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