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