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