Class Modulus11i2to7CheckDigit

All Implemented Interfaces:
Serializable, CheckDigit

public class Modulus11i2to7CheckDigit extends Modulus11iWeightCheckDigit
Iceland Tax identification number (TIN) Check Digit calculation/validation (kennitala).

It uses weights calculated from right position i started from 2 to 7 and repeated when necessary.

See Wikipedia (is)r for more details.

Since:
2.10.7
Author:
EUG https://github.com/homebeaver
See Also:
  • Method Details

    • getInstance

      public static CheckDigit getInstance()
      Gets the singleton instance of this validator.
      Returns:
      A singleton instance of the class.
    • weightedValue

      protected int weightedValue(int charValue, int leftPos, int rightPos) throws CheckDigitException
      Calculates the weighted value of a character in the code at a specified position.

      TIN digits are weighted by their position from right to left. The weights are 2, 3, .. to 7, Then we repeat the weight 2, 3, ...

      Overrides:
      weightedValue in class Modulus11iWeightCheckDigit
      Parameters:
      charValue - The numeric value of the character.
      leftPos - The position of the character in the code, counting from left to right
      rightPos - The positionof the character in the code, counting from right to left
      Returns:
      The weighted value of the character.
      Throws:
      CheckDigitException - if an error occurs calculating the weighted value
    • toCheckDigit

      protected String toCheckDigit(int charValue) throws CheckDigitException
      Convert an integer value to a check digit.

      Note: this implementation only handles single-digit numeric values For non-numeric characters, override this method to provide integer-->character conversion.

      Override to handle charValue 10.

      Override to handle charValue 10.

      Overrides:
      toCheckDigit in class Modulus11iWeightCheckDigit
      Parameters:
      charValue - The integer value of the character
      Returns:
      The converted character
      Throws:
      CheckDigitException - if integer character value doesn't represent a numeric character