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.v24.segment;
035
036// import ca.uhn.hl7v2.model.v24.group.*;
037import ca.uhn.hl7v2.model.v24.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 APR message segment (Appointment Preferences). 
049 * This segment has the following fields:</p>
050 * <ul>
051     * <li>APR-1: Time Selection Criteria (SCV) <b>optional repeating</b>
052     * <li>APR-2: Resource Selection Criteria (SCV) <b>optional repeating</b>
053     * <li>APR-3: Location Selection Criteria (SCV) <b>optional repeating</b>
054     * <li>APR-4: Slot Spacing Criteria (NM) <b>optional </b>
055     * <li>APR-5: Filler Override Criteria (SCV) <b>optional repeating</b>
056 * </ul>
057 */
058@SuppressWarnings("unused")
059public class APR extends AbstractSegment {
060
061    /** 
062     * Creates a new APR segment
063     */
064    public APR(Group parent, ModelClassFactory factory) {
065       super(parent, factory);
066       init(factory);
067    }
068
069    private void init(ModelClassFactory factory) {
070       try {
071                                  this.add(SCV.class, false, 0, 80, new Object[]{ getMessage() }, "Time Selection Criteria");
072                                  this.add(SCV.class, false, 0, 80, new Object[]{ getMessage() }, "Resource Selection Criteria");
073                                  this.add(SCV.class, false, 0, 80, new Object[]{ getMessage() }, "Location Selection Criteria");
074                                  this.add(NM.class, false, 1, 5, new Object[]{ getMessage() }, "Slot Spacing Criteria");
075                                  this.add(SCV.class, false, 0, 80, new Object[]{ getMessage() }, "Filler Override Criteria");
076       } catch(HL7Exception e) {
077          log.error("Unexpected error creating APR - this is probably a bug in the source code generator.", e);
078       }
079    }
080
081
082    /**
083     * Returns all repetitions of Time Selection Criteria (APR-1).
084     */
085    public SCV[] getTimeSelectionCriteria() {
086        SCV[] retVal = this.getTypedField(1, new SCV[0]);
087        return retVal;
088    }
089
090
091    /**
092     * Returns all repetitions of Time Selection Criteria (APR-1).
093     */
094    public SCV[] getApr1_TimeSelectionCriteria() {
095        SCV[] retVal = this.getTypedField(1, new SCV[0]);
096        return retVal;
097    }
098
099
100    /**
101     * Returns a count of the current number of repetitions of Time Selection Criteria (APR-1).
102     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
103     * it will return zero.
104     */
105    public int getTimeSelectionCriteriaReps() {
106        return this.getReps(1);
107    }
108
109
110    /**
111     * Returns a specific repetition of
112     * APR-1: "Time Selection Criteria" - creates it if necessary
113     *
114     * @param rep The repetition index (0-indexed)
115     */
116    public SCV getTimeSelectionCriteria(int rep) { 
117                SCV retVal = this.getTypedField(1, rep);
118                return retVal;
119    }
120
121    /**
122     * Returns a specific repetition of
123     * APR-1: "Time Selection Criteria" - creates it if necessary
124     *
125     * @param rep The repetition index (0-indexed)
126     */
127    public SCV getApr1_TimeSelectionCriteria(int rep) { 
128                SCV retVal = this.getTypedField(1, rep);
129                return retVal;
130    }
131
132    /**
133     * Returns a count of the current number of repetitions of Time Selection Criteria (APR-1).
134     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
135     * it will return zero.
136     */
137    public int getApr1_TimeSelectionCriteriaReps() {
138        return this.getReps(1);
139    }
140
141
142    /**
143     * Inserts a repetition of
144     * APR-1: "Time Selection Criteria" at a specific index
145     *
146     * @param rep The repetition index (0-indexed)
147     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
148     */
149    public SCV insertTimeSelectionCriteria(int rep) throws HL7Exception { 
150        return (SCV) super.insertRepetition(1, rep);
151    }
152
153
154    /**
155     * Inserts a repetition of
156     * APR-1: "Time Selection Criteria" at a specific index
157     *
158     * @param rep The repetition index (0-indexed)
159     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
160     */
161    public SCV insertApr1_TimeSelectionCriteria(int rep) throws HL7Exception { 
162        return (SCV) super.insertRepetition(1, rep);
163    }
164
165
166    /**
167     * Removes a repetition of
168     * APR-1: "Time Selection Criteria" at a specific index
169     *
170     * @param rep The repetition index (0-indexed)
171     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
172     */
173    public SCV removeTimeSelectionCriteria(int rep) throws HL7Exception { 
174        return (SCV) super.removeRepetition(1, rep);
175    }
176
177
178    /**
179     * Removes a repetition of
180     * APR-1: "Time Selection Criteria" at a specific index
181     *
182     * @param rep The repetition index (0-indexed)
183     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
184     */
185    public SCV removeApr1_TimeSelectionCriteria(int rep) throws HL7Exception { 
186        return (SCV) super.removeRepetition(1, rep);
187    }
188
189
190
191    /**
192     * Returns all repetitions of Resource Selection Criteria (APR-2).
193     */
194    public SCV[] getResourceSelectionCriteria() {
195        SCV[] retVal = this.getTypedField(2, new SCV[0]);
196        return retVal;
197    }
198
199
200    /**
201     * Returns all repetitions of Resource Selection Criteria (APR-2).
202     */
203    public SCV[] getApr2_ResourceSelectionCriteria() {
204        SCV[] retVal = this.getTypedField(2, new SCV[0]);
205        return retVal;
206    }
207
208
209    /**
210     * Returns a count of the current number of repetitions of Resource Selection Criteria (APR-2).
211     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
212     * it will return zero.
213     */
214    public int getResourceSelectionCriteriaReps() {
215        return this.getReps(2);
216    }
217
218
219    /**
220     * Returns a specific repetition of
221     * APR-2: "Resource Selection Criteria" - creates it if necessary
222     *
223     * @param rep The repetition index (0-indexed)
224     */
225    public SCV getResourceSelectionCriteria(int rep) { 
226                SCV retVal = this.getTypedField(2, rep);
227                return retVal;
228    }
229
230    /**
231     * Returns a specific repetition of
232     * APR-2: "Resource Selection Criteria" - creates it if necessary
233     *
234     * @param rep The repetition index (0-indexed)
235     */
236    public SCV getApr2_ResourceSelectionCriteria(int rep) { 
237                SCV retVal = this.getTypedField(2, rep);
238                return retVal;
239    }
240
241    /**
242     * Returns a count of the current number of repetitions of Resource Selection Criteria (APR-2).
243     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
244     * it will return zero.
245     */
246    public int getApr2_ResourceSelectionCriteriaReps() {
247        return this.getReps(2);
248    }
249
250
251    /**
252     * Inserts a repetition of
253     * APR-2: "Resource Selection Criteria" at a specific index
254     *
255     * @param rep The repetition index (0-indexed)
256     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
257     */
258    public SCV insertResourceSelectionCriteria(int rep) throws HL7Exception { 
259        return (SCV) super.insertRepetition(2, rep);
260    }
261
262
263    /**
264     * Inserts a repetition of
265     * APR-2: "Resource Selection Criteria" at a specific index
266     *
267     * @param rep The repetition index (0-indexed)
268     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
269     */
270    public SCV insertApr2_ResourceSelectionCriteria(int rep) throws HL7Exception { 
271        return (SCV) super.insertRepetition(2, rep);
272    }
273
274
275    /**
276     * Removes a repetition of
277     * APR-2: "Resource Selection Criteria" at a specific index
278     *
279     * @param rep The repetition index (0-indexed)
280     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
281     */
282    public SCV removeResourceSelectionCriteria(int rep) throws HL7Exception { 
283        return (SCV) super.removeRepetition(2, rep);
284    }
285
286
287    /**
288     * Removes a repetition of
289     * APR-2: "Resource Selection Criteria" at a specific index
290     *
291     * @param rep The repetition index (0-indexed)
292     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
293     */
294    public SCV removeApr2_ResourceSelectionCriteria(int rep) throws HL7Exception { 
295        return (SCV) super.removeRepetition(2, rep);
296    }
297
298
299
300    /**
301     * Returns all repetitions of Location Selection Criteria (APR-3).
302     */
303    public SCV[] getLocationSelectionCriteria() {
304        SCV[] retVal = this.getTypedField(3, new SCV[0]);
305        return retVal;
306    }
307
308
309    /**
310     * Returns all repetitions of Location Selection Criteria (APR-3).
311     */
312    public SCV[] getApr3_LocationSelectionCriteria() {
313        SCV[] retVal = this.getTypedField(3, new SCV[0]);
314        return retVal;
315    }
316
317
318    /**
319     * Returns a count of the current number of repetitions of Location Selection Criteria (APR-3).
320     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
321     * it will return zero.
322     */
323    public int getLocationSelectionCriteriaReps() {
324        return this.getReps(3);
325    }
326
327
328    /**
329     * Returns a specific repetition of
330     * APR-3: "Location Selection Criteria" - creates it if necessary
331     *
332     * @param rep The repetition index (0-indexed)
333     */
334    public SCV getLocationSelectionCriteria(int rep) { 
335                SCV retVal = this.getTypedField(3, rep);
336                return retVal;
337    }
338
339    /**
340     * Returns a specific repetition of
341     * APR-3: "Location Selection Criteria" - creates it if necessary
342     *
343     * @param rep The repetition index (0-indexed)
344     */
345    public SCV getApr3_LocationSelectionCriteria(int rep) { 
346                SCV retVal = this.getTypedField(3, rep);
347                return retVal;
348    }
349
350    /**
351     * Returns a count of the current number of repetitions of Location Selection Criteria (APR-3).
352     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
353     * it will return zero.
354     */
355    public int getApr3_LocationSelectionCriteriaReps() {
356        return this.getReps(3);
357    }
358
359
360    /**
361     * Inserts a repetition of
362     * APR-3: "Location Selection Criteria" at a specific index
363     *
364     * @param rep The repetition index (0-indexed)
365     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
366     */
367    public SCV insertLocationSelectionCriteria(int rep) throws HL7Exception { 
368        return (SCV) super.insertRepetition(3, rep);
369    }
370
371
372    /**
373     * Inserts a repetition of
374     * APR-3: "Location Selection Criteria" at a specific index
375     *
376     * @param rep The repetition index (0-indexed)
377     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
378     */
379    public SCV insertApr3_LocationSelectionCriteria(int rep) throws HL7Exception { 
380        return (SCV) super.insertRepetition(3, rep);
381    }
382
383
384    /**
385     * Removes a repetition of
386     * APR-3: "Location Selection Criteria" at a specific index
387     *
388     * @param rep The repetition index (0-indexed)
389     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
390     */
391    public SCV removeLocationSelectionCriteria(int rep) throws HL7Exception { 
392        return (SCV) super.removeRepetition(3, rep);
393    }
394
395
396    /**
397     * Removes a repetition of
398     * APR-3: "Location Selection Criteria" at a specific index
399     *
400     * @param rep The repetition index (0-indexed)
401     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
402     */
403    public SCV removeApr3_LocationSelectionCriteria(int rep) throws HL7Exception { 
404        return (SCV) super.removeRepetition(3, rep);
405    }
406
407
408
409
410    /**
411     * Returns
412     * APR-4: "Slot Spacing Criteria" - creates it if necessary
413     */
414    public NM getSlotSpacingCriteria() { 
415                NM retVal = this.getTypedField(4, 0);
416                return retVal;
417    }
418    
419    /**
420     * Returns
421     * APR-4: "Slot Spacing Criteria" - creates it if necessary
422     */
423    public NM getApr4_SlotSpacingCriteria() { 
424                NM retVal = this.getTypedField(4, 0);
425                return retVal;
426    }
427
428
429    /**
430     * Returns all repetitions of Filler Override Criteria (APR-5).
431     */
432    public SCV[] getFillerOverrideCriteria() {
433        SCV[] retVal = this.getTypedField(5, new SCV[0]);
434        return retVal;
435    }
436
437
438    /**
439     * Returns all repetitions of Filler Override Criteria (APR-5).
440     */
441    public SCV[] getApr5_FillerOverrideCriteria() {
442        SCV[] retVal = this.getTypedField(5, new SCV[0]);
443        return retVal;
444    }
445
446
447    /**
448     * Returns a count of the current number of repetitions of Filler Override Criteria (APR-5).
449     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
450     * it will return zero.
451     */
452    public int getFillerOverrideCriteriaReps() {
453        return this.getReps(5);
454    }
455
456
457    /**
458     * Returns a specific repetition of
459     * APR-5: "Filler Override Criteria" - creates it if necessary
460     *
461     * @param rep The repetition index (0-indexed)
462     */
463    public SCV getFillerOverrideCriteria(int rep) { 
464                SCV retVal = this.getTypedField(5, rep);
465                return retVal;
466    }
467
468    /**
469     * Returns a specific repetition of
470     * APR-5: "Filler Override Criteria" - creates it if necessary
471     *
472     * @param rep The repetition index (0-indexed)
473     */
474    public SCV getApr5_FillerOverrideCriteria(int rep) { 
475                SCV retVal = this.getTypedField(5, rep);
476                return retVal;
477    }
478
479    /**
480     * Returns a count of the current number of repetitions of Filler Override Criteria (APR-5).
481     * This method does not create a repetition, so if no repetitions have currently been defined or accessed,
482     * it will return zero.
483     */
484    public int getApr5_FillerOverrideCriteriaReps() {
485        return this.getReps(5);
486    }
487
488
489    /**
490     * Inserts a repetition of
491     * APR-5: "Filler Override Criteria" at a specific index
492     *
493     * @param rep The repetition index (0-indexed)
494     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
495     */
496    public SCV insertFillerOverrideCriteria(int rep) throws HL7Exception { 
497        return (SCV) super.insertRepetition(5, rep);
498    }
499
500
501    /**
502     * Inserts a repetition of
503     * APR-5: "Filler Override Criteria" at a specific index
504     *
505     * @param rep The repetition index (0-indexed)
506     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
507     */
508    public SCV insertApr5_FillerOverrideCriteria(int rep) throws HL7Exception { 
509        return (SCV) super.insertRepetition(5, rep);
510    }
511
512
513    /**
514     * Removes a repetition of
515     * APR-5: "Filler Override Criteria" at a specific index
516     *
517     * @param rep The repetition index (0-indexed)
518     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
519     */
520    public SCV removeFillerOverrideCriteria(int rep) throws HL7Exception { 
521        return (SCV) super.removeRepetition(5, rep);
522    }
523
524
525    /**
526     * Removes a repetition of
527     * APR-5: "Filler Override Criteria" at a specific index
528     *
529     * @param rep The repetition index (0-indexed)
530     * @throws HL7Exception If the rep is invalid (below 0, or too high for the allowable repetitions)
531     */
532    public SCV removeApr5_FillerOverrideCriteria(int rep) throws HL7Exception { 
533        return (SCV) super.removeRepetition(5, rep);
534    }
535
536
537
538
539
540
541    /** {@inheritDoc} */   
542    protected Type createNewTypeWithoutReflection(int field) {
543       switch (field) {
544          case 0: return new SCV(getMessage());
545          case 1: return new SCV(getMessage());
546          case 2: return new SCV(getMessage());
547          case 3: return new NM(getMessage());
548          case 4: return new SCV(getMessage());
549          default: return null;
550       }
551   }
552
553
554}
555