Class Generator
java.lang.Object
edu.nps.moves.dis7.source.generator.pdus.Generator
- Direct Known Subclasses:
CppGenerator
,CsharpGenerator
,JavaGenerator
,JavascriptGenerator
,ObjcGenerator
,PythonGenerator
Abstract superclass for all the concrete language generators, such as java, c++, etc.
- Author:
- Don McGregor, Mike Bailey and Don Brutzman
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<String,GeneratedClass>
Contains abstract descriptions of all the classes, key = name, value = objectDirectory in which to write the autogenerated source codeprotected Properties
properties for this programming language -
Constructor Summary
ConstructorsConstructorDescriptionGenerator(Map<String,GeneratedClass> pClassDescriptions, Properties pLanguageProperties)
Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Create the directory in which to put the generated source code filesprotected int
getBitsToShift(ClassAttribute anAttribute, String mask)
This is ugly and brute force, but I don't see an easier way to do it.Directory in which to write the autogenerated source codeinitialCap(String aString)
returns a string with the first letter capitalized.initialLower(String aString)
returns a string with the first letter lower case.void
setDirectory(String directory)
Directory in which to write the autogenerated source codeabstract void
Overridden by the subclasses to generate the code specific to that language.
-
Field Details
-
classDescriptions
Contains abstract descriptions of all the classes, key = name, value = object -
directory
Directory in which to write the autogenerated source code -
languageProperties
properties for this programming language
-
-
Constructor Details
-
Generator
Constructor- Parameters:
pClassDescriptions
- of interestpLanguageProperties
- of interest
-
-
Method Details
-
writeClasses
public abstract void writeClasses()Overridden by the subclasses to generate the code specific to that language. -
createDirectory
protected void createDirectory()Create the directory in which to put the generated source code files -
getDirectory
Directory in which to write the autogenerated source code- Returns:
- the directory
-
setDirectory
Directory in which to write the autogenerated source code- Parameters:
directory
- the directory to set
-
initialCap
returns a string with the first letter capitalized.- Parameters:
aString
- of interest- Returns:
- same string with first letter capitalized
-
initialLower
returns a string with the first letter lower case.- Parameters:
aString
- of interest- Returns:
- same string with first letter lower case
-
getBitsToShift
This is ugly and brute force, but I don't see an easier way to do it. Given a mask (like 0xf0) we want to know how many bits to shift an integer when masking in a new value.- Parameters:
anAttribute
- of interestmask
- a character set for the mask value- Returns:
- number of bits to shift
-