|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectscranton.Linear1
scranton.tree.RecursiveBinaryTreeViaLinear1
This interface describes one interpretation of an object oriented versions of the recursive binary tree found in McCarthey's LISP. Specification: a binary tree, T, is (1) empty, T = (), or (2) T = (r,(L,R)) where r is the root of the tree and L and R are (possibly empty) binary trees.
| Field Summary |
| Fields inherited from class scranton.Linear1 |
data, link |
| Constructor Summary | |
RecursiveBinaryTreeViaLinear1()
Construct an empty tree, T=(); |
|
RecursiveBinaryTreeViaLinear1(java.lang.Object obj,
RecursiveBinaryTreeViaLinear1 lst,
RecursiveBinaryTreeViaLinear1 rst)
Construct a tree, T=(obj, ((),())); NOTE: May be used by extensions of this class to construct |
|
| Method Summary | |
Linear1 |
factory()
Returns an empty tree |
java.lang.Object |
getRoot()
Returns a reference to the root of the current tree. |
void |
graft(RecursiveBinaryTree T)
Replace the current tree by T. |
boolean |
isEmpty()
Returns true if and only if the current tree is empty. |
RecursiveBinaryTree |
leftSubtree()
Returns a reference to the left subtree of the current tree. |
RecursiveBinaryTree |
prune()
Return reference to the current tree, then make current tree empty. |
RecursiveBinaryTree |
rightSubtree()
Returns a reference to the right subtree of the current tree. |
void |
setRoot(java.lang.Object obj)
Modify the root of the current tree. |
java.lang.String |
sideways(java.lang.String Str,
char Ch,
int Level)
Constructs a stylized string representation of a binary tree structure that appears sideways when displayed. |
java.lang.String |
toString()
Returns a string representation of the tree. |
| Methods inherited from class scranton.Linear1 |
getData, getLink, setData, setLink |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public RecursiveBinaryTreeViaLinear1()
public RecursiveBinaryTreeViaLinear1(java.lang.Object obj,
RecursiveBinaryTreeViaLinear1 lst,
RecursiveBinaryTreeViaLinear1 rst)
| Method Detail |
public boolean isEmpty()
RecursiveBinaryTree
isEmpty in interface RecursiveBinaryTreeisEmpty()public RecursiveBinaryTree rightSubtree()
RecursiveBinaryTree
rightSubtree in interface RecursiveBinaryTreerightSubtree()public RecursiveBinaryTree leftSubtree()
RecursiveBinaryTree
leftSubtree in interface RecursiveBinaryTreeleftSubtree()public java.lang.Object getRoot()
RecursiveBinaryTree
getRoot in interface RecursiveBinaryTreegetRoot()public void setRoot(java.lang.Object obj)
RecursiveBinaryTree
setRoot in interface RecursiveBinaryTreeobj - The new root of the current treesetRoot(java.lang.Object)public void graft(RecursiveBinaryTree T)
RecursiveBinaryTree
graft in interface RecursiveBinaryTreeT - becomes the current treegraft(scranton.tree.RecursiveBinaryTree)public RecursiveBinaryTree prune()
RecursiveBinaryTree
prune in interface RecursiveBinaryTreeprune()public Linear1 factory()
factory in class Linear1public java.lang.String toString()
RecursiveBinaryTree
toString in interface RecursiveBinaryTreetoString in class Linear1Object.toString()
public java.lang.String sideways(java.lang.String Str,
char Ch,
int Level)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||