home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
msumlmodel.tcl
< prev
next >
Wrap
Text File
|
1997-08-29
|
6KB
|
200 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)msumlmodel.tcl /main/titanic/2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)msumlmodel.tcl /main/titanic/2 29 Aug 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
#require "msumleleme.tcl"
Class MSUMLModel : {MSUMLElement} {
constructor
method destructor
method ot2ms
method otFeat2Ms
method otclass2ms
method otass2ms
method otgen2ms
method ms2ot
method promoter
method packageSet
method addPackage
method removePackage
attribute dictOfClasses
attribute dictOfSMModels
attribute packageForExternals
attribute transactionManager
attribute _packageSet
}
global MSUMLModel::confs
set MSUMLModel::confs ""
constructor MSUMLModel {class this typeName i_transactionManager} {
set this [MSUMLElement::constructor $class $this $typeName]
$this transactionManager $i_transactionManager
$this _packageSet [List new]
# Start constructor user section
$this dictOfClasses [Dictionary new]
if ![llength ${MSUMLModel::confs}] {
set MSUMLModel::confs [Dictionary new]
}
# End constructor user section
return $this
}
method MSUMLModel::destructor {this} {
foreach ref [[$this _packageSet] contents] {
$ref _model ""
}
# Start destructor user section
[$this packageSet] foreach package {
$package delete
}
# End destructor user section
$this MSUMLElement::destructor
}
method MSUMLModel::ot2ms {this package modelName} {
[$this transactionManager] begin
set createdPackage [$package createModel $modelName]
[$this transactionManager] commit
return $createdPackage
}
method MSUMLModel::otFeat2Ms {this classes} {
foreach msUmlClass $classes {
$msUmlClass otFeat2Ms
}
}
method MSUMLModel::otclass2ms {this smClasses smModel package sysV} {
set externals ""
set dictOfSMModels [$this dictOfSMModels]
set dictOfClasses [$this dictOfClasses]
set doneClasses ""
set msUmlPackage [MSUMLPackage new UMLPackage $smModel]
$this addPackage $msUmlPackage
foreach smClass $smClasses {
set definingSysV [$smClass getDefiningSystemVersion]
if { [$definingSysV isNil] || $definingSysV != $sysV} {
lappend externals $smClass
continue
}
set msumlClass [MSUMLClass new UMLClass $smClass ]
$msUmlPackage addElement $msumlClass
#puts "set dictOf Cla $smClass class name: [[$smClass getItem] name]"
$dictOfClasses set $smClass $msumlClass
lappend doneClasses $msumlClass
set umlClass [$msumlClass ot2ms $package]
}
$this otFeat2Ms $doneClasses
return [list $doneClasses $externals]
}
method MSUMLModel::otass2ms {this smAssocs package} {
foreach smAssoc $smAssocs {
set smClassType [SMTypeDB::find "Class"]
set smStartClass [$smAssoc getFrom $smClassType]
set smEndClass [$smAssoc getTo $smClassType]
set msAss [MSUMLAssociation new UMLAssociation $smAssoc]
set startRoleItem [$smAssoc getItem 0 role_start de]
set endRoleItem [$smAssoc getItem 0 role_end de]
set startWorkItem [$smAssoc getWorkItem 0 role_start de]
set endWorkItem [$smAssoc getWorkItem 0 role_end de]
set msStartRole [MSUMLAssRole new UMLAssociationRole $startWorkItem start $msAss $startRoleItem ]
set msEndRole [MSUMLAssRole new UMLAssociationRole $endWorkItem end $msAss $endRoleItem ]
$msStartRole type [[$this dictOfClasses] set $smStartClass]
$msEndRole type [[$this dictOfClasses] set $smEndClass]
$msAss ot2ms $package
$msStartRole ot2ms $package
$msEndRole ot2ms $package
}
}
method MSUMLModel::otgen2ms {this smGens package} {
set smGenConnType [SMTypeDB::find "CAD CB GenConn"]
set smClassType [SMTypeDB::find "Class"]
foreach smGenNode $smGens {
set smGenClass [$smGenNode getOppositeObjectsIn $smGenConnType $smClassType]
set msGenClass [[$this dictOfClasses] set $smGenClass]
foreach smSpecNode [$smGenNode getOppositeObjectsOut $smGenConnType $smClassType] {
set msGen [MSUMLGeneralization new UMLGeneralization $smGenNode]
$msGen superType $msGenClass
set msSubClass [[$this dictOfClasses] set $smSpecNode]
$msGen subType $msSubClass
$msGen ot2ms $package
}
}
}
method MSUMLModel::ms2ot {this packNo} {
set cc [ClientContext::global]
set pv [$cc currentPhase]
set phaseName [[$pv phase] name]
set modelName [$this name]
global MSUMLModel::confs
set confDict ${MSUMLModel::confs}
set noOfConfsForMe [$confDict set $modelName]
if ![llength $noOfConfsForMe] {
set noOfConfsForMe 0
}
incr noOfConfsForMe
$confDict set $modelName $noOfConfsForMe
if [llength $packNo] {
set package [[$this packageSet] index [expr $packNo - 1]]
$package ms2ot "" $phaseName $modelName $noOfConfsForMe
return
}
[$this packageSet] foreach package {
if {[[$package property msObject] property name] != "Stubs"} {
$package ms2ot "" $phaseName $modelName $noOfConfsForMe
}
}
}
method MSUMLModel::promoter {this} {
$this MSUMLElement::promoter
$this _packageSet [List new]
global MSUMLModel::confs
if ![llength ${MSUMLModel::confs}] {
set MSUMLModel::confs [Dictionary new]
}
set noOfPackages [$this getNoOfPackages]
for {set i 1} {$i <= $noOfPackages} {incr i} {
set umlPackage [$this getPackageAsUML $i]
MS[$umlPackage property objectType] promote $umlPackage
$this addPackage $umlPackage
}
}
# Do not delete this line -- regeneration end marker
method MSUMLModel::packageSet {this} {
return [$this _packageSet]
}
method MSUMLModel::addPackage {this newPackage} {
[$this _packageSet] append $newPackage
$newPackage _model $this
}
method MSUMLModel::removePackage {this oldPackage} {
$oldPackage _model ""
[$this _packageSet] removeValue $oldPackage
}