Interface CheckDigit

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.String calculate​(java.lang.String code)
      Calculates the Check Digit for a code.
      boolean isValid​(java.lang.String code)
      Validates the check digit for the code.
    • Method Detail

      • calculate

        java.lang.String calculate​(java.lang.String code)
                            throws CheckDigitException
        Calculates the Check Digit for a code.
        Parameters:
        code - The code to calculate the Check Digit for. The string must not include the check digit
        Returns:
        The calculated Check Digit
        Throws:
        CheckDigitException - if an error occurs.
      • isValid

        boolean isValid​(java.lang.String code)
        Validates the check digit for the code.
        Parameters:
        code - The code to validate, the string must include the check digit.
        Returns:
        true if the check digit is valid, otherwise false.