Trees
Class Branch

java.lang.Object
  extended by Trees.Branch

public class Branch
extends java.lang.Object

Represents a branch in a tree

Version:
1.0

Constructor Summary
Branch(java.lang.String parent, java.lang.String child)
          Constructor for a branch of unknown length
Branch(java.lang.String parent, java.lang.String child, double length)
          Constructor for a branch of known length
 
Method Summary
 boolean equals(java.lang.Object o)
           
 java.lang.String getChild()
          Get the child node of the branch
 double getLength()
          Get the length of the branch
 java.lang.String getParent()
          Gets the parent node of the branch
 int hashCode()
           
 boolean hasLength()
          Tests whether this branch has a length associated with it
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Branch

public Branch(java.lang.String parent,
              java.lang.String child)
Constructor for a branch of unknown length

Parameters:
parent - The parent node, that is the node nearer the root
child - The child node

Branch

public Branch(java.lang.String parent,
              java.lang.String child,
              double length)
Constructor for a branch of known length

Parameters:
parent - The parent node, that is the node nearer the root
child - The child node
length - The length of the branch
Method Detail

getParent

public java.lang.String getParent()
Gets the parent node of the branch

Returns:
The parent node

getChild

public java.lang.String getChild()
Get the child node of the branch

Returns:
The child node

getLength

public double getLength()
                 throws TreeException
Get the length of the branch

Returns:
The length of the branch
Throws:
TreeException - Thrown if the branch is of unknown length

hasLength

public boolean hasLength()
Tests whether this branch has a length associated with it

Returns:
Whether this branch has a length

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object