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 * The contents of this file are subject to the Mozilla Public License Version 1.1 
008 * (the "License"); you may not use this file except in compliance with the License. 
009 * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
010 * Software distributed under the License is distributed on an "AS IS" basis, 
011 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
012 * specific language governing rights and limitations under the License. 
013 * 
014 * The Original Code is "[file_name]".  Description: 
015 * "[one_line_description]" 
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2012.  All Rights Reserved. 
019 * 
020 * Contributor(s): ______________________________________. 
021 * 
022 * Alternatively, the contents of this file may be used under the terms of the 
023 * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
024 * applicable instead of those above.  If you wish to allow use of your version of this 
025 * file only under the terms of the GPL and not to allow others to use your version 
026 * of this file under the MPL, indicate your decision by deleting  the provisions above 
027 * and replace  them with the notice and other provisions required by the GPL License.  
028 * If you do not delete the provisions above, a recipient may use your version of 
029 * this file under either the MPL or the GPL. 
030 * 
031 */
032
033
034package ca.uhn.hl7v2.model.v26.segment;
035
036// import ca.uhn.hl7v2.model.v26.group.*;
037import ca.uhn.hl7v2.model.v26.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047/**
048 *<p>Represents an HL7 TQ2 message segment (Timing/Quantity Relationship). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>TQ2-1: Set ID - TQ2 (SI) <b>optional </b>
052     * <li>TQ2-2: Sequence/Results Flag (ID) <b>optional </b>
053     * <li>TQ2-3: Related Placer Number (EI) <b>optional repeating</b>
054     * <li>TQ2-4: Related Filler Number (EI) <b>optional repeating</b>
055     * <li>TQ2-5: Related Placer Group Number (EI) <b>optional repeating</b>
056     * <li>TQ2-6: Sequence Condition Code (ID) <b>optional </b>
057     * <li>TQ2-7: Cyclic Entry/Exit Indicator (ID) <b>optional </b>
058     * <li>TQ2-8: Sequence Condition Time Interval (CQ) <b>optional </b>
059     * <li>TQ2-9: Cyclic Group Maximum Number of Repeats (NM) <b>optional </b>
060     * <li>TQ2-10: Special Service Request Relationship (ID) <b>optional </b>
061 * </ul>
062 */
063@SuppressWarnings("unused")
064public class TQ2 extends AbstractSegment {
065
066    /** 
067     * Creates a new TQ2 segment
068     */
069    public TQ2(Group parent, ModelClassFactory factory) {
070       super(parent, factory);
071       init(factory);
072    }
073
074    private void init(ModelClassFactory factory) {
075       try {
076                                  this.add(SI.class, false, 1, 4, new Object[]{ getMessage() }, "Set ID - TQ2");
077                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(503) }, "Sequence/Results Flag");
078                                  this.add(EI.class, false, 0, 22, new Object[]{ getMessage() }, "Related Placer Number");
079                                  this.add(EI.class, false, 0, 22, new Object[]{ getMessage() }, "Related Filler Number");
080                                  this.add(EI.class, false, 0, 22, new Object[]{ getMessage() }, "Related Placer Group Number");
081                                              this.add(ID.class, false, 1, 2, new Object[]{ getMessage(), new Integer(504) }, "Sequence Condition Code");
082                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(505) }, "Cyclic Entry/Exit Indicator");
083                                  this.add(CQ.class, false, 1, 20, new Object[]{ getMessage() }, "Sequence Condition Time Interval");
084                                  this.add(NM.class, false, 1, 10, new Object[]{ getMessage() }, "Cyclic Group Maximum Number of Repeats");
085                                              this.add(ID.class, false, 1, 1, new Object[]{ getMessage(), new Integer(506) }, "Special Service Request Relationship");
086       } catch(HL7Exception e) {
087          log.error("Unexpected error creating TQ2 - this is probably a bug in the source code generator.", e);
088       }
089    }
090
091
092
093    /**
094     * Returns
095     * TQ2-1: "Set ID - TQ2" - creates it if necessary
096     */
097    public SI getSetIDTQ2() { 
098                SI retVal = this.getTypedField(1, 0);
099                return retVal;
100    }
101    
102    /**
103     * Returns
104     * TQ2-1: "Set ID - TQ2" - creates it if necessary
105     */
106    public SI getTq21_SetIDTQ2() { 
107                SI retVal = this.getTypedField(1, 0);
108                return retVal;
109    }
110
111
112
113    /**
114     * Returns
115     * TQ2-2: "Sequence/Results Flag" - creates it if necessary
116     */
117    public ID getSequenceResultsFlag() { 
118                ID retVal = this.getTypedField(2, 0);
119                return retVal;
120    }
121    
122    /**
123     * Returns
124     * TQ2-2: "Sequence/Results Flag" - creates it if necessary
125     */
126    public ID getTq22_SequenceResultsFlag() { 
127                ID retVal = this.getTypedField(2, 0);
128                return retVal;
129    }
130
131
132    /**
133     * Returns all repetitions of Related Placer Number (TQ2-3).
134     */
135    public EI[] getRelatedPlacerNumber() {
136        EI[] retVal = this.getTypedField(3, new EI[0]);
137        return retVal;
138    }
139
140
141    /**
142     * Returns all repetitions of Related Placer Number (TQ2-3).
143     */
144    public EI[] getTq23_RelatedPlacerNumber() {
145        EI[] retVal = this.getTypedField(3, new EI[0]);
146        return retVal;
147    }
148
149
150    /**
151     * Returns a count of the current number of repetitions of Related Placer Number (TQ2-3).
152     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
153     * it will return zero.
154     */
155    public int getRelatedPlacerNumberReps() {
156        return this.getReps(3);
157    }
158
159
160    /**
161     * Returns a specific repetition of
162     * TQ2-3: "Related Placer Number" - creates it if necessary
163     *
164     * @param rep The repetition index (0-indexed)
165     */
166    public EI getRelatedPlacerNumber(int rep) { 
167                EI retVal = this.getTypedField(3, rep);
168                return retVal;
169    }
170
171    /**
172     * Returns a specific repetition of
173     * TQ2-3: "Related Placer Number" - creates it if necessary
174     *
175     * @param rep The repetition index (0-indexed)
176     */
177    public EI getTq23_RelatedPlacerNumber(int rep) { 
178                EI retVal = this.getTypedField(3, rep);
179                return retVal;
180    }
181
182    /**
183     * Returns a count of the current number of repetitions of Related Placer Number (TQ2-3).
184     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
185     * it will return zero.
186     */
187    public int getTq23_RelatedPlacerNumberReps() {
188        return this.getReps(3);
189    }
190
191
192    /**
193     * Inserts a repetition of
194     * TQ2-3: "Related Placer Number" at a specific index
195     *
196     * @param rep The repetition index (0-indexed)
197     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
198     */
199    public EI insertRelatedPlacerNumber(int rep) throws HL7Exception { 
200        return (EI) super.insertRepetition(3, rep);
201    }
202
203
204    /**
205     * Inserts a repetition of
206     * TQ2-3: "Related Placer Number" at a specific index
207     *
208     * @param rep The repetition index (0-indexed)
209     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
210     */
211    public EI insertTq23_RelatedPlacerNumber(int rep) throws HL7Exception { 
212        return (EI) super.insertRepetition(3, rep);
213    }
214
215
216    /**
217     * Removes a repetition of
218     * TQ2-3: "Related Placer Number" at a specific index
219     *
220     * @param rep The repetition index (0-indexed)
221     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
222     */
223    public EI removeRelatedPlacerNumber(int rep) throws HL7Exception { 
224        return (EI) super.removeRepetition(3, rep);
225    }
226
227
228    /**
229     * Removes a repetition of
230     * TQ2-3: "Related Placer Number" at a specific index
231     *
232     * @param rep The repetition index (0-indexed)
233     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
234     */
235    public EI removeTq23_RelatedPlacerNumber(int rep) throws HL7Exception { 
236        return (EI) super.removeRepetition(3, rep);
237    }
238
239
240
241    /**
242     * Returns all repetitions of Related Filler Number (TQ2-4).
243     */
244    public EI[] getRelatedFillerNumber() {
245        EI[] retVal = this.getTypedField(4, new EI[0]);
246        return retVal;
247    }
248
249
250    /**
251     * Returns all repetitions of Related Filler Number (TQ2-4).
252     */
253    public EI[] getTq24_RelatedFillerNumber() {
254        EI[] retVal = this.getTypedField(4, new EI[0]);
255        return retVal;
256    }
257
258
259    /**
260     * Returns a count of the current number of repetitions of Related Filler Number (TQ2-4).
261     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
262     * it will return zero.
263     */
264    public int getRelatedFillerNumberReps() {
265        return this.getReps(4);
266    }
267
268
269    /**
270     * Returns a specific repetition of
271     * TQ2-4: "Related Filler Number" - creates it if necessary
272     *
273     * @param rep The repetition index (0-indexed)
274     */
275    public EI getRelatedFillerNumber(int rep) { 
276                EI retVal = this.getTypedField(4, rep);
277                return retVal;
278    }
279
280    /**
281     * Returns a specific repetition of
282     * TQ2-4: "Related Filler Number" - creates it if necessary
283     *
284     * @param rep The repetition index (0-indexed)
285     */
286    public EI getTq24_RelatedFillerNumber(int rep) { 
287                EI retVal = this.getTypedField(4, rep);
288                return retVal;
289    }
290
291    /**
292     * Returns a count of the current number of repetitions of Related Filler Number (TQ2-4).
293     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
294     * it will return zero.
295     */
296    public int getTq24_RelatedFillerNumberReps() {
297        return this.getReps(4);
298    }
299
300
301    /**
302     * Inserts a repetition of
303     * TQ2-4: "Related Filler Number" at a specific index
304     *
305     * @param rep The repetition index (0-indexed)
306     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
307     */
308    public EI insertRelatedFillerNumber(int rep) throws HL7Exception { 
309        return (EI) super.insertRepetition(4, rep);
310    }
311
312
313    /**
314     * Inserts a repetition of
315     * TQ2-4: "Related Filler Number" at a specific index
316     *
317     * @param rep The repetition index (0-indexed)
318     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
319     */
320    public EI insertTq24_RelatedFillerNumber(int rep) throws HL7Exception { 
321        return (EI) super.insertRepetition(4, rep);
322    }
323
324
325    /**
326     * Removes a repetition of
327     * TQ2-4: "Related Filler Number" at a specific index
328     *
329     * @param rep The repetition index (0-indexed)
330     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
331     */
332    public EI removeRelatedFillerNumber(int rep) throws HL7Exception { 
333        return (EI) super.removeRepetition(4, rep);
334    }
335
336
337    /**
338     * Removes a repetition of
339     * TQ2-4: "Related Filler Number" at a specific index
340     *
341     * @param rep The repetition index (0-indexed)
342     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
343     */
344    public EI removeTq24_RelatedFillerNumber(int rep) throws HL7Exception { 
345        return (EI) super.removeRepetition(4, rep);
346    }
347
348
349
350    /**
351     * Returns all repetitions of Related Placer Group Number (TQ2-5).
352     */
353    public EI[] getRelatedPlacerGroupNumber() {
354        EI[] retVal = this.getTypedField(5, new EI[0]);
355        return retVal;
356    }
357
358
359    /**
360     * Returns all repetitions of Related Placer Group Number (TQ2-5).
361     */
362    public EI[] getTq25_RelatedPlacerGroupNumber() {
363        EI[] retVal = this.getTypedField(5, new EI[0]);
364        return retVal;
365    }
366
367
368    /**
369     * Returns a count of the current number of repetitions of Related Placer Group Number (TQ2-5).
370     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
371     * it will return zero.
372     */
373    public int getRelatedPlacerGroupNumberReps() {
374        return this.getReps(5);
375    }
376
377
378    /**
379     * Returns a specific repetition of
380     * TQ2-5: "Related Placer Group Number" - creates it if necessary
381     *
382     * @param rep The repetition index (0-indexed)
383     */
384    public EI getRelatedPlacerGroupNumber(int rep) { 
385                EI retVal = this.getTypedField(5, rep);
386                return retVal;
387    }
388
389    /**
390     * Returns a specific repetition of
391     * TQ2-5: "Related Placer Group Number" - creates it if necessary
392     *
393     * @param rep The repetition index (0-indexed)
394     */
395    public EI getTq25_RelatedPlacerGroupNumber(int rep) { 
396                EI retVal = this.getTypedField(5, rep);
397                return retVal;
398    }
399
400    /**
401     * Returns a count of the current number of repetitions of Related Placer Group Number (TQ2-5).
402     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
403     * it will return zero.
404     */
405    public int getTq25_RelatedPlacerGroupNumberReps() {
406        return this.getReps(5);
407    }
408
409
410    /**
411     * Inserts a repetition of
412     * TQ2-5: "Related Placer Group Number" at a specific index
413     *
414     * @param rep The repetition index (0-indexed)
415     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
416     */
417    public EI insertRelatedPlacerGroupNumber(int rep) throws HL7Exception { 
418        return (EI) super.insertRepetition(5, rep);
419    }
420
421
422    /**
423     * Inserts a repetition of
424     * TQ2-5: "Related Placer Group Number" at a specific index
425     *
426     * @param rep The repetition index (0-indexed)
427     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
428     */
429    public EI insertTq25_RelatedPlacerGroupNumber(int rep) throws HL7Exception { 
430        return (EI) super.insertRepetition(5, rep);
431    }
432
433
434    /**
435     * Removes a repetition of
436     * TQ2-5: "Related Placer Group Number" at a specific index
437     *
438     * @param rep The repetition index (0-indexed)
439     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
440     */
441    public EI removeRelatedPlacerGroupNumber(int rep) throws HL7Exception { 
442        return (EI) super.removeRepetition(5, rep);
443    }
444
445
446    /**
447     * Removes a repetition of
448     * TQ2-5: "Related Placer Group Number" at a specific index
449     *
450     * @param rep The repetition index (0-indexed)
451     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
452     */
453    public EI removeTq25_RelatedPlacerGroupNumber(int rep) throws HL7Exception { 
454        return (EI) super.removeRepetition(5, rep);
455    }
456
457
458
459
460    /**
461     * Returns
462     * TQ2-6: "Sequence Condition Code" - creates it if necessary
463     */
464    public ID getSequenceConditionCode() { 
465                ID retVal = this.getTypedField(6, 0);
466                return retVal;
467    }
468    
469    /**
470     * Returns
471     * TQ2-6: "Sequence Condition Code" - creates it if necessary
472     */
473    public ID getTq26_SequenceConditionCode() { 
474                ID retVal = this.getTypedField(6, 0);
475                return retVal;
476    }
477
478
479
480    /**
481     * Returns
482     * TQ2-7: "Cyclic Entry/Exit Indicator" - creates it if necessary
483     */
484    public ID getCyclicEntryExitIndicator() { 
485                ID retVal = this.getTypedField(7, 0);
486                return retVal;
487    }
488    
489    /**
490     * Returns
491     * TQ2-7: "Cyclic Entry/Exit Indicator" - creates it if necessary
492     */
493    public ID getTq27_CyclicEntryExitIndicator() { 
494                ID retVal = this.getTypedField(7, 0);
495                return retVal;
496    }
497
498
499
500    /**
501     * Returns
502     * TQ2-8: "Sequence Condition Time Interval" - creates it if necessary
503     */
504    public CQ getSequenceConditionTimeInterval() { 
505                CQ retVal = this.getTypedField(8, 0);
506                return retVal;
507    }
508    
509    /**
510     * Returns
511     * TQ2-8: "Sequence Condition Time Interval" - creates it if necessary
512     */
513    public CQ getTq28_SequenceConditionTimeInterval() { 
514                CQ retVal = this.getTypedField(8, 0);
515                return retVal;
516    }
517
518
519
520    /**
521     * Returns
522     * TQ2-9: "Cyclic Group Maximum Number of Repeats" - creates it if necessary
523     */
524    public NM getCyclicGroupMaximumNumberOfRepeats() { 
525                NM retVal = this.getTypedField(9, 0);
526                return retVal;
527    }
528    
529    /**
530     * Returns
531     * TQ2-9: "Cyclic Group Maximum Number of Repeats" - creates it if necessary
532     */
533    public NM getTq29_CyclicGroupMaximumNumberOfRepeats() { 
534                NM retVal = this.getTypedField(9, 0);
535                return retVal;
536    }
537
538
539
540    /**
541     * Returns
542     * TQ2-10: "Special Service Request Relationship" - creates it if necessary
543     */
544    public ID getSpecialServiceRequestRelationship() { 
545                ID retVal = this.getTypedField(10, 0);
546                return retVal;
547    }
548    
549    /**
550     * Returns
551     * TQ2-10: "Special Service Request Relationship" - creates it if necessary
552     */
553    public ID getTq210_SpecialServiceRequestRelationship() { 
554                ID retVal = this.getTypedField(10, 0);
555                return retVal;
556    }
557
558
559
560
561
562    /** {@inheritDoc} */   
563    protected Type createNewTypeWithoutReflection(int field) {
564       switch (field) {
565          case 0: return new SI(getMessage());
566          case 1: return new ID(getMessage(), new Integer( 503 ));
567          case 2: return new EI(getMessage());
568          case 3: return new EI(getMessage());
569          case 4: return new EI(getMessage());
570          case 5: return new ID(getMessage(), new Integer( 504 ));
571          case 6: return new ID(getMessage(), new Integer( 505 ));
572          case 7: return new CQ(getMessage());
573          case 8: return new NM(getMessage());
574          case 9: return new ID(getMessage(), new Integer( 506 ));
575          default: return null;
576       }
577   }
578
579
580}
581