home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
msumlpacka.tcl
< prev
next >
Wrap
Text File
|
1997-06-03
|
3KB
|
132 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)msumlpacka.tcl /main/hindenburg/10
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)msumlpacka.tcl /main/hindenburg/10 3 Jun 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
#require "msumleleme.tcl"
Class MSUMLPackage : {MSUMLElement} {
constructor
method destructor
method ms2ot
method promoter
method model
method elementSet
method addElement
method removeElement
attribute _model
attribute smModel
attribute _elementSet
}
constructor MSUMLPackage {class this typeName smModel} {
set this [MSUMLElement::constructor $class $this $typeName]
$this smModel $smModel
$this _elementSet [List new]
# Start constructor user section
[$this elementSet] foreach element {
$element delete
}
# End constructor user section
return $this
}
method MSUMLPackage::destructor {this} {
set ref [$this _model]
if {$ref != ""} {
[$ref _packageSet] removeValue $this
}
foreach ref [[$this _elementSet] contents] {
$ref _package ""
}
# Start destructor user section
# End destructor user section
$this MSUMLElement::destructor
}
method MSUMLPackage::ms2ot {this {diag ""} {phaseName ""} {confName ""} {confV ""}} {
set cv [[ClientContext::global] currentConfig]
set myName [$this name]
puts "Package '$myName'"
if [llength $phaseName] {
set $myName [REDiagram new [$this name] [$this name] $phaseName $phaseName ]
} else {
set $myName [REDiagram new [$this name] [$this name]]
}
set diag [set $myName]
[$this elementSet] foreach uElement {
set uType [$uElement objectType]
if {$uType == "UMLPackage"} {
$uElement ms2ot $diag $phaseName
} else {
$uElement ms2ot $diag
}
}
set tmpSaveFileName [args_file {}]
$diag save $tmpSaveFileName
set resultFileName [lindex $argv 0]
if [file exists $resultFileName] {
set resultFile [open $resultFileName a]
} else {
set resultFile [open $resultFileName w]
}
set tmpFile [open $tmpSaveFileName r]
set tmpFileResult [read $tmpFile]
puts $resultFile $tmpFileResult
close $tmpFile
close $resultFile
unlink $tmpSaveFileName
}
method MSUMLPackage::promoter {this} {
$this MSUMLElement::promoter
$this _elementSet [List new]
set noOfElements [$this getNoOfElements]
for {set i 1} {$i <= $noOfElements} {incr i} {
set umlElement [$this getElementAsUML $i]
MS[$umlElement property objectType] promote $umlElement
$this addElement $umlElement
}
}
# Do not delete this line -- regeneration end marker
method MSUMLPackage::model {this args} {
if {$args == ""} {
return [$this _model]
}
set ref [$this _model]
if {$ref != ""} {
[$ref _packageSet] removeValue $this
}
set obj [lindex $args 0]
if {$obj != ""} {
[$obj _packageSet] append $this
}
$this _model $obj
}
method MSUMLPackage::elementSet {this} {
return [$this _elementSet]
}
method MSUMLPackage::addElement {this newElement} {
[$this _elementSet] append $newElement
$newElement _package $this
}
method MSUMLPackage::removeElement {this oldElement} {
$oldElement _package ""
[$this _elementSet] removeValue $oldElement
}