public class SequenceTokensEventManager extends 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,
String matchToken)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
SequenceTokensEvent |
createEvent(String sequenceID,
List<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() |
String |
getCurrentSequenceName() |
List<String> |
getFirstSequence() |
String |
getFirstSequenceName() |
String |
getMatchToken() |
JPhyloIOEventReader |
getOwner()
Returns the reader instance using this object.
|
void |
setMatchToken(String matchToken) |
public SequenceTokensEventManager(JPhyloIOEventReader owner, 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 performedNullPointerException
- if owner
is set to null
public JPhyloIOEventReader getOwner()
null
)public String getMatchToken()
public void setMatchToken(String matchToken)
public long getCurrentPosition()
public long getCurrentBlockStartPosition()
public long getCurrentBlockLength()
public String getFirstSequenceName()
public String getCurrentSequenceName()
public List<String> getFirstSequence()
public SequenceTokensEvent createEvent(String sequenceID, List<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 tokensNullPointerException
- if either sequenceID
or tokens
is null