|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfi.joensuu.cs.tra.Tree<E>
public class Tree<E>
Tree is a wrapper class for a root
TreeNode
.
TreeNode
Constructor Summary | |
---|---|
Tree()
Creates an empty Tree. |
|
Tree(TreeNode<E> node)
Creates a Tree with the specified TreeNode as the root node. |
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Tree()
public Tree(TreeNode<E> node)
TreeNode
as the root node.
node
- the root node for the Tree.
IllegalArgumentException
- if node has siblings.Method Detail |
---|
public TreeNode<E> setRoot(TreeNode<E> node)
node
- the new root TreeNode
.
TreeNode
.
IllegalArgumentException
- if node has siblings.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.
NullPointerException
- if node is null.public void killNode(TreeNode<E> node)
node
- the node to kill.
NullPointerException
- if node is null.
TreeException
- if node is not part of this Tree.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |