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