EDU.purdue.jtb.misc
Class FieldNameGenerator

java.lang.Object
  extended by EDU.purdue.jtb.misc.FieldNameGenerator

public class FieldNameGenerator
extends java.lang.Object

Class FieldNameGenerator generates the names of the fields of node classes depending on whether the "-f" parameter for descriptive field names has been used or not. By default, field will be named "fX" where X ascends from 0 to the number of children - 1. If the "-f" parameter is used, the names will be based on the classes of the children. For example, a child of class "WhileStatement" will be called "whileStatementX" (note the lowercase first letter), where X is either nothing if this is the first WhileStatement in this production or 1 through the number of children - 1 for any additional children of the same type.


Constructor Summary
FieldNameGenerator()
           
 
Method Summary
 java.lang.String curFieldName(java.lang.String fieldName)
           
 java.lang.String getNameForMod(java.lang.String mod)
           
 void resetFieldNum()
           
 java.lang.String varNameForClass(java.lang.String className)
          Returns a variable name for the name of the given class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FieldNameGenerator

public FieldNameGenerator()
Method Detail

resetFieldNum

public void resetFieldNum()

curFieldName

public java.lang.String curFieldName(java.lang.String fieldName)

varNameForClass

public java.lang.String varNameForClass(java.lang.String className)
Returns a variable name for the name of the given class.


getNameForMod

public java.lang.String getNameForMod(java.lang.String mod)