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