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.v22.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_QUANTITY)
045 * <li>interval (CM_RI)
046 * <li>duration (ST)
047 * <li>start date/time (TS)
048 * <li>end date/time (TS)
049 * <li>priority (ID)
050 * <li>condition (ST)
051 * <li>text (TX) (TX)
052 * <li>conjunction (ID)
053 * <li>order sequencing (ST)
054 * </ul>
055 */
056@SuppressWarnings("unused")
057public class TQ extends AbstractComposite {
058
059    private Type[] data;
060
061    /** 
062     * Creates a new TQ type
063     */
064    public TQ(Message message) {
065        super(message);
066        init();
067    }
068
069    private void init() {
070        data = new Type[10];    
071        data[0] = new CQ_QUANTITY(getMessage());
072        data[1] = new CM_RI(getMessage());
073        data[2] = new ST(getMessage());
074        data[3] = new TS(getMessage());
075        data[4] = new TS(getMessage());
076        data[5] = new ID(getMessage(), 0);
077        data[6] = new ST(getMessage());
078        data[7] = new TX(getMessage());
079        data[8] = new ID(getMessage(), 0);
080        data[9] = new ST(getMessage());
081    }
082
083
084    /**
085     * Returns an array containing the data elements.
086     */
087    public Type[] getComponents() { 
088        return this.data; 
089    }
090
091    /**
092     * Returns an individual data component.
093     *
094     * @param number The component number (0-indexed)
095     * @throws DataTypeException if the given element number is out of range.
096     */
097    public Type getComponent(int number) throws DataTypeException { 
098
099        try { 
100            return this.data[number]; 
101        } catch (ArrayIndexOutOfBoundsException e) { 
102            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
103        } 
104    } 
105
106
107    /**
108     * Returns Quantity (component 1).  This is a convenience method that saves you from 
109     * casting and handling an exception.
110     */
111    public CQ_QUANTITY getQuantity() {
112       return getTyped(0, CQ_QUANTITY.class);
113    }
114
115    
116    /**
117     * Returns Quantity (component 1).  This is a convenience method that saves you from 
118     * casting and handling an exception.
119     */
120    public CQ_QUANTITY getTq1_Quantity() {
121       return getTyped(0, CQ_QUANTITY.class);
122    }
123
124
125    /**
126     * Returns interval (component 2).  This is a convenience method that saves you from 
127     * casting and handling an exception.
128     */
129    public CM_RI getInterval() {
130       return getTyped(1, CM_RI.class);
131    }
132
133    
134    /**
135     * Returns interval (component 2).  This is a convenience method that saves you from 
136     * casting and handling an exception.
137     */
138    public CM_RI getTq2_Interval() {
139       return getTyped(1, CM_RI.class);
140    }
141
142
143    /**
144     * Returns duration (component 3).  This is a convenience method that saves you from 
145     * casting and handling an exception.
146     */
147    public ST getDuration() {
148       return getTyped(2, ST.class);
149    }
150
151    
152    /**
153     * Returns duration (component 3).  This is a convenience method that saves you from 
154     * casting and handling an exception.
155     */
156    public ST getTq3_Duration() {
157       return getTyped(2, ST.class);
158    }
159
160
161    /**
162     * Returns start date/time (component 4).  This is a convenience method that saves you from 
163     * casting and handling an exception.
164     */
165    public TS getStartDateTime() {
166       return getTyped(3, TS.class);
167    }
168
169    
170    /**
171     * Returns start date/time (component 4).  This is a convenience method that saves you from 
172     * casting and handling an exception.
173     */
174    public TS getTq4_StartDateTime() {
175       return getTyped(3, TS.class);
176    }
177
178
179    /**
180     * Returns end date/time (component 5).  This is a convenience method that saves you from 
181     * casting and handling an exception.
182     */
183    public TS getEndDateTime() {
184       return getTyped(4, TS.class);
185    }
186
187    
188    /**
189     * Returns end date/time (component 5).  This is a convenience method that saves you from 
190     * casting and handling an exception.
191     */
192    public TS getTq5_EndDateTime() {
193       return getTyped(4, TS.class);
194    }
195
196
197    /**
198     * Returns priority (component 6).  This is a convenience method that saves you from 
199     * casting and handling an exception.
200     */
201    public ID getPriority() {
202       return getTyped(5, ID.class);
203    }
204
205    
206    /**
207     * Returns priority (component 6).  This is a convenience method that saves you from 
208     * casting and handling an exception.
209     */
210    public ID getTq6_Priority() {
211       return getTyped(5, ID.class);
212    }
213
214
215    /**
216     * Returns condition (component 7).  This is a convenience method that saves you from 
217     * casting and handling an exception.
218     */
219    public ST getCondition() {
220       return getTyped(6, ST.class);
221    }
222
223    
224    /**
225     * Returns condition (component 7).  This is a convenience method that saves you from 
226     * casting and handling an exception.
227     */
228    public ST getTq7_Condition() {
229       return getTyped(6, ST.class);
230    }
231
232
233    /**
234     * Returns text (TX) (component 8).  This is a convenience method that saves you from 
235     * casting and handling an exception.
236     */
237    public TX getText() {
238       return getTyped(7, TX.class);
239    }
240
241    
242    /**
243     * Returns text (TX) (component 8).  This is a convenience method that saves you from 
244     * casting and handling an exception.
245     */
246    public TX getTq8_Text() {
247       return getTyped(7, TX.class);
248    }
249
250
251    /**
252     * Returns conjunction (component 9).  This is a convenience method that saves you from 
253     * casting and handling an exception.
254     */
255    public ID getConjunction() {
256       return getTyped(8, ID.class);
257    }
258
259    
260    /**
261     * Returns conjunction (component 9).  This is a convenience method that saves you from 
262     * casting and handling an exception.
263     */
264    public ID getTq9_Conjunction() {
265       return getTyped(8, ID.class);
266    }
267
268
269    /**
270     * Returns order sequencing (component 10).  This is a convenience method that saves you from 
271     * casting and handling an exception.
272     */
273    public ST getOrderSequencing() {
274       return getTyped(9, ST.class);
275    }
276
277    
278    /**
279     * Returns order sequencing (component 10).  This is a convenience method that saves you from 
280     * casting and handling an exception.
281     */
282    public ST getTq10_OrderSequencing() {
283       return getTyped(9, ST.class);
284    }
285
286
287
288}
289