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 PR1 message segment (Procedures). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>PR1-1: Set ID - PR1 (SI) <b> </b>
027         * <li>PR1-2: Procedure Coding Method (IS) <b>optional </b>
028         * <li>PR1-3: Procedure Code (CE) <b> </b>
029         * <li>PR1-4: Procedure Description (ST) <b>optional </b>
030         * <li>PR1-5: Procedure Date/Time (TS) <b> </b>
031         * <li>PR1-6: Procedure Functional Type (IS) <b>optional </b>
032         * <li>PR1-7: Procedure Minutes (NM) <b>optional </b>
033         * <li>PR1-8: Anesthesiologist (XCN) <b>optional repeating</b>
034         * <li>PR1-9: Anesthesia Code (IS) <b>optional </b>
035         * <li>PR1-10: Anesthesia Minutes (NM) <b>optional </b>
036         * <li>PR1-11: Surgeon (XCN) <b>optional repeating</b>
037         * <li>PR1-12: Procedure Practitioner (XCN) <b>optional repeating</b>
038         * <li>PR1-13: Consent Code (CE) <b>optional </b>
039         * <li>PR1-14: Procedure Priority (ID) <b>optional </b>
040         * <li>PR1-15: Associated Diagnosis Code (CE) <b>optional </b>
041         * <li>PR1-16: Procedure Code Modifier (CE) <b>optional repeating</b>
042         * <li>PR1-17: Procedure DRG Type (IS) <b>optional </b>
043         * <li>PR1-18: Tissue Type Code (CE) <b>optional repeating</b>
044     * </ul>
045     */
046    public class PR1 extends AbstractSegment {
047    
048        /** 
049         * Creates a new PR1 segment
050         */
051        public PR1(Group parent, ModelClassFactory factory) {
052           super(parent, factory);
053           init(factory);
054        }
055    
056        private void init(ModelClassFactory factory) {
057           try {
058                                      this.add(SI.class, true, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Set ID - PR1");
059                                      this.add(IS.class, false, 1, 3, new Object[]{ getMessage() }, "Procedure Coding Method");
060                                      this.add(CE.class, true, 1, 250, new Object[]{ getMessage(), new Integer(88) }, "Procedure Code");
061                                      this.add(ST.class, false, 1, 40, new Object[]{ getMessage(), new Integer(0) }, "Procedure Description");
062                                      this.add(TS.class, true, 1, 26, new Object[]{ getMessage(), new Integer(0) }, "Procedure Date/Time");
063                                      this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Procedure Functional Type");
064                                      this.add(NM.class, false, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Procedure Minutes");
065                                      this.add(XCN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(10) }, "Anesthesiologist");
066                                      this.add(IS.class, false, 1, 2, new Object[]{ getMessage() }, "Anesthesia Code");
067                                      this.add(NM.class, false, 1, 4, new Object[]{ getMessage(), new Integer(0) }, "Anesthesia Minutes");
068                                      this.add(XCN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(10) }, "Surgeon");
069                                      this.add(XCN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(10) }, "Procedure Practitioner");
070                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(59) }, "Consent Code");
071                                      this.add(ID.class, false, 1, 2, new Object[]{ getMessage() }, "Procedure Priority");
072                                      this.add(CE.class, false, 1, 250, new Object[]{ getMessage(), new Integer(51) }, "Associated Diagnosis Code");
073                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(340) }, "Procedure Code Modifier");
074                                      this.add(IS.class, false, 1, 20, new Object[]{ getMessage() }, "Procedure DRG Type");
075                                      this.add(CE.class, false, 0, 250, new Object[]{ getMessage(), new Integer(417) }, "Tissue Type Code");
076           } catch(HL7Exception e) {
077              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating PR1 - this is probably a bug in the source code generator.", e);
078           }
079        }
080    
081    
082    
083        /**
084         * Returns
085         * PR1-1: "Set ID - PR1" - creates it if necessary
086         */
087        public SI getSetIDPR1() { 
088            SI ret = null;
089            try {
090                Type t = this.getField(1, 0);
091                ret = (SI)t;
092            } catch (ClassCastException cce) {
093                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
094                throw new RuntimeException(cce);
095            } catch (HL7Exception he) {
096                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
097                throw new RuntimeException(he);
098            }
099            return ret;
100        }
101    
102    
103        /**
104         * Returns
105         * PR1-1: "Set ID - PR1" - creates it if necessary
106         */
107        public SI getPr11_SetIDPR1() { 
108            SI ret = null;
109            try {
110                Type t = this.getField(1, 0);
111                ret = (SI)t;
112            } catch (ClassCastException cce) {
113                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
114                throw new RuntimeException(cce);
115            } catch (HL7Exception he) {
116                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
117                throw new RuntimeException(he);
118            }
119            return ret;
120        }
121    
122    
123    
124        /**
125         * Returns
126         * PR1-2: "Procedure Coding Method" - creates it if necessary
127         */
128        public IS getProcedureCodingMethod() { 
129            IS ret = null;
130            try {
131                Type t = this.getField(2, 0);
132                ret = (IS)t;
133            } catch (ClassCastException cce) {
134                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
135                throw new RuntimeException(cce);
136            } catch (HL7Exception he) {
137                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
138                throw new RuntimeException(he);
139            }
140            return ret;
141        }
142    
143    
144        /**
145         * Returns
146         * PR1-2: "Procedure Coding Method" - creates it if necessary
147         */
148        public IS getPr12_ProcedureCodingMethod() { 
149            IS ret = null;
150            try {
151                Type t = this.getField(2, 0);
152                ret = (IS)t;
153            } catch (ClassCastException cce) {
154                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
155                throw new RuntimeException(cce);
156            } catch (HL7Exception he) {
157                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
158                throw new RuntimeException(he);
159            }
160            return ret;
161        }
162    
163    
164    
165        /**
166         * Returns
167         * PR1-3: "Procedure Code" - creates it if necessary
168         */
169        public CE getProcedureCode() { 
170            CE ret = null;
171            try {
172                Type t = this.getField(3, 0);
173                ret = (CE)t;
174            } catch (ClassCastException cce) {
175                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
176                throw new RuntimeException(cce);
177            } catch (HL7Exception he) {
178                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
179                throw new RuntimeException(he);
180            }
181            return ret;
182        }
183    
184    
185        /**
186         * Returns
187         * PR1-3: "Procedure Code" - creates it if necessary
188         */
189        public CE getPr13_ProcedureCode() { 
190            CE ret = null;
191            try {
192                Type t = this.getField(3, 0);
193                ret = (CE)t;
194            } catch (ClassCastException cce) {
195                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
196                throw new RuntimeException(cce);
197            } catch (HL7Exception he) {
198                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
199                throw new RuntimeException(he);
200            }
201            return ret;
202        }
203    
204    
205    
206        /**
207         * Returns
208         * PR1-4: "Procedure Description" - creates it if necessary
209         */
210        public ST getProcedureDescription() { 
211            ST ret = null;
212            try {
213                Type t = this.getField(4, 0);
214                ret = (ST)t;
215            } catch (ClassCastException cce) {
216                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
217                throw new RuntimeException(cce);
218            } catch (HL7Exception he) {
219                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
220                throw new RuntimeException(he);
221            }
222            return ret;
223        }
224    
225    
226        /**
227         * Returns
228         * PR1-4: "Procedure Description" - creates it if necessary
229         */
230        public ST getPr14_ProcedureDescription() { 
231            ST ret = null;
232            try {
233                Type t = this.getField(4, 0);
234                ret = (ST)t;
235            } catch (ClassCastException cce) {
236                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
237                throw new RuntimeException(cce);
238            } catch (HL7Exception he) {
239                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
240                throw new RuntimeException(he);
241            }
242            return ret;
243        }
244    
245    
246    
247        /**
248         * Returns
249         * PR1-5: "Procedure Date/Time" - creates it if necessary
250         */
251        public TS getProcedureDateTime() { 
252            TS ret = null;
253            try {
254                Type t = this.getField(5, 0);
255                ret = (TS)t;
256            } catch (ClassCastException cce) {
257                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
258                throw new RuntimeException(cce);
259            } catch (HL7Exception he) {
260                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
261                throw new RuntimeException(he);
262            }
263            return ret;
264        }
265    
266    
267        /**
268         * Returns
269         * PR1-5: "Procedure Date/Time" - creates it if necessary
270         */
271        public TS getPr15_ProcedureDateTime() { 
272            TS ret = null;
273            try {
274                Type t = this.getField(5, 0);
275                ret = (TS)t;
276            } catch (ClassCastException cce) {
277                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
278                throw new RuntimeException(cce);
279            } catch (HL7Exception he) {
280                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
281                throw new RuntimeException(he);
282            }
283            return ret;
284        }
285    
286    
287    
288        /**
289         * Returns
290         * PR1-6: "Procedure Functional Type" - creates it if necessary
291         */
292        public IS getProcedureFunctionalType() { 
293            IS ret = null;
294            try {
295                Type t = this.getField(6, 0);
296                ret = (IS)t;
297            } catch (ClassCastException cce) {
298                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
299                throw new RuntimeException(cce);
300            } catch (HL7Exception he) {
301                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
302                throw new RuntimeException(he);
303            }
304            return ret;
305        }
306    
307    
308        /**
309         * Returns
310         * PR1-6: "Procedure Functional Type" - creates it if necessary
311         */
312        public IS getPr16_ProcedureFunctionalType() { 
313            IS ret = null;
314            try {
315                Type t = this.getField(6, 0);
316                ret = (IS)t;
317            } catch (ClassCastException cce) {
318                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
319                throw new RuntimeException(cce);
320            } catch (HL7Exception he) {
321                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
322                throw new RuntimeException(he);
323            }
324            return ret;
325        }
326    
327    
328    
329        /**
330         * Returns
331         * PR1-7: "Procedure Minutes" - creates it if necessary
332         */
333        public NM getProcedureMinutes() { 
334            NM ret = null;
335            try {
336                Type t = this.getField(7, 0);
337                ret = (NM)t;
338            } catch (ClassCastException cce) {
339                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
340                throw new RuntimeException(cce);
341            } catch (HL7Exception he) {
342                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
343                throw new RuntimeException(he);
344            }
345            return ret;
346        }
347    
348    
349        /**
350         * Returns
351         * PR1-7: "Procedure Minutes" - creates it if necessary
352         */
353        public NM getPr17_ProcedureMinutes() { 
354            NM ret = null;
355            try {
356                Type t = this.getField(7, 0);
357                ret = (NM)t;
358            } catch (ClassCastException cce) {
359                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
360                throw new RuntimeException(cce);
361            } catch (HL7Exception he) {
362                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
363                throw new RuntimeException(he);
364            }
365            return ret;
366        }
367    
368    
369        /**
370         * Returns all repetitions of Anesthesiologist (PR1-8).
371         */
372        public XCN[] getAnesthesiologist() {
373            XCN[] ret = null;
374            try {
375                Type[] t = this.getField(8);  
376                ret = new XCN[t.length];
377                for (int i = 0; i < ret.length; i++) {
378                    ret[i] = (XCN)t[i];
379                }
380            } catch (ClassCastException cce) {
381                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
382                throw new RuntimeException(cce);
383            } catch (HL7Exception he) {
384                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
385                throw new RuntimeException(he);
386            }
387            return ret;
388        }
389    
390    
391        /**
392         * Returns a count of the current number of repetitions of Anesthesiologist (PR1-8).
393         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
394         * it will return zero.
395         */
396        public int getAnesthesiologistReps() {
397            XCN[] ret = null;
398            try {
399                Type[] t = this.getField(8);
400                return t.length;  
401            } catch (ClassCastException cce) {
402                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
403                throw new RuntimeException(cce);
404            } catch (HL7Exception he) {
405                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
406                throw new RuntimeException(he);
407            }
408        }
409    
410    
411        /**
412         * Returns a specific repetition of
413         * PR1-8: "Anesthesiologist" - creates it if necessary
414         *
415         * @param rep The repetition index (0-indexed)
416         */
417        public XCN getAnesthesiologist(int rep) { 
418            XCN ret = null;
419            try {
420                Type t = this.getField(8, rep);
421                ret = (XCN)t;
422            } catch (ClassCastException cce) {
423                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
424                throw new RuntimeException(cce);
425            } catch (HL7Exception he) {
426                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
427                throw new RuntimeException(he);
428            }
429            return ret;
430        }
431    
432        /**
433         * Returns a specific repetition of
434         * PR1-8: "Anesthesiologist" - creates it if necessary
435         *
436         * @param rep The repetition index (0-indexed)
437         */
438        public XCN getPr18_Anesthesiologist(int rep) { 
439            XCN ret = null;
440            try {
441                Type t = this.getField(8, rep);
442                ret = (XCN)t;
443            } catch (ClassCastException cce) {
444                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
445                throw new RuntimeException(cce);
446            } catch (HL7Exception he) {
447                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
448                throw new RuntimeException(he);
449            }
450            return ret;
451        }
452    
453    
454        /**
455         * Returns a count of the current number of repetitions of Anesthesiologist (PR1-8).
456         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
457         * it will return zero.
458         */
459        public int getPr18_AnesthesiologistReps() {
460            XCN[] ret = null;
461            try {
462                Type[] t = this.getField(8);
463                return t.length;  
464            } catch (ClassCastException cce) {
465                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
466                throw new RuntimeException(cce);
467            } catch (HL7Exception he) {
468                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
469                throw new RuntimeException(he);
470            }
471        }
472    
473    
474    
475        /**
476         * Inserts a repetition of
477         * PR1-8: "Anesthesiologist" at a specific index
478         *
479         * @param rep The repetition index (0-indexed)
480         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
481         */
482        public XCN insertAnesthesiologist(int rep) throws HL7Exception { 
483            return (XCN) super.insertRepetition(8, rep);
484        }
485    
486    
487    
488        /**
489         * Inserts a repetition of
490         * PR1-8: "Anesthesiologist" at a specific index
491         *
492         * @param rep The repetition index (0-indexed)
493         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
494         */
495        public XCN insertPr18_Anesthesiologist(int rep) throws HL7Exception { 
496            return (XCN) super.insertRepetition(8, rep);
497        }
498    
499    
500        /**
501         * Removes a repetition of
502         * PR1-8: "Anesthesiologist" at a specific index
503         *
504         * @param rep The repetition index (0-indexed)
505         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
506         */
507        public XCN removeAnesthesiologist(int rep) throws HL7Exception { 
508            return (XCN) super.removeRepetition(8, rep);
509        }
510    
511    
512        /**
513         * Removes a repetition of
514         * PR1-8: "Anesthesiologist" at a specific index
515         *
516         * @param rep The repetition index (0-indexed)
517         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
518         */
519        public XCN removePr18_Anesthesiologist(int rep) throws HL7Exception { 
520            return (XCN) super.removeRepetition(8, rep);
521        }
522    
523    
524    
525    
526        /**
527         * Returns
528         * PR1-9: "Anesthesia Code" - creates it if necessary
529         */
530        public IS getAnesthesiaCode() { 
531            IS ret = null;
532            try {
533                Type t = this.getField(9, 0);
534                ret = (IS)t;
535            } catch (ClassCastException cce) {
536                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
537                throw new RuntimeException(cce);
538            } catch (HL7Exception he) {
539                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
540                throw new RuntimeException(he);
541            }
542            return ret;
543        }
544    
545    
546        /**
547         * Returns
548         * PR1-9: "Anesthesia Code" - creates it if necessary
549         */
550        public IS getPr19_AnesthesiaCode() { 
551            IS ret = null;
552            try {
553                Type t = this.getField(9, 0);
554                ret = (IS)t;
555            } catch (ClassCastException cce) {
556                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
557                throw new RuntimeException(cce);
558            } catch (HL7Exception he) {
559                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
560                throw new RuntimeException(he);
561            }
562            return ret;
563        }
564    
565    
566    
567        /**
568         * Returns
569         * PR1-10: "Anesthesia Minutes" - creates it if necessary
570         */
571        public NM getAnesthesiaMinutes() { 
572            NM ret = null;
573            try {
574                Type t = this.getField(10, 0);
575                ret = (NM)t;
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
589         * PR1-10: "Anesthesia Minutes" - creates it if necessary
590         */
591        public NM getPr110_AnesthesiaMinutes() { 
592            NM ret = null;
593            try {
594                Type t = this.getField(10, 0);
595                ret = (NM)t;
596            } catch (ClassCastException cce) {
597                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
598                throw new RuntimeException(cce);
599            } catch (HL7Exception he) {
600                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
601                throw new RuntimeException(he);
602            }
603            return ret;
604        }
605    
606    
607        /**
608         * Returns all repetitions of Surgeon (PR1-11).
609         */
610        public XCN[] getSurgeon() {
611            XCN[] ret = null;
612            try {
613                Type[] t = this.getField(11);  
614                ret = new XCN[t.length];
615                for (int i = 0; i < ret.length; i++) {
616                    ret[i] = (XCN)t[i];
617                }
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        /**
630         * Returns a count of the current number of repetitions of Surgeon (PR1-11).
631         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
632         * it will return zero.
633         */
634        public int getSurgeonReps() {
635            XCN[] ret = null;
636            try {
637                Type[] t = this.getField(11);
638                return t.length;  
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        }
647    
648    
649        /**
650         * Returns a specific repetition of
651         * PR1-11: "Surgeon" - creates it if necessary
652         *
653         * @param rep The repetition index (0-indexed)
654         */
655        public XCN getSurgeon(int rep) { 
656            XCN ret = null;
657            try {
658                Type t = this.getField(11, rep);
659                ret = (XCN)t;
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            return ret;
668        }
669    
670        /**
671         * Returns a specific repetition of
672         * PR1-11: "Surgeon" - creates it if necessary
673         *
674         * @param rep The repetition index (0-indexed)
675         */
676        public XCN getPr111_Surgeon(int rep) { 
677            XCN ret = null;
678            try {
679                Type t = this.getField(11, rep);
680                ret = (XCN)t;
681            } catch (ClassCastException cce) {
682                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
683                throw new RuntimeException(cce);
684            } catch (HL7Exception he) {
685                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
686                throw new RuntimeException(he);
687            }
688            return ret;
689        }
690    
691    
692        /**
693         * Returns a count of the current number of repetitions of Surgeon (PR1-11).
694         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
695         * it will return zero.
696         */
697        public int getPr111_SurgeonReps() {
698            XCN[] ret = null;
699            try {
700                Type[] t = this.getField(11);
701                return t.length;  
702            } catch (ClassCastException cce) {
703                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
704                throw new RuntimeException(cce);
705            } catch (HL7Exception he) {
706                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
707                throw new RuntimeException(he);
708            }
709        }
710    
711    
712    
713        /**
714         * Inserts a repetition of
715         * PR1-11: "Surgeon" at a specific index
716         *
717         * @param rep The repetition index (0-indexed)
718         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
719         */
720        public XCN insertSurgeon(int rep) throws HL7Exception { 
721            return (XCN) super.insertRepetition(11, rep);
722        }
723    
724    
725    
726        /**
727         * Inserts a repetition of
728         * PR1-11: "Surgeon" at a specific index
729         *
730         * @param rep The repetition index (0-indexed)
731         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
732         */
733        public XCN insertPr111_Surgeon(int rep) throws HL7Exception { 
734            return (XCN) super.insertRepetition(11, rep);
735        }
736    
737    
738        /**
739         * Removes a repetition of
740         * PR1-11: "Surgeon" at a specific index
741         *
742         * @param rep The repetition index (0-indexed)
743         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
744         */
745        public XCN removeSurgeon(int rep) throws HL7Exception { 
746            return (XCN) super.removeRepetition(11, rep);
747        }
748    
749    
750        /**
751         * Removes a repetition of
752         * PR1-11: "Surgeon" at a specific index
753         *
754         * @param rep The repetition index (0-indexed)
755         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
756         */
757        public XCN removePr111_Surgeon(int rep) throws HL7Exception { 
758            return (XCN) super.removeRepetition(11, rep);
759        }
760    
761    
762    
763        /**
764         * Returns all repetitions of Procedure Practitioner (PR1-12).
765         */
766        public XCN[] getProcedurePractitioner() {
767            XCN[] ret = null;
768            try {
769                Type[] t = this.getField(12);  
770                ret = new XCN[t.length];
771                for (int i = 0; i < ret.length; i++) {
772                    ret[i] = (XCN)t[i];
773                }
774            } catch (ClassCastException cce) {
775                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
776                throw new RuntimeException(cce);
777            } catch (HL7Exception he) {
778                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
779                throw new RuntimeException(he);
780            }
781            return ret;
782        }
783    
784    
785        /**
786         * Returns a count of the current number of repetitions of Procedure Practitioner (PR1-12).
787         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
788         * it will return zero.
789         */
790        public int getProcedurePractitionerReps() {
791            XCN[] ret = null;
792            try {
793                Type[] t = this.getField(12);
794                return t.length;  
795            } catch (ClassCastException cce) {
796                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
797                throw new RuntimeException(cce);
798            } catch (HL7Exception he) {
799                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
800                throw new RuntimeException(he);
801            }
802        }
803    
804    
805        /**
806         * Returns a specific repetition of
807         * PR1-12: "Procedure Practitioner" - creates it if necessary
808         *
809         * @param rep The repetition index (0-indexed)
810         */
811        public XCN getProcedurePractitioner(int rep) { 
812            XCN ret = null;
813            try {
814                Type t = this.getField(12, rep);
815                ret = (XCN)t;
816            } catch (ClassCastException cce) {
817                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
818                throw new RuntimeException(cce);
819            } catch (HL7Exception he) {
820                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
821                throw new RuntimeException(he);
822            }
823            return ret;
824        }
825    
826        /**
827         * Returns a specific repetition of
828         * PR1-12: "Procedure Practitioner" - creates it if necessary
829         *
830         * @param rep The repetition index (0-indexed)
831         */
832        public XCN getPr112_ProcedurePractitioner(int rep) { 
833            XCN ret = null;
834            try {
835                Type t = this.getField(12, rep);
836                ret = (XCN)t;
837            } catch (ClassCastException cce) {
838                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
839                throw new RuntimeException(cce);
840            } catch (HL7Exception he) {
841                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
842                throw new RuntimeException(he);
843            }
844            return ret;
845        }
846    
847    
848        /**
849         * Returns a count of the current number of repetitions of Procedure Practitioner (PR1-12).
850         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
851         * it will return zero.
852         */
853        public int getPr112_ProcedurePractitionerReps() {
854            XCN[] ret = null;
855            try {
856                Type[] t = this.getField(12);
857                return t.length;  
858            } catch (ClassCastException cce) {
859                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
860                throw new RuntimeException(cce);
861            } catch (HL7Exception he) {
862                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
863                throw new RuntimeException(he);
864            }
865        }
866    
867    
868    
869        /**
870         * Inserts a repetition of
871         * PR1-12: "Procedure Practitioner" at a specific index
872         *
873         * @param rep The repetition index (0-indexed)
874         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
875         */
876        public XCN insertProcedurePractitioner(int rep) throws HL7Exception { 
877            return (XCN) super.insertRepetition(12, rep);
878        }
879    
880    
881    
882        /**
883         * Inserts a repetition of
884         * PR1-12: "Procedure Practitioner" at a specific index
885         *
886         * @param rep The repetition index (0-indexed)
887         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
888         */
889        public XCN insertPr112_ProcedurePractitioner(int rep) throws HL7Exception { 
890            return (XCN) super.insertRepetition(12, rep);
891        }
892    
893    
894        /**
895         * Removes a repetition of
896         * PR1-12: "Procedure Practitioner" at a specific index
897         *
898         * @param rep The repetition index (0-indexed)
899         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
900         */
901        public XCN removeProcedurePractitioner(int rep) throws HL7Exception { 
902            return (XCN) super.removeRepetition(12, rep);
903        }
904    
905    
906        /**
907         * Removes a repetition of
908         * PR1-12: "Procedure Practitioner" at a specific index
909         *
910         * @param rep The repetition index (0-indexed)
911         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
912         */
913        public XCN removePr112_ProcedurePractitioner(int rep) throws HL7Exception { 
914            return (XCN) super.removeRepetition(12, rep);
915        }
916    
917    
918    
919    
920        /**
921         * Returns
922         * PR1-13: "Consent Code" - creates it if necessary
923         */
924        public CE getConsentCode() { 
925            CE ret = null;
926            try {
927                Type t = this.getField(13, 0);
928                ret = (CE)t;
929            } catch (ClassCastException cce) {
930                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
931                throw new RuntimeException(cce);
932            } catch (HL7Exception he) {
933                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
934                throw new RuntimeException(he);
935            }
936            return ret;
937        }
938    
939    
940        /**
941         * Returns
942         * PR1-13: "Consent Code" - creates it if necessary
943         */
944        public CE getPr113_ConsentCode() { 
945            CE ret = null;
946            try {
947                Type t = this.getField(13, 0);
948                ret = (CE)t;
949            } catch (ClassCastException cce) {
950                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
951                throw new RuntimeException(cce);
952            } catch (HL7Exception he) {
953                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
954                throw new RuntimeException(he);
955            }
956            return ret;
957        }
958    
959    
960    
961        /**
962         * Returns
963         * PR1-14: "Procedure Priority" - creates it if necessary
964         */
965        public ID getProcedurePriority() { 
966            ID ret = null;
967            try {
968                Type t = this.getField(14, 0);
969                ret = (ID)t;
970            } catch (ClassCastException cce) {
971                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
972                throw new RuntimeException(cce);
973            } catch (HL7Exception he) {
974                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
975                throw new RuntimeException(he);
976            }
977            return ret;
978        }
979    
980    
981        /**
982         * Returns
983         * PR1-14: "Procedure Priority" - creates it if necessary
984         */
985        public ID getPr114_ProcedurePriority() { 
986            ID ret = null;
987            try {
988                Type t = this.getField(14, 0);
989                ret = (ID)t;
990            } catch (ClassCastException cce) {
991                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
992                throw new RuntimeException(cce);
993            } catch (HL7Exception he) {
994                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
995                throw new RuntimeException(he);
996            }
997            return ret;
998        }
999    
1000    
1001    
1002        /**
1003         * Returns
1004         * PR1-15: "Associated Diagnosis Code" - creates it if necessary
1005         */
1006        public CE getAssociatedDiagnosisCode() { 
1007            CE ret = null;
1008            try {
1009                Type t = this.getField(15, 0);
1010                ret = (CE)t;
1011            } catch (ClassCastException cce) {
1012                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1013                throw new RuntimeException(cce);
1014            } catch (HL7Exception he) {
1015                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1016                throw new RuntimeException(he);
1017            }
1018            return ret;
1019        }
1020    
1021    
1022        /**
1023         * Returns
1024         * PR1-15: "Associated Diagnosis Code" - creates it if necessary
1025         */
1026        public CE getPr115_AssociatedDiagnosisCode() { 
1027            CE ret = null;
1028            try {
1029                Type t = this.getField(15, 0);
1030                ret = (CE)t;
1031            } catch (ClassCastException cce) {
1032                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1033                throw new RuntimeException(cce);
1034            } catch (HL7Exception he) {
1035                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1036                throw new RuntimeException(he);
1037            }
1038            return ret;
1039        }
1040    
1041    
1042        /**
1043         * Returns all repetitions of Procedure Code Modifier (PR1-16).
1044         */
1045        public CE[] getProcedureCodeModifier() {
1046            CE[] ret = null;
1047            try {
1048                Type[] t = this.getField(16);  
1049                ret = new CE[t.length];
1050                for (int i = 0; i < ret.length; i++) {
1051                    ret[i] = (CE)t[i];
1052                }
1053            } catch (ClassCastException cce) {
1054                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1055                throw new RuntimeException(cce);
1056            } catch (HL7Exception he) {
1057                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1058                throw new RuntimeException(he);
1059            }
1060            return ret;
1061        }
1062    
1063    
1064        /**
1065         * Returns a count of the current number of repetitions of Procedure Code Modifier (PR1-16).
1066         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1067         * it will return zero.
1068         */
1069        public int getProcedureCodeModifierReps() {
1070            CE[] ret = null;
1071            try {
1072                Type[] t = this.getField(16);
1073                return t.length;  
1074            } catch (ClassCastException cce) {
1075                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1076                throw new RuntimeException(cce);
1077            } catch (HL7Exception he) {
1078                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1079                throw new RuntimeException(he);
1080            }
1081        }
1082    
1083    
1084        /**
1085         * Returns a specific repetition of
1086         * PR1-16: "Procedure Code Modifier" - creates it if necessary
1087         *
1088         * @param rep The repetition index (0-indexed)
1089         */
1090        public CE getProcedureCodeModifier(int rep) { 
1091            CE ret = null;
1092            try {
1093                Type t = this.getField(16, rep);
1094                ret = (CE)t;
1095            } catch (ClassCastException cce) {
1096                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1097                throw new RuntimeException(cce);
1098            } catch (HL7Exception he) {
1099                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1100                throw new RuntimeException(he);
1101            }
1102            return ret;
1103        }
1104    
1105        /**
1106         * Returns a specific repetition of
1107         * PR1-16: "Procedure Code Modifier" - creates it if necessary
1108         *
1109         * @param rep The repetition index (0-indexed)
1110         */
1111        public CE getPr116_ProcedureCodeModifier(int rep) { 
1112            CE ret = null;
1113            try {
1114                Type t = this.getField(16, rep);
1115                ret = (CE)t;
1116            } catch (ClassCastException cce) {
1117                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1118                throw new RuntimeException(cce);
1119            } catch (HL7Exception he) {
1120                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1121                throw new RuntimeException(he);
1122            }
1123            return ret;
1124        }
1125    
1126    
1127        /**
1128         * Returns a count of the current number of repetitions of Procedure Code Modifier (PR1-16).
1129         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1130         * it will return zero.
1131         */
1132        public int getPr116_ProcedureCodeModifierReps() {
1133            CE[] ret = null;
1134            try {
1135                Type[] t = this.getField(16);
1136                return t.length;  
1137            } catch (ClassCastException cce) {
1138                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1139                throw new RuntimeException(cce);
1140            } catch (HL7Exception he) {
1141                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1142                throw new RuntimeException(he);
1143            }
1144        }
1145    
1146    
1147    
1148        /**
1149         * Inserts a repetition of
1150         * PR1-16: "Procedure Code Modifier" at a specific index
1151         *
1152         * @param rep The repetition index (0-indexed)
1153         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1154         */
1155        public CE insertProcedureCodeModifier(int rep) throws HL7Exception { 
1156            return (CE) super.insertRepetition(16, rep);
1157        }
1158    
1159    
1160    
1161        /**
1162         * Inserts a repetition of
1163         * PR1-16: "Procedure Code Modifier" at a specific index
1164         *
1165         * @param rep The repetition index (0-indexed)
1166         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1167         */
1168        public CE insertPr116_ProcedureCodeModifier(int rep) throws HL7Exception { 
1169            return (CE) super.insertRepetition(16, rep);
1170        }
1171    
1172    
1173        /**
1174         * Removes a repetition of
1175         * PR1-16: "Procedure Code Modifier" at a specific index
1176         *
1177         * @param rep The repetition index (0-indexed)
1178         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1179         */
1180        public CE removeProcedureCodeModifier(int rep) throws HL7Exception { 
1181            return (CE) super.removeRepetition(16, rep);
1182        }
1183    
1184    
1185        /**
1186         * Removes a repetition of
1187         * PR1-16: "Procedure Code Modifier" at a specific index
1188         *
1189         * @param rep The repetition index (0-indexed)
1190         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1191         */
1192        public CE removePr116_ProcedureCodeModifier(int rep) throws HL7Exception { 
1193            return (CE) super.removeRepetition(16, rep);
1194        }
1195    
1196    
1197    
1198    
1199        /**
1200         * Returns
1201         * PR1-17: "Procedure DRG Type" - creates it if necessary
1202         */
1203        public IS getProcedureDRGType() { 
1204            IS ret = null;
1205            try {
1206                Type t = this.getField(17, 0);
1207                ret = (IS)t;
1208            } catch (ClassCastException cce) {
1209                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1210                throw new RuntimeException(cce);
1211            } catch (HL7Exception he) {
1212                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1213                throw new RuntimeException(he);
1214            }
1215            return ret;
1216        }
1217    
1218    
1219        /**
1220         * Returns
1221         * PR1-17: "Procedure DRG Type" - creates it if necessary
1222         */
1223        public IS getPr117_ProcedureDRGType() { 
1224            IS ret = null;
1225            try {
1226                Type t = this.getField(17, 0);
1227                ret = (IS)t;
1228            } catch (ClassCastException cce) {
1229                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1230                throw new RuntimeException(cce);
1231            } catch (HL7Exception he) {
1232                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1233                throw new RuntimeException(he);
1234            }
1235            return ret;
1236        }
1237    
1238    
1239        /**
1240         * Returns all repetitions of Tissue Type Code (PR1-18).
1241         */
1242        public CE[] getTissueTypeCode() {
1243            CE[] ret = null;
1244            try {
1245                Type[] t = this.getField(18);  
1246                ret = new CE[t.length];
1247                for (int i = 0; i < ret.length; i++) {
1248                    ret[i] = (CE)t[i];
1249                }
1250            } catch (ClassCastException cce) {
1251                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1252                throw new RuntimeException(cce);
1253            } catch (HL7Exception he) {
1254                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1255                throw new RuntimeException(he);
1256            }
1257            return ret;
1258        }
1259    
1260    
1261        /**
1262         * Returns a count of the current number of repetitions of Tissue Type Code (PR1-18).
1263         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1264         * it will return zero.
1265         */
1266        public int getTissueTypeCodeReps() {
1267            CE[] ret = null;
1268            try {
1269                Type[] t = this.getField(18);
1270                return t.length;  
1271            } catch (ClassCastException cce) {
1272                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1273                throw new RuntimeException(cce);
1274            } catch (HL7Exception he) {
1275                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1276                throw new RuntimeException(he);
1277            }
1278        }
1279    
1280    
1281        /**
1282         * Returns a specific repetition of
1283         * PR1-18: "Tissue Type Code" - creates it if necessary
1284         *
1285         * @param rep The repetition index (0-indexed)
1286         */
1287        public CE getTissueTypeCode(int rep) { 
1288            CE ret = null;
1289            try {
1290                Type t = this.getField(18, rep);
1291                ret = (CE)t;
1292            } catch (ClassCastException cce) {
1293                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1294                throw new RuntimeException(cce);
1295            } catch (HL7Exception he) {
1296                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1297                throw new RuntimeException(he);
1298            }
1299            return ret;
1300        }
1301    
1302        /**
1303         * Returns a specific repetition of
1304         * PR1-18: "Tissue Type Code" - creates it if necessary
1305         *
1306         * @param rep The repetition index (0-indexed)
1307         */
1308        public CE getPr118_TissueTypeCode(int rep) { 
1309            CE ret = null;
1310            try {
1311                Type t = this.getField(18, rep);
1312                ret = (CE)t;
1313            } catch (ClassCastException cce) {
1314                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1315                throw new RuntimeException(cce);
1316            } catch (HL7Exception he) {
1317                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1318                throw new RuntimeException(he);
1319            }
1320            return ret;
1321        }
1322    
1323    
1324        /**
1325         * Returns a count of the current number of repetitions of Tissue Type Code (PR1-18).
1326         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1327         * it will return zero.
1328         */
1329        public int getPr118_TissueTypeCodeReps() {
1330            CE[] ret = null;
1331            try {
1332                Type[] t = this.getField(18);
1333                return t.length;  
1334            } catch (ClassCastException cce) {
1335                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1336                throw new RuntimeException(cce);
1337            } catch (HL7Exception he) {
1338                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1339                throw new RuntimeException(he);
1340            }
1341        }
1342    
1343    
1344    
1345        /**
1346         * Inserts a repetition of
1347         * PR1-18: "Tissue Type Code" 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 CE insertTissueTypeCode(int rep) throws HL7Exception { 
1353            return (CE) super.insertRepetition(18, rep);
1354        }
1355    
1356    
1357    
1358        /**
1359         * Inserts a repetition of
1360         * PR1-18: "Tissue Type Code" at a specific index
1361         *
1362         * @param rep The repetition index (0-indexed)
1363         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1364         */
1365        public CE insertPr118_TissueTypeCode(int rep) throws HL7Exception { 
1366            return (CE) super.insertRepetition(18, rep);
1367        }
1368    
1369    
1370        /**
1371         * Removes a repetition of
1372         * PR1-18: "Tissue Type Code" at a specific index
1373         *
1374         * @param rep The repetition index (0-indexed)
1375         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1376         */
1377        public CE removeTissueTypeCode(int rep) throws HL7Exception { 
1378            return (CE) super.removeRepetition(18, rep);
1379        }
1380    
1381    
1382        /**
1383         * Removes a repetition of
1384         * PR1-18: "Tissue Type Code" at a specific index
1385         *
1386         * @param rep The repetition index (0-indexed)
1387         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1388         */
1389        public CE removePr118_TissueTypeCode(int rep) throws HL7Exception { 
1390            return (CE) super.removeRepetition(18, rep);
1391        }
1392    
1393    
1394    
1395    
1396    
1397    
1398        /** {@inheritDoc} */   
1399        protected Type createNewTypeWithoutReflection(int field) {
1400           switch (field) {
1401              case 0: return new SI(getMessage());
1402              case 1: return new IS(getMessage(), new Integer( 89 ));
1403              case 2: return new CE(getMessage());
1404              case 3: return new ST(getMessage());
1405              case 4: return new TS(getMessage());
1406              case 5: return new IS(getMessage(), new Integer( 230 ));
1407              case 6: return new NM(getMessage());
1408              case 7: return new XCN(getMessage());
1409              case 8: return new IS(getMessage(), new Integer( 19 ));
1410              case 9: return new NM(getMessage());
1411              case 10: return new XCN(getMessage());
1412              case 11: return new XCN(getMessage());
1413              case 12: return new CE(getMessage());
1414              case 13: return new ID(getMessage(), new Integer( 418 ));
1415              case 14: return new CE(getMessage());
1416              case 15: return new CE(getMessage());
1417              case 16: return new IS(getMessage(), new Integer( 416 ));
1418              case 17: return new CE(getMessage());
1419              default: return null;
1420           }
1421       }
1422    
1423    
1424    }
1425