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.v231.segment;
009    
010    // import ca.uhn.hl7v2.model.v231.group.*;
011    import ca.uhn.hl7v2.model.v231.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 LOC message segment (LOC - location identification segment). 
024     * This segment has the following fields:</p>
025     * <ul>
026         * <li>LOC-1: Primary Key Value - LOC (PL) <b> </b>
027         * <li>LOC-2: Location Description (ST) <b>optional </b>
028         * <li>LOC-3: Location Type - LOC (IS) <b> repeating</b>
029         * <li>LOC-4: Organization Name - LOC (XON) <b>optional repeating</b>
030         * <li>LOC-5: Location Address (XAD) <b>optional repeating</b>
031         * <li>LOC-6: Location Phone (XTN) <b>optional repeating</b>
032         * <li>LOC-7: License Number (CE) <b>optional repeating</b>
033         * <li>LOC-8: Location Equipment (IS) <b>optional repeating</b>
034     * </ul>
035     */
036    public class LOC extends AbstractSegment {
037    
038        /** 
039         * Creates a new LOC segment
040         */
041        public LOC(Group parent, ModelClassFactory factory) {
042           super(parent, factory);
043           init(factory);
044        }
045    
046        private void init(ModelClassFactory factory) {
047           try {
048                                      this.add(PL.class, true, 1, 200, new Object[]{ getMessage(), new Integer(0) }, "Primary Key Value - LOC");
049                                      this.add(ST.class, false, 1, 48, new Object[]{ getMessage(), new Integer(0) }, "Location Description");
050                                      this.add(IS.class, true, 0, 2, new Object[]{ getMessage() }, "Location Type - LOC");
051                                      this.add(XON.class, false, 0, 90, new Object[]{ getMessage(), new Integer(0) }, "Organization Name - LOC");
052                                      this.add(XAD.class, false, 0, 106, new Object[]{ getMessage(), new Integer(0) }, "Location Address");
053                                      this.add(XTN.class, false, 0, 40, new Object[]{ getMessage(), new Integer(0) }, "Location Phone");
054                                      this.add(CE.class, false, 0, 60, new Object[]{ getMessage(), new Integer(0) }, "License Number");
055                                      this.add(IS.class, false, 0, 3, new Object[]{ getMessage() }, "Location Equipment");
056           } catch(HL7Exception e) {
057              HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected error creating LOC - this is probably a bug in the source code generator.", e);
058           }
059        }
060    
061    
062    
063        /**
064         * Returns
065         * LOC-1: "Primary Key Value - LOC" - creates it if necessary
066         */
067        public PL getPrimaryKeyValueLOC() { 
068            PL ret = null;
069            try {
070                Type t = this.getField(1, 0);
071                ret = (PL)t;
072            } catch (ClassCastException cce) {
073                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
074                throw new RuntimeException(cce);
075            } catch (HL7Exception he) {
076                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
077                throw new RuntimeException(he);
078            }
079            return ret;
080        }
081    
082    
083        /**
084         * Returns
085         * LOC-1: "Primary Key Value - LOC" - creates it if necessary
086         */
087        public PL getLoc1_PrimaryKeyValueLOC() { 
088            PL ret = null;
089            try {
090                Type t = this.getField(1, 0);
091                ret = (PL)t;
092            } catch (ClassCastException cce) {
093                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
094                throw new RuntimeException(cce);
095            } catch (HL7Exception he) {
096                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
097                throw new RuntimeException(he);
098            }
099            return ret;
100        }
101    
102    
103    
104        /**
105         * Returns
106         * LOC-2: "Location Description" - creates it if necessary
107         */
108        public ST getLocationDescription() { 
109            ST ret = null;
110            try {
111                Type t = this.getField(2, 0);
112                ret = (ST)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        /**
125         * Returns
126         * LOC-2: "Location Description" - creates it if necessary
127         */
128        public ST getLoc2_LocationDescription() { 
129            ST ret = null;
130            try {
131                Type t = this.getField(2, 0);
132                ret = (ST)t;
133            } catch (ClassCastException cce) {
134                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
135                throw new RuntimeException(cce);
136            } catch (HL7Exception he) {
137                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
138                throw new RuntimeException(he);
139            }
140            return ret;
141        }
142    
143    
144        /**
145         * Returns all repetitions of Location Type - LOC (LOC-3).
146         */
147        public IS[] getLocationTypeLOC() {
148            IS[] ret = null;
149            try {
150                Type[] t = this.getField(3);  
151                ret = new IS[t.length];
152                for (int i = 0; i < ret.length; i++) {
153                    ret[i] = (IS)t[i];
154                }
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            return ret;
163        }
164    
165    
166        /**
167         * Returns a count of the current number of repetitions of Location Type - LOC (LOC-3).
168         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
169         * it will return zero.
170         */
171        public int getLocationTypeLOCReps() {
172            IS[] ret = null;
173            try {
174                Type[] t = this.getField(3);
175                return t.length;  
176            } catch (ClassCastException cce) {
177                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
178                throw new RuntimeException(cce);
179            } catch (HL7Exception he) {
180                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
181                throw new RuntimeException(he);
182            }
183        }
184    
185    
186        /**
187         * Returns a specific repetition of
188         * LOC-3: "Location Type - LOC" - creates it if necessary
189         *
190         * @param rep The repetition index (0-indexed)
191         */
192        public IS getLocationTypeLOC(int rep) { 
193            IS ret = null;
194            try {
195                Type t = this.getField(3, rep);
196                ret = (IS)t;
197            } catch (ClassCastException cce) {
198                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
199                throw new RuntimeException(cce);
200            } catch (HL7Exception he) {
201                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
202                throw new RuntimeException(he);
203            }
204            return ret;
205        }
206    
207        /**
208         * Returns a specific repetition of
209         * LOC-3: "Location Type - LOC" - creates it if necessary
210         *
211         * @param rep The repetition index (0-indexed)
212         */
213        public IS getLoc3_LocationTypeLOC(int rep) { 
214            IS ret = null;
215            try {
216                Type t = this.getField(3, rep);
217                ret = (IS)t;
218            } catch (ClassCastException cce) {
219                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
220                throw new RuntimeException(cce);
221            } catch (HL7Exception he) {
222                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
223                throw new RuntimeException(he);
224            }
225            return ret;
226        }
227    
228    
229        /**
230         * Returns a count of the current number of repetitions of Location Type - LOC (LOC-3).
231         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
232         * it will return zero.
233         */
234        public int getLoc3_LocationTypeLOCReps() {
235            IS[] ret = null;
236            try {
237                Type[] t = this.getField(3);
238                return t.length;  
239            } catch (ClassCastException cce) {
240                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
241                throw new RuntimeException(cce);
242            } catch (HL7Exception he) {
243                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
244                throw new RuntimeException(he);
245            }
246        }
247    
248    
249    
250        /**
251         * Inserts a repetition of
252         * LOC-3: "Location Type - LOC" at a specific index
253         *
254         * @param rep The repetition index (0-indexed)
255         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
256         */
257        public IS insertLocationTypeLOC(int rep) throws HL7Exception { 
258            return (IS) super.insertRepetition(3, rep);
259        }
260    
261    
262    
263        /**
264         * Inserts a repetition of
265         * LOC-3: "Location Type - LOC" at a specific index
266         *
267         * @param rep The repetition index (0-indexed)
268         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
269         */
270        public IS insertLoc3_LocationTypeLOC(int rep) throws HL7Exception { 
271            return (IS) super.insertRepetition(3, rep);
272        }
273    
274    
275        /**
276         * Removes a repetition of
277         * LOC-3: "Location Type - LOC" at a specific index
278         *
279         * @param rep The repetition index (0-indexed)
280         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
281         */
282        public IS removeLocationTypeLOC(int rep) throws HL7Exception { 
283            return (IS) super.removeRepetition(3, rep);
284        }
285    
286    
287        /**
288         * Removes a repetition of
289         * LOC-3: "Location Type - LOC" at a specific index
290         *
291         * @param rep The repetition index (0-indexed)
292         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
293         */
294        public IS removeLoc3_LocationTypeLOC(int rep) throws HL7Exception { 
295            return (IS) super.removeRepetition(3, rep);
296        }
297    
298    
299    
300        /**
301         * Returns all repetitions of Organization Name - LOC (LOC-4).
302         */
303        public XON[] getOrganizationNameLOC() {
304            XON[] ret = null;
305            try {
306                Type[] t = this.getField(4);  
307                ret = new XON[t.length];
308                for (int i = 0; i < ret.length; i++) {
309                    ret[i] = (XON)t[i];
310                }
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            return ret;
319        }
320    
321    
322        /**
323         * Returns a count of the current number of repetitions of Organization Name - LOC (LOC-4).
324         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
325         * it will return zero.
326         */
327        public int getOrganizationNameLOCReps() {
328            XON[] ret = null;
329            try {
330                Type[] t = this.getField(4);
331                return t.length;  
332            } catch (ClassCastException cce) {
333                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
334                throw new RuntimeException(cce);
335            } catch (HL7Exception he) {
336                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
337                throw new RuntimeException(he);
338            }
339        }
340    
341    
342        /**
343         * Returns a specific repetition of
344         * LOC-4: "Organization Name - LOC" - creates it if necessary
345         *
346         * @param rep The repetition index (0-indexed)
347         */
348        public XON getOrganizationNameLOC(int rep) { 
349            XON ret = null;
350            try {
351                Type t = this.getField(4, rep);
352                ret = (XON)t;
353            } catch (ClassCastException cce) {
354                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
355                throw new RuntimeException(cce);
356            } catch (HL7Exception he) {
357                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
358                throw new RuntimeException(he);
359            }
360            return ret;
361        }
362    
363        /**
364         * Returns a specific repetition of
365         * LOC-4: "Organization Name - LOC" - creates it if necessary
366         *
367         * @param rep The repetition index (0-indexed)
368         */
369        public XON getLoc4_OrganizationNameLOC(int rep) { 
370            XON ret = null;
371            try {
372                Type t = this.getField(4, rep);
373                ret = (XON)t;
374            } catch (ClassCastException cce) {
375                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
376                throw new RuntimeException(cce);
377            } catch (HL7Exception he) {
378                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
379                throw new RuntimeException(he);
380            }
381            return ret;
382        }
383    
384    
385        /**
386         * Returns a count of the current number of repetitions of Organization Name - LOC (LOC-4).
387         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
388         * it will return zero.
389         */
390        public int getLoc4_OrganizationNameLOCReps() {
391            XON[] ret = null;
392            try {
393                Type[] t = this.getField(4);
394                return t.length;  
395            } catch (ClassCastException cce) {
396                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
397                throw new RuntimeException(cce);
398            } catch (HL7Exception he) {
399                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
400                throw new RuntimeException(he);
401            }
402        }
403    
404    
405    
406        /**
407         * Inserts a repetition of
408         * LOC-4: "Organization Name - LOC" at a specific index
409         *
410         * @param rep The repetition index (0-indexed)
411         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
412         */
413        public XON insertOrganizationNameLOC(int rep) throws HL7Exception { 
414            return (XON) super.insertRepetition(4, rep);
415        }
416    
417    
418    
419        /**
420         * Inserts a repetition of
421         * LOC-4: "Organization Name - LOC" at a specific index
422         *
423         * @param rep The repetition index (0-indexed)
424         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
425         */
426        public XON insertLoc4_OrganizationNameLOC(int rep) throws HL7Exception { 
427            return (XON) super.insertRepetition(4, rep);
428        }
429    
430    
431        /**
432         * Removes a repetition of
433         * LOC-4: "Organization Name - LOC" at a specific index
434         *
435         * @param rep The repetition index (0-indexed)
436         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
437         */
438        public XON removeOrganizationNameLOC(int rep) throws HL7Exception { 
439            return (XON) super.removeRepetition(4, rep);
440        }
441    
442    
443        /**
444         * Removes a repetition of
445         * LOC-4: "Organization Name - LOC" at a specific index
446         *
447         * @param rep The repetition index (0-indexed)
448         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
449         */
450        public XON removeLoc4_OrganizationNameLOC(int rep) throws HL7Exception { 
451            return (XON) super.removeRepetition(4, rep);
452        }
453    
454    
455    
456        /**
457         * Returns all repetitions of Location Address (LOC-5).
458         */
459        public XAD[] getLocationAddress() {
460            XAD[] ret = null;
461            try {
462                Type[] t = this.getField(5);  
463                ret = new XAD[t.length];
464                for (int i = 0; i < ret.length; i++) {
465                    ret[i] = (XAD)t[i];
466                }
467            } catch (ClassCastException cce) {
468                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
469                throw new RuntimeException(cce);
470            } catch (HL7Exception he) {
471                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
472                throw new RuntimeException(he);
473            }
474            return ret;
475        }
476    
477    
478        /**
479         * Returns a count of the current number of repetitions of Location Address (LOC-5).
480         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
481         * it will return zero.
482         */
483        public int getLocationAddressReps() {
484            XAD[] ret = null;
485            try {
486                Type[] t = this.getField(5);
487                return t.length;  
488            } catch (ClassCastException cce) {
489                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
490                throw new RuntimeException(cce);
491            } catch (HL7Exception he) {
492                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
493                throw new RuntimeException(he);
494            }
495        }
496    
497    
498        /**
499         * Returns a specific repetition of
500         * LOC-5: "Location Address" - creates it if necessary
501         *
502         * @param rep The repetition index (0-indexed)
503         */
504        public XAD getLocationAddress(int rep) { 
505            XAD ret = null;
506            try {
507                Type t = this.getField(5, rep);
508                ret = (XAD)t;
509            } catch (ClassCastException cce) {
510                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
511                throw new RuntimeException(cce);
512            } catch (HL7Exception he) {
513                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
514                throw new RuntimeException(he);
515            }
516            return ret;
517        }
518    
519        /**
520         * Returns a specific repetition of
521         * LOC-5: "Location Address" - creates it if necessary
522         *
523         * @param rep The repetition index (0-indexed)
524         */
525        public XAD getLoc5_LocationAddress(int rep) { 
526            XAD ret = null;
527            try {
528                Type t = this.getField(5, rep);
529                ret = (XAD)t;
530            } catch (ClassCastException cce) {
531                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
532                throw new RuntimeException(cce);
533            } catch (HL7Exception he) {
534                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
535                throw new RuntimeException(he);
536            }
537            return ret;
538        }
539    
540    
541        /**
542         * Returns a count of the current number of repetitions of Location Address (LOC-5).
543         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
544         * it will return zero.
545         */
546        public int getLoc5_LocationAddressReps() {
547            XAD[] ret = null;
548            try {
549                Type[] t = this.getField(5);
550                return t.length;  
551            } catch (ClassCastException cce) {
552                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
553                throw new RuntimeException(cce);
554            } catch (HL7Exception he) {
555                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
556                throw new RuntimeException(he);
557            }
558        }
559    
560    
561    
562        /**
563         * Inserts a repetition of
564         * LOC-5: "Location Address" at a specific index
565         *
566         * @param rep The repetition index (0-indexed)
567         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
568         */
569        public XAD insertLocationAddress(int rep) throws HL7Exception { 
570            return (XAD) super.insertRepetition(5, rep);
571        }
572    
573    
574    
575        /**
576         * Inserts a repetition of
577         * LOC-5: "Location Address" at a specific index
578         *
579         * @param rep The repetition index (0-indexed)
580         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
581         */
582        public XAD insertLoc5_LocationAddress(int rep) throws HL7Exception { 
583            return (XAD) super.insertRepetition(5, rep);
584        }
585    
586    
587        /**
588         * Removes a repetition of
589         * LOC-5: "Location Address" at a specific index
590         *
591         * @param rep The repetition index (0-indexed)
592         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
593         */
594        public XAD removeLocationAddress(int rep) throws HL7Exception { 
595            return (XAD) super.removeRepetition(5, rep);
596        }
597    
598    
599        /**
600         * Removes a repetition of
601         * LOC-5: "Location Address" at a specific index
602         *
603         * @param rep The repetition index (0-indexed)
604         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
605         */
606        public XAD removeLoc5_LocationAddress(int rep) throws HL7Exception { 
607            return (XAD) super.removeRepetition(5, rep);
608        }
609    
610    
611    
612        /**
613         * Returns all repetitions of Location Phone (LOC-6).
614         */
615        public XTN[] getLocationPhone() {
616            XTN[] ret = null;
617            try {
618                Type[] t = this.getField(6);  
619                ret = new XTN[t.length];
620                for (int i = 0; i < ret.length; i++) {
621                    ret[i] = (XTN)t[i];
622                }
623            } catch (ClassCastException cce) {
624                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
625                throw new RuntimeException(cce);
626            } catch (HL7Exception he) {
627                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
628                throw new RuntimeException(he);
629            }
630            return ret;
631        }
632    
633    
634        /**
635         * Returns a count of the current number of repetitions of Location Phone (LOC-6).
636         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
637         * it will return zero.
638         */
639        public int getLocationPhoneReps() {
640            XTN[] ret = null;
641            try {
642                Type[] t = this.getField(6);
643                return t.length;  
644            } catch (ClassCastException cce) {
645                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
646                throw new RuntimeException(cce);
647            } catch (HL7Exception he) {
648                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
649                throw new RuntimeException(he);
650            }
651        }
652    
653    
654        /**
655         * Returns a specific repetition of
656         * LOC-6: "Location Phone" - creates it if necessary
657         *
658         * @param rep The repetition index (0-indexed)
659         */
660        public XTN getLocationPhone(int rep) { 
661            XTN ret = null;
662            try {
663                Type t = this.getField(6, rep);
664                ret = (XTN)t;
665            } catch (ClassCastException cce) {
666                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
667                throw new RuntimeException(cce);
668            } catch (HL7Exception he) {
669                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
670                throw new RuntimeException(he);
671            }
672            return ret;
673        }
674    
675        /**
676         * Returns a specific repetition of
677         * LOC-6: "Location Phone" - creates it if necessary
678         *
679         * @param rep The repetition index (0-indexed)
680         */
681        public XTN getLoc6_LocationPhone(int rep) { 
682            XTN ret = null;
683            try {
684                Type t = this.getField(6, rep);
685                ret = (XTN)t;
686            } catch (ClassCastException cce) {
687                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
688                throw new RuntimeException(cce);
689            } catch (HL7Exception he) {
690                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
691                throw new RuntimeException(he);
692            }
693            return ret;
694        }
695    
696    
697        /**
698         * Returns a count of the current number of repetitions of Location Phone (LOC-6).
699         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
700         * it will return zero.
701         */
702        public int getLoc6_LocationPhoneReps() {
703            XTN[] ret = null;
704            try {
705                Type[] t = this.getField(6);
706                return t.length;  
707            } catch (ClassCastException cce) {
708                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
709                throw new RuntimeException(cce);
710            } catch (HL7Exception he) {
711                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
712                throw new RuntimeException(he);
713            }
714        }
715    
716    
717    
718        /**
719         * Inserts a repetition of
720         * LOC-6: "Location Phone" at a specific index
721         *
722         * @param rep The repetition index (0-indexed)
723         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
724         */
725        public XTN insertLocationPhone(int rep) throws HL7Exception { 
726            return (XTN) super.insertRepetition(6, rep);
727        }
728    
729    
730    
731        /**
732         * Inserts a repetition of
733         * LOC-6: "Location Phone" at a specific index
734         *
735         * @param rep The repetition index (0-indexed)
736         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
737         */
738        public XTN insertLoc6_LocationPhone(int rep) throws HL7Exception { 
739            return (XTN) super.insertRepetition(6, rep);
740        }
741    
742    
743        /**
744         * Removes a repetition of
745         * LOC-6: "Location Phone" at a specific index
746         *
747         * @param rep The repetition index (0-indexed)
748         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
749         */
750        public XTN removeLocationPhone(int rep) throws HL7Exception { 
751            return (XTN) super.removeRepetition(6, rep);
752        }
753    
754    
755        /**
756         * Removes a repetition of
757         * LOC-6: "Location Phone" at a specific index
758         *
759         * @param rep The repetition index (0-indexed)
760         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
761         */
762        public XTN removeLoc6_LocationPhone(int rep) throws HL7Exception { 
763            return (XTN) super.removeRepetition(6, rep);
764        }
765    
766    
767    
768        /**
769         * Returns all repetitions of License Number (LOC-7).
770         */
771        public CE[] getLicenseNumber() {
772            CE[] ret = null;
773            try {
774                Type[] t = this.getField(7);  
775                ret = new CE[t.length];
776                for (int i = 0; i < ret.length; i++) {
777                    ret[i] = (CE)t[i];
778                }
779            } catch (ClassCastException cce) {
780                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
781                throw new RuntimeException(cce);
782            } catch (HL7Exception he) {
783                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
784                throw new RuntimeException(he);
785            }
786            return ret;
787        }
788    
789    
790        /**
791         * Returns a count of the current number of repetitions of License Number (LOC-7).
792         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
793         * it will return zero.
794         */
795        public int getLicenseNumberReps() {
796            CE[] ret = null;
797            try {
798                Type[] t = this.getField(7);
799                return t.length;  
800            } catch (ClassCastException cce) {
801                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
802                throw new RuntimeException(cce);
803            } catch (HL7Exception he) {
804                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
805                throw new RuntimeException(he);
806            }
807        }
808    
809    
810        /**
811         * Returns a specific repetition of
812         * LOC-7: "License Number" - creates it if necessary
813         *
814         * @param rep The repetition index (0-indexed)
815         */
816        public CE getLicenseNumber(int rep) { 
817            CE ret = null;
818            try {
819                Type t = this.getField(7, rep);
820                ret = (CE)t;
821            } catch (ClassCastException cce) {
822                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
823                throw new RuntimeException(cce);
824            } catch (HL7Exception he) {
825                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
826                throw new RuntimeException(he);
827            }
828            return ret;
829        }
830    
831        /**
832         * Returns a specific repetition of
833         * LOC-7: "License Number" - creates it if necessary
834         *
835         * @param rep The repetition index (0-indexed)
836         */
837        public CE getLoc7_LicenseNumber(int rep) { 
838            CE ret = null;
839            try {
840                Type t = this.getField(7, rep);
841                ret = (CE)t;
842            } catch (ClassCastException cce) {
843                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
844                throw new RuntimeException(cce);
845            } catch (HL7Exception he) {
846                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
847                throw new RuntimeException(he);
848            }
849            return ret;
850        }
851    
852    
853        /**
854         * Returns a count of the current number of repetitions of License Number (LOC-7).
855         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
856         * it will return zero.
857         */
858        public int getLoc7_LicenseNumberReps() {
859            CE[] ret = null;
860            try {
861                Type[] t = this.getField(7);
862                return t.length;  
863            } catch (ClassCastException cce) {
864                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
865                throw new RuntimeException(cce);
866            } catch (HL7Exception he) {
867                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
868                throw new RuntimeException(he);
869            }
870        }
871    
872    
873    
874        /**
875         * Inserts a repetition of
876         * LOC-7: "License Number" at a specific index
877         *
878         * @param rep The repetition index (0-indexed)
879         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
880         */
881        public CE insertLicenseNumber(int rep) throws HL7Exception { 
882            return (CE) super.insertRepetition(7, rep);
883        }
884    
885    
886    
887        /**
888         * Inserts a repetition of
889         * LOC-7: "License Number" at a specific index
890         *
891         * @param rep The repetition index (0-indexed)
892         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
893         */
894        public CE insertLoc7_LicenseNumber(int rep) throws HL7Exception { 
895            return (CE) super.insertRepetition(7, rep);
896        }
897    
898    
899        /**
900         * Removes a repetition of
901         * LOC-7: "License Number" at a specific index
902         *
903         * @param rep The repetition index (0-indexed)
904         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
905         */
906        public CE removeLicenseNumber(int rep) throws HL7Exception { 
907            return (CE) super.removeRepetition(7, rep);
908        }
909    
910    
911        /**
912         * Removes a repetition of
913         * LOC-7: "License Number" at a specific index
914         *
915         * @param rep The repetition index (0-indexed)
916         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
917         */
918        public CE removeLoc7_LicenseNumber(int rep) throws HL7Exception { 
919            return (CE) super.removeRepetition(7, rep);
920        }
921    
922    
923    
924        /**
925         * Returns all repetitions of Location Equipment (LOC-8).
926         */
927        public IS[] getLocationEquipment() {
928            IS[] ret = null;
929            try {
930                Type[] t = this.getField(8);  
931                ret = new IS[t.length];
932                for (int i = 0; i < ret.length; i++) {
933                    ret[i] = (IS)t[i];
934                }
935            } catch (ClassCastException cce) {
936                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
937                throw new RuntimeException(cce);
938            } catch (HL7Exception he) {
939                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
940                throw new RuntimeException(he);
941            }
942            return ret;
943        }
944    
945    
946        /**
947         * Returns a count of the current number of repetitions of Location Equipment (LOC-8).
948         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
949         * it will return zero.
950         */
951        public int getLocationEquipmentReps() {
952            IS[] ret = null;
953            try {
954                Type[] t = this.getField(8);
955                return t.length;  
956            } catch (ClassCastException cce) {
957                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
958                throw new RuntimeException(cce);
959            } catch (HL7Exception he) {
960                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
961                throw new RuntimeException(he);
962            }
963        }
964    
965    
966        /**
967         * Returns a specific repetition of
968         * LOC-8: "Location Equipment" - creates it if necessary
969         *
970         * @param rep The repetition index (0-indexed)
971         */
972        public IS getLocationEquipment(int rep) { 
973            IS ret = null;
974            try {
975                Type t = this.getField(8, rep);
976                ret = (IS)t;
977            } catch (ClassCastException cce) {
978                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
979                throw new RuntimeException(cce);
980            } catch (HL7Exception he) {
981                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
982                throw new RuntimeException(he);
983            }
984            return ret;
985        }
986    
987        /**
988         * Returns a specific repetition of
989         * LOC-8: "Location Equipment" - creates it if necessary
990         *
991         * @param rep The repetition index (0-indexed)
992         */
993        public IS getLoc8_LocationEquipment(int rep) { 
994            IS ret = null;
995            try {
996                Type t = this.getField(8, rep);
997                ret = (IS)t;
998            } catch (ClassCastException cce) {
999                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1000                throw new RuntimeException(cce);
1001            } catch (HL7Exception he) {
1002                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1003                throw new RuntimeException(he);
1004            }
1005            return ret;
1006        }
1007    
1008    
1009        /**
1010         * Returns a count of the current number of repetitions of Location Equipment (LOC-8).
1011         * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
1012         * it will return zero.
1013         */
1014        public int getLoc8_LocationEquipmentReps() {
1015            IS[] ret = null;
1016            try {
1017                Type[] t = this.getField(8);
1018                return t.length;  
1019            } catch (ClassCastException cce) {
1020                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", cce);
1021                throw new RuntimeException(cce);
1022            } catch (HL7Exception he) {
1023                HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem obtaining field value.  This is a bug.", he);
1024                throw new RuntimeException(he);
1025            }
1026        }
1027    
1028    
1029    
1030        /**
1031         * Inserts a repetition of
1032         * LOC-8: "Location Equipment" at a specific index
1033         *
1034         * @param rep The repetition index (0-indexed)
1035         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1036         */
1037        public IS insertLocationEquipment(int rep) throws HL7Exception { 
1038            return (IS) super.insertRepetition(8, rep);
1039        }
1040    
1041    
1042    
1043        /**
1044         * Inserts a repetition of
1045         * LOC-8: "Location Equipment" at a specific index
1046         *
1047         * @param rep The repetition index (0-indexed)
1048         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1049         */
1050        public IS insertLoc8_LocationEquipment(int rep) throws HL7Exception { 
1051            return (IS) super.insertRepetition(8, rep);
1052        }
1053    
1054    
1055        /**
1056         * Removes a repetition of
1057         * LOC-8: "Location Equipment" at a specific index
1058         *
1059         * @param rep The repetition index (0-indexed)
1060         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1061         */
1062        public IS removeLocationEquipment(int rep) throws HL7Exception { 
1063            return (IS) super.removeRepetition(8, rep);
1064        }
1065    
1066    
1067        /**
1068         * Removes a repetition of
1069         * LOC-8: "Location Equipment" at a specific index
1070         *
1071         * @param rep The repetition index (0-indexed)
1072         * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
1073         */
1074        public IS removeLoc8_LocationEquipment(int rep) throws HL7Exception { 
1075            return (IS) super.removeRepetition(8, rep);
1076        }
1077    
1078    
1079    
1080    
1081    
1082    
1083        /** {@inheritDoc} */   
1084        protected Type createNewTypeWithoutReflection(int field) {
1085           switch (field) {
1086              case 0: return new PL(getMessage());
1087              case 1: return new ST(getMessage());
1088              case 2: return new IS(getMessage(), new Integer( 260 ));
1089              case 3: return new XON(getMessage());
1090              case 4: return new XAD(getMessage());
1091              case 5: return new XTN(getMessage());
1092              case 6: return new CE(getMessage());
1093              case 7: return new IS(getMessage(), new Integer( 261 ));
1094              default: return null;
1095           }
1096       }
1097    
1098    
1099    }
1100