de.jstacs.sequenceScores.statisticalModels.trainable.phylo
Class PhyloTree

java.lang.Object
  extended by de.jstacs.sequenceScores.statisticalModels.trainable.phylo.PhyloTree
All Implemented Interfaces:
Storable, Cloneable

public class PhyloTree
extends Object
implements Cloneable, Storable

This class implements a simple (phylogenetic) tree. A PhyloTree contains the root node of type PhyloNode

Author:
Michael Scharfe

Constructor Summary
PhyloTree(StringBuffer xml)
          The standard constructor for the interface Storable.
PhyloTree(String name, PhyloNode root)
          Construct an instance of the class PhyloTree
 
Method Summary
 PhyloTree clone()
           
 ArrayList<PhyloNode> getAllLeafs()
          This method returns a list of PhyloNodes that represent the leafs of the tree
 String getName()
          This method returns the name of the PhyloTree
 int getNumberOfNodes()
          This method returns the total number of nodes in the tree
 PhyloNode getRoot()
          This method returns the root node of the tree
 StringBuffer toXML()
          This method returns an XML representation as StringBuffer of an instance of the implementing class.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PhyloTree

public PhyloTree(String name,
                 PhyloNode root)
Construct an instance of the class PhyloTree

Parameters:
name - the name of the PhyloTree
root - the root node

PhyloTree

public PhyloTree(StringBuffer xml)
          throws NonParsableException
The standard constructor for the interface Storable. Constructs a PhyloTree out of an XML representation.

Parameters:
xml - the XML representation as StringBuffer
Throws:
NonParsableException - if the PhyloTree could not be reconstructed out of the StringBuffer xml
Method Detail

clone

public PhyloTree clone()
                throws CloneNotSupportedException
Overrides:
clone in class Object
Throws:
CloneNotSupportedException

getName

public String getName()
This method returns the name of the PhyloTree

Returns:
the name of the tree

getRoot

public PhyloNode getRoot()
This method returns the root node of the tree

Returns:
the root node

getNumberOfNodes

public int getNumberOfNodes()
This method returns the total number of nodes in the tree

Returns:
the number of nodes in the tree

getAllLeafs

public ArrayList<PhyloNode> getAllLeafs()
This method returns a list of PhyloNodes that represent the leafs of the tree

Returns:
the leafs of the tree

toXML

public StringBuffer toXML()
Description copied from interface: Storable
This method returns an XML representation as StringBuffer of an instance of the implementing class.

Specified by:
toXML in interface Storable
Returns:
the XML representation