org.sandev.generator
Class InstClassEnumGenerator

java.lang.Object
  extended by org.sandev.generator.GeneratorCommon
      extended by org.sandev.generator.AggregateGeneratorBase
          extended by org.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  org.sandev.sandbuild.SandDecl[] filterDecls(org.sandev.sandbuild.SandDecl[] decls)
          Remove any declarations that are referencing instances used by the platform since we haven't built that yet.
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.
protected  boolean haveVerbInstanceDecls(org.sandev.sandbuild.SandDecl[] decls)
          Return true if we have a VerbInstance declaration, false otherwise.
 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.
 void writeClassnameTrans(java.io.PrintStream out)
           
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, org.sandev.sandbuild.SandDecl[] decls)
           
 void writeSandCollectionMessageTypesArray(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
           
 void writeSandMessageTypesArray(java.io.PrintStream out)
           
 void writeSandQueryMessageTypesArray(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
           
 void writeSandUpdateMessageTypesArray(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
           
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.
 void writeStructPrintnamesArray(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
          Write out an array of struct printname strings where the order corresponds to the order of the structMessages array.
 void writeStructTooltipsArray(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
          Write out an array of struct tooltip text where the order matches the order of the structMessages array.
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.
 void writeVerbInstanceTrans(java.io.PrintStream out, org.sandev.sandbuild.SandDecl[] decls)
           
 
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, findStructDeclByShortname, getDeclaredFields, getFields, getInheritanceHierarchy, getLastAppProject, getLastUtilDir, getLongInstanceName, getPrintStream, getSandProject, getShortInstanceName, getUtilPackage, getVisibleFields, hasSubStructs, isArray, 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)
                                throws org.sandev.sandbuild.SandGeneratorException
Return lastApp/src/org/xyz/util/AppInstanceClassEnumerator.java or the equivalent filespec. The given basedir is ignored.

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

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

filterDecls

protected org.sandev.sandbuild.SandDecl[] filterDecls(org.sandev.sandbuild.SandDecl[] decls)
Remove any declarations that are referencing instances used by the platform since we haven't built that yet.


writePreamble

protected void writePreamble(java.io.PrintStream out,
                             org.sandev.sandbuild.SandDecl[] decls)
                      throws org.sandev.sandbuild.SandGeneratorException
Throws:
org.sandev.sandbuild.SandGeneratorException

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.


writeStructPrintnamesArray

public void writeStructPrintnamesArray(java.io.PrintStream out,
                                       org.sandev.sandbuild.SandDecl[] decls)
                                throws org.sandev.sandbuild.SandGeneratorException
Write out an array of struct printname strings where the order corresponds to the order of the structMessages array.

Throws:
org.sandev.sandbuild.SandGeneratorException

writeStructTooltipsArray

public void writeStructTooltipsArray(java.io.PrintStream out,
                                     org.sandev.sandbuild.SandDecl[] decls)
                              throws org.sandev.sandbuild.SandGeneratorException
Write out an array of struct tooltip text where the order matches the order of the structMessages array.

Throws:
org.sandev.sandbuild.SandGeneratorException

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


writeSandMessageTypesArray

public void writeSandMessageTypesArray(java.io.PrintStream out)

writeSandQueryMessageTypesArray

public void writeSandQueryMessageTypesArray(java.io.PrintStream out,
                                            org.sandev.sandbuild.SandDecl[] decls)

writeSandCollectionMessageTypesArray

public void writeSandCollectionMessageTypesArray(java.io.PrintStream out,
                                                 org.sandev.sandbuild.SandDecl[] decls)

writeSandUpdateMessageTypesArray

public void writeSandUpdateMessageTypesArray(java.io.PrintStream out,
                                             org.sandev.sandbuild.SandDecl[] decls)

writeGetClassLongName

public void writeGetClassLongName(java.io.PrintStream out)

writeGetShortNames

public void writeGetShortNames(java.io.PrintStream out)

writeClassnameTrans

public void writeClassnameTrans(java.io.PrintStream out)

haveVerbInstanceDecls

protected boolean haveVerbInstanceDecls(org.sandev.sandbuild.SandDecl[] decls)
Return true if we have a VerbInstance declaration, false otherwise. The verb instance structs are declared in apps/ui, so if we are building without a sandui then these won't exist.


writeVerbInstanceTrans

public void writeVerbInstanceTrans(java.io.PrintStream out,
                                   org.sandev.sandbuild.SandDecl[] decls)