Class AbstractModulo<T>
java.lang.Object
com.github.toolarium.security.checkdigit.AbstractModulo<T>
- All Implemented Interfaces:
IModulo<T>
Implements the base class of modulo calculation
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longcalculateModulo(String data) Calculate the modulo of the given string .protected abstract longcalculateSum(Integer[] digits) Calculate the modulo sumprotected Integer[]parseString(String inputData) Parse the given stringbooleanValidate a number if modulo is validMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.github.toolarium.security.checkdigit.IModulo
createCheckDigit
-
Constructor Details
-
AbstractModulo
public AbstractModulo()
-
-
Method Details
-
validate
Description copied from interface:IModuloValidate a number if modulo is valid -
calculateSum
Calculate the modulo sum- Parameters:
digits- the integer digits- Returns:
- the sum
-
calculateModulo
Calculate the modulo of the given string .- Parameters:
data- the data to parse- Returns:
- the modulo result
- Throws:
IllegalArgumentException- In case of an invalid input
-
parseString
Parse the given string- Parameters:
inputData- the data to parse- Returns:
- the parsed number
- Throws:
IllegalArgumentException- In case of an invalid input
-