T
- the type of token in this token setpublic class DefaultTokenSet<T> extends AbstractTokenSet<T>
representationByToken(Object)
and descriptionByToken(Object)
.
In many cases a more specific implementation of TokenSet
may be preferable.
Constructor and Description |
---|
DefaultTokenSet(CharacterStateSetType type)
Returns a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
DefaultTokenSet<T> |
clone()
Inherited classes have to overwrite this method and create a deep copy of
AbstractTokenSet.getKeyMap() . |
java.lang.String |
descriptionByToken(T token)
An description of the specified token (e.g.
|
int |
maxRepresentationLength()
Calculates the maximal length of a representation returned by
TokenSet.representationByToken(Object)
of all tokens contained in this set. |
java.lang.String |
representationByToken(T token)
Returns the representation string of the specified token that shall be displayed in an
AlignmentArea or written into an alignment file. |
boolean |
representationLengthEqual()
Checks if all representation strings returned by
TokenSet.representationByToken(Object)
have the same length. |
T |
tokenByRepresentation(java.lang.String representation)
Returns the first token in this set returned by
HashSet.iterator() with a string representation equal
to representation . |
addSpaceKeyForGaps, getGapToken, getKeyMap, getMeaning, getMissingInformationToken, getSymbolType, getType, isGapToken, isMissingInformationToken, isSpaceForGap, setSpaceForGap, tokenByKeyStroke
add, clear, contains, isEmpty, iterator, remove, size, spliterator
addAll, containsAll, retainAll, toArray, toArray, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
public DefaultTokenSet(CharacterStateSetType type)
type
- the token type of the new instancepublic java.lang.String representationByToken(T token)
TokenSet
AlignmentArea
or written into an alignment file.
Note that some CharSequenceAdapter
s and StringAdapter
s only use the first character
of the returned string to represent a token.
token
- the token associated with the representationpublic T tokenByRepresentation(java.lang.String representation)
HashSet.iterator()
with a string representation equal
to representation
.
Inherited classes might want to overwrite this method to achieve a better performance for large token sets.
representation
- the string representation of the tokennull
if none is definedpublic int maxRepresentationLength()
TokenSet
TokenSet.representationByToken(Object)
of all tokens contained in this set.public boolean representationLengthEqual()
TokenSet
TokenSet.representationByToken(Object)
have the same length.true
if all lengths are equal, false
otherwisepublic java.lang.String descriptionByToken(T token)
TokenSet
token
- the token that shall be describedpublic DefaultTokenSet<T> clone()
AbstractTokenSet
AbstractTokenSet.getKeyMap()
.