home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
msumlopera.tcl
< prev
next >
Wrap
Text File
|
1997-08-29
|
4KB
|
157 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)msumlopera.tcl /main/titanic/2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)msumlopera.tcl /main/titanic/2 29 Aug 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
#require "msumlmembe.tcl"
Class MSUMLOperation : {MSUMLMember} {
constructor
method destructor
method ot2ms
method ms2ot
method promoter
method parameterSet
method addParameter
method removeParameter
attribute _parameterSet
}
constructor MSUMLOperation {class this typeName workItem {typeItem ""}} {
set this [MSUMLMember::constructor $class $this $typeName $workItem $typeItem]
$this _parameterSet [List new]
# Start constructor user section
# End constructor user section
return $this
}
method MSUMLOperation::destructor {this} {
foreach ref [[$this _parameterSet] contents] {
$ref _owner ""
}
# Start destructor user section
[$this parameterSet] foreach parameter {
$parameter delete
}
# End destructor user section
$this MSUMLMember::destructor
}
method MSUMLOperation::ot2ms {this msClass cells} {
set workItem [$this workItem]
set name [$workItem name]
puts "\t\tOperation '$name'"
set ip [$workItem properties]
global trans
$trans begin
set msOperation [$msClass createOperation $name]
set iOper [$msOperation getInterface IUmlOperation]
$this saveFreeTextProp $msOperation $ip
#properties
if { [$ip getPropertyValue is_abstract] == "1"} {
$iOper property IsAbstract 1
} else {
$iOper property IsAbstract 0
}
set isConst [$ip getPropertyValue is_const_func]
if [llength $isConst] {
# only for C++ target
if $isConst {
$iOper property IsQuery 0
} else {
$iOper property IsQuery 1
}
}
$iOper property Concurrency "Sequential"
$trans commit
foreach cell $cells {
set nameItem ""
set typeItem ""
foreach item [lindex $cell 1] {
if {[$item type] == "de"} {
set nameItem $item
} else {
set typeItem $item
}
}
if ![llength $nameItem] {
continue
}
set p [MSUMLParameter new UMLParameter [lindex $cell 0] $nameItem $this $typeItem]
$p ot2ms $msOperation
}
return $msOperation
}
method MSUMLOperation::ms2ot {this myClass} {
set operName [$this name]
set typeName ""
set msParameter ""
set returnValueParameter ""
[$this parameterSet] foreach msParameter {
set iParam [$msParameter getInterface IUmlParameter]
if {[$iParam property Kind] == "return"} {
set returnValueParameter $msParameter
set typeName [$iParam property TypeExpression]
}
}
set operName "${operName}()"
if [llength $typeName] {
set operName "${operName}:$typeName"
}
set iOper [$this getInterface IUmlOperation]
set isTypeScope [$iOper property IsTypeScope]
if {[llength $isTypeScope] && $isTypeScope == "1"} {
set operName "\$$operName"
}
set isAbstract [$iOper property IsAbstract]
if {[llength $isAbstract] && $isAbstract == "1"} {
set operName "$operName\{abstract\}"
}
set myOper [$myClass addMethod $operName]
[$this parameterSet] foreach msParameter {
if {$msParameter != $returnValueParameter} {
$msParameter ms2ot $myOper
}
}
return $myOper
}
method MSUMLOperation::promoter {this} {
$this MSUMLMember::promoter
$this _parameterSet [List new]
set noOfParams [$this getNoOfParameters]
for {set i 1} {$i <= $noOfParams} {incr i} {
set umlParam [$this getParameterAsUML $i]
MS[$umlParam property objectType] promote $umlParam
$this addParameter $umlParam
}
}
# Do not delete this line -- regeneration end marker
method MSUMLOperation::parameterSet {this} {
return [$this _parameterSet]
}
method MSUMLOperation::addParameter {this newParameter} {
[$this _parameterSet] append $newParameter
$newParameter _owner $this
}
method MSUMLOperation::removeParameter {this oldParameter} {
$oldParameter _owner ""
[$this _parameterSet] removeValue $oldParameter
}