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