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 XAD (Extended Address) data type. 
042 * This type consists of the following components:</p>
043 * <ul>
044 * <li>Street Address (SAD)
045 * <li>Other Designation (ST)
046 * <li>City (ST)
047 * <li>State or Province (ST)
048 * <li>Zip or Postal Code (ST)
049 * <li>Country (ID)
050 * <li>Address Type (ID)
051 * <li>Other Geographic Designation (ST)
052 * <li>County/Parish Code (IS)
053 * <li>Census Tract (IS)
054 * <li>Address Representation Code (ID)
055 * <li>Address Validity Range (DR)
056 * <li>Effective Date (TS)
057 * <li>Expiration Date (TS)
058 * </ul>
059 */
060@SuppressWarnings("unused")
061public class XAD extends AbstractComposite {
062
063    private Type[] data;
064
065    /** 
066     * Creates a new XAD type
067     */
068    public XAD(Message message) {
069        super(message);
070        init();
071    }
072
073    private void init() {
074        data = new Type[14];    
075        data[0] = new SAD(getMessage());
076        data[1] = new ST(getMessage());
077        data[2] = new ST(getMessage());
078        data[3] = new ST(getMessage());
079        data[4] = new ST(getMessage());
080        data[5] = new ID(getMessage(), 399);
081        data[6] = new ID(getMessage(), 190);
082        data[7] = new ST(getMessage());
083        data[8] = new IS(getMessage(), 289);
084        data[9] = new IS(getMessage(), 288);
085        data[10] = new ID(getMessage(), 465);
086        data[11] = new DR(getMessage());
087        data[12] = new TS(getMessage());
088        data[13] = new TS(getMessage());
089    }
090
091
092    /**
093     * Returns an array containing the data elements.
094     */
095    public Type[] getComponents() { 
096        return this.data; 
097    }
098
099    /**
100     * Returns an individual data component.
101     *
102     * @param number The component number (0-indexed)
103     * @throws DataTypeException if the given element number is out of range.
104     */
105    public Type getComponent(int number) throws DataTypeException { 
106
107        try { 
108            return this.data[number]; 
109        } catch (ArrayIndexOutOfBoundsException e) { 
110            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
111        } 
112    } 
113
114
115    /**
116     * Returns Street Address (component 1).  This is a convenience method that saves you from 
117     * casting and handling an exception.
118     */
119    public SAD getStreetAddress() {
120       return getTyped(0, SAD.class);
121    }
122
123    
124    /**
125     * Returns Street Address (component 1).  This is a convenience method that saves you from 
126     * casting and handling an exception.
127     */
128    public SAD getXad1_StreetAddress() {
129       return getTyped(0, SAD.class);
130    }
131
132
133    /**
134     * Returns Other Designation (component 2).  This is a convenience method that saves you from 
135     * casting and handling an exception.
136     */
137    public ST getOtherDesignation() {
138       return getTyped(1, ST.class);
139    }
140
141    
142    /**
143     * Returns Other Designation (component 2).  This is a convenience method that saves you from 
144     * casting and handling an exception.
145     */
146    public ST getXad2_OtherDesignation() {
147       return getTyped(1, ST.class);
148    }
149
150
151    /**
152     * Returns City (component 3).  This is a convenience method that saves you from 
153     * casting and handling an exception.
154     */
155    public ST getCity() {
156       return getTyped(2, ST.class);
157    }
158
159    
160    /**
161     * Returns City (component 3).  This is a convenience method that saves you from 
162     * casting and handling an exception.
163     */
164    public ST getXad3_City() {
165       return getTyped(2, ST.class);
166    }
167
168
169    /**
170     * Returns State or Province (component 4).  This is a convenience method that saves you from 
171     * casting and handling an exception.
172     */
173    public ST getStateOrProvince() {
174       return getTyped(3, ST.class);
175    }
176
177    
178    /**
179     * Returns State or Province (component 4).  This is a convenience method that saves you from 
180     * casting and handling an exception.
181     */
182    public ST getXad4_StateOrProvince() {
183       return getTyped(3, ST.class);
184    }
185
186
187    /**
188     * Returns Zip or Postal Code (component 5).  This is a convenience method that saves you from 
189     * casting and handling an exception.
190     */
191    public ST getZipOrPostalCode() {
192       return getTyped(4, ST.class);
193    }
194
195    
196    /**
197     * Returns Zip or Postal Code (component 5).  This is a convenience method that saves you from 
198     * casting and handling an exception.
199     */
200    public ST getXad5_ZipOrPostalCode() {
201       return getTyped(4, ST.class);
202    }
203
204
205    /**
206     * Returns Country (component 6).  This is a convenience method that saves you from 
207     * casting and handling an exception.
208     */
209    public ID getCountry() {
210       return getTyped(5, ID.class);
211    }
212
213    
214    /**
215     * Returns Country (component 6).  This is a convenience method that saves you from 
216     * casting and handling an exception.
217     */
218    public ID getXad6_Country() {
219       return getTyped(5, ID.class);
220    }
221
222
223    /**
224     * Returns Address Type (component 7).  This is a convenience method that saves you from 
225     * casting and handling an exception.
226     */
227    public ID getAddressType() {
228       return getTyped(6, ID.class);
229    }
230
231    
232    /**
233     * Returns Address Type (component 7).  This is a convenience method that saves you from 
234     * casting and handling an exception.
235     */
236    public ID getXad7_AddressType() {
237       return getTyped(6, ID.class);
238    }
239
240
241    /**
242     * Returns Other Geographic Designation (component 8).  This is a convenience method that saves you from 
243     * casting and handling an exception.
244     */
245    public ST getOtherGeographicDesignation() {
246       return getTyped(7, ST.class);
247    }
248
249    
250    /**
251     * Returns Other Geographic Designation (component 8).  This is a convenience method that saves you from 
252     * casting and handling an exception.
253     */
254    public ST getXad8_OtherGeographicDesignation() {
255       return getTyped(7, ST.class);
256    }
257
258
259    /**
260     * Returns County/Parish Code (component 9).  This is a convenience method that saves you from 
261     * casting and handling an exception.
262     */
263    public IS getCountyParishCode() {
264       return getTyped(8, IS.class);
265    }
266
267    
268    /**
269     * Returns County/Parish Code (component 9).  This is a convenience method that saves you from 
270     * casting and handling an exception.
271     */
272    public IS getXad9_CountyParishCode() {
273       return getTyped(8, IS.class);
274    }
275
276
277    /**
278     * Returns Census Tract (component 10).  This is a convenience method that saves you from 
279     * casting and handling an exception.
280     */
281    public IS getCensusTract() {
282       return getTyped(9, IS.class);
283    }
284
285    
286    /**
287     * Returns Census Tract (component 10).  This is a convenience method that saves you from 
288     * casting and handling an exception.
289     */
290    public IS getXad10_CensusTract() {
291       return getTyped(9, IS.class);
292    }
293
294
295    /**
296     * Returns Address Representation Code (component 11).  This is a convenience method that saves you from 
297     * casting and handling an exception.
298     */
299    public ID getAddressRepresentationCode() {
300       return getTyped(10, ID.class);
301    }
302
303    
304    /**
305     * Returns Address Representation Code (component 11).  This is a convenience method that saves you from 
306     * casting and handling an exception.
307     */
308    public ID getXad11_AddressRepresentationCode() {
309       return getTyped(10, ID.class);
310    }
311
312
313    /**
314     * Returns Address Validity Range (component 12).  This is a convenience method that saves you from 
315     * casting and handling an exception.
316     */
317    public DR getAddressValidityRange() {
318       return getTyped(11, DR.class);
319    }
320
321    
322    /**
323     * Returns Address Validity Range (component 12).  This is a convenience method that saves you from 
324     * casting and handling an exception.
325     */
326    public DR getXad12_AddressValidityRange() {
327       return getTyped(11, DR.class);
328    }
329
330
331    /**
332     * Returns Effective Date (component 13).  This is a convenience method that saves you from 
333     * casting and handling an exception.
334     */
335    public TS getEffectiveDate() {
336       return getTyped(12, TS.class);
337    }
338
339    
340    /**
341     * Returns Effective Date (component 13).  This is a convenience method that saves you from 
342     * casting and handling an exception.
343     */
344    public TS getXad13_EffectiveDate() {
345       return getTyped(12, TS.class);
346    }
347
348
349    /**
350     * Returns Expiration Date (component 14).  This is a convenience method that saves you from 
351     * casting and handling an exception.
352     */
353    public TS getExpirationDate() {
354       return getTyped(13, TS.class);
355    }
356
357    
358    /**
359     * Returns Expiration Date (component 14).  This is a convenience method that saves you from 
360     * casting and handling an exception.
361     */
362    public TS getXad14_ExpirationDate() {
363       return getTyped(13, TS.class);
364    }
365
366
367
368}
369