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

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

public class PhyloNode
extends Object
implements Cloneable, Storable

This class implements a node in a PhyloTree A PhyloNode contains some basic informations of itself and the incoming edge Furthermore it contains a list of PhyloNodes that represent the children nodes

Author:
Michael Scharfe

Constructor Summary
PhyloNode()
          Basic constructor
PhyloNode(StringBuffer xml)
          The standard constructor for the interface Storable.
 
Method Summary
 void addChild(PhyloNode node)
          This method adds a children node to the current instance
 PhyloNode clone()
           
 ArrayList<PhyloNode> getAllLeafs()
          This method returns a list of PhyloNodes that are leafs in the subtree starting from this instance
 ArrayList<PhyloNode> getChildrenNodes()
          This method returns a list of PhyloNodes that are children of this instance
 int getId()
          This method returns the ID of the current PhyloNode
 String getName()
          This method returns the name of the current instance
 int getNumberOfAllNodesBelow()
          This method returns the total number of PhyloNodes in the subtree starting from this instance
 double getWeight()
          This method return the weight (length, rate ...) for the incoming edge
 void setId(int id)
          This method set the ID of the current PhyloNode The ID should be unique in the PhyloTree
 void setName(String name)
          This method set a name for the current instance
 void setWeight(double w)
          This method set the weight (length, rate ...) for the incoming edge
 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

PhyloNode

public PhyloNode()
Basic constructor


PhyloNode

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

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

clone

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

addChild

public void addChild(PhyloNode node)
This method adds a children node to the current instance

Parameters:
node - the children node

setName

public void setName(String name)
This method set a name for the current instance

Parameters:
name - the name of the PhyloNode

getName

public String getName()
This method returns the name of the current instance

Returns:
the name of the PhyloNode

setId

public void setId(int id)
This method set the ID of the current PhyloNode The ID should be unique in the PhyloTree

Parameters:
id - the ID of the node

getId

public int getId()
This method returns the ID of the current PhyloNode

Returns:
the ID of the node

setWeight

public void setWeight(double w)
This method set the weight (length, rate ...) for the incoming edge

Parameters:
w - the weight

getWeight

public double getWeight()
This method return the weight (length, rate ...) for the incoming edge

Returns:
the weight

getNumberOfAllNodesBelow

public int getNumberOfAllNodesBelow()
This method returns the total number of PhyloNodes in the subtree starting from this instance

Returns:
the total number of nodes

getChildrenNodes

public ArrayList<PhyloNode> getChildrenNodes()
This method returns a list of PhyloNodes that are children of this instance

Returns:
the children nodes

getAllLeafs

public ArrayList<PhyloNode> getAllLeafs()
This method returns a list of PhyloNodes that are leafs in the subtree starting from this instance

Returns:
the list of leafs

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