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