Class UserClassInfo

java.lang.Object
EDU.purdue.jtb.common.UserClassInfo

public class UserClassInfo extends Object
Class UserClassInfo is used by the JTB driver, the visitors and the files generator to store and retrieve information about a (grammar) user (node) class including its name, the list of its fields, its comments. It is also used to generate the user node class code.

Class and inner classes maintain state (for a user class), and are not supposed to be run in parallel threads (on the same user class).

  • Field Details

    • astEcNode

      public final INode astEcNode
      The corresponding ExpansionChoices node
    • className

      public final String className
      The class name (without optional prefix and suffix)
    • fixedClassName

      public final String fixedClassName
      The class name (including optional prefix and suffix)
    • fields

      public final List<UserClassInfo.FieldInfo> fields
      The list of the class fields representing the node's children
    • fieldCmts

      public List<UserClassInfo.CommentData> fieldCmts
      The list of the field comments data
    • fieldSubCmts

      public List<UserClassInfo.CommentData> fieldSubCmts
      The list of the sub comments data (without field comments data).
      Built and used only when the "inline accept methods" option is on.
    • fieldsHashSig

      public int fieldsHashSig
      The fields hash signature (for helping controlling changes between generated classes versions). Null if no fields.
    • visitFieldCmtsSb

      public StringBuilder visitFieldCmtsSb
      The javadoc formatted field comments used by the visit methods (more than once, so that's why they are stored as an optimization)
  • Constructor Details

    • UserClassInfo

      public UserClassInfo(ExpansionChoices aEC, int aNbFields, String aCN, String aFCN)
      Constructs an instance giving an ExpansionChoices node and a name.
      Parameters:
      aEC - - the ExpansionChoices node
      aNbFields - - the number of fields
      aCN - - the class name
      aFCN - - the fixed name of the class name
  • Method Details

    • addField

      public void addField(String aFT, String aFN)
      Adds a field type, name (with no initializer) to the internal lists.
      Parameters:
      aFT - - the field type
      aFN - - the field name
    • addField

      public void addField(String aFT, String aFFT, String aFN)
      Adds a field type, name, initializer, code and node to the internal lists.
      Parameters:
      aFT - - the field type
      aFFT - - the fixed name of the field type
      aFN - - the field name