Class Alphabet
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
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextended(char... symbols) protected abstract char[]intReturns 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).longgetMaxNumberOfPSN(int numberOfChars, boolean useLastCharAsDelimiter) Returns number of possible psn with this alphabet.intgetPosForSymbol(char symbol) longgetPosNumberForPSN(String psn, boolean useLastCharAsDelimiter) { @return the positional number for the psn}chargetSymbol(int pos) intlength()toString()
-
Constructor Details
-
Alphabet
public Alphabet() -
Alphabet
- Throws:
InvalidAlphabetException
-
-
Method Details
-
getAlphabet
protected abstract char[] getAlphabet() -
length
public int length() -
getSymbol
- Parameters:
pos- position of the requested symbol (0 - length-1)- Returns:
- symbol at the given position
- Throws:
IndexOutOfBoundsException- if the given position is larger thenlength()
-
getPosForSymbol
- 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 checkdigitsuseLastCharAsDelimiter- true to use the last character as delimiter- Throws:
ArithmeticException- if this number exceeds intCharNotInAlphabetException- 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 charactersuseLastCharAsDelimiter- true to use the last character as delimiter- Returns:
- number of possible psn with this alphabet
- Throws:
ArithmeticException- if this number exceeds long
-
toString
-
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
- Throws:
InvalidAlphabetException
-