|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.MiToBo.core.datatypes.MTBTree
public class MTBTree
This class implements a simple tree data structure.
The main component of a tree is its root node. It can have an unrestricted number of children. The tree structure is implicitly given by the recursive (one-way) linkage of nodes to their children. Each node of the tree is associated with a certain data object. Each data object has to be derived from class 'TreeNodeData' to enable one of the basic features of this tree - the recursive printing of data contained within the tree.
MTBTreeNode
,
MTBTreeNodeData
Field Summary | |
---|---|
protected MTBTreeNode |
root
Root node of the tree. |
Constructor Summary | |
---|---|
MTBTree(MTBTreeNode rootNode)
Constructor for the tree for a given root node. |
|
MTBTree(MTBTreeNodeData rootObject)
Constructor for the tree. |
Method Summary | |
---|---|
MTBTreeNode |
getRoot()
Access the root node. |
void |
printTree()
Prints tree data. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MTBTreeNode root
Constructor Detail |
---|
public MTBTree(MTBTreeNode rootNode)
rootNode
- the root nodepublic MTBTree(MTBTreeNodeData rootObject)
An associated data object has to be provided in any case.
rootObject
- Data object associated with the root node.Method Detail |
---|
public MTBTreeNode getRoot()
public void printTree()
Special feature of this tree: this function prints recursively the data contained inside the tree. Prerequisite for this is that the data objects of each node provide a method for printing their data in a reasonable way, i.e. implement the method printData() of the abstract class TreeNodeData.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |