public class SequenceTokensEventManager extends java.lang.Object
JPhyloIOEventReader
to keep track of the current alignment
position and replacing match tokens by the according tokens from the first sequence.Constructor and Description |
---|
SequenceTokensEventManager(JPhyloIOEventReader owner,
java.lang.String matchToken)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
SequenceTokensEvent |
createEvent(java.lang.String sequenceID,
java.util.List<java.lang.String> tokens)
Creates a sequence character event object from the provided data and manages the replacement of match tokens
by tokens of the first sequence.
|
long |
getCurrentBlockLength() |
long |
getCurrentBlockStartPosition() |
long |
getCurrentPosition() |
java.lang.String |
getCurrentSequenceName() |
java.util.List<java.lang.String> |
getFirstSequence() |
java.lang.String |
getFirstSequenceName() |
java.lang.String |
getMatchToken() |
JPhyloIOEventReader |
getOwner()
Returns the reader instance using this object.
|
void |
setMatchToken(java.lang.String matchToken) |
public SequenceTokensEventManager(JPhyloIOEventReader owner, java.lang.String matchToken)
owner
- the PhyloIO event reader using the returned instancematchToken
- the match token to be replaced in sequences or null
if no replacement shall be performedjava.lang.NullPointerException
- if owner
is set to null
public JPhyloIOEventReader getOwner()
null
)public java.lang.String getMatchToken()
public void setMatchToken(java.lang.String matchToken)
public long getCurrentPosition()
public long getCurrentBlockStartPosition()
public long getCurrentBlockLength()
public java.lang.String getFirstSequenceName()
public java.lang.String getCurrentSequenceName()
public java.util.List<java.lang.String> getFirstSequence()
public SequenceTokensEvent createEvent(java.lang.String sequenceID, java.util.List<java.lang.String> tokens)
This method stores the tokens of the first sequence and the current sequence position. Therefore implementing readers supporting match token replacement must always use this method to create sequence character event objects and never do this directly, otherwise the replacement by this method will not work.
Note that the algorithm for position monitoring will only work for interleaved formats where each sequence part has the same length in each block or for non-interleaved formats (where each sequence only occurs once).
sequenceID
- the event ID or another unique name of the sequence to append the tokens totokens
- the newly read tokensjava.lang.NullPointerException
- if either sequenceID
or tokens
is null