Class TreeNode2
java.lang.Object
TreeNode
TreeNode2
- public class TreeNode2
- extends TreeNode
TreeNode2 extends TreeNode by adding two child components, which are
references other TreeNodes. Hence, TreeNode2 is used to represent binary
syntactic constructs in a parse tree.
Constructor Summary |
TreeNode2(int id,
TreeNode child1,
TreeNode child2)
Construct this with the given id and child TreeNode references. |
Method Summary |
java.lang.String |
toString(int level)
Return the String representation of this subtree, which is the String
value of its ID, followed on the next two indented lines by the
recursive toString of its two children. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
child1
public TreeNode child1
- Reference to the left child of this node.
child2
public TreeNode child2
- Reference to the right child of this node.
TreeNode2
public TreeNode2(int id,
TreeNode child1,
TreeNode child2)
- Construct this with the given id and child TreeNode references.
toString
public java.lang.String toString(int level)
- Return the String representation of this subtree, which is the String
value of its ID, followed on the next two indented lines by the
recursive toString of its two children. See the documentation for TreeNode.toString() for a general
description the way trees are represented as strings.
- Specified by:
toString
in class TreeNode