Class Modulus11FINCheckDigit

All Implemented Interfaces:
Serializable, CheckDigit

public final class Modulus11FINCheckDigit extends Modulus11XCheckDigit
Modulus 11-X module for FIN Check Digit calculation/validation of 11-X Numbers.

11-X FIN Numbers are a alphanumeric code. The last (check) digit can have a value of "X".

Check digit calculation is based on modulus 11 with digits being weighted based by their position, from right to left. If the check digit is calculated as "10" it is converted to "X".

See Wikipedia (de) for more details. And Berechnung der Prüfziffer zur FIN nach dem Modulo-11-Verfahren in kba.de.

Since:
2.10.5
See Also:
  • Method Details

    • getInstance

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

      protected int toInt(char character, int leftPos, int rightPos) throws CheckDigitException

      Convert a character at a specified position to an integer value.

      Character 'X' check digit converted to 10.

      Override to handle character FIN mapping.

      Overrides:
      toInt in class Modulus11XCheckDigit
      Parameters:
      character - The character to convert.
      leftPos - The position of the character in the code, counting from left to right
      rightPos - The position of the character in the code, counting from right to left
      Returns:
      The integer value of the character.
      Throws:
      CheckDigitException - if an error occurs.
    • 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.

      Some modulus routines weight the value of a character depending on its position in the code (e.g. ISBN-10), while others use different weighting factors for odd/even positions (e.g. EAN or Luhn). Implement the appropriate mechanism required by overriding this method.

      Implement to handle weights as right position.

      Override to handle weights as right position.

      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 position of 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
    • isValid

      public boolean isValid(String code)
      Validate a modulus check digit for a code.
      Specified by:
      isValid in interface CheckDigit
      Overrides:
      isValid in class Modulus11iWeightCheckDigit
      Parameters:
      code - The code to validate
      Returns:
      true if the check digit is valid, otherwise false