public class StoreMatrixDataAdapter extends StoreAnnotatedDataAdapter<LinkedLabeledIDEvent> implements MatrixDataAdapter
| Constructor and Description |
|---|
StoreMatrixDataAdapter(LinkedLabeledIDEvent alignmentStartEvent,
boolean longTokens,
java.util.List<JPhyloIOEvent> annotations) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsLongTokens(ReadWriteParameterMap parameters)
Returns whether tokens longer than one character are contained in the matrix modeled by this
instance.
|
StoreObjectListDataAdapter<CharacterDefinitionEvent> |
getCharacterDefinitions(ReadWriteParameterMap parameters)
Returns a list of character definitions for the matrix modeled by this instance.
|
StoreObjectListDataAdapter<LinkedLabeledIDEvent> |
getCharacterSets(ReadWriteParameterMap parameters)
Returns a list of character sets defined for the matrix modeled by this instance.
|
long |
getColumnCount(ReadWriteParameterMap parameters)
Returns the number of columns the modeled matrix has, if it contains aligned data or -1 if it
contains unaligned data and each sequence may have a different length.
|
StoreObjectListDataAdapter<LinkedLabeledIDEvent> |
getMatrix() |
long |
getSequenceCount(ReadWriteParameterMap parameters)
Returns the number of sequences contained in this matrix.
|
java.util.Iterator<java.lang.String> |
getSequenceIDIterator(ReadWriteParameterMap parameters)
Returns an iterator returning the IDs of all sequences in the represented matrix.
|
long |
getSequenceLength(ReadWriteParameterMap parameters,
java.lang.String sequenceID)
Returns the length for the specified sequence.
|
StoreObjectListDataAdapter<LinkedLabeledIDEvent> |
getSequenceSets(ReadWriteParameterMap parameters)
Returns a list of sequence sets defined for the matrix modeled by this instance.
|
LinkedLabeledIDEvent |
getSequenceStartEvent(ReadWriteParameterMap parameters,
java.lang.String sequenceID)
Returns an event describing the sequence with the specified ID.
|
LinkedLabeledIDEvent |
getStartEvent(ReadWriteParameterMap parameters)
Returns the start event of this data element.
|
StoreObjectListDataAdapter<TokenSetDefinitionEvent> |
getTokenSets(ReadWriteParameterMap parameters)
Returns a list of token sets defined for the matrix modeled by this instance.
|
void |
writeSequencePartContentData(ReadWriteParameterMap parameters,
JPhyloIOEventReceiver receiver,
java.lang.String sequenceID,
long startColumn,
long endColumn)
Implementing classes must write a sequence of events here, that describe the sequence tokens present in
the specified column range.
|
getAnnotations, writeMetadataclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitwriteMetadatapublic StoreMatrixDataAdapter(LinkedLabeledIDEvent alignmentStartEvent, boolean longTokens, java.util.List<JPhyloIOEvent> annotations)
public LinkedLabeledIDEvent getStartEvent(ReadWriteParameterMap parameters)
ElementDataAdaptergetStartEvent in interface ElementDataAdapter<LinkedLabeledIDEvent>parameters - the parameter map of the calling writer that provides context information for the data requestpublic long getSequenceCount(ReadWriteParameterMap parameters)
MatrixDataAdaptergetSequenceCount in interface MatrixDataAdapterparameters - the parameter map of the calling writer that provides context information for the data requestMatrixDataAdapter.getSequenceIDIterator(ReadWriteParameterMap)public long getColumnCount(ReadWriteParameterMap parameters)
MatrixDataAdapterFor some writers the return value of this method may also determine which type of sequence data is written. (A Nexus writer would e.g. use an UNALIGNED instead of a CHARACTERS block, if -1 is returned.)
getColumnCount in interface MatrixDataAdapterparameters - the parameter map of the calling writer that provides context information for the data requestpublic boolean containsLongTokens(ReadWriteParameterMap parameters)
MatrixDataAdaptercontainsLongTokens in interface MatrixDataAdapterparameters - the parameter map of the calling writer that provides context information for the data requesttrue if tokens longer than one character may occur, or false if all tokens
are exactly one character longpublic StoreObjectListDataAdapter<LinkedLabeledIDEvent> getMatrix()
public StoreObjectListDataAdapter<LinkedLabeledIDEvent> getCharacterSets(ReadWriteParameterMap parameters)
MatrixDataAdaptergetCharacterSets in interface MatrixDataAdapterparameters - the parameter map of the calling writer that provides context information for the data requestpublic StoreObjectListDataAdapter<TokenSetDefinitionEvent> getTokenSets(ReadWriteParameterMap parameters)
MatrixDataAdaptergetTokenSets in interface MatrixDataAdapterparameters - the parameter map of the calling writer that provides context information for the data requestpublic java.util.Iterator<java.lang.String> getSequenceIDIterator(ReadWriteParameterMap parameters)
MatrixDataAdapter
Note that the returned iterator will be in ongoing use while other methods (e.g.
#writeSequencePartContent(JPhyloIOEventReceiver, String, long, long)) are called.
Therefore implementing classes should make sure, that the source of the iterator is not
modified while a JPhyloIO writer is in use. (The iterator should not throw a
ConcurrentModificationException before writing the target document is finished.)
getSequenceIDIterator in interface MatrixDataAdapterparameters - the parameter map of the calling writer that provides context information for the data requestpublic LinkedLabeledIDEvent getSequenceStartEvent(ReadWriteParameterMap parameters, java.lang.String sequenceID) throws java.lang.IllegalArgumentException
MatrixDataAdaptergetSequenceStartEvent in interface MatrixDataAdapterparameters - the parameter map of the calling writer that provides context information for the data requestsequenceID - the ID of the sequence to be describedjava.lang.IllegalArgumentExceptionpublic long getSequenceLength(ReadWriteParameterMap parameters, java.lang.String sequenceID) throws java.lang.IllegalArgumentException
MatrixDataAdapterMatrixDataAdapter.getColumnCount(ReadWriteParameterMap) returns does not return -1,
this method should return the same value as MatrixDataAdapter.getColumnCount(ReadWriteParameterMap) for each sequence. Otherwise it
may return different values for each sequence.getSequenceLength in interface MatrixDataAdapterparameters - the parameter map of the calling writer that provides context information for the data requestsequenceID - the ID of the sequence which defined the lengthjava.lang.IllegalArgumentException - if an unknown sequence ID was specifiedpublic void writeSequencePartContentData(ReadWriteParameterMap parameters, JPhyloIOEventReceiver receiver, java.lang.String sequenceID, long startColumn, long endColumn) throws java.io.IOException, java.lang.IllegalArgumentException
MatrixDataAdapterSequencePartContent in the documentation of JPhyloIOEventReader.
Note that (according to the grammar definition) metadata related to the sequence as a whole can also be
passed to the receiver in this method. In most cases it makes sense to pass the respective
metaevents at the beginning of this sequence, i.e., if this method is called with startColumn = 0
the first events written should be the metaevents for the whole sequence. (Note that the grammar in principle
allows such metaevents also between sequence token events, but not all formats (not all writers) support
metadata at such a position.) The same applies to comment events. (See the documentation of the single
writers for further details on supported data.)
Note that column indices in JPhyloIO start with 0.
writeSequencePartContentData in interface MatrixDataAdapterparameters - the parameter map of the calling writer that provides context information for the data requestreceiver - the receiver to write the events tosequenceID - the ID of the sequence from which a part shall be writtenstartColumn - the first column of the sequence part to be written (inclusive)endColumn - the last column of the sequence part to be written (exclusive)java.io.IOException - if a I/O error occurs while writing the datajava.lang.IllegalArgumentException - if an unknown sequence ID was specifiedpublic StoreObjectListDataAdapter<CharacterDefinitionEvent> getCharacterDefinitions(ReadWriteParameterMap parameters)
MatrixDataAdaptergetCharacterDefinitions in interface MatrixDataAdapterparameters - the parameter map of the calling writer that provides context information for the data requestpublic StoreObjectListDataAdapter<LinkedLabeledIDEvent> getSequenceSets(ReadWriteParameterMap parameters)
MatrixDataAdaptergetSequenceSets in interface MatrixDataAdapterparameters - the parameter map of the calling writer that provides context information for the data request