Package org.biojavax.bio.phylo.io.nexus
Class TaxaBlock
- java.lang.Object
-
- org.biojavax.bio.phylo.io.nexus.NexusBlock.Abstract
-
- org.biojavax.bio.phylo.io.nexus.TaxaBlock
-
- All Implemented Interfaces:
NexusBlock,NexusObject
public class TaxaBlock extends NexusBlock.Abstract
Represents Nexus taxa 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
Fields Modifier and Type Field Description static StringTAXA_BLOCKA constant representing the name of Taxa blocks.
-
Constructor Summary
Constructors Constructor Description TaxaBlock()Delegates to NexusBlock.Abstract constructor using TaxaBlock.TAXA_BLOCK as the name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddComment(NexusComment comment)Adds a comment.voidaddTaxLabel(String taxLabel)Add a TAXLABEL.booleancontainsTaxLabel(String taxLabel)Checks to see if we contain the given TAXLABEL.ListgetComments()Returns all comments.intgetDimensionsNTax()Get the NTAX value.ListgetTaxLabels()Get the TAXLABEL values added so far.voidremoveComment(NexusComment comment)Removes a comment.voidremoveTaxLabel(String taxLabel)Removes the given TAXLABEL.voidsetDimensionsNTax(int dimensionsNTax)Set the NTAX value.protected voidwriteBlockContents(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
-
-
-
-
Field Detail
-
TAXA_BLOCK
public static final String TAXA_BLOCK
A constant representing the name of Taxa blocks.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TaxaBlock
public TaxaBlock()
Delegates to NexusBlock.Abstract constructor using TaxaBlock.TAXA_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.
-
addTaxLabel
public void addTaxLabel(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(String taxLabel)
Removes the given TAXLABEL.- Parameters:
taxLabel- the label to remove.
-
containsTaxLabel
public boolean containsTaxLabel(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 List getTaxLabels()
Get the TAXLABEL values added so far.- Returns:
- this labels so far.
-
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 List getComments()
Returns all comments.- Returns:
- all the selected comments.
-
writeBlockContents
protected void writeBlockContents(Writer writer) throws IOException
Description copied from class:NexusBlock.AbstractImplement this to write out block contents, not including the BEGIN and END tags.- Specified by:
writeBlockContentsin classNexusBlock.Abstract- Parameters:
writer- the writer to write to.- Throws:
IOException- if writing failed.
-
-