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.v24.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) (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 * </ul>
057 */
058@SuppressWarnings("unused")
059public class XAD extends AbstractComposite {
060
061    private Type[] data;
062
063    /** 
064     * Creates a new XAD type
065     */
066    public XAD(Message message) {
067        super(message);
068        init();
069    }
070
071    private void init() {
072        data = new Type[12];    
073        data[0] = new SAD(getMessage());
074        data[1] = new ST(getMessage());
075        data[2] = new ST(getMessage());
076        data[3] = new ST(getMessage());
077        data[4] = new ST(getMessage());
078        data[5] = new ID(getMessage(), 0);
079        data[6] = new ID(getMessage(), 0);
080        data[7] = new ST(getMessage());
081        data[8] = new IS(getMessage(), 0);
082        data[9] = new IS(getMessage(), 0);
083        data[10] = new ID(getMessage(), 0);
084        data[11] = new DR(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 street address (SAD) (component 1).  This is a convenience method that saves you from 
113     * casting and handling an exception.
114     */
115    public SAD getStreetAddress() {
116       return getTyped(0, SAD.class);
117    }
118
119    
120    /**
121     * Returns street address (SAD) (component 1).  This is a convenience method that saves you from 
122     * casting and handling an exception.
123     */
124    public SAD getXad1_StreetAddress() {
125       return getTyped(0, SAD.class);
126    }
127
128
129    /**
130     * Returns other designation (component 2).  This is a convenience method that saves you from 
131     * casting and handling an exception.
132     */
133    public ST getOtherDesignation() {
134       return getTyped(1, ST.class);
135    }
136
137    
138    /**
139     * Returns other designation (component 2).  This is a convenience method that saves you from 
140     * casting and handling an exception.
141     */
142    public ST getXad2_OtherDesignation() {
143       return getTyped(1, ST.class);
144    }
145
146
147    /**
148     * Returns city (component 3).  This is a convenience method that saves you from 
149     * casting and handling an exception.
150     */
151    public ST getCity() {
152       return getTyped(2, ST.class);
153    }
154
155    
156    /**
157     * Returns city (component 3).  This is a convenience method that saves you from 
158     * casting and handling an exception.
159     */
160    public ST getXad3_City() {
161       return getTyped(2, ST.class);
162    }
163
164
165    /**
166     * Returns state or province (component 4).  This is a convenience method that saves you from 
167     * casting and handling an exception.
168     */
169    public ST getStateOrProvince() {
170       return getTyped(3, ST.class);
171    }
172
173    
174    /**
175     * Returns state or province (component 4).  This is a convenience method that saves you from 
176     * casting and handling an exception.
177     */
178    public ST getXad4_StateOrProvince() {
179       return getTyped(3, ST.class);
180    }
181
182
183    /**
184     * Returns zip or postal code (component 5).  This is a convenience method that saves you from 
185     * casting and handling an exception.
186     */
187    public ST getZipOrPostalCode() {
188       return getTyped(4, ST.class);
189    }
190
191    
192    /**
193     * Returns zip or postal code (component 5).  This is a convenience method that saves you from 
194     * casting and handling an exception.
195     */
196    public ST getXad5_ZipOrPostalCode() {
197       return getTyped(4, ST.class);
198    }
199
200
201    /**
202     * Returns country (component 6).  This is a convenience method that saves you from 
203     * casting and handling an exception.
204     */
205    public ID getCountry() {
206       return getTyped(5, ID.class);
207    }
208
209    
210    /**
211     * Returns country (component 6).  This is a convenience method that saves you from 
212     * casting and handling an exception.
213     */
214    public ID getXad6_Country() {
215       return getTyped(5, ID.class);
216    }
217
218
219    /**
220     * Returns address type (component 7).  This is a convenience method that saves you from 
221     * casting and handling an exception.
222     */
223    public ID getAddressType() {
224       return getTyped(6, ID.class);
225    }
226
227    
228    /**
229     * Returns address type (component 7).  This is a convenience method that saves you from 
230     * casting and handling an exception.
231     */
232    public ID getXad7_AddressType() {
233       return getTyped(6, ID.class);
234    }
235
236
237    /**
238     * Returns other geographic designation (component 8).  This is a convenience method that saves you from 
239     * casting and handling an exception.
240     */
241    public ST getOtherGeographicDesignation() {
242       return getTyped(7, ST.class);
243    }
244
245    
246    /**
247     * Returns other geographic designation (component 8).  This is a convenience method that saves you from 
248     * casting and handling an exception.
249     */
250    public ST getXad8_OtherGeographicDesignation() {
251       return getTyped(7, ST.class);
252    }
253
254
255    /**
256     * Returns county/parish code (component 9).  This is a convenience method that saves you from 
257     * casting and handling an exception.
258     */
259    public IS getCountyParishCode() {
260       return getTyped(8, IS.class);
261    }
262
263    
264    /**
265     * Returns county/parish code (component 9).  This is a convenience method that saves you from 
266     * casting and handling an exception.
267     */
268    public IS getXad9_CountyParishCode() {
269       return getTyped(8, IS.class);
270    }
271
272
273    /**
274     * Returns census tract (component 10).  This is a convenience method that saves you from 
275     * casting and handling an exception.
276     */
277    public IS getCensusTract() {
278       return getTyped(9, IS.class);
279    }
280
281    
282    /**
283     * Returns census tract (component 10).  This is a convenience method that saves you from 
284     * casting and handling an exception.
285     */
286    public IS getXad10_CensusTract() {
287       return getTyped(9, IS.class);
288    }
289
290
291    /**
292     * Returns address representation code (component 11).  This is a convenience method that saves you from 
293     * casting and handling an exception.
294     */
295    public ID getAddressRepresentationCode() {
296       return getTyped(10, ID.class);
297    }
298
299    
300    /**
301     * Returns address representation code (component 11).  This is a convenience method that saves you from 
302     * casting and handling an exception.
303     */
304    public ID getXad11_AddressRepresentationCode() {
305       return getTyped(10, ID.class);
306    }
307
308
309    /**
310     * Returns address validity range (component 12).  This is a convenience method that saves you from 
311     * casting and handling an exception.
312     */
313    public DR getAddressValidityRange() {
314       return getTyped(11, DR.class);
315    }
316
317    
318    /**
319     * Returns address validity range (component 12).  This is a convenience method that saves you from 
320     * casting and handling an exception.
321     */
322    public DR getXad12_AddressValidityRange() {
323       return getTyped(11, DR.class);
324    }
325
326
327
328}
329