jebl.evolution.distances
Class BasicDistanceMatrix

java.lang.Object
  extended by jebl.evolution.distances.BasicDistanceMatrix
All Implemented Interfaces:
DistanceMatrix
Direct Known Subclasses:
F84DistanceMatrix, HKYDistanceMatrix, JukesCantorDistanceMatrix, SequenceAlignmentsDistanceMatrix, TamuraNeiDistanceMatrix

public class BasicDistanceMatrix
extends java.lang.Object
implements DistanceMatrix

Version:
$Id: BasicDistanceMatrix.java 842 2007-11-12 22:33:48Z twobeers $
Author:
Andrew Rambaut, Alexei Drummond

Constructor Summary
BasicDistanceMatrix(java.util.Collection<Taxon> taxa, double[][] distances)
           
 
Method Summary
 double getDistance(int row, int column)
          Gets the distance at a particular row and column
 double getDistance(Taxon taxonRow, Taxon taxonColumn)
          Gets the distance between 2 taxa
 double[][] getDistances()
          Gets a 2-dimensional array containing the distances
 int getSize()
          Gets the size of the matrix (which is square), i.e., number of rows or columns.
 DistanceMatrix getSubmatrix(java.util.Collection<Taxon> taxonSubset)
          Gets a sub-matrix for only those taxa in the collection (all of which should be present in this matrix).
 java.util.List<Taxon> getTaxa()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicDistanceMatrix

public BasicDistanceMatrix(java.util.Collection<Taxon> taxa,
                           double[][] distances)
Method Detail

getSize

public int getSize()
Gets the size of the matrix (which is square), i.e., number of rows or columns.

Specified by:
getSize in interface DistanceMatrix
Returns:
the size

getTaxa

public java.util.List<Taxon> getTaxa()
Specified by:
getTaxa in interface DistanceMatrix
Returns:
the list of taxa that the state values correspond to.

getDistance

public double getDistance(int row,
                          int column)
Gets the distance at a particular row and column

Specified by:
getDistance in interface DistanceMatrix
Parameters:
row - the row index
column - the column index
Returns:
the distance

getDistance

public double getDistance(Taxon taxonRow,
                          Taxon taxonColumn)
Gets the distance between 2 taxa

Specified by:
getDistance in interface DistanceMatrix
Parameters:
taxonRow -
taxonColumn -
Returns:
the distance

getSubmatrix

public DistanceMatrix getSubmatrix(java.util.Collection<Taxon> taxonSubset)
Gets a sub-matrix for only those taxa in the collection (all of which should be present in this matrix).

Specified by:
getSubmatrix in interface DistanceMatrix
Parameters:
taxonSubset -
Returns:
the new submatrix

getDistances

public double[][] getDistances()
Gets a 2-dimensional array containing the distances

Specified by:
getDistances in interface DistanceMatrix
Returns:
the distances


http://code.google.com/p/jebl2/