Interface Alphabet<I>

    • Method Detail

      • apply

        default I apply​(int index)
        Specified by:
        apply in interface IntFunction<I>
      • getSymbol

        I getSymbol​(int index)
        Returns the symbol with the given index in this alphabet.
        index - the index of the requested symbol.
        symbol with the given index.
        IllegalArgumentException - if there is no symbol with this index.
      • getSymbolIndex

        int getSymbolIndex​(I symbol)
        Returns the index of the given symbol in the alphabet.
        symbol - the symbol whose index should be determined
        the index of the given symbol
        IllegalArgumentException - if the provided symbol does not belong to the alphabet.
      • writeToArray

        default void writeToArray​(int offset,
                                  @Nullable Object[] array,
                                  int tgtOfs,
                                  int num)
        Description copied from interface: ArrayWritable
        Writes the contents of this container to an array. The behavior of calling this method should be equivalent to System.arraycopy(this.toArray(), offset, array, tgtOfs, num);
        Specified by:
        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.
      • translateFrom

        default <I2> Mapping<I2,​I> translateFrom​(Alphabet<I2> other)
      • containsSymbol

        default boolean containsSymbol​(I symbol)
        Checks whether the given symbol is part of the alphabet.

        Caution: the default implementation is rather inefficient and should be overridden, if possible.

        symbol - the symbol to check
        true iff the symbol is part of the alphabet