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

java.lang.Object
  extended by uk.ac.bbk.dcs.automed.graph.Forest

public class Forest
extends java.lang.Object

Class that abstracts the structure of a forest.

Author:
Lucas Zamboulis

Field Summary
static java.lang.String genericRootName
           
 
Constructor Summary
Forest()
           
 
Method Summary
 void addTree(TreeNode root)
          Adds a tree to the forest.
 TreeNode forestToTree()
          This method adds a generic root node to the forest and adds the trees' roots as children to the generic root node.
 java.util.HashSet getForest()
           
 void printForest()
           
protected  void printTree(TreeNode root, int depth)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

genericRootName

public static final java.lang.String genericRootName
See Also:
Constant Field Values
Constructor Detail

Forest

public Forest()
Method Detail

getForest

public java.util.HashSet getForest()
Returns:
the roots of the trees consisting the forest

addTree

public void addTree(TreeNode root)
Adds a tree to the forest.

Parameters:
root - the root of the tree

forestToTree

public TreeNode forestToTree()
This method adds a generic root node to the forest and adds the trees' roots as children to the generic root node. As a result, the forest is transformed into a tree.

Returns:
the root node of the newly created tree

printForest

public void printForest()

printTree

protected void printTree(TreeNode root,
                         int depth)