Class VerhoeffCheckDigit

    • Constructor Summary

      Constructors 
      Constructor Description
      VerhoeffCheckDigit()
      Constructs a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String calculate​(java.lang.String code)
      Calculate a Verhoeff Check Digit for a code.
      boolean isValid​(java.lang.String code)
      Validate the Verhoeff Check Digit for a code.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • calculate

        public java.lang.String calculate​(java.lang.String code)
                                   throws CheckDigitException
        Calculate a Verhoeff Check Digit for a code.
        Specified by:
        calculate in interface CheckDigit
        Parameters:
        code - The code to calculate the Check Digit for
        Returns:
        The calculated Check Digit
        Throws:
        CheckDigitException - if an error occurs calculating the check digit for the specified code
      • isValid

        public boolean isValid​(java.lang.String code)
        Validate the Verhoeff Check Digit for a code.
        Specified by:
        isValid in interface CheckDigit
        Parameters:
        code - The code to validate
        Returns:
        true if the check digit is valid, otherwise false