001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2 038import java.util.ArrayList; 039import java.util.Date; 040import java.util.List; 041 042import ca.uhn.fhir.model.api.annotation.Block; 043import ca.uhn.fhir.model.api.annotation.Child; 044import ca.uhn.fhir.model.api.annotation.DatatypeDef; 045import ca.uhn.fhir.model.api.annotation.Description; 046import org.hl7.fhir.instance.model.api.IBaseDatatypeElement; 047import org.hl7.fhir.instance.model.api.ICompositeType; 048import org.hl7.fhir.exceptions.FHIRException; 049/** 050 * 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. 051 */ 052@DatatypeDef(name="Timing") 053public class Timing extends Type implements ICompositeType { 054 055 public enum UnitsOfTime { 056 /** 057 * null 058 */ 059 S, 060 /** 061 * null 062 */ 063 MIN, 064 /** 065 * null 066 */ 067 H, 068 /** 069 * null 070 */ 071 D, 072 /** 073 * null 074 */ 075 WK, 076 /** 077 * null 078 */ 079 MO, 080 /** 081 * null 082 */ 083 A, 084 /** 085 * added to help the parsers 086 */ 087 NULL; 088 public static UnitsOfTime fromCode(String codeString) throws FHIRException { 089 if (codeString == null || "".equals(codeString)) 090 return null; 091 if ("s".equals(codeString)) 092 return S; 093 if ("min".equals(codeString)) 094 return MIN; 095 if ("h".equals(codeString)) 096 return H; 097 if ("d".equals(codeString)) 098 return D; 099 if ("wk".equals(codeString)) 100 return WK; 101 if ("mo".equals(codeString)) 102 return MO; 103 if ("a".equals(codeString)) 104 return A; 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 case NULL: return null; 117 default: return "?"; 118 } 119 } 120 public String getSystem() { 121 switch (this) { 122 case S: return "http://unitsofmeasure.org"; 123 case MIN: return "http://unitsofmeasure.org"; 124 case H: return "http://unitsofmeasure.org"; 125 case D: return "http://unitsofmeasure.org"; 126 case WK: return "http://unitsofmeasure.org"; 127 case MO: return "http://unitsofmeasure.org"; 128 case A: return "http://unitsofmeasure.org"; 129 case NULL: return null; 130 default: return "?"; 131 } 132 } 133 public String getDefinition() { 134 switch (this) { 135 case S: return ""; 136 case MIN: return ""; 137 case H: return ""; 138 case D: return ""; 139 case WK: return ""; 140 case MO: return ""; 141 case A: return ""; 142 case NULL: return null; 143 default: return "?"; 144 } 145 } 146 public String getDisplay() { 147 switch (this) { 148 case S: return "s"; 149 case MIN: return "min"; 150 case H: return "h"; 151 case D: return "d"; 152 case WK: return "wk"; 153 case MO: return "mo"; 154 case A: return "a"; 155 case NULL: return null; 156 default: return "?"; 157 } 158 } 159 } 160 161 public static class UnitsOfTimeEnumFactory implements EnumFactory<UnitsOfTime> { 162 public UnitsOfTime fromCode(String codeString) throws IllegalArgumentException { 163 if (codeString == null || "".equals(codeString)) 164 if (codeString == null || "".equals(codeString)) 165 return null; 166 if ("s".equals(codeString)) 167 return UnitsOfTime.S; 168 if ("min".equals(codeString)) 169 return UnitsOfTime.MIN; 170 if ("h".equals(codeString)) 171 return UnitsOfTime.H; 172 if ("d".equals(codeString)) 173 return UnitsOfTime.D; 174 if ("wk".equals(codeString)) 175 return UnitsOfTime.WK; 176 if ("mo".equals(codeString)) 177 return UnitsOfTime.MO; 178 if ("a".equals(codeString)) 179 return UnitsOfTime.A; 180 throw new IllegalArgumentException("Unknown UnitsOfTime code '"+codeString+"'"); 181 } 182 public Enumeration<UnitsOfTime> fromType(Base code) throws FHIRException { 183 if (code == null || code.isEmpty()) 184 return null; 185 String codeString = ((PrimitiveType) code).asStringValue(); 186 if (codeString == null || "".equals(codeString)) 187 return null; 188 if ("s".equals(codeString)) 189 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.S); 190 if ("min".equals(codeString)) 191 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.MIN); 192 if ("h".equals(codeString)) 193 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.H); 194 if ("d".equals(codeString)) 195 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.D); 196 if ("wk".equals(codeString)) 197 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.WK); 198 if ("mo".equals(codeString)) 199 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.MO); 200 if ("a".equals(codeString)) 201 return new Enumeration<UnitsOfTime>(this, UnitsOfTime.A); 202 throw new FHIRException("Unknown UnitsOfTime code '"+codeString+"'"); 203 } 204 public String toCode(UnitsOfTime code) { 205 if (code == UnitsOfTime.S) 206 return "s"; 207 if (code == UnitsOfTime.MIN) 208 return "min"; 209 if (code == UnitsOfTime.H) 210 return "h"; 211 if (code == UnitsOfTime.D) 212 return "d"; 213 if (code == UnitsOfTime.WK) 214 return "wk"; 215 if (code == UnitsOfTime.MO) 216 return "mo"; 217 if (code == UnitsOfTime.A) 218 return "a"; 219 return "?"; 220 } 221 } 222 223 public enum EventTiming { 224 /** 225 * null 226 */ 227 HS, 228 /** 229 * null 230 */ 231 WAKE, 232 /** 233 * null 234 */ 235 C, 236 /** 237 * null 238 */ 239 CM, 240 /** 241 * null 242 */ 243 CD, 244 /** 245 * null 246 */ 247 CV, 248 /** 249 * null 250 */ 251 AC, 252 /** 253 * null 254 */ 255 ACM, 256 /** 257 * null 258 */ 259 ACD, 260 /** 261 * null 262 */ 263 ACV, 264 /** 265 * null 266 */ 267 PC, 268 /** 269 * null 270 */ 271 PCM, 272 /** 273 * null 274 */ 275 PCD, 276 /** 277 * null 278 */ 279 PCV, 280 /** 281 * added to help the parsers 282 */ 283 NULL; 284 public static EventTiming fromCode(String codeString) throws FHIRException { 285 if (codeString == null || "".equals(codeString)) 286 return null; 287 if ("HS".equals(codeString)) 288 return HS; 289 if ("WAKE".equals(codeString)) 290 return WAKE; 291 if ("C".equals(codeString)) 292 return C; 293 if ("CM".equals(codeString)) 294 return CM; 295 if ("CD".equals(codeString)) 296 return CD; 297 if ("CV".equals(codeString)) 298 return CV; 299 if ("AC".equals(codeString)) 300 return AC; 301 if ("ACM".equals(codeString)) 302 return ACM; 303 if ("ACD".equals(codeString)) 304 return ACD; 305 if ("ACV".equals(codeString)) 306 return ACV; 307 if ("PC".equals(codeString)) 308 return PC; 309 if ("PCM".equals(codeString)) 310 return PCM; 311 if ("PCD".equals(codeString)) 312 return PCD; 313 if ("PCV".equals(codeString)) 314 return PCV; 315 throw new FHIRException("Unknown EventTiming code '"+codeString+"'"); 316 } 317 public String toCode() { 318 switch (this) { 319 case HS: return "HS"; 320 case WAKE: return "WAKE"; 321 case C: return "C"; 322 case CM: return "CM"; 323 case CD: return "CD"; 324 case CV: return "CV"; 325 case AC: return "AC"; 326 case ACM: return "ACM"; 327 case ACD: return "ACD"; 328 case ACV: return "ACV"; 329 case PC: return "PC"; 330 case PCM: return "PCM"; 331 case PCD: return "PCD"; 332 case PCV: return "PCV"; 333 case NULL: return null; 334 default: return "?"; 335 } 336 } 337 public String getSystem() { 338 switch (this) { 339 case HS: return "http://hl7.org/fhir/v3/TimingEvent"; 340 case WAKE: return "http://hl7.org/fhir/v3/TimingEvent"; 341 case C: return "http://hl7.org/fhir/v3/TimingEvent"; 342 case CM: return "http://hl7.org/fhir/v3/TimingEvent"; 343 case CD: return "http://hl7.org/fhir/v3/TimingEvent"; 344 case CV: return "http://hl7.org/fhir/v3/TimingEvent"; 345 case AC: return "http://hl7.org/fhir/v3/TimingEvent"; 346 case ACM: return "http://hl7.org/fhir/v3/TimingEvent"; 347 case ACD: return "http://hl7.org/fhir/v3/TimingEvent"; 348 case ACV: return "http://hl7.org/fhir/v3/TimingEvent"; 349 case PC: return "http://hl7.org/fhir/v3/TimingEvent"; 350 case PCM: return "http://hl7.org/fhir/v3/TimingEvent"; 351 case PCD: return "http://hl7.org/fhir/v3/TimingEvent"; 352 case PCV: return "http://hl7.org/fhir/v3/TimingEvent"; 353 case NULL: return null; 354 default: return "?"; 355 } 356 } 357 public String getDefinition() { 358 switch (this) { 359 case HS: return ""; 360 case WAKE: return ""; 361 case C: return ""; 362 case CM: return ""; 363 case CD: return ""; 364 case CV: return ""; 365 case AC: return ""; 366 case ACM: return ""; 367 case ACD: return ""; 368 case ACV: return ""; 369 case PC: return ""; 370 case PCM: return ""; 371 case PCD: return ""; 372 case PCV: return ""; 373 case NULL: return null; 374 default: return "?"; 375 } 376 } 377 public String getDisplay() { 378 switch (this) { 379 case HS: return "HS"; 380 case WAKE: return "WAKE"; 381 case C: return "C"; 382 case CM: return "CM"; 383 case CD: return "CD"; 384 case CV: return "CV"; 385 case AC: return "AC"; 386 case ACM: return "ACM"; 387 case ACD: return "ACD"; 388 case ACV: return "ACV"; 389 case PC: return "PC"; 390 case PCM: return "PCM"; 391 case PCD: return "PCD"; 392 case PCV: return "PCV"; 393 case NULL: return null; 394 default: return "?"; 395 } 396 } 397 } 398 399 public static class EventTimingEnumFactory implements EnumFactory<EventTiming> { 400 public EventTiming fromCode(String codeString) throws IllegalArgumentException { 401 if (codeString == null || "".equals(codeString)) 402 if (codeString == null || "".equals(codeString)) 403 return null; 404 if ("HS".equals(codeString)) 405 return EventTiming.HS; 406 if ("WAKE".equals(codeString)) 407 return EventTiming.WAKE; 408 if ("C".equals(codeString)) 409 return EventTiming.C; 410 if ("CM".equals(codeString)) 411 return EventTiming.CM; 412 if ("CD".equals(codeString)) 413 return EventTiming.CD; 414 if ("CV".equals(codeString)) 415 return EventTiming.CV; 416 if ("AC".equals(codeString)) 417 return EventTiming.AC; 418 if ("ACM".equals(codeString)) 419 return EventTiming.ACM; 420 if ("ACD".equals(codeString)) 421 return EventTiming.ACD; 422 if ("ACV".equals(codeString)) 423 return EventTiming.ACV; 424 if ("PC".equals(codeString)) 425 return EventTiming.PC; 426 if ("PCM".equals(codeString)) 427 return EventTiming.PCM; 428 if ("PCD".equals(codeString)) 429 return EventTiming.PCD; 430 if ("PCV".equals(codeString)) 431 return EventTiming.PCV; 432 throw new IllegalArgumentException("Unknown EventTiming code '"+codeString+"'"); 433 } 434 public Enumeration<EventTiming> fromType(Base code) throws FHIRException { 435 if (code == null || code.isEmpty()) 436 return null; 437 String codeString = ((PrimitiveType) code).asStringValue(); 438 if (codeString == null || "".equals(codeString)) 439 return null; 440 if ("HS".equals(codeString)) 441 return new Enumeration<EventTiming>(this, EventTiming.HS); 442 if ("WAKE".equals(codeString)) 443 return new Enumeration<EventTiming>(this, EventTiming.WAKE); 444 if ("C".equals(codeString)) 445 return new Enumeration<EventTiming>(this, EventTiming.C); 446 if ("CM".equals(codeString)) 447 return new Enumeration<EventTiming>(this, EventTiming.CM); 448 if ("CD".equals(codeString)) 449 return new Enumeration<EventTiming>(this, EventTiming.CD); 450 if ("CV".equals(codeString)) 451 return new Enumeration<EventTiming>(this, EventTiming.CV); 452 if ("AC".equals(codeString)) 453 return new Enumeration<EventTiming>(this, EventTiming.AC); 454 if ("ACM".equals(codeString)) 455 return new Enumeration<EventTiming>(this, EventTiming.ACM); 456 if ("ACD".equals(codeString)) 457 return new Enumeration<EventTiming>(this, EventTiming.ACD); 458 if ("ACV".equals(codeString)) 459 return new Enumeration<EventTiming>(this, EventTiming.ACV); 460 if ("PC".equals(codeString)) 461 return new Enumeration<EventTiming>(this, EventTiming.PC); 462 if ("PCM".equals(codeString)) 463 return new Enumeration<EventTiming>(this, EventTiming.PCM); 464 if ("PCD".equals(codeString)) 465 return new Enumeration<EventTiming>(this, EventTiming.PCD); 466 if ("PCV".equals(codeString)) 467 return new Enumeration<EventTiming>(this, EventTiming.PCV); 468 throw new FHIRException("Unknown EventTiming code '"+codeString+"'"); 469 } 470 public String toCode(EventTiming code) { 471 if (code == EventTiming.HS) 472 return "HS"; 473 if (code == EventTiming.WAKE) 474 return "WAKE"; 475 if (code == EventTiming.C) 476 return "C"; 477 if (code == EventTiming.CM) 478 return "CM"; 479 if (code == EventTiming.CD) 480 return "CD"; 481 if (code == EventTiming.CV) 482 return "CV"; 483 if (code == EventTiming.AC) 484 return "AC"; 485 if (code == EventTiming.ACM) 486 return "ACM"; 487 if (code == EventTiming.ACD) 488 return "ACD"; 489 if (code == EventTiming.ACV) 490 return "ACV"; 491 if (code == EventTiming.PC) 492 return "PC"; 493 if (code == EventTiming.PCM) 494 return "PCM"; 495 if (code == EventTiming.PCD) 496 return "PCD"; 497 if (code == EventTiming.PCV) 498 return "PCV"; 499 return "?"; 500 } 501 } 502 503 @Block() 504 public static class TimingRepeatComponent extends Element implements IBaseDatatypeElement { 505 /** 506 * 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. 507 */ 508 @Child(name = "bounds", type = {Duration.class, Range.class, Period.class}, order=1, min=0, max=1, modifier=false, summary=true) 509 @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." ) 510 protected Type bounds; 511 512 /** 513 * A total count of the desired number of repetitions. 514 */ 515 @Child(name = "count", type = {IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=true) 516 @Description(shortDefinition="Number of times to repeat", formalDefinition="A total count of the desired number of repetitions." ) 517 protected IntegerType count; 518 519 /** 520 * How long this thing happens for when it happens. 521 */ 522 @Child(name = "duration", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=true) 523 @Description(shortDefinition="How long when it happens", formalDefinition="How long this thing happens for when it happens." ) 524 protected DecimalType duration; 525 526 /** 527 * The upper limit of how long this thing happens for when it happens. 528 */ 529 @Child(name = "durationMax", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true) 530 @Description(shortDefinition="How long when it happens (Max)", formalDefinition="The upper limit of how long this thing happens for when it happens." ) 531 protected DecimalType durationMax; 532 533 /** 534 * The units of time for the duration, in UCUM units. 535 */ 536 @Child(name = "durationUnits", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=true) 537 @Description(shortDefinition="s | min | h | d | wk | mo | a - unit of time (UCUM)", formalDefinition="The units of time for the duration, in UCUM units." ) 538 protected Enumeration<UnitsOfTime> durationUnits; 539 540 /** 541 * The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided). 542 */ 543 @Child(name = "frequency", type = {IntegerType.class}, order=6, min=0, max=1, modifier=false, summary=true) 544 @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)." ) 545 protected IntegerType frequency; 546 547 /** 548 * If present, indicates that the frequency is a range - so repeat between [frequency] and [frequencyMax] times within the period or period range. 549 */ 550 @Child(name = "frequencyMax", type = {IntegerType.class}, order=7, min=0, max=1, modifier=false, summary=true) 551 @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." ) 552 protected IntegerType frequencyMax; 553 554 /** 555 * 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. 556 */ 557 @Child(name = "period", type = {DecimalType.class}, order=8, min=0, max=1, modifier=false, summary=true) 558 @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." ) 559 protected DecimalType period; 560 561 /** 562 * 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. 563 */ 564 @Child(name = "periodMax", type = {DecimalType.class}, order=9, min=0, max=1, modifier=false, summary=true) 565 @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." ) 566 protected DecimalType periodMax; 567 568 /** 569 * The units of time for the period in UCUM units. 570 */ 571 @Child(name = "periodUnits", type = {CodeType.class}, order=10, min=0, max=1, modifier=false, summary=true) 572 @Description(shortDefinition="s | min | h | d | wk | mo | a - unit of time (UCUM)", formalDefinition="The units of time for the period in UCUM units." ) 573 protected Enumeration<UnitsOfTime> periodUnits; 574 575 /** 576 * A real world event that the occurrence of the event should be tied to. 577 */ 578 @Child(name = "when", type = {CodeType.class}, order=11, min=0, max=1, modifier=false, summary=true) 579 @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." ) 580 protected Enumeration<EventTiming> when; 581 582 private static final long serialVersionUID = -585686982L; 583 584 /* 585 * Constructor 586 */ 587 public TimingRepeatComponent() { 588 super(); 589 } 590 591 /** 592 * @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.) 593 */ 594 public Type getBounds() { 595 return this.bounds; 596 } 597 598 /** 599 * @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.) 600 */ 601 public Duration getBoundsDuration() throws FHIRException { 602 if (!(this.bounds instanceof Duration)) 603 throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.bounds.getClass().getName()+" was encountered"); 604 return (Duration) this.bounds; 605 } 606 607 public boolean hasBoundsDuration() { 608 return this.bounds instanceof Duration; 609 } 610 611 /** 612 * @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.) 613 */ 614 public Range getBoundsRange() throws FHIRException { 615 if (!(this.bounds instanceof Range)) 616 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.bounds.getClass().getName()+" was encountered"); 617 return (Range) this.bounds; 618 } 619 620 public boolean hasBoundsRange() { 621 return this.bounds instanceof Range; 622 } 623 624 /** 625 * @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.) 626 */ 627 public Period getBoundsPeriod() throws FHIRException { 628 if (!(this.bounds instanceof Period)) 629 throw new FHIRException("Type mismatch: the type Period was expected, but "+this.bounds.getClass().getName()+" was encountered"); 630 return (Period) this.bounds; 631 } 632 633 public boolean hasBoundsPeriod() { 634 return this.bounds instanceof Period; 635 } 636 637 public boolean hasBounds() { 638 return this.bounds != null && !this.bounds.isEmpty(); 639 } 640 641 /** 642 * @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.) 643 */ 644 public TimingRepeatComponent setBounds(Type value) { 645 this.bounds = value; 646 return this; 647 } 648 649 /** 650 * @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 651 */ 652 public IntegerType getCountElement() { 653 if (this.count == null) 654 if (Configuration.errorOnAutoCreate()) 655 throw new Error("Attempt to auto-create TimingRepeatComponent.count"); 656 else if (Configuration.doAutoCreate()) 657 this.count = new IntegerType(); // bb 658 return this.count; 659 } 660 661 public boolean hasCountElement() { 662 return this.count != null && !this.count.isEmpty(); 663 } 664 665 public boolean hasCount() { 666 return this.count != null && !this.count.isEmpty(); 667 } 668 669 /** 670 * @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 671 */ 672 public TimingRepeatComponent setCountElement(IntegerType value) { 673 this.count = value; 674 return this; 675 } 676 677 /** 678 * @return A total count of the desired number of repetitions. 679 */ 680 public int getCount() { 681 return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue(); 682 } 683 684 /** 685 * @param value A total count of the desired number of repetitions. 686 */ 687 public TimingRepeatComponent setCount(int value) { 688 if (this.count == null) 689 this.count = new IntegerType(); 690 this.count.setValue(value); 691 return this; 692 } 693 694 /** 695 * @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 696 */ 697 public DecimalType getDurationElement() { 698 if (this.duration == null) 699 if (Configuration.errorOnAutoCreate()) 700 throw new Error("Attempt to auto-create TimingRepeatComponent.duration"); 701 else if (Configuration.doAutoCreate()) 702 this.duration = new DecimalType(); // bb 703 return this.duration; 704 } 705 706 public boolean hasDurationElement() { 707 return this.duration != null && !this.duration.isEmpty(); 708 } 709 710 public boolean hasDuration() { 711 return this.duration != null && !this.duration.isEmpty(); 712 } 713 714 /** 715 * @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 716 */ 717 public TimingRepeatComponent setDurationElement(DecimalType value) { 718 this.duration = value; 719 return this; 720 } 721 722 /** 723 * @return How long this thing happens for when it happens. 724 */ 725 public BigDecimal getDuration() { 726 return this.duration == null ? null : this.duration.getValue(); 727 } 728 729 /** 730 * @param value How long this thing happens for when it happens. 731 */ 732 public TimingRepeatComponent setDuration(BigDecimal value) { 733 if (value == null) 734 this.duration = null; 735 else { 736 if (this.duration == null) 737 this.duration = new DecimalType(); 738 this.duration.setValue(value); 739 } 740 return this; 741 } 742 743 /** 744 * @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 745 */ 746 public DecimalType getDurationMaxElement() { 747 if (this.durationMax == null) 748 if (Configuration.errorOnAutoCreate()) 749 throw new Error("Attempt to auto-create TimingRepeatComponent.durationMax"); 750 else if (Configuration.doAutoCreate()) 751 this.durationMax = new DecimalType(); // bb 752 return this.durationMax; 753 } 754 755 public boolean hasDurationMaxElement() { 756 return this.durationMax != null && !this.durationMax.isEmpty(); 757 } 758 759 public boolean hasDurationMax() { 760 return this.durationMax != null && !this.durationMax.isEmpty(); 761 } 762 763 /** 764 * @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 765 */ 766 public TimingRepeatComponent setDurationMaxElement(DecimalType value) { 767 this.durationMax = value; 768 return this; 769 } 770 771 /** 772 * @return The upper limit of how long this thing happens for when it happens. 773 */ 774 public BigDecimal getDurationMax() { 775 return this.durationMax == null ? null : this.durationMax.getValue(); 776 } 777 778 /** 779 * @param value The upper limit of how long this thing happens for when it happens. 780 */ 781 public TimingRepeatComponent setDurationMax(BigDecimal value) { 782 if (value == null) 783 this.durationMax = null; 784 else { 785 if (this.durationMax == null) 786 this.durationMax = new DecimalType(); 787 this.durationMax.setValue(value); 788 } 789 return this; 790 } 791 792 /** 793 * @return {@link #durationUnits} (The units of time for the duration, in UCUM units.). This is the underlying object with id, value and extensions. The accessor "getDurationUnits" gives direct access to the value 794 */ 795 public Enumeration<UnitsOfTime> getDurationUnitsElement() { 796 if (this.durationUnits == null) 797 if (Configuration.errorOnAutoCreate()) 798 throw new Error("Attempt to auto-create TimingRepeatComponent.durationUnits"); 799 else if (Configuration.doAutoCreate()) 800 this.durationUnits = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory()); // bb 801 return this.durationUnits; 802 } 803 804 public boolean hasDurationUnitsElement() { 805 return this.durationUnits != null && !this.durationUnits.isEmpty(); 806 } 807 808 public boolean hasDurationUnits() { 809 return this.durationUnits != null && !this.durationUnits.isEmpty(); 810 } 811 812 /** 813 * @param value {@link #durationUnits} (The units of time for the duration, in UCUM units.). This is the underlying object with id, value and extensions. The accessor "getDurationUnits" gives direct access to the value 814 */ 815 public TimingRepeatComponent setDurationUnitsElement(Enumeration<UnitsOfTime> value) { 816 this.durationUnits = value; 817 return this; 818 } 819 820 /** 821 * @return The units of time for the duration, in UCUM units. 822 */ 823 public UnitsOfTime getDurationUnits() { 824 return this.durationUnits == null ? null : this.durationUnits.getValue(); 825 } 826 827 /** 828 * @param value The units of time for the duration, in UCUM units. 829 */ 830 public TimingRepeatComponent setDurationUnits(UnitsOfTime value) { 831 if (value == null) 832 this.durationUnits = null; 833 else { 834 if (this.durationUnits == null) 835 this.durationUnits = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory()); 836 this.durationUnits.setValue(value); 837 } 838 return this; 839 } 840 841 /** 842 * @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 843 */ 844 public IntegerType getFrequencyElement() { 845 if (this.frequency == null) 846 if (Configuration.errorOnAutoCreate()) 847 throw new Error("Attempt to auto-create TimingRepeatComponent.frequency"); 848 else if (Configuration.doAutoCreate()) 849 this.frequency = new IntegerType(); // bb 850 return this.frequency; 851 } 852 853 public boolean hasFrequencyElement() { 854 return this.frequency != null && !this.frequency.isEmpty(); 855 } 856 857 public boolean hasFrequency() { 858 return this.frequency != null && !this.frequency.isEmpty(); 859 } 860 861 /** 862 * @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 863 */ 864 public TimingRepeatComponent setFrequencyElement(IntegerType value) { 865 this.frequency = value; 866 return this; 867 } 868 869 /** 870 * @return The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided). 871 */ 872 public int getFrequency() { 873 return this.frequency == null || this.frequency.isEmpty() ? 0 : this.frequency.getValue(); 874 } 875 876 /** 877 * @param value The number of times to repeat the action within the specified period / period range (i.e. both period and periodMax provided). 878 */ 879 public TimingRepeatComponent setFrequency(int value) { 880 if (this.frequency == null) 881 this.frequency = new IntegerType(); 882 this.frequency.setValue(value); 883 return this; 884 } 885 886 /** 887 * @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 888 */ 889 public IntegerType getFrequencyMaxElement() { 890 if (this.frequencyMax == null) 891 if (Configuration.errorOnAutoCreate()) 892 throw new Error("Attempt to auto-create TimingRepeatComponent.frequencyMax"); 893 else if (Configuration.doAutoCreate()) 894 this.frequencyMax = new IntegerType(); // bb 895 return this.frequencyMax; 896 } 897 898 public boolean hasFrequencyMaxElement() { 899 return this.frequencyMax != null && !this.frequencyMax.isEmpty(); 900 } 901 902 public boolean hasFrequencyMax() { 903 return this.frequencyMax != null && !this.frequencyMax.isEmpty(); 904 } 905 906 /** 907 * @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 908 */ 909 public TimingRepeatComponent setFrequencyMaxElement(IntegerType value) { 910 this.frequencyMax = value; 911 return this; 912 } 913 914 /** 915 * @return If present, indicates that the frequency is a range - so repeat between [frequency] and [frequencyMax] times within the period or period range. 916 */ 917 public int getFrequencyMax() { 918 return this.frequencyMax == null || this.frequencyMax.isEmpty() ? 0 : this.frequencyMax.getValue(); 919 } 920 921 /** 922 * @param value If present, indicates that the frequency is a range - so repeat between [frequency] and [frequencyMax] times within the period or period range. 923 */ 924 public TimingRepeatComponent setFrequencyMax(int value) { 925 if (this.frequencyMax == null) 926 this.frequencyMax = new IntegerType(); 927 this.frequencyMax.setValue(value); 928 return this; 929 } 930 931 /** 932 * @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 933 */ 934 public DecimalType getPeriodElement() { 935 if (this.period == null) 936 if (Configuration.errorOnAutoCreate()) 937 throw new Error("Attempt to auto-create TimingRepeatComponent.period"); 938 else if (Configuration.doAutoCreate()) 939 this.period = new DecimalType(); // bb 940 return this.period; 941 } 942 943 public boolean hasPeriodElement() { 944 return this.period != null && !this.period.isEmpty(); 945 } 946 947 public boolean hasPeriod() { 948 return this.period != null && !this.period.isEmpty(); 949 } 950 951 /** 952 * @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 953 */ 954 public TimingRepeatComponent setPeriodElement(DecimalType value) { 955 this.period = value; 956 return this; 957 } 958 959 /** 960 * @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. 961 */ 962 public BigDecimal getPeriod() { 963 return this.period == null ? null : this.period.getValue(); 964 } 965 966 /** 967 * @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. 968 */ 969 public TimingRepeatComponent setPeriod(BigDecimal value) { 970 if (value == null) 971 this.period = null; 972 else { 973 if (this.period == null) 974 this.period = new DecimalType(); 975 this.period.setValue(value); 976 } 977 return this; 978 } 979 980 /** 981 * @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 982 */ 983 public DecimalType getPeriodMaxElement() { 984 if (this.periodMax == null) 985 if (Configuration.errorOnAutoCreate()) 986 throw new Error("Attempt to auto-create TimingRepeatComponent.periodMax"); 987 else if (Configuration.doAutoCreate()) 988 this.periodMax = new DecimalType(); // bb 989 return this.periodMax; 990 } 991 992 public boolean hasPeriodMaxElement() { 993 return this.periodMax != null && !this.periodMax.isEmpty(); 994 } 995 996 public boolean hasPeriodMax() { 997 return this.periodMax != null && !this.periodMax.isEmpty(); 998 } 999 1000 /** 1001 * @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 1002 */ 1003 public TimingRepeatComponent setPeriodMaxElement(DecimalType value) { 1004 this.periodMax = value; 1005 return this; 1006 } 1007 1008 /** 1009 * @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. 1010 */ 1011 public BigDecimal getPeriodMax() { 1012 return this.periodMax == null ? null : this.periodMax.getValue(); 1013 } 1014 1015 /** 1016 * @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. 1017 */ 1018 public TimingRepeatComponent setPeriodMax(BigDecimal value) { 1019 if (value == null) 1020 this.periodMax = null; 1021 else { 1022 if (this.periodMax == null) 1023 this.periodMax = new DecimalType(); 1024 this.periodMax.setValue(value); 1025 } 1026 return this; 1027 } 1028 1029 /** 1030 * @return {@link #periodUnits} (The units of time for the period in UCUM units.). This is the underlying object with id, value and extensions. The accessor "getPeriodUnits" gives direct access to the value 1031 */ 1032 public Enumeration<UnitsOfTime> getPeriodUnitsElement() { 1033 if (this.periodUnits == null) 1034 if (Configuration.errorOnAutoCreate()) 1035 throw new Error("Attempt to auto-create TimingRepeatComponent.periodUnits"); 1036 else if (Configuration.doAutoCreate()) 1037 this.periodUnits = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory()); // bb 1038 return this.periodUnits; 1039 } 1040 1041 public boolean hasPeriodUnitsElement() { 1042 return this.periodUnits != null && !this.periodUnits.isEmpty(); 1043 } 1044 1045 public boolean hasPeriodUnits() { 1046 return this.periodUnits != null && !this.periodUnits.isEmpty(); 1047 } 1048 1049 /** 1050 * @param value {@link #periodUnits} (The units of time for the period in UCUM units.). This is the underlying object with id, value and extensions. The accessor "getPeriodUnits" gives direct access to the value 1051 */ 1052 public TimingRepeatComponent setPeriodUnitsElement(Enumeration<UnitsOfTime> value) { 1053 this.periodUnits = value; 1054 return this; 1055 } 1056 1057 /** 1058 * @return The units of time for the period in UCUM units. 1059 */ 1060 public UnitsOfTime getPeriodUnits() { 1061 return this.periodUnits == null ? null : this.periodUnits.getValue(); 1062 } 1063 1064 /** 1065 * @param value The units of time for the period in UCUM units. 1066 */ 1067 public TimingRepeatComponent setPeriodUnits(UnitsOfTime value) { 1068 if (value == null) 1069 this.periodUnits = null; 1070 else { 1071 if (this.periodUnits == null) 1072 this.periodUnits = new Enumeration<UnitsOfTime>(new UnitsOfTimeEnumFactory()); 1073 this.periodUnits.setValue(value); 1074 } 1075 return this; 1076 } 1077 1078 /** 1079 * @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 1080 */ 1081 public Enumeration<EventTiming> getWhenElement() { 1082 if (this.when == null) 1083 if (Configuration.errorOnAutoCreate()) 1084 throw new Error("Attempt to auto-create TimingRepeatComponent.when"); 1085 else if (Configuration.doAutoCreate()) 1086 this.when = new Enumeration<EventTiming>(new EventTimingEnumFactory()); // bb 1087 return this.when; 1088 } 1089 1090 public boolean hasWhenElement() { 1091 return this.when != null && !this.when.isEmpty(); 1092 } 1093 1094 public boolean hasWhen() { 1095 return this.when != null && !this.when.isEmpty(); 1096 } 1097 1098 /** 1099 * @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 1100 */ 1101 public TimingRepeatComponent setWhenElement(Enumeration<EventTiming> value) { 1102 this.when = value; 1103 return this; 1104 } 1105 1106 /** 1107 * @return A real world event that the occurrence of the event should be tied to. 1108 */ 1109 public EventTiming getWhen() { 1110 return this.when == null ? null : this.when.getValue(); 1111 } 1112 1113 /** 1114 * @param value A real world event that the occurrence of the event should be tied to. 1115 */ 1116 public TimingRepeatComponent setWhen(EventTiming value) { 1117 if (value == null) 1118 this.when = null; 1119 else { 1120 if (this.when == null) 1121 this.when = new Enumeration<EventTiming>(new EventTimingEnumFactory()); 1122 this.when.setValue(value); 1123 } 1124 return this; 1125 } 1126 1127 protected void listChildren(List<Property> childrenList) { 1128 super.listChildren(childrenList); 1129 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)); 1130 childrenList.add(new Property("count", "integer", "A total count of the desired number of repetitions.", 0, java.lang.Integer.MAX_VALUE, count)); 1131 childrenList.add(new Property("duration", "decimal", "How long this thing happens for when it happens.", 0, java.lang.Integer.MAX_VALUE, duration)); 1132 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)); 1133 childrenList.add(new Property("durationUnits", "code", "The units of time for the duration, in UCUM units.", 0, java.lang.Integer.MAX_VALUE, durationUnits)); 1134 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)); 1135 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)); 1136 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)); 1137 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)); 1138 childrenList.add(new Property("periodUnits", "code", "The units of time for the period in UCUM units.", 0, java.lang.Integer.MAX_VALUE, periodUnits)); 1139 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)); 1140 } 1141 1142 @Override 1143 public void setProperty(String name, Base value) throws FHIRException { 1144 if (name.equals("bounds[x]")) 1145 this.bounds = (Type) value; // Type 1146 else if (name.equals("count")) 1147 this.count = castToInteger(value); // IntegerType 1148 else if (name.equals("duration")) 1149 this.duration = castToDecimal(value); // DecimalType 1150 else if (name.equals("durationMax")) 1151 this.durationMax = castToDecimal(value); // DecimalType 1152 else if (name.equals("durationUnits")) 1153 this.durationUnits = new UnitsOfTimeEnumFactory().fromType(value); // Enumeration<UnitsOfTime> 1154 else if (name.equals("frequency")) 1155 this.frequency = castToInteger(value); // IntegerType 1156 else if (name.equals("frequencyMax")) 1157 this.frequencyMax = castToInteger(value); // IntegerType 1158 else if (name.equals("period")) 1159 this.period = castToDecimal(value); // DecimalType 1160 else if (name.equals("periodMax")) 1161 this.periodMax = castToDecimal(value); // DecimalType 1162 else if (name.equals("periodUnits")) 1163 this.periodUnits = new UnitsOfTimeEnumFactory().fromType(value); // Enumeration<UnitsOfTime> 1164 else if (name.equals("when")) 1165 this.when = new EventTimingEnumFactory().fromType(value); // Enumeration<EventTiming> 1166 else 1167 super.setProperty(name, value); 1168 } 1169 1170 @Override 1171 public Base addChild(String name) throws FHIRException { 1172 if (name.equals("boundsDuration")) { 1173 this.bounds = new Duration(); 1174 return this.bounds; 1175 } 1176 else if (name.equals("boundsRange")) { 1177 this.bounds = new Range(); 1178 return this.bounds; 1179 } 1180 else if (name.equals("boundsPeriod")) { 1181 this.bounds = new Period(); 1182 return this.bounds; 1183 } 1184 else if (name.equals("count")) { 1185 throw new FHIRException("Cannot call addChild on a primitive type Timing.count"); 1186 } 1187 else if (name.equals("duration")) { 1188 throw new FHIRException("Cannot call addChild on a primitive type Timing.duration"); 1189 } 1190 else if (name.equals("durationMax")) { 1191 throw new FHIRException("Cannot call addChild on a primitive type Timing.durationMax"); 1192 } 1193 else if (name.equals("durationUnits")) { 1194 throw new FHIRException("Cannot call addChild on a primitive type Timing.durationUnits"); 1195 } 1196 else if (name.equals("frequency")) { 1197 throw new FHIRException("Cannot call addChild on a primitive type Timing.frequency"); 1198 } 1199 else if (name.equals("frequencyMax")) { 1200 throw new FHIRException("Cannot call addChild on a primitive type Timing.frequencyMax"); 1201 } 1202 else if (name.equals("period")) { 1203 throw new FHIRException("Cannot call addChild on a primitive type Timing.period"); 1204 } 1205 else if (name.equals("periodMax")) { 1206 throw new FHIRException("Cannot call addChild on a primitive type Timing.periodMax"); 1207 } 1208 else if (name.equals("periodUnits")) { 1209 throw new FHIRException("Cannot call addChild on a primitive type Timing.periodUnits"); 1210 } 1211 else if (name.equals("when")) { 1212 throw new FHIRException("Cannot call addChild on a primitive type Timing.when"); 1213 } 1214 else 1215 return super.addChild(name); 1216 } 1217 1218 public TimingRepeatComponent copy() { 1219 TimingRepeatComponent dst = new TimingRepeatComponent(); 1220 copyValues(dst); 1221 dst.bounds = bounds == null ? null : bounds.copy(); 1222 dst.count = count == null ? null : count.copy(); 1223 dst.duration = duration == null ? null : duration.copy(); 1224 dst.durationMax = durationMax == null ? null : durationMax.copy(); 1225 dst.durationUnits = durationUnits == null ? null : durationUnits.copy(); 1226 dst.frequency = frequency == null ? null : frequency.copy(); 1227 dst.frequencyMax = frequencyMax == null ? null : frequencyMax.copy(); 1228 dst.period = period == null ? null : period.copy(); 1229 dst.periodMax = periodMax == null ? null : periodMax.copy(); 1230 dst.periodUnits = periodUnits == null ? null : periodUnits.copy(); 1231 dst.when = when == null ? null : when.copy(); 1232 return dst; 1233 } 1234 1235 @Override 1236 public boolean equalsDeep(Base other) { 1237 if (!super.equalsDeep(other)) 1238 return false; 1239 if (!(other instanceof TimingRepeatComponent)) 1240 return false; 1241 TimingRepeatComponent o = (TimingRepeatComponent) other; 1242 return compareDeep(bounds, o.bounds, true) && compareDeep(count, o.count, true) && compareDeep(duration, o.duration, true) 1243 && compareDeep(durationMax, o.durationMax, true) && compareDeep(durationUnits, o.durationUnits, true) 1244 && compareDeep(frequency, o.frequency, true) && compareDeep(frequencyMax, o.frequencyMax, true) 1245 && compareDeep(period, o.period, true) && compareDeep(periodMax, o.periodMax, true) && compareDeep(periodUnits, o.periodUnits, true) 1246 && compareDeep(when, o.when, true); 1247 } 1248 1249 @Override 1250 public boolean equalsShallow(Base other) { 1251 if (!super.equalsShallow(other)) 1252 return false; 1253 if (!(other instanceof TimingRepeatComponent)) 1254 return false; 1255 TimingRepeatComponent o = (TimingRepeatComponent) other; 1256 return compareValues(count, o.count, true) && compareValues(duration, o.duration, true) && compareValues(durationMax, o.durationMax, true) 1257 && compareValues(durationUnits, o.durationUnits, true) && compareValues(frequency, o.frequency, true) 1258 && compareValues(frequencyMax, o.frequencyMax, true) && compareValues(period, o.period, true) && compareValues(periodMax, o.periodMax, true) 1259 && compareValues(periodUnits, o.periodUnits, true) && compareValues(when, o.when, true); 1260 } 1261 1262 public boolean isEmpty() { 1263 return super.isEmpty() && (bounds == null || bounds.isEmpty()) && (count == null || count.isEmpty()) 1264 && (duration == null || duration.isEmpty()) && (durationMax == null || durationMax.isEmpty()) 1265 && (durationUnits == null || durationUnits.isEmpty()) && (frequency == null || frequency.isEmpty()) 1266 && (frequencyMax == null || frequencyMax.isEmpty()) && (period == null || period.isEmpty()) 1267 && (periodMax == null || periodMax.isEmpty()) && (periodUnits == null || periodUnits.isEmpty()) 1268 && (when == null || when.isEmpty()); 1269 } 1270 1271 public String fhirType() { 1272 return "Timing.repeat"; 1273 1274 } 1275 1276 } 1277 1278 /** 1279 * Identifies specific times when the event occurs. 1280 */ 1281 @Child(name = "event", type = {DateTimeType.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1282 @Description(shortDefinition="When the event occurs", formalDefinition="Identifies specific times when the event occurs." ) 1283 protected List<DateTimeType> event; 1284 1285 /** 1286 * A set of rules that describe when the event should occur. 1287 */ 1288 @Child(name = "repeat", type = {}, order=1, min=0, max=1, modifier=false, summary=true) 1289 @Description(shortDefinition="When the event is to occur", formalDefinition="A set of rules that describe when the event should occur." ) 1290 protected TimingRepeatComponent repeat; 1291 1292 /** 1293 * A code for the timing pattern. Some codes such as BID are ubiquitous, but many institutions define their own additional codes. 1294 */ 1295 @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 1296 @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." ) 1297 protected CodeableConcept code; 1298 1299 private static final long serialVersionUID = 791565112L; 1300 1301 /* 1302 * Constructor 1303 */ 1304 public Timing() { 1305 super(); 1306 } 1307 1308 /** 1309 * @return {@link #event} (Identifies specific times when the event occurs.) 1310 */ 1311 public List<DateTimeType> getEvent() { 1312 if (this.event == null) 1313 this.event = new ArrayList<DateTimeType>(); 1314 return this.event; 1315 } 1316 1317 public boolean hasEvent() { 1318 if (this.event == null) 1319 return false; 1320 for (DateTimeType item : this.event) 1321 if (!item.isEmpty()) 1322 return true; 1323 return false; 1324 } 1325 1326 /** 1327 * @return {@link #event} (Identifies specific times when the event occurs.) 1328 */ 1329 // syntactic sugar 1330 public DateTimeType addEventElement() {//2 1331 DateTimeType t = new DateTimeType(); 1332 if (this.event == null) 1333 this.event = new ArrayList<DateTimeType>(); 1334 this.event.add(t); 1335 return t; 1336 } 1337 1338 /** 1339 * @param value {@link #event} (Identifies specific times when the event occurs.) 1340 */ 1341 public Timing addEvent(Date value) { //1 1342 DateTimeType t = new DateTimeType(); 1343 t.setValue(value); 1344 if (this.event == null) 1345 this.event = new ArrayList<DateTimeType>(); 1346 this.event.add(t); 1347 return this; 1348 } 1349 1350 /** 1351 * @param value {@link #event} (Identifies specific times when the event occurs.) 1352 */ 1353 public boolean hasEvent(Date value) { 1354 if (this.event == null) 1355 return false; 1356 for (DateTimeType v : this.event) 1357 if (v.equals(value)) // dateTime 1358 return true; 1359 return false; 1360 } 1361 1362 /** 1363 * @return {@link #repeat} (A set of rules that describe when the event should occur.) 1364 */ 1365 public TimingRepeatComponent getRepeat() { 1366 if (this.repeat == null) 1367 if (Configuration.errorOnAutoCreate()) 1368 throw new Error("Attempt to auto-create Timing.repeat"); 1369 else if (Configuration.doAutoCreate()) 1370 this.repeat = new TimingRepeatComponent(); // cc 1371 return this.repeat; 1372 } 1373 1374 public boolean hasRepeat() { 1375 return this.repeat != null && !this.repeat.isEmpty(); 1376 } 1377 1378 /** 1379 * @param value {@link #repeat} (A set of rules that describe when the event should occur.) 1380 */ 1381 public Timing setRepeat(TimingRepeatComponent value) { 1382 this.repeat = value; 1383 return this; 1384 } 1385 1386 /** 1387 * @return {@link #code} (A code for the timing pattern. Some codes such as BID are ubiquitous, but many institutions define their own additional codes.) 1388 */ 1389 public CodeableConcept getCode() { 1390 if (this.code == null) 1391 if (Configuration.errorOnAutoCreate()) 1392 throw new Error("Attempt to auto-create Timing.code"); 1393 else if (Configuration.doAutoCreate()) 1394 this.code = new CodeableConcept(); // cc 1395 return this.code; 1396 } 1397 1398 public boolean hasCode() { 1399 return this.code != null && !this.code.isEmpty(); 1400 } 1401 1402 /** 1403 * @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.) 1404 */ 1405 public Timing setCode(CodeableConcept value) { 1406 this.code = value; 1407 return this; 1408 } 1409 1410 protected void listChildren(List<Property> childrenList) { 1411 super.listChildren(childrenList); 1412 childrenList.add(new Property("event", "dateTime", "Identifies specific times when the event occurs.", 0, java.lang.Integer.MAX_VALUE, event)); 1413 childrenList.add(new Property("repeat", "", "A set of rules that describe when the event should occur.", 0, java.lang.Integer.MAX_VALUE, repeat)); 1414 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.", 0, java.lang.Integer.MAX_VALUE, code)); 1415 } 1416 1417 @Override 1418 public void setProperty(String name, Base value) throws FHIRException { 1419 if (name.equals("event")) 1420 this.getEvent().add(castToDateTime(value)); 1421 else if (name.equals("repeat")) 1422 this.repeat = (TimingRepeatComponent) value; // TimingRepeatComponent 1423 else if (name.equals("code")) 1424 this.code = castToCodeableConcept(value); // CodeableConcept 1425 else 1426 super.setProperty(name, value); 1427 } 1428 1429 @Override 1430 public Base addChild(String name) throws FHIRException { 1431 if (name.equals("event")) { 1432 throw new FHIRException("Cannot call addChild on a primitive type Timing.event"); 1433 } 1434 else if (name.equals("repeat")) { 1435 this.repeat = new TimingRepeatComponent(); 1436 return this.repeat; 1437 } 1438 else if (name.equals("code")) { 1439 this.code = new CodeableConcept(); 1440 return this.code; 1441 } 1442 else 1443 return super.addChild(name); 1444 } 1445 1446 public String fhirType() { 1447 return "Timing"; 1448 1449 } 1450 1451 public Timing copy() { 1452 Timing dst = new Timing(); 1453 copyValues(dst); 1454 if (event != null) { 1455 dst.event = new ArrayList<DateTimeType>(); 1456 for (DateTimeType i : event) 1457 dst.event.add(i.copy()); 1458 }; 1459 dst.repeat = repeat == null ? null : repeat.copy(); 1460 dst.code = code == null ? null : code.copy(); 1461 return dst; 1462 } 1463 1464 protected Timing typedCopy() { 1465 return copy(); 1466 } 1467 1468 @Override 1469 public boolean equalsDeep(Base other) { 1470 if (!super.equalsDeep(other)) 1471 return false; 1472 if (!(other instanceof Timing)) 1473 return false; 1474 Timing o = (Timing) other; 1475 return compareDeep(event, o.event, true) && compareDeep(repeat, o.repeat, true) && compareDeep(code, o.code, true) 1476 ; 1477 } 1478 1479 @Override 1480 public boolean equalsShallow(Base other) { 1481 if (!super.equalsShallow(other)) 1482 return false; 1483 if (!(other instanceof Timing)) 1484 return false; 1485 Timing o = (Timing) other; 1486 return compareValues(event, o.event, true); 1487 } 1488 1489 public boolean isEmpty() { 1490 return super.isEmpty() && (event == null || event.isEmpty()) && (repeat == null || repeat.isEmpty()) 1491 && (code == null || code.isEmpty()); 1492 } 1493 1494 1495}