org.sandev.generator
Class InstClassEnumGenerator

java.lang.Object
  extended byorg.sandev.generator.GeneratorCommon
      extended byorg.sandev.generator.AggregateGeneratorBase
          extended byorg.sandev.generator.InstClassEnumGenerator
All Implemented Interfaces:
org.sandev.sandbuild.SandGenerator

public class InstClassEnumGenerator
extends AggregateGeneratorBase
implements org.sandev.sandbuild.SandGenerator

Write the AppInstanceClassEnumerator source file


Field Summary
 
Fields inherited from class org.sandev.generator.AggregateGeneratorBase
extra
 
Fields inherited from class org.sandev.generator.GeneratorCommon
CONTEXT_CONFIGURATION, CONTEXT_CONTROL, CONTEXT_FRAMEWORK, CONTEXT_MESSAGING, CONTEXT_PERSISTENCE, CONTEXT_UI, DEFAULT_LINE_LENGTH, MESSAGE_INTERFACES
 
Constructor Summary
InstClassEnumGenerator()
           
 
Method Summary
protected  java.lang.String getFileSpec(java.io.File baseDir)
          Return lastApp/src/org/xyz/util/AppInstanceClassEnumerator.java or the equivalent filespec.
protected  java.lang.String[] getSortedShortNames(org.sandev.sandbuild.SandDecl[] decls)
          It is critical that the short and long message names be in the same sorted order so the lookup works.
 void loadSubClassMap(java.util.TreeMap tm, org.sandev.sandbuild.SandDecl[] decls)
          Given a map and the decls, insert TreeSet entries for each superclass/class relationship.
protected  void writeFile(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
          Write the file.
 void writeGetClassLongName(java.io.PrintStream out)
           
 void writeGetShortNames(java.io.PrintStream out)
           
protected  void writeLongNameArray(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
          Write a static array with all the long class names.
 void writeNodeDeclsArray(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
          write a static array with all the NodeInstance messages
 void writePersistMessagesArray(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
          Write a static array with all the persistent messages.
protected  void writePostamble(java.io.PrintStream out)
           
protected  void writePreamble(java.io.PrintStream out)
           
protected  void writeShortNameArray(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
          Write a static array with all the short class names in order
 void writeStructInheritanceArray(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
          Write out an array of arrays, where the ordering is equivalent to the structMessages array, but each array element is an array of classes which extend that struct.
 void writeStructMessagesArray(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
          Write a static array with all the SandStructMessages in order.
protected  void writeSubArray(java.io.PrintStream out, java.lang.String key, java.util.TreeSet ts)
          Given a tree set, write out the array initializer corresponding to its contents.
 
Methods inherited from class org.sandev.generator.AggregateGeneratorBase
addSandAttrValToDecls, cleanup, cleanupSecondaryFiles, generate, getExtra, setExtra, writeSecondaryFiles
 
Methods inherited from class org.sandev.generator.GeneratorCommon
capitalize, copyfile, deletefile, filterHTMLLine, getDeclaredFields, getFields, getInheritanceHierarchy, getLastAppProject, getLastUtilDir, getLongInstanceName, getPrintStream, getSandProject, getShortInstanceName, getUtilPackage, getVisibleFields, isBasic, isLongReferenceArray, isMessageInterface, isParentAbstract, isPrimitive, isRootStruct, isVowel, log, nextToken, pluralize, rangeEscape, removePlatformDecls, trackFileDelete, trackFileWrite, uncapitalize, writeDefaultCtor, writeDescription, writeHTMLContents, writeMessageImports, writeSectionName, writeStandardCommentID, writeXHTMLFooter, writeXHTMLFooter, writeXHTMLHeader, writeXHTMLHeader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.sandev.sandbuild.SandGenerator
cleanup, generate
 

Constructor Detail

InstClassEnumGenerator

public InstClassEnumGenerator()
Method Detail

getFileSpec

protected java.lang.String getFileSpec(java.io.File baseDir)
Return lastApp/src/org/xyz/util/AppInstanceClassEnumerator.java or the equivalent filespec. The given basedir is ignored.

Overrides:
getFileSpec in class AggregateGeneratorBase

writeFile

protected void writeFile(java.io.PrintStream out,
                         org.sandev.sandbuild.SandDecl[] decls)
                  throws org.sandev.sandbuild.SandGeneratorException
Write the file.

Overrides:
writeFile in class AggregateGeneratorBase
Throws:
org.sandev.sandbuild.SandGeneratorException

writePreamble

protected void writePreamble(java.io.PrintStream out)

writePostamble

protected void writePostamble(java.io.PrintStream out)

getSortedShortNames

protected java.lang.String[] getSortedShortNames(org.sandev.sandbuild.SandDecl[] decls)
It is critical that the short and long message names be in the same sorted order so the lookup works. This method factors the creation of this index.


writeShortNameArray

protected void writeShortNameArray(java.io.PrintStream out,
                                   org.sandev.sandbuild.SandDecl[] decls)
Write a static array with all the short class names in order


writeLongNameArray

protected void writeLongNameArray(java.io.PrintStream out,
                                  org.sandev.sandbuild.SandDecl[] decls)
Write a static array with all the long class names.


writeStructMessagesArray

public void writeStructMessagesArray(java.io.PrintStream out,
                                     org.sandev.sandbuild.SandDecl[] decls)
Write a static array with all the SandStructMessages in order. The ordering here is used for subclass lookup.


writeStructInheritanceArray

public void writeStructInheritanceArray(java.io.PrintStream out,
                                        org.sandev.sandbuild.SandDecl[] decls)
                                 throws org.sandev.sandbuild.SandGeneratorException
Write out an array of arrays, where the ordering is equivalent to the structMessages array, but each array element is an array of classes which extend that struct. This enables looking up a particular struct message, and finding all struct messages that extend it. Good for disambiguating what should be instantiated, and determining if any ambiguity exists.

Throws:
org.sandev.sandbuild.SandGeneratorException

loadSubClassMap

public void loadSubClassMap(java.util.TreeMap tm,
                            org.sandev.sandbuild.SandDecl[] decls)
                     throws org.sandev.sandbuild.SandGeneratorException
Given a map and the decls, insert TreeSet entries for each superclass/class relationship. Make sure there is at least one empty TreeSet recorded for each class so we can dump this easily.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeSubArray

protected void writeSubArray(java.io.PrintStream out,
                             java.lang.String key,
                             java.util.TreeSet ts)
Given a tree set, write out the array initializer corresponding to its contents. We use print statements so it ends up on the same line for readability.


writePersistMessagesArray

public void writePersistMessagesArray(java.io.PrintStream out,
                                      org.sandev.sandbuild.SandDecl[] decls)
Write a static array with all the persistent messages. The sorting here is just for readability


writeNodeDeclsArray

public void writeNodeDeclsArray(java.io.PrintStream out,
                                org.sandev.sandbuild.SandDecl[] decls)
write a static array with all the NodeInstance messages


writeGetClassLongName

public void writeGetClassLongName(java.io.PrintStream out)

writeGetShortNames

public void writeGetShortNames(java.io.PrintStream out)