Class FastAlphabet<I extends MutableNumericID>

    • Constructor Detail

      • FastAlphabet

        public FastAlphabet()
      • FastAlphabet

        @SafeVarargs
        public FastAlphabet​(I... symbols)
      • FastAlphabet

        public FastAlphabet​(List<? extends I> symbols)
    • Method Detail

      • addSymbol

        public int addSymbol​(I a)
        Description copied from interface: GrowingAlphabet
        Adds a new symbol to the alphabet. Some alphabets may prevent symbols from being added twice. In this case, the original alphabet remains unchanged, but this is not considered an error.
        Specified by:
        addSymbol in interface GrowingAlphabet<I extends MutableNumericID>
        Returns:
        the index of the symbol in the alphabet, after adding it.
      • getSymbol

        public I getSymbol​(int index)
        Description copied from interface: Alphabet
        Returns the symbol with the given index in this alphabet.
        Specified by:
        getSymbol in interface Alphabet<I extends MutableNumericID>
        Parameters:
        index - the index of the requested symbol.
        Returns:
        symbol with the given index.
      • getSymbolIndex

        public int getSymbolIndex​(I symbol)
        Description copied from interface: Alphabet
        Returns the index of the given symbol in the alphabet.
        Specified by:
        getSymbolIndex in interface Alphabet<I extends MutableNumericID>
        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: 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 interface Alphabet<I extends MutableNumericID>
        Parameters:
        symbol - the symbol to check
        Returns:
        true iff the symbol is part of the alphabet