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