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