home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
cbbinaryas.tcl
< prev
next >
Wrap
Text File
|
1997-11-25
|
6KB
|
229 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)cbbinaryas.tcl /main/titanic/3
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)cbbinaryas.tcl /main/titanic/3 25 Nov 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
require "cbpropname.tcl"
require "cbpropcomp.tcl"
require "cbproplabe.tcl"
require "cbpropitem.tcl"
# End user added include file section
require "cadbinarya.tcl"
require "cbassociat.tcl"
Class CBBinaryAssoc : {CBAssociation CADBinaryAssoc} {
method destructor
constructor
method getCBClass
method collectClasses
method collectWorkItems
method collectPropComps
method format
attribute isInComing
attribute inComingFormattedText
attribute outGoingFormattedText
}
method CBBinaryAssoc::destructor {this} {
# Start destructor user section
# End destructor user section
$this CBAssociation::destructor
$this CADBinaryAssoc::destructor
}
constructor CBBinaryAssoc {class this inModel} {
set this [CADBinaryAssoc::constructor $class $this $inModel]
set this [CBAssociation::constructor $class $this $this]
$this isInComing 0
$this inComingFormattedText ""
$this outGoingFormattedText ""
return $this
}
method CBBinaryAssoc::getCBClass {this} {
if {[$this isInComing]} {
return [$this toClass]
} else {
return [$this fromClass]
}
}
method CBBinaryAssoc::collectClasses {this classList} {
if {[$this isInComing]} {
set oppositeClass [$this fromClass]
set thisClass [$this toClass]
} else {
set oppositeClass [$this toClass]
set thisClass [$this fromClass]
}
if {[[$this getClassBrowser] isInFlatViewMode]} {
$classList append $thisClass
}
$classList append $oppositeClass
}
method CBBinaryAssoc::collectWorkItems {this workItemList} {
if {[$this isInComing]} {
set oppositeClass [$this fromClass]
set thisClass [$this toClass]
} else {
set oppositeClass [$this toClass]
set thisClass [$this fromClass]
}
if {[[$this getClassBrowser] isInFlatViewMode]} {
$thisClass collectWorkItems $workItemList
}
if {![$this isInComing]} {
set workItem [$this getQualifierWorkItem]
if {![$workItem isNil]} {
$workItemList append $workItem
}
}
set workItem [$this getNameWorkItem]
if {![$workItem isNil]} {
$workItemList append $workItem
}
if {[$this isInComing]} {
set workItem [$this getFromRoleWorkItem]
} else {
set workItem [$this getToRoleWorkItem]
}
if {![$workItem isNil]} {
$workItemList append $workItem
}
$oppositeClass collectWorkItems $workItemList
}
method CBBinaryAssoc::collectPropComps {this propCompList} {
if {[$this isInComing]} {
set oppositeClass [$this fromClass]
set thisClass [$this toClass]
} else {
set oppositeClass [$this toClass]
set thisClass [$this fromClass]
}
if {[[$this getClassBrowser] isInFlatViewMode]} {
$thisClass collectPropComps $propCompList
}
set cbPropComp [CBPropComponent new [lindex [$this getComponents] 0]]
$propCompList addPropComponent $cbPropComp
# Qualifier part
if {![$this isInComing]} {
$cbPropComp addLabel [$this getQualifierLabel] \
[$this getQualifierItem] [$this getQualifierWorkItem]
}
# Name part
$cbPropComp addLabel [$this getNameLabel] [$this getNameItem] \
[$this getNameWorkItem]
# Opposite class role part
if {[$this isInComing]} {
$cbPropComp addLabel [$this getFromRoleLabel] \
[$this getFromRoleItem] [$this getFromRoleWorkItem]
} else {
$cbPropComp addLabel [$this getToRoleLabel] \
[$this getToRoleItem] [$this getToRoleWorkItem]
}
# Opposite class name
$oppositeClass collectPropComps $propCompList
}
method CBBinaryAssoc::format {this} {
set prefix ""
if {[[$this getClassBrowser] isInFlatViewMode]} {
if {[$this isInComing]} {
set prefix "[[$this toClass] name]: "
} else {
set prefix "[[$this fromClass] name]: "
}
}
if {[$this isInComing]} {
if {[$this inComingFormattedText] != ""} {
$this formattedText [$this inComingFormattedText]
return $prefix[$this formattedText]
}
} else {
if {[$this outGoingFormattedText] != ""} {
$this formattedText [$this outGoingFormattedText]
return $prefix[$this formattedText]
}
}
set result ""
# Qualifier part
if {![$this isInComing]} {
set qualifier [$this qualifier]
if {$qualifier != ""} {
set result "\[$qualifier\]"
}
}
set result "${result}---"
# Name part
set isDerived [$this getPropertyValue $COMP_DERIVED_ATTR]
if {$isDerived == "1"} {
set result "${result}/"
}
set result "${result}[$this name]"
set result "${result}---"
# Opposite class role part
if {[$this isInComing]} {
set role [$this fromRole]
} else {
set role [$this toRole]
}
if {$role != ""} {
set result "${result}<$role>"
}
set result "${result}--"
# Opposite multiplicity/constraint part
if {[$this isInComing]} {
set propertyId $COMP_START_MULT_KIND
set constr [$this fromConstraint]
} else {
set propertyId $COMP_END_MULT_KIND
set constr [$this toConstraint]
}
set propVal [$this getPropertyValue $propertyId]
set result "${result}[$this multKindToString $propVal $constr]"
#Opposite class name
if {[$this isInComing]} {
set oppositeClass [$this fromClass]
} else {
set oppositeClass [$this toClass]
}
set result "${result} [$oppositeClass format]"
if {[$this isInComing]} {
$this inComingFormattedText $result
} else {
$this outGoingFormattedText $result
}
$this formattedText $result
return $prefix$result
}
# Do not delete this line -- regeneration end marker