View Javadoc
1   /*
2    * This class is an auto-generated source file for a HAPI
3    * HL7 v2.x standard structure class.
4    *
5    * For more information, visit: http://hl7api.sourceforge.net/
6    * 
7    * The contents of this file are subject to the Mozilla Public License Version 1.1 
8    * (the "License"); you may not use this file except in compliance with the License. 
9    * You may obtain a copy of the License at http://www.mozilla.org/MPL/ 
10   * Software distributed under the License is distributed on an "AS IS" basis, 
11   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the 
12   * specific language governing rights and limitations under the License. 
13   * 
14   * The Original Code is "NA.java".  Description:
15   * "Composite class NA"
16   * 
17   * The Initial Developer of the Original Code is University Health Network. Copyright (C) 
18   * 2013.  All Rights Reserved.
19   * 
20   * Contributor(s): ______________________________________. 
21   * 
22   * Alternatively, the contents of this file may be used under the terms of the 
23   * GNU General Public License (the  "GPL"), in which case the provisions of the GPL are 
24   * applicable instead of those above.  If you wish to allow use of your version of this 
25   * file only under the terms of the GPL and not to allow others to use your version 
26   * of this file under the MPL, indicate your decision by deleting  the provisions above 
27   * and replace  them with the notice and other provisions required by the GPL License.  
28   * If you do not delete the provisions above, a recipient may use your version of 
29   * this file under either the MPL or the GPL. 
30   * 
31   */
32  
33  package ca.uhn.hl7v2.model.v27.datatype;
34  
35  import ca.uhn.hl7v2.model.DataTypeException;
36  import ca.uhn.hl7v2.model.Message;
37  import ca.uhn.hl7v2.model.Type;
38  import ca.uhn.hl7v2.model.AbstractComposite;
39  
40  
41  /**
42   * <p>Represents an HL7 NA (Numeric Array) data type. 
43   * This type consists of the following components:</p>
44   * <ul>
45   * <li>Value1 (NM)
46   * <li>Value2 (NM)
47   * <li>Value3 (NM)
48   * <li>Value4 (NM)
49   * </ul>
50   */
51  @SuppressWarnings("unused")
52  public class NA extends AbstractComposite {
53  
54      private Type[] data;
55  
56      /** 
57       * Creates a new NA type
58       */
59      public NA(Message message) {
60          super(message);
61          init();
62      }
63  
64      private void init() {
65          data = new Type[4];    
66          data[0] = new NM(getMessage());
67          data[1] = new NM(getMessage());
68          data[2] = new NM(getMessage());
69          data[3] = new NM(getMessage());
70      }
71  
72  
73      /**
74       * Returns an array containing the data elements.
75       */
76      public Type[] getComponents() { 
77          return this.data; 
78      }
79  
80      /**
81       * Returns an individual data component.
82       *
83       * @param number The component number (0-indexed)
84       * @throws DataTypeException if the given element number is out of range.
85       */
86      public Type getComponent(int number) throws DataTypeException { 
87  
88          try { 
89              return this.data[number]; 
90          } catch (ArrayIndexOutOfBoundsException e) { 
91              throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
92          } 
93      } 
94  
95  
96      /**
97       * Returns Value1 (component 1).  This is a convenience method that saves you from 
98       * casting and handling an exception.
99       */
100     public NM getValue1() {
101        return getTyped(0, NM.class);
102     }
103 
104     
105     /**
106      * Returns Value1 (component 1).  This is a convenience method that saves you from 
107      * casting and handling an exception.
108      */
109     public NM getNa1_Value1() {
110        return getTyped(0, NM.class);
111     }
112 
113 
114     /**
115      * Returns Value2 (component 2).  This is a convenience method that saves you from 
116      * casting and handling an exception.
117      */
118     public NM getValue2() {
119        return getTyped(1, NM.class);
120     }
121 
122     
123     /**
124      * Returns Value2 (component 2).  This is a convenience method that saves you from 
125      * casting and handling an exception.
126      */
127     public NM getNa2_Value2() {
128        return getTyped(1, NM.class);
129     }
130 
131 
132     /**
133      * Returns Value3 (component 3).  This is a convenience method that saves you from 
134      * casting and handling an exception.
135      */
136     public NM getValue3() {
137        return getTyped(2, NM.class);
138     }
139 
140     
141     /**
142      * Returns Value3 (component 3).  This is a convenience method that saves you from 
143      * casting and handling an exception.
144      */
145     public NM getNa3_Value3() {
146        return getTyped(2, NM.class);
147     }
148 
149 
150     /**
151      * Returns Value4 (component 4).  This is a convenience method that saves you from 
152      * casting and handling an exception.
153      */
154     public NM getValue4() {
155        return getTyped(3, NM.class);
156     }
157 
158     
159     /**
160      * Returns Value4 (component 4).  This is a convenience method that saves you from 
161      * casting and handling an exception.
162      */
163     public NM getNa4_Value4() {
164        return getTyped(3, NM.class);
165     }
166 
167 
168 
169 }
170