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.| Modifier | Constructor and Description |
|---|---|
protected |
TokenChangeEvent(AlignmentModel<T> source,
java.lang.String sequenceID,
ListChangeType type,
int startIndex,
java.util.Collection<? extends T> affectedTokens)
Creates a new instance of this class.
|
| Modifier and Type | Method and Description |
|---|---|
TokenChangeEvent<T> |
clone() |
TokenChangeEvent<T> |
cloneWithNewSource(AlignmentModel<T> source)
Creates a copy of this event with all properties set to identical values but with a
different source.
|
java.lang.Object |
getAffectedToken()
Returns the first affected token.
|
java.util.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,
java.lang.String sequenceID,
int startIndex,
java.util.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,
java.lang.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,
java.lang.String sequenceID,
int startIndex,
java.util.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,
java.lang.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,
java.lang.String sequenceID,
int startIndex,
java.util.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,
java.lang.String sequenceID,
int index,
T replacedToken)
Creates a new instance of this class that represents a replacement of a single token.
|
getType, newInsertInstance, newRemoveInstancegetSequenceID, getSourceprotected TokenChangeEvent(AlignmentModel<T> source, java.lang.String sequenceID, ListChangeType type, int startIndex, java.util.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, java.lang.String sequenceID, int startIndex, java.util.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 insertedsourcepublic static <T> TokenChangeEvent<T> newInsertInstance(AlignmentModel<T> source, java.lang.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 insertedsourcepublic static <T> TokenChangeEvent<T> newRemoveInstance(AlignmentModel<T> source, java.lang.String sequenceID, int startIndex, java.util.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 deletedsourcepublic static <T> TokenChangeEvent<T> newRemoveInstance(AlignmentModel<T> source, java.lang.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 deletedsourcepublic static <T> TokenChangeEvent<T> newReplaceInstance(AlignmentModel<T> source, java.lang.String sequenceID, int startIndex, java.util.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 replacedsourcepublic static <T> TokenChangeEvent<T> newReplaceInstance(AlignmentModel<T> source, java.lang.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 replacedsourcepublic int getStartIndex()
public java.util.Collection<? extends T> getAffectedTokens()
public java.lang.Object getAffectedToken()
null if #getAffectedElements() return an empty listpublic TokenChangeEvent<T> cloneWithNewSource(AlignmentModel<T> source)
AlignmentModelChangeEventcloneWithNewSource in class SequenceChangeEvent<T>source - the source model to be used for the created copypublic TokenChangeEvent<T> clone()
clone in class SequenceChangeEvent<T>