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.v23.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 (ST)
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 * </ul>
056 */
057@SuppressWarnings("unused")
058public class XAD extends AbstractComposite {
059
060    private Type[] data;
061
062    /** 
063     * Creates a new XAD type
064     */
065    public XAD(Message message) {
066        super(message);
067        init();
068    }
069
070    private void init() {
071        data = new Type[10];    
072        data[0] = new ST(getMessage());
073        data[1] = new ST(getMessage());
074        data[2] = new ST(getMessage());
075        data[3] = new ST(getMessage());
076        data[4] = new ST(getMessage());
077        data[5] = new ID(getMessage(), 0);
078        data[6] = new ID(getMessage(), 0);
079        data[7] = new ST(getMessage());
080        data[8] = new IS(getMessage(), 0);
081        data[9] = new IS(getMessage(), 0);
082    }
083
084
085    /**
086     * Returns an array containing the data elements.
087     */
088    public Type[] getComponents() { 
089        return this.data; 
090    }
091
092    /**
093     * Returns an individual data component.
094     *
095     * @param number The component number (0-indexed)
096     * @throws DataTypeException if the given element number is out of range.
097     */
098    public Type getComponent(int number) throws DataTypeException { 
099
100        try { 
101            return this.data[number]; 
102        } catch (ArrayIndexOutOfBoundsException e) { 
103            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
104        } 
105    } 
106
107
108    /**
109     * Returns street address (component 1).  This is a convenience method that saves you from 
110     * casting and handling an exception.
111     */
112    public ST getStreetAddress() {
113       return getTyped(0, ST.class);
114    }
115
116    
117    /**
118     * Returns street address (component 1).  This is a convenience method that saves you from 
119     * casting and handling an exception.
120     */
121    public ST getXad1_StreetAddress() {
122       return getTyped(0, ST.class);
123    }
124
125
126    /**
127     * Returns other designation (component 2).  This is a convenience method that saves you from 
128     * casting and handling an exception.
129     */
130    public ST getOtherDesignation() {
131       return getTyped(1, ST.class);
132    }
133
134    
135    /**
136     * Returns other designation (component 2).  This is a convenience method that saves you from 
137     * casting and handling an exception.
138     */
139    public ST getXad2_OtherDesignation() {
140       return getTyped(1, ST.class);
141    }
142
143
144    /**
145     * Returns city (component 3).  This is a convenience method that saves you from 
146     * casting and handling an exception.
147     */
148    public ST getCity() {
149       return getTyped(2, ST.class);
150    }
151
152    
153    /**
154     * Returns city (component 3).  This is a convenience method that saves you from 
155     * casting and handling an exception.
156     */
157    public ST getXad3_City() {
158       return getTyped(2, ST.class);
159    }
160
161
162    /**
163     * Returns state or province (component 4).  This is a convenience method that saves you from 
164     * casting and handling an exception.
165     */
166    public ST getStateOrProvince() {
167       return getTyped(3, ST.class);
168    }
169
170    
171    /**
172     * Returns state or province (component 4).  This is a convenience method that saves you from 
173     * casting and handling an exception.
174     */
175    public ST getXad4_StateOrProvince() {
176       return getTyped(3, ST.class);
177    }
178
179
180    /**
181     * Returns zip or postal code (component 5).  This is a convenience method that saves you from 
182     * casting and handling an exception.
183     */
184    public ST getZipOrPostalCode() {
185       return getTyped(4, ST.class);
186    }
187
188    
189    /**
190     * Returns zip or postal code (component 5).  This is a convenience method that saves you from 
191     * casting and handling an exception.
192     */
193    public ST getXad5_ZipOrPostalCode() {
194       return getTyped(4, ST.class);
195    }
196
197
198    /**
199     * Returns country (component 6).  This is a convenience method that saves you from 
200     * casting and handling an exception.
201     */
202    public ID getCountry() {
203       return getTyped(5, ID.class);
204    }
205
206    
207    /**
208     * Returns country (component 6).  This is a convenience method that saves you from 
209     * casting and handling an exception.
210     */
211    public ID getXad6_Country() {
212       return getTyped(5, ID.class);
213    }
214
215
216    /**
217     * Returns address type (component 7).  This is a convenience method that saves you from 
218     * casting and handling an exception.
219     */
220    public ID getAddressType() {
221       return getTyped(6, ID.class);
222    }
223
224    
225    /**
226     * Returns address type (component 7).  This is a convenience method that saves you from 
227     * casting and handling an exception.
228     */
229    public ID getXad7_AddressType() {
230       return getTyped(6, ID.class);
231    }
232
233
234    /**
235     * Returns other geographic designation (component 8).  This is a convenience method that saves you from 
236     * casting and handling an exception.
237     */
238    public ST getOtherGeographicDesignation() {
239       return getTyped(7, ST.class);
240    }
241
242    
243    /**
244     * Returns other geographic designation (component 8).  This is a convenience method that saves you from 
245     * casting and handling an exception.
246     */
247    public ST getXad8_OtherGeographicDesignation() {
248       return getTyped(7, ST.class);
249    }
250
251
252    /**
253     * Returns county/parish code (component 9).  This is a convenience method that saves you from 
254     * casting and handling an exception.
255     */
256    public IS getCountyParishCode() {
257       return getTyped(8, IS.class);
258    }
259
260    
261    /**
262     * Returns county/parish code (component 9).  This is a convenience method that saves you from 
263     * casting and handling an exception.
264     */
265    public IS getXad9_CountyParishCode() {
266       return getTyped(8, IS.class);
267    }
268
269
270    /**
271     * Returns census tract (component 10).  This is a convenience method that saves you from 
272     * casting and handling an exception.
273     */
274    public IS getCensusTract() {
275       return getTyped(9, IS.class);
276    }
277
278    
279    /**
280     * Returns census tract (component 10).  This is a convenience method that saves you from 
281     * casting and handling an exception.
282     */
283    public IS getXad10_CensusTract() {
284       return getTyped(9, IS.class);
285    }
286
287
288
289}
290