home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)cadclass.tcl /main/2
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)cadclass.tcl /main/2 11 Jun 1996 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- require "cachedmatr.tcl"
- require "cadfeature.tcl"
- require "cadmethod.tcl"
- # End user added include file section
-
-
- Class CADClass : {SMNode} {
- constructor
- method destructor
- method getNameLabel
- method getNameItem
- method getNameWorkItem
- method name
- method load
- method loadClassDefinition
- method createFeature
- method findClassDefinition
- method loadConnections
- method getSuperClasses
- method getSubClasses
- method featureSet
- method addFeature
- method removeFeature
- method addSuperGroup
- method removeSuperGroup
- method addSubGroup
- method removeSubGroup
- method addBinaryAssocIn
- method removeBinaryAssocIn
- method addBinaryAssocOut
- method removeBinaryAssocOut
- method addNAssocConn
- method removeNAssocConn
- attribute loaded
- attribute _featureSet
- attribute classDefinition
- attribute superGroupSet
- attribute subGroupSet
- attribute binaryAssocInSet
- attribute binaryAssocOutSet
- attribute nAssocConnSet
- }
-
- constructor CADClass {class this inModel} {
- set this [SMNode::constructor $class $this $inModel]
- $this loaded 0
- $this _featureSet [List new]
- $this superGroupSet [List new]
- $this subGroupSet [List new]
- $this binaryAssocInSet [List new]
- $this binaryAssocOutSet [List new]
- $this nAssocConnSet [List new]
- # Start constructor user section
- # End constructor user section
- return $this
- }
-
- method CADClass::destructor {this} {
- foreach ref [[$this _featureSet] contents] {
- $ref _theClass ""
- }
- # Start destructor user section
- # End destructor user section
- }
-
- method CADClass::getNameLabel {this} {
- return [$this getLabel]
- }
-
- method CADClass::getNameItem {this} {
- return [$this getItem]
- }
-
- method CADClass::getNameWorkItem {this} {
- return [$this getWorkItem]
- }
-
- method CADClass::name {this} {
- set nameItem [$this getNameItem]
- if {[$nameItem isNil]} {
- return ""
- }
- return [$nameItem name]
- }
-
- method CADClass::load {this} {
- if {[$this loaded] == 1} {
- return
- }
- $this loaded 1
- $this loadClassDefinition
- $this loadConnections
- }
-
- method CADClass::loadClassDefinition {this} {
- set classDef [$this CADClass::findClassDefinition]
- if {[$classDef isNil]} {
- return
- }
- $classDef loadCachedMatrix
- [$classDef cachedRowSet] foreach row {
- $this createFeature $row
- }
- }
-
- method CADClass::createFeature {this row} {
- if {[$row type] == $CDM_ATTR} {
- return [CADFeature new $this $row]
- }
- if {[$row type] == $CDM_METHOD} {
- return [CADMethod new $this $row]
- }
- return ""
- }
-
- method CADClass::findClassDefinition {this} {
- set systemV [$this getDefiningSystemVersion]
- if {[$systemV isNil]} {
- return $systemV
- }
- $this classDefinition [$systemV findFileVersion [$this name] $CDM_TYPE]
- return [$this classDefinition]
- }
-
- method CADClass::loadConnections {this} {
- set connectors [$this getConnectorsIn $anySMType $anySMType]
- foreach conn $connectors {
- set connSemType [$conn getSemType]
- if { $connSemType == $OMT_CAD_CB_GenConn } {
- set superInhGrp \
- [$conn getFrom $OMT_CAD_CB_Generalization]
- $this addSuperGroup $superInhGrp
- $superInhGrp load
- continue
- }
- if { $connSemType == $OMT_CAD_CB_Association } {
- $this addBinaryAssocIn $conn
- $conn load
- continue
- }
- if { $connSemType == $OMT_CAD_NaryAssocConn } {
- $this addNAssocConn $conn
- set naryAssocNode [$conn getFrom $OMT_CAD_NAssoc]
- $conn load
- $naryAssocNode load
- continue
- }
- }
-
- set connectors [$this getConnectorsOut $anySMType $anySMType]
- foreach conn $connectors {
- set connSemType [$conn getSemType]
- if { $connSemType == $OMT_CAD_CB_GenConn } {
- set subInhGrp [$conn getTo $OMT_CAD_CB_Generalization]
- $this addSubGroup $subInhGrp
- $subInhGrp load
- continue
- }
- if { $connSemType == $OMT_CAD_CB_Association } {
- $this addBinaryAssocOut $conn
- $conn load
- continue
- }
- if { $connSemType == $OMT_CAD_NaryAssocConn } {
- $this addNAssocConn $conn
- set naryAssocNode [$conn getTo $OMT_CAD_NAssoc]
- $conn load
- $naryAssocNode load
- continue
- }
- }
- }
-
- method CADClass::getSuperClasses {this} {
- $this load
- set superClasses ""
- [$this superGroupSet] foreach superInhGrp {
- lappend superClasses [$superInhGrp superClass]
- }
- return $superClasses
- }
-
- method CADClass::getSubClasses {this} {
- $this load
- set subClasses ""
- [$this subGroupSet] foreach subInhGrp {
- set subClasses [concat $subClasses \
- [[$subInhGrp subClassSet] contents]]
- }
- return $subClasses
- }
-
- # Do not delete this line -- regeneration end marker
-
- method CADClass::featureSet {this} {
- return [$this _featureSet]
- }
-
- method CADClass::addFeature {this newFeature} {
- [$this _featureSet] append $newFeature
- $newFeature _theClass $this
- }
-
- method CADClass::removeFeature {this oldFeature} {
- $oldFeature _theClass ""
- [$this _featureSet] removeValue $oldFeature
- }
-
- method CADClass::addSuperGroup {this newSuperGroup} {
- [$this superGroupSet] append $newSuperGroup
-
- }
-
- method CADClass::removeSuperGroup {this oldSuperGroup} {
- [$this superGroupSet] removeValue $oldSuperGroup
- }
-
- method CADClass::addSubGroup {this newSubGroup} {
- [$this subGroupSet] append $newSubGroup
-
- }
-
- method CADClass::removeSubGroup {this oldSubGroup} {
- [$this subGroupSet] removeValue $oldSubGroup
- }
-
- method CADClass::addBinaryAssocIn {this newBinaryAssocIn} {
- [$this binaryAssocInSet] append $newBinaryAssocIn
-
- }
-
- method CADClass::removeBinaryAssocIn {this oldBinaryAssocIn} {
- [$this binaryAssocInSet] removeValue $oldBinaryAssocIn
- }
-
- method CADClass::addBinaryAssocOut {this newBinaryAssocOut} {
- [$this binaryAssocOutSet] append $newBinaryAssocOut
-
- }
-
- method CADClass::removeBinaryAssocOut {this oldBinaryAssocOut} {
- [$this binaryAssocOutSet] removeValue $oldBinaryAssocOut
- }
-
- method CADClass::addNAssocConn {this newNAssocConn} {
- [$this nAssocConnSet] append $newNAssocConn
-
- }
-
- method CADClass::removeNAssocConn {this oldNAssocConn} {
- [$this nAssocConnSet] removeValue $oldNAssocConn
- }
-
-