home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
duallook.tcl
< prev
next >
Wrap
Text File
|
1997-08-21
|
3KB
|
124 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)duallook.tcl /main/titanic/4
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)duallook.tcl /main/titanic/4 21 Aug 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
Class DualLook : {Object} {
constructor
method destructor
method initialize
method initializeSymbolSets
method convertSymbolSet
method convertToUML
method convertToOMT
method convertSymbol
method supportedSymbolSet
# Maps diagram types to dual symbols they contain:
# symbols with a different look in OMT and UML.
#
attribute dualSymbols
# Maps diagram types to OMT only symbols they contain.
#
attribute OMTOnlySymbols
# UML or OMT
#
attribute currentLook
}
constructor DualLook {class this name} {
set this [Object::constructor $class $this $name]
# Start constructor user section
$this initialize
# End constructor user section
return $this
}
method DualLook::destructor {this} {
# Start destructor user section
# End destructor user section
}
method DualLook::initialize {this} {
if { [m4_var get M4_diagram_look] == "UML" } {
$this currentLook "UML"
} else {
$this currentLook "OMT"
}
$this OMTOnlySymbols [Dictionary new]
$this dualSymbols [Dictionary new]
$this initializeSymbolSets
}
method DualLook::initializeSymbolSets {this} {
[$this dualSymbols] set cad "loop generalization_conn overlap_gen_conn"
[$this dualSymbols] set etd "etd_initiator etd_object"
[$this dualSymbols] set std "state"
}
# Convert to symbol set for currentLook.
#
method DualLook::convertSymbolSet {this diagramType symbolSet} {
return [$this convertTo[$this currentLook] $diagramType $symbolSet]
}
# Remove OMT only symbols.
#
method DualLook::convertToUML {this diagramType symbolSet} {
foreach symbol [[$this OMTOnlySymbols] set $diagramType] {
set index [lsearch -exact $symbolSet $symbol]
if { $index != -1 } {
set symbolSet [lreplace $symbolSet $index $index]
}
}
return $symbolSet
}
# Add omt suffix to dual symbols.
#
method DualLook::convertToOMT {this diagramType symbolSet} {
foreach symbol [[$this dualSymbols] set $diagramType] {
set index [lsearch -exact $symbolSet $symbol]
if { $index != -1 } {
set symbolSet [lreplace $symbolSet $index $index "${symbol}_omt"]
}
}
return $symbolSet
}
# Remove omt suffix from symbol name.
#
method DualLook::convertSymbol {this symbol} {
regsub _omt$ $symbol "" result
return $result
}
# Remove symbols that are not supported
# by current look from symbolSet.
#
method DualLook::supportedSymbolSet {this diagramType symbolSet} {
if { [$this currentLook] == "UML" } {
return [$this convertToUML $diagramType $symbolSet]
}
return $symbolSet
}
# Do not delete this line -- regeneration end marker