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
033package ca.uhn.hl7v2.model.v231.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 * <p>Represents an HL7 CSU (channel sensitivity/units) data type. 
042 * This type consists of the following components:</p>
043 * <ul>
044 * <li>channel sensitivity (NM)
045 * <li>unit of measure identifier (ST)
046 * <li>unit of measure description (ST)
047 * <li>unit of measure coding system (IS)
048 * <li>alternate unit of measure identifier (ST)
049 * <li>alternate unit of measure description (ST)
050 * <li>alternate unit of measure coding system (IS)
051 * </ul>
052 */
053@SuppressWarnings("unused")
054public class CSU extends AbstractComposite {
055
056    private Type[] data;
057
058    /** 
059     * Creates a new CSU type
060     */
061    public CSU(Message message) {
062        super(message);
063        init();
064    }
065
066    private void init() {
067        data = new Type[7];    
068        data[0] = new NM(getMessage());
069        data[1] = new ST(getMessage());
070        data[2] = new ST(getMessage());
071        data[3] = new IS(getMessage(), 0);
072        data[4] = new ST(getMessage());
073        data[5] = new ST(getMessage());
074        data[6] = new IS(getMessage(), 0);
075    }
076
077
078    /**
079     * Returns an array containing the data elements.
080     */
081    public Type[] getComponents() { 
082        return this.data; 
083    }
084
085    /**
086     * Returns an individual data component.
087     *
088     * @param number The component number (0-indexed)
089     * @throws DataTypeException if the given element number is out of range.
090     */
091    public Type getComponent(int number) throws DataTypeException { 
092
093        try { 
094            return this.data[number]; 
095        } catch (ArrayIndexOutOfBoundsException e) { 
096            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
097        } 
098    } 
099
100
101    /**
102     * Returns channel sensitivity (component 1).  This is a convenience method that saves you from 
103     * casting and handling an exception.
104     */
105    public NM getChannelSensitivity() {
106       return getTyped(0, NM.class);
107    }
108
109    
110    /**
111     * Returns channel sensitivity (component 1).  This is a convenience method that saves you from 
112     * casting and handling an exception.
113     */
114    public NM getCsu1_ChannelSensitivity() {
115       return getTyped(0, NM.class);
116    }
117
118
119    /**
120     * Returns unit of measure identifier (component 2).  This is a convenience method that saves you from 
121     * casting and handling an exception.
122     */
123    public ST getUnitOfMeasureIdentifier() {
124       return getTyped(1, ST.class);
125    }
126
127    
128    /**
129     * Returns unit of measure identifier (component 2).  This is a convenience method that saves you from 
130     * casting and handling an exception.
131     */
132    public ST getCsu2_UnitOfMeasureIdentifier() {
133       return getTyped(1, ST.class);
134    }
135
136
137    /**
138     * Returns unit of measure description (component 3).  This is a convenience method that saves you from 
139     * casting and handling an exception.
140     */
141    public ST getUnitOfMeasureDescription() {
142       return getTyped(2, ST.class);
143    }
144
145    
146    /**
147     * Returns unit of measure description (component 3).  This is a convenience method that saves you from 
148     * casting and handling an exception.
149     */
150    public ST getCsu3_UnitOfMeasureDescription() {
151       return getTyped(2, ST.class);
152    }
153
154
155    /**
156     * Returns unit of measure coding system (component 4).  This is a convenience method that saves you from 
157     * casting and handling an exception.
158     */
159    public IS getUnitOfMeasureCodingSystem() {
160       return getTyped(3, IS.class);
161    }
162
163    
164    /**
165     * Returns unit of measure coding system (component 4).  This is a convenience method that saves you from 
166     * casting and handling an exception.
167     */
168    public IS getCsu4_UnitOfMeasureCodingSystem() {
169       return getTyped(3, IS.class);
170    }
171
172
173    /**
174     * Returns alternate unit of measure identifier (component 5).  This is a convenience method that saves you from 
175     * casting and handling an exception.
176     */
177    public ST getAlternateUnitOfMeasureIdentifier() {
178       return getTyped(4, ST.class);
179    }
180
181    
182    /**
183     * Returns alternate unit of measure identifier (component 5).  This is a convenience method that saves you from 
184     * casting and handling an exception.
185     */
186    public ST getCsu5_AlternateUnitOfMeasureIdentifier() {
187       return getTyped(4, ST.class);
188    }
189
190
191    /**
192     * Returns alternate unit of measure description (component 6).  This is a convenience method that saves you from 
193     * casting and handling an exception.
194     */
195    public ST getAlternateUnitOfMeasureDescription() {
196       return getTyped(5, ST.class);
197    }
198
199    
200    /**
201     * Returns alternate unit of measure description (component 6).  This is a convenience method that saves you from 
202     * casting and handling an exception.
203     */
204    public ST getCsu6_AlternateUnitOfMeasureDescription() {
205       return getTyped(5, ST.class);
206    }
207
208
209    /**
210     * Returns alternate unit of measure coding system (component 7).  This is a convenience method that saves you from 
211     * casting and handling an exception.
212     */
213    public IS getAlternateUnitOfMeasureCodingSystem() {
214       return getTyped(6, IS.class);
215    }
216
217    
218    /**
219     * Returns alternate unit of measure coding system (component 7).  This is a convenience method that saves you from 
220     * casting and handling an exception.
221     */
222    public IS getCsu7_AlternateUnitOfMeasureCodingSystem() {
223       return getTyped(6, IS.class);
224    }
225
226
227
228}
229