Package net.automatalib.alphabet
Class SingletonAlphabet<I>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<I>
-
- net.automatalib.alphabet.AbstractAlphabet<I>
-
- net.automatalib.alphabet.SingletonAlphabet<I>
-
- Type Parameters:
I- input symbol type
- All Implemented Interfaces:
Iterable<I>,Collection<I>,Comparator<I>,IntFunction<I>,ToIntFunction<I>,List<I>,Alphabet<I>,ArrayWritable<I>
public class SingletonAlphabet<I> extends AbstractAlphabet<I> implements Alphabet<I>
A specialized implementation forAlphabets containing only a single symbol.
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description SingletonAlphabet(I symbol)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsSymbol(I symbol)Checks whether the given symbol is part of the alphabet.IgetSymbol(int index)Returns the symbol with the given index in this alphabet.intgetSymbolIndex(I symbol)Returns the index of the given symbol in the alphabet.intsize()The size of this container.-
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, compare, translateFrom, writeToArray
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream
-
Methods inherited from interface java.util.Comparator
equals, reversed, 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
-
-
-
-
Constructor Detail
-
SingletonAlphabet
public SingletonAlphabet(I symbol)
-
-
Method Detail
-
getSymbol
public I getSymbol(int index)
Description copied from interface:AlphabetReturns the symbol with the given index in this alphabet.
-
getSymbolIndex
public int getSymbolIndex(I symbol)
Description copied from interface:AlphabetReturns the index of the given symbol in the alphabet.- Specified by:
getSymbolIndexin interfaceAlphabet<I>- Parameters:
symbol- the symbol whose index should be determined- Returns:
- the index of the given symbol
-
containsSymbol
public boolean containsSymbol(I symbol)
Description copied from interface:AlphabetChecks whether the given symbol is part of the alphabet.Caution: the default implementation is rather inefficient and should be overridden, if possible.
- Specified by:
containsSymbolin interfaceAlphabet<I>- Parameters:
symbol- the symbol to check- Returns:
trueiff the symbol is part of the alphabet
-
size
public int size()
Description copied from interface:ArrayWritableThe size of this container.- Specified by:
sizein interfaceArrayWritable<I>- Specified by:
sizein interfaceCollection<I>- Specified by:
sizein interfaceList<I>- Specified by:
sizein classAbstractCollection<I>
-
-