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 "NR.java". Description: 015 * "Composite class NR" 016 * 017 * The Initial Developer of the Original Code is University Health Network. Copyright (C) 018 * 2013. 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 033package ca.uhn.hl7v2.model.v28.datatype; 034 035import ca.uhn.hl7v2.model.DataTypeException; 036import ca.uhn.hl7v2.model.Message; 037import ca.uhn.hl7v2.model.Type; 038import ca.uhn.hl7v2.model.AbstractComposite; 039 040 041/** 042 * <p>Represents an HL7 NR (Numeric Range) data type. 043 * This type consists of the following components:</p> 044 * <ul> 045 * <li>Low Value (NM) 046 * <li>High Value (NM) 047 * </ul> 048 */ 049@SuppressWarnings("unused") 050public class NR extends AbstractComposite { 051 052 private Type[] data; 053 054 /** 055 * Creates a new NR type 056 */ 057 public NR(Message message) { 058 super(message); 059 init(); 060 } 061 062 private void init() { 063 data = new Type[2]; 064 data[0] = new NM(getMessage()); 065 data[1] = new NM(getMessage()); 066 } 067 068 069 /** 070 * Returns an array containing the data elements. 071 */ 072 public Type[] getComponents() { 073 return this.data; 074 } 075 076 /** 077 * Returns an individual data component. 078 * 079 * @param number The component number (0-indexed) 080 * @throws DataTypeException if the given element number is out of range. 081 */ 082 public Type getComponent(int number) throws DataTypeException { 083 084 try { 085 return this.data[number]; 086 } catch (ArrayIndexOutOfBoundsException e) { 087 throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 088 } 089 } 090 091 092 /** 093 * Returns Low Value (component 1). This is a convenience method that saves you from 094 * casting and handling an exception. 095 */ 096 public NM getLowValue() { 097 return getTyped(0, NM.class); 098 } 099 100 101 /** 102 * Returns Low Value (component 1). This is a convenience method that saves you from 103 * casting and handling an exception. 104 */ 105 public NM getNr1_LowValue() { 106 return getTyped(0, NM.class); 107 } 108 109 110 /** 111 * Returns High Value (component 2). This is a convenience method that saves you from 112 * casting and handling an exception. 113 */ 114 public NM getHighValue() { 115 return getTyped(1, NM.class); 116 } 117 118 119 /** 120 * Returns High Value (component 2). This is a convenience method that saves you from 121 * casting and handling an exception. 122 */ 123 public NM getNr2_HighValue() { 124 return getTyped(1, NM.class); 125 } 126 127 128 129} 130