/** * Returns the desired repetition * @param rep The desired repetition number. Note that in accordance with the HL7 standard * @return The desired repetition * @throws ConformanceException if repetition is not accessible */ public Repeatable getRep(int rep) throws ConfRepException { if (rep < 1 || (maxReps != -1 && maxReps < rep)) throw new ConfRepException(maxReps, rep); rep--; // Decremented because HL7 standard wants 1-offset arrays createNewReps(rep); // Create new reps if needed return reps.get(rep); }
/** * Returns the desired repetition * @param rep The desired repetition number. Note that in accordance with the HL7 standard * @return The desired repetition * @throws ConformanceException if repetition is not accessible */ public Repeatable getRep(int rep) throws ConfRepException { if (rep < 1 || (maxReps != -1 && maxReps < rep)) throw new ConfRepException(maxReps, rep); rep--; // Decremented because HL7 standard wants 1-offset arrays createNewReps(rep); // Create new reps if needed return reps.get(rep); }
/** Constructor for FiniteList * @param repType the Class which is repeating * @param underlyingObject the underlying object that the extending class represents */ public FiniteList(Class<? extends Repeatable> repType, Object underlyingObject) { this.repType = repType; this.underlyingObject = underlyingObject; Repeatable firstRep = createRep(0); this.maxReps = firstRep.getMaxReps(); // this.minReps = firstRep.getMinReps(); reps = new ArrayList<Repeatable>(); reps.add(firstRep); createNewReps(maxReps); }
/** Constructor for FiniteList * @param repType the Class which is repeating * @param underlyingObject the underlying object that the extending class represents */ public FiniteList(Class<? extends Repeatable> repType, Object underlyingObject) { this.repType = repType; this.underlyingObject = underlyingObject; Repeatable firstRep = createRep(0); this.maxReps = firstRep.getMaxReps(); // this.minReps = firstRep.getMinReps(); reps = new ArrayList<Repeatable>(); reps.add(firstRep); createNewReps(maxReps); }