Re-consider semantics of options of mod check constraints

Description

Currently, ignoreNonDigitCharacters() applies to the entire validated string, but it might make sense to apply it only to the interval specified via startIndex and endIndex. Otherwise, values containing separator characters couldn't be validated via @Mod11 (which can use non-digit characters as check digit), e.g. "123-456-789-X", where one would like to ignore the dashes but consider "X" as check digit.

Furthermore the values to be given for startIndex, endIndex and checkDigitPosition depend on the setting of ignoreNonDigitCharacters, in one case only digits need to be taken into account ("counted") when given the values, in the other case all characters of the validated string count. I think, generally using the latter would make using the constraints a bit simpler.

Finally, checkDigitPosition should be renamed into checkDigitIndex to be consistent with the other two options.

Environment

None

Activity

Show:
Victor Rezende dos Santos
August 28, 2013, 10:50 AM

Also if the user sets a startIndex but leaves endIndex = Integer.MAX_VALUE the start is ignored, found while testing with this EAN-14 code (01) 1 23 45678 90123 1 the first 2 in the parenthesis are ignored in the mod calculation.

Assignee

Unassigned

Reporter

Gunnar Morling

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Priority

Major
Configure