Class AbstractGenerator
java.lang.Object
edu.nps.moves.dis7.source.generator.pdus.AbstractGenerator
- Direct Known Subclasses:
CppGenerator,CsharpGenerator,JavaGenerator,JavascriptGenerator,ObjcGenerator,PythonGenerator
Abstract superclass for all the concrete language generators such as Java, Python, 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 code, relative to root of projectprotected Propertiesproperties for this programming language -
Constructor Summary
ConstructorsConstructorDescriptionAbstractGenerator(Map<String, GeneratedClass> pClassDescriptions, Properties pLanguageProperties) Constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcreateGeneratedSourceDirectory(boolean cleanFiles) Create the directory in which to put the generated source code filesprotected intgetBitsToShift(GeneratedClassAttribute 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 codeinitialCapital(String aString) returns a string with the first letter capitalized.initialLower(String aString) returns a string with the first letter lower case.voidsetGeneratedSourceDirectoryName(String newDirectoryName) Directory in which to write the autogenerated source codeabstract voidOverridden 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 -
generatedSourceDirectoryName
Directory in which to write the autogenerated source code, relative to root of project -
languageProperties
properties for this programming language
-
-
Constructor Details
-
AbstractGenerator
public AbstractGenerator(Map<String, GeneratedClass> pClassDescriptions, Properties pLanguageProperties) 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. -
createGeneratedSourceDirectory
protected void createGeneratedSourceDirectory(boolean cleanFiles) Create the directory in which to put the generated source code files- Parameters:
cleanFiles- whether to clean out prior files, if any exist in that directory
-
getGeneratedSourceDirectoryName
Directory in which to write the autogenerated source code- Returns:
- the directory name
-
setGeneratedSourceDirectoryName
Directory in which to write the autogenerated source code- Parameters:
newDirectoryName- the directory to set
-
initialCapital
-
initialLower
-
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
-