home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
cmusecase.tcl
< prev
next >
Wrap
Text File
|
1996-09-16
|
5KB
|
175 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1996
#
# File: @(#)cmusecase.tcl /main/hindenburg/7
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)cmusecase.tcl /main/hindenburg/7 16 Sep 1996 Copyright 1996 Cayenne Software Inc.
# Start user added include file section
require chktcl_msg.tcl
# End user added include file section
Class CMUseCase : {SMNode} {
method destructor
constructor
method initChkSysV
method getName
method getLocation
method isInSystem
method checkDiagramRef
method checkInitiator
method mcheck
attribute chkSysV
attribute file
}
method CMUseCase::destructor {this} {
# Start destructor user section
# End destructor user section
}
constructor CMUseCase {class this inModel} {
set this [SMNode::constructor $class $this $inModel]
$this chkSysV ""
return $this
}
method CMUseCase::initChkSysV {this} {
# in case of scopeSystem, 'chkSysV' contains the appropriate systemVersion
# must be called prior to the check functions
# note that a CMUseCase has item interpretation, and may have scopePhase
# or scopeSystem
#
if {[$this chkSysV] != ""} {
return
}
$this chkSysV [$this getDefiningSystemVersion]
}
method CMUseCase::getName {this} {
set label [$this getLabel]
if {[$label isNil]} {
return ""
}
return [$label value]
}
method CMUseCase::getLocation {this} {
# get the location of this, starting in current system
#
if {[$this file] == ""} {
set sys [[[ClientContext::global] currentSystem] system]
foreach comp [$this getComponents] {
if {[$comp system] == $sys} {
$this file [[[$comp diagram] file] name].[[[$comp diagram] file] type]
break
}
}
if {[$this file] == ""} {
set comp [lindex [$this getComponents] 0]
$this file "[[[$comp diagram] file] name].[[[$comp diagram] file] type] of System '[[$comp system] name]'"
}
}
return "File '[$this file]'"
}
method CMUseCase::isInSystem {this {sys ""}} {
# if not supplied, use current system for 'sys'
#
if {$sys == ""} {
set sys [[[ClientContext::global] currentSystem] system]
}
set defSysV [$this getDefiningSystemVersion]
if {![$defSysV isNil]} {
if {[$defSysV system] == $sys} {
return 1
}
}
foreach comp [$this getComponents] {
if {[$comp system] == $sys} {
return 1
}
}
return 0
}
method CMUseCase::checkDiagramRef {this} {
# For each UseCase there must be a UCD with the same name or at least one
# ETD qualified by the name of the UseCase
#
set name [$this getName]
regsub -all " " $name "" name
if {$name == ""} {
return
}
set cc [ClientContext::global]
set project [$cc currentProject]
set configV [$cc currentConfig]
set systemV [$this chkSysV]
if {[$systemV isNil]} {
set systemV [$cc currentSystem]
}
# UCD
#
set item [$project findItem $name cl]
if {![$item isNil]} {
$systemV getDecompositions $item $configV decompFiles {ucd} resultSystems resultFiles
if {![lempty $resultFiles]} {
return
}
}
# ETD
#
set workItem [$systemV findDefinition [$this getItem] $configV]
if {![$workItem isNil]} {
set sysV [$workItem owner]
if {![$sysV isNil]} {
foreach qfiedWorkItem [$workItem qualifiedDeclarations] {
set fileV [$sysV findFileVersion -byItemAndType [$qfiedWorkItem item] "etd"]
if {![$fileV isNil]} {
return
}
}
}
}
m4_error $E_USECASE_NO_DIAG_REF $name " in [$this getLocation]"
}
method CMUseCase::checkInitiator {this} {
# Each UseCase must have exactly one initiating UCD Actor
#
set chkSysV [$this chkSysV]
set actors [$this getOppositeObjects $OMT_UCD_UndirectedCommunicationAssociation $OMT_UCD_Actor]
foreach conn [$this getConnectorsIn $OMT_UCD_DirectedCommunicationAssociation $OMT_UCD_Actor] {
lappend actors [$conn getFrom $OMT_UCD_Actor]
}
set iniCnt 0
foreach ac $actors {
if {([$chkSysV isNil] || [$ac getDefiningSystemVersion] == $chkSysV) && [$ac getPropertyValue "initiator"] == "1"} {
set iniCnt [expr $iniCnt + 1]
}
}
if {$iniCnt != 1} {
m4_error $E_USECASE_WRONG_INIT [$this getName] " in [$this getLocation]" $iniCnt
}
}
method CMUseCase::mcheck {this} {
$this initChkSysV
$this checkDiagramRef
$this checkInitiator
}
# Do not delete this line -- regeneration end marker