public class MTBTreeNode extends Object
MTBTree
,
MTBTreeNodeData
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
MTBTreeNode(MTBTreeNodeData object)
Constructor for a TreeNode.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(MTBTreeNode t)
Add a new child to the node.
|
Vector<MTBTreeNode> |
getAllSubtreeNodesDepthFirst()
Recursively collect all nodes of the subtree below this 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 |
setData(MTBTreeNodeData d)
Set the data object of the node.
|
void |
setParent(MTBTreeNode t)
Set the parent of this node.
|
protected MTBTreeNodeData dataObject
protected Vector<MTBTreeNode> childs
protected MTBTreeNode parent
public MTBTreeNode(MTBTreeNodeData object)
object
- Data object associated with the node.public void setData(MTBTreeNodeData d)
d
- New data object associated with node.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().
public Vector<MTBTreeNode> getAllSubtreeNodesDepthFirst()
The method runs in a depth-first fashion.
Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.