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 RXG message segment (Pharmacy/Treatment Give). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>RXG-1: Give Sub-ID Counter (NM) <b> </b>
027         * <li>RXG-2: Dispense Sub-ID Counter (NM) <b>optional </b>
028         * <li>RXG-3: Quantity/Timing (TQ) <b> </b>
029         * <li>RXG-4: Give Code (CE) <b> </b>
030         * <li>RXG-5: Give Amount - Minimum (NM) <b> </b>
031         * <li>RXG-6: Give Amount - Maximum (NM) <b>optional </b>
032         * <li>RXG-7: Give Units (CE) <b> </b>
033         * <li>RXG-8: Give Dosage Form (CE) <b>optional </b>
034         * <li>RXG-9: Administration Notes (CE) <b>optional repeating</b>
035         * <li>RXG-10: Substitution Status (ID) <b>optional </b>
036         * <li>RXG-11: Dispense-To Location (LA2) <b>optional </b>
037         * <li>RXG-12: Needs Human Review (ID) <b>optional </b>
038         * <li>RXG-13: Pharmacy/Treatment Supplier's Special Administration Instructions (CE) <b>optional repeating</b>
039         * <li>RXG-14: Give Per (Time Unit) (ST) <b>optional </b>
040         * <li>RXG-15: Give Rate Amount (ST) <b>optional </b>
041         * <li>RXG-16: Give Rate Units (CE) <b>optional </b>
042         * <li>RXG-17: Give Strength (NM) <b>optional </b>
043         * <li>RXG-18: Give Strength Units (CE) <b>optional </b>
044         * <li>RXG-19: Substance Lot Number (ST) <b>optional repeating</b>
045         * <li>RXG-20: Substance Expiration Date (TS) <b>optional repeating</b>
046         * <li>RXG-21: Substance Manufacturer Name (CE) <b>optional repeating</b>
047         * <li>RXG-22: Indication (CE) <b>optional repeating</b>
048     * </ul>
049     */
050    public class RXG extends AbstractSegment {
051    
052        /** 
053         * Creates a new RXG segment
054         */
055        public RXG(Group parent, ModelClassFactory factory) {
056           super(parent, factory);
057           init(factory);
058        }
059    
060        private void init(ModelClassFactory factory) {
061           try {
062                                      this.add(NM.class, true, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Give Sub-ID Counter");
063                                      this.add(NM.class, false, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Dispense Sub-ID Counter");
064                                      this.add(TQ.class, true, 1, 200, new Object[]{ getMessage(), new Integer(0) }, "Quantity/Timing");
065                                      this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(292) }, "Give Code");
066                                      this.add(NM.class, true, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Give Amount - Minimum");
067                                      this.add(NM.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Give Amount - Maximum");
068                                      this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Give Units");
069                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Give Dosage Form");
070                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Administration Notes");
071                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Substitution Status");
072                                      this.add(LA2.class, false, 1, 200, new Object[]{ getMessage(), new Integer(0) }, "Dispense-To Location");
073                                      this.add(ID.class, false, 1, 1, new Object[]{ getMessage() }, "Needs Human Review");
074                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Pharmacy/Treatment Supplier's Special Administration Instructions");
075                                      this.add(ST.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Give Per (Time Unit)");
076                                      this.add(ST.class, false, 1, 6, new Object[]{ getMessage(), new Integer(0) }, "Give Rate Amount");
077                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Give Rate Units");
078                                      this.add(NM.class, false, 1, 20, new Object[]{ getMessage(), new Integer(0) }, "Give Strength");
079                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Give Strength Units");
080                                      this.add(ST.class, false, 0, 20, new Object[]{ getMessage(), new Integer(0) }, "Substance Lot Number");
081                                      this.add(TS.class, false, 0, 26, new Object[]{ getMessage(), new Integer(0) }, "Substance Expiration Date");
082                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(227) }, "Substance Manufacturer Name");
083                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Indication");
084           } catch(HL7Exception e) {
085              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating RXG - this is probably a bug in the source code generator.", e);
086           }
087        }
088    
089    
090    
091        /**
092         * Returns
093         * RXG-1: "Give Sub-ID Counter" - creates it if necessary
094         */
095        public NM getGiveSubIDCounter() { 
096            NM ret = null;
097            try {
098                Type t = this.getField(1, 0);
099                ret = (NM)t;
100            } catch (ClassCastException cce) {
101                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
102                throw new RuntimeException(cce);
103            } catch (HL7Exception he) {
104                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
105                throw new RuntimeException(he);
106            }
107            return ret;
108        }
109    
110    
111        /**
112         * Returns
113         * RXG-1: "Give Sub-ID Counter" - creates it if necessary
114         */
115        public NM getRxg1_GiveSubIDCounter() { 
116            NM ret = null;
117            try {
118                Type t = this.getField(1, 0);
119                ret = (NM)t;
120            } catch (ClassCastException cce) {
121                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
122                throw new RuntimeException(cce);
123            } catch (HL7Exception he) {
124                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
125                throw new RuntimeException(he);
126            }
127            return ret;
128        }
129    
130    
131    
132        /**
133         * Returns
134         * RXG-2: "Dispense Sub-ID Counter" - creates it if necessary
135         */
136        public NM getDispenseSubIDCounter() { 
137            NM ret = null;
138            try {
139                Type t = this.getField(2, 0);
140                ret = (NM)t;
141            } catch (ClassCastException cce) {
142                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
143                throw new RuntimeException(cce);
144            } catch (HL7Exception he) {
145                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
146                throw new RuntimeException(he);
147            }
148            return ret;
149        }
150    
151    
152        /**
153         * Returns
154         * RXG-2: "Dispense Sub-ID Counter" - creates it if necessary
155         */
156        public NM getRxg2_DispenseSubIDCounter() { 
157            NM ret = null;
158            try {
159                Type t = this.getField(2, 0);
160                ret = (NM)t;
161            } catch (ClassCastException cce) {
162                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
163                throw new RuntimeException(cce);
164            } catch (HL7Exception he) {
165                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
166                throw new RuntimeException(he);
167            }
168            return ret;
169        }
170    
171    
172    
173        /**
174         * Returns
175         * RXG-3: "Quantity/Timing" - creates it if necessary
176         */
177        public TQ getQuantityTiming() { 
178            TQ ret = null;
179            try {
180                Type t = this.getField(3, 0);
181                ret = (TQ)t;
182            } catch (ClassCastException cce) {
183                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
184                throw new RuntimeException(cce);
185            } catch (HL7Exception he) {
186                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
187                throw new RuntimeException(he);
188            }
189            return ret;
190        }
191    
192    
193        /**
194         * Returns
195         * RXG-3: "Quantity/Timing" - creates it if necessary
196         */
197        public TQ getRxg3_QuantityTiming() { 
198            TQ ret = null;
199            try {
200                Type t = this.getField(3, 0);
201                ret = (TQ)t;
202            } catch (ClassCastException cce) {
203                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
204                throw new RuntimeException(cce);
205            } catch (HL7Exception he) {
206                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
207                throw new RuntimeException(he);
208            }
209            return ret;
210        }
211    
212    
213    
214        /**
215         * Returns
216         * RXG-4: "Give Code" - creates it if necessary
217         */
218        public CE getGiveCode() { 
219            CE ret = null;
220            try {
221                Type t = this.getField(4, 0);
222                ret = (CE)t;
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
236         * RXG-4: "Give Code" - creates it if necessary
237         */
238        public CE getRxg4_GiveCode() { 
239            CE ret = null;
240            try {
241                Type t = this.getField(4, 0);
242                ret = (CE)t;
243            } catch (ClassCastException cce) {
244                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
245                throw new RuntimeException(cce);
246            } catch (HL7Exception he) {
247                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
248                throw new RuntimeException(he);
249            }
250            return ret;
251        }
252    
253    
254    
255        /**
256         * Returns
257         * RXG-5: "Give Amount - Minimum" - creates it if necessary
258         */
259        public NM getGiveAmountMinimum() { 
260            NM ret = null;
261            try {
262                Type t = this.getField(5, 0);
263                ret = (NM)t;
264            } catch (ClassCastException cce) {
265                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
266                throw new RuntimeException(cce);
267            } catch (HL7Exception he) {
268                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
269                throw new RuntimeException(he);
270            }
271            return ret;
272        }
273    
274    
275        /**
276         * Returns
277         * RXG-5: "Give Amount - Minimum" - creates it if necessary
278         */
279        public NM getRxg5_GiveAmountMinimum() { 
280            NM ret = null;
281            try {
282                Type t = this.getField(5, 0);
283                ret = (NM)t;
284            } catch (ClassCastException cce) {
285                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
286                throw new RuntimeException(cce);
287            } catch (HL7Exception he) {
288                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
289                throw new RuntimeException(he);
290            }
291            return ret;
292        }
293    
294    
295    
296        /**
297         * Returns
298         * RXG-6: "Give Amount - Maximum" - creates it if necessary
299         */
300        public NM getGiveAmountMaximum() { 
301            NM ret = null;
302            try {
303                Type t = this.getField(6, 0);
304                ret = (NM)t;
305            } catch (ClassCastException cce) {
306                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
307                throw new RuntimeException(cce);
308            } catch (HL7Exception he) {
309                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
310                throw new RuntimeException(he);
311            }
312            return ret;
313        }
314    
315    
316        /**
317         * Returns
318         * RXG-6: "Give Amount - Maximum" - creates it if necessary
319         */
320        public NM getRxg6_GiveAmountMaximum() { 
321            NM ret = null;
322            try {
323                Type t = this.getField(6, 0);
324                ret = (NM)t;
325            } catch (ClassCastException cce) {
326                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
327                throw new RuntimeException(cce);
328            } catch (HL7Exception he) {
329                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
330                throw new RuntimeException(he);
331            }
332            return ret;
333        }
334    
335    
336    
337        /**
338         * Returns
339         * RXG-7: "Give Units" - creates it if necessary
340         */
341        public CE getGiveUnits() { 
342            CE ret = null;
343            try {
344                Type t = this.getField(7, 0);
345                ret = (CE)t;
346            } catch (ClassCastException cce) {
347                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
348                throw new RuntimeException(cce);
349            } catch (HL7Exception he) {
350                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
351                throw new RuntimeException(he);
352            }
353            return ret;
354        }
355    
356    
357        /**
358         * Returns
359         * RXG-7: "Give Units" - creates it if necessary
360         */
361        public CE getRxg7_GiveUnits() { 
362            CE ret = null;
363            try {
364                Type t = this.getField(7, 0);
365                ret = (CE)t;
366            } catch (ClassCastException cce) {
367                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
368                throw new RuntimeException(cce);
369            } catch (HL7Exception he) {
370                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
371                throw new RuntimeException(he);
372            }
373            return ret;
374        }
375    
376    
377    
378        /**
379         * Returns
380         * RXG-8: "Give Dosage Form" - creates it if necessary
381         */
382        public CE getGiveDosageForm() { 
383            CE ret = null;
384            try {
385                Type t = this.getField(8, 0);
386                ret = (CE)t;
387            } catch (ClassCastException cce) {
388                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
389                throw new RuntimeException(cce);
390            } catch (HL7Exception he) {
391                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
392                throw new RuntimeException(he);
393            }
394            return ret;
395        }
396    
397    
398        /**
399         * Returns
400         * RXG-8: "Give Dosage Form" - creates it if necessary
401         */
402        public CE getRxg8_GiveDosageForm() { 
403            CE ret = null;
404            try {
405                Type t = this.getField(8, 0);
406                ret = (CE)t;
407            } catch (ClassCastException cce) {
408                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
409                throw new RuntimeException(cce);
410            } catch (HL7Exception he) {
411                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
412                throw new RuntimeException(he);
413            }
414            return ret;
415        }
416    
417    
418        /**
419         * Returns all repetitions of Administration Notes (RXG-9).
420         */
421        public CE[] getAdministrationNotes() {
422            CE[] ret = null;
423            try {
424                Type[] t = this.getField(9);  
425                ret = new CE[t.length];
426                for (int i = 0; i < ret.length; i++) {
427                    ret[i] = (CE)t[i];
428                }
429            } catch (ClassCastException cce) {
430                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
431                throw new RuntimeException(cce);
432            } catch (HL7Exception he) {
433                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
434                throw new RuntimeException(he);
435            }
436            return ret;
437        }
438    
439    
440        /**
441         * Returns a count of the current number of repetitions of Administration Notes (RXG-9).
442         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
443         * it will return zero.
444         */
445        public int getAdministrationNotesReps() {
446            CE[] ret = null;
447            try {
448                Type[] t = this.getField(9);
449                return t.length;  
450            } catch (ClassCastException cce) {
451                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
452                throw new RuntimeException(cce);
453            } catch (HL7Exception he) {
454                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
455                throw new RuntimeException(he);
456            }
457        }
458    
459    
460        /**
461         * Returns a specific repetition of
462         * RXG-9: "Administration Notes" - creates it if necessary
463         *
464         * @param rep The repetition index (0-indexed)
465         */
466        public CE getAdministrationNotes(int rep) { 
467            CE ret = null;
468            try {
469                Type t = this.getField(9, rep);
470                ret = (CE)t;
471            } catch (ClassCastException cce) {
472                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
473                throw new RuntimeException(cce);
474            } catch (HL7Exception he) {
475                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
476                throw new RuntimeException(he);
477            }
478            return ret;
479        }
480    
481        /**
482         * Returns a specific repetition of
483         * RXG-9: "Administration Notes" - creates it if necessary
484         *
485         * @param rep The repetition index (0-indexed)
486         */
487        public CE getRxg9_AdministrationNotes(int rep) { 
488            CE ret = null;
489            try {
490                Type t = this.getField(9, rep);
491                ret = (CE)t;
492            } catch (ClassCastException cce) {
493                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
494                throw new RuntimeException(cce);
495            } catch (HL7Exception he) {
496                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
497                throw new RuntimeException(he);
498            }
499            return ret;
500        }
501    
502    
503        /**
504         * Returns a count of the current number of repetitions of Administration Notes (RXG-9).
505         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
506         * it will return zero.
507         */
508        public int getRxg9_AdministrationNotesReps() {
509            CE[] ret = null;
510            try {
511                Type[] t = this.getField(9);
512                return t.length;  
513            } catch (ClassCastException cce) {
514                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
515                throw new RuntimeException(cce);
516            } catch (HL7Exception he) {
517                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
518                throw new RuntimeException(he);
519            }
520        }
521    
522    
523    
524        /**
525         * Inserts a repetition of
526         * RXG-9: "Administration Notes" at a specific index
527         *
528         * @param rep The repetition index (0-indexed)
529         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
530         */
531        public CE insertAdministrationNotes(int rep) throws HL7Exception { 
532            return (CE) super.insertRepetition(9, rep);
533        }
534    
535    
536    
537        /**
538         * Inserts a repetition of
539         * RXG-9: "Administration Notes" at a specific index
540         *
541         * @param rep The repetition index (0-indexed)
542         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
543         */
544        public CE insertRxg9_AdministrationNotes(int rep) throws HL7Exception { 
545            return (CE) super.insertRepetition(9, rep);
546        }
547    
548    
549        /**
550         * Removes a repetition of
551         * RXG-9: "Administration Notes" at a specific index
552         *
553         * @param rep The repetition index (0-indexed)
554         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
555         */
556        public CE removeAdministrationNotes(int rep) throws HL7Exception { 
557            return (CE) super.removeRepetition(9, rep);
558        }
559    
560    
561        /**
562         * Removes a repetition of
563         * RXG-9: "Administration Notes" at a specific index
564         *
565         * @param rep The repetition index (0-indexed)
566         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
567         */
568        public CE removeRxg9_AdministrationNotes(int rep) throws HL7Exception { 
569            return (CE) super.removeRepetition(9, rep);
570        }
571    
572    
573    
574    
575        /**
576         * Returns
577         * RXG-10: "Substitution Status" - creates it if necessary
578         */
579        public ID getSubstitutionStatus() { 
580            ID ret = null;
581            try {
582                Type t = this.getField(10, 0);
583                ret = (ID)t;
584            } catch (ClassCastException cce) {
585                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
586                throw new RuntimeException(cce);
587            } catch (HL7Exception he) {
588                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
589                throw new RuntimeException(he);
590            }
591            return ret;
592        }
593    
594    
595        /**
596         * Returns
597         * RXG-10: "Substitution Status" - creates it if necessary
598         */
599        public ID getRxg10_SubstitutionStatus() { 
600            ID ret = null;
601            try {
602                Type t = this.getField(10, 0);
603                ret = (ID)t;
604            } catch (ClassCastException cce) {
605                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
606                throw new RuntimeException(cce);
607            } catch (HL7Exception he) {
608                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
609                throw new RuntimeException(he);
610            }
611            return ret;
612        }
613    
614    
615    
616        /**
617         * Returns
618         * RXG-11: "Dispense-To Location" - creates it if necessary
619         */
620        public LA2 getDispenseToLocation() { 
621            LA2 ret = null;
622            try {
623                Type t = this.getField(11, 0);
624                ret = (LA2)t;
625            } catch (ClassCastException cce) {
626                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
627                throw new RuntimeException(cce);
628            } catch (HL7Exception he) {
629                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
630                throw new RuntimeException(he);
631            }
632            return ret;
633        }
634    
635    
636        /**
637         * Returns
638         * RXG-11: "Dispense-To Location" - creates it if necessary
639         */
640        public LA2 getRxg11_DispenseToLocation() { 
641            LA2 ret = null;
642            try {
643                Type t = this.getField(11, 0);
644                ret = (LA2)t;
645            } catch (ClassCastException cce) {
646                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
647                throw new RuntimeException(cce);
648            } catch (HL7Exception he) {
649                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
650                throw new RuntimeException(he);
651            }
652            return ret;
653        }
654    
655    
656    
657        /**
658         * Returns
659         * RXG-12: "Needs Human Review" - creates it if necessary
660         */
661        public ID getNeedsHumanReview() { 
662            ID ret = null;
663            try {
664                Type t = this.getField(12, 0);
665                ret = (ID)t;
666            } catch (ClassCastException cce) {
667                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
668                throw new RuntimeException(cce);
669            } catch (HL7Exception he) {
670                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
671                throw new RuntimeException(he);
672            }
673            return ret;
674        }
675    
676    
677        /**
678         * Returns
679         * RXG-12: "Needs Human Review" - creates it if necessary
680         */
681        public ID getRxg12_NeedsHumanReview() { 
682            ID ret = null;
683            try {
684                Type t = this.getField(12, 0);
685                ret = (ID)t;
686            } catch (ClassCastException cce) {
687                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
688                throw new RuntimeException(cce);
689            } catch (HL7Exception he) {
690                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
691                throw new RuntimeException(he);
692            }
693            return ret;
694        }
695    
696    
697        /**
698         * Returns all repetitions of Pharmacy/Treatment Supplier's Special Administration Instructions (RXG-13).
699         */
700        public CE[] getPharmacyTreatmentSupplierSSpecialAdministrationInstructions() {
701            CE[] ret = null;
702            try {
703                Type[] t = this.getField(13);  
704                ret = new CE[t.length];
705                for (int i = 0; i < ret.length; i++) {
706                    ret[i] = (CE)t[i];
707                }
708            } catch (ClassCastException cce) {
709                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
710                throw new RuntimeException(cce);
711            } catch (HL7Exception he) {
712                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
713                throw new RuntimeException(he);
714            }
715            return ret;
716        }
717    
718    
719        /**
720         * Returns a count of the current number of repetitions of Pharmacy/Treatment Supplier's Special Administration Instructions (RXG-13).
721         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
722         * it will return zero.
723         */
724        public int getPharmacyTreatmentSupplierSSpecialAdministrationInstructionsReps() {
725            CE[] ret = null;
726            try {
727                Type[] t = this.getField(13);
728                return t.length;  
729            } catch (ClassCastException cce) {
730                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
731                throw new RuntimeException(cce);
732            } catch (HL7Exception he) {
733                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
734                throw new RuntimeException(he);
735            }
736        }
737    
738    
739        /**
740         * Returns a specific repetition of
741         * RXG-13: "Pharmacy/Treatment Supplier's Special Administration Instructions" - creates it if necessary
742         *
743         * @param rep The repetition index (0-indexed)
744         */
745        public CE getPharmacyTreatmentSupplierSSpecialAdministrationInstructions(int rep) { 
746            CE ret = null;
747            try {
748                Type t = this.getField(13, rep);
749                ret = (CE)t;
750            } catch (ClassCastException cce) {
751                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
752                throw new RuntimeException(cce);
753            } catch (HL7Exception he) {
754                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
755                throw new RuntimeException(he);
756            }
757            return ret;
758        }
759    
760        /**
761         * Returns a specific repetition of
762         * RXG-13: "Pharmacy/Treatment Supplier's Special Administration Instructions" - creates it if necessary
763         *
764         * @param rep The repetition index (0-indexed)
765         */
766        public CE getRxg13_PharmacyTreatmentSupplierSSpecialAdministrationInstructions(int rep) { 
767            CE ret = null;
768            try {
769                Type t = this.getField(13, rep);
770                ret = (CE)t;
771            } catch (ClassCastException cce) {
772                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
773                throw new RuntimeException(cce);
774            } catch (HL7Exception he) {
775                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
776                throw new RuntimeException(he);
777            }
778            return ret;
779        }
780    
781    
782        /**
783         * Returns a count of the current number of repetitions of Pharmacy/Treatment Supplier's Special Administration Instructions (RXG-13).
784         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
785         * it will return zero.
786         */
787        public int getRxg13_PharmacyTreatmentSupplierSSpecialAdministrationInstructionsReps() {
788            CE[] ret = null;
789            try {
790                Type[] t = this.getField(13);
791                return t.length;  
792            } catch (ClassCastException cce) {
793                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
794                throw new RuntimeException(cce);
795            } catch (HL7Exception he) {
796                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
797                throw new RuntimeException(he);
798            }
799        }
800    
801    
802    
803        /**
804         * Inserts a repetition of
805         * RXG-13: "Pharmacy/Treatment Supplier's Special Administration Instructions" at a specific index
806         *
807         * @param rep The repetition index (0-indexed)
808         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
809         */
810        public CE insertPharmacyTreatmentSupplierSSpecialAdministrationInstructions(int rep) throws HL7Exception { 
811            return (CE) super.insertRepetition(13, rep);
812        }
813    
814    
815    
816        /**
817         * Inserts a repetition of
818         * RXG-13: "Pharmacy/Treatment Supplier's Special Administration Instructions" at a specific index
819         *
820         * @param rep The repetition index (0-indexed)
821         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
822         */
823        public CE insertRxg13_PharmacyTreatmentSupplierSSpecialAdministrationInstructions(int rep) throws HL7Exception { 
824            return (CE) super.insertRepetition(13, rep);
825        }
826    
827    
828        /**
829         * Removes a repetition of
830         * RXG-13: "Pharmacy/Treatment Supplier's Special Administration Instructions" at a specific index
831         *
832         * @param rep The repetition index (0-indexed)
833         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
834         */
835        public CE removePharmacyTreatmentSupplierSSpecialAdministrationInstructions(int rep) throws HL7Exception { 
836            return (CE) super.removeRepetition(13, rep);
837        }
838    
839    
840        /**
841         * Removes a repetition of
842         * RXG-13: "Pharmacy/Treatment Supplier's Special Administration Instructions" at a specific index
843         *
844         * @param rep The repetition index (0-indexed)
845         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
846         */
847        public CE removeRxg13_PharmacyTreatmentSupplierSSpecialAdministrationInstructions(int rep) throws HL7Exception { 
848            return (CE) super.removeRepetition(13, rep);
849        }
850    
851    
852    
853    
854        /**
855         * Returns
856         * RXG-14: "Give Per (Time Unit)" - creates it if necessary
857         */
858        public ST getGivePerTimeUnit() { 
859            ST ret = null;
860            try {
861                Type t = this.getField(14, 0);
862                ret = (ST)t;
863            } catch (ClassCastException cce) {
864                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
865                throw new RuntimeException(cce);
866            } catch (HL7Exception he) {
867                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
868                throw new RuntimeException(he);
869            }
870            return ret;
871        }
872    
873    
874        /**
875         * Returns
876         * RXG-14: "Give Per (Time Unit)" - creates it if necessary
877         */
878        public ST getRxg14_GivePerTimeUnit() { 
879            ST ret = null;
880            try {
881                Type t = this.getField(14, 0);
882                ret = (ST)t;
883            } catch (ClassCastException cce) {
884                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
885                throw new RuntimeException(cce);
886            } catch (HL7Exception he) {
887                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
888                throw new RuntimeException(he);
889            }
890            return ret;
891        }
892    
893    
894    
895        /**
896         * Returns
897         * RXG-15: "Give Rate Amount" - creates it if necessary
898         */
899        public ST getGiveRateAmount() { 
900            ST ret = null;
901            try {
902                Type t = this.getField(15, 0);
903                ret = (ST)t;
904            } catch (ClassCastException cce) {
905                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
906                throw new RuntimeException(cce);
907            } catch (HL7Exception he) {
908                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
909                throw new RuntimeException(he);
910            }
911            return ret;
912        }
913    
914    
915        /**
916         * Returns
917         * RXG-15: "Give Rate Amount" - creates it if necessary
918         */
919        public ST getRxg15_GiveRateAmount() { 
920            ST ret = null;
921            try {
922                Type t = this.getField(15, 0);
923                ret = (ST)t;
924            } catch (ClassCastException cce) {
925                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
926                throw new RuntimeException(cce);
927            } catch (HL7Exception he) {
928                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
929                throw new RuntimeException(he);
930            }
931            return ret;
932        }
933    
934    
935    
936        /**
937         * Returns
938         * RXG-16: "Give Rate Units" - creates it if necessary
939         */
940        public CE getGiveRateUnits() { 
941            CE ret = null;
942            try {
943                Type t = this.getField(16, 0);
944                ret = (CE)t;
945            } catch (ClassCastException cce) {
946                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
947                throw new RuntimeException(cce);
948            } catch (HL7Exception he) {
949                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
950                throw new RuntimeException(he);
951            }
952            return ret;
953        }
954    
955    
956        /**
957         * Returns
958         * RXG-16: "Give Rate Units" - creates it if necessary
959         */
960        public CE getRxg16_GiveRateUnits() { 
961            CE ret = null;
962            try {
963                Type t = this.getField(16, 0);
964                ret = (CE)t;
965            } catch (ClassCastException cce) {
966                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
967                throw new RuntimeException(cce);
968            } catch (HL7Exception he) {
969                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
970                throw new RuntimeException(he);
971            }
972            return ret;
973        }
974    
975    
976    
977        /**
978         * Returns
979         * RXG-17: "Give Strength" - creates it if necessary
980         */
981        public NM getGiveStrength() { 
982            NM ret = null;
983            try {
984                Type t = this.getField(17, 0);
985                ret = (NM)t;
986            } catch (ClassCastException cce) {
987                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
988                throw new RuntimeException(cce);
989            } catch (HL7Exception he) {
990                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
991                throw new RuntimeException(he);
992            }
993            return ret;
994        }
995    
996    
997        /**
998         * Returns
999         * RXG-17: "Give Strength" - creates it if necessary
1000         */
1001        public NM getRxg17_GiveStrength() { 
1002            NM ret = null;
1003            try {
1004                Type t = this.getField(17, 0);
1005                ret = (NM)t;
1006            } catch (ClassCastException cce) {
1007                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1008                throw new RuntimeException(cce);
1009            } catch (HL7Exception he) {
1010                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1011                throw new RuntimeException(he);
1012            }
1013            return ret;
1014        }
1015    
1016    
1017    
1018        /**
1019         * Returns
1020         * RXG-18: "Give Strength Units" - creates it if necessary
1021         */
1022        public CE getGiveStrengthUnits() { 
1023            CE ret = null;
1024            try {
1025                Type t = this.getField(18, 0);
1026                ret = (CE)t;
1027            } catch (ClassCastException cce) {
1028                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1029                throw new RuntimeException(cce);
1030            } catch (HL7Exception he) {
1031                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1032                throw new RuntimeException(he);
1033            }
1034            return ret;
1035        }
1036    
1037    
1038        /**
1039         * Returns
1040         * RXG-18: "Give Strength Units" - creates it if necessary
1041         */
1042        public CE getRxg18_GiveStrengthUnits() { 
1043            CE ret = null;
1044            try {
1045                Type t = this.getField(18, 0);
1046                ret = (CE)t;
1047            } catch (ClassCastException cce) {
1048                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1049                throw new RuntimeException(cce);
1050            } catch (HL7Exception he) {
1051                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1052                throw new RuntimeException(he);
1053            }
1054            return ret;
1055        }
1056    
1057    
1058        /**
1059         * Returns all repetitions of Substance Lot Number (RXG-19).
1060         */
1061        public ST[] getSubstanceLotNumber() {
1062            ST[] ret = null;
1063            try {
1064                Type[] t = this.getField(19);  
1065                ret = new ST[t.length];
1066                for (int i = 0; i < ret.length; i++) {
1067                    ret[i] = (ST)t[i];
1068                }
1069            } catch (ClassCastException cce) {
1070                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1071                throw new RuntimeException(cce);
1072            } catch (HL7Exception he) {
1073                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1074                throw new RuntimeException(he);
1075            }
1076            return ret;
1077        }
1078    
1079    
1080        /**
1081         * Returns a count of the current number of repetitions of Substance Lot Number (RXG-19).
1082         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1083         * it will return zero.
1084         */
1085        public int getSubstanceLotNumberReps() {
1086            ST[] ret = null;
1087            try {
1088                Type[] t = this.getField(19);
1089                return t.length;  
1090            } catch (ClassCastException cce) {
1091                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1092                throw new RuntimeException(cce);
1093            } catch (HL7Exception he) {
1094                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1095                throw new RuntimeException(he);
1096            }
1097        }
1098    
1099    
1100        /**
1101         * Returns a specific repetition of
1102         * RXG-19: "Substance Lot Number" - creates it if necessary
1103         *
1104         * @param rep The repetition index (0-indexed)
1105         */
1106        public ST getSubstanceLotNumber(int rep) { 
1107            ST ret = null;
1108            try {
1109                Type t = this.getField(19, rep);
1110                ret = (ST)t;
1111            } catch (ClassCastException cce) {
1112                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1113                throw new RuntimeException(cce);
1114            } catch (HL7Exception he) {
1115                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1116                throw new RuntimeException(he);
1117            }
1118            return ret;
1119        }
1120    
1121        /**
1122         * Returns a specific repetition of
1123         * RXG-19: "Substance Lot Number" - creates it if necessary
1124         *
1125         * @param rep The repetition index (0-indexed)
1126         */
1127        public ST getRxg19_SubstanceLotNumber(int rep) { 
1128            ST ret = null;
1129            try {
1130                Type t = this.getField(19, rep);
1131                ret = (ST)t;
1132            } catch (ClassCastException cce) {
1133                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1134                throw new RuntimeException(cce);
1135            } catch (HL7Exception he) {
1136                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1137                throw new RuntimeException(he);
1138            }
1139            return ret;
1140        }
1141    
1142    
1143        /**
1144         * Returns a count of the current number of repetitions of Substance Lot Number (RXG-19).
1145         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1146         * it will return zero.
1147         */
1148        public int getRxg19_SubstanceLotNumberReps() {
1149            ST[] ret = null;
1150            try {
1151                Type[] t = this.getField(19);
1152                return t.length;  
1153            } catch (ClassCastException cce) {
1154                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1155                throw new RuntimeException(cce);
1156            } catch (HL7Exception he) {
1157                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1158                throw new RuntimeException(he);
1159            }
1160        }
1161    
1162    
1163    
1164        /**
1165         * Inserts a repetition of
1166         * RXG-19: "Substance Lot Number" at a specific index
1167         *
1168         * @param rep The repetition index (0-indexed)
1169         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1170         */
1171        public ST insertSubstanceLotNumber(int rep) throws HL7Exception { 
1172            return (ST) super.insertRepetition(19, rep);
1173        }
1174    
1175    
1176    
1177        /**
1178         * Inserts a repetition of
1179         * RXG-19: "Substance Lot Number" at a specific index
1180         *
1181         * @param rep The repetition index (0-indexed)
1182         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1183         */
1184        public ST insertRxg19_SubstanceLotNumber(int rep) throws HL7Exception { 
1185            return (ST) super.insertRepetition(19, rep);
1186        }
1187    
1188    
1189        /**
1190         * Removes a repetition of
1191         * RXG-19: "Substance Lot Number" at a specific index
1192         *
1193         * @param rep The repetition index (0-indexed)
1194         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1195         */
1196        public ST removeSubstanceLotNumber(int rep) throws HL7Exception { 
1197            return (ST) super.removeRepetition(19, rep);
1198        }
1199    
1200    
1201        /**
1202         * Removes a repetition of
1203         * RXG-19: "Substance Lot Number" at a specific index
1204         *
1205         * @param rep The repetition index (0-indexed)
1206         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1207         */
1208        public ST removeRxg19_SubstanceLotNumber(int rep) throws HL7Exception { 
1209            return (ST) super.removeRepetition(19, rep);
1210        }
1211    
1212    
1213    
1214        /**
1215         * Returns all repetitions of Substance Expiration Date (RXG-20).
1216         */
1217        public TS[] getSubstanceExpirationDate() {
1218            TS[] ret = null;
1219            try {
1220                Type[] t = this.getField(20);  
1221                ret = new TS[t.length];
1222                for (int i = 0; i < ret.length; i++) {
1223                    ret[i] = (TS)t[i];
1224                }
1225            } catch (ClassCastException cce) {
1226                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1227                throw new RuntimeException(cce);
1228            } catch (HL7Exception he) {
1229                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1230                throw new RuntimeException(he);
1231            }
1232            return ret;
1233        }
1234    
1235    
1236        /**
1237         * Returns a count of the current number of repetitions of Substance Expiration Date (RXG-20).
1238         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1239         * it will return zero.
1240         */
1241        public int getSubstanceExpirationDateReps() {
1242            TS[] ret = null;
1243            try {
1244                Type[] t = this.getField(20);
1245                return t.length;  
1246            } catch (ClassCastException cce) {
1247                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1248                throw new RuntimeException(cce);
1249            } catch (HL7Exception he) {
1250                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1251                throw new RuntimeException(he);
1252            }
1253        }
1254    
1255    
1256        /**
1257         * Returns a specific repetition of
1258         * RXG-20: "Substance Expiration Date" - creates it if necessary
1259         *
1260         * @param rep The repetition index (0-indexed)
1261         */
1262        public TS getSubstanceExpirationDate(int rep) { 
1263            TS ret = null;
1264            try {
1265                Type t = this.getField(20, rep);
1266                ret = (TS)t;
1267            } catch (ClassCastException cce) {
1268                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1269                throw new RuntimeException(cce);
1270            } catch (HL7Exception he) {
1271                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1272                throw new RuntimeException(he);
1273            }
1274            return ret;
1275        }
1276    
1277        /**
1278         * Returns a specific repetition of
1279         * RXG-20: "Substance Expiration Date" - creates it if necessary
1280         *
1281         * @param rep The repetition index (0-indexed)
1282         */
1283        public TS getRxg20_SubstanceExpirationDate(int rep) { 
1284            TS ret = null;
1285            try {
1286                Type t = this.getField(20, rep);
1287                ret = (TS)t;
1288            } catch (ClassCastException cce) {
1289                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1290                throw new RuntimeException(cce);
1291            } catch (HL7Exception he) {
1292                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1293                throw new RuntimeException(he);
1294            }
1295            return ret;
1296        }
1297    
1298    
1299        /**
1300         * Returns a count of the current number of repetitions of Substance Expiration Date (RXG-20).
1301         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1302         * it will return zero.
1303         */
1304        public int getRxg20_SubstanceExpirationDateReps() {
1305            TS[] ret = null;
1306            try {
1307                Type[] t = this.getField(20);
1308                return t.length;  
1309            } catch (ClassCastException cce) {
1310                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1311                throw new RuntimeException(cce);
1312            } catch (HL7Exception he) {
1313                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1314                throw new RuntimeException(he);
1315            }
1316        }
1317    
1318    
1319    
1320        /**
1321         * Inserts a repetition of
1322         * RXG-20: "Substance Expiration Date" at a specific index
1323         *
1324         * @param rep The repetition index (0-indexed)
1325         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1326         */
1327        public TS insertSubstanceExpirationDate(int rep) throws HL7Exception { 
1328            return (TS) super.insertRepetition(20, rep);
1329        }
1330    
1331    
1332    
1333        /**
1334         * Inserts a repetition of
1335         * RXG-20: "Substance Expiration Date" at a specific index
1336         *
1337         * @param rep The repetition index (0-indexed)
1338         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1339         */
1340        public TS insertRxg20_SubstanceExpirationDate(int rep) throws HL7Exception { 
1341            return (TS) super.insertRepetition(20, rep);
1342        }
1343    
1344    
1345        /**
1346         * Removes a repetition of
1347         * RXG-20: "Substance Expiration Date" at a specific index
1348         *
1349         * @param rep The repetition index (0-indexed)
1350         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1351         */
1352        public TS removeSubstanceExpirationDate(int rep) throws HL7Exception { 
1353            return (TS) super.removeRepetition(20, rep);
1354        }
1355    
1356    
1357        /**
1358         * Removes a repetition of
1359         * RXG-20: "Substance Expiration Date" at a specific index
1360         *
1361         * @param rep The repetition index (0-indexed)
1362         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1363         */
1364        public TS removeRxg20_SubstanceExpirationDate(int rep) throws HL7Exception { 
1365            return (TS) super.removeRepetition(20, rep);
1366        }
1367    
1368    
1369    
1370        /**
1371         * Returns all repetitions of Substance Manufacturer Name (RXG-21).
1372         */
1373        public CE[] getSubstanceManufacturerName() {
1374            CE[] ret = null;
1375            try {
1376                Type[] t = this.getField(21);  
1377                ret = new CE[t.length];
1378                for (int i = 0; i < ret.length; i++) {
1379                    ret[i] = (CE)t[i];
1380                }
1381            } catch (ClassCastException cce) {
1382                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1383                throw new RuntimeException(cce);
1384            } catch (HL7Exception he) {
1385                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1386                throw new RuntimeException(he);
1387            }
1388            return ret;
1389        }
1390    
1391    
1392        /**
1393         * Returns a count of the current number of repetitions of Substance Manufacturer Name (RXG-21).
1394         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1395         * it will return zero.
1396         */
1397        public int getSubstanceManufacturerNameReps() {
1398            CE[] ret = null;
1399            try {
1400                Type[] t = this.getField(21);
1401                return t.length;  
1402            } catch (ClassCastException cce) {
1403                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1404                throw new RuntimeException(cce);
1405            } catch (HL7Exception he) {
1406                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1407                throw new RuntimeException(he);
1408            }
1409        }
1410    
1411    
1412        /**
1413         * Returns a specific repetition of
1414         * RXG-21: "Substance Manufacturer Name" - creates it if necessary
1415         *
1416         * @param rep The repetition index (0-indexed)
1417         */
1418        public CE getSubstanceManufacturerName(int rep) { 
1419            CE ret = null;
1420            try {
1421                Type t = this.getField(21, rep);
1422                ret = (CE)t;
1423            } catch (ClassCastException cce) {
1424                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1425                throw new RuntimeException(cce);
1426            } catch (HL7Exception he) {
1427                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1428                throw new RuntimeException(he);
1429            }
1430            return ret;
1431        }
1432    
1433        /**
1434         * Returns a specific repetition of
1435         * RXG-21: "Substance Manufacturer Name" - creates it if necessary
1436         *
1437         * @param rep The repetition index (0-indexed)
1438         */
1439        public CE getRxg21_SubstanceManufacturerName(int rep) { 
1440            CE ret = null;
1441            try {
1442                Type t = this.getField(21, rep);
1443                ret = (CE)t;
1444            } catch (ClassCastException cce) {
1445                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1446                throw new RuntimeException(cce);
1447            } catch (HL7Exception he) {
1448                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1449                throw new RuntimeException(he);
1450            }
1451            return ret;
1452        }
1453    
1454    
1455        /**
1456         * Returns a count of the current number of repetitions of Substance Manufacturer Name (RXG-21).
1457         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1458         * it will return zero.
1459         */
1460        public int getRxg21_SubstanceManufacturerNameReps() {
1461            CE[] ret = null;
1462            try {
1463                Type[] t = this.getField(21);
1464                return t.length;  
1465            } catch (ClassCastException cce) {
1466                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1467                throw new RuntimeException(cce);
1468            } catch (HL7Exception he) {
1469                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1470                throw new RuntimeException(he);
1471            }
1472        }
1473    
1474    
1475    
1476        /**
1477         * Inserts a repetition of
1478         * RXG-21: "Substance Manufacturer Name" at a specific index
1479         *
1480         * @param rep The repetition index (0-indexed)
1481         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1482         */
1483        public CE insertSubstanceManufacturerName(int rep) throws HL7Exception { 
1484            return (CE) super.insertRepetition(21, rep);
1485        }
1486    
1487    
1488    
1489        /**
1490         * Inserts a repetition of
1491         * RXG-21: "Substance Manufacturer Name" at a specific index
1492         *
1493         * @param rep The repetition index (0-indexed)
1494         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1495         */
1496        public CE insertRxg21_SubstanceManufacturerName(int rep) throws HL7Exception { 
1497            return (CE) super.insertRepetition(21, rep);
1498        }
1499    
1500    
1501        /**
1502         * Removes a repetition of
1503         * RXG-21: "Substance Manufacturer Name" at a specific index
1504         *
1505         * @param rep The repetition index (0-indexed)
1506         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1507         */
1508        public CE removeSubstanceManufacturerName(int rep) throws HL7Exception { 
1509            return (CE) super.removeRepetition(21, rep);
1510        }
1511    
1512    
1513        /**
1514         * Removes a repetition of
1515         * RXG-21: "Substance Manufacturer Name" at a specific index
1516         *
1517         * @param rep The repetition index (0-indexed)
1518         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1519         */
1520        public CE removeRxg21_SubstanceManufacturerName(int rep) throws HL7Exception { 
1521            return (CE) super.removeRepetition(21, rep);
1522        }
1523    
1524    
1525    
1526        /**
1527         * Returns all repetitions of Indication (RXG-22).
1528         */
1529        public CE[] getIndication() {
1530            CE[] ret = null;
1531            try {
1532                Type[] t = this.getField(22);  
1533                ret = new CE[t.length];
1534                for (int i = 0; i < ret.length; i++) {
1535                    ret[i] = (CE)t[i];
1536                }
1537            } catch (ClassCastException cce) {
1538                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1539                throw new RuntimeException(cce);
1540            } catch (HL7Exception he) {
1541                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1542                throw new RuntimeException(he);
1543            }
1544            return ret;
1545        }
1546    
1547    
1548        /**
1549         * Returns a count of the current number of repetitions of Indication (RXG-22).
1550         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1551         * it will return zero.
1552         */
1553        public int getIndicationReps() {
1554            CE[] ret = null;
1555            try {
1556                Type[] t = this.getField(22);
1557                return t.length;  
1558            } catch (ClassCastException cce) {
1559                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1560                throw new RuntimeException(cce);
1561            } catch (HL7Exception he) {
1562                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1563                throw new RuntimeException(he);
1564            }
1565        }
1566    
1567    
1568        /**
1569         * Returns a specific repetition of
1570         * RXG-22: "Indication" - creates it if necessary
1571         *
1572         * @param rep The repetition index (0-indexed)
1573         */
1574        public CE getIndication(int rep) { 
1575            CE ret = null;
1576            try {
1577                Type t = this.getField(22, rep);
1578                ret = (CE)t;
1579            } catch (ClassCastException cce) {
1580                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1581                throw new RuntimeException(cce);
1582            } catch (HL7Exception he) {
1583                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1584                throw new RuntimeException(he);
1585            }
1586            return ret;
1587        }
1588    
1589        /**
1590         * Returns a specific repetition of
1591         * RXG-22: "Indication" - creates it if necessary
1592         *
1593         * @param rep The repetition index (0-indexed)
1594         */
1595        public CE getRxg22_Indication(int rep) { 
1596            CE ret = null;
1597            try {
1598                Type t = this.getField(22, rep);
1599                ret = (CE)t;
1600            } catch (ClassCastException cce) {
1601                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1602                throw new RuntimeException(cce);
1603            } catch (HL7Exception he) {
1604                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1605                throw new RuntimeException(he);
1606            }
1607            return ret;
1608        }
1609    
1610    
1611        /**
1612         * Returns a count of the current number of repetitions of Indication (RXG-22).
1613         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1614         * it will return zero.
1615         */
1616        public int getRxg22_IndicationReps() {
1617            CE[] ret = null;
1618            try {
1619                Type[] t = this.getField(22);
1620                return t.length;  
1621            } catch (ClassCastException cce) {
1622                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1623                throw new RuntimeException(cce);
1624            } catch (HL7Exception he) {
1625                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1626                throw new RuntimeException(he);
1627            }
1628        }
1629    
1630    
1631    
1632        /**
1633         * Inserts a repetition of
1634         * RXG-22: "Indication" at a specific index
1635         *
1636         * @param rep The repetition index (0-indexed)
1637         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1638         */
1639        public CE insertIndication(int rep) throws HL7Exception { 
1640            return (CE) super.insertRepetition(22, rep);
1641        }
1642    
1643    
1644    
1645        /**
1646         * Inserts a repetition of
1647         * RXG-22: "Indication" at a specific index
1648         *
1649         * @param rep The repetition index (0-indexed)
1650         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1651         */
1652        public CE insertRxg22_Indication(int rep) throws HL7Exception { 
1653            return (CE) super.insertRepetition(22, rep);
1654        }
1655    
1656    
1657        /**
1658         * Removes a repetition of
1659         * RXG-22: "Indication" at a specific index
1660         *
1661         * @param rep The repetition index (0-indexed)
1662         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1663         */
1664        public CE removeIndication(int rep) throws HL7Exception { 
1665            return (CE) super.removeRepetition(22, rep);
1666        }
1667    
1668    
1669        /**
1670         * Removes a repetition of
1671         * RXG-22: "Indication" at a specific index
1672         *
1673         * @param rep The repetition index (0-indexed)
1674         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1675         */
1676        public CE removeRxg22_Indication(int rep) throws HL7Exception { 
1677            return (CE) super.removeRepetition(22, rep);
1678        }
1679    
1680    
1681    
1682    
1683    
1684    
1685        /** {@inheritDoc} */   
1686        protected Type createNewTypeWithoutReflection(int field) {
1687           switch (field) {
1688              case 0: return new NM(getMessage());
1689              case 1: return new NM(getMessage());
1690              case 2: return new TQ(getMessage());
1691              case 3: return new CE(getMessage());
1692              case 4: return new NM(getMessage());
1693              case 5: return new NM(getMessage());
1694              case 6: return new CE(getMessage());
1695              case 7: return new CE(getMessage());
1696              case 8: return new CE(getMessage());
1697              case 9: return new ID(getMessage(), new Integer( 167 ));
1698              case 10: return new LA2(getMessage());
1699              case 11: return new ID(getMessage(), new Integer( 136 ));
1700              case 12: return new CE(getMessage());
1701              case 13: return new ST(getMessage());
1702              case 14: return new ST(getMessage());
1703              case 15: return new CE(getMessage());
1704              case 16: return new NM(getMessage());
1705              case 17: return new CE(getMessage());
1706              case 18: return new ST(getMessage());
1707              case 19: return new TS(getMessage());
1708              case 20: return new CE(getMessage());
1709              case 21: return new CE(getMessage());
1710              default: return null;
1711           }
1712       }
1713    
1714    
1715    }
1716