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.v27.segment;
035
036// import ca.uhn.hl7v2.model.v27.group.*;
037import ca.uhn.hl7v2.model.v27.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: Sequence Number - Test/Observation Master File (NM) <b>optional </b>
053     * <li>OM2-2: Units of Measure (CWE) <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 (CWE) <b>optional </b>
056     * <li>OM2-5: SI Conversion Factor (TX) <b>optional </b>
057     * <li>OM2-6: Reference (Normal) Range for Ordinal and Continuous Observations (RFR) <b>optional repeating</b>
058     * <li>OM2-7: Critical Range for Ordinal and Continuous Observations (RFR) <b>optional repeating</b>
059     * <li>OM2-8: Absolute Range for Ordinal and Continuous Observations (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, 0, new Object[]{ getMessage() }, "Sequence Number - Test/Observation Master File");
078                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Units of Measure");
079                                  this.add(NM.class, false, 0, 0, new Object[]{ getMessage() }, "Range of Decimal Precision");
080                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Corresponding SI Units of Measure");
081                                  this.add(TX.class, false, 1, 0, new Object[]{ getMessage() }, "SI Conversion Factor");
082                                  this.add(RFR.class, false, 0, 0, new Object[]{ getMessage() }, "Reference (Normal) Range for Ordinal and Continuous Observations");
083                                  this.add(RFR.class, false, 0, 0, new Object[]{ getMessage() }, "Critical Range for Ordinal and Continuous Observations");
084                                  this.add(RFR.class, false, 1, 0, new Object[]{ getMessage() }, "Absolute Range for Ordinal and Continuous Observations");
085                                  this.add(DLT.class, false, 0, 0, new Object[]{ getMessage() }, "Delta Check Criteria");
086                                  this.add(NM.class, false, 1, 0, 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 CWE getUnitsOfMeasure() { 
119                CWE 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 CWE getOm22_UnitsOfMeasure() { 
128                CWE 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 CWE getCorrespondingSIUnitsOfMeasure() { 
248                CWE 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 CWE getOm24_CorrespondingSIUnitsOfMeasure() { 
257                CWE 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     * Returns all repetitions of Reference (Normal) Range for Ordinal and Continuous Observations (OM2-6).
284     */
285    public RFR[] getReferenceNormalRangeForOrdinalAndContinuousObservations() {
286        RFR[] retVal = this.getTypedField(6, new RFR[0]);
287        return retVal;
288    }
289
290
291    /**
292     * Returns all repetitions of Reference (Normal) Range for Ordinal and Continuous Observations (OM2-6).
293     */
294    public RFR[] getOm26_ReferenceNormalRangeForOrdinalAndContinuousObservations() {
295        RFR[] retVal = this.getTypedField(6, new RFR[0]);
296        return retVal;
297    }
298
299
300    /**
301     * Returns a count of the current number of repetitions of Reference (Normal) Range for Ordinal and Continuous Observations (OM2-6).
302     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
303     * it will return zero.
304     */
305    public int getReferenceNormalRangeForOrdinalAndContinuousObservationsReps() {
306        return this.getReps(6);
307    }
308
309
310    /**
311     * Returns a specific repetition of
312     * OM2-6: "Reference (Normal) Range for Ordinal and Continuous Observations" - creates it if necessary
313     *
314     * @param rep The repetition index (0-indexed)
315     */
316    public RFR getReferenceNormalRangeForOrdinalAndContinuousObservations(int rep) { 
317                RFR retVal = this.getTypedField(6, rep);
318                return retVal;
319    }
320
321    /**
322     * Returns a specific repetition of
323     * OM2-6: "Reference (Normal) Range for Ordinal and Continuous Observations" - creates it if necessary
324     *
325     * @param rep The repetition index (0-indexed)
326     */
327    public RFR getOm26_ReferenceNormalRangeForOrdinalAndContinuousObservations(int rep) { 
328                RFR retVal = this.getTypedField(6, rep);
329                return retVal;
330    }
331
332    /**
333     * Returns a count of the current number of repetitions of Reference (Normal) Range for Ordinal and Continuous Observations (OM2-6).
334     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
335     * it will return zero.
336     */
337    public int getOm26_ReferenceNormalRangeForOrdinalAndContinuousObservationsReps() {
338        return this.getReps(6);
339    }
340
341
342    /**
343     * Inserts a repetition of
344     * OM2-6: "Reference (Normal) Range for Ordinal and Continuous Observations" at a specific index
345     *
346     * @param rep The repetition index (0-indexed)
347     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
348     */
349    public RFR insertReferenceNormalRangeForOrdinalAndContinuousObservations(int rep) throws HL7Exception { 
350        return (RFR) super.insertRepetition(6, rep);
351    }
352
353
354    /**
355     * Inserts a repetition of
356     * OM2-6: "Reference (Normal) Range for Ordinal and Continuous Observations" at a specific index
357     *
358     * @param rep The repetition index (0-indexed)
359     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
360     */
361    public RFR insertOm26_ReferenceNormalRangeForOrdinalAndContinuousObservations(int rep) throws HL7Exception { 
362        return (RFR) super.insertRepetition(6, rep);
363    }
364
365
366    /**
367     * Removes a repetition of
368     * OM2-6: "Reference (Normal) Range for Ordinal and Continuous Observations" at a specific index
369     *
370     * @param rep The repetition index (0-indexed)
371     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
372     */
373    public RFR removeReferenceNormalRangeForOrdinalAndContinuousObservations(int rep) throws HL7Exception { 
374        return (RFR) super.removeRepetition(6, rep);
375    }
376
377
378    /**
379     * Removes a repetition of
380     * OM2-6: "Reference (Normal) Range for Ordinal and Continuous Observations" at a specific index
381     *
382     * @param rep The repetition index (0-indexed)
383     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
384     */
385    public RFR removeOm26_ReferenceNormalRangeForOrdinalAndContinuousObservations(int rep) throws HL7Exception { 
386        return (RFR) super.removeRepetition(6, rep);
387    }
388
389
390
391    /**
392     * Returns all repetitions of Critical Range for Ordinal and Continuous Observations (OM2-7).
393     */
394    public RFR[] getCriticalRangeForOrdinalAndContinuousObservations() {
395        RFR[] retVal = this.getTypedField(7, new RFR[0]);
396        return retVal;
397    }
398
399
400    /**
401     * Returns all repetitions of Critical Range for Ordinal and Continuous Observations (OM2-7).
402     */
403    public RFR[] getOm27_CriticalRangeForOrdinalAndContinuousObservations() {
404        RFR[] retVal = this.getTypedField(7, new RFR[0]);
405        return retVal;
406    }
407
408
409    /**
410     * Returns a count of the current number of repetitions of Critical Range for Ordinal and Continuous Observations (OM2-7).
411     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
412     * it will return zero.
413     */
414    public int getCriticalRangeForOrdinalAndContinuousObservationsReps() {
415        return this.getReps(7);
416    }
417
418
419    /**
420     * Returns a specific repetition of
421     * OM2-7: "Critical Range for Ordinal and Continuous Observations" - creates it if necessary
422     *
423     * @param rep The repetition index (0-indexed)
424     */
425    public RFR getCriticalRangeForOrdinalAndContinuousObservations(int rep) { 
426                RFR retVal = this.getTypedField(7, rep);
427                return retVal;
428    }
429
430    /**
431     * Returns a specific repetition of
432     * OM2-7: "Critical Range for Ordinal and Continuous Observations" - creates it if necessary
433     *
434     * @param rep The repetition index (0-indexed)
435     */
436    public RFR getOm27_CriticalRangeForOrdinalAndContinuousObservations(int rep) { 
437                RFR retVal = this.getTypedField(7, rep);
438                return retVal;
439    }
440
441    /**
442     * Returns a count of the current number of repetitions of Critical Range for Ordinal and Continuous Observations (OM2-7).
443     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
444     * it will return zero.
445     */
446    public int getOm27_CriticalRangeForOrdinalAndContinuousObservationsReps() {
447        return this.getReps(7);
448    }
449
450
451    /**
452     * Inserts a repetition of
453     * OM2-7: "Critical Range for Ordinal and Continuous Observations" at a specific index
454     *
455     * @param rep The repetition index (0-indexed)
456     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
457     */
458    public RFR insertCriticalRangeForOrdinalAndContinuousObservations(int rep) throws HL7Exception { 
459        return (RFR) super.insertRepetition(7, rep);
460    }
461
462
463    /**
464     * Inserts a repetition of
465     * OM2-7: "Critical Range for Ordinal and Continuous Observations" at a specific index
466     *
467     * @param rep The repetition index (0-indexed)
468     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
469     */
470    public RFR insertOm27_CriticalRangeForOrdinalAndContinuousObservations(int rep) throws HL7Exception { 
471        return (RFR) super.insertRepetition(7, rep);
472    }
473
474
475    /**
476     * Removes a repetition of
477     * OM2-7: "Critical Range for Ordinal and Continuous Observations" at a specific index
478     *
479     * @param rep The repetition index (0-indexed)
480     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
481     */
482    public RFR removeCriticalRangeForOrdinalAndContinuousObservations(int rep) throws HL7Exception { 
483        return (RFR) super.removeRepetition(7, rep);
484    }
485
486
487    /**
488     * Removes a repetition of
489     * OM2-7: "Critical Range for Ordinal and Continuous Observations" at a specific index
490     *
491     * @param rep The repetition index (0-indexed)
492     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
493     */
494    public RFR removeOm27_CriticalRangeForOrdinalAndContinuousObservations(int rep) throws HL7Exception { 
495        return (RFR) super.removeRepetition(7, rep);
496    }
497
498
499
500
501    /**
502     * Returns
503     * OM2-8: "Absolute Range for Ordinal and Continuous Observations" - creates it if necessary
504     */
505    public RFR getAbsoluteRangeForOrdinalAndContinuousObservations() { 
506                RFR retVal = this.getTypedField(8, 0);
507                return retVal;
508    }
509    
510    /**
511     * Returns
512     * OM2-8: "Absolute Range for Ordinal and Continuous Observations" - creates it if necessary
513     */
514    public RFR getOm28_AbsoluteRangeForOrdinalAndContinuousObservations() { 
515                RFR retVal = this.getTypedField(8, 0);
516                return retVal;
517    }
518
519
520    /**
521     * Returns all repetitions of Delta Check Criteria (OM2-9).
522     */
523    public DLT[] getDeltaCheckCriteria() {
524        DLT[] retVal = this.getTypedField(9, new DLT[0]);
525        return retVal;
526    }
527
528
529    /**
530     * Returns all repetitions of Delta Check Criteria (OM2-9).
531     */
532    public DLT[] getOm29_DeltaCheckCriteria() {
533        DLT[] retVal = this.getTypedField(9, new DLT[0]);
534        return retVal;
535    }
536
537
538    /**
539     * Returns a count of the current number of repetitions of Delta Check Criteria (OM2-9).
540     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
541     * it will return zero.
542     */
543    public int getDeltaCheckCriteriaReps() {
544        return this.getReps(9);
545    }
546
547
548    /**
549     * Returns a specific repetition of
550     * OM2-9: "Delta Check Criteria" - creates it if necessary
551     *
552     * @param rep The repetition index (0-indexed)
553     */
554    public DLT getDeltaCheckCriteria(int rep) { 
555                DLT retVal = this.getTypedField(9, rep);
556                return retVal;
557    }
558
559    /**
560     * Returns a specific repetition of
561     * OM2-9: "Delta Check Criteria" - creates it if necessary
562     *
563     * @param rep The repetition index (0-indexed)
564     */
565    public DLT getOm29_DeltaCheckCriteria(int rep) { 
566                DLT retVal = this.getTypedField(9, rep);
567                return retVal;
568    }
569
570    /**
571     * Returns a count of the current number of repetitions of Delta Check Criteria (OM2-9).
572     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
573     * it will return zero.
574     */
575    public int getOm29_DeltaCheckCriteriaReps() {
576        return this.getReps(9);
577    }
578
579
580    /**
581     * Inserts a repetition of
582     * OM2-9: "Delta Check Criteria" at a specific index
583     *
584     * @param rep The repetition index (0-indexed)
585     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
586     */
587    public DLT insertDeltaCheckCriteria(int rep) throws HL7Exception { 
588        return (DLT) super.insertRepetition(9, rep);
589    }
590
591
592    /**
593     * Inserts a repetition of
594     * OM2-9: "Delta Check Criteria" at a specific index
595     *
596     * @param rep The repetition index (0-indexed)
597     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
598     */
599    public DLT insertOm29_DeltaCheckCriteria(int rep) throws HL7Exception { 
600        return (DLT) super.insertRepetition(9, rep);
601    }
602
603
604    /**
605     * Removes a repetition of
606     * OM2-9: "Delta Check Criteria" at a specific index
607     *
608     * @param rep The repetition index (0-indexed)
609     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
610     */
611    public DLT removeDeltaCheckCriteria(int rep) throws HL7Exception { 
612        return (DLT) super.removeRepetition(9, rep);
613    }
614
615
616    /**
617     * Removes a repetition of
618     * OM2-9: "Delta Check Criteria" at a specific index
619     *
620     * @param rep The repetition index (0-indexed)
621     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
622     */
623    public DLT removeOm29_DeltaCheckCriteria(int rep) throws HL7Exception { 
624        return (DLT) super.removeRepetition(9, rep);
625    }
626
627
628
629
630    /**
631     * Returns
632     * OM2-10: "Minimum Meaningful Increments" - creates it if necessary
633     */
634    public NM getMinimumMeaningfulIncrements() { 
635                NM retVal = this.getTypedField(10, 0);
636                return retVal;
637    }
638    
639    /**
640     * Returns
641     * OM2-10: "Minimum Meaningful Increments" - creates it if necessary
642     */
643    public NM getOm210_MinimumMeaningfulIncrements() { 
644                NM retVal = this.getTypedField(10, 0);
645                return retVal;
646    }
647
648
649
650
651
652    /** {@inheritDoc} */   
653    protected Type createNewTypeWithoutReflection(int field) {
654       switch (field) {
655          case 0: return new NM(getMessage());
656          case 1: return new CWE(getMessage());
657          case 2: return new NM(getMessage());
658          case 3: return new CWE(getMessage());
659          case 4: return new TX(getMessage());
660          case 5: return new RFR(getMessage());
661          case 6: return new RFR(getMessage());
662          case 7: return new RFR(getMessage());
663          case 8: return new DLT(getMessage());
664          case 9: return new NM(getMessage());
665          default: return null;
666       }
667   }
668
669
670}
671