Package org.biojavax.bio.phylo.io.nexus
Class CharactersBlock
- java.lang.Object
-
- org.biojavax.bio.phylo.io.nexus.NexusBlock.Abstract
-
- org.biojavax.bio.phylo.io.nexus.CharactersBlock
-
- All Implemented Interfaces:
NexusBlock
,NexusObject
- Direct Known Subclasses:
DataBlock
public class CharactersBlock extends NexusBlock.Abstract
Represents Nexus characters 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 String
CHARACTERS_BLOCK
A constant representing the name of Characters blocks.
-
Constructor Summary
Constructors Modifier Constructor Description CharactersBlock()
Delegates to NexusBlock.Abstract constructor using CharactersBlock.CHARACTERS_BLOCK as the name.protected
CharactersBlock(String replacementLabel)
For the DATA block subclass.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCharLabel(String charLabel)
void
addCharState(String charState)
void
addCharStateKeyword(String charState, String keyword)
void
addComment(NexusComment comment)
Adds a comment.void
addEquate(String symbol, List symbols)
void
addItem(String item)
void
addMatrixEntry(String taxa)
void
addState(String state)
void
addStateLabel(String state, String label)
void
addSymbol(String symbol)
void
addTaxLabel(String taxLabel)
Add a TAXLABEL.void
appendMatrixData(String taxa, Object data)
boolean
containsCharLabel(String charLabel)
boolean
containsTaxLabel(String taxLabel)
Checks to see if we contain the given TAXLABEL.Set
getAllCharStates()
List
getCharLabels()
String
getCharStateLabel(String charState)
List
getCharStateLabelKeywords(String charState)
List
getComments()
Returns all comments.String
getDataType()
int
getDimensionsNChar()
Get the NCHAR value.int
getDimensionsNTax()
Get the NTAX value.int
getEliminateEnd()
int
getEliminateStart()
Map
getEquates()
String
getGap()
List
getItems()
String
getMatchChar()
List
getMatrixData(String taxa)
Collection
getMatrixLabels()
String
getMissing()
List
getStateLabels(String state)
String
getStatesFormat()
List
getSymbols()
List
getTaxLabels()
Get the TAXLABEL values added so far.boolean
isInterleaved()
boolean
isLabels()
boolean
isRespectCase()
boolean
isTokens()
boolean
isTransposed()
void
removeAllItems()
void
removeAllSymbols()
void
removeCharLabel(String charLabel)
void
removeCharState(String charState)
void
removeComment(NexusComment comment)
Removes a comment.void
removeEquate(String symbol)
void
removeItem(String item)
void
removeState(String state)
void
removeSymbol(String symbol)
void
removeTaxLabel(String taxLabel)
Removes the given TAXLABEL.void
setCharStateLabel(String charState, String label)
void
setDataType(String dataType)
void
setDimensionsNChar(int dimensionsNChar)
Set the NCHAR value.void
setDimensionsNTax(int dimensionsNTax)
Set the NTAX value.void
setEliminateEnd(int eliminateEnd)
void
setEliminateStart(int eliminateStart)
void
setGap(String gap)
void
setInterleaved(boolean interleaved)
void
setLabels(boolean labels)
void
setMatchChar(String matchChar)
void
setMissing(String missing)
void
setRespectCase(boolean respectCase)
void
setStatesFormat(String statesFormat)
void
setTokens(boolean tokens)
void
setTransposed(boolean transposed)
protected void
writeBlockContents(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
-
CHARACTERS_BLOCK
public static final String CHARACTERS_BLOCK
A constant representing the name of Characters blocks.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CharactersBlock
public CharactersBlock()
Delegates to NexusBlock.Abstract constructor using CharactersBlock.CHARACTERS_BLOCK as the name.
-
CharactersBlock
protected CharactersBlock(String replacementLabel)
For the DATA block subclass.- Parameters:
replacementLabel
- the different label to use.
-
-
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.
-
setDataType
public void setDataType(String dataType)
-
getDataType
public String getDataType()
-
setRespectCase
public void setRespectCase(boolean respectCase)
-
isRespectCase
public boolean isRespectCase()
-
setMissing
public void setMissing(String missing)
-
getMissing
public String getMissing()
-
removeSymbol
public void removeSymbol(String symbol)
-
removeAllSymbols
public void removeAllSymbols()
-
getSymbols
public List getSymbols()
-
removeEquate
public void removeEquate(String symbol)
-
getEquates
public Map getEquates()
-
setMatchChar
public void setMatchChar(String matchChar)
-
getMatchChar
public String getMatchChar()
-
setLabels
public void setLabels(boolean labels)
-
isLabels
public boolean isLabels()
-
setTransposed
public void setTransposed(boolean transposed)
-
isTransposed
public boolean isTransposed()
-
setInterleaved
public void setInterleaved(boolean interleaved)
-
isInterleaved
public boolean isInterleaved()
-
removeItem
public void removeItem(String item)
-
removeAllItems
public void removeAllItems()
-
setStatesFormat
public void setStatesFormat(String statesFormat)
-
getStatesFormat
public String getStatesFormat()
-
setTokens
public void setTokens(boolean tokens)
-
isTokens
public boolean isTokens()
-
setEliminateStart
public void setEliminateStart(int eliminateStart)
-
getEliminateStart
public int getEliminateStart()
-
setEliminateEnd
public void setEliminateEnd(int eliminateEnd)
-
getEliminateEnd
public int getEliminateEnd()
-
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.
-
addCharState
public void addCharState(String charState)
-
setCharStateLabel
public void setCharStateLabel(String charState, String label)
-
addCharStateKeyword
public void addCharStateKeyword(String charState, String keyword)
-
getCharStateLabel
public String getCharStateLabel(String charState)
-
getCharStateLabelKeywords
public List getCharStateLabelKeywords(String charState)
-
removeCharState
public void removeCharState(String charState)
-
getAllCharStates
public Set getAllCharStates()
-
addCharLabel
public void addCharLabel(String charLabel)
-
removeCharLabel
public void removeCharLabel(String charLabel)
-
containsCharLabel
public boolean containsCharLabel(String charLabel)
-
getCharLabels
public List getCharLabels()
-
addStateLabel
public void addStateLabel(String state, String label)
-
getStateLabels
public List getStateLabels(String state)
-
removeState
public void removeState(String state)
-
addMatrixEntry
public void addMatrixEntry(String taxa)
-
appendMatrixData
public void appendMatrixData(String taxa, Object data)
-
getMatrixData
public List getMatrixData(String taxa)
-
getMatrixLabels
public Collection getMatrixLabels()
-
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.Abstract
Implement this to write out block contents, not including the BEGIN and END tags.- Specified by:
writeBlockContents
in classNexusBlock.Abstract
- Parameters:
writer
- the writer to write to.- Throws:
IOException
- if writing failed.
-
-