001package org.hl7.fhir.dstu3.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu3
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023
024import java.math.BigDecimal;
025
026/*
027  Copyright (c) 2011+, HL7, Inc.
028  All rights reserved.
029  
030  Redistribution and use in source and binary forms, with or without modification, 
031  are permitted provided that the following conditions are met:
032  
033   * Redistributions of source code must retain the above copyright notice, this 
034     list of conditions and the following disclaimer.
035   * Redistributions in binary form must reproduce the above copyright notice, 
036     this list of conditions and the following disclaimer in the documentation 
037     and/or other materials provided with the distribution.
038   * Neither the name of HL7 nor the names of its contributors may be used to 
039     endorse or promote products derived from this software without specific 
040     prior written permission.
041  
042  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
043  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
044  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
045  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
046  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
047  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
048  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
049  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
050  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
051  POSSIBILITY OF SUCH DAMAGE.
052  
053*/
054
055// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
056import java.util.ArrayList;
057import java.util.Date;
058import java.util.List;
059
060import org.hl7.fhir.exceptions.FHIRException;
061import org.hl7.fhir.exceptions.FHIRFormatError;
062import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
063import org.hl7.fhir.instance.model.api.ICompositeType;
064
065import ca.uhn.fhir.model.api.annotation.Block;
066import ca.uhn.fhir.model.api.annotation.Child;
067import ca.uhn.fhir.model.api.annotation.DatatypeDef;
068import ca.uhn.fhir.model.api.annotation.Description;
069/**
070 * Specifies an event that may occur multiple times. Timing schedules are used to record when things are planned, expected or requested to occur. The most common usage is in dosage instructions for medications. They are also used when planning care of various kinds, and may be used for reporting the schedule to which past regular activities were carried out.
071 */
072@DatatypeDef(name="Timing")
073public class Timing extends Type implements ICompositeType {
074
075    public enum UnitsOfTime {
076        /**
077         * null
078         */
079        S, 
080        /**
081         * null
082         */
083        MIN, 
084        /**
085         * null
086         */
087        H, 
088        /**
089         * null
090         */
091        D, 
092        /**
093         * null
094         */
095        WK, 
096        /**
097         * null
098         */
099        MO, 
100        /**
101         * null
102         */
103        A, 
104        /**
105         * added to help the parsers with the generic types
106         */
107        NULL;
108        public static UnitsOfTime fromCode(String codeString) throws FHIRException {
109            if (codeString == null || "".equals(codeString))
110                return null;
111        if ("s".equals(codeString))
112          return S;
113        if ("min".equals(codeString))
114          return MIN;
115        if ("h".equals(codeString))
116          return H;
117        if ("d".equals(codeString))
118          return D;
119        if ("wk".equals(codeString))
120          return WK;
121        if ("mo".equals(codeString))
122          return MO;
123        if ("a".equals(codeString))
124          return A;
125        if (Configuration.isAcceptInvalidEnums())
126          return null;
127        else
128          throw new FHIRException("Unknown UnitsOfTime code '"+codeString+"'");
129        }
130        public String toCode() {
131          switch (this) {
132            case S: return "s";
133            case MIN: return "min";
134            case H: return "h";
135            case D: return "d";
136            case WK: return "wk";
137            case MO: return "mo";
138            case A: return "a";
139            default: return "?";
140          }
141        }
142        public String getSystem() {
143          switch (this) {
144            case S: return "http://unitsofmeasure.org";
145            case MIN: return "http://unitsofmeasure.org";
146            case H: return "http://unitsofmeasure.org";
147            case D: return "http://unitsofmeasure.org";
148            case WK: return "http://unitsofmeasure.org";
149            case MO: return "http://unitsofmeasure.org";
150            case A: return "http://unitsofmeasure.org";
151            default: return "?";
152          }
153        }
154        public String getDefinition() {
155          switch (this) {
156            case S: return "";
157            case MIN: return "";
158            case H: return "";
159            case D: return "";
160            case WK: return "";
161            case MO: return "";
162            case A: return "";
163            default: return "?";
164          }
165        }
166        public String getDisplay() {
167          switch (this) {
168            case S: return "second";
169            case MIN: return "minute";
170            case H: return "hour";
171            case D: return "day";
172            case WK: return "week";
173            case MO: return "month";
174            case A: return "year";
175            default: return "?";
176          }
177        }
178    }
179
180  public static class UnitsOfTimeEnumFactory implements EnumFactory<UnitsOfTime> {
181    public UnitsOfTime fromCode(String codeString) throws IllegalArgumentException {
182      if (codeString == null || "".equals(codeString))
183            if (codeString == null || "".equals(codeString))
184                return null;
185        if ("s".equals(codeString))
186          return UnitsOfTime.S;
187        if ("min".equals(codeString))
188          return UnitsOfTime.MIN;
189        if ("h".equals(codeString))
190          return UnitsOfTime.H;
191        if ("d".equals(codeString))
192          return UnitsOfTime.D;
193        if ("wk".equals(codeString))
194          return UnitsOfTime.WK;
195        if ("mo".equals(codeString))
196          return UnitsOfTime.MO;
197        if ("a".equals(codeString))
198          return UnitsOfTime.A;
199        throw new IllegalArgumentException("Unknown UnitsOfTime code '"+codeString+"'");
200        }
201        public Enumeration<UnitsOfTime> fromType(Base code) throws FHIRException {
202          if (code == null)
203            return null;
204          if (code.isEmpty())
205            return new Enumeration<UnitsOfTime>(this);
206          String codeString = ((PrimitiveType) code).asStringValue();
207          if (codeString == null || "".equals(codeString))
208            return null;
209        if ("s".equals(codeString))
210          return new Enumeration<UnitsOfTime>(this, UnitsOfTime.S);
211        if ("min".equals(codeString))
212          return new Enumeration<UnitsOfTime>(this, UnitsOfTime.MIN);
213        if ("h".equals(codeString))
214          return new Enumeration<UnitsOfTime>(this, UnitsOfTime.H);
215        if ("d".equals(codeString))
216          return new Enumeration<UnitsOfTime>(this, UnitsOfTime.D);
217        if ("wk".equals(codeString))
218          return new Enumeration<UnitsOfTime>(this, UnitsOfTime.WK);
219        if ("mo".equals(codeString))
220          return new Enumeration<UnitsOfTime>(this, UnitsOfTime.MO);
221        if ("a".equals(codeString))
222          return new Enumeration<UnitsOfTime>(this, UnitsOfTime.A);
223        throw new FHIRException("Unknown UnitsOfTime code '"+codeString+"'");
224        }
225    public String toCode(UnitsOfTime code) {
226      if (code == UnitsOfTime.S)
227        return "s";
228      if (code == UnitsOfTime.MIN)
229        return "min";
230      if (code == UnitsOfTime.H)
231        return "h";
232      if (code == UnitsOfTime.D)
233        return "d";
234      if (code == UnitsOfTime.WK)
235        return "wk";
236      if (code == UnitsOfTime.MO)
237        return "mo";
238      if (code == UnitsOfTime.A)
239        return "a";
240      return "?";
241      }
242    public String toSystem(UnitsOfTime code) {
243      return code.getSystem();
244      }
245    }
246
247    public enum DayOfWeek {
248        /**
249         * Monday
250         */
251        MON, 
252        /**
253         * Tuesday
254         */
255        TUE, 
256        /**
257         * Wednesday
258         */
259        WED, 
260        /**
261         * Thursday
262         */
263        THU, 
264        /**
265         * Friday
266         */
267        FRI, 
268        /**
269         * Saturday
270         */
271        SAT, 
272        /**
273         * Sunday
274         */
275        SUN, 
276        /**
277         * added to help the parsers with the generic types
278         */
279        NULL;
280        public static DayOfWeek fromCode(String codeString) throws FHIRException {
281            if (codeString == null || "".equals(codeString))
282                return null;
283        if ("mon".equals(codeString))
284          return MON;
285        if ("tue".equals(codeString))
286          return TUE;
287        if ("wed".equals(codeString))
288          return WED;
289        if ("thu".equals(codeString))
290          return THU;
291        if ("fri".equals(codeString))
292          return FRI;
293        if ("sat".equals(codeString))
294          return SAT;
295        if ("sun".equals(codeString))
296          return SUN;
297        if (Configuration.isAcceptInvalidEnums())
298          return null;
299        else
300          throw new FHIRException("Unknown DayOfWeek code '"+codeString+"'");
301        }
302        public String toCode() {
303          switch (this) {
304            case MON: return "mon";
305            case TUE: return "tue";
306            case WED: return "wed";
307            case THU: return "thu";
308            case FRI: return "fri";
309            case SAT: return "sat";
310            case SUN: return "sun";
311            default: return "?";
312          }
313        }
314        public String getSystem() {
315          switch (this) {
316            case MON: return "http://hl7.org/fhir/days-of-week";
317            case TUE: return "http://hl7.org/fhir/days-of-week";
318            case WED: return "http://hl7.org/fhir/days-of-week";
319            case THU: return "http://hl7.org/fhir/days-of-week";
320            case FRI: return "http://hl7.org/fhir/days-of-week";
321            case SAT: return "http://hl7.org/fhir/days-of-week";
322            case SUN: return "http://hl7.org/fhir/days-of-week";
323            default: return "?";
324          }
325        }
326        public String getDefinition() {
327          switch (this) {
328            case MON: return "Monday";
329            case TUE: return "Tuesday";
330            case WED: return "Wednesday";
331            case THU: return "Thursday";
332            case FRI: return "Friday";
333            case SAT: return "Saturday";
334            case SUN: return "Sunday";
335            default: return "?";
336          }
337        }
338        public String getDisplay() {
339          switch (this) {
340            case MON: return "Monday";
341            case TUE: return "Tuesday";
342            case WED: return "Wednesday";
343            case THU: return "Thursday";
344            case FRI: return "Friday";
345            case SAT: return "Saturday";
346            case SUN: return "Sunday";
347            default: return "?";
348          }
349        }
350    }
351
352  public static class DayOfWeekEnumFactory implements EnumFactory<DayOfWeek> {
353    public DayOfWeek fromCode(String codeString) throws IllegalArgumentException {
354      if (codeString == null || "".equals(codeString))
355            if (codeString == null || "".equals(codeString))
356                return null;
357        if ("mon".equals(codeString))
358          return DayOfWeek.MON;
359        if ("tue".equals(codeString))
360          return DayOfWeek.TUE;
361        if ("wed".equals(codeString))
362          return DayOfWeek.WED;
363        if ("thu".equals(codeString))
364          return DayOfWeek.THU;
365        if ("fri".equals(codeString))
366          return DayOfWeek.FRI;
367        if ("sat".equals(codeString))
368          return DayOfWeek.SAT;
369        if ("sun".equals(codeString))
370          return DayOfWeek.SUN;
371        throw new IllegalArgumentException("Unknown DayOfWeek code '"+codeString+"'");
372        }
373        public Enumeration<DayOfWeek> fromType(Base code) throws FHIRException {
374          if (code == null)
375            return null;
376          if (code.isEmpty())
377            return new Enumeration<DayOfWeek>(this);
378          String codeString = ((PrimitiveType) code).asStringValue();
379          if (codeString == null || "".equals(codeString))
380            return null;
381        if ("mon".equals(codeString))
382          return new Enumeration<DayOfWeek>(this, DayOfWeek.MON);
383        if ("tue".equals(codeString))
384          return new Enumeration<DayOfWeek>(this, DayOfWeek.TUE);
385        if ("wed".equals(codeString))
386          return new Enumeration<DayOfWeek>(this, DayOfWeek.WED);
387        if ("thu".equals(codeString))
388          return new Enumeration<DayOfWeek>(this, DayOfWeek.THU);
389        if ("fri".equals(codeString))
390          return new Enumeration<DayOfWeek>(this, DayOfWeek.FRI);
391        if ("sat".equals(codeString))
392          return new Enumeration<DayOfWeek>(this, DayOfWeek.SAT);
393        if ("sun".equals(codeString))
394          return new Enumeration<DayOfWeek>(this, DayOfWeek.SUN);
395        throw new FHIRException("Unknown DayOfWeek code '"+codeString+"'");
396        }
397    public String toCode(DayOfWeek code) {
398      if (code == DayOfWeek.MON)
399        return "mon";
400      if (code == DayOfWeek.TUE)
401        return "tue";
402      if (code == DayOfWeek.WED)
403        return "wed";
404      if (code == DayOfWeek.THU)
405        return "thu";
406      if (code == DayOfWeek.FRI)
407        return "fri";
408      if (code == DayOfWeek.SAT)
409        return "sat";
410      if (code == DayOfWeek.SUN)
411        return "sun";
412      return "?";
413      }
414    public String toSystem(DayOfWeek code) {
415      return code.getSystem();
416      }
417    }
418
419    public enum EventTiming {
420        /**
421         * event occurs during the morning
422         */
423        MORN, 
424        /**
425         * event occurs during the afternoon
426         */
427        AFT, 
428        /**
429         * event occurs during the evening
430         */
431        EVE, 
432        /**
433         * event occurs during the night
434         */
435        NIGHT, 
436        /**
437         * event occurs [offset] after subject goes to sleep
438         */
439        PHS, 
440        /**
441         * null
442         */
443        HS, 
444        /**
445         * null
446         */
447        WAKE, 
448        /**
449         * null
450         */
451        C, 
452        /**
453         * null
454         */
455        CM, 
456        /**
457         * null
458         */
459        CD, 
460        /**
461         * null
462         */
463        CV, 
464        /**
465         * null
466         */
467        AC, 
468        /**
469         * null
470         */
471        ACM, 
472        /**
473         * null
474         */
475        ACD, 
476        /**
477         * null
478         */
479        ACV, 
480        /**
481         * null
482         */
483        PC, 
484        /**
485         * null
486         */
487        PCM, 
488        /**
489         * null
490         */
491        PCD, 
492        /**
493         * null
494         */
495        PCV, 
496        /**
497         * added to help the parsers with the generic types
498         */
499        NULL;
500        public static EventTiming fromCode(String codeString) throws FHIRException {
501            if (codeString == null || "".equals(codeString))
502                return null;
503        if ("MORN".equals(codeString))
504          return MORN;
505        if ("AFT".equals(codeString))
506          return AFT;
507        if ("EVE".equals(codeString))
508          return EVE;
509        if ("NIGHT".equals(codeString))
510          return NIGHT;
511        if ("PHS".equals(codeString))
512          return PHS;
513        if ("HS".equals(codeString))
514          return HS;
515        if ("WAKE".equals(codeString))
516          return WAKE;
517        if ("C".equals(codeString))
518          return C;
519        if ("CM".equals(codeString))
520          return CM;
521        if ("CD".equals(codeString))
522          return CD;
523        if ("CV".equals(codeString))
524          return CV;
525        if ("AC".equals(codeString))
526          return AC;
527        if ("ACM".equals(codeString))
528          return ACM;
529        if ("ACD".equals(codeString))
530          return ACD;
531        if ("ACV".equals(codeString))
532          return ACV;
533        if ("PC".equals(codeString))
534          return PC;
535        if ("PCM".equals(codeString))
536          return PCM;
537        if ("PCD".equals(codeString))
538          return PCD;
539        if ("PCV".equals(codeString))
540          return PCV;
541        if (Configuration.isAcceptInvalidEnums())
542          return null;
543        else
544          throw new FHIRException("Unknown EventTiming code '"+codeString+"'");
545        }
546        public String toCode() {
547          switch (this) {
548            case MORN: return "MORN";
549            case AFT: return "AFT";
550            case EVE: return "EVE";
551            case NIGHT: return "NIGHT";
552            case PHS: return "PHS";
553            case HS: return "HS";
554            case WAKE: return "WAKE";
555            case C: return "C";
556            case CM: return "CM";
557            case CD: return "CD";
558            case CV: return "CV";
559            case AC: return "AC";
560            case ACM: return "ACM";
561            case ACD: return "ACD";
562            case ACV: return "ACV";
563            case PC: return "PC";
564            case PCM: return "PCM";
565            case PCD: return "PCD";
566            case PCV: return "PCV";
567            default: return "?";
568          }
569        }
570        public String getSystem() {
571          switch (this) {
572            case MORN: return "http://hl7.org/fhir/event-timing";
573            case AFT: return "http://hl7.org/fhir/event-timing";
574            case EVE: return "http://hl7.org/fhir/event-timing";
575            case NIGHT: return "http://hl7.org/fhir/event-timing";
576            case PHS: return "http://hl7.org/fhir/event-timing";
577            case HS: return "http://hl7.org/fhir/v3/TimingEvent";
578            case WAKE: return "http://hl7.org/fhir/v3/TimingEvent";
579            case C: return "http://hl7.org/fhir/v3/TimingEvent";
580            case CM: return "http://hl7.org/fhir/v3/TimingEvent";
581            case CD: return "http://hl7.org/fhir/v3/TimingEvent";
582            case CV: return "http://hl7.org/fhir/v3/TimingEvent";
583            case AC: return "http://hl7.org/fhir/v3/TimingEvent";
584            case ACM: return "http://hl7.org/fhir/v3/TimingEvent";
585            case ACD: return "http://hl7.org/fhir/v3/TimingEvent";
586            case ACV: return "http://hl7.org/fhir/v3/TimingEvent";
587            case PC: return "http://hl7.org/fhir/v3/TimingEvent";
588            case PCM: return "http://hl7.org/fhir/v3/TimingEvent";
589            case PCD: return "http://hl7.org/fhir/v3/TimingEvent";
590            case PCV: return "http://hl7.org/fhir/v3/TimingEvent";
591            default: return "?";
592          }
593        }
594        public String getDefinition() {
595          switch (this) {
596            case MORN: return "event occurs during the morning";
597            case AFT: return "event occurs during the afternoon";
598            case EVE: return "event occurs during the evening";
599            case NIGHT: return "event occurs during the night";
600            case PHS: return "event occurs [offset] after subject goes to sleep";
601            case HS: return "";
602            case WAKE: return "";
603            case C: return "";
604            case CM: return "";
605            case CD: return "";
606            case CV: return "";
607            case AC: return "";
608            case ACM: return "";
609            case ACD: return "";
610            case ACV: return "";
611            case PC: return "";
612            case PCM: return "";
613            case PCD: return "";
614            case PCV: return "";
615            default: return "?";
616          }
617        }
618        public String getDisplay() {
619          switch (this) {
620            case MORN: return "Morning";
621            case AFT: return "Afternoon";
622            case EVE: return "Evening";
623            case NIGHT: return "Night";
624            case PHS: return "After Sleep";
625            case HS: return "HS";
626            case WAKE: return "WAKE";
627            case C: return "C";
628            case CM: return "CM";
629            case CD: return "CD";
630            case CV: return "CV";
631            case AC: return "AC";
632            case ACM: return "ACM";
633            case ACD: return "ACD";
634            case ACV: return "ACV";
635            case PC: return "PC";
636            case PCM: return "PCM";
637            case PCD: return "PCD";
638            case PCV: return "PCV";
639            default: return "?";
640          }
641        }
642    }
643
644  public static class EventTimingEnumFactory implements EnumFactory<EventTiming> {
645    public EventTiming fromCode(String codeString) throws IllegalArgumentException {
646      if (codeString == null || "".equals(codeString))
647            if (codeString == null || "".equals(codeString))
648                return null;
649        if ("MORN".equals(codeString))
650          return EventTiming.MORN;
651        if ("AFT".equals(codeString))
652          return EventTiming.AFT;
653        if ("EVE".equals(codeString))
654          return EventTiming.EVE;
655        if ("NIGHT".equals(codeString))
656          return EventTiming.NIGHT;
657        if ("PHS".equals(codeString))
658          return EventTiming.PHS;
659        if ("HS".equals(codeString))
660          return EventTiming.HS;
661        if ("WAKE".equals(codeString))
662          return EventTiming.WAKE;
663        if ("C".equals(codeString))
664          return EventTiming.C;
665        if ("CM".equals(codeString))
666          return EventTiming.CM;
667        if ("CD".equals(codeString))
668          return EventTiming.CD;
669        if ("CV".equals(codeString))
670          return EventTiming.CV;
671        if ("AC".equals(codeString))
672          return EventTiming.AC;
673        if ("ACM".equals(codeString))
674          return EventTiming.ACM;
675        if ("ACD".equals(codeString))
676          return EventTiming.ACD;
677        if ("ACV".equals(codeString))
678          return EventTiming.ACV;
679        if ("PC".equals(codeString))
680          return EventTiming.PC;
681        if ("PCM".equals(codeString))
682          return EventTiming.PCM;
683        if ("PCD".equals(codeString))
684          return EventTiming.PCD;
685        if ("PCV".equals(codeString))
686          return EventTiming.PCV;
687        throw new IllegalArgumentException("Unknown EventTiming code '"+codeString+"'");
688        }
689        public Enumeration<EventTiming> fromType(Base code) throws FHIRException {
690          if (code == null)
691            return null;
692          if (code.isEmpty())
693            return new Enumeration<EventTiming>(this);
694          String codeString = ((PrimitiveType) code).asStringValue();
695          if (codeString == null || "".equals(codeString))
696            return null;
697        if ("MORN".equals(codeString))
698          return new Enumeration<EventTiming>(this, EventTiming.MORN);
699        if ("AFT".equals(codeString))
700          return new Enumeration<EventTiming>(this, EventTiming.AFT);
701        if ("EVE".equals(codeString))
702          return new Enumeration<EventTiming>(this, EventTiming.EVE);
703        if ("NIGHT".equals(codeString))
704          return new Enumeration<EventTiming>(this, EventTiming.NIGHT);
705        if ("PHS".equals(codeString))
706          return new Enumeration<EventTiming>(this, EventTiming.PHS);
707        if ("HS".equals(codeString))
708          return new Enumeration<EventTiming>(this, EventTiming.HS);
709        if ("WAKE".equals(codeString))
710          return new Enumeration<EventTiming>(this, EventTiming.WAKE);
711        if ("C".equals(codeString))
712          return new Enumeration<EventTiming>(this, EventTiming.C);
713        if ("CM".equals(codeString))
714          return new Enumeration<EventTiming>(this, EventTiming.CM);
715        if ("CD".equals(codeString))
716          return new Enumeration<EventTiming>(this, EventTiming.CD);
717        if ("CV".equals(codeString))
718          return new Enumeration<EventTiming>(this, EventTiming.CV);
719        if ("AC".equals(codeString))
720          return new Enumeration<EventTiming>(this, EventTiming.AC);
721        if ("ACM".equals(codeString))
722          return new Enumeration<EventTiming>(this, EventTiming.ACM);
723        if ("ACD".equals(codeString))
724          return new Enumeration<EventTiming>(this, EventTiming.ACD);
725        if ("ACV".equals(codeString))
726          return new Enumeration<EventTiming>(this, EventTiming.ACV);
727        if ("PC".equals(codeString))
728          return new Enumeration<EventTiming>(this, EventTiming.PC);
729        if ("PCM".equals(codeString))
730          return new Enumeration<EventTiming>(this, EventTiming.PCM);
731        if ("PCD".equals(codeString))
732          return new Enumeration<EventTiming>(this, EventTiming.PCD);
733        if ("PCV".equals(codeString))
734          return new Enumeration<EventTiming>(this, EventTiming.PCV);
735        throw new FHIRException("Unknown EventTiming code '"+codeString+"'");
736        }
737    public String toCode(EventTiming code) {
738      if (code == EventTiming.MORN)
739        return "MORN";
740      if (code == EventTiming.AFT)
741        return "AFT";
742      if (code == EventTiming.EVE)
743        return "EVE";
744      if (code == EventTiming.NIGHT)
745        return "NIGHT";
746      if (code == EventTiming.PHS)
747        return "PHS";
748      if (code == EventTiming.HS)
749        return "HS";
750      if (code == EventTiming.WAKE)
751        return "WAKE";
752      if (code == EventTiming.C)
753        return "C";
754      if (code == EventTiming.CM)
755        return "CM";
756      if (code == EventTiming.CD)
757        return "CD";
758      if (code == EventTiming.CV)
759        return "CV";
760      if (code == EventTiming.AC)
761        return "AC";
762      if (code == EventTiming.ACM)
763        return "ACM";
764      if (code == EventTiming.ACD)
765        return "ACD";
766      if (code == EventTiming.ACV)
767        return "ACV";
768      if (code == EventTiming.PC)
769        return "PC";
770      if (code == EventTiming.PCM)
771        return "PCM";
772      if (code == EventTiming.PCD)
773        return "PCD";
774      if (code == EventTiming.PCV)
775        return "PCV";
776      return "?";
777      }
778    public String toSystem(EventTiming code) {
779      return code.getSystem();
780      }
781    }
782
783    @Block()
784    public static class TimingRepeatComponent extends Element implements IBaseDatatypeElement {
785        /**
786         * Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.
787         */
788        @Child(name = "bounds", type = {Duration.class, Range.class, Period.class}, order=1, min=0, max=1, modifier=false, summary=true)
789        @Description(shortDefinition="Length/Range of lengths, or (Start and/or end) limits", formalDefinition="Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule." )
790        protected Type bounds;
791
792        /**
793         * A total count of the desired number of repetitions.
794         */
795        @Child(name = "count", type = {IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=true)
796        @Description(shortDefinition="Number of times to repeat", formalDefinition="A total count of the desired number of repetitions." )
797        protected IntegerType count;
798
799        /**
800         * A maximum value for the count of the desired repetitions (e.g. do something 6-8 times).
801         */
802        @Child(name = "countMax", type = {IntegerType.class}, order=3, min=0, max=1, modifier=false, summary=true)
803        @Description(shortDefinition="Maximum number of times to repeat", formalDefinition="A maximum value for the count of the desired repetitions (e.g. do something 6-8 times)." )
804        protected IntegerType countMax;
805
806        /**
807         * How long this thing happens for when it happens.
808         */
809        @Child(name = "duration", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
810        @Description(shortDefinition="How long when it happens", formalDefinition="How long this thing happens for when it happens." )
811        protected DecimalType duration;
812
813        /**
814         * The upper limit of how long this thing happens for when it happens.
815         */
816        @Child(name = "durationMax", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=true)
817        @Description(shortDefinition="How long when it happens (Max)", formalDefinition="The upper limit of how long this thing happens for when it happens." )
818        protected DecimalType durationMax;
819
820        /**
821         * The units of time for the duration, in UCUM units.
822         */
823        @Child(name = "durationUnit", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
824        @Description(shortDefinition="s | min | h | d | wk | mo | a - unit of time (UCUM)", formalDefinition="The units of time for the duration, in UCUM units." )
825        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/units-of-time")
826        protected Enumeration<UnitsOfTime> durationUnit;
827
828        /**
829         * The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided).
830         */
831        @Child(name = "frequency", type = {IntegerType.class}, order=7, min=0, max=1, modifier=false, summary=true)
832        @Description(shortDefinition="Event occurs frequency times per period", formalDefinition="The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided)." )
833        protected IntegerType frequency;
834
835        /**
836         * If present, indicates that the frequency is a range - so to repeat between [frequency] and [frequencyMax] times within the period or period range.
837         */
838        @Child(name = "frequencyMax", type = {IntegerType.class}, order=8, min=0, max=1, modifier=false, summary=true)
839        @Description(shortDefinition="Event occurs up to frequencyMax times per period", formalDefinition="If present, indicates that the frequency is a range - so to repeat between [frequency] and [frequencyMax] times within the period or period range." )
840        protected IntegerType frequencyMax;
841
842        /**
843         * Indicates the duration of time over which repetitions are to occur; e.g. to express "3 times per day", 3 would be the frequency and "1 day" would be the period.
844         */
845        @Child(name = "period", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=true)
846        @Description(shortDefinition="Event occurs frequency times per period", formalDefinition="Indicates the duration of time over which repetitions are to occur; e.g. to express \"3 times per day\", 3 would be the frequency and \"1 day\" would be the period." )
847        protected DecimalType period;
848
849        /**
850         * If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as "do this once every 3-5 days.
851         */
852        @Child(name = "periodMax", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=true)
853        @Description(shortDefinition="Upper limit of period (3-4 hours)", formalDefinition="If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as \"do this once every 3-5 days." )
854        protected DecimalType periodMax;
855
856        /**
857         * The units of time for the period in UCUM units.
858         */
859        @Child(name = "periodUnit", type = {CodeType.class}, order=11, min=0, max=1, modifier=false, summary=true)
860        @Description(shortDefinition="s | min | h | d | wk | mo | a - unit of time (UCUM)", formalDefinition="The units of time for the period in UCUM units." )
861        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/units-of-time")
862        protected Enumeration<UnitsOfTime> periodUnit;
863
864        /**
865         * If one or more days of week is provided, then the action happens only on the specified day(s).
866         */
867        @Child(name = "dayOfWeek", type = {CodeType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
868        @Description(shortDefinition="mon | tue | wed | thu | fri | sat | sun", formalDefinition="If one or more days of week is provided, then the action happens only on the specified day(s)." )
869        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/days-of-week")
870        protected List<Enumeration<DayOfWeek>> dayOfWeek;
871
872        /**
873         * Specified time of day for action to take place.
874         */
875        @Child(name = "timeOfDay", type = {TimeType.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
876        @Description(shortDefinition="Time of day for action", formalDefinition="Specified time of day for action to take place." )
877        protected List<TimeType> timeOfDay;
878
879        /**
880         * Real world events that the occurrence of the event should be tied to.
881         */
882        @Child(name = "when", type = {CodeType.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
883        @Description(shortDefinition="Regular life events the event is tied to", formalDefinition="Real world events that the occurrence of the event should be tied to." )
884        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/event-timing")
885        protected List<Enumeration<EventTiming>> when;
886
887        /**
888         * The number of minutes from the event. If the event code does not indicate whether the minutes is before or after the event, then the offset is assumed to be after the event.
889         */
890        @Child(name = "offset", type = {UnsignedIntType.class}, order=15, min=0, max=1, modifier=false, summary=true)
891        @Description(shortDefinition="Minutes from event (before or after)", formalDefinition="The number of minutes from the event. If the event code does not indicate whether the minutes is before or after the event, then the offset is assumed to be after the event." )
892        protected UnsignedIntType offset;
893
894        private static final long serialVersionUID = -1590643356L;
895
896    /**
897     * Constructor
898     */
899      public TimingRepeatComponent() {
900        super();
901      }
902
903        /**
904         * @return {@link #bounds} (Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.)
905         */
906        public Type getBounds() { 
907          return this.bounds;
908        }
909
910        /**
911         * @return {@link #bounds} (Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.)
912         */
913        public Duration getBoundsDuration() throws FHIRException { 
914          if (this.bounds == null)
915            return null;
916          if (!(this.bounds instanceof Duration))
917            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.bounds.getClass().getName()+" was encountered");
918          return (Duration) this.bounds;
919        }
920
921        public boolean hasBoundsDuration() { 
922          return this != null && this.bounds instanceof Duration;
923        }
924
925        /**
926         * @return {@link #bounds} (Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.)
927         */
928        public Range getBoundsRange() throws FHIRException { 
929          if (this.bounds == null)
930            return null;
931          if (!(this.bounds instanceof Range))
932            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.bounds.getClass().getName()+" was encountered");
933          return (Range) this.bounds;
934        }
935
936        public boolean hasBoundsRange() { 
937          return this != null && this.bounds instanceof Range;
938        }
939
940        /**
941         * @return {@link #bounds} (Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.)
942         */
943        public Period getBoundsPeriod() throws FHIRException { 
944          if (this.bounds == null)
945            return null;
946          if (!(this.bounds instanceof Period))
947            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.bounds.getClass().getName()+" was encountered");
948          return (Period) this.bounds;
949        }
950
951        public boolean hasBoundsPeriod() { 
952          return this != null && this.bounds instanceof Period;
953        }
954
955        public boolean hasBounds() { 
956          return this.bounds != null && !this.bounds.isEmpty();
957        }
958
959        /**
960         * @param value {@link #bounds} (Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.)
961         */
962        public TimingRepeatComponent setBounds(Type value) throws FHIRFormatError { 
963          if (value != null && !(value instanceof Duration || value instanceof Range || value instanceof Period))
964            throw new FHIRFormatError("Not the right type for Timing.repeat.bounds[x]: "+value.fhirType());
965          this.bounds = value;
966          return this;
967        }
968
969        /**
970         * @return {@link #count} (A total count of the desired number of repetitions.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
971         */
972        public IntegerType getCountElement() { 
973          if (this.count == null)
974            if (Configuration.errorOnAutoCreate())
975              throw new Error("Attempt to auto-create TimingRepeatComponent.count");
976            else if (Configuration.doAutoCreate())
977              this.count = new IntegerType(); // bb
978          return this.count;
979        }
980
981        public boolean hasCountElement() { 
982          return this.count != null && !this.count.isEmpty();
983        }
984
985        public boolean hasCount() { 
986          return this.count != null && !this.count.isEmpty();
987        }
988
989        /**
990         * @param value {@link #count} (A total count of the desired number of repetitions.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
991         */
992        public TimingRepeatComponent setCountElement(IntegerType value) { 
993          this.count = value;
994          return this;
995        }
996
997        /**
998         * @return A total count of the desired number of repetitions.
999         */
1000        public int getCount() { 
1001          return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue();
1002        }
1003
1004        /**
1005         * @param value A total count of the desired number of repetitions.
1006         */
1007        public TimingRepeatComponent setCount(int value) { 
1008            if (this.count == null)
1009              this.count = new IntegerType();
1010            this.count.setValue(value);
1011          return this;
1012        }
1013
1014        /**
1015         * @return {@link #countMax} (A maximum value for the count of the desired repetitions (e.g. do something 6-8 times).). This is the underlying object with id, value and extensions. The accessor "getCountMax" gives direct access to the value
1016         */
1017        public IntegerType getCountMaxElement() { 
1018          if (this.countMax == null)
1019            if (Configuration.errorOnAutoCreate())
1020              throw new Error("Attempt to auto-create TimingRepeatComponent.countMax");
1021            else if (Configuration.doAutoCreate())
1022              this.countMax = new IntegerType(); // bb
1023          return this.countMax;
1024        }
1025
1026        public boolean hasCountMaxElement() { 
1027          return this.countMax != null && !this.countMax.isEmpty();
1028        }
1029
1030        public boolean hasCountMax() { 
1031          return this.countMax != null && !this.countMax.isEmpty();
1032        }
1033
1034        /**
1035         * @param value {@link #countMax} (A maximum value for the count of the desired repetitions (e.g. do something 6-8 times).). This is the underlying object with id, value and extensions. The accessor "getCountMax" gives direct access to the value
1036         */
1037        public TimingRepeatComponent setCountMaxElement(IntegerType value) { 
1038          this.countMax = value;
1039          return this;
1040        }
1041
1042        /**
1043         * @return A maximum value for the count of the desired repetitions (e.g. do something 6-8 times).
1044         */
1045        public int getCountMax() { 
1046          return this.countMax == null || this.countMax.isEmpty() ? 0 : this.countMax.getValue();
1047        }
1048
1049        /**
1050         * @param value A maximum value for the count of the desired repetitions (e.g. do something 6-8 times).
1051         */
1052        public TimingRepeatComponent setCountMax(int value) { 
1053            if (this.countMax == null)
1054              this.countMax = new IntegerType();
1055            this.countMax.setValue(value);
1056          return this;
1057        }
1058
1059        /**
1060         * @return {@link #duration} (How long this thing happens for when it happens.). This is the underlying object with id, value and extensions. The accessor "getDuration" gives direct access to the value
1061         */
1062        public DecimalType getDurationElement() { 
1063          if (this.duration == null)
1064            if (Configuration.errorOnAutoCreate())
1065              throw new Error("Attempt to auto-create TimingRepeatComponent.duration");
1066            else if (Configuration.doAutoCreate())
1067              this.duration = new DecimalType(); // bb
1068          return this.duration;
1069        }
1070
1071        public boolean hasDurationElement() { 
1072          return this.duration != null && !this.duration.isEmpty();
1073        }
1074
1075        public boolean hasDuration() { 
1076          return this.duration != null && !this.duration.isEmpty();
1077        }
1078
1079        /**
1080         * @param value {@link #duration} (How long this thing happens for when it happens.). This is the underlying object with id, value and extensions. The accessor "getDuration" gives direct access to the value
1081         */
1082        public TimingRepeatComponent setDurationElement(DecimalType value) { 
1083          this.duration = value;
1084          return this;
1085        }
1086
1087        /**
1088         * @return How long this thing happens for when it happens.
1089         */
1090        public BigDecimal getDuration() { 
1091          return this.duration == null ? null : this.duration.getValue();
1092        }
1093
1094        /**
1095         * @param value How long this thing happens for when it happens.
1096         */
1097        public TimingRepeatComponent setDuration(BigDecimal value) { 
1098          if (value == null)
1099            this.duration = null;
1100          else {
1101            if (this.duration == null)
1102              this.duration = new DecimalType();
1103            this.duration.setValue(value);
1104          }
1105          return this;
1106        }
1107
1108        /**
1109         * @param value How long this thing happens for when it happens.
1110         */
1111        public TimingRepeatComponent setDuration(long value) { 
1112              this.duration = new DecimalType();
1113            this.duration.setValue(value);
1114          return this;
1115        }
1116
1117        /**
1118         * @param value How long this thing happens for when it happens.
1119         */
1120        public TimingRepeatComponent setDuration(double value) { 
1121              this.duration = new DecimalType();
1122            this.duration.setValue(value);
1123          return this;
1124        }
1125
1126        /**
1127         * @return {@link #durationMax} (The upper limit of how long this thing happens for when it happens.). This is the underlying object with id, value and extensions. The accessor "getDurationMax" gives direct access to the value
1128         */
1129        public DecimalType getDurationMaxElement() { 
1130          if (this.durationMax == null)
1131            if (Configuration.errorOnAutoCreate())
1132              throw new Error("Attempt to auto-create TimingRepeatComponent.durationMax");
1133            else if (Configuration.doAutoCreate())
1134              this.durationMax = new DecimalType(); // bb
1135          return this.durationMax;
1136        }
1137
1138        public boolean hasDurationMaxElement() { 
1139          return this.durationMax != null && !this.durationMax.isEmpty();
1140        }
1141
1142        public boolean hasDurationMax() { 
1143          return this.durationMax != null && !this.durationMax.isEmpty();
1144        }
1145
1146        /**
1147         * @param value {@link #durationMax} (The upper limit of how long this thing happens for when it happens.). This is the underlying object with id, value and extensions. The accessor "getDurationMax" gives direct access to the value
1148         */
1149        public TimingRepeatComponent setDurationMaxElement(DecimalType value) { 
1150          this.durationMax = value;
1151          return this;
1152        }
1153
1154        /**
1155         * @return The upper limit of how long this thing happens for when it happens.
1156         */
1157        public BigDecimal getDurationMax() { 
1158          return this.durationMax == null ? null : this.durationMax.getValue();
1159        }
1160
1161        /**
1162         * @param value The upper limit of how long this thing happens for when it happens.
1163         */
1164        public TimingRepeatComponent setDurationMax(BigDecimal value) { 
1165          if (value == null)
1166            this.durationMax = null;
1167          else {
1168            if (this.durationMax == null)
1169              this.durationMax = new DecimalType();
1170            this.durationMax.setValue(value);
1171          }
1172          return this;
1173        }
1174
1175        /**
1176         * @param value The upper limit of how long this thing happens for when it happens.
1177         */
1178        public TimingRepeatComponent setDurationMax(long value) { 
1179              this.durationMax = new DecimalType();
1180            this.durationMax.setValue(value);
1181          return this;
1182        }
1183
1184        /**
1185         * @param value The upper limit of how long this thing happens for when it happens.
1186         */
1187        public TimingRepeatComponent setDurationMax(double value) { 
1188              this.durationMax = new DecimalType();
1189            this.durationMax.setValue(value);
1190          return this;
1191        }
1192
1193        /**
1194         * @return {@link #durationUnit} (The units of time for the duration, in UCUM units.). This is the underlying object with id, value and extensions. The accessor "getDurationUnit" gives direct access to the value
1195         */
1196        public Enumeration<UnitsOfTime> getDurationUnitElement() { 
1197          if (this.durationUnit == null)
1198            if (Configuration.errorOnAutoCreate())
1199              throw new Error("Attempt to auto-create TimingRepeatComponent.durationUnit");
1200            else if (Configuration.doAutoCreate())
1201              this.durationUnit = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory()); // bb
1202          return this.durationUnit;
1203        }
1204
1205        public boolean hasDurationUnitElement() { 
1206          return this.durationUnit != null && !this.durationUnit.isEmpty();
1207        }
1208
1209        public boolean hasDurationUnit() { 
1210          return this.durationUnit != null && !this.durationUnit.isEmpty();
1211        }
1212
1213        /**
1214         * @param value {@link #durationUnit} (The units of time for the duration, in UCUM units.). This is the underlying object with id, value and extensions. The accessor "getDurationUnit" gives direct access to the value
1215         */
1216        public TimingRepeatComponent setDurationUnitElement(Enumeration<UnitsOfTime> value) { 
1217          this.durationUnit = value;
1218          return this;
1219        }
1220
1221        /**
1222         * @return The units of time for the duration, in UCUM units.
1223         */
1224        public UnitsOfTime getDurationUnit() { 
1225          return this.durationUnit == null ? null : this.durationUnit.getValue();
1226        }
1227
1228        /**
1229         * @param value The units of time for the duration, in UCUM units.
1230         */
1231        public TimingRepeatComponent setDurationUnit(UnitsOfTime value) { 
1232          if (value == null)
1233            this.durationUnit = null;
1234          else {
1235            if (this.durationUnit == null)
1236              this.durationUnit = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory());
1237            this.durationUnit.setValue(value);
1238          }
1239          return this;
1240        }
1241
1242        /**
1243         * @return {@link #frequency} (The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided).). This is the underlying object with id, value and extensions. The accessor "getFrequency" gives direct access to the value
1244         */
1245        public IntegerType getFrequencyElement() { 
1246          if (this.frequency == null)
1247            if (Configuration.errorOnAutoCreate())
1248              throw new Error("Attempt to auto-create TimingRepeatComponent.frequency");
1249            else if (Configuration.doAutoCreate())
1250              this.frequency = new IntegerType(); // bb
1251          return this.frequency;
1252        }
1253
1254        public boolean hasFrequencyElement() { 
1255          return this.frequency != null && !this.frequency.isEmpty();
1256        }
1257
1258        public boolean hasFrequency() { 
1259          return this.frequency != null && !this.frequency.isEmpty();
1260        }
1261
1262        /**
1263         * @param value {@link #frequency} (The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided).). This is the underlying object with id, value and extensions. The accessor "getFrequency" gives direct access to the value
1264         */
1265        public TimingRepeatComponent setFrequencyElement(IntegerType value) { 
1266          this.frequency = value;
1267          return this;
1268        }
1269
1270        /**
1271         * @return The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided).
1272         */
1273        public int getFrequency() { 
1274          return this.frequency == null || this.frequency.isEmpty() ? 0 : this.frequency.getValue();
1275        }
1276
1277        /**
1278         * @param value The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided).
1279         */
1280        public TimingRepeatComponent setFrequency(int value) { 
1281            if (this.frequency == null)
1282              this.frequency = new IntegerType();
1283            this.frequency.setValue(value);
1284          return this;
1285        }
1286
1287        /**
1288         * @return {@link #frequencyMax} (If present, indicates that the frequency is a range - so to repeat between [frequency] and [frequencyMax] times within the period or period range.). This is the underlying object with id, value and extensions. The accessor "getFrequencyMax" gives direct access to the value
1289         */
1290        public IntegerType getFrequencyMaxElement() { 
1291          if (this.frequencyMax == null)
1292            if (Configuration.errorOnAutoCreate())
1293              throw new Error("Attempt to auto-create TimingRepeatComponent.frequencyMax");
1294            else if (Configuration.doAutoCreate())
1295              this.frequencyMax = new IntegerType(); // bb
1296          return this.frequencyMax;
1297        }
1298
1299        public boolean hasFrequencyMaxElement() { 
1300          return this.frequencyMax != null && !this.frequencyMax.isEmpty();
1301        }
1302
1303        public boolean hasFrequencyMax() { 
1304          return this.frequencyMax != null && !this.frequencyMax.isEmpty();
1305        }
1306
1307        /**
1308         * @param value {@link #frequencyMax} (If present, indicates that the frequency is a range - so to repeat between [frequency] and [frequencyMax] times within the period or period range.). This is the underlying object with id, value and extensions. The accessor "getFrequencyMax" gives direct access to the value
1309         */
1310        public TimingRepeatComponent setFrequencyMaxElement(IntegerType value) { 
1311          this.frequencyMax = value;
1312          return this;
1313        }
1314
1315        /**
1316         * @return If present, indicates that the frequency is a range - so to repeat between [frequency] and [frequencyMax] times within the period or period range.
1317         */
1318        public int getFrequencyMax() { 
1319          return this.frequencyMax == null || this.frequencyMax.isEmpty() ? 0 : this.frequencyMax.getValue();
1320        }
1321
1322        /**
1323         * @param value If present, indicates that the frequency is a range - so to repeat between [frequency] and [frequencyMax] times within the period or period range.
1324         */
1325        public TimingRepeatComponent setFrequencyMax(int value) { 
1326            if (this.frequencyMax == null)
1327              this.frequencyMax = new IntegerType();
1328            this.frequencyMax.setValue(value);
1329          return this;
1330        }
1331
1332        /**
1333         * @return {@link #period} (Indicates the duration of time over which repetitions are to occur; e.g. to express "3 times per day", 3 would be the frequency and "1 day" would be the period.). This is the underlying object with id, value and extensions. The accessor "getPeriod" gives direct access to the value
1334         */
1335        public DecimalType getPeriodElement() { 
1336          if (this.period == null)
1337            if (Configuration.errorOnAutoCreate())
1338              throw new Error("Attempt to auto-create TimingRepeatComponent.period");
1339            else if (Configuration.doAutoCreate())
1340              this.period = new DecimalType(); // bb
1341          return this.period;
1342        }
1343
1344        public boolean hasPeriodElement() { 
1345          return this.period != null && !this.period.isEmpty();
1346        }
1347
1348        public boolean hasPeriod() { 
1349          return this.period != null && !this.period.isEmpty();
1350        }
1351
1352        /**
1353         * @param value {@link #period} (Indicates the duration of time over which repetitions are to occur; e.g. to express "3 times per day", 3 would be the frequency and "1 day" would be the period.). This is the underlying object with id, value and extensions. The accessor "getPeriod" gives direct access to the value
1354         */
1355        public TimingRepeatComponent setPeriodElement(DecimalType value) { 
1356          this.period = value;
1357          return this;
1358        }
1359
1360        /**
1361         * @return Indicates the duration of time over which repetitions are to occur; e.g. to express "3 times per day", 3 would be the frequency and "1 day" would be the period.
1362         */
1363        public BigDecimal getPeriod() { 
1364          return this.period == null ? null : this.period.getValue();
1365        }
1366
1367        /**
1368         * @param value Indicates the duration of time over which repetitions are to occur; e.g. to express "3 times per day", 3 would be the frequency and "1 day" would be the period.
1369         */
1370        public TimingRepeatComponent setPeriod(BigDecimal value) { 
1371          if (value == null)
1372            this.period = null;
1373          else {
1374            if (this.period == null)
1375              this.period = new DecimalType();
1376            this.period.setValue(value);
1377          }
1378          return this;
1379        }
1380
1381        /**
1382         * @param value Indicates the duration of time over which repetitions are to occur; e.g. to express "3 times per day", 3 would be the frequency and "1 day" would be the period.
1383         */
1384        public TimingRepeatComponent setPeriod(long value) { 
1385              this.period = new DecimalType();
1386            this.period.setValue(value);
1387          return this;
1388        }
1389
1390        /**
1391         * @param value Indicates the duration of time over which repetitions are to occur; e.g. to express "3 times per day", 3 would be the frequency and "1 day" would be the period.
1392         */
1393        public TimingRepeatComponent setPeriod(double value) { 
1394              this.period = new DecimalType();
1395            this.period.setValue(value);
1396          return this;
1397        }
1398
1399        /**
1400         * @return {@link #periodMax} (If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as "do this once every 3-5 days.). This is the underlying object with id, value and extensions. The accessor "getPeriodMax" gives direct access to the value
1401         */
1402        public DecimalType getPeriodMaxElement() { 
1403          if (this.periodMax == null)
1404            if (Configuration.errorOnAutoCreate())
1405              throw new Error("Attempt to auto-create TimingRepeatComponent.periodMax");
1406            else if (Configuration.doAutoCreate())
1407              this.periodMax = new DecimalType(); // bb
1408          return this.periodMax;
1409        }
1410
1411        public boolean hasPeriodMaxElement() { 
1412          return this.periodMax != null && !this.periodMax.isEmpty();
1413        }
1414
1415        public boolean hasPeriodMax() { 
1416          return this.periodMax != null && !this.periodMax.isEmpty();
1417        }
1418
1419        /**
1420         * @param value {@link #periodMax} (If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as "do this once every 3-5 days.). This is the underlying object with id, value and extensions. The accessor "getPeriodMax" gives direct access to the value
1421         */
1422        public TimingRepeatComponent setPeriodMaxElement(DecimalType value) { 
1423          this.periodMax = value;
1424          return this;
1425        }
1426
1427        /**
1428         * @return If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as "do this once every 3-5 days.
1429         */
1430        public BigDecimal getPeriodMax() { 
1431          return this.periodMax == null ? null : this.periodMax.getValue();
1432        }
1433
1434        /**
1435         * @param value If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as "do this once every 3-5 days.
1436         */
1437        public TimingRepeatComponent setPeriodMax(BigDecimal value) { 
1438          if (value == null)
1439            this.periodMax = null;
1440          else {
1441            if (this.periodMax == null)
1442              this.periodMax = new DecimalType();
1443            this.periodMax.setValue(value);
1444          }
1445          return this;
1446        }
1447
1448        /**
1449         * @param value If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as "do this once every 3-5 days.
1450         */
1451        public TimingRepeatComponent setPeriodMax(long value) { 
1452              this.periodMax = new DecimalType();
1453            this.periodMax.setValue(value);
1454          return this;
1455        }
1456
1457        /**
1458         * @param value If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as "do this once every 3-5 days.
1459         */
1460        public TimingRepeatComponent setPeriodMax(double value) { 
1461              this.periodMax = new DecimalType();
1462            this.periodMax.setValue(value);
1463          return this;
1464        }
1465
1466        /**
1467         * @return {@link #periodUnit} (The units of time for the period in UCUM units.). This is the underlying object with id, value and extensions. The accessor "getPeriodUnit" gives direct access to the value
1468         */
1469        public Enumeration<UnitsOfTime> getPeriodUnitElement() { 
1470          if (this.periodUnit == null)
1471            if (Configuration.errorOnAutoCreate())
1472              throw new Error("Attempt to auto-create TimingRepeatComponent.periodUnit");
1473            else if (Configuration.doAutoCreate())
1474              this.periodUnit = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory()); // bb
1475          return this.periodUnit;
1476        }
1477
1478        public boolean hasPeriodUnitElement() { 
1479          return this.periodUnit != null && !this.periodUnit.isEmpty();
1480        }
1481
1482        public boolean hasPeriodUnit() { 
1483          return this.periodUnit != null && !this.periodUnit.isEmpty();
1484        }
1485
1486        /**
1487         * @param value {@link #periodUnit} (The units of time for the period in UCUM units.). This is the underlying object with id, value and extensions. The accessor "getPeriodUnit" gives direct access to the value
1488         */
1489        public TimingRepeatComponent setPeriodUnitElement(Enumeration<UnitsOfTime> value) { 
1490          this.periodUnit = value;
1491          return this;
1492        }
1493
1494        /**
1495         * @return The units of time for the period in UCUM units.
1496         */
1497        public UnitsOfTime getPeriodUnit() { 
1498          return this.periodUnit == null ? null : this.periodUnit.getValue();
1499        }
1500
1501        /**
1502         * @param value The units of time for the period in UCUM units.
1503         */
1504        public TimingRepeatComponent setPeriodUnit(UnitsOfTime value) { 
1505          if (value == null)
1506            this.periodUnit = null;
1507          else {
1508            if (this.periodUnit == null)
1509              this.periodUnit = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory());
1510            this.periodUnit.setValue(value);
1511          }
1512          return this;
1513        }
1514
1515        /**
1516         * @return {@link #dayOfWeek} (If one or more days of week is provided, then the action happens only on the specified day(s).)
1517         */
1518        public List<Enumeration<DayOfWeek>> getDayOfWeek() { 
1519          if (this.dayOfWeek == null)
1520            this.dayOfWeek = new ArrayList<Enumeration<DayOfWeek>>();
1521          return this.dayOfWeek;
1522        }
1523
1524        /**
1525         * @return Returns a reference to <code>this</code> for easy method chaining
1526         */
1527        public TimingRepeatComponent setDayOfWeek(List<Enumeration<DayOfWeek>> theDayOfWeek) { 
1528          this.dayOfWeek = theDayOfWeek;
1529          return this;
1530        }
1531
1532        public boolean hasDayOfWeek() { 
1533          if (this.dayOfWeek == null)
1534            return false;
1535          for (Enumeration<DayOfWeek> item : this.dayOfWeek)
1536            if (!item.isEmpty())
1537              return true;
1538          return false;
1539        }
1540
1541        /**
1542         * @return {@link #dayOfWeek} (If one or more days of week is provided, then the action happens only on the specified day(s).)
1543         */
1544        public Enumeration<DayOfWeek> addDayOfWeekElement() {//2 
1545          Enumeration<DayOfWeek> t = new Enumeration<DayOfWeek>(new DayOfWeekEnumFactory());
1546          if (this.dayOfWeek == null)
1547            this.dayOfWeek = new ArrayList<Enumeration<DayOfWeek>>();
1548          this.dayOfWeek.add(t);
1549          return t;
1550        }
1551
1552        /**
1553         * @param value {@link #dayOfWeek} (If one or more days of week is provided, then the action happens only on the specified day(s).)
1554         */
1555        public TimingRepeatComponent addDayOfWeek(DayOfWeek value) { //1
1556          Enumeration<DayOfWeek> t = new Enumeration<DayOfWeek>(new DayOfWeekEnumFactory());
1557          t.setValue(value);
1558          if (this.dayOfWeek == null)
1559            this.dayOfWeek = new ArrayList<Enumeration<DayOfWeek>>();
1560          this.dayOfWeek.add(t);
1561          return this;
1562        }
1563
1564        /**
1565         * @param value {@link #dayOfWeek} (If one or more days of week is provided, then the action happens only on the specified day(s).)
1566         */
1567        public boolean hasDayOfWeek(DayOfWeek value) { 
1568          if (this.dayOfWeek == null)
1569            return false;
1570          for (Enumeration<DayOfWeek> v : this.dayOfWeek)
1571            if (v.getValue().equals(value)) // code
1572              return true;
1573          return false;
1574        }
1575
1576        /**
1577         * @return {@link #timeOfDay} (Specified time of day for action to take place.)
1578         */
1579        public List<TimeType> getTimeOfDay() { 
1580          if (this.timeOfDay == null)
1581            this.timeOfDay = new ArrayList<TimeType>();
1582          return this.timeOfDay;
1583        }
1584
1585        /**
1586         * @return Returns a reference to <code>this</code> for easy method chaining
1587         */
1588        public TimingRepeatComponent setTimeOfDay(List<TimeType> theTimeOfDay) { 
1589          this.timeOfDay = theTimeOfDay;
1590          return this;
1591        }
1592
1593        public boolean hasTimeOfDay() { 
1594          if (this.timeOfDay == null)
1595            return false;
1596          for (TimeType item : this.timeOfDay)
1597            if (!item.isEmpty())
1598              return true;
1599          return false;
1600        }
1601
1602        /**
1603         * @return {@link #timeOfDay} (Specified time of day for action to take place.)
1604         */
1605        public TimeType addTimeOfDayElement() {//2 
1606          TimeType t = new TimeType();
1607          if (this.timeOfDay == null)
1608            this.timeOfDay = new ArrayList<TimeType>();
1609          this.timeOfDay.add(t);
1610          return t;
1611        }
1612
1613        /**
1614         * @param value {@link #timeOfDay} (Specified time of day for action to take place.)
1615         */
1616        public TimingRepeatComponent addTimeOfDay(String value) { //1
1617          TimeType t = new TimeType();
1618          t.setValue(value);
1619          if (this.timeOfDay == null)
1620            this.timeOfDay = new ArrayList<TimeType>();
1621          this.timeOfDay.add(t);
1622          return this;
1623        }
1624
1625        /**
1626         * @param value {@link #timeOfDay} (Specified time of day for action to take place.)
1627         */
1628        public boolean hasTimeOfDay(String value) { 
1629          if (this.timeOfDay == null)
1630            return false;
1631          for (TimeType v : this.timeOfDay)
1632            if (v.getValue().equals(value)) // time
1633              return true;
1634          return false;
1635        }
1636
1637        /**
1638         * @return {@link #when} (Real world events that the occurrence of the event should be tied to.)
1639         */
1640        public List<Enumeration<EventTiming>> getWhen() { 
1641          if (this.when == null)
1642            this.when = new ArrayList<Enumeration<EventTiming>>();
1643          return this.when;
1644        }
1645
1646        /**
1647         * @return Returns a reference to <code>this</code> for easy method chaining
1648         */
1649        public TimingRepeatComponent setWhen(List<Enumeration<EventTiming>> theWhen) { 
1650          this.when = theWhen;
1651          return this;
1652        }
1653
1654        public boolean hasWhen() { 
1655          if (this.when == null)
1656            return false;
1657          for (Enumeration<EventTiming> item : this.when)
1658            if (!item.isEmpty())
1659              return true;
1660          return false;
1661        }
1662
1663        /**
1664         * @return {@link #when} (Real world events that the occurrence of the event should be tied to.)
1665         */
1666        public Enumeration<EventTiming> addWhenElement() {//2 
1667          Enumeration<EventTiming> t = new Enumeration<EventTiming>(new EventTimingEnumFactory());
1668          if (this.when == null)
1669            this.when = new ArrayList<Enumeration<EventTiming>>();
1670          this.when.add(t);
1671          return t;
1672        }
1673
1674        /**
1675         * @param value {@link #when} (Real world events that the occurrence of the event should be tied to.)
1676         */
1677        public TimingRepeatComponent addWhen(EventTiming value) { //1
1678          Enumeration<EventTiming> t = new Enumeration<EventTiming>(new EventTimingEnumFactory());
1679          t.setValue(value);
1680          if (this.when == null)
1681            this.when = new ArrayList<Enumeration<EventTiming>>();
1682          this.when.add(t);
1683          return this;
1684        }
1685
1686        /**
1687         * @param value {@link #when} (Real world events that the occurrence of the event should be tied to.)
1688         */
1689        public boolean hasWhen(EventTiming value) { 
1690          if (this.when == null)
1691            return false;
1692          for (Enumeration<EventTiming> v : this.when)
1693            if (v.getValue().equals(value)) // code
1694              return true;
1695          return false;
1696        }
1697
1698        /**
1699         * @return {@link #offset} (The number of minutes from the event. If the event code does not indicate whether the minutes is before or after the event, then the offset is assumed to be after the event.). This is the underlying object with id, value and extensions. The accessor "getOffset" gives direct access to the value
1700         */
1701        public UnsignedIntType getOffsetElement() { 
1702          if (this.offset == null)
1703            if (Configuration.errorOnAutoCreate())
1704              throw new Error("Attempt to auto-create TimingRepeatComponent.offset");
1705            else if (Configuration.doAutoCreate())
1706              this.offset = new UnsignedIntType(); // bb
1707          return this.offset;
1708        }
1709
1710        public boolean hasOffsetElement() { 
1711          return this.offset != null && !this.offset.isEmpty();
1712        }
1713
1714        public boolean hasOffset() { 
1715          return this.offset != null && !this.offset.isEmpty();
1716        }
1717
1718        /**
1719         * @param value {@link #offset} (The number of minutes from the event. If the event code does not indicate whether the minutes is before or after the event, then the offset is assumed to be after the event.). This is the underlying object with id, value and extensions. The accessor "getOffset" gives direct access to the value
1720         */
1721        public TimingRepeatComponent setOffsetElement(UnsignedIntType value) { 
1722          this.offset = value;
1723          return this;
1724        }
1725
1726        /**
1727         * @return The number of minutes from the event. If the event code does not indicate whether the minutes is before or after the event, then the offset is assumed to be after the event.
1728         */
1729        public int getOffset() { 
1730          return this.offset == null || this.offset.isEmpty() ? 0 : this.offset.getValue();
1731        }
1732
1733        /**
1734         * @param value The number of minutes from the event. If the event code does not indicate whether the minutes is before or after the event, then the offset is assumed to be after the event.
1735         */
1736        public TimingRepeatComponent setOffset(int value) { 
1737            if (this.offset == null)
1738              this.offset = new UnsignedIntType();
1739            this.offset.setValue(value);
1740          return this;
1741        }
1742
1743        protected void listChildren(List<Property> children) {
1744          super.listChildren(children);
1745          children.add(new Property("bounds[x]", "Duration|Range|Period", "Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.", 0, 1, bounds));
1746          children.add(new Property("count", "integer", "A total count of the desired number of repetitions.", 0, 1, count));
1747          children.add(new Property("countMax", "integer", "A maximum value for the count of the desired repetitions (e.g. do something 6-8 times).", 0, 1, countMax));
1748          children.add(new Property("duration", "decimal", "How long this thing happens for when it happens.", 0, 1, duration));
1749          children.add(new Property("durationMax", "decimal", "The upper limit of how long this thing happens for when it happens.", 0, 1, durationMax));
1750          children.add(new Property("durationUnit", "code", "The units of time for the duration, in UCUM units.", 0, 1, durationUnit));
1751          children.add(new Property("frequency", "integer", "The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided).", 0, 1, frequency));
1752          children.add(new Property("frequencyMax", "integer", "If present, indicates that the frequency is a range - so to repeat between [frequency] and [frequencyMax] times within the period or period range.", 0, 1, frequencyMax));
1753          children.add(new Property("period", "decimal", "Indicates the duration of time over which repetitions are to occur; e.g. to express \"3 times per day\", 3 would be the frequency and \"1 day\" would be the period.", 0, 1, period));
1754          children.add(new Property("periodMax", "decimal", "If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as \"do this once every 3-5 days.", 0, 1, periodMax));
1755          children.add(new Property("periodUnit", "code", "The units of time for the period in UCUM units.", 0, 1, periodUnit));
1756          children.add(new Property("dayOfWeek", "code", "If one or more days of week is provided, then the action happens only on the specified day(s).", 0, java.lang.Integer.MAX_VALUE, dayOfWeek));
1757          children.add(new Property("timeOfDay", "time", "Specified time of day for action to take place.", 0, java.lang.Integer.MAX_VALUE, timeOfDay));
1758          children.add(new Property("when", "code", "Real world events that the occurrence of the event should be tied to.", 0, java.lang.Integer.MAX_VALUE, when));
1759          children.add(new Property("offset", "unsignedInt", "The number of minutes from the event. If the event code does not indicate whether the minutes is before or after the event, then the offset is assumed to be after the event.", 0, 1, offset));
1760        }
1761
1762        @Override
1763        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1764          switch (_hash) {
1765          case -1149635157: /*bounds[x]*/  return new Property("bounds[x]", "Duration|Range|Period", "Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.", 0, 1, bounds);
1766          case -1383205195: /*bounds*/  return new Property("bounds[x]", "Duration|Range|Period", "Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.", 0, 1, bounds);
1767          case -189193367: /*boundsDuration*/  return new Property("bounds[x]", "Duration|Range|Period", "Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.", 0, 1, bounds);
1768          case -1001768056: /*boundsRange*/  return new Property("bounds[x]", "Duration|Range|Period", "Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.", 0, 1, bounds);
1769          case -1043481386: /*boundsPeriod*/  return new Property("bounds[x]", "Duration|Range|Period", "Either a duration for the length of the timing schedule, a range of possible length, or outer bounds for start and/or end limits of the timing schedule.", 0, 1, bounds);
1770          case 94851343: /*count*/  return new Property("count", "integer", "A total count of the desired number of repetitions.", 0, 1, count);
1771          case -372044331: /*countMax*/  return new Property("countMax", "integer", "A maximum value for the count of the desired repetitions (e.g. do something 6-8 times).", 0, 1, countMax);
1772          case -1992012396: /*duration*/  return new Property("duration", "decimal", "How long this thing happens for when it happens.", 0, 1, duration);
1773          case -478083280: /*durationMax*/  return new Property("durationMax", "decimal", "The upper limit of how long this thing happens for when it happens.", 0, 1, durationMax);
1774          case -1935429320: /*durationUnit*/  return new Property("durationUnit", "code", "The units of time for the duration, in UCUM units.", 0, 1, durationUnit);
1775          case -70023844: /*frequency*/  return new Property("frequency", "integer", "The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided).", 0, 1, frequency);
1776          case 1273846376: /*frequencyMax*/  return new Property("frequencyMax", "integer", "If present, indicates that the frequency is a range - so to repeat between [frequency] and [frequencyMax] times within the period or period range.", 0, 1, frequencyMax);
1777          case -991726143: /*period*/  return new Property("period", "decimal", "Indicates the duration of time over which repetitions are to occur; e.g. to express \"3 times per day\", 3 would be the frequency and \"1 day\" would be the period.", 0, 1, period);
1778          case 566580195: /*periodMax*/  return new Property("periodMax", "decimal", "If present, indicates that the period is a range from [period] to [periodMax], allowing expressing concepts such as \"do this once every 3-5 days.", 0, 1, periodMax);
1779          case 384367333: /*periodUnit*/  return new Property("periodUnit", "code", "The units of time for the period in UCUM units.", 0, 1, periodUnit);
1780          case -730552025: /*dayOfWeek*/  return new Property("dayOfWeek", "code", "If one or more days of week is provided, then the action happens only on the specified day(s).", 0, java.lang.Integer.MAX_VALUE, dayOfWeek);
1781          case 21434232: /*timeOfDay*/  return new Property("timeOfDay", "time", "Specified time of day for action to take place.", 0, java.lang.Integer.MAX_VALUE, timeOfDay);
1782          case 3648314: /*when*/  return new Property("when", "code", "Real world events that the occurrence of the event should be tied to.", 0, java.lang.Integer.MAX_VALUE, when);
1783          case -1019779949: /*offset*/  return new Property("offset", "unsignedInt", "The number of minutes from the event. If the event code does not indicate whether the minutes is before or after the event, then the offset is assumed to be after the event.", 0, 1, offset);
1784          default: return super.getNamedProperty(_hash, _name, _checkValid);
1785          }
1786
1787        }
1788
1789      @Override
1790      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1791        switch (hash) {
1792        case -1383205195: /*bounds*/ return this.bounds == null ? new Base[0] : new Base[] {this.bounds}; // Type
1793        case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // IntegerType
1794        case -372044331: /*countMax*/ return this.countMax == null ? new Base[0] : new Base[] {this.countMax}; // IntegerType
1795        case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // DecimalType
1796        case -478083280: /*durationMax*/ return this.durationMax == null ? new Base[0] : new Base[] {this.durationMax}; // DecimalType
1797        case -1935429320: /*durationUnit*/ return this.durationUnit == null ? new Base[0] : new Base[] {this.durationUnit}; // Enumeration<UnitsOfTime>
1798        case -70023844: /*frequency*/ return this.frequency == null ? new Base[0] : new Base[] {this.frequency}; // IntegerType
1799        case 1273846376: /*frequencyMax*/ return this.frequencyMax == null ? new Base[0] : new Base[] {this.frequencyMax}; // IntegerType
1800        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // DecimalType
1801        case 566580195: /*periodMax*/ return this.periodMax == null ? new Base[0] : new Base[] {this.periodMax}; // DecimalType
1802        case 384367333: /*periodUnit*/ return this.periodUnit == null ? new Base[0] : new Base[] {this.periodUnit}; // Enumeration<UnitsOfTime>
1803        case -730552025: /*dayOfWeek*/ return this.dayOfWeek == null ? new Base[0] : this.dayOfWeek.toArray(new Base[this.dayOfWeek.size()]); // Enumeration<DayOfWeek>
1804        case 21434232: /*timeOfDay*/ return this.timeOfDay == null ? new Base[0] : this.timeOfDay.toArray(new Base[this.timeOfDay.size()]); // TimeType
1805        case 3648314: /*when*/ return this.when == null ? new Base[0] : this.when.toArray(new Base[this.when.size()]); // Enumeration<EventTiming>
1806        case -1019779949: /*offset*/ return this.offset == null ? new Base[0] : new Base[] {this.offset}; // UnsignedIntType
1807        default: return super.getProperty(hash, name, checkValid);
1808        }
1809
1810      }
1811
1812      @Override
1813      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1814        switch (hash) {
1815        case -1383205195: // bounds
1816          this.bounds = castToType(value); // Type
1817          return value;
1818        case 94851343: // count
1819          this.count = castToInteger(value); // IntegerType
1820          return value;
1821        case -372044331: // countMax
1822          this.countMax = castToInteger(value); // IntegerType
1823          return value;
1824        case -1992012396: // duration
1825          this.duration = castToDecimal(value); // DecimalType
1826          return value;
1827        case -478083280: // durationMax
1828          this.durationMax = castToDecimal(value); // DecimalType
1829          return value;
1830        case -1935429320: // durationUnit
1831          value = new UnitsOfTimeEnumFactory().fromType(castToCode(value));
1832          this.durationUnit = (Enumeration) value; // Enumeration<UnitsOfTime>
1833          return value;
1834        case -70023844: // frequency
1835          this.frequency = castToInteger(value); // IntegerType
1836          return value;
1837        case 1273846376: // frequencyMax
1838          this.frequencyMax = castToInteger(value); // IntegerType
1839          return value;
1840        case -991726143: // period
1841          this.period = castToDecimal(value); // DecimalType
1842          return value;
1843        case 566580195: // periodMax
1844          this.periodMax = castToDecimal(value); // DecimalType
1845          return value;
1846        case 384367333: // periodUnit
1847          value = new UnitsOfTimeEnumFactory().fromType(castToCode(value));
1848          this.periodUnit = (Enumeration) value; // Enumeration<UnitsOfTime>
1849          return value;
1850        case -730552025: // dayOfWeek
1851          value = new DayOfWeekEnumFactory().fromType(castToCode(value));
1852          this.getDayOfWeek().add((Enumeration) value); // Enumeration<DayOfWeek>
1853          return value;
1854        case 21434232: // timeOfDay
1855          this.getTimeOfDay().add(castToTime(value)); // TimeType
1856          return value;
1857        case 3648314: // when
1858          value = new EventTimingEnumFactory().fromType(castToCode(value));
1859          this.getWhen().add((Enumeration) value); // Enumeration<EventTiming>
1860          return value;
1861        case -1019779949: // offset
1862          this.offset = castToUnsignedInt(value); // UnsignedIntType
1863          return value;
1864        default: return super.setProperty(hash, name, value);
1865        }
1866
1867      }
1868
1869      @Override
1870      public Base setProperty(String name, Base value) throws FHIRException {
1871        if (name.equals("bounds[x]")) {
1872          this.bounds = castToType(value); // Type
1873        } else if (name.equals("count")) {
1874          this.count = castToInteger(value); // IntegerType
1875        } else if (name.equals("countMax")) {
1876          this.countMax = castToInteger(value); // IntegerType
1877        } else if (name.equals("duration")) {
1878          this.duration = castToDecimal(value); // DecimalType
1879        } else if (name.equals("durationMax")) {
1880          this.durationMax = castToDecimal(value); // DecimalType
1881        } else if (name.equals("durationUnit")) {
1882          value = new UnitsOfTimeEnumFactory().fromType(castToCode(value));
1883          this.durationUnit = (Enumeration) value; // Enumeration<UnitsOfTime>
1884        } else if (name.equals("frequency")) {
1885          this.frequency = castToInteger(value); // IntegerType
1886        } else if (name.equals("frequencyMax")) {
1887          this.frequencyMax = castToInteger(value); // IntegerType
1888        } else if (name.equals("period")) {
1889          this.period = castToDecimal(value); // DecimalType
1890        } else if (name.equals("periodMax")) {
1891          this.periodMax = castToDecimal(value); // DecimalType
1892        } else if (name.equals("periodUnit")) {
1893          value = new UnitsOfTimeEnumFactory().fromType(castToCode(value));
1894          this.periodUnit = (Enumeration) value; // Enumeration<UnitsOfTime>
1895        } else if (name.equals("dayOfWeek")) {
1896          value = new DayOfWeekEnumFactory().fromType(castToCode(value));
1897          this.getDayOfWeek().add((Enumeration) value);
1898        } else if (name.equals("timeOfDay")) {
1899          this.getTimeOfDay().add(castToTime(value));
1900        } else if (name.equals("when")) {
1901          value = new EventTimingEnumFactory().fromType(castToCode(value));
1902          this.getWhen().add((Enumeration) value);
1903        } else if (name.equals("offset")) {
1904          this.offset = castToUnsignedInt(value); // UnsignedIntType
1905        } else
1906          return super.setProperty(name, value);
1907        return value;
1908      }
1909
1910      @Override
1911      public Base makeProperty(int hash, String name) throws FHIRException {
1912        switch (hash) {
1913        case -1149635157:  return getBounds(); 
1914        case -1383205195:  return getBounds(); 
1915        case 94851343:  return getCountElement();
1916        case -372044331:  return getCountMaxElement();
1917        case -1992012396:  return getDurationElement();
1918        case -478083280:  return getDurationMaxElement();
1919        case -1935429320:  return getDurationUnitElement();
1920        case -70023844:  return getFrequencyElement();
1921        case 1273846376:  return getFrequencyMaxElement();
1922        case -991726143:  return getPeriodElement();
1923        case 566580195:  return getPeriodMaxElement();
1924        case 384367333:  return getPeriodUnitElement();
1925        case -730552025:  return addDayOfWeekElement();
1926        case 21434232:  return addTimeOfDayElement();
1927        case 3648314:  return addWhenElement();
1928        case -1019779949:  return getOffsetElement();
1929        default: return super.makeProperty(hash, name);
1930        }
1931
1932      }
1933
1934      @Override
1935      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1936        switch (hash) {
1937        case -1383205195: /*bounds*/ return new String[] {"Duration", "Range", "Period"};
1938        case 94851343: /*count*/ return new String[] {"integer"};
1939        case -372044331: /*countMax*/ return new String[] {"integer"};
1940        case -1992012396: /*duration*/ return new String[] {"decimal"};
1941        case -478083280: /*durationMax*/ return new String[] {"decimal"};
1942        case -1935429320: /*durationUnit*/ return new String[] {"code"};
1943        case -70023844: /*frequency*/ return new String[] {"integer"};
1944        case 1273846376: /*frequencyMax*/ return new String[] {"integer"};
1945        case -991726143: /*period*/ return new String[] {"decimal"};
1946        case 566580195: /*periodMax*/ return new String[] {"decimal"};
1947        case 384367333: /*periodUnit*/ return new String[] {"code"};
1948        case -730552025: /*dayOfWeek*/ return new String[] {"code"};
1949        case 21434232: /*timeOfDay*/ return new String[] {"time"};
1950        case 3648314: /*when*/ return new String[] {"code"};
1951        case -1019779949: /*offset*/ return new String[] {"unsignedInt"};
1952        default: return super.getTypesForProperty(hash, name);
1953        }
1954
1955      }
1956
1957      @Override
1958      public Base addChild(String name) throws FHIRException {
1959        if (name.equals("boundsDuration")) {
1960          this.bounds = new Duration();
1961          return this.bounds;
1962        }
1963        else if (name.equals("boundsRange")) {
1964          this.bounds = new Range();
1965          return this.bounds;
1966        }
1967        else if (name.equals("boundsPeriod")) {
1968          this.bounds = new Period();
1969          return this.bounds;
1970        }
1971        else if (name.equals("count")) {
1972          throw new FHIRException("Cannot call addChild on a primitive type Timing.count");
1973        }
1974        else if (name.equals("countMax")) {
1975          throw new FHIRException("Cannot call addChild on a primitive type Timing.countMax");
1976        }
1977        else if (name.equals("duration")) {
1978          throw new FHIRException("Cannot call addChild on a primitive type Timing.duration");
1979        }
1980        else if (name.equals("durationMax")) {
1981          throw new FHIRException("Cannot call addChild on a primitive type Timing.durationMax");
1982        }
1983        else if (name.equals("durationUnit")) {
1984          throw new FHIRException("Cannot call addChild on a primitive type Timing.durationUnit");
1985        }
1986        else if (name.equals("frequency")) {
1987          throw new FHIRException("Cannot call addChild on a primitive type Timing.frequency");
1988        }
1989        else if (name.equals("frequencyMax")) {
1990          throw new FHIRException("Cannot call addChild on a primitive type Timing.frequencyMax");
1991        }
1992        else if (name.equals("period")) {
1993          throw new FHIRException("Cannot call addChild on a primitive type Timing.period");
1994        }
1995        else if (name.equals("periodMax")) {
1996          throw new FHIRException("Cannot call addChild on a primitive type Timing.periodMax");
1997        }
1998        else if (name.equals("periodUnit")) {
1999          throw new FHIRException("Cannot call addChild on a primitive type Timing.periodUnit");
2000        }
2001        else if (name.equals("dayOfWeek")) {
2002          throw new FHIRException("Cannot call addChild on a primitive type Timing.dayOfWeek");
2003        }
2004        else if (name.equals("timeOfDay")) {
2005          throw new FHIRException("Cannot call addChild on a primitive type Timing.timeOfDay");
2006        }
2007        else if (name.equals("when")) {
2008          throw new FHIRException("Cannot call addChild on a primitive type Timing.when");
2009        }
2010        else if (name.equals("offset")) {
2011          throw new FHIRException("Cannot call addChild on a primitive type Timing.offset");
2012        }
2013        else
2014          return super.addChild(name);
2015      }
2016
2017      public TimingRepeatComponent copy() {
2018        TimingRepeatComponent dst = new TimingRepeatComponent();
2019        copyValues(dst);
2020        dst.bounds = bounds == null ? null : bounds.copy();
2021        dst.count = count == null ? null : count.copy();
2022        dst.countMax = countMax == null ? null : countMax.copy();
2023        dst.duration = duration == null ? null : duration.copy();
2024        dst.durationMax = durationMax == null ? null : durationMax.copy();
2025        dst.durationUnit = durationUnit == null ? null : durationUnit.copy();
2026        dst.frequency = frequency == null ? null : frequency.copy();
2027        dst.frequencyMax = frequencyMax == null ? null : frequencyMax.copy();
2028        dst.period = period == null ? null : period.copy();
2029        dst.periodMax = periodMax == null ? null : periodMax.copy();
2030        dst.periodUnit = periodUnit == null ? null : periodUnit.copy();
2031        if (dayOfWeek != null) {
2032          dst.dayOfWeek = new ArrayList<Enumeration<DayOfWeek>>();
2033          for (Enumeration<DayOfWeek> i : dayOfWeek)
2034            dst.dayOfWeek.add(i.copy());
2035        };
2036        if (timeOfDay != null) {
2037          dst.timeOfDay = new ArrayList<TimeType>();
2038          for (TimeType i : timeOfDay)
2039            dst.timeOfDay.add(i.copy());
2040        };
2041        if (when != null) {
2042          dst.when = new ArrayList<Enumeration<EventTiming>>();
2043          for (Enumeration<EventTiming> i : when)
2044            dst.when.add(i.copy());
2045        };
2046        dst.offset = offset == null ? null : offset.copy();
2047        return dst;
2048      }
2049
2050      @Override
2051      public boolean equalsDeep(Base other_) {
2052        if (!super.equalsDeep(other_))
2053          return false;
2054        if (!(other_ instanceof TimingRepeatComponent))
2055          return false;
2056        TimingRepeatComponent o = (TimingRepeatComponent) other_;
2057        return compareDeep(bounds, o.bounds, true) && compareDeep(count, o.count, true) && compareDeep(countMax, o.countMax, true)
2058           && compareDeep(duration, o.duration, true) && compareDeep(durationMax, o.durationMax, true) && compareDeep(durationUnit, o.durationUnit, true)
2059           && compareDeep(frequency, o.frequency, true) && compareDeep(frequencyMax, o.frequencyMax, true)
2060           && compareDeep(period, o.period, true) && compareDeep(periodMax, o.periodMax, true) && compareDeep(periodUnit, o.periodUnit, true)
2061           && compareDeep(dayOfWeek, o.dayOfWeek, true) && compareDeep(timeOfDay, o.timeOfDay, true) && compareDeep(when, o.when, true)
2062           && compareDeep(offset, o.offset, true);
2063      }
2064
2065      @Override
2066      public boolean equalsShallow(Base other_) {
2067        if (!super.equalsShallow(other_))
2068          return false;
2069        if (!(other_ instanceof TimingRepeatComponent))
2070          return false;
2071        TimingRepeatComponent o = (TimingRepeatComponent) other_;
2072        return compareValues(count, o.count, true) && compareValues(countMax, o.countMax, true) && compareValues(duration, o.duration, true)
2073           && compareValues(durationMax, o.durationMax, true) && compareValues(durationUnit, o.durationUnit, true)
2074           && compareValues(frequency, o.frequency, true) && compareValues(frequencyMax, o.frequencyMax, true)
2075           && compareValues(period, o.period, true) && compareValues(periodMax, o.periodMax, true) && compareValues(periodUnit, o.periodUnit, true)
2076           && compareValues(dayOfWeek, o.dayOfWeek, true) && compareValues(timeOfDay, o.timeOfDay, true) && compareValues(when, o.when, true)
2077           && compareValues(offset, o.offset, true);
2078      }
2079
2080      public boolean isEmpty() {
2081        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(bounds, count, countMax
2082          , duration, durationMax, durationUnit, frequency, frequencyMax, period, periodMax
2083          , periodUnit, dayOfWeek, timeOfDay, when, offset);
2084      }
2085
2086  public String fhirType() {
2087    return "Timing.repeat";
2088
2089  }
2090
2091  }
2092
2093    /**
2094     * Identifies specific times when the event occurs.
2095     */
2096    @Child(name = "event", type = {DateTimeType.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2097    @Description(shortDefinition="When the event occurs", formalDefinition="Identifies specific times when the event occurs." )
2098    protected List<DateTimeType> event;
2099
2100    /**
2101     * A set of rules that describe when the event is scheduled.
2102     */
2103    @Child(name = "repeat", type = {}, order=1, min=0, max=1, modifier=false, summary=true)
2104    @Description(shortDefinition="When the event is to occur", formalDefinition="A set of rules that describe when the event is scheduled." )
2105    protected TimingRepeatComponent repeat;
2106
2107    /**
2108     * A code for the timing schedule. Some codes such as BID are ubiquitous, but many institutions define their own additional codes. If a code is provided, the code is understood to be a complete statement of whatever is specified in the structured timing data, and either the code or the data may be used to interpret the Timing, with the exception that .repeat.bounds still applies over the code (and is not contained in the code).
2109     */
2110    @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
2111    @Description(shortDefinition="BID | TID | QID | AM | PM | QD | QOD | Q4H | Q6H +", formalDefinition="A code for the timing schedule. Some codes such as BID are ubiquitous, but many institutions define their own additional codes. If a code is provided, the code is understood to be a complete statement of whatever is specified in the structured timing data, and either the code or the data may be used to interpret the Timing, with the exception that .repeat.bounds still applies over the code (and is not contained in the code)." )
2112    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/timing-abbreviation")
2113    protected CodeableConcept code;
2114
2115    private static final long serialVersionUID = 791565112L;
2116
2117  /**
2118   * Constructor
2119   */
2120    public Timing() {
2121      super();
2122    }
2123
2124    /**
2125     * @return {@link #event} (Identifies specific times when the event occurs.)
2126     */
2127    public List<DateTimeType> getEvent() { 
2128      if (this.event == null)
2129        this.event = new ArrayList<DateTimeType>();
2130      return this.event;
2131    }
2132
2133    /**
2134     * @return Returns a reference to <code>this</code> for easy method chaining
2135     */
2136    public Timing setEvent(List<DateTimeType> theEvent) { 
2137      this.event = theEvent;
2138      return this;
2139    }
2140
2141    public boolean hasEvent() { 
2142      if (this.event == null)
2143        return false;
2144      for (DateTimeType item : this.event)
2145        if (!item.isEmpty())
2146          return true;
2147      return false;
2148    }
2149
2150    /**
2151     * @return {@link #event} (Identifies specific times when the event occurs.)
2152     */
2153    public DateTimeType addEventElement() {//2 
2154      DateTimeType t = new DateTimeType();
2155      if (this.event == null)
2156        this.event = new ArrayList<DateTimeType>();
2157      this.event.add(t);
2158      return t;
2159    }
2160
2161    /**
2162     * @param value {@link #event} (Identifies specific times when the event occurs.)
2163     */
2164    public Timing addEvent(Date value) { //1
2165      DateTimeType t = new DateTimeType();
2166      t.setValue(value);
2167      if (this.event == null)
2168        this.event = new ArrayList<DateTimeType>();
2169      this.event.add(t);
2170      return this;
2171    }
2172
2173    /**
2174     * @param value {@link #event} (Identifies specific times when the event occurs.)
2175     */
2176    public boolean hasEvent(Date value) { 
2177      if (this.event == null)
2178        return false;
2179      for (DateTimeType v : this.event)
2180        if (v.getValue().equals(value)) // dateTime
2181          return true;
2182      return false;
2183    }
2184
2185    /**
2186     * @return {@link #repeat} (A set of rules that describe when the event is scheduled.)
2187     */
2188    public TimingRepeatComponent getRepeat() { 
2189      if (this.repeat == null)
2190        if (Configuration.errorOnAutoCreate())
2191          throw new Error("Attempt to auto-create Timing.repeat");
2192        else if (Configuration.doAutoCreate())
2193          this.repeat = new TimingRepeatComponent(); // cc
2194      return this.repeat;
2195    }
2196
2197    public boolean hasRepeat() { 
2198      return this.repeat != null && !this.repeat.isEmpty();
2199    }
2200
2201    /**
2202     * @param value {@link #repeat} (A set of rules that describe when the event is scheduled.)
2203     */
2204    public Timing setRepeat(TimingRepeatComponent value)  { 
2205      this.repeat = value;
2206      return this;
2207    }
2208
2209    /**
2210     * @return {@link #code} (A code for the timing schedule. Some codes such as BID are ubiquitous, but many institutions define their own additional codes. If a code is provided, the code is understood to be a complete statement of whatever is specified in the structured timing data, and either the code or the data may be used to interpret the Timing, with the exception that .repeat.bounds still applies over the code (and is not contained in the code).)
2211     */
2212    public CodeableConcept getCode() { 
2213      if (this.code == null)
2214        if (Configuration.errorOnAutoCreate())
2215          throw new Error("Attempt to auto-create Timing.code");
2216        else if (Configuration.doAutoCreate())
2217          this.code = new CodeableConcept(); // cc
2218      return this.code;
2219    }
2220
2221    public boolean hasCode() { 
2222      return this.code != null && !this.code.isEmpty();
2223    }
2224
2225    /**
2226     * @param value {@link #code} (A code for the timing schedule. Some codes such as BID are ubiquitous, but many institutions define their own additional codes. If a code is provided, the code is understood to be a complete statement of whatever is specified in the structured timing data, and either the code or the data may be used to interpret the Timing, with the exception that .repeat.bounds still applies over the code (and is not contained in the code).)
2227     */
2228    public Timing setCode(CodeableConcept value)  { 
2229      this.code = value;
2230      return this;
2231    }
2232
2233      protected void listChildren(List<Property> children) {
2234        super.listChildren(children);
2235        children.add(new Property("event", "dateTime", "Identifies specific times when the event occurs.", 0, java.lang.Integer.MAX_VALUE, event));
2236        children.add(new Property("repeat", "", "A set of rules that describe when the event is scheduled.", 0, 1, repeat));
2237        children.add(new Property("code", "CodeableConcept", "A code for the timing schedule. Some codes such as BID are ubiquitous, but many institutions define their own additional codes. If a code is provided, the code is understood to be a complete statement of whatever is specified in the structured timing data, and either the code or the data may be used to interpret the Timing, with the exception that .repeat.bounds still applies over the code (and is not contained in the code).", 0, 1, code));
2238      }
2239
2240      @Override
2241      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2242        switch (_hash) {
2243        case 96891546: /*event*/  return new Property("event", "dateTime", "Identifies specific times when the event occurs.", 0, java.lang.Integer.MAX_VALUE, event);
2244        case -934531685: /*repeat*/  return new Property("repeat", "", "A set of rules that describe when the event is scheduled.", 0, 1, repeat);
2245        case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A code for the timing schedule. Some codes such as BID are ubiquitous, but many institutions define their own additional codes. If a code is provided, the code is understood to be a complete statement of whatever is specified in the structured timing data, and either the code or the data may be used to interpret the Timing, with the exception that .repeat.bounds still applies over the code (and is not contained in the code).", 0, 1, code);
2246        default: return super.getNamedProperty(_hash, _name, _checkValid);
2247        }
2248
2249      }
2250
2251      @Override
2252      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2253        switch (hash) {
2254        case 96891546: /*event*/ return this.event == null ? new Base[0] : this.event.toArray(new Base[this.event.size()]); // DateTimeType
2255        case -934531685: /*repeat*/ return this.repeat == null ? new Base[0] : new Base[] {this.repeat}; // TimingRepeatComponent
2256        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
2257        default: return super.getProperty(hash, name, checkValid);
2258        }
2259
2260      }
2261
2262      @Override
2263      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2264        switch (hash) {
2265        case 96891546: // event
2266          this.getEvent().add(castToDateTime(value)); // DateTimeType
2267          return value;
2268        case -934531685: // repeat
2269          this.repeat = (TimingRepeatComponent) value; // TimingRepeatComponent
2270          return value;
2271        case 3059181: // code
2272          this.code = castToCodeableConcept(value); // CodeableConcept
2273          return value;
2274        default: return super.setProperty(hash, name, value);
2275        }
2276
2277      }
2278
2279      @Override
2280      public Base setProperty(String name, Base value) throws FHIRException {
2281        if (name.equals("event")) {
2282          this.getEvent().add(castToDateTime(value));
2283        } else if (name.equals("repeat")) {
2284          this.repeat = (TimingRepeatComponent) value; // TimingRepeatComponent
2285        } else if (name.equals("code")) {
2286          this.code = castToCodeableConcept(value); // CodeableConcept
2287        } else
2288          return super.setProperty(name, value);
2289        return value;
2290      }
2291
2292      @Override
2293      public Base makeProperty(int hash, String name) throws FHIRException {
2294        switch (hash) {
2295        case 96891546:  return addEventElement();
2296        case -934531685:  return getRepeat(); 
2297        case 3059181:  return getCode(); 
2298        default: return super.makeProperty(hash, name);
2299        }
2300
2301      }
2302
2303      @Override
2304      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2305        switch (hash) {
2306        case 96891546: /*event*/ return new String[] {"dateTime"};
2307        case -934531685: /*repeat*/ return new String[] {};
2308        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2309        default: return super.getTypesForProperty(hash, name);
2310        }
2311
2312      }
2313
2314      @Override
2315      public Base addChild(String name) throws FHIRException {
2316        if (name.equals("event")) {
2317          throw new FHIRException("Cannot call addChild on a primitive type Timing.event");
2318        }
2319        else if (name.equals("repeat")) {
2320          this.repeat = new TimingRepeatComponent();
2321          return this.repeat;
2322        }
2323        else if (name.equals("code")) {
2324          this.code = new CodeableConcept();
2325          return this.code;
2326        }
2327        else
2328          return super.addChild(name);
2329      }
2330
2331  public String fhirType() {
2332    return "Timing";
2333
2334  }
2335
2336      public Timing copy() {
2337        Timing dst = new Timing();
2338        copyValues(dst);
2339        if (event != null) {
2340          dst.event = new ArrayList<DateTimeType>();
2341          for (DateTimeType i : event)
2342            dst.event.add(i.copy());
2343        };
2344        dst.repeat = repeat == null ? null : repeat.copy();
2345        dst.code = code == null ? null : code.copy();
2346        return dst;
2347      }
2348
2349      protected Timing typedCopy() {
2350        return copy();
2351      }
2352
2353      @Override
2354      public boolean equalsDeep(Base other_) {
2355        if (!super.equalsDeep(other_))
2356          return false;
2357        if (!(other_ instanceof Timing))
2358          return false;
2359        Timing o = (Timing) other_;
2360        return compareDeep(event, o.event, true) && compareDeep(repeat, o.repeat, true) && compareDeep(code, o.code, true)
2361          ;
2362      }
2363
2364      @Override
2365      public boolean equalsShallow(Base other_) {
2366        if (!super.equalsShallow(other_))
2367          return false;
2368        if (!(other_ instanceof Timing))
2369          return false;
2370        Timing o = (Timing) other_;
2371        return compareValues(event, o.event, true);
2372      }
2373
2374      public boolean isEmpty() {
2375        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(event, repeat, code);
2376      }
2377
2378
2379}
2380