Class CheckDigit
java.lang.Object
org.emau.icmvc.ganimed.ttp.psn.generator.CheckDigits
org.emau.icmvc.ganimed.ttp.psn.generator.CheckDigit
- All Implemented Interfaces:
Serializable
Extends CheckDigits to be a common base for all algorithms handling a single check digit
- See Also:
-
Field Summary
Fields inherited from class org.emau.icmvc.ganimed.ttp.psn.generator.CheckDigits
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract charcalculateCheckDigit(String message) voidgenerateCheckDigits(String message) intgetEffectiveMaxMessageLength(int total) Returns the maximum length of messages for which the resulting value including check digits is not longer than the given total.intgetNumberOfCheckDigits(int messageLength) Returns the number of check digits computed by this algorithm for a message with a given length.Methods inherited from class org.emau.icmvc.ganimed.ttp.psn.generator.CheckDigits
createCheckDigitClass, createCheckDigits, createCheckDigits, createCheckDigits, getAlphabet, getAlphabetRestriction, getEffectiveMaxMessageLength, getMaxMessageLength, isDeprecated, isDeprecated, toMessage, toNumber, toString
-
Constructor Details
-
CheckDigit
protected CheckDigit() -
CheckDigit
-
-
Method Details
-
generateCheckDigits
- Specified by:
generateCheckDigitsin classCheckDigits- Parameters:
message- string for which check digits should be generated- Returns:
- check digits
- Throws:
CharNotInAlphabetException- if the message contains characters which are not contained in the alphabet
-
check
public void check(String value, int messageLength) throws CharNotInAlphabetException, InvalidPSNException - Specified by:
checkin classCheckDigits- Parameters:
value- string (including check digits) to be checkedmessageLength- length of [value] without check digits- Throws:
CharNotInAlphabetException- if the value contains characters which are not contained in the alphabetInvalidPSNException- if the value is not a valid pseudonym
-
getNumberOfCheckDigits
public int getNumberOfCheckDigits(int messageLength) Description copied from class:CheckDigitsReturns the number of check digits computed by this algorithm for a message with a given length.- Specified by:
getNumberOfCheckDigitsin classCheckDigits- Parameters:
messageLength- the length of the message- Returns:
- the number of check digits computed by this algorithm for a message with a given length
-
getEffectiveMaxMessageLength
public int getEffectiveMaxMessageLength(int total) Description copied from class:CheckDigitsReturns the maximum length of messages for which the resulting value including check digits is not longer than the given total.- Overrides:
getEffectiveMaxMessageLengthin classCheckDigits- Returns:
- the maximum length of messages for which the resulting value including check digits is not longer than the given total
-
calculateCheckDigit
- Throws:
CharNotInAlphabetException
-