001package org.hl7.fhir.dstu3.model; 002 003import java.math.BigDecimal; 004 005/* 006 Copyright (c) 2011+, HL7, Inc. 007 All rights reserved. 008 009 Redistribution and use in source and binary forms, with or without modification, 010 are permitted provided that the following conditions are met: 011 012 * Redistributions of source code must retain the above copyright notice, this 013 list of conditions and the following disclaimer. 014 * Redistributions in binary form must reproduce the above copyright notice, 015 this list of conditions and the following disclaimer in the documentation 016 and/or other materials provided with the distribution. 017 * Neither the name of HL7 nor the names of its contributors may be used to 018 endorse or promote products derived from this software without specific 019 prior written permission. 020 021 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 022 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 023 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 024 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 025 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 026 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 027 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 028 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 029 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 030 POSSIBILITY OF SUCH DAMAGE. 031 032*/ 033 034// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x 035import java.util.List; 036 037import org.hl7.fhir.exceptions.FHIRException; 038import org.hl7.fhir.instance.model.api.ICompositeType; 039import org.hl7.fhir.utilities.Utilities; 040 041import ca.uhn.fhir.model.api.annotation.Child; 042import ca.uhn.fhir.model.api.annotation.DatatypeDef; 043import ca.uhn.fhir.model.api.annotation.Description; 044/** 045 * A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies. 046 */ 047@DatatypeDef(name="Quantity") 048public class Quantity extends Type implements ICompositeType { 049 050 public enum QuantityComparator { 051 /** 052 * The actual value is less than the given value. 053 */ 054 LESS_THAN, 055 /** 056 * The actual value is less than or equal to the given value. 057 */ 058 LESS_OR_EQUAL, 059 /** 060 * The actual value is greater than or equal to the given value. 061 */ 062 GREATER_OR_EQUAL, 063 /** 064 * The actual value is greater than the given value. 065 */ 066 GREATER_THAN, 067 /** 068 * added to help the parsers with the generic types 069 */ 070 NULL; 071 public static QuantityComparator fromCode(String codeString) throws FHIRException { 072 if (codeString == null || "".equals(codeString)) 073 return null; 074 if ("<".equals(codeString)) 075 return LESS_THAN; 076 if ("<=".equals(codeString)) 077 return LESS_OR_EQUAL; 078 if (">=".equals(codeString)) 079 return GREATER_OR_EQUAL; 080 if (">".equals(codeString)) 081 return GREATER_THAN; 082 if (Configuration.isAcceptInvalidEnums()) 083 return null; 084 else 085 throw new FHIRException("Unknown QuantityComparator code '"+codeString+"'"); 086 } 087 public String toCode() { 088 switch (this) { 089 case LESS_THAN: return "<"; 090 case LESS_OR_EQUAL: return "<="; 091 case GREATER_OR_EQUAL: return ">="; 092 case GREATER_THAN: return ">"; 093 case NULL: return null; 094 default: return "?"; 095 } 096 } 097 public String getSystem() { 098 switch (this) { 099 case LESS_THAN: return "http://hl7.org/fhir/quantity-comparator"; 100 case LESS_OR_EQUAL: return "http://hl7.org/fhir/quantity-comparator"; 101 case GREATER_OR_EQUAL: return "http://hl7.org/fhir/quantity-comparator"; 102 case GREATER_THAN: return "http://hl7.org/fhir/quantity-comparator"; 103 case NULL: return null; 104 default: return "?"; 105 } 106 } 107 public String getDefinition() { 108 switch (this) { 109 case LESS_THAN: return "The actual value is less than the given value."; 110 case LESS_OR_EQUAL: return "The actual value is less than or equal to the given value."; 111 case GREATER_OR_EQUAL: return "The actual value is greater than or equal to the given value."; 112 case GREATER_THAN: return "The actual value is greater than the given value."; 113 case NULL: return null; 114 default: return "?"; 115 } 116 } 117 public String getDisplay() { 118 switch (this) { 119 case LESS_THAN: return "Less than"; 120 case LESS_OR_EQUAL: return "Less or Equal to"; 121 case GREATER_OR_EQUAL: return "Greater or Equal to"; 122 case GREATER_THAN: return "Greater than"; 123 case NULL: return null; 124 default: return "?"; 125 } 126 } 127 } 128 129 public static class QuantityComparatorEnumFactory implements EnumFactory<QuantityComparator> { 130 public QuantityComparator fromCode(String codeString) throws IllegalArgumentException { 131 if (codeString == null || "".equals(codeString)) 132 if (codeString == null || "".equals(codeString)) 133 return null; 134 if ("<".equals(codeString)) 135 return QuantityComparator.LESS_THAN; 136 if ("<=".equals(codeString)) 137 return QuantityComparator.LESS_OR_EQUAL; 138 if (">=".equals(codeString)) 139 return QuantityComparator.GREATER_OR_EQUAL; 140 if (">".equals(codeString)) 141 return QuantityComparator.GREATER_THAN; 142 throw new IllegalArgumentException("Unknown QuantityComparator code '"+codeString+"'"); 143 } 144 public Enumeration<QuantityComparator> fromType(PrimitiveType<?> code) throws FHIRException { 145 if (code == null) 146 return null; 147 if (code.isEmpty()) 148 return new Enumeration<QuantityComparator>(this); 149 String codeString = code.asStringValue(); 150 if (codeString == null || "".equals(codeString)) 151 return null; 152 if ("<".equals(codeString)) 153 return new Enumeration<QuantityComparator>(this, QuantityComparator.LESS_THAN); 154 if ("<=".equals(codeString)) 155 return new Enumeration<QuantityComparator>(this, QuantityComparator.LESS_OR_EQUAL); 156 if (">=".equals(codeString)) 157 return new Enumeration<QuantityComparator>(this, QuantityComparator.GREATER_OR_EQUAL); 158 if (">".equals(codeString)) 159 return new Enumeration<QuantityComparator>(this, QuantityComparator.GREATER_THAN); 160 throw new FHIRException("Unknown QuantityComparator code '"+codeString+"'"); 161 } 162 public String toCode(QuantityComparator code) { 163 if (code == QuantityComparator.NULL) 164 return null; 165 if (code == QuantityComparator.LESS_THAN) 166 return "<"; 167 if (code == QuantityComparator.LESS_OR_EQUAL) 168 return "<="; 169 if (code == QuantityComparator.GREATER_OR_EQUAL) 170 return ">="; 171 if (code == QuantityComparator.GREATER_THAN) 172 return ">"; 173 return "?"; 174 } 175 public String toSystem(QuantityComparator code) { 176 return code.getSystem(); 177 } 178 } 179 180 /** 181 * The value of the measured amount. The value includes an implicit precision in the presentation of the value. 182 */ 183 @Child(name = "value", type = {DecimalType.class}, order=0, min=0, max=1, modifier=false, summary=true) 184 @Description(shortDefinition="Numerical value (with implicit precision)", formalDefinition="The value of the measured amount. The value includes an implicit precision in the presentation of the value." ) 185 protected DecimalType value; 186 187 /** 188 * How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value. 189 */ 190 @Child(name = "comparator", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true) 191 @Description(shortDefinition="< | <= | >= | > - how to understand the value", formalDefinition="How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value." ) 192 @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/quantity-comparator") 193 protected Enumeration<QuantityComparator> comparator; 194 195 /** 196 * A human-readable form of the unit. 197 */ 198 @Child(name = "unit", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true) 199 @Description(shortDefinition="Unit representation", formalDefinition="A human-readable form of the unit." ) 200 protected StringType unit; 201 202 /** 203 * The identification of the system that provides the coded form of the unit. 204 */ 205 @Child(name = "system", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=true) 206 @Description(shortDefinition="System that defines coded unit form", formalDefinition="The identification of the system that provides the coded form of the unit." ) 207 protected UriType system; 208 209 /** 210 * A computer processable form of the unit in some unit representation system. 211 */ 212 @Child(name = "code", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=true) 213 @Description(shortDefinition="Coded form of the unit", formalDefinition="A computer processable form of the unit in some unit representation system." ) 214 protected CodeType code; 215 216 private static final long serialVersionUID = 1069574054L; 217 218 /** 219 * Constructor 220 */ 221 public Quantity() { 222 super(); 223 } 224 225 /** 226 * Convenience constructor 227 * 228 * @param theValue The {@link #setValue(double) value} 229 */ 230 public Quantity(double theValue) { 231 setValue(theValue); 232 } 233 234 /** 235 * Convenience constructor 236 * 237 * @param theValue The {@link #setValue(long) value} 238 */ 239 public Quantity(long theValue) { 240 setValue(theValue); 241 } 242 243 /** 244 * Convenience constructor 245 * 246 * @param theComparator The {@link #setComparator(QuantityComparator) comparator} 247 * @param theValue The {@link #setValue(BigDecimal) value} 248 * @param theSystem The {@link #setSystem(String)} (the code system for the units} 249 * @param theCode The {@link #setCode(String)} (the code for the units} 250 * @param theUnit The {@link #setUnit(String)} (the human readable display name for the units} 251 */ 252 public Quantity(QuantityComparator theComparator, double theValue, String theSystem, String theCode, String theUnit) { 253 setValue(theValue); 254 setComparator(theComparator); 255 setSystem(theSystem); 256 setCode(theCode); 257 setUnit(theUnit); 258 } 259 260 /** 261 * Convenience constructor 262 * 263 * @param theComparator The {@link #setComparator(QuantityComparator) comparator} 264 * @param theValue The {@link #setValue(BigDecimal) value} 265 * @param theSystem The {@link #setSystem(String)} (the code system for the units} 266 * @param theCode The {@link #setCode(String)} (the code for the units} 267 * @param theUnit The {@link #setUnit(String)} (the human readable display name for the units} 268 */ 269 public Quantity(QuantityComparator theComparator, long theValue, String theSystem, String theCode, String theUnit) { 270 setValue(theValue); 271 setComparator(theComparator); 272 setSystem(theSystem); 273 setCode(theCode); 274 setUnit(theUnit); 275 } 276 /** 277 * @return {@link #value} (The value of the measured amount. The value includes an implicit precision in the presentation of the value.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value 278 */ 279 public DecimalType getValueElement() { 280 if (this.value == null) 281 if (Configuration.errorOnAutoCreate()) 282 throw new Error("Attempt to auto-create Quantity.value"); 283 else if (Configuration.doAutoCreate()) 284 this.value = new DecimalType(); // bb 285 return this.value; 286 } 287 288 public boolean hasValueElement() { 289 return this.value != null && !this.value.isEmpty(); 290 } 291 292 public boolean hasValue() { 293 return this.value != null && !this.value.isEmpty(); 294 } 295 296 /** 297 * @param value {@link #value} (The value of the measured amount. The value includes an implicit precision in the presentation of the value.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value 298 */ 299 public Quantity setValueElement(DecimalType value) { 300 this.value = value; 301 return this; 302 } 303 304 /** 305 * @return The value of the measured amount. The value includes an implicit precision in the presentation of the value. 306 */ 307 public BigDecimal getValue() { 308 return this.value == null ? null : this.value.getValue(); 309 } 310 311 /** 312 * @param value The value of the measured amount. The value includes an implicit precision in the presentation of the value. 313 */ 314 public Quantity setValue(BigDecimal value) { 315 if (value == null) 316 this.value = null; 317 else { 318 if (this.value == null) 319 this.value = new DecimalType(); 320 this.value.setValue(value); 321 } 322 return this; 323 } 324 325 /** 326 * @param value The value of the measured amount. The value includes an implicit precision in the presentation of the value. 327 */ 328 public Quantity setValue(long value) { 329 this.value = new DecimalType(); 330 this.value.setValue(value); 331 return this; 332 } 333 334 /** 335 * @param value The value of the measured amount. The value includes an implicit precision in the presentation of the value. 336 */ 337 public Quantity setValue(double value) { 338 this.value = new DecimalType(); 339 this.value.setValue(value); 340 return this; 341 } 342 343 /** 344 * @return {@link #comparator} (How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.). This is the underlying object with id, value and extensions. The accessor "getComparator" gives direct access to the value 345 */ 346 public Enumeration<QuantityComparator> getComparatorElement() { 347 if (this.comparator == null) 348 if (Configuration.errorOnAutoCreate()) 349 throw new Error("Attempt to auto-create Quantity.comparator"); 350 else if (Configuration.doAutoCreate()) 351 this.comparator = new Enumeration<QuantityComparator>(new QuantityComparatorEnumFactory()); // bb 352 return this.comparator; 353 } 354 355 public boolean hasComparatorElement() { 356 return this.comparator != null && !this.comparator.isEmpty(); 357 } 358 359 public boolean hasComparator() { 360 return this.comparator != null && !this.comparator.isEmpty(); 361 } 362 363 /** 364 * @param value {@link #comparator} (How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value.). This is the underlying object with id, value and extensions. The accessor "getComparator" gives direct access to the value 365 */ 366 public Quantity setComparatorElement(Enumeration<QuantityComparator> value) { 367 this.comparator = value; 368 return this; 369 } 370 371 /** 372 * @return How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value. 373 */ 374 public QuantityComparator getComparator() { 375 return this.comparator == null ? null : this.comparator.getValue(); 376 } 377 378 /** 379 * @param value How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is "<" , then the real value is < stated value. 380 */ 381 public Quantity setComparator(QuantityComparator value) { 382 if (value == null) 383 this.comparator = null; 384 else { 385 if (this.comparator == null) 386 this.comparator = new Enumeration<QuantityComparator>(new QuantityComparatorEnumFactory()); 387 this.comparator.setValue(value); 388 } 389 return this; 390 } 391 392 /** 393 * @return {@link #unit} (A human-readable form of the unit.). This is the underlying object with id, value and extensions. The accessor "getUnit" gives direct access to the value 394 */ 395 public StringType getUnitElement() { 396 if (this.unit == null) 397 if (Configuration.errorOnAutoCreate()) 398 throw new Error("Attempt to auto-create Quantity.unit"); 399 else if (Configuration.doAutoCreate()) 400 this.unit = new StringType(); // bb 401 return this.unit; 402 } 403 404 public boolean hasUnitElement() { 405 return this.unit != null && !this.unit.isEmpty(); 406 } 407 408 public boolean hasUnit() { 409 return this.unit != null && !this.unit.isEmpty(); 410 } 411 412 /** 413 * @param value {@link #unit} (A human-readable form of the unit.). This is the underlying object with id, value and extensions. The accessor "getUnit" gives direct access to the value 414 */ 415 public Quantity setUnitElement(StringType value) { 416 this.unit = value; 417 return this; 418 } 419 420 /** 421 * @return A human-readable form of the unit. 422 */ 423 public String getUnit() { 424 return this.unit == null ? null : this.unit.getValue(); 425 } 426 427 /** 428 * @param value A human-readable form of the unit. 429 */ 430 public Quantity setUnit(String value) { 431 if (Utilities.noString(value)) 432 this.unit = null; 433 else { 434 if (this.unit == null) 435 this.unit = new StringType(); 436 this.unit.setValue(value); 437 } 438 return this; 439 } 440 441 /** 442 * @return {@link #system} (The identification of the system that provides the coded form of the unit.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value 443 */ 444 public UriType getSystemElement() { 445 if (this.system == null) 446 if (Configuration.errorOnAutoCreate()) 447 throw new Error("Attempt to auto-create Quantity.system"); 448 else if (Configuration.doAutoCreate()) 449 this.system = new UriType(); // bb 450 return this.system; 451 } 452 453 public boolean hasSystemElement() { 454 return this.system != null && !this.system.isEmpty(); 455 } 456 457 public boolean hasSystem() { 458 return this.system != null && !this.system.isEmpty(); 459 } 460 461 /** 462 * @param value {@link #system} (The identification of the system that provides the coded form of the unit.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value 463 */ 464 public Quantity setSystemElement(UriType value) { 465 this.system = value; 466 return this; 467 } 468 469 /** 470 * @return The identification of the system that provides the coded form of the unit. 471 */ 472 public String getSystem() { 473 return this.system == null ? null : this.system.getValue(); 474 } 475 476 /** 477 * @param value The identification of the system that provides the coded form of the unit. 478 */ 479 public Quantity setSystem(String value) { 480 if (Utilities.noString(value)) 481 this.system = null; 482 else { 483 if (this.system == null) 484 this.system = new UriType(); 485 this.system.setValue(value); 486 } 487 return this; 488 } 489 490 /** 491 * @return {@link #code} (A computer processable form of the unit in some unit representation system.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value 492 */ 493 public CodeType getCodeElement() { 494 if (this.code == null) 495 if (Configuration.errorOnAutoCreate()) 496 throw new Error("Attempt to auto-create Quantity.code"); 497 else if (Configuration.doAutoCreate()) 498 this.code = new CodeType(); // bb 499 return this.code; 500 } 501 502 public boolean hasCodeElement() { 503 return this.code != null && !this.code.isEmpty(); 504 } 505 506 public boolean hasCode() { 507 return this.code != null && !this.code.isEmpty(); 508 } 509 510 /** 511 * @param value {@link #code} (A computer processable form of the unit in some unit representation system.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value 512 */ 513 public Quantity setCodeElement(CodeType value) { 514 this.code = value; 515 return this; 516 } 517 518 /** 519 * @return A computer processable form of the unit in some unit representation system. 520 */ 521 public String getCode() { 522 return this.code == null ? null : this.code.getValue(); 523 } 524 525 /** 526 * @param value A computer processable form of the unit in some unit representation system. 527 */ 528 public Quantity setCode(String value) { 529 if (Utilities.noString(value)) 530 this.code = null; 531 else { 532 if (this.code == null) 533 this.code = new CodeType(); 534 this.code.setValue(value); 535 } 536 return this; 537 } 538 539 protected void listChildren(List<Property> children) { 540 super.listChildren(children); 541 children.add(new Property("value", "decimal", "The value of the measured amount. The value includes an implicit precision in the presentation of the value.", 0, 1, value)); 542 children.add(new Property("comparator", "code", "How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value.", 0, 1, comparator)); 543 children.add(new Property("unit", "string", "A human-readable form of the unit.", 0, 1, unit)); 544 children.add(new Property("system", "uri", "The identification of the system that provides the coded form of the unit.", 0, 1, system)); 545 children.add(new Property("code", "code", "A computer processable form of the unit in some unit representation system.", 0, 1, code)); 546 } 547 548 @Override 549 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 550 switch (_hash) { 551 case 111972721: /*value*/ return new Property("value", "decimal", "The value of the measured amount. The value includes an implicit precision in the presentation of the value.", 0, 1, value); 552 case -844673834: /*comparator*/ return new Property("comparator", "code", "How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value.", 0, 1, comparator); 553 case 3594628: /*unit*/ return new Property("unit", "string", "A human-readable form of the unit.", 0, 1, unit); 554 case -887328209: /*system*/ return new Property("system", "uri", "The identification of the system that provides the coded form of the unit.", 0, 1, system); 555 case 3059181: /*code*/ return new Property("code", "code", "A computer processable form of the unit in some unit representation system.", 0, 1, code); 556 default: return super.getNamedProperty(_hash, _name, _checkValid); 557 } 558 559 } 560 561 @Override 562 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 563 switch (hash) { 564 case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType 565 case -844673834: /*comparator*/ return this.comparator == null ? new Base[0] : new Base[] {this.comparator}; // Enumeration<QuantityComparator> 566 case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // StringType 567 case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // UriType 568 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeType 569 default: return super.getProperty(hash, name, checkValid); 570 } 571 572 } 573 574 @Override 575 public Base setProperty(int hash, String name, Base value) throws FHIRException { 576 switch (hash) { 577 case 111972721: // value 578 this.value = castToDecimal(value); // DecimalType 579 return value; 580 case -844673834: // comparator 581 value = new QuantityComparatorEnumFactory().fromType(castToCode(value)); 582 this.comparator = (Enumeration) value; // Enumeration<QuantityComparator> 583 return value; 584 case 3594628: // unit 585 this.unit = castToString(value); // StringType 586 return value; 587 case -887328209: // system 588 this.system = castToUri(value); // UriType 589 return value; 590 case 3059181: // code 591 this.code = castToCode(value); // CodeType 592 return value; 593 default: return super.setProperty(hash, name, value); 594 } 595 596 } 597 598 @Override 599 public Base setProperty(String name, Base value) throws FHIRException { 600 if (name.equals("value")) { 601 this.value = castToDecimal(value); // DecimalType 602 } else if (name.equals("comparator")) { 603 value = new QuantityComparatorEnumFactory().fromType(castToCode(value)); 604 this.comparator = (Enumeration) value; // Enumeration<QuantityComparator> 605 } else if (name.equals("unit")) { 606 this.unit = castToString(value); // StringType 607 } else if (name.equals("system")) { 608 this.system = castToUri(value); // UriType 609 } else if (name.equals("code")) { 610 this.code = castToCode(value); // CodeType 611 } else 612 return super.setProperty(name, value); 613 return value; 614 } 615 616 @Override 617 public Base makeProperty(int hash, String name) throws FHIRException { 618 switch (hash) { 619 case 111972721: return getValueElement(); 620 case -844673834: return getComparatorElement(); 621 case 3594628: return getUnitElement(); 622 case -887328209: return getSystemElement(); 623 case 3059181: return getCodeElement(); 624 default: return super.makeProperty(hash, name); 625 } 626 627 } 628 629 @Override 630 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 631 switch (hash) { 632 case 111972721: /*value*/ return new String[] {"decimal"}; 633 case -844673834: /*comparator*/ return new String[] {"code"}; 634 case 3594628: /*unit*/ return new String[] {"string"}; 635 case -887328209: /*system*/ return new String[] {"uri"}; 636 case 3059181: /*code*/ return new String[] {"code"}; 637 default: return super.getTypesForProperty(hash, name); 638 } 639 640 } 641 642 @Override 643 public Base addChild(String name) throws FHIRException { 644 if (name.equals("value")) { 645 throw new FHIRException("Cannot call addChild on a singleton property Quantity.value"); 646 } 647 else if (name.equals("comparator")) { 648 throw new FHIRException("Cannot call addChild on a singleton property Quantity.comparator"); 649 } 650 else if (name.equals("unit")) { 651 throw new FHIRException("Cannot call addChild on a singleton property Quantity.unit"); 652 } 653 else if (name.equals("system")) { 654 throw new FHIRException("Cannot call addChild on a singleton property Quantity.system"); 655 } 656 else if (name.equals("code")) { 657 throw new FHIRException("Cannot call addChild on a singleton property Quantity.code"); 658 } 659 else 660 return super.addChild(name); 661 } 662 663 public String fhirType() { 664 return "Quantity"; 665 666 } 667 668 public Quantity copy() { 669 Quantity dst = new Quantity(); 670 copyValues(dst); 671 dst.value = value == null ? null : value.copy(); 672 dst.comparator = comparator == null ? null : comparator.copy(); 673 dst.unit = unit == null ? null : unit.copy(); 674 dst.system = system == null ? null : system.copy(); 675 dst.code = code == null ? null : code.copy(); 676 return dst; 677 } 678 679 protected Quantity typedCopy() { 680 return copy(); 681 } 682 683 @Override 684 public boolean equalsDeep(Base other_) { 685 if (!super.equalsDeep(other_)) 686 return false; 687 if (!(other_ instanceof Quantity)) 688 return false; 689 Quantity o = (Quantity) other_; 690 return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(unit, o.unit, true) 691 && compareDeep(system, o.system, true) && compareDeep(code, o.code, true); 692 } 693 694 @Override 695 public boolean equalsShallow(Base other_) { 696 if (!super.equalsShallow(other_)) 697 return false; 698 if (!(other_ instanceof Quantity)) 699 return false; 700 Quantity o = (Quantity) other_; 701 return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(unit, o.unit, true) 702 && compareValues(system, o.system, true) && compareValues(code, o.code, true); 703 } 704 705 public boolean isEmpty() { 706 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, comparator, unit 707 , system, code); 708 } 709 710 711}