|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectTreeNode
TreeNode is the abstract parent class for a parse tree node. It contains an integer ID data field that is common to all types of node. The ID defines what type of tree node this is, e.g., an IF node, a PLUS, etc. The ID values are those defined for symbols in sym.java.
Extensions of TreeNode add additional data fields to hold information necessary for a particular node type. The TreeNode extensions are the following:
See the documentation for each of these extending classes for further detail.
Field Summary | |
int |
id
The ID of this node. |
Constructor Summary | |
TreeNode()
Construct a tree node with id = 0. |
|
TreeNode(int id)
Construct a tree node with the given id. |
|
TreeNode(int id,
int line,
int column)
Construct a tree node with the given id, with the given line and column source file character positions. |
Method Summary | |
static java.lang.String |
symPrint(int id)
Print a readable string value for a numeric-valued tree ID. |
java.lang.String |
toString()
Output the String representation of a pre-order tree traversal. |
abstract java.lang.String |
toString(int level)
This is the recursive work-doer for toString. |
java.lang.String |
toStringLineAndColumn(java.lang.String indent)
Common method for subclasses' toStrings to append line number and column positions, if they have been explicitly set for this node. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int id
Constructor Detail |
public TreeNode()
public TreeNode(int id)
public TreeNode(int id, int line, int column)
Method Detail |
public java.lang.String toString()
For example, the following tree
looks like this from TreeNode.toString
+ a * b cThe implementation of toString() uses an int-valued overload to perform recursive traversal, passing an incrementing level value to successive recursive invocations. See the definitions of toString(int) in each TreeNode extension for further details.
public abstract java.lang.String toString(int level)
public java.lang.String toStringLineAndColumn(java.lang.String indent)
public static java.lang.String symPrint(int id)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |