pal.tree
Interface Tree

All Superinterfaces:
java.io.Serializable, Units
All Known Implementing Classes:
ParameterizedTree, SimpleTree

public interface Tree
extends Units, java.io.Serializable

Interface for a phylogenetic or genealogical tree.


Fields inherited from interface pal.misc.Units
DAYS, EXPECTED_SUBSTITUTIONS, GENERATIONS, MONTHS, YEARS
 
Method Summary
 void createNodeList()
          This method is called to ensure that the calls to other methods in this interface are valid.
 java.lang.Object getAttribute(Node node, java.lang.String name)
           
 Node getExternalNode(int i)
           
 int getExternalNodeCount()
           
 Node getInternalNode(int i)
           
 int getInternalNodeCount()
           
 Node getRoot()
           
 int getUnits()
          Gets the units that this tree's branch lengths and node heights are expressed in.
 void setAttribute(Node node, java.lang.String name, java.lang.Object value)
          Sets an named attribute for a given node.
 void setRoot(Node root)
          This method constructs a tree from the given root node.
 void setUnits(int units)
          Sets the units that this tree's branch lengths and node heights are expressed in.
 

Method Detail

getRoot

public Node getRoot()
Returns:
the root node of this tree.

setRoot

public void setRoot(Node root)
This method constructs a tree from the given root node.
Parameters:
root - the root node of the tree to construct.

getExternalNodeCount

public int getExternalNodeCount()
Returns:
a count of the number of external nodes (tips) in this tree.

getInternalNodeCount

public int getInternalNodeCount()
Returns:
a count of the number of internal nodes (and hence clades) in this tree.

getExternalNode

public Node getExternalNode(int i)
Returns:
the ith external node in the tree.

getInternalNode

public Node getInternalNode(int i)
Returns:
the ith internal node in the tree.

createNodeList

public void createNodeList()
This method is called to ensure that the calls to other methods in this interface are valid.

getUnits

public int getUnits()
Gets the units that this tree's branch lengths and node heights are expressed in.

setUnits

public void setUnits(int units)
Sets the units that this tree's branch lengths and node heights are expressed in.

setAttribute

public void setAttribute(Node node,
                         java.lang.String name,
                         java.lang.Object value)
Sets an named attribute for a given node.
Parameters:
node - the node whose attribute is being set.
name - the name of the attribute.
value - the new value of the attribute.

getAttribute

public java.lang.Object getAttribute(Node node,
                                     java.lang.String name)
Parameters:
node - the node being interrogated.
name - the name of the attribute of interest.
Returns:
an object representing the named attributed for the numbered node.