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 "TQ.java".  Description:
015 * "Composite class TQ"
016 * 
017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
018 * 2013.  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
033package ca.uhn.hl7v2.model.v25.datatype;
034
035import ca.uhn.hl7v2.model.DataTypeException;
036import ca.uhn.hl7v2.model.Message;
037import ca.uhn.hl7v2.model.Type;
038import ca.uhn.hl7v2.model.AbstractComposite;
039
040
041/**
042 * <p>Represents an HL7 TQ (Timing Quantity) data type. 
043 * This type consists of the following components:</p>
044 * <ul>
045 * <li>Quantity (CQ)
046 * <li>Interval (RI)
047 * <li>Duration (ST)
048 * <li>Start Date/Time (TS)
049 * <li>End Date/Time (TS)
050 * <li>Priority (ST)
051 * <li>Condition (ST)
052 * <li>Text (TX)
053 * <li>Conjunction (ID)
054 * <li>Order Sequencing (OSD)
055 * <li>Occurrence Duration (CE)
056 * <li>Total Occurrences (NM)
057 * </ul>
058 */
059@SuppressWarnings("unused")
060public class TQ extends AbstractComposite {
061
062    private Type[] data;
063
064    /** 
065     * Creates a new TQ type
066     */
067    public TQ(Message message) {
068        super(message);
069        init();
070    }
071
072    private void init() {
073        data = new Type[12];    
074        data[0] = new CQ(getMessage());
075        data[1] = new RI(getMessage());
076        data[2] = new ST(getMessage());
077        data[3] = new TS(getMessage());
078        data[4] = new TS(getMessage());
079        data[5] = new ST(getMessage());
080        data[6] = new ST(getMessage());
081        data[7] = new TX(getMessage());
082        data[8] = new ID(getMessage(), 472);
083        data[9] = new OSD(getMessage());
084        data[10] = new CE(getMessage());
085        data[11] = new NM(getMessage());
086    }
087
088
089    /**
090     * Returns an array containing the data elements.
091     */
092    public Type[] getComponents() { 
093        return this.data; 
094    }
095
096    /**
097     * Returns an individual data component.
098     *
099     * @param number The component number (0-indexed)
100     * @throws DataTypeException if the given element number is out of range.
101     */
102    public Type getComponent(int number) throws DataTypeException { 
103
104        try { 
105            return this.data[number]; 
106        } catch (ArrayIndexOutOfBoundsException e) { 
107            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
108        } 
109    } 
110
111
112    /**
113     * Returns Quantity (component 1).  This is a convenience method that saves you from 
114     * casting and handling an exception.
115     */
116    public CQ getQuantity() {
117       return getTyped(0, CQ.class);
118    }
119
120    
121    /**
122     * Returns Quantity (component 1).  This is a convenience method that saves you from 
123     * casting and handling an exception.
124     */
125    public CQ getTq1_Quantity() {
126       return getTyped(0, CQ.class);
127    }
128
129
130    /**
131     * Returns Interval (component 2).  This is a convenience method that saves you from 
132     * casting and handling an exception.
133     */
134    public RI getInterval() {
135       return getTyped(1, RI.class);
136    }
137
138    
139    /**
140     * Returns Interval (component 2).  This is a convenience method that saves you from 
141     * casting and handling an exception.
142     */
143    public RI getTq2_Interval() {
144       return getTyped(1, RI.class);
145    }
146
147
148    /**
149     * Returns Duration (component 3).  This is a convenience method that saves you from 
150     * casting and handling an exception.
151     */
152    public ST getDuration() {
153       return getTyped(2, ST.class);
154    }
155
156    
157    /**
158     * Returns Duration (component 3).  This is a convenience method that saves you from 
159     * casting and handling an exception.
160     */
161    public ST getTq3_Duration() {
162       return getTyped(2, ST.class);
163    }
164
165
166    /**
167     * Returns Start Date/Time (component 4).  This is a convenience method that saves you from 
168     * casting and handling an exception.
169     */
170    public TS getStartDateTime() {
171       return getTyped(3, TS.class);
172    }
173
174    
175    /**
176     * Returns Start Date/Time (component 4).  This is a convenience method that saves you from 
177     * casting and handling an exception.
178     */
179    public TS getTq4_StartDateTime() {
180       return getTyped(3, TS.class);
181    }
182
183
184    /**
185     * Returns End Date/Time (component 5).  This is a convenience method that saves you from 
186     * casting and handling an exception.
187     */
188    public TS getEndDateTime() {
189       return getTyped(4, TS.class);
190    }
191
192    
193    /**
194     * Returns End Date/Time (component 5).  This is a convenience method that saves you from 
195     * casting and handling an exception.
196     */
197    public TS getTq5_EndDateTime() {
198       return getTyped(4, TS.class);
199    }
200
201
202    /**
203     * Returns Priority (component 6).  This is a convenience method that saves you from 
204     * casting and handling an exception.
205     */
206    public ST getPriority() {
207       return getTyped(5, ST.class);
208    }
209
210    
211    /**
212     * Returns Priority (component 6).  This is a convenience method that saves you from 
213     * casting and handling an exception.
214     */
215    public ST getTq6_Priority() {
216       return getTyped(5, ST.class);
217    }
218
219
220    /**
221     * Returns Condition (component 7).  This is a convenience method that saves you from 
222     * casting and handling an exception.
223     */
224    public ST getCondition() {
225       return getTyped(6, ST.class);
226    }
227
228    
229    /**
230     * Returns Condition (component 7).  This is a convenience method that saves you from 
231     * casting and handling an exception.
232     */
233    public ST getTq7_Condition() {
234       return getTyped(6, ST.class);
235    }
236
237
238    /**
239     * Returns Text (component 8).  This is a convenience method that saves you from 
240     * casting and handling an exception.
241     */
242    public TX getText() {
243       return getTyped(7, TX.class);
244    }
245
246    
247    /**
248     * Returns Text (component 8).  This is a convenience method that saves you from 
249     * casting and handling an exception.
250     */
251    public TX getTq8_Text() {
252       return getTyped(7, TX.class);
253    }
254
255
256    /**
257     * Returns Conjunction (component 9).  This is a convenience method that saves you from 
258     * casting and handling an exception.
259     */
260    public ID getConjunction() {
261       return getTyped(8, ID.class);
262    }
263
264    
265    /**
266     * Returns Conjunction (component 9).  This is a convenience method that saves you from 
267     * casting and handling an exception.
268     */
269    public ID getTq9_Conjunction() {
270       return getTyped(8, ID.class);
271    }
272
273
274    /**
275     * Returns Order Sequencing (component 10).  This is a convenience method that saves you from 
276     * casting and handling an exception.
277     */
278    public OSD getOrderSequencing() {
279       return getTyped(9, OSD.class);
280    }
281
282    
283    /**
284     * Returns Order Sequencing (component 10).  This is a convenience method that saves you from 
285     * casting and handling an exception.
286     */
287    public OSD getTq10_OrderSequencing() {
288       return getTyped(9, OSD.class);
289    }
290
291
292    /**
293     * Returns Occurrence Duration (component 11).  This is a convenience method that saves you from 
294     * casting and handling an exception.
295     */
296    public CE getOccurrenceDuration() {
297       return getTyped(10, CE.class);
298    }
299
300    
301    /**
302     * Returns Occurrence Duration (component 11).  This is a convenience method that saves you from 
303     * casting and handling an exception.
304     */
305    public CE getTq11_OccurrenceDuration() {
306       return getTyped(10, CE.class);
307    }
308
309
310    /**
311     * Returns Total Occurrences (component 12).  This is a convenience method that saves you from 
312     * casting and handling an exception.
313     */
314    public NM getTotalOccurrences() {
315       return getTyped(11, NM.class);
316    }
317
318    
319    /**
320     * Returns Total Occurrences (component 12).  This is a convenience method that saves you from 
321     * casting and handling an exception.
322     */
323    public NM getTq12_TotalOccurrences() {
324       return getTyped(11, NM.class);
325    }
326
327
328
329}
330