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 MRG message segment (Merge patient information). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>MRG-1: Prior Patient Identifier List (CX) <b> repeating</b>
027         * <li>MRG-2: Prior Alternate Patient ID (CX) <b>optional repeating</b>
028         * <li>MRG-3: Prior Patient Account Number (CX) <b>optional </b>
029         * <li>MRG-4: Prior Patient ID (CX) <b>optional </b>
030         * <li>MRG-5: Prior Visit Number (CX) <b>optional </b>
031         * <li>MRG-6: Prior Alternate Visit ID (CX) <b>optional </b>
032         * <li>MRG-7: Prior Patient Name (XPN) <b>optional repeating</b>
033     * </ul>
034     */
035    public class MRG extends AbstractSegment {
036    
037        /** 
038         * Creates a new MRG segment
039         */
040        public MRG(Group parent, ModelClassFactory factory) {
041           super(parent, factory);
042           init(factory);
043        }
044    
045        private void init(ModelClassFactory factory) {
046           try {
047                                      this.add(CX.class, true, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Prior Patient Identifier List");
048                                      this.add(CX.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Prior Alternate Patient ID");
049                                      this.add(CX.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Prior Patient Account Number");
050                                      this.add(CX.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Prior Patient ID");
051                                      this.add(CX.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Prior Visit Number");
052                                      this.add(CX.class, false, 1, 250, new Object[]{ getMessage(), new Integer(0) }, "Prior Alternate Visit ID");
053                                      this.add(XPN.class, false, 0, 250, new Object[]{ getMessage(), new Integer(0) }, "Prior Patient Name");
054           } catch(HL7Exception e) {
055              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating MRG - this is probably a bug in the source code generator.", e);
056           }
057        }
058    
059    
060        /**
061         * Returns all repetitions of Prior Patient Identifier List (MRG-1).
062         */
063        public CX[] getPriorPatientIdentifierList() {
064            CX[] ret = null;
065            try {
066                Type[] t = this.getField(1);  
067                ret = new CX[t.length];
068                for (int i = 0; i < ret.length; i++) {
069                    ret[i] = (CX)t[i];
070                }
071            } catch (ClassCastException cce) {
072                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
073                throw new RuntimeException(cce);
074            } catch (HL7Exception he) {
075                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
076                throw new RuntimeException(he);
077            }
078            return ret;
079        }
080    
081    
082        /**
083         * Returns a count of the current number of repetitions of Prior Patient Identifier List (MRG-1).
084         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
085         * it will return zero.
086         */
087        public int getPriorPatientIdentifierListReps() {
088            CX[] ret = null;
089            try {
090                Type[] t = this.getField(1);
091                return t.length;  
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        }
100    
101    
102        /**
103         * Returns a specific repetition of
104         * MRG-1: "Prior Patient Identifier List" - creates it if necessary
105         *
106         * @param rep The repetition index (0-indexed)
107         */
108        public CX getPriorPatientIdentifierList(int rep) { 
109            CX ret = null;
110            try {
111                Type t = this.getField(1, rep);
112                ret = (CX)t;
113            } catch (ClassCastException cce) {
114                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
115                throw new RuntimeException(cce);
116            } catch (HL7Exception he) {
117                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
118                throw new RuntimeException(he);
119            }
120            return ret;
121        }
122    
123        /**
124         * Returns a specific repetition of
125         * MRG-1: "Prior Patient Identifier List" - creates it if necessary
126         *
127         * @param rep The repetition index (0-indexed)
128         */
129        public CX getMrg1_PriorPatientIdentifierList(int rep) { 
130            CX ret = null;
131            try {
132                Type t = this.getField(1, rep);
133                ret = (CX)t;
134            } catch (ClassCastException cce) {
135                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
136                throw new RuntimeException(cce);
137            } catch (HL7Exception he) {
138                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
139                throw new RuntimeException(he);
140            }
141            return ret;
142        }
143    
144    
145        /**
146         * Returns a count of the current number of repetitions of Prior Patient Identifier List (MRG-1).
147         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
148         * it will return zero.
149         */
150        public int getMrg1_PriorPatientIdentifierListReps() {
151            CX[] ret = null;
152            try {
153                Type[] t = this.getField(1);
154                return t.length;  
155            } catch (ClassCastException cce) {
156                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
157                throw new RuntimeException(cce);
158            } catch (HL7Exception he) {
159                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
160                throw new RuntimeException(he);
161            }
162        }
163    
164    
165    
166        /**
167         * Inserts a repetition of
168         * MRG-1: "Prior Patient Identifier List" at a specific index
169         *
170         * @param rep The repetition index (0-indexed)
171         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
172         */
173        public CX insertPriorPatientIdentifierList(int rep) throws HL7Exception { 
174            return (CX) super.insertRepetition(1, rep);
175        }
176    
177    
178    
179        /**
180         * Inserts a repetition of
181         * MRG-1: "Prior Patient Identifier List" at a specific index
182         *
183         * @param rep The repetition index (0-indexed)
184         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
185         */
186        public CX insertMrg1_PriorPatientIdentifierList(int rep) throws HL7Exception { 
187            return (CX) super.insertRepetition(1, rep);
188        }
189    
190    
191        /**
192         * Removes a repetition of
193         * MRG-1: "Prior Patient Identifier List" at a specific index
194         *
195         * @param rep The repetition index (0-indexed)
196         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
197         */
198        public CX removePriorPatientIdentifierList(int rep) throws HL7Exception { 
199            return (CX) super.removeRepetition(1, rep);
200        }
201    
202    
203        /**
204         * Removes a repetition of
205         * MRG-1: "Prior Patient Identifier List" at a specific index
206         *
207         * @param rep The repetition index (0-indexed)
208         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
209         */
210        public CX removeMrg1_PriorPatientIdentifierList(int rep) throws HL7Exception { 
211            return (CX) super.removeRepetition(1, rep);
212        }
213    
214    
215    
216        /**
217         * Returns all repetitions of Prior Alternate Patient ID (MRG-2).
218         */
219        public CX[] getPriorAlternatePatientID() {
220            CX[] ret = null;
221            try {
222                Type[] t = this.getField(2);  
223                ret = new CX[t.length];
224                for (int i = 0; i < ret.length; i++) {
225                    ret[i] = (CX)t[i];
226                }
227            } catch (ClassCastException cce) {
228                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
229                throw new RuntimeException(cce);
230            } catch (HL7Exception he) {
231                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
232                throw new RuntimeException(he);
233            }
234            return ret;
235        }
236    
237    
238        /**
239         * Returns a count of the current number of repetitions of Prior Alternate Patient ID (MRG-2).
240         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
241         * it will return zero.
242         */
243        public int getPriorAlternatePatientIDReps() {
244            CX[] ret = null;
245            try {
246                Type[] t = this.getField(2);
247                return t.length;  
248            } catch (ClassCastException cce) {
249                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
250                throw new RuntimeException(cce);
251            } catch (HL7Exception he) {
252                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
253                throw new RuntimeException(he);
254            }
255        }
256    
257    
258        /**
259         * Returns a specific repetition of
260         * MRG-2: "Prior Alternate Patient ID" - creates it if necessary
261         *
262         * @param rep The repetition index (0-indexed)
263         */
264        public CX getPriorAlternatePatientID(int rep) { 
265            CX ret = null;
266            try {
267                Type t = this.getField(2, rep);
268                ret = (CX)t;
269            } catch (ClassCastException cce) {
270                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
271                throw new RuntimeException(cce);
272            } catch (HL7Exception he) {
273                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
274                throw new RuntimeException(he);
275            }
276            return ret;
277        }
278    
279        /**
280         * Returns a specific repetition of
281         * MRG-2: "Prior Alternate Patient ID" - creates it if necessary
282         *
283         * @param rep The repetition index (0-indexed)
284         */
285        public CX getMrg2_PriorAlternatePatientID(int rep) { 
286            CX ret = null;
287            try {
288                Type t = this.getField(2, rep);
289                ret = (CX)t;
290            } catch (ClassCastException cce) {
291                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
292                throw new RuntimeException(cce);
293            } catch (HL7Exception he) {
294                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
295                throw new RuntimeException(he);
296            }
297            return ret;
298        }
299    
300    
301        /**
302         * Returns a count of the current number of repetitions of Prior Alternate Patient ID (MRG-2).
303         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
304         * it will return zero.
305         */
306        public int getMrg2_PriorAlternatePatientIDReps() {
307            CX[] ret = null;
308            try {
309                Type[] t = this.getField(2);
310                return t.length;  
311            } catch (ClassCastException cce) {
312                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
313                throw new RuntimeException(cce);
314            } catch (HL7Exception he) {
315                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
316                throw new RuntimeException(he);
317            }
318        }
319    
320    
321    
322        /**
323         * Inserts a repetition of
324         * MRG-2: "Prior Alternate Patient ID" at a specific index
325         *
326         * @param rep The repetition index (0-indexed)
327         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
328         */
329        public CX insertPriorAlternatePatientID(int rep) throws HL7Exception { 
330            return (CX) super.insertRepetition(2, rep);
331        }
332    
333    
334    
335        /**
336         * Inserts a repetition of
337         * MRG-2: "Prior Alternate Patient ID" at a specific index
338         *
339         * @param rep The repetition index (0-indexed)
340         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
341         */
342        public CX insertMrg2_PriorAlternatePatientID(int rep) throws HL7Exception { 
343            return (CX) super.insertRepetition(2, rep);
344        }
345    
346    
347        /**
348         * Removes a repetition of
349         * MRG-2: "Prior Alternate Patient ID" at a specific index
350         *
351         * @param rep The repetition index (0-indexed)
352         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
353         */
354        public CX removePriorAlternatePatientID(int rep) throws HL7Exception { 
355            return (CX) super.removeRepetition(2, rep);
356        }
357    
358    
359        /**
360         * Removes a repetition of
361         * MRG-2: "Prior Alternate Patient ID" at a specific index
362         *
363         * @param rep The repetition index (0-indexed)
364         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
365         */
366        public CX removeMrg2_PriorAlternatePatientID(int rep) throws HL7Exception { 
367            return (CX) super.removeRepetition(2, rep);
368        }
369    
370    
371    
372    
373        /**
374         * Returns
375         * MRG-3: "Prior Patient Account Number" - creates it if necessary
376         */
377        public CX getPriorPatientAccountNumber() { 
378            CX ret = null;
379            try {
380                Type t = this.getField(3, 0);
381                ret = (CX)t;
382            } catch (ClassCastException cce) {
383                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
384                throw new RuntimeException(cce);
385            } catch (HL7Exception he) {
386                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
387                throw new RuntimeException(he);
388            }
389            return ret;
390        }
391    
392    
393        /**
394         * Returns
395         * MRG-3: "Prior Patient Account Number" - creates it if necessary
396         */
397        public CX getMrg3_PriorPatientAccountNumber() { 
398            CX ret = null;
399            try {
400                Type t = this.getField(3, 0);
401                ret = (CX)t;
402            } catch (ClassCastException cce) {
403                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
404                throw new RuntimeException(cce);
405            } catch (HL7Exception he) {
406                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
407                throw new RuntimeException(he);
408            }
409            return ret;
410        }
411    
412    
413    
414        /**
415         * Returns
416         * MRG-4: "Prior Patient ID" - creates it if necessary
417         */
418        public CX getPriorPatientID() { 
419            CX ret = null;
420            try {
421                Type t = this.getField(4, 0);
422                ret = (CX)t;
423            } catch (ClassCastException cce) {
424                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
425                throw new RuntimeException(cce);
426            } catch (HL7Exception he) {
427                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
428                throw new RuntimeException(he);
429            }
430            return ret;
431        }
432    
433    
434        /**
435         * Returns
436         * MRG-4: "Prior Patient ID" - creates it if necessary
437         */
438        public CX getMrg4_PriorPatientID() { 
439            CX ret = null;
440            try {
441                Type t = this.getField(4, 0);
442                ret = (CX)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        /**
456         * Returns
457         * MRG-5: "Prior Visit Number" - creates it if necessary
458         */
459        public CX getPriorVisitNumber() { 
460            CX ret = null;
461            try {
462                Type t = this.getField(5, 0);
463                ret = (CX)t;
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            return ret;
472        }
473    
474    
475        /**
476         * Returns
477         * MRG-5: "Prior Visit Number" - creates it if necessary
478         */
479        public CX getMrg5_PriorVisitNumber() { 
480            CX ret = null;
481            try {
482                Type t = this.getField(5, 0);
483                ret = (CX)t;
484            } catch (ClassCastException cce) {
485                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
486                throw new RuntimeException(cce);
487            } catch (HL7Exception he) {
488                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
489                throw new RuntimeException(he);
490            }
491            return ret;
492        }
493    
494    
495    
496        /**
497         * Returns
498         * MRG-6: "Prior Alternate Visit ID" - creates it if necessary
499         */
500        public CX getPriorAlternateVisitID() { 
501            CX ret = null;
502            try {
503                Type t = this.getField(6, 0);
504                ret = (CX)t;
505            } catch (ClassCastException cce) {
506                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
507                throw new RuntimeException(cce);
508            } catch (HL7Exception he) {
509                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
510                throw new RuntimeException(he);
511            }
512            return ret;
513        }
514    
515    
516        /**
517         * Returns
518         * MRG-6: "Prior Alternate Visit ID" - creates it if necessary
519         */
520        public CX getMrg6_PriorAlternateVisitID() { 
521            CX ret = null;
522            try {
523                Type t = this.getField(6, 0);
524                ret = (CX)t;
525            } catch (ClassCastException cce) {
526                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
527                throw new RuntimeException(cce);
528            } catch (HL7Exception he) {
529                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
530                throw new RuntimeException(he);
531            }
532            return ret;
533        }
534    
535    
536        /**
537         * Returns all repetitions of Prior Patient Name (MRG-7).
538         */
539        public XPN[] getPriorPatientName() {
540            XPN[] ret = null;
541            try {
542                Type[] t = this.getField(7);  
543                ret = new XPN[t.length];
544                for (int i = 0; i < ret.length; i++) {
545                    ret[i] = (XPN)t[i];
546                }
547            } catch (ClassCastException cce) {
548                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
549                throw new RuntimeException(cce);
550            } catch (HL7Exception he) {
551                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
552                throw new RuntimeException(he);
553            }
554            return ret;
555        }
556    
557    
558        /**
559         * Returns a count of the current number of repetitions of Prior Patient Name (MRG-7).
560         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
561         * it will return zero.
562         */
563        public int getPriorPatientNameReps() {
564            XPN[] ret = null;
565            try {
566                Type[] t = this.getField(7);
567                return t.length;  
568            } catch (ClassCastException cce) {
569                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
570                throw new RuntimeException(cce);
571            } catch (HL7Exception he) {
572                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
573                throw new RuntimeException(he);
574            }
575        }
576    
577    
578        /**
579         * Returns a specific repetition of
580         * MRG-7: "Prior Patient Name" - creates it if necessary
581         *
582         * @param rep The repetition index (0-indexed)
583         */
584        public XPN getPriorPatientName(int rep) { 
585            XPN ret = null;
586            try {
587                Type t = this.getField(7, rep);
588                ret = (XPN)t;
589            } catch (ClassCastException cce) {
590                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
591                throw new RuntimeException(cce);
592            } catch (HL7Exception he) {
593                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
594                throw new RuntimeException(he);
595            }
596            return ret;
597        }
598    
599        /**
600         * Returns a specific repetition of
601         * MRG-7: "Prior Patient Name" - creates it if necessary
602         *
603         * @param rep The repetition index (0-indexed)
604         */
605        public XPN getMrg7_PriorPatientName(int rep) { 
606            XPN ret = null;
607            try {
608                Type t = this.getField(7, rep);
609                ret = (XPN)t;
610            } catch (ClassCastException cce) {
611                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
612                throw new RuntimeException(cce);
613            } catch (HL7Exception he) {
614                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
615                throw new RuntimeException(he);
616            }
617            return ret;
618        }
619    
620    
621        /**
622         * Returns a count of the current number of repetitions of Prior Patient Name (MRG-7).
623         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
624         * it will return zero.
625         */
626        public int getMrg7_PriorPatientNameReps() {
627            XPN[] ret = null;
628            try {
629                Type[] t = this.getField(7);
630                return t.length;  
631            } catch (ClassCastException cce) {
632                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
633                throw new RuntimeException(cce);
634            } catch (HL7Exception he) {
635                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
636                throw new RuntimeException(he);
637            }
638        }
639    
640    
641    
642        /**
643         * Inserts a repetition of
644         * MRG-7: "Prior Patient Name" at a specific index
645         *
646         * @param rep The repetition index (0-indexed)
647         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
648         */
649        public XPN insertPriorPatientName(int rep) throws HL7Exception { 
650            return (XPN) super.insertRepetition(7, rep);
651        }
652    
653    
654    
655        /**
656         * Inserts a repetition of
657         * MRG-7: "Prior Patient Name" at a specific index
658         *
659         * @param rep The repetition index (0-indexed)
660         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
661         */
662        public XPN insertMrg7_PriorPatientName(int rep) throws HL7Exception { 
663            return (XPN) super.insertRepetition(7, rep);
664        }
665    
666    
667        /**
668         * Removes a repetition of
669         * MRG-7: "Prior Patient Name" at a specific index
670         *
671         * @param rep The repetition index (0-indexed)
672         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
673         */
674        public XPN removePriorPatientName(int rep) throws HL7Exception { 
675            return (XPN) super.removeRepetition(7, rep);
676        }
677    
678    
679        /**
680         * Removes a repetition of
681         * MRG-7: "Prior Patient Name" at a specific index
682         *
683         * @param rep The repetition index (0-indexed)
684         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
685         */
686        public XPN removeMrg7_PriorPatientName(int rep) throws HL7Exception { 
687            return (XPN) super.removeRepetition(7, rep);
688        }
689    
690    
691    
692    
693    
694    
695        /** {@inheritDoc} */   
696        protected Type createNewTypeWithoutReflection(int field) {
697           switch (field) {
698              case 0: return new CX(getMessage());
699              case 1: return new CX(getMessage());
700              case 2: return new CX(getMessage());
701              case 3: return new CX(getMessage());
702              case 4: return new CX(getMessage());
703              case 5: return new CX(getMessage());
704              case 6: return new XPN(getMessage());
705              default: return null;
706           }
707       }
708    
709    
710    }
711