uk.ac.bbk.dcs.automed.graph
Class TreeNode
java.lang.Object
uk.ac.bbk.dcs.automed.graph.TreeNode
public class TreeNode
- extends java.lang.Object
Class that abstracts the node of a tree structure.
IMPORTANT: at the moment, the children of a tree node are a set and not a list.
- Author:
- Lucas Zamboulis
Constructor Summary |
protected |
TreeNode(java.lang.String name)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
nodeName
java.lang.String nodeName
children
java.util.List children
parent
TreeNode parent
TreeNode
protected TreeNode(java.lang.String name)
- Parameters:
name
- the name of the node
setParent
protected void setParent(TreeNode n)
- Sets the parent node.
- Parameters:
n
- the parent node
isRoot
public boolean isRoot()
- Returns:
- true if the node is a root node, false otherwise
isLeaf
protected boolean isLeaf()
- Returns:
- true if the node is a leaf node, false otherwise
getParent
public TreeNode getParent()
- Returns:
- the parent node
getChildren
public java.util.List getChildren()
- Returns:
- the set of children of the node
setChildren
protected void setChildren(java.util.List s)
- Sets the children of the node.
- Parameters:
s
- the set of children
addChild
protected void addChild(TreeNode t)
- Adds a node to the set of children of the node
- Parameters:
t
- the node to add in the set of children
getName
public java.lang.String getName()
- Returns:
- the name of the node
setName
public void setName(java.lang.String name)
- Parameters:
name
- the name that will be given to the tree node