home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
semanticbase.tcl
< prev
next >
Wrap
Text File
|
1997-08-27
|
3KB
|
147 lines
#---------------------------------------------------------------------------
#
# (c) Cadre Technologies Inc. 1995
#
# File: @(#)semanticbase.tcl /main/titanic/2
# Author: Harm Leijendeckers
# Description: Base of all report classes which use the
# semantic model
#
#---------------------------------------------------------------------------
# SccsId = @(#)semanticbase.tcl /main/titanic/2 27 Aug 1997 Copyright 1995 Cadre Technologies Inc.
Class SemanticBase : {ReportBase} {
method destructor
constructor
method phaseReport
method systemReport
method fileReport
method doReport
method objName
method objType
method labelValue
method fullFileName
}
constructor SemanticBase {class this} {
set this [ReportBase::constructor $class $this]
OTShRegister::semanticModel
defineTypes
return $this
}
method SemanticBase::destructor {this} {
[$this report] delete
}
method SemanticBase::phaseReport {this} {
set model [SMPhaseModel new [$this configV] [$this phaseV]]
set result [$this doReport $model]
$model delete
return $result
}
method SemanticBase::systemReport {this} {
set model [SMSystemModel new [$this configV] [$this systemV]]
set result [$this doReport $model]
$model delete
return $result
}
method SemanticBase::fileReport {this} {
set model [SMFileModel new [$this configV] [$this fileV]]
set result [$this doReport $model]
$model delete
return $result
}
method SemanticBase::objName {this smObj} {
set class "SMConnector SMNode"
if { [lsearch $class [$smObj objType]] != -1 } {
set label [$smObj getLabel]
if ![$label isNil] {
set name [$label value]
if ![lempty $name] {
return $name
}
}
}
set item [$smObj getItem]
if ![$item isNil] {
return [$item name]
}
return "?"
}
method SemanticBase::objType {this smObj} {
return [[$smObj getSemType] name]
}
method SemanticBase::labelValue {this smObj} {
set label [$smObj getLabel]
if [$label isNil] {
return ""
}
set result ""
foreach item [query $label.itemRefs.item] {
if [lempty $result] {
set result [$item name]
} else {
set result [concat [$item name] ,$result]
}
}
return $result
}
method SemanticBase::fullFileName {this fileVersion} {
if { [$fileVersion isNil] } { return "unknown" }
set file [$fileVersion file]
set result [$file qualifiedName].[$file type].[$fileVersion versionName]
set cc [ClientContext::global]
if { [$cc currentLevel] == "Phase" } {
append result " in system [[$file system] name]"
}
return $result
}
# ----------------------------------------------------------------------
# initialization procedures
proc makeTypeName {method type} {
regsub -all "\[ \t]\[ \t]*" $type "_" type
return "[string toupper $method]_$type"
}
proc defineTypes {} {
set typeIter [SMTypeIter new]
while {[$typeIter current] != ""} {
set name [makeTypeName OMT [[$typeIter current] name]]
global $name
set $name [$typeIter current]
$typeIter next
}
$typeIter delete
global ANY; set ANY [SMTypeDB::any]
global NIL; set NIL [SMTypeDB::nil]
return
}