|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.junaraki.libtree.AbstractTree<T>
net.junaraki.libtree.AbstractRootedTree<T>
T - the type of elements maintained by this treepublic abstract class AbstractRootedTree<T>
A skeletal implementation of the RootedTree interface.
| Constructor Summary | |
|---|---|
AbstractRootedTree()
Sole constructor. |
|
| Method Summary | |
|---|---|
boolean |
contains(java.lang.Object o)
Returns true if this tree contains a node with the specified element; otherwise returns false. |
void |
createRoot()
Creates the root of this tree. |
int |
getHeight()
Returns the height of this tree. |
RootedTreeNode<T> |
getRoot()
Returns the root of this tree. |
boolean |
hasRoot()
Returns true if this tree has the root; otherwise returns false. |
TreeNode<T> |
search(java.lang.Object o)
Returns the node of this tree with the specified element. |
void |
setRoot(RootedTreeNode<T> root)
Sets the specified node to the root of this tree. |
int |
size()
Returns the size of this tree, i.e., the number of elements in this tree. |
java.lang.String |
toString()
Returns the string representation which is similar to the Unix tree command. |
| Methods inherited from class net.junaraki.libtree.AbstractTree |
|---|
isEmpty |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface net.junaraki.libtree.Tree |
|---|
isEmpty |
| Constructor Detail |
|---|
public AbstractRootedTree()
| Method Detail |
|---|
public int size()
Tree
size in interface Tree<T>public int getHeight()
Tree
getHeight in interface Tree<T>public boolean contains(java.lang.Object o)
Tree
contains in interface Tree<T>public TreeNode<T> search(java.lang.Object o)
Tree
search in interface Tree<T>public void createRoot()
RootedTree
createRoot in interface RootedTree<T>public RootedTreeNode<T> getRoot()
RootedTree
getRoot in interface RootedTree<T>public void setRoot(RootedTreeNode<T> root)
RootedTree
setRoot in interface RootedTree<T>public boolean hasRoot()
RootedTree
hasRoot in interface RootedTree<T>public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||