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
033
034package ca.uhn.hl7v2.model.v231.segment;
035
036// import ca.uhn.hl7v2.model.v231.group.*;
037import ca.uhn.hl7v2.model.v231.datatype.*;
038import ca.uhn.hl7v2.HL7Exception;
039import ca.uhn.hl7v2.parser.ModelClassFactory;
040import ca.uhn.hl7v2.parser.DefaultModelClassFactory;
041import ca.uhn.hl7v2.model.AbstractMessage;
042import ca.uhn.hl7v2.model.Group;
043import ca.uhn.hl7v2.model.Type;
044import ca.uhn.hl7v2.model.AbstractSegment;
045import ca.uhn.hl7v2.model.Varies;
046
047
048/**
049 *<p>Represents an HL7 OM2 message segment (OM2 - numeric observation segment). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>OM2-1: Sequence Number - Test/Observation Master File (NM) <b>optional </b>
053     * <li>OM2-2: Units of Measure (CE) <b>optional </b>
054     * <li>OM2-3: Range of Decimal Precision (NM) <b>optional repeating</b>
055     * <li>OM2-4: Corresponding SI Units of Measure (CE) <b>optional </b>
056     * <li>OM2-5: SI Conversion Factor (TX) <b>optional </b>
057     * <li>OM2-6: Reference (Normal) Range - Ordinal & Continuous Obs (RFR) <b>optional </b>
058     * <li>OM2-7: Critical Range for Ordinal & Continuous Obs (NR) <b>optional </b>
059     * <li>OM2-8: Absolute Range for Ordinal & Continuous Obs (RFR) <b>optional </b>
060     * <li>OM2-9: Delta Check Criteria (DLT) <b>optional repeating</b>
061     * <li>OM2-10: Minimum Meaningful Increments (NM) <b>optional </b>
062 * </ul>
063 */
064@SuppressWarnings("unused")
065public class OM2 extends AbstractSegment {
066
067    /** 
068     * Creates a new OM2 segment
069     */
070    public OM2(Group parent, ModelClassFactory factory) {
071       super(parent, factory);
072       init(factory);
073    }
074
075    private void init(ModelClassFactory factory) {
076       try {
077                                  this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Sequence Number - Test/Observation Master File");
078                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Units of Measure");
079                                  this.add(NM.class, false, 0, 10, new Object[]{ getMessage() }, "Range of Decimal Precision");
080                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Corresponding SI Units of Measure");
081                                  this.add(TX.class, false, 1, 60, new Object[]{ getMessage() }, "SI Conversion Factor");
082                                  this.add(RFR.class, false, 1, 200, new Object[]{ getMessage() }, "Reference (Normal) Range - Ordinal & Continuous Obs");
083                                  this.add(NR.class, false, 1, 200, new Object[]{ getMessage() }, "Critical Range for Ordinal & Continuous Obs");
084                                  this.add(RFR.class, false, 1, 200, new Object[]{ getMessage() }, "Absolute Range for Ordinal & Continuous Obs");
085                                  this.add(DLT.class, false, 0, 200, new Object[]{ getMessage() }, "Delta Check Criteria");
086                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Minimum Meaningful Increments");
087       } catch(HL7Exception e) {
088          log.error("Unexpected error creating OM2 - this is probably a bug in the source code generator.", e);
089       }
090    }
091
092
093
094    /**
095     * Returns
096     * OM2-1: "Sequence Number - Test/Observation Master File" - creates it if necessary
097     */
098    public NM getSequenceNumberTestObservationMasterFile() { 
099                NM retVal = this.getTypedField(1, 0);
100                return retVal;
101    }
102    
103    /**
104     * Returns
105     * OM2-1: "Sequence Number - Test/Observation Master File" - creates it if necessary
106     */
107    public NM getOm21_SequenceNumberTestObservationMasterFile() { 
108                NM retVal = this.getTypedField(1, 0);
109                return retVal;
110    }
111
112
113
114    /**
115     * Returns
116     * OM2-2: "Units of Measure" - creates it if necessary
117     */
118    public CE getUnitsOfMeasure() { 
119                CE retVal = this.getTypedField(2, 0);
120                return retVal;
121    }
122    
123    /**
124     * Returns
125     * OM2-2: "Units of Measure" - creates it if necessary
126     */
127    public CE getOm22_UnitsOfMeasure() { 
128                CE retVal = this.getTypedField(2, 0);
129                return retVal;
130    }
131
132
133    /**
134     * Returns all repetitions of Range of Decimal Precision (OM2-3).
135     */
136    public NM[] getRangeOfDecimalPrecision() {
137        NM[] retVal = this.getTypedField(3, new NM[0]);
138        return retVal;
139    }
140
141
142    /**
143     * Returns all repetitions of Range of Decimal Precision (OM2-3).
144     */
145    public NM[] getOm23_RangeOfDecimalPrecision() {
146        NM[] retVal = this.getTypedField(3, new NM[0]);
147        return retVal;
148    }
149
150
151    /**
152     * Returns a count of the current number of repetitions of Range of Decimal Precision (OM2-3).
153     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
154     * it will return zero.
155     */
156    public int getRangeOfDecimalPrecisionReps() {
157        return this.getReps(3);
158    }
159
160
161    /**
162     * Returns a specific repetition of
163     * OM2-3: "Range of Decimal Precision" - creates it if necessary
164     *
165     * @param rep The repetition index (0-indexed)
166     */
167    public NM getRangeOfDecimalPrecision(int rep) { 
168                NM retVal = this.getTypedField(3, rep);
169                return retVal;
170    }
171
172    /**
173     * Returns a specific repetition of
174     * OM2-3: "Range of Decimal Precision" - creates it if necessary
175     *
176     * @param rep The repetition index (0-indexed)
177     */
178    public NM getOm23_RangeOfDecimalPrecision(int rep) { 
179                NM retVal = this.getTypedField(3, rep);
180                return retVal;
181    }
182
183    /**
184     * Returns a count of the current number of repetitions of Range of Decimal Precision (OM2-3).
185     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
186     * it will return zero.
187     */
188    public int getOm23_RangeOfDecimalPrecisionReps() {
189        return this.getReps(3);
190    }
191
192
193    /**
194     * Inserts a repetition of
195     * OM2-3: "Range of Decimal Precision" at a specific index
196     *
197     * @param rep The repetition index (0-indexed)
198     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
199     */
200    public NM insertRangeOfDecimalPrecision(int rep) throws HL7Exception { 
201        return (NM) super.insertRepetition(3, rep);
202    }
203
204
205    /**
206     * Inserts a repetition of
207     * OM2-3: "Range of Decimal Precision" at a specific index
208     *
209     * @param rep The repetition index (0-indexed)
210     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
211     */
212    public NM insertOm23_RangeOfDecimalPrecision(int rep) throws HL7Exception { 
213        return (NM) super.insertRepetition(3, rep);
214    }
215
216
217    /**
218     * Removes a repetition of
219     * OM2-3: "Range of Decimal Precision" at a specific index
220     *
221     * @param rep The repetition index (0-indexed)
222     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
223     */
224    public NM removeRangeOfDecimalPrecision(int rep) throws HL7Exception { 
225        return (NM) super.removeRepetition(3, rep);
226    }
227
228
229    /**
230     * Removes a repetition of
231     * OM2-3: "Range of Decimal Precision" at a specific index
232     *
233     * @param rep The repetition index (0-indexed)
234     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
235     */
236    public NM removeOm23_RangeOfDecimalPrecision(int rep) throws HL7Exception { 
237        return (NM) super.removeRepetition(3, rep);
238    }
239
240
241
242
243    /**
244     * Returns
245     * OM2-4: "Corresponding SI Units of Measure" - creates it if necessary
246     */
247    public CE getCorrespondingSIUnitsOfMeasure() { 
248                CE retVal = this.getTypedField(4, 0);
249                return retVal;
250    }
251    
252    /**
253     * Returns
254     * OM2-4: "Corresponding SI Units of Measure" - creates it if necessary
255     */
256    public CE getOm24_CorrespondingSIUnitsOfMeasure() { 
257                CE retVal = this.getTypedField(4, 0);
258                return retVal;
259    }
260
261
262
263    /**
264     * Returns
265     * OM2-5: "SI Conversion Factor" - creates it if necessary
266     */
267    public TX getSIConversionFactor() { 
268                TX retVal = this.getTypedField(5, 0);
269                return retVal;
270    }
271    
272    /**
273     * Returns
274     * OM2-5: "SI Conversion Factor" - creates it if necessary
275     */
276    public TX getOm25_SIConversionFactor() { 
277                TX retVal = this.getTypedField(5, 0);
278                return retVal;
279    }
280
281
282
283    /**
284     * Returns
285     * OM2-6: "Reference (Normal) Range - Ordinal & Continuous Obs" - creates it if necessary
286     */
287    public RFR getReferenceNormalRangeOrdinalContinuousObs() { 
288                RFR retVal = this.getTypedField(6, 0);
289                return retVal;
290    }
291    
292    /**
293     * Returns
294     * OM2-6: "Reference (Normal) Range - Ordinal & Continuous Obs" - creates it if necessary
295     */
296    public RFR getOm26_ReferenceNormalRangeOrdinalContinuousObs() { 
297                RFR retVal = this.getTypedField(6, 0);
298                return retVal;
299    }
300
301
302
303    /**
304     * Returns
305     * OM2-7: "Critical Range for Ordinal & Continuous Obs" - creates it if necessary
306     */
307    public NR getCriticalRangeForOrdinalContinuousObs() { 
308                NR retVal = this.getTypedField(7, 0);
309                return retVal;
310    }
311    
312    /**
313     * Returns
314     * OM2-7: "Critical Range for Ordinal & Continuous Obs" - creates it if necessary
315     */
316    public NR getOm27_CriticalRangeForOrdinalContinuousObs() { 
317                NR retVal = this.getTypedField(7, 0);
318                return retVal;
319    }
320
321
322
323    /**
324     * Returns
325     * OM2-8: "Absolute Range for Ordinal & Continuous Obs" - creates it if necessary
326     */
327    public RFR getAbsoluteRangeForOrdinalContinuousObs() { 
328                RFR retVal = this.getTypedField(8, 0);
329                return retVal;
330    }
331    
332    /**
333     * Returns
334     * OM2-8: "Absolute Range for Ordinal & Continuous Obs" - creates it if necessary
335     */
336    public RFR getOm28_AbsoluteRangeForOrdinalContinuousObs() { 
337                RFR retVal = this.getTypedField(8, 0);
338                return retVal;
339    }
340
341
342    /**
343     * Returns all repetitions of Delta Check Criteria (OM2-9).
344     */
345    public DLT[] getDeltaCheckCriteria() {
346        DLT[] retVal = this.getTypedField(9, new DLT[0]);
347        return retVal;
348    }
349
350
351    /**
352     * Returns all repetitions of Delta Check Criteria (OM2-9).
353     */
354    public DLT[] getOm29_DeltaCheckCriteria() {
355        DLT[] retVal = this.getTypedField(9, new DLT[0]);
356        return retVal;
357    }
358
359
360    /**
361     * Returns a count of the current number of repetitions of Delta Check Criteria (OM2-9).
362     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
363     * it will return zero.
364     */
365    public int getDeltaCheckCriteriaReps() {
366        return this.getReps(9);
367    }
368
369
370    /**
371     * Returns a specific repetition of
372     * OM2-9: "Delta Check Criteria" - creates it if necessary
373     *
374     * @param rep The repetition index (0-indexed)
375     */
376    public DLT getDeltaCheckCriteria(int rep) { 
377                DLT retVal = this.getTypedField(9, rep);
378                return retVal;
379    }
380
381    /**
382     * Returns a specific repetition of
383     * OM2-9: "Delta Check Criteria" - creates it if necessary
384     *
385     * @param rep The repetition index (0-indexed)
386     */
387    public DLT getOm29_DeltaCheckCriteria(int rep) { 
388                DLT retVal = this.getTypedField(9, rep);
389                return retVal;
390    }
391
392    /**
393     * Returns a count of the current number of repetitions of Delta Check Criteria (OM2-9).
394     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
395     * it will return zero.
396     */
397    public int getOm29_DeltaCheckCriteriaReps() {
398        return this.getReps(9);
399    }
400
401
402    /**
403     * Inserts a repetition of
404     * OM2-9: "Delta Check Criteria" at a specific index
405     *
406     * @param rep The repetition index (0-indexed)
407     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
408     */
409    public DLT insertDeltaCheckCriteria(int rep) throws HL7Exception { 
410        return (DLT) super.insertRepetition(9, rep);
411    }
412
413
414    /**
415     * Inserts a repetition of
416     * OM2-9: "Delta Check Criteria" at a specific index
417     *
418     * @param rep The repetition index (0-indexed)
419     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
420     */
421    public DLT insertOm29_DeltaCheckCriteria(int rep) throws HL7Exception { 
422        return (DLT) super.insertRepetition(9, rep);
423    }
424
425
426    /**
427     * Removes a repetition of
428     * OM2-9: "Delta Check Criteria" at a specific index
429     *
430     * @param rep The repetition index (0-indexed)
431     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
432     */
433    public DLT removeDeltaCheckCriteria(int rep) throws HL7Exception { 
434        return (DLT) super.removeRepetition(9, rep);
435    }
436
437
438    /**
439     * Removes a repetition of
440     * OM2-9: "Delta Check Criteria" at a specific index
441     *
442     * @param rep The repetition index (0-indexed)
443     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
444     */
445    public DLT removeOm29_DeltaCheckCriteria(int rep) throws HL7Exception { 
446        return (DLT) super.removeRepetition(9, rep);
447    }
448
449
450
451
452    /**
453     * Returns
454     * OM2-10: "Minimum Meaningful Increments" - creates it if necessary
455     */
456    public NM getMinimumMeaningfulIncrements() { 
457                NM retVal = this.getTypedField(10, 0);
458                return retVal;
459    }
460    
461    /**
462     * Returns
463     * OM2-10: "Minimum Meaningful Increments" - creates it if necessary
464     */
465    public NM getOm210_MinimumMeaningfulIncrements() { 
466                NM retVal = this.getTypedField(10, 0);
467                return retVal;
468    }
469
470
471
472
473
474    /** {@inheritDoc} */   
475    protected Type createNewTypeWithoutReflection(int field) {
476       switch (field) {
477          case 0: return new NM(getMessage());
478          case 1: return new CE(getMessage());
479          case 2: return new NM(getMessage());
480          case 3: return new CE(getMessage());
481          case 4: return new TX(getMessage());
482          case 5: return new RFR(getMessage());
483          case 6: return new NR(getMessage());
484          case 7: return new RFR(getMessage());
485          case 8: return new DLT(getMessage());
486          case 9: return new NM(getMessage());
487          default: return null;
488       }
489   }
490
491
492}
493