|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.unihalle.informatik.MiToBo.core.datatypes.MTBTreeNode
@ALDMetaInfo(export=ALLOWED) public class MTBTreeNode
This class implements the nodes of class 'Tree'. The recursive structure of a tree is implicitly given by the list of children of each node that again are TreeNodes on their own.
MTBTree
,
MTBTreeNodeData
Field Summary | |
---|---|
protected Vector<MTBTreeNode> |
childs
List of nodes that are childs of the given node. |
protected MTBTreeNodeData |
dataObject
Data object associated with the given node. |
protected MTBTreeNode |
parent
Parent node |
Constructor Summary | |
---|---|
MTBTreeNode(MTBTreeNodeData object)
Constructor for a TreeNode. |
Method Summary | |
---|---|
void |
addChild(MTBTreeNode t)
Add a new child to the node. |
Vector<MTBTreeNode> |
getChilds()
Returns Vector with child nodes. |
MTBTreeNodeData |
getData()
Returns a reference to the data associated with the node. |
MTBTreeNode |
getParent()
Get the parent of this node. |
void |
printData()
Recursively prints the data contained in the nodes of the tree. |
void |
removeChild(MTBTreeNode t)
Remove child node. |
void |
setParent(MTBTreeNode t)
Set the parent of this node. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MTBTreeNodeData dataObject
protected Vector<MTBTreeNode> childs
protected MTBTreeNode parent
Constructor Detail |
---|
public MTBTreeNode(MTBTreeNodeData object)
object
- Data object associated with the node.Method Detail |
---|
public MTBTreeNodeData getData()
public void addChild(MTBTreeNode t)
Sets the parent reference of the child to this node.
t
- Node to be added as child to this node.public void removeChild(MTBTreeNode t)
t
- Node to be removed.public Vector<MTBTreeNode> getChilds()
public void setParent(MTBTreeNode t)
Also adds this node to the children of the parent.
t
- Parent node.public MTBTreeNode getParent()
public void printData()
The method requires all data objects to be derived from
TreeNodeData
and implement the function printData().
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |