001package org.hl7.fhir.dstu2016may.model; 002 003 004 005 006import java.math.BigDecimal; 007 008/* 009 Copyright (c) 2011+, HL7, Inc. 010 All rights reserved. 011 012 Redistribution and use in source and binary forms, with or without modification, 013 are permitted provided that the following conditions are met: 014 015 * Redistributions of source code must retain the above copyright notice, this 016 list of conditions and the following disclaimer. 017 * Redistributions in binary form must reproduce the above copyright notice, 018 this list of conditions and the following disclaimer in the documentation 019 and/or other materials provided with the distribution. 020 * Neither the name of HL7 nor the names of its contributors may be used to 021 endorse or promote products derived from this software without specific 022 prior written permission. 023 024 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 025 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 026 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 027 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 028 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 029 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 030 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 031 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 032 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 033 POSSIBILITY OF SUCH DAMAGE. 034 035*/ 036 037// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0 038import java.util.ArrayList; 039import java.util.Date; 040import java.util.List; 041 042import org.hl7.fhir.exceptions.FHIRException; 043import org.hl7.fhir.instance.model.api.IBaseDatatypeElement; 044import org.hl7.fhir.instance.model.api.ICompositeType; 045 046import ca.uhn.fhir.model.api.annotation.Block; 047import ca.uhn.fhir.model.api.annotation.Child; 048import ca.uhn.fhir.model.api.annotation.DatatypeDef; 049import ca.uhn.fhir.model.api.annotation.Description; 050/** 051 * Specifies an event that may occur multiple times. Timing schedules are used to record when things are 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. 052 */ 053@DatatypeDef(name="Timing") 054public class Timing extends Type implements ICompositeType { 055 056 public enum UnitsOfTime { 057 /** 058 * null 059 */ 060 S, 061 /** 062 * null 063 */ 064 MIN, 065 /** 066 * null 067 */ 068 H, 069 /** 070 * null 071 */ 072 D, 073 /** 074 * null 075 */ 076 WK, 077 /** 078 * null 079 */ 080 MO, 081 /** 082 * null 083 */ 084 A, 085 /** 086 * added to help the parsers 087 */ 088 NULL; 089 public static UnitsOfTime fromCode(String codeString) throws FHIRException { 090 if (codeString == null || "".equals(codeString)) 091 return null; 092 if ("s".equals(codeString)) 093 return S; 094 if ("min".equals(codeString)) 095 return MIN; 096 if ("h".equals(codeString)) 097 return H; 098 if ("d".equals(codeString)) 099 return D; 100 if ("wk".equals(codeString)) 101 return WK; 102 if ("mo".equals(codeString)) 103 return MO; 104 if ("a".equals(codeString)) 105 return A; 106 throw new FHIRException("Unknown UnitsOfTime code '"+codeString+"'"); 107 } 108 public String toCode() { 109 switch (this) { 110 case S: return "s"; 111 case MIN: return "min"; 112 case H: return "h"; 113 case D: return "d"; 114 case WK: return "wk"; 115 case MO: return "mo"; 116 case A: return "a"; 117 case NULL: return null; 118 default: return "?"; 119 } 120 } 121 public String getSystem() { 122 switch (this) { 123 case S: return "http://unitsofmeasure.org"; 124 case MIN: return "http://unitsofmeasure.org"; 125 case H: return "http://unitsofmeasure.org"; 126 case D: return "http://unitsofmeasure.org"; 127 case WK: return "http://unitsofmeasure.org"; 128 case MO: return "http://unitsofmeasure.org"; 129 case A: return "http://unitsofmeasure.org"; 130 case NULL: return null; 131 default: return "?"; 132 } 133 } 134 public String getDefinition() { 135 switch (this) { 136 case S: return ""; 137 case MIN: return ""; 138 case H: return ""; 139 case D: return ""; 140 case WK: return ""; 141 case MO: return ""; 142 case A: return ""; 143 case NULL: return null; 144 default: return "?"; 145 } 146 } 147 public String getDisplay() { 148 switch (this) { 149 case S: return "s"; 150 case MIN: return "min"; 151 case H: return "h"; 152 case D: return "d"; 153 case WK: return "wk"; 154 case MO: return "mo"; 155 case A: return "a"; 156 case NULL: return null; 157 default: return "?"; 158 } 159 } 160 } 161 162 public static class UnitsOfTimeEnumFactory implements EnumFactory<UnitsOfTime> { 163 public UnitsOfTime fromCode(String codeString) throws IllegalArgumentException { 164 if (codeString == null || "".equals(codeString)) 165 if (codeString == null || "".equals(codeString)) 166 return null; 167 if ("s".equals(codeString)) 168 return UnitsOfTime.S; 169 if ("min".equals(codeString)) 170 return UnitsOfTime.MIN; 171 if ("h".equals(codeString)) 172 return UnitsOfTime.H; 173 if ("d".equals(codeString)) 174 return UnitsOfTime.D; 175 if ("wk".equals(codeString)) 176 return UnitsOfTime.WK; 177 if ("mo".equals(codeString)) 178 return UnitsOfTime.MO; 179 if ("a".equals(codeString)) 180 return UnitsOfTime.A; 181 throw new IllegalArgumentException("Unknown UnitsOfTime code '"+codeString+"'"); 182 } 183 public Enumeration<UnitsOfTime> fromType(Base code) throws FHIRException { 184 if (code == null || code.isEmpty()) 185 return null; 186 String codeString = ((PrimitiveType) code).asStringValue(); 187 if (codeString == null || "".equals(codeString)) 188 return null; 189 if ("s".equals(codeString)) 190 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.S); 191 if ("min".equals(codeString)) 192 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.MIN); 193 if ("h".equals(codeString)) 194 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.H); 195 if ("d".equals(codeString)) 196 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.D); 197 if ("wk".equals(codeString)) 198 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.WK); 199 if ("mo".equals(codeString)) 200 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.MO); 201 if ("a".equals(codeString)) 202 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.A); 203 throw new FHIRException("Unknown UnitsOfTime code '"+codeString+"'"); 204 } 205 public String toCode(UnitsOfTime code) { 206 if (code == UnitsOfTime.S) 207 return "s"; 208 if (code == UnitsOfTime.MIN) 209 return "min"; 210 if (code == UnitsOfTime.H) 211 return "h"; 212 if (code == UnitsOfTime.D) 213 return "d"; 214 if (code == UnitsOfTime.WK) 215 return "wk"; 216 if (code == UnitsOfTime.MO) 217 return "mo"; 218 if (code == UnitsOfTime.A) 219 return "a"; 220 return "?"; 221 } 222 public String toSystem(UnitsOfTime code) { 223 return code.getSystem(); 224 } 225 } 226 227 public enum EventTiming { 228 /** 229 * null 230 */ 231 HS, 232 /** 233 * null 234 */ 235 WAKE, 236 /** 237 * null 238 */ 239 C, 240 /** 241 * null 242 */ 243 CM, 244 /** 245 * null 246 */ 247 CD, 248 /** 249 * null 250 */ 251 CV, 252 /** 253 * null 254 */ 255 AC, 256 /** 257 * null 258 */ 259 ACM, 260 /** 261 * null 262 */ 263 ACD, 264 /** 265 * null 266 */ 267 ACV, 268 /** 269 * null 270 */ 271 PC, 272 /** 273 * null 274 */ 275 PCM, 276 /** 277 * null 278 */ 279 PCD, 280 /** 281 * null 282 */ 283 PCV, 284 /** 285 * added to help the parsers 286 */ 287 NULL; 288 public static EventTiming fromCode(String codeString) throws FHIRException { 289 if (codeString == null || "".equals(codeString)) 290 return null; 291 if ("HS".equals(codeString)) 292 return HS; 293 if ("WAKE".equals(codeString)) 294 return WAKE; 295 if ("C".equals(codeString)) 296 return C; 297 if ("CM".equals(codeString)) 298 return CM; 299 if ("CD".equals(codeString)) 300 return CD; 301 if ("CV".equals(codeString)) 302 return CV; 303 if ("AC".equals(codeString)) 304 return AC; 305 if ("ACM".equals(codeString)) 306 return ACM; 307 if ("ACD".equals(codeString)) 308 return ACD; 309 if ("ACV".equals(codeString)) 310 return ACV; 311 if ("PC".equals(codeString)) 312 return PC; 313 if ("PCM".equals(codeString)) 314 return PCM; 315 if ("PCD".equals(codeString)) 316 return PCD; 317 if ("PCV".equals(codeString)) 318 return PCV; 319 throw new FHIRException("Unknown EventTiming code '"+codeString+"'"); 320 } 321 public String toCode() { 322 switch (this) { 323 case HS: return "HS"; 324 case WAKE: return "WAKE"; 325 case C: return "C"; 326 case CM: return "CM"; 327 case CD: return "CD"; 328 case CV: return "CV"; 329 case AC: return "AC"; 330 case ACM: return "ACM"; 331 case ACD: return "ACD"; 332 case ACV: return "ACV"; 333 case PC: return "PC"; 334 case PCM: return "PCM"; 335 case PCD: return "PCD"; 336 case PCV: return "PCV"; 337 case NULL: return null; 338 default: return "?"; 339 } 340 } 341 public String getSystem() { 342 switch (this) { 343 case HS: return "http://hl7.org/fhir/v3/TimingEvent"; 344 case WAKE: return "http://hl7.org/fhir/v3/TimingEvent"; 345 case C: return "http://hl7.org/fhir/v3/TimingEvent"; 346 case CM: return "http://hl7.org/fhir/v3/TimingEvent"; 347 case CD: return "http://hl7.org/fhir/v3/TimingEvent"; 348 case CV: return "http://hl7.org/fhir/v3/TimingEvent"; 349 case AC: return "http://hl7.org/fhir/v3/TimingEvent"; 350 case ACM: return "http://hl7.org/fhir/v3/TimingEvent"; 351 case ACD: return "http://hl7.org/fhir/v3/TimingEvent"; 352 case ACV: return "http://hl7.org/fhir/v3/TimingEvent"; 353 case PC: return "http://hl7.org/fhir/v3/TimingEvent"; 354 case PCM: return "http://hl7.org/fhir/v3/TimingEvent"; 355 case PCD: return "http://hl7.org/fhir/v3/TimingEvent"; 356 case PCV: return "http://hl7.org/fhir/v3/TimingEvent"; 357 case NULL: return null; 358 default: return "?"; 359 } 360 } 361 public String getDefinition() { 362 switch (this) { 363 case HS: return ""; 364 case WAKE: return ""; 365 case C: return ""; 366 case CM: return ""; 367 case CD: return ""; 368 case CV: return ""; 369 case AC: return ""; 370 case ACM: return ""; 371 case ACD: return ""; 372 case ACV: return ""; 373 case PC: return ""; 374 case PCM: return ""; 375 case PCD: return ""; 376 case PCV: return ""; 377 case NULL: return null; 378 default: return "?"; 379 } 380 } 381 public String getDisplay() { 382 switch (this) { 383 case HS: return "HS"; 384 case WAKE: return "WAKE"; 385 case C: return "C"; 386 case CM: return "CM"; 387 case CD: return "CD"; 388 case CV: return "CV"; 389 case AC: return "AC"; 390 case ACM: return "ACM"; 391 case ACD: return "ACD"; 392 case ACV: return "ACV"; 393 case PC: return "PC"; 394 case PCM: return "PCM"; 395 case PCD: return "PCD"; 396 case PCV: return "PCV"; 397 case NULL: return null; 398 default: return "?"; 399 } 400 } 401 } 402 403 public static class EventTimingEnumFactory implements EnumFactory<EventTiming> { 404 public EventTiming fromCode(String codeString) throws IllegalArgumentException { 405 if (codeString == null || "".equals(codeString)) 406 if (codeString == null || "".equals(codeString)) 407 return null; 408 if ("HS".equals(codeString)) 409 return EventTiming.HS; 410 if ("WAKE".equals(codeString)) 411 return EventTiming.WAKE; 412 if ("C".equals(codeString)) 413 return EventTiming.C; 414 if ("CM".equals(codeString)) 415 return EventTiming.CM; 416 if ("CD".equals(codeString)) 417 return EventTiming.CD; 418 if ("CV".equals(codeString)) 419 return EventTiming.CV; 420 if ("AC".equals(codeString)) 421 return EventTiming.AC; 422 if ("ACM".equals(codeString)) 423 return EventTiming.ACM; 424 if ("ACD".equals(codeString)) 425 return EventTiming.ACD; 426 if ("ACV".equals(codeString)) 427 return EventTiming.ACV; 428 if ("PC".equals(codeString)) 429 return EventTiming.PC; 430 if ("PCM".equals(codeString)) 431 return EventTiming.PCM; 432 if ("PCD".equals(codeString)) 433 return EventTiming.PCD; 434 if ("PCV".equals(codeString)) 435 return EventTiming.PCV; 436 throw new IllegalArgumentException("Unknown EventTiming code '"+codeString+"'"); 437 } 438 public Enumeration<EventTiming> fromType(Base code) throws FHIRException { 439 if (code == null || code.isEmpty()) 440 return null; 441 String codeString = ((PrimitiveType) code).asStringValue(); 442 if (codeString == null || "".equals(codeString)) 443 return null; 444 if ("HS".equals(codeString)) 445 return new Enumeration<EventTiming>(this, EventTiming.HS); 446 if ("WAKE".equals(codeString)) 447 return new Enumeration<EventTiming>(this, EventTiming.WAKE); 448 if ("C".equals(codeString)) 449 return new Enumeration<EventTiming>(this, EventTiming.C); 450 if ("CM".equals(codeString)) 451 return new Enumeration<EventTiming>(this, EventTiming.CM); 452 if ("CD".equals(codeString)) 453 return new Enumeration<EventTiming>(this, EventTiming.CD); 454 if ("CV".equals(codeString)) 455 return new Enumeration<EventTiming>(this, EventTiming.CV); 456 if ("AC".equals(codeString)) 457 return new Enumeration<EventTiming>(this, EventTiming.AC); 458 if ("ACM".equals(codeString)) 459 return new Enumeration<EventTiming>(this, EventTiming.ACM); 460 if ("ACD".equals(codeString)) 461 return new Enumeration<EventTiming>(this, EventTiming.ACD); 462 if ("ACV".equals(codeString)) 463 return new Enumeration<EventTiming>(this, EventTiming.ACV); 464 if ("PC".equals(codeString)) 465 return new Enumeration<EventTiming>(this, EventTiming.PC); 466 if ("PCM".equals(codeString)) 467 return new Enumeration<EventTiming>(this, EventTiming.PCM); 468 if ("PCD".equals(codeString)) 469 return new Enumeration<EventTiming>(this, EventTiming.PCD); 470 if ("PCV".equals(codeString)) 471 return new Enumeration<EventTiming>(this, EventTiming.PCV); 472 throw new FHIRException("Unknown EventTiming code '"+codeString+"'"); 473 } 474 public String toCode(EventTiming code) { 475 if (code == EventTiming.HS) 476 return "HS"; 477 if (code == EventTiming.WAKE) 478 return "WAKE"; 479 if (code == EventTiming.C) 480 return "C"; 481 if (code == EventTiming.CM) 482 return "CM"; 483 if (code == EventTiming.CD) 484 return "CD"; 485 if (code == EventTiming.CV) 486 return "CV"; 487 if (code == EventTiming.AC) 488 return "AC"; 489 if (code == EventTiming.ACM) 490 return "ACM"; 491 if (code == EventTiming.ACD) 492 return "ACD"; 493 if (code == EventTiming.ACV) 494 return "ACV"; 495 if (code == EventTiming.PC) 496 return "PC"; 497 if (code == EventTiming.PCM) 498 return "PCM"; 499 if (code == EventTiming.PCD) 500 return "PCD"; 501 if (code == EventTiming.PCV) 502 return "PCV"; 503 return "?"; 504 } 505 public String toSystem(EventTiming code) { 506 return code.getSystem(); 507 } 508 } 509 510 @Block() 511 public static class TimingRepeatComponent extends Element implements IBaseDatatypeElement { 512 /** 513 * 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. 514 */ 515 @Child(name = "bounds", type = {Duration.class, Range.class, Period.class}, order=1, min=0, max=1, modifier=false, summary=true) 516 @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." ) 517 protected Type bounds; 518 519 /** 520 * A total count of the desired number of repetitions. 521 */ 522 @Child(name = "count", type = {IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=true) 523 @Description(shortDefinition="Number of times to repeat", formalDefinition="A total count of the desired number of repetitions." ) 524 protected IntegerType count; 525 526 /** 527 * A maximum value for the count of the desired repetitions (e.g. do something 6-8 times). 528 */ 529 @Child(name = "countMax", type = {IntegerType.class}, order=3, min=0, max=1, modifier=false, summary=true) 530 @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)." ) 531 protected IntegerType countMax; 532 533 /** 534 * How long this thing happens for when it happens. 535 */ 536 @Child(name = "duration", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true) 537 @Description(shortDefinition="How long when it happens", formalDefinition="How long this thing happens for when it happens." ) 538 protected DecimalType duration; 539 540 /** 541 * The upper limit of how long this thing happens for when it happens. 542 */ 543 @Child(name = "durationMax", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=true) 544 @Description(shortDefinition="How long when it happens (Max)", formalDefinition="The upper limit of how long this thing happens for when it happens." ) 545 protected DecimalType durationMax; 546 547 /** 548 * The units of time for the duration, in UCUM units. 549 */ 550 @Child(name = "durationUnit", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true) 551 @Description(shortDefinition="s | min | h | d | wk | mo | a - unit of time (UCUM)", formalDefinition="The units of time for the duration, in UCUM units." ) 552 protected Enumeration<UnitsOfTime> durationUnit; 553 554 /** 555 * The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided). 556 */ 557 @Child(name = "frequency", type = {IntegerType.class}, order=7, min=0, max=1, modifier=false, summary=true) 558 @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)." ) 559 protected IntegerType frequency; 560 561 /** 562 * If present, indicates that the frequency is a range - so repeat between [frequency] and [frequencyMax] times within the period or period range. 563 */ 564 @Child(name = "frequencyMax", type = {IntegerType.class}, order=8, min=0, max=1, modifier=false, summary=true) 565 @Description(shortDefinition="Event occurs up to frequencyMax times per period", formalDefinition="If present, indicates that the frequency is a range - so repeat between [frequency] and [frequencyMax] times within the period or period range." ) 566 protected IntegerType frequencyMax; 567 568 /** 569 * 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. 570 */ 571 @Child(name = "period", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=true) 572 @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." ) 573 protected DecimalType period; 574 575 /** 576 * 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. 577 */ 578 @Child(name = "periodMax", type = {DecimalType.class}, order=10, min=0, max=1, modifier=false, summary=true) 579 @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." ) 580 protected DecimalType periodMax; 581 582 /** 583 * The units of time for the period in UCUM units. 584 */ 585 @Child(name = "periodUnit", type = {CodeType.class}, order=11, min=0, max=1, modifier=false, summary=true) 586 @Description(shortDefinition="s | min | h | d | wk | mo | a - unit of time (UCUM)", formalDefinition="The units of time for the period in UCUM units." ) 587 protected Enumeration<UnitsOfTime> periodUnit; 588 589 /** 590 * A real world event that the occurrence of the event should be tied to. 591 */ 592 @Child(name = "when", type = {CodeType.class}, order=12, min=0, max=1, modifier=false, summary=true) 593 @Description(shortDefinition="Regular life events the event is tied to", formalDefinition="A real world event that the occurrence of the event should be tied to." ) 594 protected Enumeration<EventTiming> when; 595 596 /** 597 * 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. 598 */ 599 @Child(name = "offset", type = {UnsignedIntType.class}, order=13, min=0, max=1, modifier=false, summary=true) 600 @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." ) 601 protected UnsignedIntType offset; 602 603 private static final long serialVersionUID = -1317919984L; 604 605 /** 606 * Constructor 607 */ 608 public TimingRepeatComponent() { 609 super(); 610 } 611 612 /** 613 * @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.) 614 */ 615 public Type getBounds() { 616 return this.bounds; 617 } 618 619 /** 620 * @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.) 621 */ 622 public Duration getBoundsDuration() throws FHIRException { 623 if (!(this.bounds instanceof Duration)) 624 throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.bounds.getClass().getName()+" was encountered"); 625 return (Duration) this.bounds; 626 } 627 628 public boolean hasBoundsDuration() { 629 return this.bounds instanceof Duration; 630 } 631 632 /** 633 * @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.) 634 */ 635 public Range getBoundsRange() throws FHIRException { 636 if (!(this.bounds instanceof Range)) 637 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.bounds.getClass().getName()+" was encountered"); 638 return (Range) this.bounds; 639 } 640 641 public boolean hasBoundsRange() { 642 return this.bounds instanceof Range; 643 } 644 645 /** 646 * @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.) 647 */ 648 public Period getBoundsPeriod() throws FHIRException { 649 if (!(this.bounds instanceof Period)) 650 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.bounds.getClass().getName()+" was encountered"); 651 return (Period) this.bounds; 652 } 653 654 public boolean hasBoundsPeriod() { 655 return this.bounds instanceof Period; 656 } 657 658 public boolean hasBounds() { 659 return this.bounds != null && !this.bounds.isEmpty(); 660 } 661 662 /** 663 * @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.) 664 */ 665 public TimingRepeatComponent setBounds(Type value) { 666 this.bounds = value; 667 return this; 668 } 669 670 /** 671 * @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 672 */ 673 public IntegerType getCountElement() { 674 if (this.count == null) 675 if (Configuration.errorOnAutoCreate()) 676 throw new Error("Attempt to auto-create TimingRepeatComponent.count"); 677 else if (Configuration.doAutoCreate()) 678 this.count = new IntegerType(); // bb 679 return this.count; 680 } 681 682 public boolean hasCountElement() { 683 return this.count != null && !this.count.isEmpty(); 684 } 685 686 public boolean hasCount() { 687 return this.count != null && !this.count.isEmpty(); 688 } 689 690 /** 691 * @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 692 */ 693 public TimingRepeatComponent setCountElement(IntegerType value) { 694 this.count = value; 695 return this; 696 } 697 698 /** 699 * @return A total count of the desired number of repetitions. 700 */ 701 public int getCount() { 702 return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue(); 703 } 704 705 /** 706 * @param value A total count of the desired number of repetitions. 707 */ 708 public TimingRepeatComponent setCount(int value) { 709 if (this.count == null) 710 this.count = new IntegerType(); 711 this.count.setValue(value); 712 return this; 713 } 714 715 /** 716 * @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 717 */ 718 public IntegerType getCountMaxElement() { 719 if (this.countMax == null) 720 if (Configuration.errorOnAutoCreate()) 721 throw new Error("Attempt to auto-create TimingRepeatComponent.countMax"); 722 else if (Configuration.doAutoCreate()) 723 this.countMax = new IntegerType(); // bb 724 return this.countMax; 725 } 726 727 public boolean hasCountMaxElement() { 728 return this.countMax != null && !this.countMax.isEmpty(); 729 } 730 731 public boolean hasCountMax() { 732 return this.countMax != null && !this.countMax.isEmpty(); 733 } 734 735 /** 736 * @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 737 */ 738 public TimingRepeatComponent setCountMaxElement(IntegerType value) { 739 this.countMax = value; 740 return this; 741 } 742 743 /** 744 * @return A maximum value for the count of the desired repetitions (e.g. do something 6-8 times). 745 */ 746 public int getCountMax() { 747 return this.countMax == null || this.countMax.isEmpty() ? 0 : this.countMax.getValue(); 748 } 749 750 /** 751 * @param value A maximum value for the count of the desired repetitions (e.g. do something 6-8 times). 752 */ 753 public TimingRepeatComponent setCountMax(int value) { 754 if (this.countMax == null) 755 this.countMax = new IntegerType(); 756 this.countMax.setValue(value); 757 return this; 758 } 759 760 /** 761 * @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 762 */ 763 public DecimalType getDurationElement() { 764 if (this.duration == null) 765 if (Configuration.errorOnAutoCreate()) 766 throw new Error("Attempt to auto-create TimingRepeatComponent.duration"); 767 else if (Configuration.doAutoCreate()) 768 this.duration = new DecimalType(); // bb 769 return this.duration; 770 } 771 772 public boolean hasDurationElement() { 773 return this.duration != null && !this.duration.isEmpty(); 774 } 775 776 public boolean hasDuration() { 777 return this.duration != null && !this.duration.isEmpty(); 778 } 779 780 /** 781 * @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 782 */ 783 public TimingRepeatComponent setDurationElement(DecimalType value) { 784 this.duration = value; 785 return this; 786 } 787 788 /** 789 * @return How long this thing happens for when it happens. 790 */ 791 public BigDecimal getDuration() { 792 return this.duration == null ? null : this.duration.getValue(); 793 } 794 795 /** 796 * @param value How long this thing happens for when it happens. 797 */ 798 public TimingRepeatComponent setDuration(BigDecimal value) { 799 if (value == null) 800 this.duration = null; 801 else { 802 if (this.duration == null) 803 this.duration = new DecimalType(); 804 this.duration.setValue(value); 805 } 806 return this; 807 } 808 809 /** 810 * @param value How long this thing happens for when it happens. 811 */ 812 public TimingRepeatComponent setDuration(long value) { 813 this.duration = new DecimalType(); 814 this.duration.setValue(value); 815 return this; 816 } 817 818 /** 819 * @param value How long this thing happens for when it happens. 820 */ 821 public TimingRepeatComponent setDuration(double value) { 822 this.duration = new DecimalType(); 823 this.duration.setValue(value); 824 return this; 825 } 826 827 /** 828 * @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 829 */ 830 public DecimalType getDurationMaxElement() { 831 if (this.durationMax == null) 832 if (Configuration.errorOnAutoCreate()) 833 throw new Error("Attempt to auto-create TimingRepeatComponent.durationMax"); 834 else if (Configuration.doAutoCreate()) 835 this.durationMax = new DecimalType(); // bb 836 return this.durationMax; 837 } 838 839 public boolean hasDurationMaxElement() { 840 return this.durationMax != null && !this.durationMax.isEmpty(); 841 } 842 843 public boolean hasDurationMax() { 844 return this.durationMax != null && !this.durationMax.isEmpty(); 845 } 846 847 /** 848 * @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 849 */ 850 public TimingRepeatComponent setDurationMaxElement(DecimalType value) { 851 this.durationMax = value; 852 return this; 853 } 854 855 /** 856 * @return The upper limit of how long this thing happens for when it happens. 857 */ 858 public BigDecimal getDurationMax() { 859 return this.durationMax == null ? null : this.durationMax.getValue(); 860 } 861 862 /** 863 * @param value The upper limit of how long this thing happens for when it happens. 864 */ 865 public TimingRepeatComponent setDurationMax(BigDecimal value) { 866 if (value == null) 867 this.durationMax = null; 868 else { 869 if (this.durationMax == null) 870 this.durationMax = new DecimalType(); 871 this.durationMax.setValue(value); 872 } 873 return this; 874 } 875 876 /** 877 * @param value The upper limit of how long this thing happens for when it happens. 878 */ 879 public TimingRepeatComponent setDurationMax(long value) { 880 this.durationMax = new DecimalType(); 881 this.durationMax.setValue(value); 882 return this; 883 } 884 885 /** 886 * @param value The upper limit of how long this thing happens for when it happens. 887 */ 888 public TimingRepeatComponent setDurationMax(double value) { 889 this.durationMax = new DecimalType(); 890 this.durationMax.setValue(value); 891 return this; 892 } 893 894 /** 895 * @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 896 */ 897 public Enumeration<UnitsOfTime> getDurationUnitElement() { 898 if (this.durationUnit == null) 899 if (Configuration.errorOnAutoCreate()) 900 throw new Error("Attempt to auto-create TimingRepeatComponent.durationUnit"); 901 else if (Configuration.doAutoCreate()) 902 this.durationUnit = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory()); // bb 903 return this.durationUnit; 904 } 905 906 public boolean hasDurationUnitElement() { 907 return this.durationUnit != null && !this.durationUnit.isEmpty(); 908 } 909 910 public boolean hasDurationUnit() { 911 return this.durationUnit != null && !this.durationUnit.isEmpty(); 912 } 913 914 /** 915 * @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 916 */ 917 public TimingRepeatComponent setDurationUnitElement(Enumeration<UnitsOfTime> value) { 918 this.durationUnit = value; 919 return this; 920 } 921 922 /** 923 * @return The units of time for the duration, in UCUM units. 924 */ 925 public UnitsOfTime getDurationUnit() { 926 return this.durationUnit == null ? null : this.durationUnit.getValue(); 927 } 928 929 /** 930 * @param value The units of time for the duration, in UCUM units. 931 */ 932 public TimingRepeatComponent setDurationUnit(UnitsOfTime value) { 933 if (value == null) 934 this.durationUnit = null; 935 else { 936 if (this.durationUnit == null) 937 this.durationUnit = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory()); 938 this.durationUnit.setValue(value); 939 } 940 return this; 941 } 942 943 /** 944 * @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 945 */ 946 public IntegerType getFrequencyElement() { 947 if (this.frequency == null) 948 if (Configuration.errorOnAutoCreate()) 949 throw new Error("Attempt to auto-create TimingRepeatComponent.frequency"); 950 else if (Configuration.doAutoCreate()) 951 this.frequency = new IntegerType(); // bb 952 return this.frequency; 953 } 954 955 public boolean hasFrequencyElement() { 956 return this.frequency != null && !this.frequency.isEmpty(); 957 } 958 959 public boolean hasFrequency() { 960 return this.frequency != null && !this.frequency.isEmpty(); 961 } 962 963 /** 964 * @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 965 */ 966 public TimingRepeatComponent setFrequencyElement(IntegerType value) { 967 this.frequency = value; 968 return this; 969 } 970 971 /** 972 * @return The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided). 973 */ 974 public int getFrequency() { 975 return this.frequency == null || this.frequency.isEmpty() ? 0 : this.frequency.getValue(); 976 } 977 978 /** 979 * @param value The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided). 980 */ 981 public TimingRepeatComponent setFrequency(int value) { 982 if (this.frequency == null) 983 this.frequency = new IntegerType(); 984 this.frequency.setValue(value); 985 return this; 986 } 987 988 /** 989 * @return {@link #frequencyMax} (If present, indicates that the frequency is a range - so 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 990 */ 991 public IntegerType getFrequencyMaxElement() { 992 if (this.frequencyMax == null) 993 if (Configuration.errorOnAutoCreate()) 994 throw new Error("Attempt to auto-create TimingRepeatComponent.frequencyMax"); 995 else if (Configuration.doAutoCreate()) 996 this.frequencyMax = new IntegerType(); // bb 997 return this.frequencyMax; 998 } 999 1000 public boolean hasFrequencyMaxElement() { 1001 return this.frequencyMax != null && !this.frequencyMax.isEmpty(); 1002 } 1003 1004 public boolean hasFrequencyMax() { 1005 return this.frequencyMax != null && !this.frequencyMax.isEmpty(); 1006 } 1007 1008 /** 1009 * @param value {@link #frequencyMax} (If present, indicates that the frequency is a range - so 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 1010 */ 1011 public TimingRepeatComponent setFrequencyMaxElement(IntegerType value) { 1012 this.frequencyMax = value; 1013 return this; 1014 } 1015 1016 /** 1017 * @return If present, indicates that the frequency is a range - so repeat between [frequency] and [frequencyMax] times within the period or period range. 1018 */ 1019 public int getFrequencyMax() { 1020 return this.frequencyMax == null || this.frequencyMax.isEmpty() ? 0 : this.frequencyMax.getValue(); 1021 } 1022 1023 /** 1024 * @param value If present, indicates that the frequency is a range - so repeat between [frequency] and [frequencyMax] times within the period or period range. 1025 */ 1026 public TimingRepeatComponent setFrequencyMax(int value) { 1027 if (this.frequencyMax == null) 1028 this.frequencyMax = new IntegerType(); 1029 this.frequencyMax.setValue(value); 1030 return this; 1031 } 1032 1033 /** 1034 * @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 1035 */ 1036 public DecimalType getPeriodElement() { 1037 if (this.period == null) 1038 if (Configuration.errorOnAutoCreate()) 1039 throw new Error("Attempt to auto-create TimingRepeatComponent.period"); 1040 else if (Configuration.doAutoCreate()) 1041 this.period = new DecimalType(); // bb 1042 return this.period; 1043 } 1044 1045 public boolean hasPeriodElement() { 1046 return this.period != null && !this.period.isEmpty(); 1047 } 1048 1049 public boolean hasPeriod() { 1050 return this.period != null && !this.period.isEmpty(); 1051 } 1052 1053 /** 1054 * @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 1055 */ 1056 public TimingRepeatComponent setPeriodElement(DecimalType value) { 1057 this.period = value; 1058 return this; 1059 } 1060 1061 /** 1062 * @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. 1063 */ 1064 public BigDecimal getPeriod() { 1065 return this.period == null ? null : this.period.getValue(); 1066 } 1067 1068 /** 1069 * @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. 1070 */ 1071 public TimingRepeatComponent setPeriod(BigDecimal value) { 1072 if (value == null) 1073 this.period = null; 1074 else { 1075 if (this.period == null) 1076 this.period = new DecimalType(); 1077 this.period.setValue(value); 1078 } 1079 return this; 1080 } 1081 1082 /** 1083 * @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. 1084 */ 1085 public TimingRepeatComponent setPeriod(long value) { 1086 this.period = new DecimalType(); 1087 this.period.setValue(value); 1088 return this; 1089 } 1090 1091 /** 1092 * @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. 1093 */ 1094 public TimingRepeatComponent setPeriod(double value) { 1095 this.period = new DecimalType(); 1096 this.period.setValue(value); 1097 return this; 1098 } 1099 1100 /** 1101 * @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 1102 */ 1103 public DecimalType getPeriodMaxElement() { 1104 if (this.periodMax == null) 1105 if (Configuration.errorOnAutoCreate()) 1106 throw new Error("Attempt to auto-create TimingRepeatComponent.periodMax"); 1107 else if (Configuration.doAutoCreate()) 1108 this.periodMax = new DecimalType(); // bb 1109 return this.periodMax; 1110 } 1111 1112 public boolean hasPeriodMaxElement() { 1113 return this.periodMax != null && !this.periodMax.isEmpty(); 1114 } 1115 1116 public boolean hasPeriodMax() { 1117 return this.periodMax != null && !this.periodMax.isEmpty(); 1118 } 1119 1120 /** 1121 * @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 1122 */ 1123 public TimingRepeatComponent setPeriodMaxElement(DecimalType value) { 1124 this.periodMax = value; 1125 return this; 1126 } 1127 1128 /** 1129 * @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. 1130 */ 1131 public BigDecimal getPeriodMax() { 1132 return this.periodMax == null ? null : this.periodMax.getValue(); 1133 } 1134 1135 /** 1136 * @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. 1137 */ 1138 public TimingRepeatComponent setPeriodMax(BigDecimal value) { 1139 if (value == null) 1140 this.periodMax = null; 1141 else { 1142 if (this.periodMax == null) 1143 this.periodMax = new DecimalType(); 1144 this.periodMax.setValue(value); 1145 } 1146 return this; 1147 } 1148 1149 /** 1150 * @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. 1151 */ 1152 public TimingRepeatComponent setPeriodMax(long value) { 1153 this.periodMax = new DecimalType(); 1154 this.periodMax.setValue(value); 1155 return this; 1156 } 1157 1158 /** 1159 * @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. 1160 */ 1161 public TimingRepeatComponent setPeriodMax(double value) { 1162 this.periodMax = new DecimalType(); 1163 this.periodMax.setValue(value); 1164 return this; 1165 } 1166 1167 /** 1168 * @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 1169 */ 1170 public Enumeration<UnitsOfTime> getPeriodUnitElement() { 1171 if (this.periodUnit == null) 1172 if (Configuration.errorOnAutoCreate()) 1173 throw new Error("Attempt to auto-create TimingRepeatComponent.periodUnit"); 1174 else if (Configuration.doAutoCreate()) 1175 this.periodUnit = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory()); // bb 1176 return this.periodUnit; 1177 } 1178 1179 public boolean hasPeriodUnitElement() { 1180 return this.periodUnit != null && !this.periodUnit.isEmpty(); 1181 } 1182 1183 public boolean hasPeriodUnit() { 1184 return this.periodUnit != null && !this.periodUnit.isEmpty(); 1185 } 1186 1187 /** 1188 * @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 1189 */ 1190 public TimingRepeatComponent setPeriodUnitElement(Enumeration<UnitsOfTime> value) { 1191 this.periodUnit = value; 1192 return this; 1193 } 1194 1195 /** 1196 * @return The units of time for the period in UCUM units. 1197 */ 1198 public UnitsOfTime getPeriodUnit() { 1199 return this.periodUnit == null ? null : this.periodUnit.getValue(); 1200 } 1201 1202 /** 1203 * @param value The units of time for the period in UCUM units. 1204 */ 1205 public TimingRepeatComponent setPeriodUnit(UnitsOfTime value) { 1206 if (value == null) 1207 this.periodUnit = null; 1208 else { 1209 if (this.periodUnit == null) 1210 this.periodUnit = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory()); 1211 this.periodUnit.setValue(value); 1212 } 1213 return this; 1214 } 1215 1216 /** 1217 * @return {@link #when} (A real world event that the occurrence of the event should be tied to.). This is the underlying object with id, value and extensions. The accessor "getWhen" gives direct access to the value 1218 */ 1219 public Enumeration<EventTiming> getWhenElement() { 1220 if (this.when == null) 1221 if (Configuration.errorOnAutoCreate()) 1222 throw new Error("Attempt to auto-create TimingRepeatComponent.when"); 1223 else if (Configuration.doAutoCreate()) 1224 this.when = new Enumeration<EventTiming>(new EventTimingEnumFactory()); // bb 1225 return this.when; 1226 } 1227 1228 public boolean hasWhenElement() { 1229 return this.when != null && !this.when.isEmpty(); 1230 } 1231 1232 public boolean hasWhen() { 1233 return this.when != null && !this.when.isEmpty(); 1234 } 1235 1236 /** 1237 * @param value {@link #when} (A real world event that the occurrence of the event should be tied to.). This is the underlying object with id, value and extensions. The accessor "getWhen" gives direct access to the value 1238 */ 1239 public TimingRepeatComponent setWhenElement(Enumeration<EventTiming> value) { 1240 this.when = value; 1241 return this; 1242 } 1243 1244 /** 1245 * @return A real world event that the occurrence of the event should be tied to. 1246 */ 1247 public EventTiming getWhen() { 1248 return this.when == null ? null : this.when.getValue(); 1249 } 1250 1251 /** 1252 * @param value A real world event that the occurrence of the event should be tied to. 1253 */ 1254 public TimingRepeatComponent setWhen(EventTiming value) { 1255 if (value == null) 1256 this.when = null; 1257 else { 1258 if (this.when == null) 1259 this.when = new Enumeration<EventTiming>(new EventTimingEnumFactory()); 1260 this.when.setValue(value); 1261 } 1262 return this; 1263 } 1264 1265 /** 1266 * @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 1267 */ 1268 public UnsignedIntType getOffsetElement() { 1269 if (this.offset == null) 1270 if (Configuration.errorOnAutoCreate()) 1271 throw new Error("Attempt to auto-create TimingRepeatComponent.offset"); 1272 else if (Configuration.doAutoCreate()) 1273 this.offset = new UnsignedIntType(); // bb 1274 return this.offset; 1275 } 1276 1277 public boolean hasOffsetElement() { 1278 return this.offset != null && !this.offset.isEmpty(); 1279 } 1280 1281 public boolean hasOffset() { 1282 return this.offset != null && !this.offset.isEmpty(); 1283 } 1284 1285 /** 1286 * @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 1287 */ 1288 public TimingRepeatComponent setOffsetElement(UnsignedIntType value) { 1289 this.offset = value; 1290 return this; 1291 } 1292 1293 /** 1294 * @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. 1295 */ 1296 public int getOffset() { 1297 return this.offset == null || this.offset.isEmpty() ? 0 : this.offset.getValue(); 1298 } 1299 1300 /** 1301 * @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. 1302 */ 1303 public TimingRepeatComponent setOffset(int value) { 1304 if (this.offset == null) 1305 this.offset = new UnsignedIntType(); 1306 this.offset.setValue(value); 1307 return this; 1308 } 1309 1310 protected void listChildren(List<Property> childrenList) { 1311 super.listChildren(childrenList); 1312 childrenList.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, java.lang.Integer.MAX_VALUE, bounds)); 1313 childrenList.add(new Property("count", "integer", "A total count of the desired number of repetitions.", 0, java.lang.Integer.MAX_VALUE, count)); 1314 childrenList.add(new Property("countMax", "integer", "A maximum value for the count of the desired repetitions (e.g. do something 6-8 times).", 0, java.lang.Integer.MAX_VALUE, countMax)); 1315 childrenList.add(new Property("duration", "decimal", "How long this thing happens for when it happens.", 0, java.lang.Integer.MAX_VALUE, duration)); 1316 childrenList.add(new Property("durationMax", "decimal", "The upper limit of how long this thing happens for when it happens.", 0, java.lang.Integer.MAX_VALUE, durationMax)); 1317 childrenList.add(new Property("durationUnit", "code", "The units of time for the duration, in UCUM units.", 0, java.lang.Integer.MAX_VALUE, durationUnit)); 1318 childrenList.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, java.lang.Integer.MAX_VALUE, frequency)); 1319 childrenList.add(new Property("frequencyMax", "integer", "If present, indicates that the frequency is a range - so repeat between [frequency] and [frequencyMax] times within the period or period range.", 0, java.lang.Integer.MAX_VALUE, frequencyMax)); 1320 childrenList.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, java.lang.Integer.MAX_VALUE, period)); 1321 childrenList.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, java.lang.Integer.MAX_VALUE, periodMax)); 1322 childrenList.add(new Property("periodUnit", "code", "The units of time for the period in UCUM units.", 0, java.lang.Integer.MAX_VALUE, periodUnit)); 1323 childrenList.add(new Property("when", "code", "A real world event that the occurrence of the event should be tied to.", 0, java.lang.Integer.MAX_VALUE, when)); 1324 childrenList.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, java.lang.Integer.MAX_VALUE, offset)); 1325 } 1326 1327 @Override 1328 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1329 switch (hash) { 1330 case -1383205195: /*bounds*/ return this.bounds == null ? new Base[0] : new Base[] {this.bounds}; // Type 1331 case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // IntegerType 1332 case -372044331: /*countMax*/ return this.countMax == null ? new Base[0] : new Base[] {this.countMax}; // IntegerType 1333 case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // DecimalType 1334 case -478083280: /*durationMax*/ return this.durationMax == null ? new Base[0] : new Base[] {this.durationMax}; // DecimalType 1335 case -1935429320: /*durationUnit*/ return this.durationUnit == null ? new Base[0] : new Base[] {this.durationUnit}; // Enumeration<UnitsOfTime> 1336 case -70023844: /*frequency*/ return this.frequency == null ? new Base[0] : new Base[] {this.frequency}; // IntegerType 1337 case 1273846376: /*frequencyMax*/ return this.frequencyMax == null ? new Base[0] : new Base[] {this.frequencyMax}; // IntegerType 1338 case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // DecimalType 1339 case 566580195: /*periodMax*/ return this.periodMax == null ? new Base[0] : new Base[] {this.periodMax}; // DecimalType 1340 case 384367333: /*periodUnit*/ return this.periodUnit == null ? new Base[0] : new Base[] {this.periodUnit}; // Enumeration<UnitsOfTime> 1341 case 3648314: /*when*/ return this.when == null ? new Base[0] : new Base[] {this.when}; // Enumeration<EventTiming> 1342 case -1019779949: /*offset*/ return this.offset == null ? new Base[0] : new Base[] {this.offset}; // UnsignedIntType 1343 default: return super.getProperty(hash, name, checkValid); 1344 } 1345 1346 } 1347 1348 @Override 1349 public void setProperty(int hash, String name, Base value) throws FHIRException { 1350 switch (hash) { 1351 case -1383205195: // bounds 1352 this.bounds = (Type) value; // Type 1353 break; 1354 case 94851343: // count 1355 this.count = castToInteger(value); // IntegerType 1356 break; 1357 case -372044331: // countMax 1358 this.countMax = castToInteger(value); // IntegerType 1359 break; 1360 case -1992012396: // duration 1361 this.duration = castToDecimal(value); // DecimalType 1362 break; 1363 case -478083280: // durationMax 1364 this.durationMax = castToDecimal(value); // DecimalType 1365 break; 1366 case -1935429320: // durationUnit 1367 this.durationUnit = new UnitsOfTimeEnumFactory().fromType(value); // Enumeration<UnitsOfTime> 1368 break; 1369 case -70023844: // frequency 1370 this.frequency = castToInteger(value); // IntegerType 1371 break; 1372 case 1273846376: // frequencyMax 1373 this.frequencyMax = castToInteger(value); // IntegerType 1374 break; 1375 case -991726143: // period 1376 this.period = castToDecimal(value); // DecimalType 1377 break; 1378 case 566580195: // periodMax 1379 this.periodMax = castToDecimal(value); // DecimalType 1380 break; 1381 case 384367333: // periodUnit 1382 this.periodUnit = new UnitsOfTimeEnumFactory().fromType(value); // Enumeration<UnitsOfTime> 1383 break; 1384 case 3648314: // when 1385 this.when = new EventTimingEnumFactory().fromType(value); // Enumeration<EventTiming> 1386 break; 1387 case -1019779949: // offset 1388 this.offset = castToUnsignedInt(value); // UnsignedIntType 1389 break; 1390 default: super.setProperty(hash, name, value); 1391 } 1392 1393 } 1394 1395 @Override 1396 public void setProperty(String name, Base value) throws FHIRException { 1397 if (name.equals("bounds[x]")) 1398 this.bounds = (Type) value; // Type 1399 else if (name.equals("count")) 1400 this.count = castToInteger(value); // IntegerType 1401 else if (name.equals("countMax")) 1402 this.countMax = castToInteger(value); // IntegerType 1403 else if (name.equals("duration")) 1404 this.duration = castToDecimal(value); // DecimalType 1405 else if (name.equals("durationMax")) 1406 this.durationMax = castToDecimal(value); // DecimalType 1407 else if (name.equals("durationUnit")) 1408 this.durationUnit = new UnitsOfTimeEnumFactory().fromType(value); // Enumeration<UnitsOfTime> 1409 else if (name.equals("frequency")) 1410 this.frequency = castToInteger(value); // IntegerType 1411 else if (name.equals("frequencyMax")) 1412 this.frequencyMax = castToInteger(value); // IntegerType 1413 else if (name.equals("period")) 1414 this.period = castToDecimal(value); // DecimalType 1415 else if (name.equals("periodMax")) 1416 this.periodMax = castToDecimal(value); // DecimalType 1417 else if (name.equals("periodUnit")) 1418 this.periodUnit = new UnitsOfTimeEnumFactory().fromType(value); // Enumeration<UnitsOfTime> 1419 else if (name.equals("when")) 1420 this.when = new EventTimingEnumFactory().fromType(value); // Enumeration<EventTiming> 1421 else if (name.equals("offset")) 1422 this.offset = castToUnsignedInt(value); // UnsignedIntType 1423 else 1424 super.setProperty(name, value); 1425 } 1426 1427 @Override 1428 public Base makeProperty(int hash, String name) throws FHIRException { 1429 switch (hash) { 1430 case -1149635157: return getBounds(); // Type 1431 case 94851343: throw new FHIRException("Cannot make property count as it is not a complex type"); // IntegerType 1432 case -372044331: throw new FHIRException("Cannot make property countMax as it is not a complex type"); // IntegerType 1433 case -1992012396: throw new FHIRException("Cannot make property duration as it is not a complex type"); // DecimalType 1434 case -478083280: throw new FHIRException("Cannot make property durationMax as it is not a complex type"); // DecimalType 1435 case -1935429320: throw new FHIRException("Cannot make property durationUnit as it is not a complex type"); // Enumeration<UnitsOfTime> 1436 case -70023844: throw new FHIRException("Cannot make property frequency as it is not a complex type"); // IntegerType 1437 case 1273846376: throw new FHIRException("Cannot make property frequencyMax as it is not a complex type"); // IntegerType 1438 case -991726143: throw new FHIRException("Cannot make property period as it is not a complex type"); // DecimalType 1439 case 566580195: throw new FHIRException("Cannot make property periodMax as it is not a complex type"); // DecimalType 1440 case 384367333: throw new FHIRException("Cannot make property periodUnit as it is not a complex type"); // Enumeration<UnitsOfTime> 1441 case 3648314: throw new FHIRException("Cannot make property when as it is not a complex type"); // Enumeration<EventTiming> 1442 case -1019779949: throw new FHIRException("Cannot make property offset as it is not a complex type"); // UnsignedIntType 1443 default: return super.makeProperty(hash, name); 1444 } 1445 1446 } 1447 1448 @Override 1449 public Base addChild(String name) throws FHIRException { 1450 if (name.equals("boundsDuration")) { 1451 this.bounds = new Duration(); 1452 return this.bounds; 1453 } 1454 else if (name.equals("boundsRange")) { 1455 this.bounds = new Range(); 1456 return this.bounds; 1457 } 1458 else if (name.equals("boundsPeriod")) { 1459 this.bounds = new Period(); 1460 return this.bounds; 1461 } 1462 else if (name.equals("count")) { 1463 throw new FHIRException("Cannot call addChild on a primitive type Timing.count"); 1464 } 1465 else if (name.equals("countMax")) { 1466 throw new FHIRException("Cannot call addChild on a primitive type Timing.countMax"); 1467 } 1468 else if (name.equals("duration")) { 1469 throw new FHIRException("Cannot call addChild on a primitive type Timing.duration"); 1470 } 1471 else if (name.equals("durationMax")) { 1472 throw new FHIRException("Cannot call addChild on a primitive type Timing.durationMax"); 1473 } 1474 else if (name.equals("durationUnit")) { 1475 throw new FHIRException("Cannot call addChild on a primitive type Timing.durationUnit"); 1476 } 1477 else if (name.equals("frequency")) { 1478 throw new FHIRException("Cannot call addChild on a primitive type Timing.frequency"); 1479 } 1480 else if (name.equals("frequencyMax")) { 1481 throw new FHIRException("Cannot call addChild on a primitive type Timing.frequencyMax"); 1482 } 1483 else if (name.equals("period")) { 1484 throw new FHIRException("Cannot call addChild on a primitive type Timing.period"); 1485 } 1486 else if (name.equals("periodMax")) { 1487 throw new FHIRException("Cannot call addChild on a primitive type Timing.periodMax"); 1488 } 1489 else if (name.equals("periodUnit")) { 1490 throw new FHIRException("Cannot call addChild on a primitive type Timing.periodUnit"); 1491 } 1492 else if (name.equals("when")) { 1493 throw new FHIRException("Cannot call addChild on a primitive type Timing.when"); 1494 } 1495 else if (name.equals("offset")) { 1496 throw new FHIRException("Cannot call addChild on a primitive type Timing.offset"); 1497 } 1498 else 1499 return super.addChild(name); 1500 } 1501 1502 public TimingRepeatComponent copy() { 1503 TimingRepeatComponent dst = new TimingRepeatComponent(); 1504 copyValues(dst); 1505 dst.bounds = bounds == null ? null : bounds.copy(); 1506 dst.count = count == null ? null : count.copy(); 1507 dst.countMax = countMax == null ? null : countMax.copy(); 1508 dst.duration = duration == null ? null : duration.copy(); 1509 dst.durationMax = durationMax == null ? null : durationMax.copy(); 1510 dst.durationUnit = durationUnit == null ? null : durationUnit.copy(); 1511 dst.frequency = frequency == null ? null : frequency.copy(); 1512 dst.frequencyMax = frequencyMax == null ? null : frequencyMax.copy(); 1513 dst.period = period == null ? null : period.copy(); 1514 dst.periodMax = periodMax == null ? null : periodMax.copy(); 1515 dst.periodUnit = periodUnit == null ? null : periodUnit.copy(); 1516 dst.when = when == null ? null : when.copy(); 1517 dst.offset = offset == null ? null : offset.copy(); 1518 return dst; 1519 } 1520 1521 @Override 1522 public boolean equalsDeep(Base other) { 1523 if (!super.equalsDeep(other)) 1524 return false; 1525 if (!(other instanceof TimingRepeatComponent)) 1526 return false; 1527 TimingRepeatComponent o = (TimingRepeatComponent) other; 1528 return compareDeep(bounds, o.bounds, true) && compareDeep(count, o.count, true) && compareDeep(countMax, o.countMax, true) 1529 && compareDeep(duration, o.duration, true) && compareDeep(durationMax, o.durationMax, true) && compareDeep(durationUnit, o.durationUnit, true) 1530 && compareDeep(frequency, o.frequency, true) && compareDeep(frequencyMax, o.frequencyMax, true) 1531 && compareDeep(period, o.period, true) && compareDeep(periodMax, o.periodMax, true) && compareDeep(periodUnit, o.periodUnit, true) 1532 && compareDeep(when, o.when, true) && compareDeep(offset, o.offset, true); 1533 } 1534 1535 @Override 1536 public boolean equalsShallow(Base other) { 1537 if (!super.equalsShallow(other)) 1538 return false; 1539 if (!(other instanceof TimingRepeatComponent)) 1540 return false; 1541 TimingRepeatComponent o = (TimingRepeatComponent) other; 1542 return compareValues(count, o.count, true) && compareValues(countMax, o.countMax, true) && compareValues(duration, o.duration, true) 1543 && compareValues(durationMax, o.durationMax, true) && compareValues(durationUnit, o.durationUnit, true) 1544 && compareValues(frequency, o.frequency, true) && compareValues(frequencyMax, o.frequencyMax, true) 1545 && compareValues(period, o.period, true) && compareValues(periodMax, o.periodMax, true) && compareValues(periodUnit, o.periodUnit, true) 1546 && compareValues(when, o.when, true) && compareValues(offset, o.offset, true); 1547 } 1548 1549 public boolean isEmpty() { 1550 return super.isEmpty() && (bounds == null || bounds.isEmpty()) && (count == null || count.isEmpty()) 1551 && (countMax == null || countMax.isEmpty()) && (duration == null || duration.isEmpty()) && (durationMax == null || durationMax.isEmpty()) 1552 && (durationUnit == null || durationUnit.isEmpty()) && (frequency == null || frequency.isEmpty()) 1553 && (frequencyMax == null || frequencyMax.isEmpty()) && (period == null || period.isEmpty()) 1554 && (periodMax == null || periodMax.isEmpty()) && (periodUnit == null || periodUnit.isEmpty()) 1555 && (when == null || when.isEmpty()) && (offset == null || offset.isEmpty()); 1556 } 1557 1558 public String fhirType() { 1559 return "Timing.repeat"; 1560 1561 } 1562 1563 } 1564 1565 /** 1566 * Identifies specific times when the event occurs. 1567 */ 1568 @Child(name = "event", type = {DateTimeType.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1569 @Description(shortDefinition="When the event occurs", formalDefinition="Identifies specific times when the event occurs." ) 1570 protected List<DateTimeType> event; 1571 1572 /** 1573 * A set of rules that describe when the event should occur. 1574 */ 1575 @Child(name = "repeat", type = {}, order=1, min=0, max=1, modifier=false, summary=true) 1576 @Description(shortDefinition="When the event is to occur", formalDefinition="A set of rules that describe when the event should occur." ) 1577 protected TimingRepeatComponent repeat; 1578 1579 /** 1580 * A code for the timing pattern. 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. 1581 */ 1582 @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 1583 @Description(shortDefinition="QD | QOD | Q4H | Q6H | BID | TID | QID | AM | PM +", formalDefinition="A code for the timing pattern. 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." ) 1584 protected CodeableConcept code; 1585 1586 private static final long serialVersionUID = 791565112L; 1587 1588 /** 1589 * Constructor 1590 */ 1591 public Timing() { 1592 super(); 1593 } 1594 1595 /** 1596 * @return {@link #event} (Identifies specific times when the event occurs.) 1597 */ 1598 public List<DateTimeType> getEvent() { 1599 if (this.event == null) 1600 this.event = new ArrayList<DateTimeType>(); 1601 return this.event; 1602 } 1603 1604 public boolean hasEvent() { 1605 if (this.event == null) 1606 return false; 1607 for (DateTimeType item : this.event) 1608 if (!item.isEmpty()) 1609 return true; 1610 return false; 1611 } 1612 1613 /** 1614 * @return {@link #event} (Identifies specific times when the event occurs.) 1615 */ 1616 // syntactic sugar 1617 public DateTimeType addEventElement() {//2 1618 DateTimeType t = new DateTimeType(); 1619 if (this.event == null) 1620 this.event = new ArrayList<DateTimeType>(); 1621 this.event.add(t); 1622 return t; 1623 } 1624 1625 /** 1626 * @param value {@link #event} (Identifies specific times when the event occurs.) 1627 */ 1628 public Timing addEvent(Date value) { //1 1629 DateTimeType t = new DateTimeType(); 1630 t.setValue(value); 1631 if (this.event == null) 1632 this.event = new ArrayList<DateTimeType>(); 1633 this.event.add(t); 1634 return this; 1635 } 1636 1637 /** 1638 * @param value {@link #event} (Identifies specific times when the event occurs.) 1639 */ 1640 public boolean hasEvent(Date value) { 1641 if (this.event == null) 1642 return false; 1643 for (DateTimeType v : this.event) 1644 if (v.equals(value)) // dateTime 1645 return true; 1646 return false; 1647 } 1648 1649 /** 1650 * @return {@link #repeat} (A set of rules that describe when the event should occur.) 1651 */ 1652 public TimingRepeatComponent getRepeat() { 1653 if (this.repeat == null) 1654 if (Configuration.errorOnAutoCreate()) 1655 throw new Error("Attempt to auto-create Timing.repeat"); 1656 else if (Configuration.doAutoCreate()) 1657 this.repeat = new TimingRepeatComponent(); // cc 1658 return this.repeat; 1659 } 1660 1661 public boolean hasRepeat() { 1662 return this.repeat != null && !this.repeat.isEmpty(); 1663 } 1664 1665 /** 1666 * @param value {@link #repeat} (A set of rules that describe when the event should occur.) 1667 */ 1668 public Timing setRepeat(TimingRepeatComponent value) { 1669 this.repeat = value; 1670 return this; 1671 } 1672 1673 /** 1674 * @return {@link #code} (A code for the timing pattern. 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.) 1675 */ 1676 public CodeableConcept getCode() { 1677 if (this.code == null) 1678 if (Configuration.errorOnAutoCreate()) 1679 throw new Error("Attempt to auto-create Timing.code"); 1680 else if (Configuration.doAutoCreate()) 1681 this.code = new CodeableConcept(); // cc 1682 return this.code; 1683 } 1684 1685 public boolean hasCode() { 1686 return this.code != null && !this.code.isEmpty(); 1687 } 1688 1689 /** 1690 * @param value {@link #code} (A code for the timing pattern. 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.) 1691 */ 1692 public Timing setCode(CodeableConcept value) { 1693 this.code = value; 1694 return this; 1695 } 1696 1697 protected void listChildren(List<Property> childrenList) { 1698 super.listChildren(childrenList); 1699 childrenList.add(new Property("event", "dateTime", "Identifies specific times when the event occurs.", 0, java.lang.Integer.MAX_VALUE, event)); 1700 childrenList.add(new Property("repeat", "", "A set of rules that describe when the event should occur.", 0, java.lang.Integer.MAX_VALUE, repeat)); 1701 childrenList.add(new Property("code", "CodeableConcept", "A code for the timing pattern. 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.", 0, java.lang.Integer.MAX_VALUE, code)); 1702 } 1703 1704 @Override 1705 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1706 switch (hash) { 1707 case 96891546: /*event*/ return this.event == null ? new Base[0] : this.event.toArray(new Base[this.event.size()]); // DateTimeType 1708 case -934531685: /*repeat*/ return this.repeat == null ? new Base[0] : new Base[] {this.repeat}; // TimingRepeatComponent 1709 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 1710 default: return super.getProperty(hash, name, checkValid); 1711 } 1712 1713 } 1714 1715 @Override 1716 public void setProperty(int hash, String name, Base value) throws FHIRException { 1717 switch (hash) { 1718 case 96891546: // event 1719 this.getEvent().add(castToDateTime(value)); // DateTimeType 1720 break; 1721 case -934531685: // repeat 1722 this.repeat = (TimingRepeatComponent) value; // TimingRepeatComponent 1723 break; 1724 case 3059181: // code 1725 this.code = castToCodeableConcept(value); // CodeableConcept 1726 break; 1727 default: super.setProperty(hash, name, value); 1728 } 1729 1730 } 1731 1732 @Override 1733 public void setProperty(String name, Base value) throws FHIRException { 1734 if (name.equals("event")) 1735 this.getEvent().add(castToDateTime(value)); 1736 else if (name.equals("repeat")) 1737 this.repeat = (TimingRepeatComponent) value; // TimingRepeatComponent 1738 else if (name.equals("code")) 1739 this.code = castToCodeableConcept(value); // CodeableConcept 1740 else 1741 super.setProperty(name, value); 1742 } 1743 1744 @Override 1745 public Base makeProperty(int hash, String name) throws FHIRException { 1746 switch (hash) { 1747 case 96891546: throw new FHIRException("Cannot make property event as it is not a complex type"); // DateTimeType 1748 case -934531685: return getRepeat(); // TimingRepeatComponent 1749 case 3059181: return getCode(); // CodeableConcept 1750 default: return super.makeProperty(hash, name); 1751 } 1752 1753 } 1754 1755 @Override 1756 public Base addChild(String name) throws FHIRException { 1757 if (name.equals("event")) { 1758 throw new FHIRException("Cannot call addChild on a primitive type Timing.event"); 1759 } 1760 else if (name.equals("repeat")) { 1761 this.repeat = new TimingRepeatComponent(); 1762 return this.repeat; 1763 } 1764 else if (name.equals("code")) { 1765 this.code = new CodeableConcept(); 1766 return this.code; 1767 } 1768 else 1769 return super.addChild(name); 1770 } 1771 1772 public String fhirType() { 1773 return "Timing"; 1774 1775 } 1776 1777 public Timing copy() { 1778 Timing dst = new Timing(); 1779 copyValues(dst); 1780 if (event != null) { 1781 dst.event = new ArrayList<DateTimeType>(); 1782 for (DateTimeType i : event) 1783 dst.event.add(i.copy()); 1784 }; 1785 dst.repeat = repeat == null ? null : repeat.copy(); 1786 dst.code = code == null ? null : code.copy(); 1787 return dst; 1788 } 1789 1790 protected Timing typedCopy() { 1791 return copy(); 1792 } 1793 1794 @Override 1795 public boolean equalsDeep(Base other) { 1796 if (!super.equalsDeep(other)) 1797 return false; 1798 if (!(other instanceof Timing)) 1799 return false; 1800 Timing o = (Timing) other; 1801 return compareDeep(event, o.event, true) && compareDeep(repeat, o.repeat, true) && compareDeep(code, o.code, true) 1802 ; 1803 } 1804 1805 @Override 1806 public boolean equalsShallow(Base other) { 1807 if (!super.equalsShallow(other)) 1808 return false; 1809 if (!(other instanceof Timing)) 1810 return false; 1811 Timing o = (Timing) other; 1812 return compareValues(event, o.event, true); 1813 } 1814 1815 public boolean isEmpty() { 1816 return super.isEmpty() && (event == null || event.isEmpty()) && (repeat == null || repeat.isEmpty()) 1817 && (code == null || code.isEmpty()); 1818 } 1819 1820 1821}