@Override protected String toCheckDigit(int charValue) throws CheckDigitException { if (charValue == 10) { // CHECKSTYLE IGNORE MagicNumber return "X"; } return super.toCheckDigit(charValue); }
/** * <p>Convert an integer value to a character at a specified position.</p> * * <p>Value '10' for position 1 (check digit) converted to 'X'.</p> * * @param charValue The integer value of the character. * @return The converted character. * @throws CheckDigitException if an error occurs. */ @Override protected String toCheckDigit(int charValue) throws CheckDigitException { if (charValue == 10) { // CHECKSTYLE IGNORE MagicNumber return "X"; } return super.toCheckDigit(charValue); }
/** * Calculate a modulus <i>Check Digit</i> for a code which does not yet have one. * * @param code The code for which to calculate the Check Digit; * the check digit should not be included * @return The calculated Check Digit * @throws CheckDigitException if an error occurs calculating the check digit */ @Override public String calculate(String code) throws CheckDigitException { if (code == null || code.length() == 0) { throw new CheckDigitException("Code is missing"); } int modulusResult = calculateModulus(code, false); int charValue = (modulus - modulusResult) % modulus; return toCheckDigit(charValue); }
@Override protected String toCheckDigit(int charValue) throws CheckDigitException { if (charValue == 10) { // CHECKSTYLE IGNORE MagicNumber return "X"; } return super.toCheckDigit(charValue); }
/** * <p>Convert an integer value to a character at a specified position.</p> * * <p>Value '10' for position 1 (check digit) converted to 'X'.</p> * * @param charValue The integer value of the character. * @return The converted character. * @throws CheckDigitException if an error occurs. */ protected String toCheckDigit(int charValue) throws CheckDigitException { if (charValue == 10) { return "X"; } return super.toCheckDigit(charValue); }
/** * <p>Convert an integer value to a character at a specified position.</p> * * <p>Value '10' for position 1 (check digit) converted to 'X'.</p> * * @param charValue The integer value of the character. * @return The converted character. * @throws CheckDigitException if an error occurs. */ @Override protected String toCheckDigit(int charValue) throws CheckDigitException { if (charValue == 10) { // CHECKSTYLE IGNORE MagicNumber return "X"; } return super.toCheckDigit(charValue); }
/** * Calculate a modulus <i>Check Digit</i> for a code which does not yet have one. * * @param code The code for which to calculate the Check Digit; * the check digit should not be included * @return The calculated Check Digit * @throws CheckDigitException if an error occurs calculating the check digit */ @Override public String calculate(String code) throws CheckDigitException { if (code == null || code.length() == 0) { throw new CheckDigitException("Code is missing"); } int modulusResult = calculateModulus(code, false); int charValue = (modulus - modulusResult) % modulus; return toCheckDigit(charValue); }
/** * Calculate a modulus <i>Check Digit</i> for a code which does not yet have one. * * @param code The code for which to calculate the Check Digit; * the check digit should not be included * @return The calculated Check Digit * @throws CheckDigitException if an error occurs calculating the check digit */ @Override public String calculate(String code) throws CheckDigitException { if (code == null || code.length() == 0) { throw new CheckDigitException("Code is missing"); } int modulusResult = calculateModulus(code, false); int charValue = (modulus - modulusResult) % modulus; return toCheckDigit(charValue); }
/** * Calculate a modulus <i>Check Digit</i> for a code which does not yet have one. * * @param code The code for which to calculate the Check Digit; * the check digit should not be included * @return The calculated Check Digit * @throws CheckDigitException if an error occurs calculating the check digit */ @Override public String calculate(String code) throws CheckDigitException { if (code == null || code.length() == 0) { throw new CheckDigitException("Code is missing"); } int modulusResult = calculateModulus(code, false); int charValue = (modulus - modulusResult) % modulus; return toCheckDigit(charValue); }