Package net.automatalib.alphabet
Class EnumAlphabet<E extends Enum<E>>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<I>
-
- net.automatalib.alphabet.AbstractAlphabet<I>
-
- net.automatalib.alphabet.ArrayAlphabet<E>
-
- net.automatalib.alphabet.EnumAlphabet<E>
-
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Comparator<E>
,IntFunction<E>
,ToIntFunction<E>
,List<E>
,Alphabet<E>
,ArrayWritable<E>
public class EnumAlphabet<E extends Enum<E>> extends ArrayAlphabet<E>
-
-
Field Summary
-
Fields inherited from class net.automatalib.alphabet.ArrayAlphabet
symbols
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description EnumAlphabet(Class<E> enumClazz, boolean withNull)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.-
Methods inherited from class net.automatalib.alphabet.ArrayAlphabet
getSymbol, size, writeToArray
-
Methods inherited from class net.automatalib.alphabet.AbstractAlphabet
get, reversed
-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.automatalib.alphabet.Alphabet
apply, applyAsInt, translateFrom
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
-
Methods inherited from interface java.util.Comparator
equals, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
getSymbolIndex
public int getSymbolIndex(E symbol)
Description copied from interface:Alphabet
Returns the index of the given symbol in the alphabet.- Specified by:
getSymbolIndex
in interfaceAlphabet<E extends Enum<E>>
- Overrides:
getSymbolIndex
in classArrayAlphabet<E extends Enum<E>>
- Parameters:
symbol
- the symbol whose index should be determined- Returns:
- the index of the given symbol
-
containsSymbol
public boolean containsSymbol(E symbol)
Description copied from interface:Alphabet
Checks whether the given symbol is part of the alphabet.Caution: the default implementation is rather inefficient and should be overridden, if possible.
- Specified by:
containsSymbol
in interfaceAlphabet<E extends Enum<E>>
- Overrides:
containsSymbol
in classArrayAlphabet<E extends Enum<E>>
- Parameters:
symbol
- the symbol to check- Returns:
true
iff the symbol is part of the alphabet
-
-