home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
javatarget.tcl
< prev
next >
Wrap
Text File
|
1997-12-01
|
44KB
|
1,701 lines
#---------------------------------------------------------------------------
#
# Copyright (c) 1997 by Cayenne Software, Inc.
#
# This software is furnished under a license and may be used only in
# accordance with the terms of such license and with the inclusion of
# the above copyright notice. This software or any other copies thereof
# may not be provided or otherwise made available to any other person.
# No title to and ownership of the software is hereby transferred.
#
# The information in this software is subject to change without notice
# and should not be construed as a commitment by Cayenne Software, Inc.
#
#---------------------------------------------------------------------------
#
# File : javatarget.tcl
# Author :
# Original date : November 1997
# Description : Classes for code generation
#
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
# File: @(#)javaaccess.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaAccess : {GCObject} {
constructor
method destructor
method generate
attribute accessor
}
constructor JavaAccess {class this i_accessor} {
set this [GCObject::constructor $class $this]
$this accessor $i_accessor
# Start constructor user section
# End constructor user section
return $this
}
method JavaAccess::destructor {this} {
# Start destructor user section
# End destructor user section
}
method JavaAccess::generate {this sect} {
$sect append "[$this accessor] "
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javacommen.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaComment : {GCObject} {
constructor
method destructor
method generate
attribute comment
}
constructor JavaComment {class this comment} {
set this [GCObject::constructor $class $this]
$this comment $comment
# Start constructor user section
# End constructor user section
return $this
}
method JavaComment::destructor {this} {
# Start destructor user section
# End destructor user section
}
method JavaComment::generate {this sect} {
# !! Implement this function !!
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javacompil.tcl /main/titanic/4
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaCompilationUnit : {GCObject} {
constructor
method destructor
method addSystemImport
method generate
method needsType
method addImportOnDemand
method removeImportOnDemand
method addImportPackage
method removeImportPackage
method addImportType
method removeImportType
method addUserImport
method removeUserImport
method addContainer
method removeContainer
attribute name
attribute importOnDemandSet
attribute importPackageSet
attribute importTypeSet
attribute packageStatement
attribute systemImportSet
attribute userImportSet
attribute masterContainer
attribute containerSet
}
constructor JavaCompilationUnit {class this i_name} {
set this [GCObject::constructor $class $this]
$this name $i_name
$this importOnDemandSet [List new]
$this importPackageSet [List new]
$this importTypeSet [List new]
$this systemImportSet [List new]
$this userImportSet [List new]
$this containerSet [List new]
# Start constructor user section
# End constructor user section
return $this
}
method JavaCompilationUnit::destructor {this} {
# Start destructor user section
# End destructor user section
}
method JavaCompilationUnit::addSystemImport {this newSystemImport} {
set ident [$newSystemImport identifier]
[$this systemImportSet] foreach systemImport {
if {[$systemImport identifier] == $ident} {
return
}
}
[$this systemImportSet] append $newSystemImport
}
method JavaCompilationUnit::generate {this} {
if [$this needsType "Hashtable"] {
$this addSystemImport [JavaPackageName new "java.util.Hashtable"]
}
if [$this needsType "Vector"] {
$this addSystemImport [JavaPackageName new "java.util.Vector"]
}
set sect [TextSection new]
expandHeaderIntoSection [$this name].java java $sect
if {[$this packageStatement] != ""} {
$sect append "package "
[$this packageStatement] generate $sect
$sect append ";\n\n"
}
[$this systemImportSet] foreach package {
$sect append "import "
$package generate $sect
$sect append ";\n"
}
set userImports [List new]
[$this userImportSet] foreach package {
if {[$userImports search -exact [$package identifier]] < 0} {
$userImports append [$package identifier]
}
}
[$this importPackageSet] foreach package {
if {[$userImports search -exact [$package identifier]] < 0} {
$userImports append [$package identifier]
}
}
[$this importTypeSet] foreach package {
if {[$userImports search -exact [$package identifier]] < 0} {
$userImports append [$package identifier]
}
}
[$this importOnDemandSet] foreach package {
if {[$userImports search -exact [$package identifier].*] < 0} {
$userImports append [$package identifier].*
}
}
$sect append "\n${JavaCookie::startUserImportSection}\n\n"
$userImports foreach name {
$sect append "import $name;\n"
}
$sect append "\n${JavaCookie::endUserImportSection}\n"
$sect append "\n${JavaCookie::startClassDeclaration}\n\n"
if {[$this masterContainer] != ""} {
[$this masterContainer] generate $sect
}
[$this containerSet] foreach container {
if {[$this masterContainer] != $container} {
$container generate $sect
}
}
$sect append "\n${JavaCookie::endClassDeclaration}\n"
return $sect
}
method JavaCompilationUnit::needsType {this typeName} {
[$this containerSet] foreach container {
if [$container needsType $typeName] {
return 1
}
}
return 0
}
# Do not delete this line -- regeneration end marker
method JavaCompilationUnit::addImportOnDemand {this newImportOnDemand} {
[$this importOnDemandSet] append $newImportOnDemand
}
method JavaCompilationUnit::removeImportOnDemand {this oldImportOnDemand} {
[$this importOnDemandSet] removeValue $oldImportOnDemand
}
method JavaCompilationUnit::addImportPackage {this newImportPackage} {
[$this importPackageSet] append $newImportPackage
}
method JavaCompilationUnit::removeImportPackage {this oldImportPackage} {
[$this importPackageSet] removeValue $oldImportPackage
}
method JavaCompilationUnit::addImportType {this newImportType} {
[$this importTypeSet] append $newImportType
}
method JavaCompilationUnit::removeImportType {this oldImportType} {
[$this importTypeSet] removeValue $oldImportType
}
method JavaCompilationUnit::addUserImport {this newUserImport} {
[$this userImportSet] append $newUserImport
}
method JavaCompilationUnit::removeUserImport {this oldUserImport} {
[$this userImportSet] removeValue $oldUserImport
}
method JavaCompilationUnit::addContainer {this newContainer} {
[$this containerSet] append $newContainer
}
method JavaCompilationUnit::removeContainer {this oldContainer} {
[$this containerSet] removeValue $oldContainer
}
#---------------------------------------------------------------------------
# File: @(#)javacontai.tcl /main/titanic/2
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaContainer : {GCObject} {
constructor
method destructor
method generate
method generateInterfaceList
method needsType
method addMethod
method removeMethod
method addConstructor
method removeConstructor
method addVariable
method removeVariable
method addInterface
method removeInterface
attribute name
attribute needsHashtable
attribute needsVector
attribute comment
attribute access
attribute modifier
attribute methodSet
attribute constructorSet
attribute variableSet
attribute interfaceSet
attribute ooplClass
}
constructor JavaContainer {class this ooplClass} {
set this [GCObject::constructor $class $this]
$this needsHashtable 0
$this needsVector 0
$this ooplClass $ooplClass
$this methodSet [List new]
$this constructorSet [List new]
$this variableSet [List new]
$this interfaceSet [List new]
# Start constructor user section
$this name [$ooplClass getName]
# End constructor user section
return $this
}
method JavaContainer::destructor {this} {
# Start destructor user section
# End destructor user section
}
method JavaContainer::generate {this sect} {
# !! Implement this function !!
}
method JavaContainer::generateInterfaceList {this keyword} {
set sect [TextSection new]
set first 1
[$this interfaceSet] foreach interface {
if {$first} {
$sect append " $keyword $interface"
incr first -1
} else {
$sect append ", $interface"
}
}
return $sect
}
method JavaContainer::needsType {this typeName} {
return 0
}
# Do not delete this line -- regeneration end marker
method JavaContainer::addMethod {this newMethod} {
[$this methodSet] append $newMethod
}
method JavaContainer::removeMethod {this oldMethod} {
[$this methodSet] removeValue $oldMethod
}
method JavaContainer::addConstructor {this newConstructor} {
[$this constructorSet] append $newConstructor
}
method JavaContainer::removeConstructor {this oldConstructor} {
[$this constructorSet] removeValue $oldConstructor
}
method JavaContainer::addVariable {this newVariable} {
[$this variableSet] append $newVariable
}
method JavaContainer::removeVariable {this oldVariable} {
[$this variableSet] removeValue $oldVariable
}
method JavaContainer::addInterface {this newInterface} {
[$this interfaceSet] append $newInterface
}
method JavaContainer::removeInterface {this oldInterface} {
[$this interfaceSet] removeValue $oldInterface
}
#---------------------------------------------------------------------------
# File: @(#)javacookie.tcl /main/titanic/4
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaCookie : {GCObject} {
constructor
method destructor
}
global JavaCookie::dataAttributeSection
set JavaCookie::dataAttributeSection "// Data attributes"
global JavaCookie::associationAttributeSection
set JavaCookie::associationAttributeSection "// Association attributes"
global JavaCookie::defaultConstructorSection
set JavaCookie::defaultConstructorSection "// Default constructor"
global JavaCookie::userConstructorSection
set JavaCookie::userConstructorSection "// User defined constructors"
global JavaCookie::methodSection
set JavaCookie::methodSection "// Methods"
global JavaCookie::attributeAccessorSection
set JavaCookie::attributeAccessorSection "// Attribute accessors"
global JavaCookie::associationAccessorSection
set JavaCookie::associationAccessorSection "// Association accessors"
global JavaCookie::startClassDeclaration
set JavaCookie::startClassDeclaration "// Do not delete this line -- Start Class Declarations"
global JavaCookie::regenerationEndSection
set JavaCookie::regenerationEndSection "// Do not delete this line -- regeneration end marker"
global JavaCookie::endClassDeclaration
set JavaCookie::endClassDeclaration "// Do not delete this line -- End Class Declarations"
global JavaCookie::startUserSection
set JavaCookie::startUserSection "// Start user code section"
global JavaCookie::endUserSection
set JavaCookie::endUserSection "// End user code section"
global JavaCookie::startObsoleteCodeSection
set JavaCookie::startObsoleteCodeSection "// Start obsolete code section -- Remove this line"
global JavaCookie::endObsoleteCodeSection
set JavaCookie::endObsoleteCodeSection "// End obsolete code section -- Remove this line"
global JavaCookie::startUserImportSection
set JavaCookie::startUserImportSection "// Begin user import section"
global JavaCookie::endUserImportSection
set JavaCookie::endUserImportSection "// End user import section"
global JavaCookie::endMarker
set JavaCookie::endMarker "-- regeneration end marker"
constructor JavaCookie {class this} {
set this [GCObject::constructor $class $this]
# Start constructor user section
# End constructor user section
return $this
}
method JavaCookie::destructor {this} {
# Start destructor user section
# End destructor user section
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javafeatur.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaFeature : {GCObject} {
constructor
method destructor
method generate
method addModifier
method removeModifier
attribute name
attribute comment
attribute type
attribute modifierSet
attribute access
}
constructor JavaFeature {class this i_name} {
set this [GCObject::constructor $class $this]
$this name $i_name
$this modifierSet [List new]
# Start constructor user section
# End constructor user section
return $this
}
method JavaFeature::destructor {this} {
# Start destructor user section
# End destructor user section
}
method JavaFeature::generate {this sect} {
# !! Implement this function !!
}
# Do not delete this line -- regeneration end marker
method JavaFeature::addModifier {this newModifier} {
[$this modifierSet] append $newModifier
}
method JavaFeature::removeModifier {this oldModifier} {
[$this modifierSet] removeValue $oldModifier
}
#---------------------------------------------------------------------------
# File: @(#)javainitia.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaInitializer : {GCObject} {
constructor
method destructor
method generate
attribute value
}
constructor JavaInitializer {class this i_value} {
set this [GCObject::constructor $class $this]
$this value $i_value
# Start constructor user section
# End constructor user section
return $this
}
method JavaInitializer::destructor {this} {
# Start destructor user section
# End destructor user section
}
method JavaInitializer::generate {this sect} {
$sect append " = [$this value]"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javamodel.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaModel : {GCObject} {
constructor
method destructor
method generate
method getCompilationUnit
method addUnit
method removeUnit
attribute unitSet
}
constructor JavaModel {class this} {
set this [GCObject::constructor $class $this]
$this unitSet [List new]
# Start constructor user section
# End constructor user section
return $this
}
method JavaModel::destructor {this} {
# Start destructor user section
# End destructor user section
}
method JavaModel::generate {this typeToClassDict} {
[$this unitSet] foreach unit {
if {[$unit masterContainer] != ""} {
set sectionDict [Dictionary new]
$sectionDict set "java" [$unit generate]
set ooplClass [[$unit masterContainer] ooplClass]
$typeToClassDict set $ooplClass $sectionDict
}
}
}
method JavaModel::getCompilationUnit {this unitName} {
[$this unitSet] foreach unit {
if {[$unit name] == $unitName} {
return $unit
}
}
set unit [JavaCompilationUnit new $unitName]
$this addUnit $unit
return $unit
}
# Do not delete this line -- regeneration end marker
method JavaModel::addUnit {this newUnit} {
[$this unitSet] append $newUnit
}
method JavaModel::removeUnit {this oldUnit} {
[$this unitSet] removeValue $oldUnit
}
#---------------------------------------------------------------------------
# File: @(#)javamodifi.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaModifier : {GCObject} {
constructor
method destructor
method generate
attribute modifier
}
constructor JavaModifier {class this i_modifier} {
set this [GCObject::constructor $class $this]
$this modifier $i_modifier
# Start constructor user section
# End constructor user section
return $this
}
method JavaModifier::destructor {this} {
# Start destructor user section
# End destructor user section
}
method JavaModifier::generate {this sect} {
$sect append "[$this modifier] "
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javapackag.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaPackageName : {GCObject} {
constructor
method destructor
method generate
attribute identifier
}
constructor JavaPackageName {class this i_identifier} {
set this [GCObject::constructor $class $this]
$this identifier $i_identifier
# Start constructor user section
$this identifier [string trim $i_identifier]
# End constructor user section
return $this
}
method JavaPackageName::destructor {this} {
# Start destructor user section
# End destructor user section
}
method JavaPackageName::generate {this sect} {
$sect append [$this identifier]
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javaparame.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaParameter : {GCObject} {
constructor
method destructor
method generate
attribute name
attribute type
}
constructor JavaParameter {class this i_name type} {
set this [GCObject::constructor $class $this]
$this name $i_name
$this type $type
# Start constructor user section
# End constructor user section
return $this
}
method JavaParameter::destructor {this} {
# Start destructor user section
# End destructor user section
}
method JavaParameter::generate {this sect} {
[$this type] generate $sect
$sect append [$this name]
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javatype.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaType : {GCObject} {
constructor
method destructor
method generate
attribute name
}
constructor JavaType {class this i_name} {
set this [GCObject::constructor $class $this]
$this name $i_name
# Start constructor user section
# End constructor user section
return $this
}
method JavaType::destructor {this} {
# Start destructor user section
# End destructor user section
}
method JavaType::generate {this sect} {
$sect append "[$this name] "
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javamethod.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaMethod : {JavaFeature} {
constructor
method destructor
method generate
method generateParameterList
method addParameter
method removeParameter
attribute userBody
attribute parameterSet
}
constructor JavaMethod {class this i_name} {
set this [JavaFeature::constructor $class $this $i_name]
$this parameterSet [List new]
# Start constructor user section
# End constructor user section
return $this
}
method JavaMethod::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaFeature::destructor
}
method JavaMethod::generate {this sect} {
# !! Implement this function !!
}
method JavaMethod::generateParameterList {this} {
set sect [TextSection new]
$sect append "("
set first 1
[$this parameterSet] foreach parameter {
if {$first} {
incr first -1
} else {
$sect append ", "
}
$parameter generate $sect
}
$sect append ")"
return $sect
}
# Do not delete this line -- regeneration end marker
method JavaMethod::addParameter {this newParameter} {
[$this parameterSet] append $newParameter
}
method JavaMethod::removeParameter {this oldParameter} {
[$this parameterSet] removeValue $oldParameter
}
#---------------------------------------------------------------------------
# File: @(#)javathrowe.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaThrower : {JavaMethod} {
constructor
method destructor
method generateThrowList
method addThrow
method removeThrow
attribute throwSet
}
constructor JavaThrower {class this i_name} {
set this [JavaMethod::constructor $class $this $i_name]
$this throwSet [List new]
# Start constructor user section
# End constructor user section
return $this
}
method JavaThrower::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaMethod::destructor
}
method JavaThrower::generateThrowList {this} {
set sect [TextSection new]
if {![[$this throwSet] empty]} {
set first 1
[$this throwSet] foreach throw {
if {$first} {
$sect append " throws "
incr first -1
} else {
$sect append ", "
}
$throw generate $sect
}
}
return $sect
}
# Do not delete this line -- regeneration end marker
method JavaThrower::addThrow {this newThrow} {
[$this throwSet] append $newThrow
}
method JavaThrower::removeThrow {this oldThrow} {
[$this throwSet] removeValue $oldThrow
}
#---------------------------------------------------------------------------
# File: @(#)javavariab.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaVariable : {JavaFeature} {
constructor
method destructor
method generate
attribute initializer
}
constructor JavaVariable {class this i_name} {
set this [JavaFeature::constructor $class $this $i_name]
# Start constructor user section
# End constructor user section
return $this
}
method JavaVariable::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaFeature::destructor
}
method JavaVariable::generate {this sect} {
if {[$this comment] != ""} {
[$this comment] generate $sect
}
if {[$this access] != ""} {
[$this access] generate $sect
}
[$this modifierSet] foreach modifier {
$modifier generate $sect
}
[$this type] generate $sect
$sect append [$this name]
if {[$this initializer] != ""} {
[$this initializer] generate $sect
}
$sect append ";\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javaconstr.tcl /main/titanic/3
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaConstructor : {JavaMethod} {
constructor
method destructor
method generate
attribute generatorBody
}
constructor JavaConstructor {class this i_name} {
set this [JavaMethod::constructor $class $this $i_name]
# Start constructor user section
# End constructor user section
return $this
}
method JavaConstructor::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaMethod::destructor
}
method JavaConstructor::generate {this sect} {
if {[$this comment] != ""} {
[$this comment] generate $sect
}
if {[$this access] != ""} {
[$this access] generate $sect
}
$sect append [$this name]
$sect appendSect [$this generateParameterList]
$sect append " {\n"
$sect indent +
$sect appendSect [$this generatorBody]
$sect append "\n${JavaCookie::startUserSection}\n"
if {[$this userBody] != ""} {
set oldIndent [$sect indent]
$sect indent 0
$sect appendSect [$this userBody]
$sect indent $oldIndent
}
$sect append "${JavaCookie::endUserSection}\n"
$sect indent -
$sect append "} // default constructor [$this name]\n\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javauserme.tcl /main/titanic/3
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaUserMethod : {JavaThrower} {
constructor
method destructor
method generate
attribute hasBody
}
constructor JavaUserMethod {class this i_name} {
set this [JavaThrower::constructor $class $this $i_name]
# Start constructor user section
$this hasBody 1
# End constructor user section
return $this
}
method JavaUserMethod::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaThrower::destructor
}
method JavaUserMethod::generate {this sect} {
if {[$this comment] != ""} {
[$this comment] generate $sect
}
if {[$this access] != ""} {
[$this access] generate $sect
}
[$this modifierSet] foreach modifier {
$modifier generate $sect
}
if {[$this type] != ""} {
[$this type] generate $sect
}
$sect append [$this name]
$sect appendSect [$this generateParameterList]
$sect appendSect [$this generateThrowList]
if [$this hasBody] {
$sect append " {\n"
if {[$this userBody] != ""} {
set oldIndent [$sect indent]
$sect indent 0
$sect appendSect [$this userBody]
$sect indent $oldIndent
}
$sect append "} // method [$this name] ${JavaCookie::endMarker}\n\n"
} else {
$sect append ";\n\n"
}
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javaenumcl.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaEnumClass : {JavaContainer} {
constructor
method destructor
method generate
attribute obsoleteCode
}
constructor JavaEnumClass {class this ooplClass} {
set this [JavaContainer::constructor $class $this $ooplClass]
# Start constructor user section
# End constructor user section
return $this
}
method JavaEnumClass::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaContainer::destructor
}
method JavaEnumClass::generate {this sect} {
if {[$this comment] != ""} {
[$this comment] generate $sect
}
if {[$this access] != ""} {
[$this access] generate $sect
}
if {[$this modifier] != ""} {
[$this modifier] generate $sect
}
$sect append "class [$this name] extends Object"
$sect append " {\n"
$sect indent +
$sect append "\n${JavaCookie::dataAttributeSection}\n\n"
[$this variableSet] foreach variable {
$variable generate $sect
}
$sect append "\n${JavaCookie::regenerationEndSection}\n"
if {[$this obsoleteCode] != ""} {
$sect append "\n${JavaCookie::startObsoleteCodeSection}\n\n"
$sect appendSect [$this obsoleteCode]
$sect append "\n${JavaCookie::endObsoleteCodeSection}\n\n"
}
$sect indent -
$sect append "} // class [$this name]\n\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javastatic.tcl /main/titanic/2
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaStaticInitializer : {JavaMethod} {
constructor
method destructor
method generate
method generateParameterList
}
constructor JavaStaticInitializer {class this i_name} {
set this [JavaMethod::constructor $class $this $i_name]
# Start constructor user section
# End constructor user section
return $this
}
method JavaStaticInitializer::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaMethod::destructor
}
method JavaStaticInitializer::generate {this sect} {
if {[$this comment] != ""} {
[$this comment] generate $sect
}
$sect append "static {\n"
if {[$this userBody] != ""} {
set oldIndent [$sect indent]
$sect indent 0
$sect appendSect [$this userBody]
$sect indent $oldIndent
}
$sect append "} // static initializer ${JavaCookie::endMarker}\n\n"
}
method JavaStaticInitializer::generateParameterList {this} {
return [TextSection new]
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javaaccmet.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaAccMethod : {JavaMethod} {
constructor
method destructor
method generate
attribute generatorBody
}
constructor JavaAccMethod {class this i_name} {
set this [JavaMethod::constructor $class $this $i_name]
# Start constructor user section
# End constructor user section
return $this
}
method JavaAccMethod::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaMethod::destructor
}
method JavaAccMethod::generate {this sect} {
if {[$this access] != ""} {
[$this access] generate $sect
}
[$this modifierSet] foreach modifier {
$modifier generate $sect
}
if {[$this type] != ""} {
[$this type] generate $sect
}
$sect append [$this name]
$sect appendSect [$this generateParameterList]
$sect append " {\n"
$sect indent +
$sect appendSect [$this generatorBody]
$sect indent -
$sect append "}\n\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javablockc.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaBlockComment : {JavaComment} {
constructor
method destructor
method generate
}
constructor JavaBlockComment {class this comment} {
set this [JavaComment::constructor $class $this $comment]
# Start constructor user section
# End constructor user section
return $this
}
method JavaBlockComment::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaComment::destructor
}
method JavaBlockComment::generate {this sect} {
$sect append "/*\n"
$sect append "[$this comment]\n"
$sect append "*/\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javauserco.tcl /main/titanic/4
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaUserConstructor : {JavaThrower} {
constructor
method destructor
method generate
}
constructor JavaUserConstructor {class this i_name} {
set this [JavaThrower::constructor $class $this $i_name]
# Start constructor user section
# End constructor user section
return $this
}
method JavaUserConstructor::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaThrower::destructor
}
method JavaUserConstructor::generate {this sect} {
if {[$this comment] != ""} {
[$this comment] generate $sect
}
if {[$this access] != ""} {
[$this access] generate $sect
}
$sect append [$this name]
$sect appendSect [$this generateParameterList]
$sect appendSect [$this generateThrowList]
$sect append " {\n"
if {[$this userBody] != ""} {
set oldIndent [$sect indent]
$sect indent 0
$sect appendSect [$this userBody]
$sect indent $oldIndent
}
$sect append "} // user constructor [$this name] ${JavaCookie::endMarker}\n\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javainterf.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaInterface : {JavaContainer} {
constructor
method destructor
method generate
}
constructor JavaInterface {class this ooplClass} {
set this [JavaContainer::constructor $class $this $ooplClass]
# Start constructor user section
# End constructor user section
return $this
}
method JavaInterface::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaContainer::destructor
}
method JavaInterface::generate {this sect} {
if {[$this comment] != ""} {
[$this comment] generate $sect
}
if {[$this access] != ""} {
[$this access] generate $sect
}
if {[$this modifier] != ""} {
[$this modifier] generate $sect
}
$sect append "interface [$this name]"
$sect appendSect [$this generateInterfaceList "extends"]
$sect append " {\n"
$sect indent +
$sect append "\n${JavaCookie::dataAttributeSection}\n\n"
[$this variableSet] foreach variable {
$variable generate $sect
}
$sect append "\n${JavaCookie::methodSection}\n\n"
[$this methodSet] foreach method {
$method generate $sect
}
$sect indent -
$sect append "} // interface [$this name]\n\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javaclass.tcl /main/titanic/3
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaClass : {JavaContainer} {
constructor
method destructor
method generate
method needsType
method addAttributeAccessor
method removeAttributeAccessor
method addAssociationAccessor
method removeAssociationAccessor
method addUserConstructor
method removeUserConstructor
method addAssocVariable
method removeAssocVariable
attribute superClass
attribute obsoleteCode
attribute attributeAccessorSet
attribute associationAccessorSet
attribute userConstructorSet
attribute defaultConstructor
attribute assocVariableSet
}
constructor JavaClass {class this ooplClass} {
set this [JavaContainer::constructor $class $this $ooplClass]
$this attributeAccessorSet [List new]
$this associationAccessorSet [List new]
$this userConstructorSet [List new]
$this assocVariableSet [List new]
# Start constructor user section
# End constructor user section
return $this
}
method JavaClass::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaContainer::destructor
}
method JavaClass::generate {this sect} {
if {[$this comment] != ""} {
[$this comment] generate $sect
}
if {[$this access] != ""} {
[$this access] generate $sect
}
if {[$this modifier] != ""} {
[$this modifier] generate $sect
}
$sect append "class [$this name] extends "
if {[$this superClass] == ""} {
$sect append "Object"
} else {
$sect append [$this superClass]
}
$sect appendSect [$this generateInterfaceList "implements"]
$sect append " {\n"
$sect indent +
$sect append "\n${JavaCookie::dataAttributeSection}\n\n"
[$this variableSet] foreach variable {
$variable generate $sect
}
$sect append "\n${JavaCookie::associationAttributeSection}\n\n"
[$this assocVariableSet] foreach variable {
$variable generate $sect
}
$sect append "\n${JavaCookie::defaultConstructorSection}\n\n"
if {[$this defaultConstructor] != ""} {
[$this defaultConstructor] generate $sect
}
$sect append "\n${JavaCookie::userConstructorSection}\n\n"
[$this userConstructorSet] foreach constructor {
$constructor generate $sect
}
$sect append "\n${JavaCookie::methodSection}\n\n"
[$this methodSet] foreach method {
$method generate $sect
}
$sect append "\n${JavaCookie::regenerationEndSection}\n"
$sect append "\n${JavaCookie::attributeAccessorSection}\n\n"
[$this attributeAccessorSet] foreach accessor {
$accessor generate $sect
}
$sect append "\n${JavaCookie::associationAccessorSection}\n\n"
[$this associationAccessorSet] foreach accessor {
$accessor generate $sect
}
if {[$this obsoleteCode] != ""} {
$sect append "\n${JavaCookie::startObsoleteCodeSection}\n\n"
$sect appendSect [$this obsoleteCode]
$sect append "\n${JavaCookie::endObsoleteCodeSection}\n\n"
}
$sect indent -
$sect append "} // class [$this name]\n\n"
}
method JavaClass::needsType {this typeName} {
switch $typeName {
Hashtable {return [$this needsHashtable]}
Vector {return [$this needsVector]}
}
[$this assocVariableSet] foreach variable {
if {[[$variable type] name] == $typeName} {
return 1
}
}
return 0
}
# Do not delete this line -- regeneration end marker
method JavaClass::addAttributeAccessor {this newAttributeAccessor} {
[$this attributeAccessorSet] append $newAttributeAccessor
}
method JavaClass::removeAttributeAccessor {this oldAttributeAccessor} {
[$this attributeAccessorSet] removeValue $oldAttributeAccessor
}
method JavaClass::addAssociationAccessor {this newAssociationAccessor} {
[$this associationAccessorSet] append $newAssociationAccessor
}
method JavaClass::removeAssociationAccessor {this oldAssociationAccessor} {
[$this associationAccessorSet] removeValue $oldAssociationAccessor
}
method JavaClass::addUserConstructor {this newUserConstructor} {
[$this userConstructorSet] append $newUserConstructor
}
method JavaClass::removeUserConstructor {this oldUserConstructor} {
[$this userConstructorSet] removeValue $oldUserConstructor
}
method JavaClass::addAssocVariable {this newAssocVariable} {
[$this assocVariableSet] append $newAssocVariable
}
method JavaClass::removeAssocVariable {this oldAssocVariable} {
[$this assocVariableSet] removeValue $oldAssocVariable
}
#---------------------------------------------------------------------------
# File: @(#)javadoccom.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaDocComment : {JavaComment} {
constructor
method destructor
method generate
}
constructor JavaDocComment {class this comment} {
set this [JavaComment::constructor $class $this $comment]
# Start constructor user section
# End constructor user section
return $this
}
method JavaDocComment::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaComment::destructor
}
method JavaDocComment::generate {this sect} {
$sect append "/**\n"
$sect append "[$this comment]\n"
$sect append "*/\n"
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javalineco.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaLineComment : {JavaComment} {
constructor
method destructor
method generate
}
constructor JavaLineComment {class this comment} {
set this [JavaComment::constructor $class $this $comment]
# Start constructor user section
# End constructor user section
return $this
}
method JavaLineComment::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaComment::destructor
}
method JavaLineComment::generate {this sect} {
set lines [split [$this comment] "\n"]
foreach line $lines {
$sect append "// $line\n"
}
}
# Do not delete this line -- regeneration end marker
#---------------------------------------------------------------------------
# File: @(#)javaexcept.tcl /main/titanic/1
#---------------------------------------------------------------------------
# Start user added include file section
# End user added include file section
Class JavaException : {JavaPackageName} {
constructor
method destructor
}
constructor JavaException {class this i_identifier} {
set this [JavaPackageName::constructor $class $this $i_identifier]
# Start constructor user section
# End constructor user section
return $this
}
method JavaException::destructor {this} {
# Start destructor user section
# End destructor user section
$this JavaPackageName::destructor
}
# Do not delete this line -- regeneration end marker