@ParametersAreNonnullByDefault public class ListAlphabet<I> extends AbstractAlphabet<I>
modCount
Constructor and Description |
---|
ListAlphabet(List<? extends I> list) |
Modifier and Type | Method and Description |
---|---|
boolean |
containsSymbol(I symbol)
Checks whether the given symbol is part of the alphabet.
|
I |
get(int index) |
I |
getSymbol(int index)
Returns the symbol with the given index in this alphabet.
|
int |
getSymbolIndex(I symbol)
Returns the index of the given symbol in the alphabet.
|
int |
size()
The size of this container.
|
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
apply, applyAsInt, compare, translateFrom, writeToArray
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
public I getSymbol(int index) throws IllegalArgumentException
Alphabet
index
- the index of the requested symbol.IllegalArgumentException
- if there is no symbol with this index.public int getSymbolIndex(I symbol) throws IllegalArgumentException
Alphabet
IllegalArgumentException
- if the provided symbol does not belong to the alphabet.public I get(int index)
public int size()
ArrayWritable
size
in interface Collection<I>
size
in interface List<I>
size
in interface ArrayWritable<I>
size
in class AbstractCollection<I>
public boolean containsSymbol(I symbol)
Alphabet
Caution: the default implementation is rather inefficient and should be overridden, if possible.
symbol
- the symbol to checktrue
iff the symbol is part of the alphabetCopyright © 2015. All rights reserved.