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