Class Modulus11iTwoPhaseCheckDigit
java.lang.Object
org.apache.commons.validator.routines.checkdigit.ModulusCheckDigit
org.apache.commons.validator.routines.checkdigit.Modulus11iWeightCheckDigit
org.apache.commons.validator.routines.checkdigit.Modulus11iBSNCheckDigit
org.apache.commons.validator.routines.checkdigit.Modulus11iLeftCheckDigit
org.apache.commons.validator.routines.checkdigit.Modulus11iTwoPhaseCheckDigit
- All Implemented Interfaces:
Serializable,CheckDigit
Lithuanian VAT identification number (VATIN) Check Digit calculation/validation.
Pridetines vertes mokescio moketojo kodas (PVM MK)
- Since:
- 1.10.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionCalculate a modulus Check Digit for a code which does not yet have one.static CheckDigitGets the singleton instance of this validator.booleanValidate a modulus check digit for a code.protected intweightedValue(int charValue, int leftPos, int rightPos) Calculates the weighted value of a character in the code at a specified position.Methods inherited from class org.apache.commons.validator.routines.checkdigit.Modulus11iLeftCheckDigit
toCheckDigitMethods inherited from class org.apache.commons.validator.routines.checkdigit.ModulusCheckDigit
calculateModulus, getCheckdigitLength, getModulus, sumDigits, toInt
-
Method Details
-
getInstance
Gets the singleton instance of this validator.- Returns:
- A singleton instance of the class.
-
calculate
Calculate a modulus Check Digit for a code which does not yet have one.Overridden to provide two calculateModulus methods, the second is used when the first results to 10
- Specified by:
calculatein interfaceCheckDigit- Overrides:
calculatein classModulus11iBSNCheckDigit- Parameters:
code- The code for which to calculate the Check Digit; the check digit should not be included- Returns:
- The calculated Check Digit
- Throws:
CheckDigitException- if an error occurs calculating the check digit
-
weightedValue
protected int weightedValue(int charValue, int leftPos, int rightPos) Calculates the weighted value of a character in the code at a specified position.For the second calculateModulus method digits are weighted by their position+2 from left to right.
- Overrides:
weightedValuein classModulus11iLeftCheckDigit- Parameters:
charValue- The numeric value of the character.leftPos- The position of the character in the code, counting from left to rightrightPos- The positionof the character in the code, counting from right to left- Returns:
- The weighted value of the character.
-
isValid
Validate a modulus check digit for a code.Overridden to provide two calculateModulus methods, the second is used when the first results to 10
- Specified by:
isValidin interfaceCheckDigit- Overrides:
isValidin classModulus11iWeightCheckDigit- Parameters:
code- The code to validate- Returns:
trueif the check digit is valid, otherwisefalse
-