pal.tree
Interface Tree

All Superinterfaces:
IdGroup, java.io.Serializable, Units, UnitsProvider
All Known Subinterfaces:
ParameterizedTree
All Known Implementing Classes:
ClockTree, ClusterTree, DemographicClockTree, LogParameterizedTree, MutationRateModelTree, NeighborJoiningTree, ParameterizedTree.ParameterizedTreeBase, ReadTree, SimpleTree, SUPGMATree, Tree.TreeBase, UnconstrainedTree, UPGMATree

public interface Tree
extends IdGroup, Units, java.io.Serializable, UnitsProvider

Interface for a phylogenetic or genealogical tree.

Version:
$Id: Tree.java,v 1.22 2002/10/03 06:06:55 matt Exp $
Author:
Alexei Drummond

Nested Class Summary
static class Tree.TreeBase
           
 
Nested classes/interfaces inherited from interface pal.misc.IdGroup
IdGroup.Utils
 
Field Summary
 
Fields inherited from interface pal.misc.Units
DAYS, EXPECTED_SUBSTITUTIONS, GENERATIONS, MONTHS, SAMPLE, SHORT_UNIT_NAMES, UNIT_NAMES, UNKNOWN, 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)
           
 Tree getCopy()
           
 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.
 
Methods inherited from interface pal.misc.IdGroup
getIdCount, getIdentifier, setIdentifier, whichIdNumber
 

Method Detail

getRoot

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

setRoot

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

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

getInternalNodeCount

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

getExternalNode

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

getInternalNode

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

createNodeList

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


getUnits

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

Specified by:
getUnits in interface UnitsProvider
Returns:
the units relating to this object.

setAttribute

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

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.

getCopy

Tree getCopy()
Returns:
a clone of this tree