home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1997 November
/
PCWorld_1997-11_cd.bin
/
software
/
programy
/
komix
/
DATA.Z
/
events.tcl
< prev
next >
Wrap
Text File
|
1996-12-16
|
5KB
|
179 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1995
#
# File: @(#)events.tcl /main/hindenburg/7
# Author: Harm Leijendeckers
# Description: Report on events
# Usage in: SystemVersion, CCD, ETD, STD and UCD editor
#
#---------------------------------------------------------------------------
# SccsId = @(#)events.tcl /main/hindenburg/7 16 Dec 1996 Copyright 1995 Cadre Technologies Inc.
eval [$cc getCustomFileContents semanticbase tcl reports]
Class ReportEvents : {SemanticBase} {
constructor
method doReport
method getNameAndType
}
constructor ReportEvents {class this} {
set this [SemanticBase::constructor $class $this]
$this reportName Events
return $this
}
method ReportEvents::doReport {this model} {
# get all CCD Classes
set events [concat [$model getSMObjects $OMT_Event] \
[$model getSMObjects $OMT_STD_StateEvent]]
if [lempty $events] { return 0 }
set report [$this report]
$report header {
[$this report] print "From Component" 32
[$this report] print Event 32
[$this report] print "To Component" 32
[$this report] print Diagram line
[$this report] line
}
set sortedEvents [concat [query "getItem.isNil == 1" $events] \
[osort getItem.name [query "getItem.isNil == 0" $events]]]
foreach event $sortedEvents {
# From Component
#
case [[$event getComponents] type] in {
event_msg {
set from [$event getFrom $OMT_STD_Event]
}
state_action {
set from [$event getSuperiorObjects $OMT_STD_State]
}
default {
set from [$event getFrom $OMT_EventSender]
}
}
set fromText [$this getNameAndType $from]
# Event
#
set eventText [$this getNameAndType $event]
if { $eventText == "?" } {
# skip events with no name
continue
}
# To Component
#
case [[$event getComponents] type] in {
state_action {
set to [$event getSuperiorObjects $OMT_STD_State]
}
default {
set to [$event getTo $OMT_EventReceiver]
}
}
set toText [$this getNameAndType $to]
# Diagram
#
if { $from != "" } {
set diagText [$this fullFileName [$from getDefiningDiagram]]
} elseif { $to != "" } {
set diagText [$this fullFileName [$to getDefiningDiagram]]
} else {
set diagText ?
}
$report print $fromText 31
$report space
$report print $eventText 31
$report space
$report print $toText 31
$report space
$report print $diagText 35
$report line
}
$report page
$report remove header
return 0
}
method ReportEvents::getNameAndType {this smObject} {
if { $smObject == "" } {
return ?
}
set wi [$smObject getItem]
if ![$wi isNil] {
return "[$wi name] ([$wi type])"
}
set qi [ORB::nil]
case [[$smObject getComponents] type] in {
ccd_actor { set wi [$smObject getItem 0 name cl] }
ccd_class { set wi [$smObject getItem 0 name cl] }
ccd_class_ref { set wi [$smObject getItem 0 name cl] }
ccd_container { set wi [$smObject getItem 0 name cl] }
com_message { set wi [$smObject getItem 0 name pe] }
dir_com_assoc { set wi [$smObject getItem 0 name pe] }
etd_event { set wi [$smObject getItem 0 event pe] }
etd_initiator { set wi [$smObject getItem 0 name_type de]
set qi [$smObject getItem 0 name_type cl] }
etd_object { set wi [$smObject getItem 0 name_type de]
set qi [$smObject getItem 0 name_type cl] }
event_msg { set wi [$smObject getItem 0 event pe] }
final_state { set wi [$smObject getItem 0 name pe] }
state { set wi [$smObject getItem 0 name st] }
start_state { set wi [$smObject getItem 0 name st] }
state_action { set wi [$smObject getItem 0 name cl] }
std_state { set wi [$smObject getItem 0 name cl] }
std_class { set wi [$smObject getItem 0 name cl] }
subject { set wi [$smObject getItem 0 name cl] }
super_state { set wi [$smObject getItem 0 name st] }
transition { set wi [$smObject getItem 0 event pe] }
ucd_actor { set wi [$smObject getItem 0 name cl] }
und_com_assoc { set wi [$smObject getItem 0 name pe] }
use_case { set wi [$smObject getItem 0 name cl] }
default { error "assert 'ReportEvents::getNameAndType'\
[[$smObject getComponents] type]" }
}
set result ""
if ![$wi isNil] {
lappend result [$wi name] ([$wi type])
if ![$qi isNil] {
lappend result :
}
}
if ![$qi isNil] {
lappend result [$qi name] ([$qi type])
}
if [lempty $result] {
set result ?
set label [$smObject getLabel]
if ![$label isNil] {
set result [$label value]
}
}
return $result
}
# ----------------------------------------------------------------------
#
set executeMe [ReportEvents new]