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