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