java.lang.Object
org.emau.icmvc.ganimed.ttp.psn.generator.Alphabet
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
GenericAlphabet, Hex, Numbers, NumbersWithoutZero, NumbersX, Symbol31, Symbol32

public abstract class Alphabet extends Object implements Serializable
See Also:
  • Constructor Details

  • Method Details

    • getAlphabet

      protected abstract char[] getAlphabet()
    • length

      public int length()
    • getSymbol

      public char getSymbol(int pos) throws IndexOutOfBoundsException
      Parameters:
      pos - position of the requested symbol (0 - length-1)
      Returns:
      symbol at the given position
      Throws:
      IndexOutOfBoundsException - if the given position is larger then length()
    • getPosForSymbol

      public int getPosForSymbol(char symbol) throws CharNotInAlphabetException
      Parameters:
      symbol - symbol for which the position is requested
      Returns:
      position of the requested symbol
      Throws:
      CharNotInAlphabetException - if the given symbol is not an element of this alphabet
    • getPosNumberForPSN

      public long getPosNumberForPSN(String psn, boolean useLastCharAsDelimiter) throws ArithmeticException, CharNotInAlphabetException
      { @return the positional number for the psn}
      Parameters:
      psn - psn without pre-, suffix and checkdigits
      useLastCharAsDelimiter - true to use the last character as delimiter
      Throws:
      ArithmeticException - if this number exceeds int
      CharNotInAlphabetException - if the psn contains characters which are not in the alphabet
    • getMaxNumberOfPSN

      public long getMaxNumberOfPSN(int numberOfChars, boolean useLastCharAsDelimiter) throws ArithmeticException
      Returns number of possible psn with this alphabet.
      Parameters:
      numberOfChars - the number of characters
      useLastCharAsDelimiter - true to use the last character as delimiter
      Returns:
      number of possible psn with this alphabet
      Throws:
      ArithmeticException - if this number exceeds long
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toAlphabetString

      public String toAlphabetString()
    • getMaxBytesPerSymbolInUtf8mb4

      public int getMaxBytesPerSymbolInUtf8mb4()
      Returns the maximum number of bytes required to encode each single symbol of the alphabet when using UTF8MB4 encoding in databases (which can be 1, 2, 3, or 4).
      Returns:
      the maximum number of bytes required to encode each single symbol of the alphabet when using UTF8MB4 encoding in databases (which can be 1, 2, 3, or 4)
    • extended

      public GenericAlphabet extended(char... symbols) throws InvalidAlphabetException
      Throws:
      InvalidAlphabetException