public class JavaCodeGenerator extends ProceduralCodeGenerator
red (zgang) |
red (zgang) |
NamedObj.ContainedObjectsIterator
_compileCommandDefault, _includes, _libraries, compile, compileCommand, generateEmbeddedCode
_modifiedVariables, _newTypesUsed, _portTypeMap, _portTypeMap2, _portTypeMap3, _portTypeMaxIndex, _portTypeMaxIndex2, _portTypeMaxIndex3, _primitiveTypes, _runCommandDefault, _substituteMap, _tokenFuncUsed, _typeFuncUsed, _variablesAsArrays, generateComment, inline, maximumLinesPerBlock, measureTime, run, runCommand, useMake, variablesAsArrays, verbosity
_codeFileName, _eol, _executeCommands, _generateInSubdirectory, _model, _sanitizedModelName, codeDirectory, generateInSubdirectory, generatorPackage, generatorPackageList, INDENT1, INDENT2, INDENT3, overwriteFiles
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
JavaCodeGenerator(NamedObj container,
java.lang.String name)
Create a new instance of the Java code generator.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_addActorIncludeDirectories()
Add include directories specified by the actors in this model.
|
protected void |
_addActorLibraries()
Add libraries specified by the actors in this model.
|
protected void |
_addClassPathLibraries()
Add the directories and files from the classpath to
the list of libraries.
|
protected void |
_analyzeTypeConversions()
Analyze the model to find out what connections need to be type
converted.
|
protected java.lang.String |
_concatenateClasspath(java.util.Collection<java.lang.String> collection)
Given a Collection of Strings, return a string where each element of the
Set is separated by $.
|
protected java.lang.StringBuffer |
_finalPassOverCode(java.lang.StringBuffer code)
Make a final pass over the generated code.
|
protected java.lang.String |
_generateIncludeFiles()
Generate include files.
|
protected java.lang.String |
_generatePreinitializeMethodBodyCode()
Generate the preinitialization method body.
|
protected java.lang.String |
_generatePreinitializeMethodEntryCode()
Generate the preinitialization procedure entry point.
|
protected java.lang.String |
_generatePreinitializeMethodExitCode()
Generate the preinitialization procedure exit point.
|
protected java.lang.String |
_generatePreinitializeMethodProcedureName()
Generate the preinitialization procedure name.
|
protected CodeGeneratorAdapter |
_getAutoGeneratedAdapter(GenericCodeGenerator codeGenerator,
java.lang.Object object)
Attempt to automatically generate an adapter.
|
protected java.lang.String |
_getFireFunctionArguments()
Return the prototype for fire functions.
|
protected java.lang.String |
_printExecutionTime()
Generate the code for printing the execution time since
the code generated by _recordStartTime() was called.
|
protected java.lang.String |
_processCode(java.lang.String code)
Process the specified code for the adapter associated with the
container.
|
protected java.lang.String |
_recordStartTime()
Generate the code for recording the current time.
|
protected void |
_reset()
Reset the code generator.
|
protected java.lang.Class<? extends TemplateParser> |
_templateParserClass()
Return the class of the templateParser class.
|
protected void |
_writeMakefile(CompositeEntity container,
java.lang.String currentDirectory)
Read in a template makefile, substitute variables and write
the resulting makefile.
|
protected java.lang.String |
_writeVariableDeclarations(java.util.List<java.lang.String> variableDeclarations)
Write the variable declaration code.
|
java.lang.String |
codeGenType(Type type)
Get the corresponding type in code generation from the given Ptolemy
type.
|
static java.lang.String |
codeGenType2(Type type)
Get the corresponding type in code generation from the given Ptolemy
type.
|
static Type |
codeGenTypeToPtType(int codeGenType)
Return the type that corresponds with an index in the typesArray in
in the generated type.
|
static java.lang.Short |
codeGenTypeValue(java.lang.String type)
Return the index of the type in the typesArray in the generated code.
|
java.lang.String |
generateClosingEntryCode()
Return the closing entry code, if any.
|
java.lang.String |
generateClosingExitCode()
Return the closing exit code, if any.
|
java.lang.String |
generateConstantDefinition(java.lang.String constant,
java.lang.String type,
java.lang.String value)
Generate code that defines a constant.
|
java.lang.String |
generateFireFunctionCompositeEnd()
Generate the closing code for a group of fire functions common
to a Composite Actor.
|
java.lang.String |
generateFireFunctionCompositeStart(java.lang.String className)
Generate the initial code for a group of fire functions common
to a Composite Actor.
|
java.lang.String |
generateFireFunctionMethodInvocation(NamedObj namedObj)
Generate the fire function method invocation.
|
java.lang.String |
generateFireFunctionMethodName(NamedObj namedObj)
Generate the fire function method name.
|
java.lang.String[] |
generateFireFunctionVariableAndMethodName(NamedObj namedObj)
Generate the fire function variable name and method
name.
|
java.lang.String |
generateFireFunctionVariableDeclaration(NamedObj namedObj)
Generate the fire function variable declaration.
|
java.lang.Object |
generateFunctionTable(java.lang.String[] types,
java.lang.String[] functions)
Generate the function table.
|
java.lang.String |
generateInitializeEntryCode()
Generate the initialization procedure entry point.
|
java.lang.String |
generateInitializeExitCode()
Generate the initialization procedure exit point.
|
java.lang.String |
generateInitializeProcedureName()
Generate the initialization procedure name.
|
java.lang.String |
generateLineInfo(int lineNumber,
java.lang.String filename)
Generate line number information.
|
java.lang.String |
generateMainEntryCode()
Generate the main entry point.
|
java.lang.String |
generateMainExitCode()
Generate the main exit point.
|
java.lang.String |
generatePackageStatement()
Generate the package statement, if any.
|
java.lang.String |
generatePostfireEntryCode()
Generate the postfire procedure entry point.
|
java.lang.String |
generatePostfireExitCode()
Generate the postfire procedure exit point.
|
java.lang.String |
generatePostfireProcedureName()
Generate the postfire procedure name.
|
java.lang.String |
generateTypeConvertCode()
Generate type conversion code.
|
java.lang.String |
generateVariableDeclaration()
Generate variable declarations for inputs and outputs and parameters.
|
java.lang.String |
generateVariableInitialization()
Generate variable initialization for the referenced parameters.
|
java.lang.String |
generateVariableName(NamedObj attribute)
Generate variable name for the given attribute.
|
java.lang.String |
generateWrapupEntryCode()
Generate the wrapup procedure entry point.
|
java.lang.String |
generateWrapupExitCode()
Generate the wrapup procedure exit point.
|
java.lang.String |
generateWrapupProcedureName()
Generate the wrapup procedure name.
|
java.lang.String |
getMethodExceptionString()
Return the exception signature (for Java).
|
java.lang.String |
getMethodVisibilityString()
Return the return signature for run() and execute().
|
void |
markFunctionCalled(java.lang.String name,
JavaTemplateParser javaTemplateParser)
Add called functions to the set of overloaded functions for
later use.
|
static int |
ptTypeToCodegenType(Type type)
Return the index of the type in the typesArray in the generated code.
|
java.lang.String[] |
splitLongBody(int linesPerMethod,
java.lang.String prefix,
java.lang.String code)
Split a long function body into multiple inner classes.
|
java.util.List<java.lang.String> |
splitVariableDeclaration(int linesPerMethod,
java.lang.String prefix,
java.lang.String code)
Split a long variable declaration body into multiple blocks or
files.
|
java.lang.String |
targetType(Type ptType)
Get the corresponding type in Java from the given Ptolemy type.
|
_concatenateElements, _executeCommands, addInclude, addLibrary, addLibraryIfNecessary, clone, markFunctionCalled
_codeDirectoryAsFile, _formatComment, _generateBodyCode, _generateCode, _generatePreinitializeCode, _generateSharedCode, _instantiateAdapter, _setupAdapter, _splitBody, _splitVariableDeclaration, addModifiedVariables, attributeChanged, comment, comment, containsCode, generateFireFunctionCode, generateInitializeCode, generatePortName, generatePostfireCode, generatePtIOPortName, generatePtIOPortSize, generatePtTypedCompositeActorName, generatePtTypedCompositeActorSize, generateWrapupCode, getModifiedVariables, getTemplateExtension, isPrimitive, isPrimitive, ptolemyType, setModifiedVariables, updateCommandOptions
_copyCFilesTosrc, _copyCFileTosrc, _getAdapter, _getAdapterClassFilter, _getOutputFilename, _isTopLevel, _printTimeAndMemory, _resetAll, _writeCode, _writeCodeFileName, createDecoratorAttributes, decoratedObjects, generateCode, generateCode, generateCode, generateCopyright, getAdapter, getCodeFileName, getComponent, getExecuteCommands, isGlobalDecorator, main, setCodeGenerator, setContainer, setExecuteCommands
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
description, getContainer, getDisplayName, getFullName, getName, getName, setName
public JavaCodeGenerator(NamedObj container, java.lang.String name) throws IllegalActionException, NameDuplicationException
container
- The container.name
- The name of the Java code generator.IllegalActionException
- If the super class throws the
exception or error occurs when setting the file path.NameDuplicationException
- If the super class throws the
exception or an error occurs when setting the file path.public java.lang.String codeGenType(Type type)
codeGenType
in class ProgramCodeGenerator
type
- The given Ptolemy type.ProgramCodeGenerator.ptolemyType(String)
public static java.lang.String codeGenType2(Type type)
type
- The given Ptolemy type.public static java.lang.Short codeGenTypeValue(java.lang.String type) throws IllegalActionException
type
- The given codegen type.IllegalActionException
- If the type is unsupported.public static Type codeGenTypeToPtType(int codeGenType) throws IllegalActionException
codeGenType
- The index of the codegen type.IllegalActionException
- If the type is unsupported.ptTypeToCodegenType(Type)
public static int ptTypeToCodegenType(Type type) throws IllegalActionException
type
- The given Ptolemy type.IllegalActionException
- If the type is unsupported.codeGenTypeToPtType(int)
public java.lang.String generateConstantDefinition(java.lang.String constant, java.lang.String type, java.lang.String value)
generateConstantDefinition
in class ProgramCodeGenerator
constant
- The name of the constant to be definedtype
- A string representing the type. In C, this
parameter is ignored.value
- The value of the constant.public java.lang.String generateFireFunctionCompositeEnd()
generateFireFunctionCompositeEnd
in class ProgramCodeGenerator
public java.lang.String generateFireFunctionCompositeStart(java.lang.String className)
generateFireFunctionCompositeStart
in class ProgramCodeGenerator
className
- The name of the class to include in the
initial code.public java.lang.String generateFireFunctionMethodInvocation(NamedObj namedObj) throws IllegalActionException
So as to reduce the size of classes to be compiled, this code generator generates the fire function methods for the top two levels of composites in separate inner classes. This method returns a String that contains variable that refers to an instance of the inner class followed by the name of the method to be invoked.
generateFireFunctionMethodInvocation
in class ProgramCodeGenerator
namedObj
- The named object for which the name is generated.IllegalActionException
- If thrown while generating fire code.public java.lang.String generateFireFunctionMethodName(NamedObj namedObj) throws IllegalActionException
So as to reduce the size of classes to be compiled, this code generator generates the fire function methods for the top two levels of composites in separate inner classes. This method returns a String that contains the name of the method to be invoked.
generateFireFunctionMethodName
in class ProgramCodeGenerator
namedObj
- The named object for which the name is generated.IllegalActionException
- If thrown while generating fire code.public java.lang.String[] generateFireFunctionVariableAndMethodName(NamedObj namedObj) throws IllegalActionException
So as to reduce the size of classes to be compiled, this code generator generates the fire function methods for the top two levels of composites in separate inner classes.
generateFireFunctionVariableAndMethodName
in class ProgramCodeGenerator
namedObj
- The named object for which the name is generated.IllegalActionException
- If thrown while generating fire code.public java.lang.String generateFireFunctionVariableDeclaration(NamedObj namedObj) throws IllegalActionException
So as to reduce the size of classes the Java Code Generator, the fire function methods for the top two levels of composites are placed in a separate inner class.
generateFireFunctionVariableDeclaration
in class ProgramCodeGenerator
namedObj
- The named object for which the name is generated.IllegalActionException
- If there are problems
accessing the name of the namedObj or generating the variable
declaration.public java.lang.Object generateFunctionTable(java.lang.String[] types, java.lang.String[] functions)
types
- An array of types.functions
- An array of functions.public java.lang.String generateClosingEntryCode()
generateClosingEntryCode
in class ProgramCodeGenerator
public java.lang.String generateClosingExitCode()
generateClosingExitCode
in class ProgramCodeGenerator
public java.lang.String generateInitializeEntryCode() throws IllegalActionException
generateInitializeEntryCode
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class..public java.lang.String generateInitializeExitCode() throws IllegalActionException
generateInitializeExitCode
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class..public java.lang.String generateInitializeProcedureName() throws IllegalActionException
generateInitializeProcedureName
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this baseclass.public java.lang.String generateLineInfo(int lineNumber, java.lang.String filename)
#line lineNumber "filename"are generated for use by the C preprocessor.
generateLineInfo
in class ProgramCodeGenerator
lineNumber
- The line number of the source file or
file containing code blocks.filename
- The name of the source file or file containing
code blocks.public java.lang.String generateMainEntryCode() throws IllegalActionException
generateMainEntryCode
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.public java.lang.String generateMainExitCode() throws IllegalActionException
generateMainExitCode
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.public java.lang.String generatePackageStatement() throws IllegalActionException
generatePackageStatement
in class ProgramCodeGenerator
IllegalActionException
- Thrown if generateInSubdirectory
cannot be read.public java.lang.String generatePostfireEntryCode() throws IllegalActionException
generatePostfireEntryCode
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.public java.lang.String generatePostfireExitCode() throws IllegalActionException
generatePostfireExitCode
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.public java.lang.String generatePostfireProcedureName() throws IllegalActionException
generatePostfireProcedureName
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.public java.lang.String generateTypeConvertCode() throws IllegalActionException
generateTypeConvertCode
in class ProgramCodeGenerator
IllegalActionException
- If an error occurs when generating
the type resolution code, or if the adapter class for the model
director cannot be found, or if an error occurs when the adapter
actor generates the type resolution code.public java.lang.String generateVariableDeclaration() throws IllegalActionException
generateVariableDeclaration
in class ProgramCodeGenerator
IllegalActionException
- If the adapter class for the model
director cannot be found.public java.lang.String generateVariableInitialization() throws IllegalActionException
generateVariableInitialization
in class ProgramCodeGenerator
IllegalActionException
- If the adapter class for the model
director cannot be found.public java.lang.String generateVariableName(NamedObj attribute)
generateVariableName
in class ProgramCodeGenerator
attribute
- The attribute to for which to generate a variable name.public java.lang.String generateWrapupEntryCode() throws IllegalActionException
generateWrapupEntryCode
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.public java.lang.String generateWrapupExitCode() throws IllegalActionException
generateWrapupExitCode
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.public java.lang.String generateWrapupProcedureName() throws IllegalActionException
generateWrapupProcedureName
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.public java.lang.String getMethodVisibilityString()
getMethodVisibilityString
in class GenericCodeGenerator
public java.lang.String getMethodExceptionString()
getMethodExceptionString
in class GenericCodeGenerator
public void markFunctionCalled(java.lang.String name, JavaTemplateParser javaTemplateParser) throws IllegalActionException
name
- The name of the function, for example "Double_equals"javaTemplateParser
- The corresponding parser that contains the
codeBlock.IllegalActionException
- If there is a problem adding
a function to the set of overloaded functions.public java.lang.String[] splitLongBody(int linesPerMethod, java.lang.String prefix, java.lang.String code) throws java.io.IOException
splitLongBody
in class ProgramCodeGenerator
linesPerMethod
- The number of lines that should go into
each method.prefix
- The prefix to use when naming inner classes that
are created.code
- The method body to be split.java.io.IOException
- If thrown while reading the code.public java.util.List<java.lang.String> splitVariableDeclaration(int linesPerMethod, java.lang.String prefix, java.lang.String code) throws java.io.IOException
For Java, if the code consists of
linesPerMethod or fewer lines, then the the first
element will be the empty string and the second element will
consist of the value of the code argument. If the code
consists of more than linesPerMethod then the first
element will consist of one or more "import static" statements
and the second and possibly successive element will consist of
Java classes that should be written out by
_writeVariableDeclarations(List)
.
splitVariableDeclaration
in class ProgramCodeGenerator
linesPerMethod
- The number of lines that should go into
each method.prefix
- The prefix to use when naming functions that
are createdcode
- The variable declarations to be split.java.io.IOException
- If thrown while reading the code.public java.lang.String targetType(Type ptType)
targetType
in class ProgramCodeGenerator
ptType
- The given Ptolemy type.protected void _addActorIncludeDirectories() throws IllegalActionException
_addActorIncludeDirectories
in class ProgramCodeGenerator
IllegalActionException
- If thrown when getting an actor's
include directories.protected void _addActorLibraries() throws IllegalActionException
_addActorLibraries
in class ProgramCodeGenerator
IllegalActionException
- If thrown when getting an actor's
libraries.ProceduralCodeGenerator.addLibrary(String)
,
ProceduralCodeGenerator.addLibraryIfNecessary(String)
protected void _addClassPathLibraries()
protected void _analyzeTypeConversions() throws IllegalActionException
_analyzeTypeConversions
in class ProgramCodeGenerator
IllegalActionException
- If the adapter of the
top composite actor is unavailable.protected java.lang.String _concatenateClasspath(java.util.Collection<java.lang.String> collection)
collection
- The Collection of Strings.protected java.lang.StringBuffer _finalPassOverCode(java.lang.StringBuffer code) throws IllegalActionException
_finalPassOverCode
in class ProgramCodeGenerator
code
- The given code to be processed.IllegalActionException
- If #getOutputFilename() throws it.protected java.lang.String _generateIncludeFiles() throws IllegalActionException
_generateIncludeFiles
in class ProgramCodeGenerator
IllegalActionException
- If the adapter class for some actor
cannot be found.protected java.lang.String _generatePreinitializeMethodBodyCode() throws IllegalActionException
Typically, the preinitialize code consists of variable declarations. However, AutoAdapter generates method calls that instantiate wrapper TypedCompositeActors, so we need to invoke those method calls.
_generatePreinitializeMethodBodyCode
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.protected java.lang.String _generatePreinitializeMethodEntryCode() throws IllegalActionException
_generatePreinitializeMethodEntryCode
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.protected java.lang.String _generatePreinitializeMethodExitCode() throws IllegalActionException
_generatePreinitializeMethodExitCode
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.protected java.lang.String _generatePreinitializeMethodProcedureName() throws IllegalActionException
_generatePreinitializeMethodProcedureName
in class ProgramCodeGenerator
IllegalActionException
- Not thrown in this base class.protected CodeGeneratorAdapter _getAutoGeneratedAdapter(GenericCodeGenerator codeGenerator, java.lang.Object object)
_getAutoGeneratedAdapter
in class GenericCodeGenerator
codeGenerator
- The code generator with which to associate the adapter.object
- The given object.protected java.lang.String _getFireFunctionArguments()
_getFireFunctionArguments
in class ProgramCodeGenerator
protected java.lang.String _printExecutionTime()
_printExecutionTime
in class ProgramCodeGenerator
protected java.lang.String _processCode(java.lang.String code) throws IllegalActionException
code
- The code to process.IllegalActionException
- If illegal macro names are found.protected java.lang.String _recordStartTime()
_recordStartTime
in class ProgramCodeGenerator
protected void _reset() throws IllegalActionException
_reset
in class ProceduralCodeGenerator
IllegalActionException
- Not thrown in this base class,
thrown by the parent if the container of the model
cannot be set to null.protected java.lang.Class<? extends TemplateParser> _templateParserClass()
_templateParserClass
in class ProgramCodeGenerator
protected void _writeMakefile(CompositeEntity container, java.lang.String currentDirectory) throws IllegalActionException
If a .mk.in
file with the name of the sanitized model
name, then that file is used as a template. For example, if the
model name is Foo
and the file Foo.mk.in
exists, then the file Foo.mk.in
is used as a makefile
template.
If no .mk.in
file is found, then the makefile
template can be found by looking up a resource name
makefile.in in the package named by the
generatorPackage parameter. Thus, if the
generatorPackage has the value "ptolemy.codegen.c",
then we look for the resource "ptolemy.codegen.c.makefile.in", which
is usually found as $PTII/ptolemy/codegen/c/makefile.in
.
The makefile is written to a directory named by the codeDirectory parameter, with a file name that is a sanitized version of the model name, and a ".mk" extension. Thus, for a model named "Foo", we might generate a makefile in "$HOME/codegen/Foo.mk".
Under Java under Windows, your $HOME
variable
is set to the value of the user.home
System property,
which is usually something like
C:\Documents and Settings\yourlogin
, thus
for user mrptolemy
the makefile would be
C:\Documents and Settings\mrptolemy\codegen\Foo.mk
.
The following variables are substituted
@modelName@
StringUtilities.sanitizeName(String)
on the model name.
@PTCGIncludes@
ProceduralCodeGenerator.addInclude(String)
, where each
element is separated by a space.
@PTCGLibraries@
ProceduralCodeGenerator.addLibrary(String)
, where each
element is separated by a space.
_writeMakefile
in class ProceduralCodeGenerator
container
- The composite actor for which we generate the makefilecurrentDirectory
- The director in which the makefile is to be written.IllegalActionException
- If there is a problem reading
a parameter, if there is a problem creating the codeDirectory directory
or if there is a problem writing the code to a file.protected java.lang.String _writeVariableDeclarations(java.util.List<java.lang.String> variableDeclarations) throws IllegalActionException
If the first element is the empty String, then the second element contains all of the variable declarations and this method does not create files and the value of the second element is returned. If the first element is not the empty string, then the second and successive elements are written to a file whos name is created by parsing the first element. The first element must consist of strings like "import static variables.foo;", the file name will be "variables/foo.java".
_writeVariableDeclarations
in class ProgramCodeGenerator
variableDeclarations
- A List of two or more elements.
first element is not empty, then it contains the language
specific declarations for the variable declarations. In Java,
the first element may consist of one or more "import"
statements. The second and successive elements contain the
code to be written to separate files or to be returned as one
String.IllegalActionException
- Thrown if there is a problem
writing the files.