I - symbol typepublic interface Alphabet<I> extends ArrayWritable<I>, Collection<I>, Comparator<I>, IntFunction<I>, ToIntFunction<I>
| Modifier and Type | Method and Description |
|---|---|
default I |
apply(int index) |
default int |
applyAsInt(I symbol) |
default int |
compare(I o1,
I o2) |
default 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.
|
default <I2> Mapping<I2,I> |
translateFrom(Alphabet<I2> other) |
default void |
writeToArray(int offset,
@Nullable Object[] array,
int tgtOfs,
int num)
Writes the contents of this container to an array.
|
sizeadd, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArraycomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongdefault I apply(int index)
apply in interface IntFunction<I>I getSymbol(int index)
index - the index of the requested symbol.IllegalArgumentException - if there is no symbol with this index.default int applyAsInt(I symbol)
applyAsInt in interface ToIntFunction<I>int getSymbolIndex(I symbol)
symbol - the symbol whose index should be determinedIllegalArgumentException - if the provided symbol does not belong to the alphabet.default int compare(I o1, I o2)
compare in interface Comparator<I>default void writeToArray(int offset,
@Nullable Object[] array,
int tgtOfs,
int num)
ArrayWritableSystem.arraycopy(this.toArray(), offset, array, tgtOfs, num);writeToArray in interface ArrayWritable<I>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.default boolean containsSymbol(I symbol)
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 © 2020. All rights reserved.