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