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 "CM_ABS_RANGE.java".  Description:
015 * "Composite class CM_ABS_RANGE"
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.v22.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 CM_ABS_RANGE (absolute range) data type. 
043 * This type consists of the following components:</p>
044 * <ul>
045 * <li>Range (CM_RANGE)
046 * <li>Numeric Change (NM)
047 * <li>Percent per Change (NM)
048 * <li>Days (NM)
049 * </ul>
050 */
051@SuppressWarnings("unused")
052public class CM_ABS_RANGE extends AbstractComposite {
053
054    private Type[] data;
055
056    /** 
057     * Creates a new CM_ABS_RANGE type
058     */
059    public CM_ABS_RANGE(Message message) {
060        super(message);
061        init();
062    }
063
064    private void init() {
065        data = new Type[4];    
066        data[0] = new CM_RANGE(getMessage());
067        data[1] = new NM(getMessage());
068        data[2] = new NM(getMessage());
069        data[3] = new NM(getMessage());
070    }
071
072
073    /**
074     * Returns an array containing the data elements.
075     */
076    public Type[] getComponents() { 
077        return this.data; 
078    }
079
080    /**
081     * Returns an individual data component.
082     *
083     * @param number The component number (0-indexed)
084     * @throws DataTypeException if the given element number is out of range.
085     */
086    public Type getComponent(int number) throws DataTypeException { 
087
088        try { 
089            return this.data[number]; 
090        } catch (ArrayIndexOutOfBoundsException e) { 
091            throw new DataTypeException("Element " + number + " doesn't exist (Type " + getClass().getName() + " has only " + this.data.length + " components)"); 
092        } 
093    } 
094
095
096    /**
097     * Returns Range (component 1).  This is a convenience method that saves you from 
098     * casting and handling an exception.
099     */
100    public CM_RANGE getRange() {
101       return getTyped(0, CM_RANGE.class);
102    }
103
104    
105    /**
106     * Returns Range (component 1).  This is a convenience method that saves you from 
107     * casting and handling an exception.
108     */
109    public CM_RANGE getCm_abs_range1_Range() {
110       return getTyped(0, CM_RANGE.class);
111    }
112
113
114    /**
115     * Returns Numeric Change (component 2).  This is a convenience method that saves you from 
116     * casting and handling an exception.
117     */
118    public NM getNumericChange() {
119       return getTyped(1, NM.class);
120    }
121
122    
123    /**
124     * Returns Numeric Change (component 2).  This is a convenience method that saves you from 
125     * casting and handling an exception.
126     */
127    public NM getCm_abs_range2_NumericChange() {
128       return getTyped(1, NM.class);
129    }
130
131
132    /**
133     * Returns Percent per Change (component 3).  This is a convenience method that saves you from 
134     * casting and handling an exception.
135     */
136    public NM getPercentPerChange() {
137       return getTyped(2, NM.class);
138    }
139
140    
141    /**
142     * Returns Percent per Change (component 3).  This is a convenience method that saves you from 
143     * casting and handling an exception.
144     */
145    public NM getCm_abs_range3_PercentPerChange() {
146       return getTyped(2, NM.class);
147    }
148
149
150    /**
151     * Returns Days (component 4).  This is a convenience method that saves you from 
152     * casting and handling an exception.
153     */
154    public NM getDays() {
155       return getTyped(3, NM.class);
156    }
157
158    
159    /**
160     * Returns Days (component 4).  This is a convenience method that saves you from 
161     * casting and handling an exception.
162     */
163    public NM getCm_abs_range4_Days() {
164       return getTyped(3, NM.class);
165    }
166
167
168
169}
170