public class TreeNode extends Object
Modifier and Type | Field and Description |
---|---|
private TreeNode |
leftChild
The first (leftmost) child
|
private TreeNode |
parent
The parent of this node
|
private TreeNode |
rightSibling
The next node on the child list that I am on
|
Constructor and Description |
---|
TreeNode()
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(TreeNode node)
adds a child to this node
|
void |
clear()
Sets all tree pointers to null
|
Enumeration<TreeNode> |
getChildren() |
TreeNode |
getLeftChild()
returns the first child of this node
|
TreeNode |
getParent()
return the parent of this node
|
TreeNode |
getRightSibling()
returns the next node with the same parent as me
|
private TreeNode rightSibling
public TreeNode()
public TreeNode getLeftChild()
public TreeNode getRightSibling()
public void addChild(TreeNode node)
node
- the new childpublic void clear()
public Enumeration<TreeNode> getChildren()