|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectikg.adt.tree.Tree
public class Tree
Class with standard methods for handling binary trees
| Field Summary | |
|---|---|
protected TreeElement |
root
|
| Constructor Summary | |
|---|---|
Tree()
Constructor for the empty Tree object |
|
Tree(java.lang.Object newContent)
Constructor for the Tree object with newcontent as root |
|
| Method Summary | |
|---|---|
void |
addLeftTree(Tree newLeft)
Adds a tree to the Left attribute of the Tree object |
void |
addRightTree(Tree newRight)
Adds a tree to the Right attribute of the Tree object |
int |
getDepth(Tree b)
Gets the depth of the tree |
java.lang.String |
getInOrder()
inOrder-Traversierung |
Tree |
getLeftTree()
Gets the left attribute of the Tree object |
java.lang.String |
getPostOrder()
postOrder-Traversierung |
java.lang.String |
getPreOrder()
preOrder-Traversierung |
Tree |
getRightTree()
Gets the right attribute of the Tree object |
java.lang.Object |
getRootItem()
Gets the informationobject of root |
boolean |
isEmpty()
Gets the empty attribute of the Tree object |
boolean |
isLeaf()
Gets the leaf attribute of the Tree object |
java.lang.Object |
lastLeft(Tree b)
returns the outmost left node of the tree |
java.lang.Object |
lastRight(Tree b)
returns the outmost right node of the tree |
void |
loadTree(java.lang.String datName)
The complete tree is loaded from a diskfile. |
int |
numberOfNodes(Tree b)
determine the number of nodes of the tree |
void |
saveTree(java.lang.String datName)
The complete tree is written to a diskfile. |
void |
setRootItem(java.lang.Object newInfo)
sets the information of root to newInfo |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected TreeElement root
| Constructor Detail |
|---|
public Tree()
public Tree(java.lang.Object newContent)
newContent - object of any type| Method Detail |
|---|
public boolean isEmpty()
public void setRootItem(java.lang.Object newInfo)
newInfo - the new informationobjectpublic java.lang.Object getRootItem()
public void addRightTree(Tree newRight)
newRight - The tree to be added to the Right attributepublic void addLeftTree(Tree newLeft)
newLeft - The tree to be added to the Left attributepublic Tree getRightTree()
public Tree getLeftTree()
public boolean isLeaf()
public int numberOfNodes(Tree b)
b - Tree
public int getDepth(Tree b)
b - Tree
public java.lang.Object lastRight(Tree b)
b - Tree
public java.lang.Object lastLeft(Tree b)
b - Tree
public void saveTree(java.lang.String datName)
datName - name of the diskfile. If only the 8+3 name is specified the
file is written in the actual directory; otherwise the name must be a
absolute pathpublic void loadTree(java.lang.String datName)
datName - name of the diskfile. If only the 8+3 name is specified the
file is written in the actual directory; otherwise the name must be a
absolute pathpublic java.lang.String getInOrder()
public java.lang.String getPostOrder()
public java.lang.String getPreOrder()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||