public class EnumAlphabet<E extends Enum<E>> extends ArrayAlphabet<E>
symbols
modCount
Constructor and Description |
---|
EnumAlphabet(Class<E> enumClazz,
boolean withNull) |
Modifier and Type | Method and Description |
---|---|
int |
compare(E o1,
E o2) |
boolean |
containsSymbol(E symbol)
Checks whether the given symbol is part of the alphabet.
|
int |
getSymbolIndex(E symbol)
Returns the index of the given symbol in the alphabet.
|
getSymbol, size, writeToArray
get
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, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
apply, applyAsInt, translateFrom
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 int getSymbolIndex(E symbol)
Alphabet
getSymbolIndex
in interface Alphabet<E extends Enum<E>>
getSymbolIndex
in class ArrayAlphabet<E extends Enum<E>>
symbol
- the symbol whose index should be determinedpublic boolean containsSymbol(E symbol)
Alphabet
Caution: the default implementation is rather inefficient and should be overridden, if possible.
containsSymbol
in interface Alphabet<E extends Enum<E>>
containsSymbol
in class ArrayAlphabet<E extends Enum<E>>
symbol
- the symbol to checktrue
iff the symbol is part of the alphabetCopyright © 2020. All rights reserved.