* @param usage the usage code
* @param name the name of the repeating structure (used in exception msg)
* @return null if cardinality OK, exception otherwise
*/
protected HL7Exception testCardinality(int reps, int min, int max, String usage, String name) {
HL7Exception e = null;
if (reps < min && usage.equalsIgnoreCase("R")) {
e = new ProfileNotFollowedException(name + " must have at least " + min + " repetitions (has " + reps + ")");
} else if (max > 0 && reps > max) {
e = new ProfileNotFollowedException(name + " must have no more than " + max + " repetitions (has " + reps + ")");
}