EDU.purdue.jtb.misc
Class ClassInfo

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

public class ClassInfo
extends java.lang.Object

Class ClassInfo is used by the visitors to store information about a class including its name, a list of field types, and a list of field names. Class CommentPrinter appears at the end of this file.


Constructor Summary
ClassInfo(Node node, java.lang.String n)
           
 
Method Summary
 void addField(java.lang.String type, java.lang.String name)
           
 void addField(java.lang.String type, java.lang.String name, java.lang.String initialValue)
          Use this method to generate a default constructor where this field value is already filled in, e.g.
 Node getAstNode()
           
 java.lang.String getClassString(Spacing space)
          Returns a string representing the class.
 java.lang.String getEbnfProduction(Spacing space)
          Returns the EBNF production of the current class as a bunch of comments showing which field names belong to which parts of the production.
 java.lang.String getName()
           
 java.util.Vector getNameList()
           
 java.util.Vector getTypeList()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassInfo

public ClassInfo(Node node,
                 java.lang.String n)
Method Detail

getAstNode

public Node getAstNode()

getName

public java.lang.String getName()

getTypeList

public java.util.Vector getTypeList()

getNameList

public java.util.Vector getNameList()

addField

public void addField(java.lang.String type,
                     java.lang.String name)

addField

public void addField(java.lang.String type,
                     java.lang.String name,
                     java.lang.String initialValue)
Use this method to generate a default constructor where this field value is already filled in, e.g.
 MyProduction ::= Foo() "a constant token"
 
 public MyProduction(Foo f) {
    n.f0 = f;
    n.f1 = "a constant token";
 }
 


getEbnfProduction

public java.lang.String getEbnfProduction(Spacing space)
Returns the EBNF production of the current class as a bunch of comments showing which field names belong to which parts of the production.


getClassString

public java.lang.String getClassString(Spacing space)
Returns a string representing the class.