public class NexusReaderStreamDataProvider extends TextReaderStreamDataProvider<NexusEventReader> implements NexusConstants
NexusCommandEventReader
reading from the same document.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
INFO_CHARACTER_NAME_TO_INDEX_MAP |
static java.lang.String |
INFO_KEY_BLOCK_ID_MAP |
static java.lang.String |
INFO_KEY_BLOCK_LINKS |
static java.lang.String |
INFO_KEY_BLOCK_START_EVENT_FIRED |
static java.lang.String |
INFO_KEY_BLOCK_TITLE
Used to store the title of the current block if specified by a TITLE command.
|
static java.lang.String |
INFO_KEY_CURRENT_BLOCK_ID
Used to store the ID of the according JPhyloIO event to the current Nexus block (if one exists).
|
static java.lang.String |
INFO_KEY_ELEMENT_LIST |
static java.lang.String |
INFO_KEY_MATRIX_WIDTHS_MAP
Used to Determine the lengths of character set intervals that shall reach until the end of a matrix.
|
static java.lang.String |
INFO_KEY_NEXUS_NAME_TO_ID_MAP |
static java.lang.String |
INFO_KEY_TREES_TRANSLATION |
ALTERNATIVE_END_COMMAND, BEGIN_COMMAND, BLOCK_NAME_CHARACTERS, BLOCK_NAME_DATA, BLOCK_NAME_NETWORKS, BLOCK_NAME_SETS, BLOCK_NAME_TAXA, BLOCK_NAME_TREES, BLOCK_NAME_UNALIGNED, CHARACTER_NAME_STATES_SEPARATOR, COMMAND_END, COMMAND_NAME_CHAR_LABELS, COMMAND_NAME_CHAR_SET, COMMAND_NAME_CHAR_STATE_LABELS, COMMAND_NAME_DIMENSIONS, COMMAND_NAME_FORMAT, COMMAND_NAME_LINK, COMMAND_NAME_MATRIX, COMMAND_NAME_NETWORK, COMMAND_NAME_TAX_LABELS, COMMAND_NAME_TAXON_SET, COMMAND_NAME_TITLE, COMMAND_NAME_TRANSLATE, COMMAND_NAME_TREE, COMMAND_NAME_TREE_SET, COMMENT_END, COMMENT_START, DIMENSIONS_SUBCOMMAND_NCHAR, DIMENSIONS_SUBCOMMAND_NEW_TAXA, DIMENSIONS_SUBCOMMAND_NTAX, ELEMENT_SEPARATOR, END_COMMAND, FIRST_LINE, FORMAT_NAME_STANDARD, FORMAT_NAME_VECTOR, FORMAT_SUBCOMMAND_DATA_TYPE, FORMAT_SUBCOMMAND_GAP_CHAR, FORMAT_SUBCOMMAND_INTERLEAVE, FORMAT_SUBCOMMAND_MATCH_CHAR, FORMAT_SUBCOMMAND_MISSING_CHAR, FORMAT_SUBCOMMAND_NO_LABELS, FORMAT_SUBCOMMAND_NO_TOKENS, FORMAT_SUBCOMMAND_SYMBOLS, FORMAT_SUBCOMMAND_TOKENS, FORMAT_SUBCOMMAND_TRANSPOSE, FORMAT_VALUE_CONTINUOUS_DATA_TYPE, FORMAT_VALUE_DNA_DATA_TYPE, FORMAT_VALUE_MIXED_DATA_TYPE, FORMAT_VALUE_NUCLEOTIDE_DATA_TYPE, FORMAT_VALUE_PROTEIN_DATA_TYPE, FORMAT_VALUE_RNA_DATA_TYPE, FORMAT_VALUE_STANDARD_DATA_TYPE, KEY_VALUE_SEPARATOR, MATRIX_POLYMORPHIC_TOKEN_END, MATRIX_POLYMORPHIC_TOKEN_START, MATRIX_UNCERTAINS_TOKEN_END, MATRIX_UNCERTAINS_TOKEN_START, NEXUS_FORMAT_NAME, NEXUS_NAMESPACE_PREFIX, NEXUS_PREDICATE_NAMESPACE, SET_END_INDEX_SYMBOL, SET_KEY_WORD_ALL, SET_KEY_WORD_REMAINING, SET_REGULAR_INTERVAL_SYMBOL, SET_TO_SYMBOL, SET_VECTOR_CONTAINED, SET_VECTOR_NOT_CONTAINED, UNTIL_WHITESPACE_COMMENT_COMMAND_EQUAL_PATTERN, UNTIL_WHITESPACE_COMMENT_COMMAND_PATTERN, VALUE_DELIMITER, WORD_DELIMITER
Constructor and Description |
---|
NexusReaderStreamDataProvider(NexusEventReader nexusReader) |
Modifier and Type | Method and Description |
---|---|
void |
clearBlockInformation() |
void |
consumeWhiteSpaceAndComments()
Calls
#consumeWhiteSpaceAndComments(char, char) with according parameters and
ensures visibility for NexusReaderStreamDataProvider . |
java.util.Map<java.lang.String,java.lang.String> |
getBlockLinks()
Returns the map that contains links to other blocks that are explicitly linked to this block.
|
BlockTitleToIDMap |
getBlockTitleToIDMap()
Returns a map object that can translate Nexus block titles to the IDs of the according JPhyloIO start events.
|
java.lang.String |
getCurrentLinkedBlockID(java.lang.String blockTypeName)
Returns the JPhyloIO ID of the start event describing the Nexus block of the specified type that is linked to the current
block.
|
java.util.List<java.lang.String> |
getElementList(EventContentType type,
java.lang.String listID) |
NexusEventReader |
getEventReader() |
java.util.Map<?,?> |
getMap(java.lang.String key)
Gets a map object from the shared information map.
|
java.lang.String |
getMatrixLink()
Returns the ID if a
CHARACTERS , DATA or UNALIGNED block that is linked to the current block. |
java.util.Map<java.lang.String,java.lang.Long> |
getMatrixWidthsMap()
Returns a map object that stores the widths of all sequence matrices encountered until now.
|
java.util.Map<java.lang.String,java.lang.String> |
getNexusNameToIDMap(EventContentType type,
java.lang.String listID)
Returns a map object that translates between a Nexus name and the JPhyloIO ID of the according event.
|
ParameterMap |
getSharedInformationMap()
This map can be used to store objects to be shared between different instances of
NexusCommandEventReader . |
NexusTranslationTable |
getTreesTranslationTable()
Returns the current Nexus translation table object.
|
void |
readComment() |
KeyValueInformation |
readKeyValueMetaInformation() |
java.lang.String |
readNexusWord() |
long |
readPositiveInteger(long startOrEndIndex)
Tries to read a positive integer from the current position of the underlying stream-
|
getDataReader
eventsUpcoming, getCurrentEventCollection, getIDManager, getParameters, getSequenceTokensEventManager, hasSpecialEventCollection, resetCurrentEventCollection, setCurrentEventCollection
public static final java.lang.String INFO_KEY_BLOCK_START_EVENT_FIRED
public static final java.lang.String INFO_KEY_CURRENT_BLOCK_ID
public static final java.lang.String INFO_KEY_BLOCK_TITLE
public static final java.lang.String INFO_KEY_BLOCK_LINKS
public static final java.lang.String INFO_KEY_BLOCK_ID_MAP
public static final java.lang.String INFO_KEY_ELEMENT_LIST
public static final java.lang.String INFO_KEY_NEXUS_NAME_TO_ID_MAP
public static final java.lang.String INFO_CHARACTER_NAME_TO_INDEX_MAP
public static final java.lang.String INFO_KEY_TREES_TRANSLATION
public static final java.lang.String INFO_KEY_MATRIX_WIDTHS_MAP
public NexusReaderStreamDataProvider(NexusEventReader nexusReader)
public NexusEventReader getEventReader()
getEventReader
in class ReaderStreamDataProvider<NexusEventReader>
public void consumeWhiteSpaceAndComments() throws java.io.IOException
#consumeWhiteSpaceAndComments(char, char)
with according parameters and
ensures visibility for NexusReaderStreamDataProvider
.java.io.IOException
- if an I/O error occurs during the read operationpublic java.lang.String readNexusWord() throws java.io.IOException
java.io.IOException
public long readPositiveInteger(long startOrEndIndex) throws java.io.IOException
startOrEndIndex
- the value to be returned, if '.'
is encountered (It is used as a placeholder
for the highest possible index in some commands.)startOrEndIndex
or -2 if neither a positive integer nor '.'
was foundjava.io.IOException
public void readComment() throws java.io.IOException
java.io.IOException
public KeyValueInformation readKeyValueMetaInformation() throws java.io.IOException
java.io.IOException
public ParameterMap getSharedInformationMap()
NexusCommandEventReader
.public java.util.Map<java.lang.String,java.lang.String> getBlockLinks()
The returned map is used internally in JPhyloIO to manage links of the current block that are defined with a
LINK
command. It should never be used to determine a currently linked block, but getCurrentLinkedBlockID(String)
should be used instead.
public java.lang.String getMatrixLink()
CHARACTERS
, DATA
or UNALIGNED
block that is linked to the current block.
If none of these blocks is explicitly linked, returning a default linked block will be tried in this order. If no default
linked block is found, null
will be returned.null
public void clearBlockInformation()
public java.util.Map<?,?> getMap(java.lang.String key)
HashMap
instance is stored under
the specified key and returned.key
- the key in the shared information mappublic BlockTitleToIDMap getBlockTitleToIDMap()
public java.lang.String getCurrentLinkedBlockID(java.lang.String blockTypeName)
getBlockLinks()
. If no link is found, the default link
from BlockTitleToIDMap.getDefaultBlockID(String)
will be returned.blockTypeName
- the name of the Nexus block type that could be linkednull
if no according block could be foundpublic java.util.List<java.lang.String> getElementList(EventContentType type, java.lang.String listID)
public java.util.Map<java.lang.String,java.lang.String> getNexusNameToIDMap(EventContentType type, java.lang.String listID)
type
- the event type of events of the requested IDlistID
- the JPhyloIO ID of the according OTU list start eventjava.lang.NullPointerException
- if listID is null
public NexusTranslationTable getTreesTranslationTable()
public java.util.Map<java.lang.String,java.lang.Long> getMatrixWidthsMap()