T - the type of tokens represented by this setpublic abstract class AbstractContinuousSet<T extends java.lang.Number & java.lang.Comparable<T>> extends java.lang.Object implements TokenSet<ContinuousToken<T>>
This implementation does not support the optional add and remove operations. Because it represents non-discrete
values the methods toArray(), toArray(Object[]) and iterator() cannot be implemented
and return an empty array or iterator. size() always returns Integer.MAX_VALUE in accordance
with the definition in Collection.size().
| Constructor and Description |
|---|
AbstractContinuousSet() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(ContinuousToken<T> e)
This method is not supported by this implementation and will always throw an
UnsupportedOperationException. |
boolean |
addAll(java.util.Collection<? extends ContinuousToken<T>> c)
This method is not supported by this implementation and will always throw an
UnsupportedOperationException. |
void |
clear()
This method is not supported by this implementation and will always throw an
UnsupportedOperationException. |
abstract AbstractContinuousSet<T> |
clone()
Returns a deep copy of this instance.
|
boolean |
contains(java.lang.Object o)
This default implementation always returns
true. |
boolean |
containsAll(java.util.Collection<?> c)
This default implementation always returns
true. |
java.lang.String |
descriptionByToken(ContinuousToken<T> token)
An description of the specified token (e.g.
|
ContinuousToken<T> |
getGapToken()
Returns the default object that represents a gap in this token set.
|
CharacterSymbolMeaning |
getMeaning(ContinuousToken<T> token)
Returns the meaning of the specified symbol.
|
ContinuousToken<T> |
getMissingInformationToken()
Returns the default object that represents an unknown position in this token set.
|
CharacterSymbolType |
getSymbolType(ContinuousToken<T> token)
Returns the type of the specified token (symbol).
|
CharacterStateSetType |
getType()
Determines the type of tokens that are defined by this instance.
|
boolean |
isEmpty()
This default implementation always returns
false. |
boolean |
isGapToken(ContinuousToken<T> token)
Tests if the specified token represents a gap.
|
boolean |
isMissingInformationToken(ContinuousToken<T> token)
Tests if the specified token represents an unknown position (usually '?').
|
boolean |
isSpaceForGap()
Determines whether
TokenSet.tokenByKeyStroke(KeyStroke) shall return the gap token, if the space bar is
pressed, even if that key stroke is not associated with that token. |
java.util.Iterator<ContinuousToken<T>> |
iterator()
Continuous sets cannot be iterated, therefore this method is not supported by this class.
|
protected abstract ContinuousToken<T> |
parseValue(java.lang.String value) |
boolean |
remove(java.lang.Object o)
This method is not supported by this implementation and will always throw an
UnsupportedOperationException. |
boolean |
removeAll(java.util.Collection<?> c)
This method is not supported by this implementation and will always throw an
UnsupportedOperationException. |
java.lang.String |
representationByToken(ContinuousToken<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. |
boolean |
retainAll(java.util.Collection<?> c)
This method is not supported by this implementation and will always throw an
UnsupportedOperationException. |
void |
setSpaceForGap(boolean spaceForGap)
Allows to specify whether
TokenSet.tokenByKeyStroke(KeyStroke) shall return the gap token, if the space
bar is pressed, even if that key stroke is not associated with that token. |
int |
size()
The number of elements in a continuous set is unlimited.
|
java.lang.Object[] |
toArray()
Continuous sets cannot be stored in arrays, therefore this method is not supported by this class.
|
<E> E[] |
toArray(E[] a)
Continuous sets cannot be stored in arrays, therefore this method is not supported by this class.
|
ContinuousToken<T> |
tokenByKeyStroke(javax.swing.KeyStroke key)
Returns the token from this set that is associated with the specified key stroke.
|
ContinuousToken<T> |
tokenByRepresentation(java.lang.String representation)
Returns the token associated with the specified string representation used to display the token in
an
AlignmentArea or an alignment file. |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitmaxRepresentationLengthpublic AbstractContinuousSet()
protected abstract ContinuousToken<T> parseValue(java.lang.String value) throws java.lang.NumberFormatException
java.lang.NumberFormatExceptionpublic ContinuousToken<T> tokenByRepresentation(java.lang.String representation)
TokenSetAlignmentArea or an alignment file.tokenByRepresentation in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>representation - the string representation of the tokennull if none is definedpublic ContinuousToken<T> tokenByKeyStroke(javax.swing.KeyStroke key)
TokenSetAlignmentArea.
Note that the key character is only used by AlignmentArea if it does not collide with a default
keyboard action. (Usually the key character can be any lower or upper case letter or digit.)
tokenByKeyStroke in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>key - the key stroke (key code and shift mask) the user can press to insert the returned token
into an AlignmentAreanull if none is definedpublic boolean isGapToken(ContinuousToken<T> token)
TokenSetNote that it's legal to have multiple tokens to be considered as gaps, but one of them must be defined as the default gap tokens. When alignments are written to files (e.g. using JPhyloIO), some formats may accept only one of these tokens as a gap and the others may be represented as additional character states.
isGapToken in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>token - the token to be testedtrue if the specified token is recognized as a gap, false otherwise.public ContinuousToken<T> getGapToken()
TokenSetgetGapToken in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>public boolean isMissingInformationToken(ContinuousToken<T> token)
TokenSetNote that it's legal to have multiple tokens to be considered as unknown symbols, but one of them must be defined as the default. When alignments are written to files, some formats may accept only one
isMissingInformationToken in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>token - the token to be testedtrue if the specified token is recognized as an unknown position, false otherwise.public ContinuousToken<T> getMissingInformationToken()
TokenSetgetMissingInformationToken in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>public CharacterSymbolType getSymbolType(ContinuousToken<T> token)
TokenSetgetSymbolType in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>token - the symbol to be testedpublic CharacterSymbolMeaning getMeaning(ContinuousToken<T> token)
TokenSetgetMeaning in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>token - the token to determine the meaning frompublic boolean add(ContinuousToken<T> e)
UnsupportedOperationException.add in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>add in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>java.lang.UnsupportedOperationException - alwayspublic boolean addAll(java.util.Collection<? extends ContinuousToken<T>> c)
UnsupportedOperationException.addAll in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>addAll in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>java.lang.UnsupportedOperationException - alwayspublic void clear()
UnsupportedOperationException.clear in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>clear in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>java.lang.UnsupportedOperationException - alwayspublic boolean contains(java.lang.Object o)
true.contains in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>contains in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>truepublic boolean containsAll(java.util.Collection<?> c)
true.containsAll in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>containsAll in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>truepublic boolean isEmpty()
false.isEmpty in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>isEmpty in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>falsepublic java.util.Iterator<ContinuousToken<T>> iterator()
iterator in interface java.lang.Iterable<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>iterator in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>iterator in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>public boolean remove(java.lang.Object o)
UnsupportedOperationException.remove in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>remove in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>java.lang.UnsupportedOperationException - alwayspublic boolean removeAll(java.util.Collection<?> c)
UnsupportedOperationException.removeAll in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>removeAll in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>java.lang.UnsupportedOperationException - alwayspublic boolean retainAll(java.util.Collection<?> c)
UnsupportedOperationException.retainAll in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>retainAll in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>java.lang.UnsupportedOperationException - alwayspublic int size()
size in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>size in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>Integer.MAX_VALUE in accordance with the definition of Collection.size()public java.lang.Object[] toArray()
toArray in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>toArray in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>public <E> E[] toArray(E[] a)
toArray in interface java.util.Collection<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>toArray in interface java.util.Set<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>a - the array into which the elements of this set would be stored, if it was not continuousa without any modificationspublic java.lang.String representationByToken(ContinuousToken<T> token)
TokenSetAlignmentArea or written into an alignment file.
Note that some CharSequenceAdapters and StringAdapters only use the first character
of the returned string to represent a token.
representationByToken in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>token - the token associated with the representationpublic boolean representationLengthEqual()
TokenSetTokenSet.representationByToken(Object)
have the same length.representationLengthEqual in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>true if all lengths are equal, false otherwisepublic java.lang.String descriptionByToken(ContinuousToken<T> token)
TokenSetdescriptionByToken in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>token - the token that shall be describedpublic CharacterStateSetType getType()
TokenSetgetType in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>public boolean isSpaceForGap()
TokenSetTokenSet.tokenByKeyStroke(KeyStroke) shall return the gap token, if the space bar is
pressed, even if that key stroke is not associated with that token.isSpaceForGap in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>true if the gap token shall always be returned, false otherwise.public void setSpaceForGap(boolean spaceForGap)
TokenSetTokenSet.tokenByKeyStroke(KeyStroke) shall return the gap token, if the space
bar is pressed, even if that key stroke is not associated with that token.setSpaceForGap in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>spaceForGap - Specify true here, if the gap token shall always be returned, false
otherwise.public abstract AbstractContinuousSet<T> clone()
TokenSetclone in interface TokenSet<ContinuousToken<T extends java.lang.Number & java.lang.Comparable<T>>>clone in class java.lang.Object