T
- the type of sequence elements (tokens) the implementing provider object works withpublic class TokenChangeEvent<T> extends SequenceChangeEvent<T>
AlignmentModel
were inserted, removed or replaced.source
Modifier | Constructor and Description |
---|---|
protected |
TokenChangeEvent(AlignmentModel<T> source,
String sequenceID,
ListChangeType type,
int startIndex,
Collection<? extends T> affectedTokens)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
Object |
getAffectedToken()
Returns the first affected token.
|
Collection<? extends T> |
getAffectedTokens()
Returns a collection of tokens that have been affected by this operation.
|
int |
getStartIndex()
Returns the (former) index of the first affected token.
|
static <T> TokenChangeEvent<T> |
newInsertInstance(AlignmentModel<T> source,
String sequenceID,
int startIndex,
Collection<? extends T> newTokens)
Creates a new instance of this class that represents an insertion of a list of tokens.
|
static <T> TokenChangeEvent<T> |
newInsertInstance(AlignmentModel<T> source,
String sequenceID,
int index,
T newToken)
Creates a new instance of this class that represents an insertion of a single token.
|
static <T> TokenChangeEvent<T> |
newRemoveInstance(AlignmentModel<T> source,
String sequenceID,
int startIndex,
Collection<? extends T> removedTokens)
Creates a new instance of this class that represents a deletion of a list of tokens.
|
static <T> TokenChangeEvent<T> |
newRemoveInstance(AlignmentModel<T> source,
String sequenceID,
int index,
T removedToken)
Creates a new instance of this class that represents a deletion of a single token.
|
static <T> TokenChangeEvent<T> |
newReplaceInstance(AlignmentModel<T> source,
String sequenceID,
int startIndex,
Collection<? extends T> replacedTokens)
Creates a new instance of this class that represents a replacement of a list of tokens.
|
static <T> TokenChangeEvent<T> |
newReplaceInstance(AlignmentModel<T> source,
String sequenceID,
int index,
T replacedToken)
Creates a new instance of this class that represents a replacement of a single token.
|
getType, newInsertInstance, newRemoveInstance
getSequenceID, getSource
toString
protected TokenChangeEvent(AlignmentModel<T> source, String sequenceID, ListChangeType type, int startIndex, Collection<? extends T> affectedTokens)
source
- the sequence data provider that fires this eventsequenceID
- the ID of the affected sequencetype
- the type of change that happenedstartIndex
- the index of the first affected token in the sequenceaffectedTokens
- a list of the affected tokenspublic static <T> TokenChangeEvent<T> newInsertInstance(AlignmentModel<T> source, String sequenceID, int startIndex, Collection<? extends T> newTokens)
source
- the sequence data provider that fires this eventsequenceID
- the ID of the affected sequencestartIndex
- the index where the first token was inserted into the sequencenewTokens
- the list of the tokens to be insertedsource
public static <T> TokenChangeEvent<T> newInsertInstance(AlignmentModel<T> source, String sequenceID, int index, T newToken)
source
- the sequence data provider that fires this eventsequenceID
- the ID of the affected sequenceindex
- the index where the new token was insertednewToken
- the token to be insertedsource
public static <T> TokenChangeEvent<T> newRemoveInstance(AlignmentModel<T> source, String sequenceID, int startIndex, Collection<? extends T> removedTokens)
source
- the sequence data provider that fires this eventsequenceID
- the ID of the affected sequencestartIndex
- the index where the first token has been deleted from the sequenceremovedTokens
- the tokens that have been deletedsource
public static <T> TokenChangeEvent<T> newRemoveInstance(AlignmentModel<T> source, String sequenceID, int index, T removedToken)
source
- the sequence data provider that fires this eventsequenceID
- the ID of the affected sequenceindex
- the index where the token has been deleted from the sequenceremovedToken
- the token that has been deletedsource
public static <T> TokenChangeEvent<T> newReplaceInstance(AlignmentModel<T> source, String sequenceID, int startIndex, Collection<? extends T> replacedTokens)
source
- the sequence data provider that fires this eventsequenceID
- the ID of the affected sequencestartIndex
- the index where the first token was replaced in the sequencereplacedTokens
- the list of tokens that have been replacedsource
public static <T> TokenChangeEvent<T> newReplaceInstance(AlignmentModel<T> source, String sequenceID, int index, T replacedToken)
source
- the sequence data provider that fires this eventsequenceID
- the ID of the affected sequenceindex
- the index where the token shall be inserted into the sequencereplacedToken
- the list of tokens that have been replacedsource
public int getStartIndex()
public Collection<? extends T> getAffectedTokens()
public Object getAffectedToken()
null
if #getAffectedElements()
return an empty list