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