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.v23.segment;
035
036// import ca.uhn.hl7v2.model.v23.group.*;
037import ca.uhn.hl7v2.model.v23.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 LCC message segment (Location Charge Code). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>LCC-1: Primary Key Value (PL) <b> </b>
052     * <li>LCC-2: Location Department (IS) <b> </b>
053     * <li>LCC-3: Accommodation Type (CE) <b>optional repeating</b>
054     * <li>LCC-4: Charge Code (CE) <b> repeating</b>
055 * </ul>
056 */
057@SuppressWarnings("unused")
058public class LCC extends AbstractSegment {
059
060    /** 
061     * Creates a new LCC segment
062     */
063    public LCC(Group parent, ModelClassFactory factory) {
064       super(parent, factory);
065       init(factory);
066    }
067
068    private void init(ModelClassFactory factory) {
069       try {
070                                  this.add(PL.class, true, 1, 200, new Object[]{ getMessage() }, "Primary Key Value");
071                                              this.add(IS.class, true, 1, 10, new Object[]{ getMessage(), new Integer(264) }, "Location Department");
072                                  this.add(CE.class, false, 0, 60, new Object[]{ getMessage() }, "Accommodation Type");
073                                  this.add(CE.class, true, 0, 60, new Object[]{ getMessage() }, "Charge Code");
074       } catch(HL7Exception e) {
075          log.error("Unexpected error creating LCC - this is probably a bug in the source code generator.", e);
076       }
077    }
078
079
080
081    /**
082     * Returns
083     * LCC-1: "Primary Key Value" - creates it if necessary
084     */
085    public PL getPrimaryKeyValue() { 
086                PL retVal = this.getTypedField(1, 0);
087                return retVal;
088    }
089    
090    /**
091     * Returns
092     * LCC-1: "Primary Key Value" - creates it if necessary
093     */
094    public PL getLcc1_PrimaryKeyValue() { 
095                PL retVal = this.getTypedField(1, 0);
096                return retVal;
097    }
098
099
100
101    /**
102     * Returns
103     * LCC-2: "Location Department" - creates it if necessary
104     */
105    public IS getLocationDepartment() { 
106                IS retVal = this.getTypedField(2, 0);
107                return retVal;
108    }
109    
110    /**
111     * Returns
112     * LCC-2: "Location Department" - creates it if necessary
113     */
114    public IS getLcc2_LocationDepartment() { 
115                IS retVal = this.getTypedField(2, 0);
116                return retVal;
117    }
118
119
120    /**
121     * Returns all repetitions of Accommodation Type (LCC-3).
122     */
123    public CE[] getAccommodationType() {
124        CE[] retVal = this.getTypedField(3, new CE[0]);
125        return retVal;
126    }
127
128
129    /**
130     * Returns all repetitions of Accommodation Type (LCC-3).
131     */
132    public CE[] getLcc3_AccommodationType() {
133        CE[] retVal = this.getTypedField(3, new CE[0]);
134        return retVal;
135    }
136
137
138    /**
139     * Returns a count of the current number of repetitions of Accommodation Type (LCC-3).
140     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
141     * it will return zero.
142     */
143    public int getAccommodationTypeReps() {
144        return this.getReps(3);
145    }
146
147
148    /**
149     * Returns a specific repetition of
150     * LCC-3: "Accommodation Type" - creates it if necessary
151     *
152     * @param rep The repetition index (0-indexed)
153     */
154    public CE getAccommodationType(int rep) { 
155                CE retVal = this.getTypedField(3, rep);
156                return retVal;
157    }
158
159    /**
160     * Returns a specific repetition of
161     * LCC-3: "Accommodation Type" - creates it if necessary
162     *
163     * @param rep The repetition index (0-indexed)
164     */
165    public CE getLcc3_AccommodationType(int rep) { 
166                CE retVal = this.getTypedField(3, rep);
167                return retVal;
168    }
169
170    /**
171     * Returns a count of the current number of repetitions of Accommodation Type (LCC-3).
172     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
173     * it will return zero.
174     */
175    public int getLcc3_AccommodationTypeReps() {
176        return this.getReps(3);
177    }
178
179
180    /**
181     * Inserts a repetition of
182     * LCC-3: "Accommodation Type" at a specific index
183     *
184     * @param rep The repetition index (0-indexed)
185     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
186     */
187    public CE insertAccommodationType(int rep) throws HL7Exception { 
188        return (CE) super.insertRepetition(3, rep);
189    }
190
191
192    /**
193     * Inserts a repetition of
194     * LCC-3: "Accommodation Type" at a specific index
195     *
196     * @param rep The repetition index (0-indexed)
197     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
198     */
199    public CE insertLcc3_AccommodationType(int rep) throws HL7Exception { 
200        return (CE) super.insertRepetition(3, rep);
201    }
202
203
204    /**
205     * Removes a repetition of
206     * LCC-3: "Accommodation Type" at a specific index
207     *
208     * @param rep The repetition index (0-indexed)
209     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
210     */
211    public CE removeAccommodationType(int rep) throws HL7Exception { 
212        return (CE) super.removeRepetition(3, rep);
213    }
214
215
216    /**
217     * Removes a repetition of
218     * LCC-3: "Accommodation Type" at a specific index
219     *
220     * @param rep The repetition index (0-indexed)
221     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
222     */
223    public CE removeLcc3_AccommodationType(int rep) throws HL7Exception { 
224        return (CE) super.removeRepetition(3, rep);
225    }
226
227
228
229    /**
230     * Returns all repetitions of Charge Code (LCC-4).
231     */
232    public CE[] getChargeCode() {
233        CE[] retVal = this.getTypedField(4, new CE[0]);
234        return retVal;
235    }
236
237
238    /**
239     * Returns all repetitions of Charge Code (LCC-4).
240     */
241    public CE[] getLcc4_ChargeCode() {
242        CE[] retVal = this.getTypedField(4, new CE[0]);
243        return retVal;
244    }
245
246
247    /**
248     * Returns a count of the current number of repetitions of Charge Code (LCC-4).
249     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
250     * it will return zero.
251     */
252    public int getChargeCodeReps() {
253        return this.getReps(4);
254    }
255
256
257    /**
258     * Returns a specific repetition of
259     * LCC-4: "Charge Code" - creates it if necessary
260     *
261     * @param rep The repetition index (0-indexed)
262     */
263    public CE getChargeCode(int rep) { 
264                CE retVal = this.getTypedField(4, rep);
265                return retVal;
266    }
267
268    /**
269     * Returns a specific repetition of
270     * LCC-4: "Charge Code" - creates it if necessary
271     *
272     * @param rep The repetition index (0-indexed)
273     */
274    public CE getLcc4_ChargeCode(int rep) { 
275                CE retVal = this.getTypedField(4, rep);
276                return retVal;
277    }
278
279    /**
280     * Returns a count of the current number of repetitions of Charge Code (LCC-4).
281     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
282     * it will return zero.
283     */
284    public int getLcc4_ChargeCodeReps() {
285        return this.getReps(4);
286    }
287
288
289    /**
290     * Inserts a repetition of
291     * LCC-4: "Charge Code" at a specific index
292     *
293     * @param rep The repetition index (0-indexed)
294     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
295     */
296    public CE insertChargeCode(int rep) throws HL7Exception { 
297        return (CE) super.insertRepetition(4, rep);
298    }
299
300
301    /**
302     * Inserts a repetition of
303     * LCC-4: "Charge Code" at a specific index
304     *
305     * @param rep The repetition index (0-indexed)
306     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
307     */
308    public CE insertLcc4_ChargeCode(int rep) throws HL7Exception { 
309        return (CE) super.insertRepetition(4, rep);
310    }
311
312
313    /**
314     * Removes a repetition of
315     * LCC-4: "Charge Code" at a specific index
316     *
317     * @param rep The repetition index (0-indexed)
318     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
319     */
320    public CE removeChargeCode(int rep) throws HL7Exception { 
321        return (CE) super.removeRepetition(4, rep);
322    }
323
324
325    /**
326     * Removes a repetition of
327     * LCC-4: "Charge Code" at a specific index
328     *
329     * @param rep The repetition index (0-indexed)
330     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
331     */
332    public CE removeLcc4_ChargeCode(int rep) throws HL7Exception { 
333        return (CE) super.removeRepetition(4, rep);
334    }
335
336
337
338
339
340
341    /** {@inheritDoc} */   
342    protected Type createNewTypeWithoutReflection(int field) {
343       switch (field) {
344          case 0: return new PL(getMessage());
345          case 1: return new IS(getMessage(), new Integer( 264 ));
346          case 2: return new CE(getMessage());
347          case 3: return new CE(getMessage());
348          default: return null;
349       }
350   }
351
352
353}
354