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