Interface VPAlphabet<I>

    • Method Detail

      • getCallAlphabet

        Alphabet<I> getCallAlphabet()
        Returns the call symbols of this alphabet as a (sub-) alphabet.
        Returns:
        the call symbols of this alphabet
      • getCallSymbol

        I getCallSymbol​(int index)
        The Alphabet.getSymbol(int) variant for the call alphabet. Note that the index must be relative to the call alphabet and not to this alphabet.
        Parameters:
        index - the index of the symbol
        Returns:
        the call symbol at the given index
        Throws:
        IllegalArgumentException - if there is no symbol with this index
      • getCallSymbolIndex

        int getCallSymbolIndex​(I symbol)
        The Alphabet.getSymbolIndex(Object) variant for the call alphabet. Note that the index is relative to the call alphabet and not to this alphabet.
        Parameters:
        symbol - the symbol whose index should be determined
        Returns:
        the index of the given call symbol
        Throws:
        IllegalArgumentException - if the provided symbol does not belong to the call alphabet.
      • getNumCalls

        int getNumCalls()
        The ArrayWritable.size() variant for the call alphabet.
        Returns:
        the number of call symbols
      • getInternalAlphabet

        Alphabet<I> getInternalAlphabet()
        Returns the internal symbols of this alphabet as a (sub-) alphabet.
        Returns:
        the internal symbols of this alphabet
      • getInternalSymbol

        I getInternalSymbol​(int index)
        The Alphabet.getSymbol(int) variant for the internal alphabet. Note that the index must be relative to the internal alphabet and not to this alphabet.
        Parameters:
        index - the index of the symbol
        Returns:
        the internal symbol at the given index
        Throws:
        IllegalArgumentException - if there is no symbol with this index
      • getInternalSymbolIndex

        int getInternalSymbolIndex​(I symbol)
        The Alphabet.getSymbolIndex(Object) variant for the internal alphabet. Note that the index is relative to the internal alphabet and not to this alphabet.
        Parameters:
        symbol - the symbol whose index should be determined
        Returns:
        the index of the given internal symbol
        Throws:
        IllegalArgumentException - if the provided symbol does not belong to the internal alphabet.
      • getNumInternals

        int getNumInternals()
        The ArrayWritable.size() variant for the internal alphabet.
        Returns:
        the number of internal symbols
      • getReturnAlphabet

        Alphabet<I> getReturnAlphabet()
        Returns the return symbols of this alphabet as a (sub-) alphabet.
        Returns:
        the return symbols of this alphabet
      • getReturnSymbol

        I getReturnSymbol​(int index)
        The Alphabet.getSymbol(int) variant for the return alphabet. Note that the index must be relative to the return alphabet and not to this alphabet.
        Parameters:
        index - the index of the symbol
        Returns:
        the return symbol at the given index
        Throws:
        IllegalArgumentException - if there is no symbol with this index
      • getReturnSymbolIndex

        int getReturnSymbolIndex​(I symbol)
        The Alphabet.getSymbolIndex(Object) variant for the return alphabet. Note that the index is relative to the return alphabet and not to this alphabet.
        Parameters:
        symbol - the symbol whose index should be determined
        Returns:
        the index of the given return symbol
        Throws:
        IllegalArgumentException - if the provided symbol does not belong to the return alphabet.
      • getNumReturns

        int getNumReturns()
        The ArrayWritable.size() variant for the return alphabet.
        Returns:
        the number of return symbols
      • isCallSymbol

        default boolean isCallSymbol​(I symbol)
        Returns whether the given symbol is a call symbol of this alphabet.
        Parameters:
        symbol - the symbol to analyze
        Returns:
        true if the given symbol is a call symbol of this alphabet, false otherwise
        Throws:
        IllegalArgumentException - if the provided symbol does not belong to the alphabet.
      • isInternalSymbol

        default boolean isInternalSymbol​(I symbol)
        Returns whether the given symbol is an internal symbol of this alphabet.
        Parameters:
        symbol - the symbol to analyze
        Returns:
        true if the given symbol is an internal symbol of this alphabet, false otherwise
        Throws:
        IllegalArgumentException - if the provided symbol does not belong to the alphabet.
      • isReturnSymbol

        default boolean isReturnSymbol​(I symbol)
        Returns whether the given symbol is a return symbol of this alphabet.
        Parameters:
        symbol - the symbol to analyze
        Returns:
        true if the given symbol is a return symbol of this alphabet, false otherwise
        Throws:
        IllegalArgumentException - if the provided symbol does not belong to the alphabet.
      • callReturnBalance

        default int callReturnBalance​(Word<I> word)
        Returns the call-return balance of the given word relative to this alphabet. The call-return balance is positive, if the given word contains more call symbols than return symbols, negative if the given word contains more return symbols than call symbols, and 0 if it contains an equal number of call symbols and return symbols.
        Parameters:
        word - the word to analyze
        Returns:
        the call-return balance
      • isCallMatched

        default boolean isCallMatched​(Word<I> word)
        Returns whether the given word is call-matched relative to this alphabet. A word is call-matched if every call symbol is at one point succeeded by a matching return symbol and there exist no un-matched call symbols. Note that a call-matched word may still contain un-matched return symbols.
        Parameters:
        word - the word to analyze
        Returns:
        true if the given word is call-matched, false otherwise
      • isReturnMatched

        default boolean isReturnMatched​(Word<I> word)
        Returns whether the given word is return-matched relative to this alphabet. A word is return-matched if every return symbol is at one point preceded by a matching call symbol and there exist no un-matched return symbols. Note that a return-matched word may still contain un-matched call symbols.
        Parameters:
        word - the word to analyze
        Returns:
        true if the given word is return-matched, false otherwise
      • isWellMatched

        default boolean isWellMatched​(Word<I> word)
        Returns whether the given word is well-matched relative to this alphabet. A word is well-matched if every call symbol is at one point succeeded by a matching return symbol and there exist no un-matched call symbols or return symbols.
        Parameters:
        word - the word to analyze
        Returns:
        true if the given word is well-matched, false otherwise
      • longestWellMatchedPrefix

        default Word<I> longestWellMatchedPrefix​(Word<I> word)
        Return the longest well-matched (relative to this alphabet) prefix of the given word.
        Parameters:
        word - the word to analyze
        Returns:
        the longest well-matched prefix of the given word
      • longestWellMatchedSuffix

        default Word<I> longestWellMatchedSuffix​(Word<I> word)
        Return the longest well-matched (relative to this alphabet) suffix of the given word.
        Parameters:
        word - the word to analyze
        Returns:
        the longest well-matched suffix of the given word