org.biojavax.bio.phylo.io.nexus
Class DistancesBlock

java.lang.Object
  extended by org.biojavax.bio.phylo.io.nexus.NexusBlock.Abstract
      extended by org.biojavax.bio.phylo.io.nexus.DistancesBlock
All Implemented Interfaces:
NexusBlock, NexusObject

public class DistancesBlock
extends NexusBlock.Abstract

Represents Nexus distances blocks.

Since:
1.6
Author:
Richard Holland, Tobias Thierer, Jim Balhoff

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.biojavax.bio.phylo.io.nexus.NexusBlock
NexusBlock.Abstract
 
Field Summary
static java.lang.String DISTANCES_BLOCK
          A constant representing the name of Distances blocks.
 
Constructor Summary
DistancesBlock()
          Delegates to NexusBlock.Abstract constructor using DistancesBlock.DISTANCES_BLOCK as the name.
 
Method Summary
 void addComment(NexusComment comment)
          Adds a comment.
 void addMatrixEntry(java.lang.String taxa)
           
 void addTaxLabel(java.lang.String taxLabel)
          Add a TAXLABEL.
 void appendMatrixData(java.lang.String taxa, java.lang.Object data)
           
 boolean containsTaxLabel(java.lang.String taxLabel)
          Checks to see if we contain the given TAXLABEL.
 java.util.List getComments()
          Returns all comments.
 int getDimensionsNChar()
          Get the NCHAR value.
 int getDimensionsNTax()
          Get the NTAX value.
 java.util.List getMatrixData(java.lang.String taxa)
           
 java.lang.String getMissing()
           
 java.util.List getTaxLabels()
          Get the TAXLABEL values added so far.
 boolean isDiagonal()
           
 boolean isInterleaved()
           
 boolean isLabels()
           
 void removeComment(NexusComment comment)
          Removes a comment.
 void removeTaxLabel(java.lang.String taxLabel)
          Removes the given TAXLABEL.
 void setDiagonal(boolean diagonal)
           
 void setDimensionsNChar(int dimensionsNChar)
          Set the NCHAR value.
 void setDimensionsNTax(int dimensionsNTax)
          Set the NTAX value.
 void setInterleaved(boolean interleaved)
           
 void setLabels(boolean labels)
           
 void setMissing(java.lang.String missing)
           
 void setTriangle(java.lang.String triangle)
           
protected  void writeBlockContents(java.io.Writer writer)
          Implement this to write out block contents, not including the BEGIN and END tags.
 
Methods inherited from class org.biojavax.bio.phylo.io.nexus.NexusBlock.Abstract
getBlockName, writeObject, writeToken
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DISTANCES_BLOCK

public static final java.lang.String DISTANCES_BLOCK
A constant representing the name of Distances blocks.

See Also:
Constant Field Values
Constructor Detail

DistancesBlock

public DistancesBlock()
Delegates to NexusBlock.Abstract constructor using DistancesBlock.DISTANCES_BLOCK as the name.

Method Detail

setDimensionsNTax

public void setDimensionsNTax(int dimensionsNTax)
Set the NTAX value.

Parameters:
dimensionsNTax - the NTAX value.

getDimensionsNTax

public int getDimensionsNTax()
Get the NTAX value.

Returns:
the NTAX value.

setDimensionsNChar

public void setDimensionsNChar(int dimensionsNChar)
Set the NCHAR value.

Parameters:
dimensionsNChar - the NCHAR value.

getDimensionsNChar

public int getDimensionsNChar()
Get the NCHAR value.

Returns:
the NCHAR value.

setTriangle

public void setTriangle(java.lang.String triangle)

setDiagonal

public void setDiagonal(boolean diagonal)

isDiagonal

public boolean isDiagonal()

setLabels

public void setLabels(boolean labels)

isLabels

public boolean isLabels()

setMissing

public void setMissing(java.lang.String missing)

getMissing

public java.lang.String getMissing()

setInterleaved

public void setInterleaved(boolean interleaved)

isInterleaved

public boolean isInterleaved()

addTaxLabel

public void addTaxLabel(java.lang.String taxLabel)
                 throws ParseException
Add a TAXLABEL. If it already exists, or is a number that refers to an index position that already exists, an exception is thrown.

Parameters:
taxLabel - the label to add.
Throws:
ParseException - if the label cannot be added.

removeTaxLabel

public void removeTaxLabel(java.lang.String taxLabel)
Removes the given TAXLABEL.

Parameters:
taxLabel - the label to remove.

containsTaxLabel

public boolean containsTaxLabel(java.lang.String taxLabel)
Checks to see if we contain the given TAXLABEL.

Parameters:
taxLabel - the label to check for.
Returns:
true if we already contain it.

getTaxLabels

public java.util.List getTaxLabels()
Get the TAXLABEL values added so far.

Returns:
this labels so far.

addMatrixEntry

public void addMatrixEntry(java.lang.String taxa)

appendMatrixData

public void appendMatrixData(java.lang.String taxa,
                             java.lang.Object data)

getMatrixData

public java.util.List getMatrixData(java.lang.String taxa)

addComment

public void addComment(NexusComment comment)
Adds a comment.

Parameters:
comment - the comment to add.

removeComment

public void removeComment(NexusComment comment)
Removes a comment.

Parameters:
comment - the comment to remove.

getComments

public java.util.List getComments()
Returns all comments.

Returns:
all the selected comments.

writeBlockContents

protected void writeBlockContents(java.io.Writer writer)
                           throws java.io.IOException
Description copied from class: NexusBlock.Abstract
Implement this to write out block contents, not including the BEGIN and END tags.

Specified by:
writeBlockContents in class NexusBlock.Abstract
Parameters:
writer - the writer to write to.
Throws:
java.io.IOException - if writing failed.