|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.ksu.cis.viewer.BinaryTree
An immutable binary tree that can draw itself.
Constructor Summary | |
BinaryTree()
Constructs an empty BinaryTree. |
|
BinaryTree(Node root,
BinaryTree left,
BinaryTree right)
Constructs a BinaryTree with the given root and children. |
Method Summary | |
Object |
clone()
Because this structure is immutable, this method simply returns this tree itself. |
TreeComponent |
getDrawing()
Returns a drawing of this tree. |
TreeComponent |
getDrawing(Font fnt)
Returns a drawing of the tree using the given Font. |
BinaryTree |
getLeftChild()
Returns the left-hand child of this tree. |
BinaryTree |
getRightChild()
Returns the right-hand child of this tree. |
Node |
getRoot()
Returns the root of this tree. |
boolean |
isEmpty()
Returns true if this tree is empty. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BinaryTree()
public BinaryTree(Node root, BinaryTree left, BinaryTree right) throws NullPointerException
root
- the root of the treeleft
- the left childright
- the right child
NullPointerException
- if root is nullMethod Detail |
public boolean isEmpty()
public Node getRoot() throws EmptyTreeException
EmptyTreeException
- If this tree is empty.public BinaryTree getLeftChild() throws EmptyTreeException
EmptyTreeException
- If this tree is empty.public BinaryTree getRightChild() throws EmptyTreeException
EmptyTreeException
public TreeComponent getDrawing()
public TreeComponent getDrawing(Font fnt) throws NullPointerException
NullPointerException
- if fnt is nullpublic Object clone()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |