org.biojavax.bio.phylo.tree
Class DefaultBranch

java.lang.Object
  extended by org.biojavax.bio.phylo.tree.DefaultBranch
All Implemented Interfaces:
Branch
Direct Known Subclasses:
WeightedBranch

public class DefaultBranch
extends Object
implements Branch

Version:
$Id: DefaultBranch.java,v 1.2 2006/12/13 17:46:21 tobias Exp $

created on 12.12.2006 14:16:54

Author:
Tobias Thierer

Constructor Summary
protected DefaultBranch(Node nodeA, Node nodeB)
           
 
Method Summary
 Node getNodeA()
           
 Node getNodeB()
           
 Collection getNodes()
          If this branch is part of a rooted tree, then it is guaranteed that the iterator of this collection will return the parent node first.
 Node getOtherNode(Node node)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultBranch

protected DefaultBranch(Node nodeA,
                        Node nodeB)
Method Detail

getNodeA

public Node getNodeA()
Specified by:
getNodeA in interface Branch
Returns:
The node of this branch that was part of the tree first.

getNodeB

public Node getNodeB()
Specified by:
getNodeB in interface Branch
Returns:
The node at the other end of this branch (not the one returned by Branch.getNodeA())

getOtherNode

public final Node getOtherNode(Node node)
                        throws IllegalArgumentException
Specified by:
getOtherNode in interface Branch
Throws:
IllegalArgumentException

getNodes

public final Collection getNodes()
Description copied from interface: Branch
If this branch is part of a rooted tree, then it is guaranteed that the iterator of this collection will return the parent node first.

Specified by:
getNodes in interface Branch
Returns:
A collection with two nodes, namely the ones returned by Branch.getNodeA() and Branch.getNodeB().

toString

public String toString()
Overrides:
toString in class Object