public class ArrayAlphabet<I> extends AbstractAlphabet<I>
| Modifier and Type | Field and Description |
|---|---|
protected I[] |
symbols |
modCount| Constructor and Description |
|---|
ArrayAlphabet(I... symbols) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsSymbol(I symbol)
Checks whether the given symbol is part of the alphabet.
|
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.
|
void |
writeToArray(int offset,
Object[] array,
int tgtOfs,
int num)
Writes the contents of this container to an array.
|
getadd, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitapply, applyAsInt, compare, translateFromadd, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArraycomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongaddAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayprotected final I[] symbols
@SafeVarargs public ArrayAlphabet(I... symbols)
public I getSymbol(int index) throws IllegalArgumentException
Alphabetindex - the index of the requested symbol.IllegalArgumentException - if there is no symbol with this index.public int getSymbolIndex(I symbol) throws IllegalArgumentException
AlphabetIllegalArgumentException - if the provided symbol does not belong to the alphabet.public int size()
ArrayWritablesize in interface Collection<I>size in interface List<I>size in interface ArrayWritable<I>size in class AbstractCollection<I>public void writeToArray(int offset,
Object[] array,
int tgtOfs,
int num)
ArrayWritableSystem.arraycopy(this.toArray(), offset, array, tgtOfs, num);offset - how many elements of this container to skip.array - the array in which to store the elements.tgtOfs - the starting offset in the target array.num - the maximum number of elements to copy.public boolean containsSymbol(I symbol)
AlphabetCaution: 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.