|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
A class that represents a positional binary tree with a recursive binary tree and a stack. The stack maintains the path from the root (bottom of the stack) to the current subtree (top of the stack).
| Method Summary | |
java.lang.Object |
getNode()
Replace the root of the current tree. |
void |
graft(PositionalBinaryTree Subtree)
Grafts a tree to the current position of the tree, which must be empty. |
boolean |
isEmpty()
Returns true if the current position is an empty tree. |
boolean |
isRoot()
Returns true iff the current position is the root fo the tree. |
PositionalBinaryTree |
prune()
Returns the subtree at the current position in the tree and makes the tree at the current position be empty. |
void |
setNode(java.lang.Object obj)
Replace the current root with obj |
void |
toLeftSubtree()
Navigates to the left subtree of the current tree. |
void |
toParent()
Navigates to the parent of the current tree. |
void |
toRightSubtree()
Navigates to the right subtree of the current tree. |
void |
toRoot()
Navigates to the root of the tree structure. |
java.lang.String |
toString()
Returns a string representation of the tree. |
| Method Detail |
public boolean isEmpty()
public boolean isRoot()
public void toRoot()
public void toParent()
public void toLeftSubtree()
public void toRightSubtree()
public java.lang.Object getNode()
public void setNode(java.lang.Object obj)
obj - New contents of the current rootpublic void graft(PositionalBinaryTree Subtree)
Subtree - Grafted to the current position in the treepublic PositionalBinaryTree prune()
public java.lang.String toString()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||