001    /*
002     * This class is an auto-generated source file for a HAPI
003     * HL7 v2.x standard structure class.
004     *
005     * For more information, visit: http://hl7api.sourceforge.net/
006     */
007    
008    package ca.uhn.hl7v2.model.v24.segment;
009    
010    // import ca.uhn.hl7v2.model.v24.group.*;
011    import ca.uhn.hl7v2.model.v24.datatype.*;
012    import ca.uhn.log.HapiLogFactory;
013    import ca.uhn.hl7v2.HL7Exception;
014    import ca.uhn.hl7v2.parser.ModelClassFactory;
015    import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
016    import ca.uhn.hl7v2.model.AbstractMessage;
017    import ca.uhn.hl7v2.model.Group;
018    import ca.uhn.hl7v2.model.Type;
019    import ca.uhn.hl7v2.model.AbstractSegment;
020    import ca.uhn.hl7v2.model.Varies;
021    
022    /**
023     *<p>Represents an HL7 APR message segment (Appointment Preferences). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>APR-1: Time Selection Criteria (SCV) <b>optional repeating</b>
027         * <li>APR-2: Resource Selection Criteria (SCV) <b>optional repeating</b>
028         * <li>APR-3: Location Selection Criteria (SCV) <b>optional repeating</b>
029         * <li>APR-4: Slot Spacing Criteria (NM) <b>optional </b>
030         * <li>APR-5: Filler Override Criteria (SCV) <b>optional repeating</b>
031     * </ul>
032     */
033    public class APR extends AbstractSegment {
034    
035        /** 
036         * Creates a new APR segment
037         */
038        public APR(Group parent, ModelClassFactory factory) {
039           super(parent, factory);
040           init(factory);
041        }
042    
043        private void init(ModelClassFactory factory) {
044           try {
045                                      this.add(SCV.class, false, 0, 80, new Object[]{ getMessage(), new Integer(294) }, "Time Selection Criteria");
046                                      this.add(SCV.class, false, 0, 80, new Object[]{ getMessage(), new Integer(294) }, "Resource Selection Criteria");
047                                      this.add(SCV.class, false, 0, 80, new Object[]{ getMessage(), new Integer(294) }, "Location Selection Criteria");
048                                      this.add(NM.class, false, 1, 5, new Object[]{ getMessage(), new Integer(0) }, "Slot Spacing Criteria");
049                                      this.add(SCV.class, false, 0, 80, new Object[]{ getMessage(), new Integer(0) }, "Filler Override Criteria");
050           } catch(HL7Exception e) {
051              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating APR - this is probably a bug in the source code generator.", e);
052           }
053        }
054    
055    
056        /**
057         * Returns all repetitions of Time Selection Criteria (APR-1).
058         */
059        public SCV[] getTimeSelectionCriteria() {
060            SCV[] ret = null;
061            try {
062                Type[] t = this.getField(1);  
063                ret = new SCV[t.length];
064                for (int i = 0; i < ret.length; i++) {
065                    ret[i] = (SCV)t[i];
066                }
067            } catch (ClassCastException cce) {
068                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
069                throw new RuntimeException(cce);
070            } catch (HL7Exception he) {
071                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
072                throw new RuntimeException(he);
073            }
074            return ret;
075        }
076    
077    
078        /**
079         * Returns a count of the current number of repetitions of Time Selection Criteria (APR-1).
080         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
081         * it will return zero.
082         */
083        public int getTimeSelectionCriteriaReps() {
084            SCV[] ret = null;
085            try {
086                Type[] t = this.getField(1);
087                return t.length;  
088            } catch (ClassCastException cce) {
089                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
090                throw new RuntimeException(cce);
091            } catch (HL7Exception he) {
092                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
093                throw new RuntimeException(he);
094            }
095        }
096    
097    
098        /**
099         * Returns a specific repetition of
100         * APR-1: "Time Selection Criteria" - creates it if necessary
101         *
102         * @param rep The repetition index (0-indexed)
103         */
104        public SCV getTimeSelectionCriteria(int rep) { 
105            SCV ret = null;
106            try {
107                Type t = this.getField(1, rep);
108                ret = (SCV)t;
109            } catch (ClassCastException cce) {
110                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
111                throw new RuntimeException(cce);
112            } catch (HL7Exception he) {
113                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
114                throw new RuntimeException(he);
115            }
116            return ret;
117        }
118    
119        /**
120         * Returns a specific repetition of
121         * APR-1: "Time Selection Criteria" - creates it if necessary
122         *
123         * @param rep The repetition index (0-indexed)
124         */
125        public SCV getApr1_TimeSelectionCriteria(int rep) { 
126            SCV ret = null;
127            try {
128                Type t = this.getField(1, rep);
129                ret = (SCV)t;
130            } catch (ClassCastException cce) {
131                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
132                throw new RuntimeException(cce);
133            } catch (HL7Exception he) {
134                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
135                throw new RuntimeException(he);
136            }
137            return ret;
138        }
139    
140    
141        /**
142         * Returns a count of the current number of repetitions of Time Selection Criteria (APR-1).
143         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
144         * it will return zero.
145         */
146        public int getApr1_TimeSelectionCriteriaReps() {
147            SCV[] ret = null;
148            try {
149                Type[] t = this.getField(1);
150                return t.length;  
151            } catch (ClassCastException cce) {
152                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
153                throw new RuntimeException(cce);
154            } catch (HL7Exception he) {
155                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
156                throw new RuntimeException(he);
157            }
158        }
159    
160    
161    
162        /**
163         * Inserts a repetition of
164         * APR-1: "Time Selection Criteria" at a specific index
165         *
166         * @param rep The repetition index (0-indexed)
167         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
168         */
169        public SCV insertTimeSelectionCriteria(int rep) throws HL7Exception { 
170            return (SCV) super.insertRepetition(1, rep);
171        }
172    
173    
174    
175        /**
176         * Inserts a repetition of
177         * APR-1: "Time Selection Criteria" at a specific index
178         *
179         * @param rep The repetition index (0-indexed)
180         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
181         */
182        public SCV insertApr1_TimeSelectionCriteria(int rep) throws HL7Exception { 
183            return (SCV) super.insertRepetition(1, rep);
184        }
185    
186    
187        /**
188         * Removes a repetition of
189         * APR-1: "Time Selection Criteria" at a specific index
190         *
191         * @param rep The repetition index (0-indexed)
192         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
193         */
194        public SCV removeTimeSelectionCriteria(int rep) throws HL7Exception { 
195            return (SCV) super.removeRepetition(1, rep);
196        }
197    
198    
199        /**
200         * Removes a repetition of
201         * APR-1: "Time Selection Criteria" at a specific index
202         *
203         * @param rep The repetition index (0-indexed)
204         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
205         */
206        public SCV removeApr1_TimeSelectionCriteria(int rep) throws HL7Exception { 
207            return (SCV) super.removeRepetition(1, rep);
208        }
209    
210    
211    
212        /**
213         * Returns all repetitions of Resource Selection Criteria (APR-2).
214         */
215        public SCV[] getResourceSelectionCriteria() {
216            SCV[] ret = null;
217            try {
218                Type[] t = this.getField(2);  
219                ret = new SCV[t.length];
220                for (int i = 0; i < ret.length; i++) {
221                    ret[i] = (SCV)t[i];
222                }
223            } catch (ClassCastException cce) {
224                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
225                throw new RuntimeException(cce);
226            } catch (HL7Exception he) {
227                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
228                throw new RuntimeException(he);
229            }
230            return ret;
231        }
232    
233    
234        /**
235         * Returns a count of the current number of repetitions of Resource Selection Criteria (APR-2).
236         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
237         * it will return zero.
238         */
239        public int getResourceSelectionCriteriaReps() {
240            SCV[] ret = null;
241            try {
242                Type[] t = this.getField(2);
243                return t.length;  
244            } catch (ClassCastException cce) {
245                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
246                throw new RuntimeException(cce);
247            } catch (HL7Exception he) {
248                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
249                throw new RuntimeException(he);
250            }
251        }
252    
253    
254        /**
255         * Returns a specific repetition of
256         * APR-2: "Resource Selection Criteria" - creates it if necessary
257         *
258         * @param rep The repetition index (0-indexed)
259         */
260        public SCV getResourceSelectionCriteria(int rep) { 
261            SCV ret = null;
262            try {
263                Type t = this.getField(2, rep);
264                ret = (SCV)t;
265            } catch (ClassCastException cce) {
266                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
267                throw new RuntimeException(cce);
268            } catch (HL7Exception he) {
269                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
270                throw new RuntimeException(he);
271            }
272            return ret;
273        }
274    
275        /**
276         * Returns a specific repetition of
277         * APR-2: "Resource Selection Criteria" - creates it if necessary
278         *
279         * @param rep The repetition index (0-indexed)
280         */
281        public SCV getApr2_ResourceSelectionCriteria(int rep) { 
282            SCV ret = null;
283            try {
284                Type t = this.getField(2, rep);
285                ret = (SCV)t;
286            } catch (ClassCastException cce) {
287                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
288                throw new RuntimeException(cce);
289            } catch (HL7Exception he) {
290                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
291                throw new RuntimeException(he);
292            }
293            return ret;
294        }
295    
296    
297        /**
298         * Returns a count of the current number of repetitions of Resource Selection Criteria (APR-2).
299         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
300         * it will return zero.
301         */
302        public int getApr2_ResourceSelectionCriteriaReps() {
303            SCV[] ret = null;
304            try {
305                Type[] t = this.getField(2);
306                return t.length;  
307            } catch (ClassCastException cce) {
308                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
309                throw new RuntimeException(cce);
310            } catch (HL7Exception he) {
311                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
312                throw new RuntimeException(he);
313            }
314        }
315    
316    
317    
318        /**
319         * Inserts a repetition of
320         * APR-2: "Resource Selection Criteria" at a specific index
321         *
322         * @param rep The repetition index (0-indexed)
323         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
324         */
325        public SCV insertResourceSelectionCriteria(int rep) throws HL7Exception { 
326            return (SCV) super.insertRepetition(2, rep);
327        }
328    
329    
330    
331        /**
332         * Inserts a repetition of
333         * APR-2: "Resource Selection Criteria" at a specific index
334         *
335         * @param rep The repetition index (0-indexed)
336         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
337         */
338        public SCV insertApr2_ResourceSelectionCriteria(int rep) throws HL7Exception { 
339            return (SCV) super.insertRepetition(2, rep);
340        }
341    
342    
343        /**
344         * Removes a repetition of
345         * APR-2: "Resource Selection Criteria" at a specific index
346         *
347         * @param rep The repetition index (0-indexed)
348         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
349         */
350        public SCV removeResourceSelectionCriteria(int rep) throws HL7Exception { 
351            return (SCV) super.removeRepetition(2, rep);
352        }
353    
354    
355        /**
356         * Removes a repetition of
357         * APR-2: "Resource Selection Criteria" at a specific index
358         *
359         * @param rep The repetition index (0-indexed)
360         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
361         */
362        public SCV removeApr2_ResourceSelectionCriteria(int rep) throws HL7Exception { 
363            return (SCV) super.removeRepetition(2, rep);
364        }
365    
366    
367    
368        /**
369         * Returns all repetitions of Location Selection Criteria (APR-3).
370         */
371        public SCV[] getLocationSelectionCriteria() {
372            SCV[] ret = null;
373            try {
374                Type[] t = this.getField(3);  
375                ret = new SCV[t.length];
376                for (int i = 0; i < ret.length; i++) {
377                    ret[i] = (SCV)t[i];
378                }
379            } catch (ClassCastException cce) {
380                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
381                throw new RuntimeException(cce);
382            } catch (HL7Exception he) {
383                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
384                throw new RuntimeException(he);
385            }
386            return ret;
387        }
388    
389    
390        /**
391         * Returns a count of the current number of repetitions of Location Selection Criteria (APR-3).
392         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
393         * it will return zero.
394         */
395        public int getLocationSelectionCriteriaReps() {
396            SCV[] ret = null;
397            try {
398                Type[] t = this.getField(3);
399                return t.length;  
400            } catch (ClassCastException cce) {
401                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
402                throw new RuntimeException(cce);
403            } catch (HL7Exception he) {
404                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
405                throw new RuntimeException(he);
406            }
407        }
408    
409    
410        /**
411         * Returns a specific repetition of
412         * APR-3: "Location Selection Criteria" - creates it if necessary
413         *
414         * @param rep The repetition index (0-indexed)
415         */
416        public SCV getLocationSelectionCriteria(int rep) { 
417            SCV ret = null;
418            try {
419                Type t = this.getField(3, rep);
420                ret = (SCV)t;
421            } catch (ClassCastException cce) {
422                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
423                throw new RuntimeException(cce);
424            } catch (HL7Exception he) {
425                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
426                throw new RuntimeException(he);
427            }
428            return ret;
429        }
430    
431        /**
432         * Returns a specific repetition of
433         * APR-3: "Location Selection Criteria" - creates it if necessary
434         *
435         * @param rep The repetition index (0-indexed)
436         */
437        public SCV getApr3_LocationSelectionCriteria(int rep) { 
438            SCV ret = null;
439            try {
440                Type t = this.getField(3, rep);
441                ret = (SCV)t;
442            } catch (ClassCastException cce) {
443                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
444                throw new RuntimeException(cce);
445            } catch (HL7Exception he) {
446                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
447                throw new RuntimeException(he);
448            }
449            return ret;
450        }
451    
452    
453        /**
454         * Returns a count of the current number of repetitions of Location Selection Criteria (APR-3).
455         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
456         * it will return zero.
457         */
458        public int getApr3_LocationSelectionCriteriaReps() {
459            SCV[] ret = null;
460            try {
461                Type[] t = this.getField(3);
462                return t.length;  
463            } catch (ClassCastException cce) {
464                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
465                throw new RuntimeException(cce);
466            } catch (HL7Exception he) {
467                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
468                throw new RuntimeException(he);
469            }
470        }
471    
472    
473    
474        /**
475         * Inserts a repetition of
476         * APR-3: "Location Selection Criteria" at a specific index
477         *
478         * @param rep The repetition index (0-indexed)
479         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
480         */
481        public SCV insertLocationSelectionCriteria(int rep) throws HL7Exception { 
482            return (SCV) super.insertRepetition(3, rep);
483        }
484    
485    
486    
487        /**
488         * Inserts a repetition of
489         * APR-3: "Location Selection Criteria" at a specific index
490         *
491         * @param rep The repetition index (0-indexed)
492         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
493         */
494        public SCV insertApr3_LocationSelectionCriteria(int rep) throws HL7Exception { 
495            return (SCV) super.insertRepetition(3, rep);
496        }
497    
498    
499        /**
500         * Removes a repetition of
501         * APR-3: "Location Selection Criteria" at a specific index
502         *
503         * @param rep The repetition index (0-indexed)
504         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
505         */
506        public SCV removeLocationSelectionCriteria(int rep) throws HL7Exception { 
507            return (SCV) super.removeRepetition(3, rep);
508        }
509    
510    
511        /**
512         * Removes a repetition of
513         * APR-3: "Location Selection Criteria" at a specific index
514         *
515         * @param rep The repetition index (0-indexed)
516         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
517         */
518        public SCV removeApr3_LocationSelectionCriteria(int rep) throws HL7Exception { 
519            return (SCV) super.removeRepetition(3, rep);
520        }
521    
522    
523    
524    
525        /**
526         * Returns
527         * APR-4: "Slot Spacing Criteria" - creates it if necessary
528         */
529        public NM getSlotSpacingCriteria() { 
530            NM ret = null;
531            try {
532                Type t = this.getField(4, 0);
533                ret = (NM)t;
534            } catch (ClassCastException cce) {
535                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
536                throw new RuntimeException(cce);
537            } catch (HL7Exception he) {
538                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
539                throw new RuntimeException(he);
540            }
541            return ret;
542        }
543    
544    
545        /**
546         * Returns
547         * APR-4: "Slot Spacing Criteria" - creates it if necessary
548         */
549        public NM getApr4_SlotSpacingCriteria() { 
550            NM ret = null;
551            try {
552                Type t = this.getField(4, 0);
553                ret = (NM)t;
554            } catch (ClassCastException cce) {
555                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
556                throw new RuntimeException(cce);
557            } catch (HL7Exception he) {
558                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
559                throw new RuntimeException(he);
560            }
561            return ret;
562        }
563    
564    
565        /**
566         * Returns all repetitions of Filler Override Criteria (APR-5).
567         */
568        public SCV[] getFillerOverrideCriteria() {
569            SCV[] ret = null;
570            try {
571                Type[] t = this.getField(5);  
572                ret = new SCV[t.length];
573                for (int i = 0; i < ret.length; i++) {
574                    ret[i] = (SCV)t[i];
575                }
576            } catch (ClassCastException cce) {
577                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
578                throw new RuntimeException(cce);
579            } catch (HL7Exception he) {
580                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
581                throw new RuntimeException(he);
582            }
583            return ret;
584        }
585    
586    
587        /**
588         * Returns a count of the current number of repetitions of Filler Override Criteria (APR-5).
589         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
590         * it will return zero.
591         */
592        public int getFillerOverrideCriteriaReps() {
593            SCV[] ret = null;
594            try {
595                Type[] t = this.getField(5);
596                return t.length;  
597            } catch (ClassCastException cce) {
598                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
599                throw new RuntimeException(cce);
600            } catch (HL7Exception he) {
601                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
602                throw new RuntimeException(he);
603            }
604        }
605    
606    
607        /**
608         * Returns a specific repetition of
609         * APR-5: "Filler Override Criteria" - creates it if necessary
610         *
611         * @param rep The repetition index (0-indexed)
612         */
613        public SCV getFillerOverrideCriteria(int rep) { 
614            SCV ret = null;
615            try {
616                Type t = this.getField(5, rep);
617                ret = (SCV)t;
618            } catch (ClassCastException cce) {
619                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
620                throw new RuntimeException(cce);
621            } catch (HL7Exception he) {
622                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
623                throw new RuntimeException(he);
624            }
625            return ret;
626        }
627    
628        /**
629         * Returns a specific repetition of
630         * APR-5: "Filler Override Criteria" - creates it if necessary
631         *
632         * @param rep The repetition index (0-indexed)
633         */
634        public SCV getApr5_FillerOverrideCriteria(int rep) { 
635            SCV ret = null;
636            try {
637                Type t = this.getField(5, rep);
638                ret = (SCV)t;
639            } catch (ClassCastException cce) {
640                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
641                throw new RuntimeException(cce);
642            } catch (HL7Exception he) {
643                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
644                throw new RuntimeException(he);
645            }
646            return ret;
647        }
648    
649    
650        /**
651         * Returns a count of the current number of repetitions of Filler Override Criteria (APR-5).
652         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
653         * it will return zero.
654         */
655        public int getApr5_FillerOverrideCriteriaReps() {
656            SCV[] ret = null;
657            try {
658                Type[] t = this.getField(5);
659                return t.length;  
660            } catch (ClassCastException cce) {
661                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
662                throw new RuntimeException(cce);
663            } catch (HL7Exception he) {
664                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
665                throw new RuntimeException(he);
666            }
667        }
668    
669    
670    
671        /**
672         * Inserts a repetition of
673         * APR-5: "Filler Override Criteria" at a specific index
674         *
675         * @param rep The repetition index (0-indexed)
676         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
677         */
678        public SCV insertFillerOverrideCriteria(int rep) throws HL7Exception { 
679            return (SCV) super.insertRepetition(5, rep);
680        }
681    
682    
683    
684        /**
685         * Inserts a repetition of
686         * APR-5: "Filler Override Criteria" at a specific index
687         *
688         * @param rep The repetition index (0-indexed)
689         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
690         */
691        public SCV insertApr5_FillerOverrideCriteria(int rep) throws HL7Exception { 
692            return (SCV) super.insertRepetition(5, rep);
693        }
694    
695    
696        /**
697         * Removes a repetition of
698         * APR-5: "Filler Override Criteria" at a specific index
699         *
700         * @param rep The repetition index (0-indexed)
701         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
702         */
703        public SCV removeFillerOverrideCriteria(int rep) throws HL7Exception { 
704            return (SCV) super.removeRepetition(5, rep);
705        }
706    
707    
708        /**
709         * Removes a repetition of
710         * APR-5: "Filler Override Criteria" at a specific index
711         *
712         * @param rep The repetition index (0-indexed)
713         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
714         */
715        public SCV removeApr5_FillerOverrideCriteria(int rep) throws HL7Exception { 
716            return (SCV) super.removeRepetition(5, rep);
717        }
718    
719    
720    
721    
722    
723    
724        /** {@inheritDoc} */   
725        protected Type createNewTypeWithoutReflection(int field) {
726           switch (field) {
727              case 0: return new SCV(getMessage());
728              case 1: return new SCV(getMessage());
729              case 2: return new SCV(getMessage());
730              case 3: return new NM(getMessage());
731              case 4: return new SCV(getMessage());
732              default: return null;
733           }
734       }
735    
736    
737    }
738