home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
cadmodel.tcl
< prev
next >
Wrap
Text File
|
1996-05-29
|
3KB
|
125 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1996
#
# File: @(#)cadmodel.tcl 1.5
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)cadmodel.tcl 1.5 31 Jan 1996 Copyright 1996 Cadre Technologies Inc.
# Start user added include file section
require "cadbinarya.tcl"
require "cadclass.tcl"
require "cadinhergr.tcl"
require "cadnassocc.tcl"
require "cadnassocn.tcl"
require "cadmodeltp.tcl"
# End user added include file section
Class CADModel : {SMPhaseModel} {
constructor
method destructor
method load
method loadClasses
method getClasses
method defineSMTypes
method makeSMTypeName
method addClass
method removeClass
attribute loaded
attribute classSet
}
constructor CADModel {class this i_configVersion i_phaseVersion} {
set this [SMPhaseModel::constructor $class $this $i_configVersion $i_phaseVersion]
$this loaded 0
$this classSet [List new]
# Start constructor user section
# Define global available SMTypes
$this defineSMTypes
# Add creator scripts to the ObjectFactory
set objFac [$this getObjectFactory]
$objFac addCreatorScript $OMT_CAD_NAssoc \
"return \[CADNAssocNode new $this]"
$objFac addCreatorScript $OMT_CAD_NaryAssocConn \
"return \[CADNAssocConn new $this]"
# Combined types
$objFac addCreatorScript $OMT_CAD_CB_Class \
"return \[CADClass new $this]"
$objFac addCreatorScript $OMT_CAD_CB_Generalization \
"return \[CADInherGroup new $this]"
$objFac addCreatorScript $OMT_CAD_CB_Association \
"return \[CADBinaryAssoc new $this]"
# End constructor user section
return $this
}
method CADModel::destructor {this} {
# Start destructor user section
# End destructor user section
}
method CADModel::load {this} {
if {[$this loaded] == 1} {
return
}
$this loaded 1
$this loadClasses
}
method CADModel::loadClasses {this} {
set classes [$this getSMObjects $OMT_CAD_CB_Class]
foreach class $classes {
$this addClass $class
}
}
method CADModel::getClasses {this} {
$this load
return [$this classSet]
}
method CADModel::defineSMTypes {this} {
set typeIter [SMTypeIter new]
while {[$typeIter current] != ""} {
set smType [$typeIter current]
if { ![string match CAD* [$smType name]]} {
$typeIter next
continue
}
set name [$this makeSMTypeName [$smType name]]
eval "global $name"
eval "set $name $smType"
$typeIter next
}
$typeIter delete
global anySMType; set anySMType [SMTypeDB::any]
global nilSMType; set nilSMType [SMTypeDB::nil]
return
}
method CADModel::makeSMTypeName {this type} {
regsub -all "\[ \t]+" $type "_" type
return "OMT_$type"
}
# Do not delete this line -- regeneration end marker
method CADModel::addClass {this newClass} {
[$this classSet] append $newClass
}
method CADModel::removeClass {this oldClass} {
[$this classSet] removeValue $oldClass
}