uk.ac.bbk.dcs.automed.graph
Class TreeNode

java.lang.Object
  extended by 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

Field Summary
(package private)  java.util.List children
           
(package private)  java.lang.String nodeName
           
(package private)  TreeNode parent
           
 
Constructor Summary
protected TreeNode(java.lang.String name)
           
 
Method Summary
protected  void addChild(TreeNode t)
          Adds a node to the set of children of the node
 java.util.List getChildren()
           
 java.lang.String getName()
           
 TreeNode getParent()
           
protected  boolean isLeaf()
           
 boolean isRoot()
           
protected  void setChildren(java.util.List s)
          Sets the children of the node.
 void setName(java.lang.String name)
           
protected  void setParent(TreeNode n)
          Sets the parent node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nodeName

java.lang.String nodeName

children

java.util.List children

parent

TreeNode parent
Constructor Detail

TreeNode

protected TreeNode(java.lang.String name)
Parameters:
name - the name of the node
Method Detail

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