001package org.hl7.fhir.r5.model; 002 003/*- 004 * #%L 005 * org.hl7.fhir.r5 006 * %% 007 * Copyright (C) 2014 - 2019 Health Level 7 008 * %% 009 * Licensed under the Apache License, Version 2.0 (the "License"); 010 * you may not use this file except in compliance with the License. 011 * You may obtain a copy of the License at 012 * 013 * http://www.apache.org/licenses/LICENSE-2.0 014 * 015 * Unless required by applicable law or agreed to in writing, software 016 * distributed under the License is distributed on an "AS IS" BASIS, 017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 018 * See the License for the specific language governing permissions and 019 * limitations under the License. 020 * #L% 021 */ 022 023/* 024 Copyright (c) 2011+, HL7, Inc. 025 All rights reserved. 026 027 Redistribution and use in source and binary forms, with or without modification, 028 are permitted provided that the following conditions are met: 029 030 * Redistributions of source code must retain the above copyright notice, this 031 list of conditions and the following disclaimer. 032 * Redistributions in binary form must reproduce the above copyright notice, 033 this list of conditions and the following disclaimer in the documentation 034 and/or other materials provided with the distribution. 035 * Neither the name of HL7 nor the names of its contributors may be used to 036 endorse or promote products derived from this software without specific 037 prior written permission. 038 039 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 040 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 041 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 042 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 043 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 044 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 045 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 046 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 047 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 048 POSSIBILITY OF SUCH DAMAGE. 049 050*/ 051 052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0 053import java.util.ArrayList; 054import java.util.Date; 055import java.util.List; 056import org.hl7.fhir.exceptions.FHIRException; 057import org.hl7.fhir.instance.model.api.ICompositeType; 058 059import org.hl7.fhir.instance.model.api.IBaseDatatypeElement; 060import org.hl7.fhir.utilities.Utilities; 061import ca.uhn.fhir.model.api.annotation.Child; 062import ca.uhn.fhir.model.api.annotation.ChildOrder; 063import ca.uhn.fhir.model.api.annotation.DatatypeDef; 064import ca.uhn.fhir.model.api.annotation.Description; 065import ca.uhn.fhir.model.api.annotation.Block; 066/** 067 * An ordered list (distribution) of statistics. 068 */ 069@DatatypeDef(name="OrderedDistribution") 070public class OrderedDistribution extends BackboneType implements ICompositeType { 071 072 @Block() 073 public static class OrderedDistributionIntervalComponent extends Element implements IBaseDatatypeElement { 074 /** 075 * Relative order of interval. 076 */ 077 @Child(name = "rankOrder", type = {IntegerType.class}, order=1, min=1, max=1, modifier=false, summary=true) 078 @Description(shortDefinition="Relative order of interval", formalDefinition="Relative order of interval." ) 079 protected IntegerType rankOrder; 080 081 /** 082 * Values and parameters for a single statistic related to the interval. 083 */ 084 @Child(name = "intervalStatistic", type = {Statistic.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 085 @Description(shortDefinition="Values and parameters for a single statistic related to the interval", formalDefinition="Values and parameters for a single statistic related to the interval." ) 086 protected List<Statistic> intervalStatistic; 087 088 private static final long serialVersionUID = 1714817635L; 089 090 /** 091 * Constructor 092 */ 093 public OrderedDistributionIntervalComponent() { 094 super(); 095 } 096 097 /** 098 * Constructor 099 */ 100 public OrderedDistributionIntervalComponent(IntegerType rankOrder) { 101 super(); 102 this.rankOrder = rankOrder; 103 } 104 105 /** 106 * @return {@link #rankOrder} (Relative order of interval.). This is the underlying object with id, value and extensions. The accessor "getRankOrder" gives direct access to the value 107 */ 108 public IntegerType getRankOrderElement() { 109 if (this.rankOrder == null) 110 if (Configuration.errorOnAutoCreate()) 111 throw new Error("Attempt to auto-create OrderedDistributionIntervalComponent.rankOrder"); 112 else if (Configuration.doAutoCreate()) 113 this.rankOrder = new IntegerType(); // bb 114 return this.rankOrder; 115 } 116 117 public boolean hasRankOrderElement() { 118 return this.rankOrder != null && !this.rankOrder.isEmpty(); 119 } 120 121 public boolean hasRankOrder() { 122 return this.rankOrder != null && !this.rankOrder.isEmpty(); 123 } 124 125 /** 126 * @param value {@link #rankOrder} (Relative order of interval.). This is the underlying object with id, value and extensions. The accessor "getRankOrder" gives direct access to the value 127 */ 128 public OrderedDistributionIntervalComponent setRankOrderElement(IntegerType value) { 129 this.rankOrder = value; 130 return this; 131 } 132 133 /** 134 * @return Relative order of interval. 135 */ 136 public int getRankOrder() { 137 return this.rankOrder == null || this.rankOrder.isEmpty() ? 0 : this.rankOrder.getValue(); 138 } 139 140 /** 141 * @param value Relative order of interval. 142 */ 143 public OrderedDistributionIntervalComponent setRankOrder(int value) { 144 if (this.rankOrder == null) 145 this.rankOrder = new IntegerType(); 146 this.rankOrder.setValue(value); 147 return this; 148 } 149 150 /** 151 * @return {@link #intervalStatistic} (Values and parameters for a single statistic related to the interval.) 152 */ 153 public List<Statistic> getIntervalStatistic() { 154 if (this.intervalStatistic == null) 155 this.intervalStatistic = new ArrayList<Statistic>(); 156 return this.intervalStatistic; 157 } 158 159 /** 160 * @return Returns a reference to <code>this</code> for easy method chaining 161 */ 162 public OrderedDistributionIntervalComponent setIntervalStatistic(List<Statistic> theIntervalStatistic) { 163 this.intervalStatistic = theIntervalStatistic; 164 return this; 165 } 166 167 public boolean hasIntervalStatistic() { 168 if (this.intervalStatistic == null) 169 return false; 170 for (Statistic item : this.intervalStatistic) 171 if (!item.isEmpty()) 172 return true; 173 return false; 174 } 175 176 public Statistic addIntervalStatistic() { //3 177 Statistic t = new Statistic(); 178 if (this.intervalStatistic == null) 179 this.intervalStatistic = new ArrayList<Statistic>(); 180 this.intervalStatistic.add(t); 181 return t; 182 } 183 184 public OrderedDistributionIntervalComponent addIntervalStatistic(Statistic t) { //3 185 if (t == null) 186 return this; 187 if (this.intervalStatistic == null) 188 this.intervalStatistic = new ArrayList<Statistic>(); 189 this.intervalStatistic.add(t); 190 return this; 191 } 192 193 /** 194 * @return The first repetition of repeating field {@link #intervalStatistic}, creating it if it does not already exist 195 */ 196 public Statistic getIntervalStatisticFirstRep() { 197 if (getIntervalStatistic().isEmpty()) { 198 addIntervalStatistic(); 199 } 200 return getIntervalStatistic().get(0); 201 } 202 203 protected void listChildren(List<Property> children) { 204 super.listChildren(children); 205 children.add(new Property("rankOrder", "integer", "Relative order of interval.", 0, 1, rankOrder)); 206 children.add(new Property("intervalStatistic", "Statistic", "Values and parameters for a single statistic related to the interval.", 0, java.lang.Integer.MAX_VALUE, intervalStatistic)); 207 } 208 209 @Override 210 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 211 switch (_hash) { 212 case -656537982: /*rankOrder*/ return new Property("rankOrder", "integer", "Relative order of interval.", 0, 1, rankOrder); 213 case 227099147: /*intervalStatistic*/ return new Property("intervalStatistic", "Statistic", "Values and parameters for a single statistic related to the interval.", 0, java.lang.Integer.MAX_VALUE, intervalStatistic); 214 default: return super.getNamedProperty(_hash, _name, _checkValid); 215 } 216 217 } 218 219 @Override 220 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 221 switch (hash) { 222 case -656537982: /*rankOrder*/ return this.rankOrder == null ? new Base[0] : new Base[] {this.rankOrder}; // IntegerType 223 case 227099147: /*intervalStatistic*/ return this.intervalStatistic == null ? new Base[0] : this.intervalStatistic.toArray(new Base[this.intervalStatistic.size()]); // Statistic 224 default: return super.getProperty(hash, name, checkValid); 225 } 226 227 } 228 229 @Override 230 public Base setProperty(int hash, String name, Base value) throws FHIRException { 231 switch (hash) { 232 case -656537982: // rankOrder 233 this.rankOrder = castToInteger(value); // IntegerType 234 return value; 235 case 227099147: // intervalStatistic 236 this.getIntervalStatistic().add(castToStatistic(value)); // Statistic 237 return value; 238 default: return super.setProperty(hash, name, value); 239 } 240 241 } 242 243 @Override 244 public Base setProperty(String name, Base value) throws FHIRException { 245 if (name.equals("rankOrder")) { 246 this.rankOrder = castToInteger(value); // IntegerType 247 } else if (name.equals("intervalStatistic")) { 248 this.getIntervalStatistic().add(castToStatistic(value)); 249 } else 250 return super.setProperty(name, value); 251 return value; 252 } 253 254 @Override 255 public Base makeProperty(int hash, String name) throws FHIRException { 256 switch (hash) { 257 case -656537982: return getRankOrderElement(); 258 case 227099147: return addIntervalStatistic(); 259 default: return super.makeProperty(hash, name); 260 } 261 262 } 263 264 @Override 265 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 266 switch (hash) { 267 case -656537982: /*rankOrder*/ return new String[] {"integer"}; 268 case 227099147: /*intervalStatistic*/ return new String[] {"Statistic"}; 269 default: return super.getTypesForProperty(hash, name); 270 } 271 272 } 273 274 @Override 275 public Base addChild(String name) throws FHIRException { 276 if (name.equals("rankOrder")) { 277 throw new FHIRException("Cannot call addChild on a primitive type OrderedDistribution.rankOrder"); 278 } 279 else if (name.equals("intervalStatistic")) { 280 return addIntervalStatistic(); 281 } 282 else 283 return super.addChild(name); 284 } 285 286 public OrderedDistributionIntervalComponent copy() { 287 OrderedDistributionIntervalComponent dst = new OrderedDistributionIntervalComponent(); 288 copyValues(dst); 289 return dst; 290 } 291 292 public void copyValues(OrderedDistributionIntervalComponent dst) { 293 super.copyValues(dst); 294 dst.rankOrder = rankOrder == null ? null : rankOrder.copy(); 295 if (intervalStatistic != null) { 296 dst.intervalStatistic = new ArrayList<Statistic>(); 297 for (Statistic i : intervalStatistic) 298 dst.intervalStatistic.add(i.copy()); 299 }; 300 } 301 302 @Override 303 public boolean equalsDeep(Base other_) { 304 if (!super.equalsDeep(other_)) 305 return false; 306 if (!(other_ instanceof OrderedDistributionIntervalComponent)) 307 return false; 308 OrderedDistributionIntervalComponent o = (OrderedDistributionIntervalComponent) other_; 309 return compareDeep(rankOrder, o.rankOrder, true) && compareDeep(intervalStatistic, o.intervalStatistic, true) 310 ; 311 } 312 313 @Override 314 public boolean equalsShallow(Base other_) { 315 if (!super.equalsShallow(other_)) 316 return false; 317 if (!(other_ instanceof OrderedDistributionIntervalComponent)) 318 return false; 319 OrderedDistributionIntervalComponent o = (OrderedDistributionIntervalComponent) other_; 320 return compareValues(rankOrder, o.rankOrder, true); 321 } 322 323 public boolean isEmpty() { 324 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(rankOrder, intervalStatistic 325 ); 326 } 327 328 public String fhirType() { 329 return "OrderedDistribution.interval"; 330 331 } 332 333 } 334 335 /** 336 * A description of the content and value of the statistic. 337 */ 338 @Child(name = "description", type = {StringType.class}, order=0, min=0, max=1, modifier=false, summary=false) 339 @Description(shortDefinition="A description of the content and value of the statistic", formalDefinition="A description of the content and value of the statistic." ) 340 protected StringType description; 341 342 /** 343 * Footnotes and/or explanatory notes. 344 */ 345 @Child(name = "note", type = {Annotation.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) 346 @Description(shortDefinition="Footnotes and/or explanatory notes", formalDefinition="Footnotes and/or explanatory notes." ) 347 protected List<Annotation> note; 348 349 /** 350 * Number of intervals in an array, eg 4 for quartiles. 351 */ 352 @Child(name = "numberOfIntervals", type = {IntegerType.class}, order=2, min=1, max=1, modifier=false, summary=true) 353 @Description(shortDefinition="Number of intervals in an array, eg 4 for quartiles", formalDefinition="Number of intervals in an array, eg 4 for quartiles." ) 354 protected IntegerType numberOfIntervals; 355 356 /** 357 * Bottom of first interval. 358 */ 359 @Child(name = "bottomOfFirstInterval", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=false) 360 @Description(shortDefinition="Bottom of first interval", formalDefinition="Bottom of first interval." ) 361 protected Quantity bottomOfFirstInterval; 362 363 /** 364 * Interval. 365 */ 366 @Child(name = "interval", type = {}, order=4, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 367 @Description(shortDefinition="Interval", formalDefinition="Interval." ) 368 protected List<OrderedDistributionIntervalComponent> interval; 369 370 /** 371 * Singular value of the statistic at the upper bound of the interval. 372 */ 373 @Child(name = "topOfInterval", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=false) 374 @Description(shortDefinition="Singular value of the statistic at the upper bound of the interval", formalDefinition="Singular value of the statistic at the upper bound of the interval." ) 375 protected Quantity topOfInterval; 376 377 private static final long serialVersionUID = -1559333328L; 378 379 /** 380 * Constructor 381 */ 382 public OrderedDistribution() { 383 super(); 384 } 385 386 /** 387 * Constructor 388 */ 389 public OrderedDistribution(IntegerType numberOfIntervals) { 390 super(); 391 this.numberOfIntervals = numberOfIntervals; 392 } 393 394 /** 395 * @return {@link #description} (A description of the content and value of the statistic.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 396 */ 397 public StringType getDescriptionElement() { 398 if (this.description == null) 399 if (Configuration.errorOnAutoCreate()) 400 throw new Error("Attempt to auto-create OrderedDistribution.description"); 401 else if (Configuration.doAutoCreate()) 402 this.description = new StringType(); // bb 403 return this.description; 404 } 405 406 public boolean hasDescriptionElement() { 407 return this.description != null && !this.description.isEmpty(); 408 } 409 410 public boolean hasDescription() { 411 return this.description != null && !this.description.isEmpty(); 412 } 413 414 /** 415 * @param value {@link #description} (A description of the content and value of the statistic.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value 416 */ 417 public OrderedDistribution setDescriptionElement(StringType value) { 418 this.description = value; 419 return this; 420 } 421 422 /** 423 * @return A description of the content and value of the statistic. 424 */ 425 public String getDescription() { 426 return this.description == null ? null : this.description.getValue(); 427 } 428 429 /** 430 * @param value A description of the content and value of the statistic. 431 */ 432 public OrderedDistribution setDescription(String value) { 433 if (Utilities.noString(value)) 434 this.description = null; 435 else { 436 if (this.description == null) 437 this.description = new StringType(); 438 this.description.setValue(value); 439 } 440 return this; 441 } 442 443 /** 444 * @return {@link #note} (Footnotes and/or explanatory notes.) 445 */ 446 public List<Annotation> getNote() { 447 if (this.note == null) 448 this.note = new ArrayList<Annotation>(); 449 return this.note; 450 } 451 452 /** 453 * @return Returns a reference to <code>this</code> for easy method chaining 454 */ 455 public OrderedDistribution setNote(List<Annotation> theNote) { 456 this.note = theNote; 457 return this; 458 } 459 460 public boolean hasNote() { 461 if (this.note == null) 462 return false; 463 for (Annotation item : this.note) 464 if (!item.isEmpty()) 465 return true; 466 return false; 467 } 468 469 public Annotation addNote() { //3 470 Annotation t = new Annotation(); 471 if (this.note == null) 472 this.note = new ArrayList<Annotation>(); 473 this.note.add(t); 474 return t; 475 } 476 477 public OrderedDistribution addNote(Annotation t) { //3 478 if (t == null) 479 return this; 480 if (this.note == null) 481 this.note = new ArrayList<Annotation>(); 482 this.note.add(t); 483 return this; 484 } 485 486 /** 487 * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist 488 */ 489 public Annotation getNoteFirstRep() { 490 if (getNote().isEmpty()) { 491 addNote(); 492 } 493 return getNote().get(0); 494 } 495 496 /** 497 * @return {@link #numberOfIntervals} (Number of intervals in an array, eg 4 for quartiles.). This is the underlying object with id, value and extensions. The accessor "getNumberOfIntervals" gives direct access to the value 498 */ 499 public IntegerType getNumberOfIntervalsElement() { 500 if (this.numberOfIntervals == null) 501 if (Configuration.errorOnAutoCreate()) 502 throw new Error("Attempt to auto-create OrderedDistribution.numberOfIntervals"); 503 else if (Configuration.doAutoCreate()) 504 this.numberOfIntervals = new IntegerType(); // bb 505 return this.numberOfIntervals; 506 } 507 508 public boolean hasNumberOfIntervalsElement() { 509 return this.numberOfIntervals != null && !this.numberOfIntervals.isEmpty(); 510 } 511 512 public boolean hasNumberOfIntervals() { 513 return this.numberOfIntervals != null && !this.numberOfIntervals.isEmpty(); 514 } 515 516 /** 517 * @param value {@link #numberOfIntervals} (Number of intervals in an array, eg 4 for quartiles.). This is the underlying object with id, value and extensions. The accessor "getNumberOfIntervals" gives direct access to the value 518 */ 519 public OrderedDistribution setNumberOfIntervalsElement(IntegerType value) { 520 this.numberOfIntervals = value; 521 return this; 522 } 523 524 /** 525 * @return Number of intervals in an array, eg 4 for quartiles. 526 */ 527 public int getNumberOfIntervals() { 528 return this.numberOfIntervals == null || this.numberOfIntervals.isEmpty() ? 0 : this.numberOfIntervals.getValue(); 529 } 530 531 /** 532 * @param value Number of intervals in an array, eg 4 for quartiles. 533 */ 534 public OrderedDistribution setNumberOfIntervals(int value) { 535 if (this.numberOfIntervals == null) 536 this.numberOfIntervals = new IntegerType(); 537 this.numberOfIntervals.setValue(value); 538 return this; 539 } 540 541 /** 542 * @return {@link #bottomOfFirstInterval} (Bottom of first interval.) 543 */ 544 public Quantity getBottomOfFirstInterval() { 545 if (this.bottomOfFirstInterval == null) 546 if (Configuration.errorOnAutoCreate()) 547 throw new Error("Attempt to auto-create OrderedDistribution.bottomOfFirstInterval"); 548 else if (Configuration.doAutoCreate()) 549 this.bottomOfFirstInterval = new Quantity(); // cc 550 return this.bottomOfFirstInterval; 551 } 552 553 public boolean hasBottomOfFirstInterval() { 554 return this.bottomOfFirstInterval != null && !this.bottomOfFirstInterval.isEmpty(); 555 } 556 557 /** 558 * @param value {@link #bottomOfFirstInterval} (Bottom of first interval.) 559 */ 560 public OrderedDistribution setBottomOfFirstInterval(Quantity value) { 561 this.bottomOfFirstInterval = value; 562 return this; 563 } 564 565 /** 566 * @return {@link #interval} (Interval.) 567 */ 568 public List<OrderedDistributionIntervalComponent> getInterval() { 569 if (this.interval == null) 570 this.interval = new ArrayList<OrderedDistributionIntervalComponent>(); 571 return this.interval; 572 } 573 574 /** 575 * @return Returns a reference to <code>this</code> for easy method chaining 576 */ 577 public OrderedDistribution setInterval(List<OrderedDistributionIntervalComponent> theInterval) { 578 this.interval = theInterval; 579 return this; 580 } 581 582 public boolean hasInterval() { 583 if (this.interval == null) 584 return false; 585 for (OrderedDistributionIntervalComponent item : this.interval) 586 if (!item.isEmpty()) 587 return true; 588 return false; 589 } 590 591 public OrderedDistributionIntervalComponent addInterval() { //3 592 OrderedDistributionIntervalComponent t = new OrderedDistributionIntervalComponent(); 593 if (this.interval == null) 594 this.interval = new ArrayList<OrderedDistributionIntervalComponent>(); 595 this.interval.add(t); 596 return t; 597 } 598 599 public OrderedDistribution addInterval(OrderedDistributionIntervalComponent t) { //3 600 if (t == null) 601 return this; 602 if (this.interval == null) 603 this.interval = new ArrayList<OrderedDistributionIntervalComponent>(); 604 this.interval.add(t); 605 return this; 606 } 607 608 /** 609 * @return The first repetition of repeating field {@link #interval}, creating it if it does not already exist 610 */ 611 public OrderedDistributionIntervalComponent getIntervalFirstRep() { 612 if (getInterval().isEmpty()) { 613 addInterval(); 614 } 615 return getInterval().get(0); 616 } 617 618 /** 619 * @return {@link #topOfInterval} (Singular value of the statistic at the upper bound of the interval.) 620 */ 621 public Quantity getTopOfInterval() { 622 if (this.topOfInterval == null) 623 if (Configuration.errorOnAutoCreate()) 624 throw new Error("Attempt to auto-create OrderedDistribution.topOfInterval"); 625 else if (Configuration.doAutoCreate()) 626 this.topOfInterval = new Quantity(); // cc 627 return this.topOfInterval; 628 } 629 630 public boolean hasTopOfInterval() { 631 return this.topOfInterval != null && !this.topOfInterval.isEmpty(); 632 } 633 634 /** 635 * @param value {@link #topOfInterval} (Singular value of the statistic at the upper bound of the interval.) 636 */ 637 public OrderedDistribution setTopOfInterval(Quantity value) { 638 this.topOfInterval = value; 639 return this; 640 } 641 642 protected void listChildren(List<Property> children) { 643 super.listChildren(children); 644 children.add(new Property("description", "string", "A description of the content and value of the statistic.", 0, 1, description)); 645 children.add(new Property("note", "Annotation", "Footnotes and/or explanatory notes.", 0, java.lang.Integer.MAX_VALUE, note)); 646 children.add(new Property("numberOfIntervals", "integer", "Number of intervals in an array, eg 4 for quartiles.", 0, 1, numberOfIntervals)); 647 children.add(new Property("bottomOfFirstInterval", "Quantity", "Bottom of first interval.", 0, 1, bottomOfFirstInterval)); 648 children.add(new Property("interval", "", "Interval.", 0, java.lang.Integer.MAX_VALUE, interval)); 649 children.add(new Property("topOfInterval", "Quantity", "Singular value of the statistic at the upper bound of the interval.", 0, 1, topOfInterval)); 650 } 651 652 @Override 653 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 654 switch (_hash) { 655 case -1724546052: /*description*/ return new Property("description", "string", "A description of the content and value of the statistic.", 0, 1, description); 656 case 3387378: /*note*/ return new Property("note", "Annotation", "Footnotes and/or explanatory notes.", 0, java.lang.Integer.MAX_VALUE, note); 657 case -569541330: /*numberOfIntervals*/ return new Property("numberOfIntervals", "integer", "Number of intervals in an array, eg 4 for quartiles.", 0, 1, numberOfIntervals); 658 case 37889363: /*bottomOfFirstInterval*/ return new Property("bottomOfFirstInterval", "Quantity", "Bottom of first interval.", 0, 1, bottomOfFirstInterval); 659 case 570418373: /*interval*/ return new Property("interval", "", "Interval.", 0, java.lang.Integer.MAX_VALUE, interval); 660 case 691816177: /*topOfInterval*/ return new Property("topOfInterval", "Quantity", "Singular value of the statistic at the upper bound of the interval.", 0, 1, topOfInterval); 661 default: return super.getNamedProperty(_hash, _name, _checkValid); 662 } 663 664 } 665 666 @Override 667 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 668 switch (hash) { 669 case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType 670 case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation 671 case -569541330: /*numberOfIntervals*/ return this.numberOfIntervals == null ? new Base[0] : new Base[] {this.numberOfIntervals}; // IntegerType 672 case 37889363: /*bottomOfFirstInterval*/ return this.bottomOfFirstInterval == null ? new Base[0] : new Base[] {this.bottomOfFirstInterval}; // Quantity 673 case 570418373: /*interval*/ return this.interval == null ? new Base[0] : this.interval.toArray(new Base[this.interval.size()]); // OrderedDistributionIntervalComponent 674 case 691816177: /*topOfInterval*/ return this.topOfInterval == null ? new Base[0] : new Base[] {this.topOfInterval}; // Quantity 675 default: return super.getProperty(hash, name, checkValid); 676 } 677 678 } 679 680 @Override 681 public Base setProperty(int hash, String name, Base value) throws FHIRException { 682 switch (hash) { 683 case -1724546052: // description 684 this.description = castToString(value); // StringType 685 return value; 686 case 3387378: // note 687 this.getNote().add(castToAnnotation(value)); // Annotation 688 return value; 689 case -569541330: // numberOfIntervals 690 this.numberOfIntervals = castToInteger(value); // IntegerType 691 return value; 692 case 37889363: // bottomOfFirstInterval 693 this.bottomOfFirstInterval = castToQuantity(value); // Quantity 694 return value; 695 case 570418373: // interval 696 this.getInterval().add((OrderedDistributionIntervalComponent) value); // OrderedDistributionIntervalComponent 697 return value; 698 case 691816177: // topOfInterval 699 this.topOfInterval = castToQuantity(value); // Quantity 700 return value; 701 default: return super.setProperty(hash, name, value); 702 } 703 704 } 705 706 @Override 707 public Base setProperty(String name, Base value) throws FHIRException { 708 if (name.equals("description")) { 709 this.description = castToString(value); // StringType 710 } else if (name.equals("note")) { 711 this.getNote().add(castToAnnotation(value)); 712 } else if (name.equals("numberOfIntervals")) { 713 this.numberOfIntervals = castToInteger(value); // IntegerType 714 } else if (name.equals("bottomOfFirstInterval")) { 715 this.bottomOfFirstInterval = castToQuantity(value); // Quantity 716 } else if (name.equals("interval")) { 717 this.getInterval().add((OrderedDistributionIntervalComponent) value); 718 } else if (name.equals("topOfInterval")) { 719 this.topOfInterval = castToQuantity(value); // Quantity 720 } else 721 return super.setProperty(name, value); 722 return value; 723 } 724 725 @Override 726 public Base makeProperty(int hash, String name) throws FHIRException { 727 switch (hash) { 728 case -1724546052: return getDescriptionElement(); 729 case 3387378: return addNote(); 730 case -569541330: return getNumberOfIntervalsElement(); 731 case 37889363: return getBottomOfFirstInterval(); 732 case 570418373: return addInterval(); 733 case 691816177: return getTopOfInterval(); 734 default: return super.makeProperty(hash, name); 735 } 736 737 } 738 739 @Override 740 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 741 switch (hash) { 742 case -1724546052: /*description*/ return new String[] {"string"}; 743 case 3387378: /*note*/ return new String[] {"Annotation"}; 744 case -569541330: /*numberOfIntervals*/ return new String[] {"integer"}; 745 case 37889363: /*bottomOfFirstInterval*/ return new String[] {"Quantity"}; 746 case 570418373: /*interval*/ return new String[] {}; 747 case 691816177: /*topOfInterval*/ return new String[] {"Quantity"}; 748 default: return super.getTypesForProperty(hash, name); 749 } 750 751 } 752 753 @Override 754 public Base addChild(String name) throws FHIRException { 755 if (name.equals("description")) { 756 throw new FHIRException("Cannot call addChild on a primitive type OrderedDistribution.description"); 757 } 758 else if (name.equals("note")) { 759 return addNote(); 760 } 761 else if (name.equals("numberOfIntervals")) { 762 throw new FHIRException("Cannot call addChild on a primitive type OrderedDistribution.numberOfIntervals"); 763 } 764 else if (name.equals("bottomOfFirstInterval")) { 765 this.bottomOfFirstInterval = new Quantity(); 766 return this.bottomOfFirstInterval; 767 } 768 else if (name.equals("interval")) { 769 return addInterval(); 770 } 771 else if (name.equals("topOfInterval")) { 772 this.topOfInterval = new Quantity(); 773 return this.topOfInterval; 774 } 775 else 776 return super.addChild(name); 777 } 778 779 public String fhirType() { 780 return "OrderedDistribution"; 781 782 } 783 784 public OrderedDistribution copy() { 785 OrderedDistribution dst = new OrderedDistribution(); 786 copyValues(dst); 787 return dst; 788 } 789 790 public void copyValues(OrderedDistribution dst) { 791 super.copyValues(dst); 792 dst.description = description == null ? null : description.copy(); 793 if (note != null) { 794 dst.note = new ArrayList<Annotation>(); 795 for (Annotation i : note) 796 dst.note.add(i.copy()); 797 }; 798 dst.numberOfIntervals = numberOfIntervals == null ? null : numberOfIntervals.copy(); 799 dst.bottomOfFirstInterval = bottomOfFirstInterval == null ? null : bottomOfFirstInterval.copy(); 800 if (interval != null) { 801 dst.interval = new ArrayList<OrderedDistributionIntervalComponent>(); 802 for (OrderedDistributionIntervalComponent i : interval) 803 dst.interval.add(i.copy()); 804 }; 805 dst.topOfInterval = topOfInterval == null ? null : topOfInterval.copy(); 806 } 807 808 protected OrderedDistribution typedCopy() { 809 return copy(); 810 } 811 812 @Override 813 public boolean equalsDeep(Base other_) { 814 if (!super.equalsDeep(other_)) 815 return false; 816 if (!(other_ instanceof OrderedDistribution)) 817 return false; 818 OrderedDistribution o = (OrderedDistribution) other_; 819 return compareDeep(description, o.description, true) && compareDeep(note, o.note, true) && compareDeep(numberOfIntervals, o.numberOfIntervals, true) 820 && compareDeep(bottomOfFirstInterval, o.bottomOfFirstInterval, true) && compareDeep(interval, o.interval, true) 821 && compareDeep(topOfInterval, o.topOfInterval, true); 822 } 823 824 @Override 825 public boolean equalsShallow(Base other_) { 826 if (!super.equalsShallow(other_)) 827 return false; 828 if (!(other_ instanceof OrderedDistribution)) 829 return false; 830 OrderedDistribution o = (OrderedDistribution) other_; 831 return compareValues(description, o.description, true) && compareValues(numberOfIntervals, o.numberOfIntervals, true) 832 ; 833 } 834 835 public boolean isEmpty() { 836 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, note, numberOfIntervals 837 , bottomOfFirstInterval, interval, topOfInterval); 838 } 839 840 841} 842