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.v22.segment;
035
036// import ca.uhn.hl7v2.model.v22.group.*;
037import ca.uhn.hl7v2.model.v22.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 (NUMERIC OBSERVATION). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>OM2-1: Segment Type ID (ST) <b>optional </b>
053     * <li>OM2-2: Sequence Number - Test/ Observation Master File (NM) <b>optional </b>
054     * <li>OM2-3: Units of Measure (CE) <b>optional </b>
055     * <li>OM2-4: Range of Decimal Precision (NM) <b>optional </b>
056     * <li>OM2-5: Corresponding SI Units of Measure (CE) <b>optional </b>
057     * <li>OM2-6: SI Conversion Factor (TX) <b> repeating</b>
058     * <li>OM2-7: Reference (normal) range - ordinal & continuous observations (CM_RFR) <b>optional repeating</b>
059     * <li>OM2-8: Critical range for ordinal and continuous observations (CM_RANGE) <b>optional </b>
060     * <li>OM2-9: Absolute range for ordinal and continuous observations (CM_ABS_RANGE) <b>optional </b>
061     * <li>OM2-10: Delta Check Criteria (CM_DLT) <b>optional repeating</b>
062     * <li>OM2-11: Minimum Meaningful Increments (NM) <b>optional </b>
063 * </ul>
064 */
065@SuppressWarnings("unused")
066public class OM2 extends AbstractSegment {
067
068    /** 
069     * Creates a new OM2 segment
070     */
071    public OM2(Group parent, ModelClassFactory factory) {
072       super(parent, factory);
073       init(factory);
074    }
075
076    private void init(ModelClassFactory factory) {
077       try {
078                                  this.add(ST.class, false, 1, 3, new Object[]{ getMessage() }, "Segment Type ID");
079                                  this.add(NM.class, false, 1, 4, new Object[]{ getMessage() }, "Sequence Number - Test/ Observation Master File");
080                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Units of Measure");
081                                  this.add(NM.class, false, 1, 10, new Object[]{ getMessage() }, "Range of Decimal Precision");
082                                  this.add(CE.class, false, 1, 60, new Object[]{ getMessage() }, "Corresponding SI Units of Measure");
083                                  this.add(TX.class, true, 0, 20, new Object[]{ getMessage() }, "SI Conversion Factor");
084                                  this.add(CM_RFR.class, false, 0, 200, new Object[]{ getMessage() }, "Reference (normal) range - ordinal & continuous observations");
085                                  this.add(CM_RANGE.class, false, 1, 200, new Object[]{ getMessage() }, "Critical range for ordinal and continuous observations");
086                                  this.add(CM_ABS_RANGE.class, false, 1, 200, new Object[]{ getMessage() }, "Absolute range for ordinal and continuous observations");
087                                  this.add(CM_DLT.class, false, 0, 200, new Object[]{ getMessage() }, "Delta Check Criteria");
088                                  this.add(NM.class, false, 1, 20, new Object[]{ getMessage() }, "Minimum Meaningful Increments");
089       } catch(HL7Exception e) {
090          log.error("Unexpected error creating OM2 - this is probably a bug in the source code generator.", e);
091       }
092    }
093
094
095
096    /**
097     * Returns
098     * OM2-1: "Segment Type ID" - creates it if necessary
099     */
100    public ST getSegmentTypeID() { 
101                ST retVal = this.getTypedField(1, 0);
102                return retVal;
103    }
104    
105    /**
106     * Returns
107     * OM2-1: "Segment Type ID" - creates it if necessary
108     */
109    public ST getOm21_SegmentTypeID() { 
110                ST retVal = this.getTypedField(1, 0);
111                return retVal;
112    }
113
114
115
116    /**
117     * Returns
118     * OM2-2: "Sequence Number - Test/ Observation Master File" - creates it if necessary
119     */
120    public NM getSequenceNumberTestObservationMasterFile() { 
121                NM retVal = this.getTypedField(2, 0);
122                return retVal;
123    }
124    
125    /**
126     * Returns
127     * OM2-2: "Sequence Number - Test/ Observation Master File" - creates it if necessary
128     */
129    public NM getOm22_SequenceNumberTestObservationMasterFile() { 
130                NM retVal = this.getTypedField(2, 0);
131                return retVal;
132    }
133
134
135
136    /**
137     * Returns
138     * OM2-3: "Units of Measure" - creates it if necessary
139     */
140    public CE getUnitsOfMeasure() { 
141                CE retVal = this.getTypedField(3, 0);
142                return retVal;
143    }
144    
145    /**
146     * Returns
147     * OM2-3: "Units of Measure" - creates it if necessary
148     */
149    public CE getOm23_UnitsOfMeasure() { 
150                CE retVal = this.getTypedField(3, 0);
151                return retVal;
152    }
153
154
155
156    /**
157     * Returns
158     * OM2-4: "Range of Decimal Precision" - creates it if necessary
159     */
160    public NM getRangeOfDecimalPrecision() { 
161                NM retVal = this.getTypedField(4, 0);
162                return retVal;
163    }
164    
165    /**
166     * Returns
167     * OM2-4: "Range of Decimal Precision" - creates it if necessary
168     */
169    public NM getOm24_RangeOfDecimalPrecision() { 
170                NM retVal = this.getTypedField(4, 0);
171                return retVal;
172    }
173
174
175
176    /**
177     * Returns
178     * OM2-5: "Corresponding SI Units of Measure" - creates it if necessary
179     */
180    public CE getCorrespondingSIUnitsOfMeasure() { 
181                CE retVal = this.getTypedField(5, 0);
182                return retVal;
183    }
184    
185    /**
186     * Returns
187     * OM2-5: "Corresponding SI Units of Measure" - creates it if necessary
188     */
189    public CE getOm25_CorrespondingSIUnitsOfMeasure() { 
190                CE retVal = this.getTypedField(5, 0);
191                return retVal;
192    }
193
194
195    /**
196     * Returns all repetitions of SI Conversion Factor (OM2-6).
197     */
198    public TX[] getSIConversionFactor() {
199        TX[] retVal = this.getTypedField(6, new TX[0]);
200        return retVal;
201    }
202
203
204    /**
205     * Returns all repetitions of SI Conversion Factor (OM2-6).
206     */
207    public TX[] getOm26_SIConversionFactor() {
208        TX[] retVal = this.getTypedField(6, new TX[0]);
209        return retVal;
210    }
211
212
213    /**
214     * Returns a count of the current number of repetitions of SI Conversion Factor (OM2-6).
215     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
216     * it will return zero.
217     */
218    public int getSIConversionFactorReps() {
219        return this.getReps(6);
220    }
221
222
223    /**
224     * Returns a specific repetition of
225     * OM2-6: "SI Conversion Factor" - creates it if necessary
226     *
227     * @param rep The repetition index (0-indexed)
228     */
229    public TX getSIConversionFactor(int rep) { 
230                TX retVal = this.getTypedField(6, rep);
231                return retVal;
232    }
233
234    /**
235     * Returns a specific repetition of
236     * OM2-6: "SI Conversion Factor" - creates it if necessary
237     *
238     * @param rep The repetition index (0-indexed)
239     */
240    public TX getOm26_SIConversionFactor(int rep) { 
241                TX retVal = this.getTypedField(6, rep);
242                return retVal;
243    }
244
245    /**
246     * Returns a count of the current number of repetitions of SI Conversion Factor (OM2-6).
247     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
248     * it will return zero.
249     */
250    public int getOm26_SIConversionFactorReps() {
251        return this.getReps(6);
252    }
253
254
255    /**
256     * Inserts a repetition of
257     * OM2-6: "SI Conversion Factor" at a specific index
258     *
259     * @param rep The repetition index (0-indexed)
260     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
261     */
262    public TX insertSIConversionFactor(int rep) throws HL7Exception { 
263        return (TX) super.insertRepetition(6, rep);
264    }
265
266
267    /**
268     * Inserts a repetition of
269     * OM2-6: "SI Conversion Factor" at a specific index
270     *
271     * @param rep The repetition index (0-indexed)
272     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
273     */
274    public TX insertOm26_SIConversionFactor(int rep) throws HL7Exception { 
275        return (TX) super.insertRepetition(6, rep);
276    }
277
278
279    /**
280     * Removes a repetition of
281     * OM2-6: "SI Conversion Factor" at a specific index
282     *
283     * @param rep The repetition index (0-indexed)
284     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
285     */
286    public TX removeSIConversionFactor(int rep) throws HL7Exception { 
287        return (TX) super.removeRepetition(6, rep);
288    }
289
290
291    /**
292     * Removes a repetition of
293     * OM2-6: "SI Conversion Factor" at a specific index
294     *
295     * @param rep The repetition index (0-indexed)
296     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
297     */
298    public TX removeOm26_SIConversionFactor(int rep) throws HL7Exception { 
299        return (TX) super.removeRepetition(6, rep);
300    }
301
302
303
304    /**
305     * Returns all repetitions of Reference (normal) range - ordinal & continuous observations (OM2-7).
306     */
307    public CM_RFR[] getReferenceNormalRangeOrdinalContinuousObservations() {
308        CM_RFR[] retVal = this.getTypedField(7, new CM_RFR[0]);
309        return retVal;
310    }
311
312
313    /**
314     * Returns all repetitions of Reference (normal) range - ordinal & continuous observations (OM2-7).
315     */
316    public CM_RFR[] getOm27_ReferenceNormalRangeOrdinalContinuousObservations() {
317        CM_RFR[] retVal = this.getTypedField(7, new CM_RFR[0]);
318        return retVal;
319    }
320
321
322    /**
323     * Returns a count of the current number of repetitions of Reference (normal) range - ordinal & continuous observations (OM2-7).
324     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
325     * it will return zero.
326     */
327    public int getReferenceNormalRangeOrdinalContinuousObservationsReps() {
328        return this.getReps(7);
329    }
330
331
332    /**
333     * Returns a specific repetition of
334     * OM2-7: "Reference (normal) range - ordinal & continuous observations" - creates it if necessary
335     *
336     * @param rep The repetition index (0-indexed)
337     */
338    public CM_RFR getReferenceNormalRangeOrdinalContinuousObservations(int rep) { 
339                CM_RFR retVal = this.getTypedField(7, rep);
340                return retVal;
341    }
342
343    /**
344     * Returns a specific repetition of
345     * OM2-7: "Reference (normal) range - ordinal & continuous observations" - creates it if necessary
346     *
347     * @param rep The repetition index (0-indexed)
348     */
349    public CM_RFR getOm27_ReferenceNormalRangeOrdinalContinuousObservations(int rep) { 
350                CM_RFR retVal = this.getTypedField(7, rep);
351                return retVal;
352    }
353
354    /**
355     * Returns a count of the current number of repetitions of Reference (normal) range - ordinal & continuous observations (OM2-7).
356     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
357     * it will return zero.
358     */
359    public int getOm27_ReferenceNormalRangeOrdinalContinuousObservationsReps() {
360        return this.getReps(7);
361    }
362
363
364    /**
365     * Inserts a repetition of
366     * OM2-7: "Reference (normal) range - ordinal & continuous observations" at a specific index
367     *
368     * @param rep The repetition index (0-indexed)
369     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
370     */
371    public CM_RFR insertReferenceNormalRangeOrdinalContinuousObservations(int rep) throws HL7Exception { 
372        return (CM_RFR) super.insertRepetition(7, rep);
373    }
374
375
376    /**
377     * Inserts a repetition of
378     * OM2-7: "Reference (normal) range - ordinal & continuous observations" at a specific index
379     *
380     * @param rep The repetition index (0-indexed)
381     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
382     */
383    public CM_RFR insertOm27_ReferenceNormalRangeOrdinalContinuousObservations(int rep) throws HL7Exception { 
384        return (CM_RFR) super.insertRepetition(7, rep);
385    }
386
387
388    /**
389     * Removes a repetition of
390     * OM2-7: "Reference (normal) range - ordinal & continuous observations" at a specific index
391     *
392     * @param rep The repetition index (0-indexed)
393     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
394     */
395    public CM_RFR removeReferenceNormalRangeOrdinalContinuousObservations(int rep) throws HL7Exception { 
396        return (CM_RFR) super.removeRepetition(7, rep);
397    }
398
399
400    /**
401     * Removes a repetition of
402     * OM2-7: "Reference (normal) range - ordinal & continuous observations" at a specific index
403     *
404     * @param rep The repetition index (0-indexed)
405     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
406     */
407    public CM_RFR removeOm27_ReferenceNormalRangeOrdinalContinuousObservations(int rep) throws HL7Exception { 
408        return (CM_RFR) super.removeRepetition(7, rep);
409    }
410
411
412
413
414    /**
415     * Returns
416     * OM2-8: "Critical range for ordinal and continuous observations" - creates it if necessary
417     */
418    public CM_RANGE getCriticalRangeForOrdinalAndContinuousObservations() { 
419                CM_RANGE retVal = this.getTypedField(8, 0);
420                return retVal;
421    }
422    
423    /**
424     * Returns
425     * OM2-8: "Critical range for ordinal and continuous observations" - creates it if necessary
426     */
427    public CM_RANGE getOm28_CriticalRangeForOrdinalAndContinuousObservations() { 
428                CM_RANGE retVal = this.getTypedField(8, 0);
429                return retVal;
430    }
431
432
433
434    /**
435     * Returns
436     * OM2-9: "Absolute range for ordinal and continuous observations" - creates it if necessary
437     */
438    public CM_ABS_RANGE getAbsoluteRangeForOrdinalAndContinuousObservations() { 
439                CM_ABS_RANGE retVal = this.getTypedField(9, 0);
440                return retVal;
441    }
442    
443    /**
444     * Returns
445     * OM2-9: "Absolute range for ordinal and continuous observations" - creates it if necessary
446     */
447    public CM_ABS_RANGE getOm29_AbsoluteRangeForOrdinalAndContinuousObservations() { 
448                CM_ABS_RANGE retVal = this.getTypedField(9, 0);
449                return retVal;
450    }
451
452
453    /**
454     * Returns all repetitions of Delta Check Criteria (OM2-10).
455     */
456    public CM_DLT[] getDeltaCheckCriteria() {
457        CM_DLT[] retVal = this.getTypedField(10, new CM_DLT[0]);
458        return retVal;
459    }
460
461
462    /**
463     * Returns all repetitions of Delta Check Criteria (OM2-10).
464     */
465    public CM_DLT[] getOm210_DeltaCheckCriteria() {
466        CM_DLT[] retVal = this.getTypedField(10, new CM_DLT[0]);
467        return retVal;
468    }
469
470
471    /**
472     * Returns a count of the current number of repetitions of Delta Check Criteria (OM2-10).
473     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
474     * it will return zero.
475     */
476    public int getDeltaCheckCriteriaReps() {
477        return this.getReps(10);
478    }
479
480
481    /**
482     * Returns a specific repetition of
483     * OM2-10: "Delta Check Criteria" - creates it if necessary
484     *
485     * @param rep The repetition index (0-indexed)
486     */
487    public CM_DLT getDeltaCheckCriteria(int rep) { 
488                CM_DLT retVal = this.getTypedField(10, rep);
489                return retVal;
490    }
491
492    /**
493     * Returns a specific repetition of
494     * OM2-10: "Delta Check Criteria" - creates it if necessary
495     *
496     * @param rep The repetition index (0-indexed)
497     */
498    public CM_DLT getOm210_DeltaCheckCriteria(int rep) { 
499                CM_DLT retVal = this.getTypedField(10, rep);
500                return retVal;
501    }
502
503    /**
504     * Returns a count of the current number of repetitions of Delta Check Criteria (OM2-10).
505     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
506     * it will return zero.
507     */
508    public int getOm210_DeltaCheckCriteriaReps() {
509        return this.getReps(10);
510    }
511
512
513    /**
514     * Inserts a repetition of
515     * OM2-10: "Delta Check Criteria" at a specific index
516     *
517     * @param rep The repetition index (0-indexed)
518     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
519     */
520    public CM_DLT insertDeltaCheckCriteria(int rep) throws HL7Exception { 
521        return (CM_DLT) super.insertRepetition(10, rep);
522    }
523
524
525    /**
526     * Inserts a repetition of
527     * OM2-10: "Delta Check Criteria" at a specific index
528     *
529     * @param rep The repetition index (0-indexed)
530     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
531     */
532    public CM_DLT insertOm210_DeltaCheckCriteria(int rep) throws HL7Exception { 
533        return (CM_DLT) super.insertRepetition(10, rep);
534    }
535
536
537    /**
538     * Removes a repetition of
539     * OM2-10: "Delta Check Criteria" at a specific index
540     *
541     * @param rep The repetition index (0-indexed)
542     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
543     */
544    public CM_DLT removeDeltaCheckCriteria(int rep) throws HL7Exception { 
545        return (CM_DLT) super.removeRepetition(10, rep);
546    }
547
548
549    /**
550     * Removes a repetition of
551     * OM2-10: "Delta Check Criteria" at a specific index
552     *
553     * @param rep The repetition index (0-indexed)
554     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
555     */
556    public CM_DLT removeOm210_DeltaCheckCriteria(int rep) throws HL7Exception { 
557        return (CM_DLT) super.removeRepetition(10, rep);
558    }
559
560
561
562
563    /**
564     * Returns
565     * OM2-11: "Minimum Meaningful Increments" - creates it if necessary
566     */
567    public NM getMinimumMeaningfulIncrements() { 
568                NM retVal = this.getTypedField(11, 0);
569                return retVal;
570    }
571    
572    /**
573     * Returns
574     * OM2-11: "Minimum Meaningful Increments" - creates it if necessary
575     */
576    public NM getOm211_MinimumMeaningfulIncrements() { 
577                NM retVal = this.getTypedField(11, 0);
578                return retVal;
579    }
580
581
582
583
584
585    /** {@inheritDoc} */   
586    protected Type createNewTypeWithoutReflection(int field) {
587       switch (field) {
588          case 0: return new ST(getMessage());
589          case 1: return new NM(getMessage());
590          case 2: return new CE(getMessage());
591          case 3: return new NM(getMessage());
592          case 4: return new CE(getMessage());
593          case 5: return new TX(getMessage());
594          case 6: return new CM_RFR(getMessage());
595          case 7: return new CM_RANGE(getMessage());
596          case 8: return new CM_ABS_RANGE(getMessage());
597          case 9: return new CM_DLT(getMessage());
598          case 10: return new NM(getMessage());
599          default: return null;
600       }
601   }
602
603
604}
605