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
008 package ca.uhn.hl7v2.model.v24.datatype;
009
010 import ca.uhn.hl7v2.model.Composite;
011 import ca.uhn.hl7v2.model.DataTypeException;
012 import ca.uhn.hl7v2.model.Message;
013 import ca.uhn.hl7v2.model.Type;
014 import ca.uhn.hl7v2.model.AbstractType;
015 import ca.uhn.log.HapiLogFactory;
016
017 /**
018 * <p>Represents an HL7 MA (multiplexed array) data type.
019 * This type consists of the following components:</p>
020 * <ul>
021 * <li>sample 1 from channel 1 (NM)
022 * <li>sample 1 from channel 2 (NM)
023 * <li>sample 1 from channel 3 (NM)
024 * <li>sample 1 from channel 4 (NM)
025 * <li>sample 1 from channel 5 (NM)
026 * <li>sample 1 from channel 6 (NM)
027 * </ul>
028 */
029 public class MA extends AbstractType implements Composite {
030
031 private Type[] data;
032
033 /**
034 * Creates a new MA type
035 */
036 public MA(Message message) {
037 super(message);
038 init();
039 }
040
041 private void init() {
042 data = new Type[6];
043 data[0] = new NM(getMessage());
044 data[1] = new NM(getMessage());
045 data[2] = new NM(getMessage());
046 data[3] = new NM(getMessage());
047 data[4] = new NM(getMessage());
048 data[5] = new NM(getMessage());
049 }
050
051
052 /**
053 * Returns an array containing the data elements.
054 */
055 public Type[] getComponents() {
056 return this.data;
057 }
058
059 /**
060 * Returns an individual data component.
061 *
062 * @param number The component number (0-indexed)
063 * @throws DataTypeException if the given element number is out of range.
064 */
065 public Type getComponent(int number) throws DataTypeException {
066
067 try {
068 return this.data[number];
069 } catch (ArrayIndexOutOfBoundsException e) {
070 throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)");
071 }
072 }
073
074
075 /**
076 * Returns sample 1 from channel 1 (component #1). This is a convenience method that saves you from
077 * casting and handling an exception.
078 */
079 public NM getSample1FromChannel1() {
080 NM ret = null;
081 try {
082 ret = (NM)getComponent(0);
083 } catch (DataTypeException e) {
084 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
085 throw new RuntimeException(e);
086 }
087 return ret;
088 }
089
090
091 /**
092 * Returns sample 1 from channel 1 (component #1). This is a convenience method that saves you from
093 * casting and handling an exception.
094 */
095 public NM getMa1_Sample1FromChannel1() {
096 NM ret = null;
097 try {
098 ret = (NM)getComponent(0);
099 } catch (DataTypeException e) {
100 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
101 throw new RuntimeException(e);
102 }
103 return ret;
104 }
105
106
107 /**
108 * Returns sample 1 from channel 2 (component #2). This is a convenience method that saves you from
109 * casting and handling an exception.
110 */
111 public NM getSample1FromChannel2() {
112 NM ret = null;
113 try {
114 ret = (NM)getComponent(1);
115 } catch (DataTypeException e) {
116 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
117 throw new RuntimeException(e);
118 }
119 return ret;
120 }
121
122
123 /**
124 * Returns sample 1 from channel 2 (component #2). This is a convenience method that saves you from
125 * casting and handling an exception.
126 */
127 public NM getMa2_Sample1FromChannel2() {
128 NM ret = null;
129 try {
130 ret = (NM)getComponent(1);
131 } catch (DataTypeException e) {
132 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
133 throw new RuntimeException(e);
134 }
135 return ret;
136 }
137
138
139 /**
140 * Returns sample 1 from channel 3 (component #3). This is a convenience method that saves you from
141 * casting and handling an exception.
142 */
143 public NM getSample1FromChannel3() {
144 NM ret = null;
145 try {
146 ret = (NM)getComponent(2);
147 } catch (DataTypeException e) {
148 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
149 throw new RuntimeException(e);
150 }
151 return ret;
152 }
153
154
155 /**
156 * Returns sample 1 from channel 3 (component #3). This is a convenience method that saves you from
157 * casting and handling an exception.
158 */
159 public NM getMa3_Sample1FromChannel3() {
160 NM ret = null;
161 try {
162 ret = (NM)getComponent(2);
163 } catch (DataTypeException e) {
164 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
165 throw new RuntimeException(e);
166 }
167 return ret;
168 }
169
170
171 /**
172 * Returns sample 1 from channel 4 (component #4). This is a convenience method that saves you from
173 * casting and handling an exception.
174 */
175 public NM getSample1FromChannel4() {
176 NM ret = null;
177 try {
178 ret = (NM)getComponent(3);
179 } catch (DataTypeException e) {
180 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
181 throw new RuntimeException(e);
182 }
183 return ret;
184 }
185
186
187 /**
188 * Returns sample 1 from channel 4 (component #4). This is a convenience method that saves you from
189 * casting and handling an exception.
190 */
191 public NM getMa4_Sample1FromChannel4() {
192 NM ret = null;
193 try {
194 ret = (NM)getComponent(3);
195 } catch (DataTypeException e) {
196 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
197 throw new RuntimeException(e);
198 }
199 return ret;
200 }
201
202
203 /**
204 * Returns sample 1 from channel 5 (component #5). This is a convenience method that saves you from
205 * casting and handling an exception.
206 */
207 public NM getSample1FromChannel5() {
208 NM ret = null;
209 try {
210 ret = (NM)getComponent(4);
211 } catch (DataTypeException e) {
212 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
213 throw new RuntimeException(e);
214 }
215 return ret;
216 }
217
218
219 /**
220 * Returns sample 1 from channel 5 (component #5). This is a convenience method that saves you from
221 * casting and handling an exception.
222 */
223 public NM getMa5_Sample1FromChannel5() {
224 NM ret = null;
225 try {
226 ret = (NM)getComponent(4);
227 } catch (DataTypeException e) {
228 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
229 throw new RuntimeException(e);
230 }
231 return ret;
232 }
233
234
235 /**
236 * Returns sample 1 from channel 6 (component #6). This is a convenience method that saves you from
237 * casting and handling an exception.
238 */
239 public NM getSample1FromChannel6() {
240 NM ret = null;
241 try {
242 ret = (NM)getComponent(5);
243 } catch (DataTypeException e) {
244 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
245 throw new RuntimeException(e);
246 }
247 return ret;
248 }
249
250
251 /**
252 * Returns sample 1 from channel 6 (component #6). This is a convenience method that saves you from
253 * casting and handling an exception.
254 */
255 public NM getMa6_Sample1FromChannel6() {
256 NM ret = null;
257 try {
258 ret = (NM)getComponent(5);
259 } catch (DataTypeException e) {
260 HapiLogFactory.getHapiLog(this.getClass()).error("Unexpected problem accessing known data type component - this is a bug.", e);
261 throw new RuntimeException(e);
262 }
263 return ret;
264 }
265
266
267
268 }
269