Class SingletonAlphabet<I>

    • Constructor Detail

      • SingletonAlphabet

        public SingletonAlphabet​(I symbol)
    • Method Detail

      • 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>
        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>
        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>
        Parameters:
        symbol - the symbol to check
        Returns:
        true iff the symbol is part of the alphabet