Constructor and Description |
---|
Tree()
Creates an empty Tree.
|
Tree(TreeNode<E> node)
Creates a Tree with the specified
TreeNode as the root node. |
Modifier and Type | Method and Description |
---|---|
void |
destroyNode(TreeNode<E> node)
Removes a single node.
|
TreeNode<E> |
getRoot()
Returns the root of this Tree.
|
boolean |
isEmpty()
Returns true if this Tree is empty.
|
void |
killNode(TreeNode<E> node)
Kills a node.
|
TreeNode<E> |
setRoot(TreeNode<E> node)
Sets the root of this Tree.
|
public TreeNode<E> getRoot()
TreeNode
or
null if this Tree is empty.public boolean isEmpty()
TreeNode
is null, false otherwise.public void destroyNode(TreeNode<E> node)
node
- the node to remove.java.lang.NullPointerException
- if node is null.public void killNode(TreeNode<E> node)
node
- the node to kill.java.lang.NullPointerException
- if node is null.TreeException
- if node is not part of this Tree.