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.v28.segment;
035
036// import ca.uhn.hl7v2.model.v28.group.*;
037import ca.uhn.hl7v2.model.v28.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 EQU message segment (Equipment Detail). 
050 * This segment has the following fields:</p>
051 * <ul>
052     * <li>EQU-1: Equipment Instance Identifier (EI) <b> repeating</b>
053     * <li>EQU-2: Event Date/Time (DTM) <b> </b>
054     * <li>EQU-3: Equipment State (CWE) <b>optional </b>
055     * <li>EQU-4: Local/Remote Control State (CWE) <b>optional </b>
056     * <li>EQU-5: Alert Level (CWE) <b>optional </b>
057 * </ul>
058 */
059@SuppressWarnings("unused")
060public class EQU extends AbstractSegment {
061
062    /** 
063     * Creates a new EQU segment
064     */
065    public EQU(Group parent, ModelClassFactory factory) {
066       super(parent, factory);
067       init(factory);
068    }
069
070    private void init(ModelClassFactory factory) {
071       try {
072                                  this.add(EI.class, true, 0, 0, new Object[]{ getMessage() }, "Equipment Instance Identifier");
073                                  this.add(DTM.class, true, 1, 0, new Object[]{ getMessage() }, "Event Date/Time");
074                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Equipment State");
075                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Local/Remote Control State");
076                                  this.add(CWE.class, false, 1, 0, new Object[]{ getMessage() }, "Alert Level");
077       } catch(HL7Exception e) {
078          log.error("Unexpected error creating EQU - this is probably a bug in the source code generator.", e);
079       }
080    }
081
082
083    /**
084     * Returns all repetitions of Equipment Instance Identifier (EQU-1).
085     */
086    public EI[] getEquipmentInstanceIdentifier() {
087        EI[] retVal = this.getTypedField(1, new EI[0]);
088        return retVal;
089    }
090
091
092    /**
093     * Returns all repetitions of Equipment Instance Identifier (EQU-1).
094     */
095    public EI[] getEqu1_EquipmentInstanceIdentifier() {
096        EI[] retVal = this.getTypedField(1, new EI[0]);
097        return retVal;
098    }
099
100
101    /**
102     * Returns a count of the current number of repetitions of Equipment Instance Identifier (EQU-1).
103     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
104     * it will return zero.
105     */
106    public int getEquipmentInstanceIdentifierReps() {
107        return this.getReps(1);
108    }
109
110
111    /**
112     * Returns a specific repetition of
113     * EQU-1: "Equipment Instance Identifier" - creates it if necessary
114     *
115     * @param rep The repetition index (0-indexed)
116     */
117    public EI getEquipmentInstanceIdentifier(int rep) { 
118                EI retVal = this.getTypedField(1, rep);
119                return retVal;
120    }
121
122    /**
123     * Returns a specific repetition of
124     * EQU-1: "Equipment Instance Identifier" - creates it if necessary
125     *
126     * @param rep The repetition index (0-indexed)
127     */
128    public EI getEqu1_EquipmentInstanceIdentifier(int rep) { 
129                EI retVal = this.getTypedField(1, rep);
130                return retVal;
131    }
132
133    /**
134     * Returns a count of the current number of repetitions of Equipment Instance Identifier (EQU-1).
135     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
136     * it will return zero.
137     */
138    public int getEqu1_EquipmentInstanceIdentifierReps() {
139        return this.getReps(1);
140    }
141
142
143    /**
144     * Inserts a repetition of
145     * EQU-1: "Equipment Instance Identifier" at a specific index
146     *
147     * @param rep The repetition index (0-indexed)
148     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
149     */
150    public EI insertEquipmentInstanceIdentifier(int rep) throws HL7Exception { 
151        return (EI) super.insertRepetition(1, rep);
152    }
153
154
155    /**
156     * Inserts a repetition of
157     * EQU-1: "Equipment Instance Identifier" at a specific index
158     *
159     * @param rep The repetition index (0-indexed)
160     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
161     */
162    public EI insertEqu1_EquipmentInstanceIdentifier(int rep) throws HL7Exception { 
163        return (EI) super.insertRepetition(1, rep);
164    }
165
166
167    /**
168     * Removes a repetition of
169     * EQU-1: "Equipment Instance Identifier" at a specific index
170     *
171     * @param rep The repetition index (0-indexed)
172     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
173     */
174    public EI removeEquipmentInstanceIdentifier(int rep) throws HL7Exception { 
175        return (EI) super.removeRepetition(1, rep);
176    }
177
178
179    /**
180     * Removes a repetition of
181     * EQU-1: "Equipment Instance Identifier" at a specific index
182     *
183     * @param rep The repetition index (0-indexed)
184     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
185     */
186    public EI removeEqu1_EquipmentInstanceIdentifier(int rep) throws HL7Exception { 
187        return (EI) super.removeRepetition(1, rep);
188    }
189
190
191
192
193    /**
194     * Returns
195     * EQU-2: "Event Date/Time" - creates it if necessary
196     */
197    public DTM getEventDateTime() { 
198                DTM retVal = this.getTypedField(2, 0);
199                return retVal;
200    }
201    
202    /**
203     * Returns
204     * EQU-2: "Event Date/Time" - creates it if necessary
205     */
206    public DTM getEqu2_EventDateTime() { 
207                DTM retVal = this.getTypedField(2, 0);
208                return retVal;
209    }
210
211
212
213    /**
214     * Returns
215     * EQU-3: "Equipment State" - creates it if necessary
216     */
217    public CWE getEquipmentState() { 
218                CWE retVal = this.getTypedField(3, 0);
219                return retVal;
220    }
221    
222    /**
223     * Returns
224     * EQU-3: "Equipment State" - creates it if necessary
225     */
226    public CWE getEqu3_EquipmentState() { 
227                CWE retVal = this.getTypedField(3, 0);
228                return retVal;
229    }
230
231
232
233    /**
234     * Returns
235     * EQU-4: "Local/Remote Control State" - creates it if necessary
236     */
237    public CWE getLocalRemoteControlState() { 
238                CWE retVal = this.getTypedField(4, 0);
239                return retVal;
240    }
241    
242    /**
243     * Returns
244     * EQU-4: "Local/Remote Control State" - creates it if necessary
245     */
246    public CWE getEqu4_LocalRemoteControlState() { 
247                CWE retVal = this.getTypedField(4, 0);
248                return retVal;
249    }
250
251
252
253    /**
254     * Returns
255     * EQU-5: "Alert Level" - creates it if necessary
256     */
257    public CWE getAlertLevel() { 
258                CWE retVal = this.getTypedField(5, 0);
259                return retVal;
260    }
261    
262    /**
263     * Returns
264     * EQU-5: "Alert Level" - creates it if necessary
265     */
266    public CWE getEqu5_AlertLevel() { 
267                CWE retVal = this.getTypedField(5, 0);
268                return retVal;
269    }
270
271
272
273
274
275    /** {@inheritDoc} */   
276    protected Type createNewTypeWithoutReflection(int field) {
277       switch (field) {
278          case 0: return new EI(getMessage());
279          case 1: return new DTM(getMessage());
280          case 2: return new CWE(getMessage());
281          case 3: return new CWE(getMessage());
282          case 4: return new CWE(getMessage());
283          default: return null;
284       }
285   }
286
287
288}
289