home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-05-22 | 59.2 KB | 2,453 lines |
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)header.tcl /main/hindenburg/3
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)header.tcl /main/hindenburg/3 13 Feb 1997 Copyright 1996 Cadre Technologies Inc.
-
- require "wmt_util.tcl"
- require "fstorage.tcl"
- require "rt_getset.tcl"
- require "propknowle.tcl"
- require "config.tcl"
-
- OTShRegister::importToolEdExt
-
- #--------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1997
- #
- # File: %W%
- # Author: <generated>
- #
- #--------------------------------------------------------------------------
-
- # File: @(#)rtcomp.tcl /main/hindenburg/3
- # End user added include file section
-
-
- Class RTComp : {GCObject} {
- constructor
- method destructor
- method setLabel
- method setProp
- method findLabel
- method findProp
- method getLabel
- method getProp
- method rtDiagram
- method rtLabelSet
- method addRtLabel
- method removeRtLabel
- method rtPropertySet
- method addRtProperty
- method removeRtProperty
- attribute _rtDiagram
- attribute _rtLabelSet
- attribute _rtPropertySet
- }
-
- constructor RTComp {class this rtDiagram} {
- set this [GCObject::constructor $class $this]
- $this _rtDiagram $rtDiagram
- [$rtDiagram _rtCompSet] append $this
- $this _rtLabelSet [List new]
- $this _rtPropertySet [List new]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method RTComp::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method RTComp::setLabel {this name value} {
- set lbl [$this findLabel $name]
- if {$lbl == ""} {
- set lbl [RTLabel new [$this rtDiagram]]
- $lbl name $name
- $this addRtLabel $lbl
- }
- $lbl value $value
- }
-
- method RTComp::setProp {this name value {item "comp"}} {
- switch $item {
- de {set item "name"}
- pe {set item "name"}
- cl {set item "type"}
- }
- set prop [$this findProp $name $item]
- if { $prop == "" } {
- set prop [RTProperty new]
- $prop name $name
- $prop item $item
- $this addRtProperty $prop
- }
- $prop value $value
- }
-
- method RTComp::findLabel {this name} {
- [$this rtLabelSet] foreach lbl {
- if { [$lbl name] == $name } {
- return $lbl
- }
- }
- return ""
- }
-
- method RTComp::findProp {this name {item "comp"}} {
- switch $item {
- de {set item "name"}
- pe {set item "name"}
- cl {set item "type"}
- }
- [$this rtPropertySet] foreach prop {
- if { ( [$prop name] == $name ) &&
- ( [$prop item] == $item ) } {
- return $prop
- }
- }
- return ""
- }
-
- method RTComp::getLabel {this name} {
- set lbl [$this findLabel $name]
- if {$lbl != ""} {
- return [$lbl value]
- } else {
- return ""
- }
- }
-
- method RTComp::getProp {this name {item "comp"}} {
- set prop [$this findProp $name $item]
- if {$prop != ""} {
- return [$prop value]
- } else {
- return ""
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTComp::rtDiagram {this args} {
- if {$args == ""} {
- return [$this _rtDiagram]
- }
- set ref [$this _rtDiagram]
- if {$ref != ""} {
- [$ref _rtCompSet] removeValue $this
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- [$obj _rtCompSet] append $this
- }
- $this _rtDiagram $obj
- }
-
- method RTComp::rtLabelSet {this} {
- return [$this _rtLabelSet]
- }
-
- method RTComp::addRtLabel {this newRtLabel} {
- [$this _rtLabelSet] append $newRtLabel
- $newRtLabel _rtComp $this
- }
-
- method RTComp::removeRtLabel {this oldRtLabel} {
- $oldRtLabel _rtComp ""
- [$this _rtLabelSet] removeValue $oldRtLabel
- }
-
- method RTComp::rtPropertySet {this} {
- return [$this _rtPropertySet]
- }
-
- method RTComp::addRtProperty {this newRtProperty} {
- [$this _rtPropertySet] append $newRtProperty
- $newRtProperty _rtComp $this
- }
-
- method RTComp::removeRtProperty {this oldRtProperty} {
- $oldRtProperty _rtComp ""
- [$this _rtPropertySet] removeValue $oldRtProperty
- }
-
-
- # File: @(#)rtdiagram.tcl /main/hindenburg/7
- # End user added include file section
-
-
- Class RTDiagram : {GCObject} {
- method destructor
- constructor
- method addClass
- method addNode
- method findClass
- method addConn
- method update
- method checkAccess
- method save
- method rtCompSet
- method addRtComp
- method removeRtComp
- attribute fileName
- attribute systemName
- attribute phaseName
- attribute phaseType
- attribute configName
- attribute configVersion
- attribute projectName
- attribute hasScopePhase
- attribute overwriteDiagram
- attribute _rtCompSet
- }
-
- method RTDiagram::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- constructor RTDiagram {class this fin syn phn pht con cov prn {hsp ""} {overwrite ""}} {
- set this [GCObject::constructor $class $this]
- $this _rtCompSet [List new]
-
- $this fileName $fin
- $this systemName $syn
- $this phaseName $phn
- $this phaseType $pht
- $this configName $con
- $this configVersion $cov
- $this projectName $prn
- $this hasScopePhase $hsp
- $this overwriteDiagram $overwrite
-
- return $this
- }
-
- method RTDiagram::addClass {this {name ""}} {
- set clss [RTClass new $this]
- if { $name != "" } {
- $clss setLabel "name" $name
- }
- return $clss
- }
-
- method RTDiagram::addNode {this type} {
- if {$type=="cad_class"} {
- return [$this addClass]
- }
- return ""
- }
-
- method RTDiagram::findClass {this name} {
- [$this rtCompSet] foreach comp {
- if [ $comp isA RTClass ] {
- if { [[$comp findLabel "name"] value] == $name } {
- return $comp
- }
- }
- }
- return ""
- }
-
- method RTDiagram::addConn {this type st end} {
- # for compatibility only
- return [RTComp new $this]
- }
-
- method RTDiagram::update {this} {
- [$this rtCompSet] foreach comp {
- if [$comp isA RTClass] {
- $comp update
- }
- }
- }
-
- method RTDiagram::checkAccess {this} {
- [$this rtCompSet] foreach comp {
- if [ $comp isA RTAttrib ] {
- $comp checkAccess
- }
- }
- }
-
- method RTDiagram::save {this {filename ""}} {
-
- $this update
- $this checkAccess
-
- set rtitui [RTITUserInterface new]
-
- # combine models
- [$this rtCompSet] foreach comp {
- if [$comp isA RTClass] {
- # Temporary save current levelpath
- set cc [ClientContext::global]
- set path [$cc currentLevelString]
-
- set rtitClass [RTITClass new $comp $rtitui]
-
- if {[$rtitClass go] == 0} {
- $rtitClass deleteUnUsed
- $rtitClass update
- $rtitClass save
- }
-
- $cc setLevelPath $path
- }
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTDiagram::rtCompSet {this} {
- return [$this _rtCompSet]
- }
-
- method RTDiagram::addRtComp {this newRtComp} {
- [$this _rtCompSet] append $newRtComp
- $newRtComp _rtDiagram $this
- }
-
- method RTDiagram::removeRtComp {this oldRtComp} {
- $oldRtComp _rtDiagram ""
- [$this _rtCompSet] removeValue $oldRtComp
- }
-
-
- # File: @(#)rtitattrib.tcl /main/hindenburg/8
- # End user added include file section
-
-
- Class RTITAttrib : {GCObject} {
- constructor
- method destructor
- method go
- method update
- method setBestMatch
- method setPosition
- method prev
- method next
- method clss
- attribute rtAttrib
- attribute _clss
- attribute edAttrib
- }
-
- constructor RTITAttrib {class this rtAttrib clss} {
- set this [GCObject::constructor $class $this]
- $this rtAttrib $rtAttrib
- $this _clss $clss
- [$clss _attrSet] append $this
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method RTITAttrib::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method RTITAttrib::go {this} {
- $this setBestMatch
- $this setPosition
- }
-
- method RTITAttrib::update {this} {
- # Check pre-conditions
- if {[$this edAttrib] == "" } return
-
- # Special key attribute handling
- if [[$this rtAttrib] keyAttrib] {
- if {[[$this edAttrib] getProp "nullable" name_type de] == "no"} {
- [$this rtAttrib] setProp "nullable" "no" "name"
- } else {
- if {[[$this rtAttrib] getProp "key"] != 1} {
- [$this rtAttrib] setProp "key" 1
- [$this rtAttrib] setLabel name_type \
- "*[[$this rtAttrib] getLabel name_type]"
- }
- }
- }
-
- # check the label
- # compare the items name and type and check the properties which
- # change the label
- set attribName [[$this edAttrib] getItem name_type de]
- set attribType [[$this edAttrib] getItem name_type cl]
- set type ""
- if {$attribType != ""} {
- set type [${RTITClass::langTypeTable} getTypeByStdTypeName $attribType]
- }
-
- if { $type != "" } {
- set attribType [$type name]
- }
-
- if { ([[$this rtAttrib] name] != $attribName) ||
- ([[$this rtAttrib] type] != $attribType) ||
- ([[$this rtAttrib] getProp "is_class_feature"] !=
- [[$this edAttrib] getProp "is_class_feature"]) ||
- ([[$this rtAttrib] getProp "is_derived"] !=
- [[$this edAttrib] getProp "is_derived"]) ||
- ([[$this rtAttrib] getProp "key"] !=
- [[$this edAttrib] getProp "key"]) ||
- ([[$this rtAttrib] getProp "initial_value"] !=
- [[$this edAttrib] getProp "initial_value"]) } {
-
- if {[[$this rtAttrib] type] != ""} {
- set type [${RTITClass::langTypeTable} getType [[$this rtAttrib] type]]
- if { $type != "" } {
- if [regsub "(.*)[[$this rtAttrib] type](.*)" "[[$this rtAttrib] getLabel name_type]" "\\1[$type stdTypeName]\\2" newLabel] {
- [$this rtAttrib] setLabel name_type $newLabel
- }
- }
- }
-
- if {[[[$this clss] ui] attribUpdateLabel $this] == "yes"} {
- [$this edAttrib] setLabel name_type \
- "[[$this rtAttrib] getLabel name_type]"
- }
- }
- # check all known properties
- # known properties are properties which have been defined by the
- # parser which gave us our input
- [[$this rtAttrib] rtPropertySet] foreach prop {
- set name [$prop name]
- switch $name {
- "is_class_feature" continue
- "is_derived" continue
- "key" continue
- "initial_value" continue
- }
- set item [$prop item]
- switch $item {
- "name" { set itlbl "name_type" ; set ititem "de" }
- "type" { set itlbl "name_type" ; set ititem "cl" }
- "comp" { set itlbl "" ; set ititem "" }
- }
- set value [$prop value]
- set itvalue [[$this edAttrib] getProp $name $itlbl $ititem]
- if { $itvalue == "" } {
- set itvalue [PropKnowledge::getDefaultValue $name]
- }
- if { $itvalue != $value } {
- if {[[[$this clss] ui] attribUpdateProp $this $name $item] == "yes"} {
- [$this edAttrib] setProp $name $value $itlbl $ititem
- }
- }
- }
- }
-
- method RTITAttrib::setBestMatch {this} {
- [[$this clss] unUsedAttribSet] foreach attr {
- if { [$attr getItem name_type de] == [[$this rtAttrib] name] } {
- # found an attribute with the same name.
- # only one attribute with a specific name can
- # exists at one time, so this is the one.
- $this edAttrib $attr
- [[$this clss] unUsedAttribSet] removeValue $attr
- return
- }
- }
- # attribute was not found
- # create a new attribute
- if {[[[$this clss] ui] attribAdd $this] == "yes"} {
- set newAttr [[[$this clss] edMatrix] addRow "attribute"]
- $this edAttrib $newAttr
- $newAttr setLabel name_type [[$this rtAttrib] getLabel name_type]
- [[$this rtAttrib] rtPropertySet] foreach prop {
- set name [$prop name]
- switch $name {
- "is_class_feature" continue
- "is_derived" continue
- "key" continue
- "initial_value" continue
- }
- set item [$prop item]
- switch $item {
- "name" { set itlbl "name_type" ; set ititem "de" }
- "type" { set itlbl "name_type" ; set ititem "cl" }
- "comp" { set itlbl "" ; set ititem "" }
- }
- set value [$prop value]
- $newAttr setProp $name $value $itlbl $ititem
- }
- } else {
- $this edAttrib ""
- }
- }
-
- method RTITAttrib::setPosition {this} {
- if {[$this edAttrib] == ""} return
- set prev [$this prev]
- if { $prev != "" } {
- # not the first one, so move
- if { [$prev edAttrib] != "" } {
- [$this edAttrib] moveBehind [$prev edAttrib]
- }
- }
- }
-
- method RTITAttrib::prev {this} {
- # Look for myself and sub one to the index
- set idx [[[$this clss] attrSet] search -exact $this]
- if { $idx == -1 } {
- return ""
- } else {
- set previdx [expr $idx - 1]
- if { $previdx != -1 } {
- return [[[$this clss] attrSet] index $previdx]
- } else {
- return ""
- }
- }
- }
-
- method RTITAttrib::next {this} {
- # Look for myself and add one to the index
- set idx [[[$this clss] attrSet] search -exact $this]
- if { $idx == -1 } {
- return ""
- } else {
- set nextidx [expr $idx + 1]
- if { $nextidx < [[[$this clss] attrSet] length] } {
- return [[[$this clss] attrSet] index $nextidx]
- } else {
- return ""
- }
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTITAttrib::clss {this args} {
- if {$args == ""} {
- return [$this _clss]
- }
- set ref [$this _clss]
- if {$ref != ""} {
- [$ref _attrSet] removeValue $this
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- [$obj _attrSet] append $this
- }
- $this _clss $obj
- }
-
-
- # File: @(#)rtitclass.tcl /main/hindenburg/12
- # End user added include file section
-
-
- Class RTITClass : {GCObject} {
- constructor
- method destructor
- method go
- method update
- method deleteUnUsed
- method save
- method createLists
- method addUnUsedAttrib
- method removeUnUsedAttrib
- method attrSet
- method addAttr
- method removeAttr
- method mthdSet
- method addMthd
- method removeMthd
- method addUnUsedMethod
- method removeUnUsedMethod
- attribute rtClass
- attribute unUsedAttribSet
- attribute _attrSet
- attribute _mthdSet
- attribute ui
- attribute edMatrix
- attribute unUsedMethodSet
- }
-
- global RTITClass::langTypeTable
- set RTITClass::langTypeTable ""
-
-
- constructor RTITClass {class this rtClass ui} {
- set this [GCObject::constructor $class $this]
- $this rtClass $rtClass
- $this ui $ui
- $this unUsedAttribSet [List new]
- $this _attrSet [List new]
- $this _mthdSet [List new]
- $this unUsedMethodSet [List new]
- # Start constructor user section
-
- if {${RTITClass::langTypeTable} == ""} {
- global RTITClass::langTypeTable
- set RTITClass::langTypeTable [LangTypeTable::createTable]
- }
-
- [[$this rtClass] rtAttribSet] foreach attr {
- if { [$attr section] == "user-defined-attribute" } {
- RTITAttrib new $attr $this
- }
- }
-
- [[$this rtClass] rtMethodSet] foreach mthd {
- if { [$mthd section] == "user-defined-method" } {
- RTITMethod new $this $mthd
- }
- }
-
- # End constructor user section
- return $this
- }
-
- method RTITClass::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method RTITClass::go {this} {
-
- # find out CDM name with some help of fstorage
- # (if we still know the file name)
- set CDMname ""
- set fileName [[$this rtClass] getProp include_list type]
- if {$fileName != "" } {
- set CDMname [fstorage::get_imp_from $fileName]
- }
- if { $CDMname == "" } {
- # Last resort
- set CDMname [[$this rtClass] name]
- }
-
- # Check if this class has a CDM
- # if no CDM exists, we should not try to roundtrip this file
- set cc [ClientContext::global]
- set levelPath "/[[$cc currentCorporate] name]"
- if {[$diag projectName] != ""} {
- set levelPath "${levelPath}/[$diag projectName]"
- } else {
- set levelPath "${levelPath}/[[$cc currentProject] name]"
- }
- if {[$diag configName] != ""} {
- set levelPath "${levelPath}/[$diag configName]"
- } else {
- set levelPath "${levelPath}/[[[$cc currentConfig] config] name]"
- }
- if {[$diag configVersion] != ""} {
- set levelPath "${levelPath}:[$diag configVersion]"
- } else {
- set levelPath "${levelPath}:[[$cc currentConfig] versionNumber]"
- }
- if {[$diag phaseName] != ""} {
- set levelPath "${levelPath}/[$diag phaseName]"
- } else {
- set levelPath "${levelPath}/[[[$cc currentPhase] phase] name]"
- }
- if {[$diag phaseType] != ""} {
- set levelPath "${levelPath}.[$diag phaseType]"
- } else {
- set levelPath "${levelPath}.[[[$cc currentPhase] phase] type]"
- }
- if {[$diag systemName] != ""} {
- set levelPath "${levelPath}/[$diag systemName].system"
- } else {
- set levelPath "${levelPath}/[[[$cc currentSystem] system] name].system"
- }
-
- set prop [[$this rtClass] getProp "is_folded" comp]
- if {$prop != ""} {
- if { $prop == "1" } {
- $this edMatrix ""
- return 1
- }
- }
-
- $cc setLevelPath $levelPath
- set sysV [$cc currentSystem]
- set item [[$cc currentProject] findItem $CDMname cl]
- if {$item != "" && ![$item isNil]} {
- $sysV getDecompositions $item [$cc currentConfig] decompFiles \
- {cdm} resultSystems resultFiles
- if {[lempty $resultFiles]} {
- puts "Warning: CDM ($CDMname) not found, roundtrip skipped..."
- return 1
- }
- } else {
- puts "Warning: CDM ($CDMname) not found, roundtrip skipped..."
- return 1
- }
-
- set diag [[$this rtClass] rtDiagram]
- set newEdCDM [EdCDM new $CDMname \
- "[$diag systemName]" "[$diag phaseName]" \
- "[$diag phaseType]" "[$diag configName]" \
- "[$diag configVersion]" "[$diag projectName]" \
- "[$diag hasScopePhase]" "[$diag overwriteDiagram]"]
-
- $this edMatrix $newEdCDM
-
- $this createLists
- [$this attrSet] foreach attr {
- $attr go
- }
- [$this mthdSet] foreach mthd {
- $mthd go
- }
- return 0
- }
-
- method RTITClass::update {this} {
- if {[$this edMatrix] == ""} return
- [$this attrSet] foreach attr {
- $attr update
- }
- [$this mthdSet] foreach mthd {
- $mthd update
- }
- [$this edMatrix] formatLayout
- }
-
- method RTITClass::deleteUnUsed {this} {
- if {[$this edMatrix] == ""} return
- [$this unUsedAttribSet] foreach attr {
- if {[[$this ui] attribDelete $this [$attr getItem name_type de]] == "yes"} {
- [$this edMatrix] deleteRow $attr
- }
- }
- [$this unUsedMethodSet] foreach mthd {
- # Check if this is the default ctor
- # if so, don't remove it
- if {[$mthd getItem name_type pe] != "create" ||
- ![$mthd getProp is_class_feature] ||
- [llength [$mthd getCells]] != 0} {
- if {[[$this ui] methodDelete $this \
- [$mthd getItem name_type pe]] == "yes"} {
- [$this edMatrix] deleteRow $mthd
- }
- }
- }
- [$this mthdSet] foreach mthd {
- $mthd deleteUnUsed
- }
- }
-
- method RTITClass::save {this} {
- if {[$this edMatrix] == ""} return
- if {[[$this ui] classSave $this] == "yes"} {
- [$this edMatrix] save
- } else {
- [$this edMatrix] quit
- }
- }
-
- method RTITClass::createLists {this} {
- if {[$this edMatrix] == ""} return
- foreach row [[$this edMatrix] getRows] {
- switch [$row getType] {
- "attribute" { $this addUnUsedAttrib $row }
- "method" { $this addUnUsedMethod $row }
- }
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTITClass::addUnUsedAttrib {this newUnUsedAttrib} {
- [$this unUsedAttribSet] append $newUnUsedAttrib
-
- }
-
- method RTITClass::removeUnUsedAttrib {this oldUnUsedAttrib} {
- [$this unUsedAttribSet] removeValue $oldUnUsedAttrib
- }
-
- method RTITClass::attrSet {this} {
- return [$this _attrSet]
- }
-
- method RTITClass::addAttr {this newAttr} {
- [$this _attrSet] append $newAttr
- $newAttr _clss $this
- }
-
- method RTITClass::removeAttr {this oldAttr} {
- $oldAttr _clss ""
- [$this _attrSet] removeValue $oldAttr
- }
-
- method RTITClass::mthdSet {this} {
- return [$this _mthdSet]
- }
-
- method RTITClass::addMthd {this newMthd} {
- [$this _mthdSet] append $newMthd
- $newMthd _clss $this
- }
-
- method RTITClass::removeMthd {this oldMthd} {
- $oldMthd _clss ""
- [$this _mthdSet] removeValue $oldMthd
- }
-
- method RTITClass::addUnUsedMethod {this newUnUsedMethod} {
- [$this unUsedMethodSet] append $newUnUsedMethod
-
- }
-
- method RTITClass::removeUnUsedMethod {this oldUnUsedMethod} {
- [$this unUsedMethodSet] removeValue $oldUnUsedMethod
- }
-
-
- # File: @(#)rtitmethod.tcl /main/hindenburg/6
- # End user added include file section
-
-
- Class RTITMethod : {GCObject} {
- constructor
- method destructor
- method go
- method update
- method deleteUnUsed
- method createList
- method setBestMatch
- method setPosition
- method prev
- method next
- method clss
- method paramSet
- method addParam
- method removeParam
- method addUnUsedParam
- method removeUnUsedParam
- attribute _clss
- attribute rtMethod
- attribute _paramSet
- attribute edMethod
- attribute unUsedParamSet
- }
-
- constructor RTITMethod {class this clss rtMethod} {
- set this [GCObject::constructor $class $this]
- $this _clss $clss
- [$clss _mthdSet] append $this
- $this rtMethod $rtMethod
- $this _paramSet [List new]
- $this unUsedParamSet [List new]
- # Start constructor user section
-
- [[$this rtMethod] rtParamSet] foreach param {
- RTITParam new $this $param
- }
-
- # End constructor user section
- return $this
- }
-
- method RTITMethod::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method RTITMethod::go {this} {
- $this setBestMatch
- $this setPosition
-
- $this createList
- [$this paramSet] foreach param {
- $param go
- }
- }
-
- method RTITMethod::update {this} {
- if {[$this edMethod] == ""} return
- # check the name_type label
- # compare the items and all properties which change the label
-
- set methodName [[$this edMethod] getItem name_type pe]
- set methodType [[$this edMethod] getItem name_type cl]
- set type ""
- if {$methodType != ""} {
- set type [${RTITClass::langTypeTable} getTypeByStdTypeName $methodType]
- }
-
- if { $type != "" } {
- set methodType [$type name]
- }
-
- if { ([[$this rtMethod] name] != $methodName) ||
- ([[$this rtMethod] type] != $methodType) ||
- ([[$this rtMethod] getProp "is_class_feature"] !=
- [[$this edMethod] getProp "is_class_feature"]) ||
- ([[$this rtMethod] getProp "is_abstract"] !=
- [[$this edMethod] getProp "is_abstract"])} {
-
- if {[[$this rtMethod] type] != $methodType} {
- if {[[$this rtMethod] type] != ""} {
- set type [${RTITClass::langTypeTable} getType [[$this rtMethod] type]]
- if { $type != "" } {
- if [regsub "(.*)[[$this rtMethod] type](.*)" "[[$this rtMethod] getLabel name_type]" "\\1[$type stdTypeName]\\2" newLabel] {
- [$this rtMethod] setLabel name_type $newLabel
- }
- }
- }
- }
-
- if {[[[$this clss] ui] methodUpdateLabel $this] == "yes"} {
- [$this edMethod] setLabel name_type \
- [[$this rtMethod] getLabel name_type]
- }
- }
- # check all known properties
- # known properties are properties which have been defined by the
- # parser which gave us our input
- [[$this rtMethod] rtPropertySet] foreach prop {
- set name [$prop name]
- switch $name {
- "is_class_feature" continue
- "is_abstract" continue
- }
-
- set item [$prop item]
- switch $item {
- "name" { set itlbl "name_type" ; set ititem "pe" }
- "type" { set itlbl "name_type" ; set ititem "cl" }
- "comp" { set itlbl "" ; set ititem "" }
- }
- set value [$prop value]
- set itvalue [[$this edMethod] getProp $name $itlbl $ititem]
- if { $itvalue == "" } {
- set itvalue [PropKnowledge::getDefaultValue $name]
- }
- if { $itvalue != $value } {
- if {[[[$this clss] ui] methodUpdateProp $this $name $item] == "yes"} {
- [$this edMethod] setProp $name $value $itlbl $ititem
- }
- }
- }
-
- [$this paramSet] foreach param {
- $param update
- }
-
- [$this edMethod] formatLayout
-
- }
-
- method RTITMethod::deleteUnUsed {this} {
- if {[$this edMethod] == ""} return
- [$this unUsedParamSet] foreach param {
- if {[[[$this clss] ui] paramDelete $this [$param getItem name_type de]] == "yes"} {
- [$this edMethod] deleteCell $param
- }
- }
- }
-
- method RTITMethod::createList {this} {
- if {[$this edMethod] == ""} return
- foreach cell [[$this edMethod] getCells] {
- $this addUnUsedParam $cell
- }
- }
-
- method RTITMethod::setBestMatch {this} {
- # this is the most tricky method.
- # methods are the same if the signature is the same, this
- # means that we should determine the signature of the
- # methods from the it and rt models, compare these and
- # it they match use that one. if they don't match use
- # the first method with the same name (warning: this makes
- # re-ordering of methods dangerous)
-
- # a signature consists of the name, type and parameters
- # (with their names, types and ordering).
-
- # calc signature of RT method
- set signatureRt "[[$this rtMethod] name]:[[$this rtMethod] type]"
- [[$this rtMethod] rtParamSet] foreach param {
- set signatureRt "$signatureRt:[$param name]:[$param type]"
- }
-
- [[$this clss] unUsedMethodSet] foreach mthd {
- # calc signature of IT method
- set signatureEd "[$mthd getItem name_type pe]"
- set signatureEd "$signatureEd:[$mthd getItem name_type cl]"
- foreach cell [$mthd getCells] {
- set signatureEd "$signatureEd:[$cell getItem name_type de]"
- set signatureEd "$signatureEd:[$cell getItem name_type cl]"
- }
-
- if { $signatureRt == $signatureEd } {
- # found a matching signature
- $this edMethod $mthd
- [[$this clss] unUsedMethodSet] removeValue $mthd
- return
- }
- }
-
- # no matching signature found, so try to find a method with the same name
- [[$this clss] unUsedMethodSet] foreach mthd {
- if { [$mthd getItem "name_type" "pe"] == [[$this rtMethod] name] } {
- # found a matching name (signatures don't match)
- $this edMethod $mthd
- [[$this clss] unUsedMethodSet] removeValue $mthd
- return
- }
- }
-
- # no matching name found either, so create a new method
- if {[[[$this clss] ui] methodAdd $this] == "yes"} {
- set newMethod [[[$this clss] edMatrix] addRow "method"]
- $this edMethod $newMethod
- $newMethod setLabel name_type [[$this rtMethod] getLabel name_type]
- [[$this rtMethod] rtPropertySet] foreach prop {
- set name [$prop name]
- switch $name {
- "is_class_feature" continue
- "is_abstract" continue
- }
-
- set item [$prop item]
- switch $item {
- "name" { set itlbl "name_type" ; set ititem "pe" }
- "type" { set itlbl "name_type" ; set ititem "cl" }
- "comp" { set itlbl "name_type" ; set ititem "" }
- }
- set value [$prop value]
- $newMethod setProp $name $value $itlbl $ititem
- }
- } else {
- $this edMethod ""
- }
- }
-
- method RTITMethod::setPosition {this} {
- if {[$this edMethod] == ""} return
- set prev [$this prev]
- if { $prev != "" } {
- # not the first one, so move
- if { [$prev edMethod] != ""} {
- [$this edMethod] moveBehind [$prev edMethod]
- }
- }
- }
-
- method RTITMethod::prev {this} {
- # Look for myself and sub one to the index
- set idx [[[$this clss] mthdSet] search -exact $this]
- if { $idx == -1 } {
- return ""
- } else {
- set previdx [expr $idx - 1]
- if { $previdx != -1 } {
- return [[[$this clss] mthdSet] index $previdx]
- } else {
- return ""
- }
- }
- }
-
- method RTITMethod::next {this} {
- # Look for myself and add one to the index
- set idx [[[$this clss] mthdSet] search -exact $this]
- if { $idx == -1 } {
- return ""
- } else {
- set nextidx [expr $idx + 1]
- if { $nextidx < [[[$this clss] mthdSet] length] } {
- return [[[$this clss] mthdSet] index $nextidx]
- } else {
- return ""
- }
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTITMethod::clss {this args} {
- if {$args == ""} {
- return [$this _clss]
- }
- set ref [$this _clss]
- if {$ref != ""} {
- [$ref _mthdSet] removeValue $this
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- [$obj _mthdSet] append $this
- }
- $this _clss $obj
- }
-
- method RTITMethod::paramSet {this} {
- return [$this _paramSet]
- }
-
- method RTITMethod::addParam {this newParam} {
- [$this _paramSet] append $newParam
- $newParam _mthd $this
- }
-
- method RTITMethod::removeParam {this oldParam} {
- $oldParam _mthd ""
- [$this _paramSet] removeValue $oldParam
- }
-
- method RTITMethod::addUnUsedParam {this newUnUsedParam} {
- [$this unUsedParamSet] append $newUnUsedParam
-
- }
-
- method RTITMethod::removeUnUsedParam {this oldUnUsedParam} {
- [$this unUsedParamSet] removeValue $oldUnUsedParam
- }
-
-
- # File: @(#)rtitparam.tcl /main/hindenburg/7
- # End user added include file section
-
-
- Class RTITParam : {GCObject} {
- constructor
- method destructor
- method go
- method update
- method setBestMatch
- method setPosition
- method prev
- method next
- method mthd
- attribute _mthd
- attribute rtParam
- attribute edParam
- }
-
- constructor RTITParam {class this mthd rtParam} {
- set this [GCObject::constructor $class $this]
- $this _mthd $mthd
- [$mthd _paramSet] append $this
- $this rtParam $rtParam
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method RTITParam::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method RTITParam::go {this} {
- $this setBestMatch
- $this setPosition
- }
-
- method RTITParam::update {this} {
- if {[$this edParam] == ""} return
- if {[$this mthd] == ""} return
- if {[[$this mthd] clss] == ""} return
-
- # compare the name and type item of each parameter
- set paramName [[$this edParam] getItem name_type de]
- set paramType [[$this edParam] getItem name_type cl]
- set type ""
- if { $paramType != "" } {
- set type [${RTITClass::langTypeTable} getTypeByStdTypeName $paramType]
- }
-
- if { $type != "" } {
- set paramType [$type name]
- }
-
- if { ([[$this rtParam] name] != $paramName) ||
- ([[$this rtParam] type] != $paramType)} {
-
- if {[[$this rtParam] type] != $paramType} {
- if {[[$this rtParam] type] == ""} {
- set type [${RTITClass::langTypeTable} getType [[$this rtParam] type]]
- if { $type != "" } {
- if [regsub "(.*)[[$this rtParam] type](.*)" [[$this rtParam] getLabel name_type] "\\1[$type stdTypeName]\\2" newLabel] {
- [$this rtParam] setLabel name_type $newLabel
- }
- }
- }
- }
-
- if {[[[[$this mthd] clss] ui] paramUpdateLabel $this] == "yes"} {
- [$this edParam] setLabel name_type \
- [[$this rtParam] getLabel name_type]
- }
- }
- # check all known properties
- # known properties are properties which have been defined by the
- # parser which gave us our input
- [[$this rtParam] rtPropertySet] foreach prop {
- set item [$prop item]
- switch $item {
- "name" { set itlbl "name_type" ; set ititem "de" }
- "type" { set itlbl "name_type" ; set ititem "cl" }
- "comp" { set itlbl "" ; set ititem "" }
- }
- set name [$prop name]
- set value [$prop value]
- set itvalue [[$this edParam] getProp $name $itlbl $ititem]
- if { $itvalue == "" } {
- set itvalue [PropKnowledge::getDefaultValue $name]
- }
- if { $itvalue != $value } {
- if {[[[[$this mthd] clss] ui] paramUpdateProp $this $name $item] == "yes"} {
- [$this edParam] setProp $name $value $itlbl $ititem
- }
- }
- }
- }
-
- method RTITParam::setBestMatch {this} {
- if {[$this rtParam] == ""} return
- if {[$this mthd] == ""} return
- if {[[$this mthd] clss] == ""} return
- if {[[$this mthd] edMethod] == ""} return
-
- [[$this mthd] unUsedParamSet] foreach param {
- if { [$param getItem name_type de] == [[$this rtParam] name] } {
- # found a parameter with the same name.
- # most languages don't support multiple parameters
- # with the same name, but if there is a language,
- # we will simply take the first one found.
- $this edParam $param
- [[$this mthd] unUsedParamSet] removeValue $param
- return
- }
- }
- # attribute was not found
- # create a new attribute
- if {[[[[$this mthd] clss] ui] paramAdd $this] == "yes"} {
- set newParam [[[$this mthd] edMethod] addCell "parameter"]
- $this edParam $newParam
- $newParam setLabel name_type [[$this rtParam] getLabel name_type]
- [[$this rtParam] rtPropertySet] foreach prop {
- set item [$prop item]
- switch $item {
- "name" { set itlbl "name_type" ; set ititem "de" }
- "type" { set itlbl "name_type" ; set ititem "cl" }
- "comp" { set itlbl "" ; set ititem "" }
- }
- set name [$prop name]
- set value [$prop value]
- set itvalue [[$this edParam] getProp $name $itlbl $ititem]
- $newParam setProp $name $value $itlbl $ititem
- }
- } else {
- $this edParam ""
- }
- }
-
- method RTITParam::setPosition {this} {
- if {[$this edParam] == ""} return
- set prev [$this prev]
- if { $prev != "" } {
- # not the first one, so move
- if { [$prev edParam] != "" } {
- [$this edParam] moveBehind [$prev edParam]
- }
- }
- }
-
- method RTITParam::prev {this} {
- # Look for myself and sub one to the index
- set idx [[[$this mthd] paramSet] search -exact $this]
- if { $idx == -1 } {
- return ""
- } else {
- set previdx [expr $idx - 1]
- if { $previdx != -1 } {
- return [[[$this mthd] paramSet] index $previdx]
- } else {
- return ""
- }
- }
- }
-
- method RTITParam::next {this} {
- # Look for myself and add one to the index
- set idx [[[$this mthd] paramSet] search -exact $this]
- if { $idx == -1 } {
- return ""
- } else {
- set nextidx [expr $idx + 1]
- if { $nextidx < [[[$this mthd] paramSet] length] } {
- return [[[$this mthd] paramSet] index $nextidx]
- } else {
- return ""
- }
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTITParam::mthd {this args} {
- if {$args == ""} {
- return [$this _mthd]
- }
- set ref [$this _mthd]
- if {$ref != ""} {
- [$ref _paramSet] removeValue $this
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- [$obj _paramSet] append $this
- }
- $this _mthd $obj
- }
-
-
- # File: @(#)rtituserin.tcl /main/hindenburg/8
- # End user added include file section
-
-
- Class RTITUserInterface : {GCObject} {
- constructor
- method destructor
- method attribUpdateLabel
- method attribUpdateProp
- method attribDelete
- method attribAdd
- method methodUpdateLabel
- method methodUpdateProp
- method methodDelete
- method methodAdd
- method paramUpdateLabel
- method paramUpdateProp
- method paramDelete
- method paramAdd
- method classSave
- method getPropName
- method askQuestion
- attribute configuration
- attribute changes
- }
-
- constructor RTITUserInterface {class this} {
- set this [GCObject::constructor $class $this]
- # Start constructor user section
-
- $this configuration [Dictionary new]
- $this changes 0
-
- set clientContext [ClientContext::global]
- set config [args_file {}]
- $clientContext downLoadCustomFile roundtrip roundtrip etc $config
- set configList [readConfigurationFile $config]
- unlink $config
-
- foreach configLine $configList {
- set key "[lindex $configLine 0]-[lindex $configLine 1]"
- set value "[lindex $configLine 2] [lindex $configLine 3]"
- [$this configuration] set $key $value
- }
- # End constructor user section
- return $this
- }
-
- method RTITUserInterface::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- method RTITUserInterface::attribUpdateLabel {this attr} {
- set conf [[$this configuration] set "attribute-change_label"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName [[[$attr clss] rtClass] name]
- set attrNLbl [[$attr rtAttrib] getLabel name_type]
- regsub -all "\n" [[$attr edAttrib] getLabel name_type] "" attrOLbl
-
- puts -nonewline "In class \"$clssName\": change attribute "
- puts "\"$attrOLbl\" into \"$attrNLbl\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::attribUpdateProp {this attr propName propItem} {
- set conf [[$this configuration] set "attribute-change_property"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName [[[$attr clss] rtClass] name]
- regsub -all "\n" [[$attr edAttrib] getLabel "name_type"] "" attrName
- set attrNProp [[$attr rtAttrib] getProp $propName $propItem ]
- switch $propItem {
- "name" { set itlbl "name_type" ; set ititem "de" }
- "type" { set itlbl "name_type" ; set ititem "cl" }
- "comp" { set itlbl "" ; set ititem "" }
- }
- set attrOProp [[$attr edAttrib] getProp $propName $itlbl $ititem]
-
- set fullPropName [$this getPropName $propName]
-
- puts -nonewline "In class \"$clssName\": change property "
- puts -nonewline "\"$fullPropName\" of attribute \"$attrName\" "
- puts "from \"$attrOProp\" into \"$attrNProp\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::attribDelete {this clss attribName} {
- set conf [[$this configuration] set "attribute-delete"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName [[$clss rtClass] name]
-
- puts -nonewline "In class \"$clssName\": delete attribute "
- puts "\"$attribName\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::attribAdd {this attr} {
- set conf [[$this configuration] set "attribute-add"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName [[[$attr clss] rtClass] name]
- set attrName [[$attr rtAttrib] getLabel "name_type"]
-
- puts -nonewline "In class \"$clssName\": add attribute "
- puts "\"$attrName\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::methodUpdateLabel {this mthd} {
- set conf [[$this configuration] set "method-change_label"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName [[[$mthd clss] rtClass] name]
- set mthdNLbl [[$mthd rtMethod] getLabel name_type]
- regsub -all "\n" [[$mthd edMethod] getLabel name_type] "" mthdOLbl
-
- puts -nonewline "In class \"$clssName\": change method "
- puts "\"$mthdOLbl\" into \"$mthdNLbl\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::methodUpdateProp {this mthd propName propItem} {
- set conf [[$this configuration] set "method-change_property"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName [[[$mthd clss] rtClass] name]
- regsub -all "\n" [[$mthd edMethod] getLabel "name_type"] "" mthdName
- set mthdNProp [[$mthd rtMethod] getProp $propName $propItem]
- switch $propItem {
- "name" { set itlbl "name_type" ; set ititem "pe" }
- "type" { set itlbl "name_type" ; set ititem "cl" }
- "comp" { set itlbl "" ; set ititem "" }
- }
- set mthdOProp [[$mthd edMethod] getProp $propName $itlbl $ititem]
-
- set fullPropName [$this getPropName $propName]
-
- puts -nonewline "In class \"$clssName\": change property "
- puts -nonewline "\"$fullPropName\" of method \"$mthdName\" "
- puts "from \"$mthdOProp\" into \"$mthdNProp\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::methodDelete {this clss methodName} {
- set conf [[$this configuration] set "method-delete"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName [[$clss rtClass] name]
-
- puts -nonewline "In class \"$clssName\": delete method "
- puts "\"$methodName\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::methodAdd {this mthd} {
- set conf [[$this configuration] set "method-add"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName [[[$mthd clss] rtClass] name]
- set mthdName [[$mthd rtMethod] getLabel "name_type"]
-
- puts -nonewline "In class \"$clssName\": add method "
- puts "\"$mthdName\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::paramUpdateLabel {this param} {
- set conf [[$this configuration] set "parameter-change_label"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName [[[[$param mthd] clss] rtClass] name]
- set methodName [[[$param mthd] rtMethod] name]
- set paramNLbl [[$param rtParam] getLabel name_type]
- regsub -all "\[\t\n, \]" [[$param edParam] getLabel name_type] "" paramOLbl
-
- puts -nonewline "In class \"$clssName\", change parameter "
- puts -nonewline "of method \"$methodName\" from "
- puts "\"$paramOLbl\" into \"$paramNLbl\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::paramUpdateProp {this param propName propItem} {
- set conf [[$this configuration] set "parameter-change_property"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName [[[[$param mthd] clss] rtClass] name]
- set methodName [[[$param mthd] rtMethod] name]
- regsub -all "\[\t \n,\]" [[$param edParam] getLabel "name_type"] "" paramName
- set paramNProp [[$param rtParam] getProp $propName $propItem]
- switch $propItem {
- "name" { set itlbl "name_type" ; set ititem "de" }
- "type" { set itlbl "name_type" ; set ititem "cl" }
- "comp" { set itlbl "" ; set ititem "" }
- }
- set paramOProp [[$param edParam] getProp $propName $itlbl $ititem]
-
- set fullPropName [$this getPropName $propName]
-
- puts -nonewline "In class \"$clssName\", method \"$methodName\""
- puts -nonewline " change property \"$fullPropName\" of parameter "
- puts -nonewline "\"$paramName\" from \"$paramOProp\" "
- puts "into \"$paramNProp\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::paramDelete {this mthd paramName} {
- set conf [[$this configuration] set "parameter-delete"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName "[[[$mthd clss] rtClass] name]"
- set methodName [[$mthd rtMethod] name]
-
- puts -nonewline "In class \"$clssName\", method \"$methodName\""
- puts ": delete parameter \"$paramName\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::paramAdd {this param} {
- set conf [[$this configuration] set "parameter-add"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- set answer $defAnswer
- if {($do == "ask") || ($do == "display")} {
- set clssName [[[[$param mthd] clss] rtClass] name]
- set methodName [[[$param mthd] rtMethod] name]
- set paramName [[$param rtParam] getLabel "name_type"]
-
- puts -nonewline "In class \"$clssName\", method \"$methodName\""
- puts ": add parameter \"$paramName\""
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- if { $answer == "yes" } {
- $this changes [expr [$this changes] + 1]
- }
- return $answer
- }
-
- method RTITUserInterface::classSave {this clss} {
- if { [$this changes] == 0} {
- puts "No changes..."
- return "no"
- }
-
- set conf [[$this configuration] set "class-save"]
- if {$conf == ""} {
- set do "ask"
- set defAnswer "yes"
- } else {
- set do [lindex $conf 0]
- set defAnswer [lindex $conf 1]
- }
-
- if {($do == "ask") || ($do == "display")} {
- set clssName [[$clss rtClass] name]
-
- puts "Save class \"$clssName\" and accept all changes"
-
- if {$do == "ask"} {
- set answer [$this askQuestion $defAnswer]
- if {$answer != "yes"} {
- puts "Abandoning all changes..."
- }
- return $answer
- } else {
- if {$defAnswer != "yes"} {
- puts "Skipped..."
- }
- }
- }
- return $defAnswer
- }
-
- method RTITUserInterface::getPropName {this shortName} {
- return [PropKnowledge::getLongName $shortName]
- }
-
- method RTITUserInterface::askQuestion {this {defaultAnswer "yes"}} {
- puts -nonewline \
- "Are you sure (y/n) \[[string index $defaultAnswer 0]\] ?"
-
- set answer [gets stdin]
-
- if {[string toupper [string index $answer 0]] == "N"} {
- return "no"
- }
-
- if {[string toupper [string index $answer 0]] == "Y"} {
- return "yes"
- }
-
- return $defaultAnswer
- }
-
- # Do not delete this line -- regeneration end marker
-
-
- # File: @(#)rtproperty.tcl /main/hindenburg/1
-
-
- Class RTProperty : {GCObject} {
- constructor
- method destructor
- method rtComp
- attribute name
- attribute value
- attribute item
- attribute _rtComp
- }
-
- constructor RTProperty {class this} {
- set this [GCObject::constructor $class $this]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method RTProperty::destructor {this} {
- # Start destructor user section
- # End destructor user section
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTProperty::rtComp {this args} {
- if {$args == ""} {
- return [$this _rtComp]
- }
- set ref [$this _rtComp]
- if {$ref != ""} {
- [$ref _rtPropertySet] removeValue $this
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- [$obj _rtPropertySet] append $this
- }
- $this _rtComp $obj
- }
-
-
- # File: @(#)rtattrib.tcl /main/hindenburg/5
-
-
- Class RTAttrib : {RTComp} {
- constructor
- method destructor
- method update
- method checkAccess
- method rtClass
- attribute section
- attribute mods
- attribute name
- attribute type
- attribute initValue
- attribute keyAttrib
- attribute _rtClass
- }
-
- constructor RTAttrib {class this rtDiagram} {
- set this [RTComp::constructor $class $this $rtDiagram]
- # Start constructor user section
- $this keyAttrib 0
- # End constructor user section
- return $this
- }
-
- method RTAttrib::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this RTComp::destructor
- }
-
- method RTAttrib::update {this} {
- set lbl [$this findLabel "name_type"]
- if {$lbl != ""} {
- if [regexp \
- "(\[ \t\]*)(\[\\\$/*\]*)(\[ \t\]*)(\[^:= \t\]+)(\[: \t\]*)(\[^= \t\]+)?(\[ \t\]*)(=.*)?\$" \
- [$lbl value] discard ws0 mods ws1 name point type ws2 initval] {
- $this mods $mods
- $this name $name
- $this type $type
-
- if [regexp "(\[ \t=\]*)(.*)" $initval discard assign val] {
- $this initValue $val
- } else {
- $this initValue $initval
- }
-
- $this setProp "initial_value" [$this initValue]
-
- if [regexp {\$} $mods] {
- $this setProp "is_class_feature" "1"
- }
- if [regexp {/} $mods] {
- $this setProp "is_derived" "1"
- }
- if [regexp {[*]} $mods] {
- $this setProp "key" "1"
- } else {
- # Look for a default constructor with this attrib as param
- [[$this rtClass] rtMethodSet] foreach mthd {
- if { [$mthd section] == "default-constructor-destructor" &&
- [$mthd name] == "create" } {
- # Found the constructor we were looking for
- # Check it parameters (try to match this attributes name)
- set paramName "i_[$this name]"
- [$mthd rtParamSet] foreach param {
- if {$paramName == [$param name]} {
- # Found the parameter
- $this keyAttrib 1
- break
- }
- }
- break
- }
- }
- }
- }
- }
- }
-
- method RTAttrib::checkAccess {this} {
- if {[$this section] != "user-defined-attribute"} {
- # skip all non user-defined attributes
- return
- }
-
- if {![info exists hasGetSetMethod]} {
- return
- }
-
- if {!$hasGetSetMethod} {
- return
- }
-
- set raccess "None"
- set waccess "None"
-
- global methodAccessPropName
-
- [[$this rtClass] rtMethodSet] foreach mthd {
- if { [$mthd section] == "attribute-accessor-method" } {
- set prop [$mthd findProp $methodAccessPropName "comp"]
- if {$prop != ""} {
- set access [$prop value]
- } else {
- set access [PropKnowledge::getDefaultValue method_access]
- }
- if [isGetMethod $mthd $this] {
- set raccess $access
- }
- if [isSetMethod $mthd $this] {
- set waccess $access
- }
- }
- }
- global attribAccessPropName
- $this setProp $attribAccessPropName "${raccess}-${waccess}" "name"
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTAttrib::rtClass {this args} {
- if {$args == ""} {
- return [$this _rtClass]
- }
- set ref [$this _rtClass]
- if {$ref != ""} {
- [$ref _rtAttribSet] removeValue $this
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- [$obj _rtAttribSet] append $this
- }
- $this _rtClass $obj
- }
-
-
- # File: @(#)rtclass.tcl /main/hindenburg/2
- # End user added include file section
-
-
- Class RTClass : {RTComp} {
- constructor
- method destructor
- method addMethod
- method addAttrib
- method addGeneralization
- method update
- method superGenSet
- method addSuperGen
- method removeSuperGen
- method rtAttribSet
- method addRtAttrib
- method removeRtAttrib
- method rtMethodSet
- method addRtMethod
- method removeRtMethod
- method genSet
- method addGen
- method removeGen
- attribute derived
- attribute name
- attribute _superGenSet
- attribute _rtAttribSet
- attribute _rtMethodSet
- attribute _genSet
- }
-
- constructor RTClass {class this rtDiagram} {
- set this [RTComp::constructor $class $this $rtDiagram]
- $this _superGenSet [List new]
- $this _rtAttribSet [List new]
- $this _rtMethodSet [List new]
- $this _genSet [List new]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method RTClass::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this RTComp::destructor
- }
-
- method RTClass::addMethod {this {nameType ""} {section "user-defined-method"}} {
- set mthd [RTMethod new [$this rtDiagram]]
- $mthd section $section
- if {$nameType != ""} {
- $mthd setLabel "name_type" $nameType
- }
- $this addRtMethod $mthd
- return $mthd
- }
-
- method RTClass::addAttrib {this {nameType ""} {section "user-defined-attribute"}} {
- set attr [RTAttrib new [$this rtDiagram]]
- $attr section $section
- if {$nameType != ""} {
- $attr setLabel "name_type" $nameType
- }
- $this addRtAttrib $attr
- return $attr
- }
-
- method RTClass::addGeneralization {this super {overlap 1}} {
- [$super genSet] foreach gen {
- if { [$gen overlap] == $overlap } {
- $gen addDerived $this
- return $gen
- }
- }
- # No generalization created yet, create one
- set ng [RTGen new [$this rtDiagram]]
- $ng overlap $overlap
- $ng super $super
- $ng addDerived $this
- return $ng
- }
-
- method RTClass::update {this} {
- set lbl [$this findLabel "name"]
- if {$lbl != ""} {
- regsub -all "\[ \t\n\]" [$lbl value] "" value
- if [regexp {(/*)(.*)} $value discard derived name] {
- $this derived $derived
- $this name $name
- }
- }
- set prop [$this getProp "is_folded"]
- if {$prop != ""} {
- if {$prop == "1"} {
- return
- }
- }
- [$this rtMethodSet] foreach mthd {
- $mthd update
- }
- [$this rtAttribSet] foreach attr {
- $attr update
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTClass::superGenSet {this} {
- return [$this _superGenSet]
- }
-
- method RTClass::addSuperGen {this newSuperGen} {
- [$this _superGenSet] append $newSuperGen
- [$newSuperGen _derivedSet] append $this
- }
-
- method RTClass::removeSuperGen {this oldSuperGen} {
- [$oldSuperGen _derivedSet] removeValue $this
- [$this _superGenSet] removeValue $oldSuperGen
- }
-
- method RTClass::rtAttribSet {this} {
- return [$this _rtAttribSet]
- }
-
- method RTClass::addRtAttrib {this newRtAttrib} {
- [$this _rtAttribSet] append $newRtAttrib
- $newRtAttrib _rtClass $this
- }
-
- method RTClass::removeRtAttrib {this oldRtAttrib} {
- $oldRtAttrib _rtClass ""
- [$this _rtAttribSet] removeValue $oldRtAttrib
- }
-
- method RTClass::rtMethodSet {this} {
- return [$this _rtMethodSet]
- }
-
- method RTClass::addRtMethod {this newRtMethod} {
- [$this _rtMethodSet] append $newRtMethod
- $newRtMethod _rtClass $this
- }
-
- method RTClass::removeRtMethod {this oldRtMethod} {
- $oldRtMethod _rtClass ""
- [$this _rtMethodSet] removeValue $oldRtMethod
- }
-
- method RTClass::genSet {this} {
- return [$this _genSet]
- }
-
- method RTClass::addGen {this newGen} {
- [$this _genSet] append $newGen
- $newGen _super $this
- }
-
- method RTClass::removeGen {this oldGen} {
- $oldGen _super ""
- [$this _genSet] removeValue $oldGen
- }
-
-
- # File: @(#)rtgen.tcl /main/hindenburg/1
-
-
- Class RTGen : {RTComp} {
- constructor
- method destructor
- method super
- method derivedSet
- method addDerived
- method removeDerived
- attribute overlap
- attribute _super
- attribute _derivedSet
- }
-
- constructor RTGen {class this rtDiagram} {
- set this [RTComp::constructor $class $this $rtDiagram]
- $this _derivedSet [List new]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method RTGen::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this RTComp::destructor
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTGen::super {this args} {
- if {$args == ""} {
- return [$this _super]
- }
- set ref [$this _super]
- if {$ref != ""} {
- [$ref _genSet] removeValue $this
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- [$obj _genSet] append $this
- }
- $this _super $obj
- }
-
- method RTGen::derivedSet {this} {
- return [$this _derivedSet]
- }
-
- method RTGen::addDerived {this newDerived} {
- [$this _derivedSet] append $newDerived
- [$newDerived _superGenSet] append $this
- }
-
- method RTGen::removeDerived {this oldDerived} {
- [$oldDerived _superGenSet] removeValue $this
- [$this _derivedSet] removeValue $oldDerived
- }
-
-
- # File: @(#)rtlabel.tcl /main/hindenburg/1
-
-
- Class RTLabel : {RTComp} {
- constructor
- method destructor
- method rtComp
- attribute name
- attribute value
- attribute _rtComp
- }
-
- constructor RTLabel {class this rtDiagram} {
- set this [RTComp::constructor $class $this $rtDiagram]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method RTLabel::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this RTComp::destructor
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTLabel::rtComp {this args} {
- if {$args == ""} {
- return [$this _rtComp]
- }
- set ref [$this _rtComp]
- if {$ref != ""} {
- [$ref _rtLabelSet] removeValue $this
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- [$obj _rtLabelSet] append $this
- }
- $this _rtComp $obj
- }
-
-
- # File: @(#)rtmethod.tcl /main/hindenburg/1
-
-
- Class RTMethod : {RTComp} {
- constructor
- method destructor
- method addParam
- method update
- method rtClass
- method rtParamSet
- method addRtParam
- method removeRtParam
- attribute section
- attribute mods
- attribute name
- attribute type
- attribute constraint
- attribute _rtClass
- attribute _rtParamSet
- }
-
- constructor RTMethod {class this rtDiagram} {
- set this [RTComp::constructor $class $this $rtDiagram]
- $this _rtParamSet [List new]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method RTMethod::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this RTComp::destructor
- }
-
- method RTMethod::addParam {this {nameType ""}} {
- set prm [RTParam new [$this rtDiagram]]
- $this addRtParam $prm
- if { $nameType != "" } {
- $prm setLabel "name_type" $nameType
- }
- return $prm
- }
-
- method RTMethod::update {this} {
- [$this rtParamSet] foreach prm {
- $prm update
- }
- set lbl [$this findLabel "name_type"]
- if {$lbl != ""} {
- regsub -all "\[ \t\n\]" [$lbl value] "" value
- if [regexp {(\$)?([^(:\{]+)([()]*)(:[^\{]+)?(\{abstract\})?$}\
- $value discard mods name braces type constraint] {
- $this mods $mods
- $this name $name
- if [regexp {(:)?(.*)} $type discard point typeName] {
- $this type $typeName
- } else {
- $this type $type
- }
- $this constraint $constraint
- if { $constraint == "{abstract}" } {
- $this setProp "is_abstract" "1"
- }
- if { $mods == "\$" } {
- $this setProp "is_class_feature" "1"
- }
- }
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTMethod::rtClass {this args} {
- if {$args == ""} {
- return [$this _rtClass]
- }
- set ref [$this _rtClass]
- if {$ref != ""} {
- [$ref _rtMethodSet] removeValue $this
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- [$obj _rtMethodSet] append $this
- }
- $this _rtClass $obj
- }
-
- method RTMethod::rtParamSet {this} {
- return [$this _rtParamSet]
- }
-
- method RTMethod::addRtParam {this newRtParam} {
- [$this _rtParamSet] append $newRtParam
- $newRtParam _rtMethod $this
- }
-
- method RTMethod::removeRtParam {this oldRtParam} {
- $oldRtParam _rtMethod ""
- [$this _rtParamSet] removeValue $oldRtParam
- }
-
-
- # File: @(#)rtparam.tcl /main/hindenburg/1
-
-
- Class RTParam : {RTComp} {
- constructor
- method destructor
- method update
- method rtMethod
- attribute name
- attribute type
- attribute _rtMethod
- }
-
- constructor RTParam {class this rtDiagram} {
- set this [RTComp::constructor $class $this $rtDiagram]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method RTParam::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this RTComp::destructor
- }
-
- method RTParam::update {this} {
- set lbl [$this findLabel "name_type"]
- if {$lbl != ""} {
- regsub -all "\[ \t\n\]" [$lbl value] "" value
- if [regexp {([^:]+)(:)(.*)} $value discard name point type] {
- $this name $name
- $this type $type
- }
- }
- }
-
- # Do not delete this line -- regeneration end marker
-
- method RTParam::rtMethod {this args} {
- if {$args == ""} {
- return [$this _rtMethod]
- }
- set ref [$this _rtMethod]
- if {$ref != ""} {
- [$ref _rtParamSet] removeValue $this
- }
- set obj [lindex $args 0]
- if {$obj != ""} {
- [$obj _rtParamSet] append $this
- }
- $this _rtMethod $obj
- }
-
-