001package org.hl7.fhir.r4.model; 002 003/* 004 Copyright (c) 2011+, HL7, Inc. 005 All rights reserved. 006 007 Redistribution and use in source and binary forms, with or without modification, 008 are permitted provided that the following conditions are met: 009 010 * Redistributions of source code must retain the above copyright notice, this 011 list of conditions and the following disclaimer. 012 * Redistributions in binary form must reproduce the above copyright notice, 013 this list of conditions and the following disclaimer in the documentation 014 and/or other materials provided with the distribution. 015 * Neither the name of HL7 nor the names of its contributors may be used to 016 endorse or promote products derived from this software without specific 017 prior written permission. 018 019 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 022 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 023 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 024 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 025 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 027 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 028 POSSIBILITY OF SUCH DAMAGE. 029 030*/ 031 032// Generated on Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0 033 034import java.util.*; 035 036import org.hl7.fhir.utilities.Utilities; 037import ca.uhn.fhir.model.api.annotation.Child; 038import ca.uhn.fhir.model.api.annotation.ChildOrder; 039import ca.uhn.fhir.model.api.annotation.Description; 040import ca.uhn.fhir.model.api.annotation.DatatypeDef; 041import ca.uhn.fhir.model.api.annotation.Block; 042import org.hl7.fhir.instance.model.api.*; 043import org.hl7.fhir.exceptions.FHIRException; 044/** 045 * Chemical substances are a single substance type whose primary defining element is the molecular structure. Chemical substances shall be defined on the basis of their complete covalent molecular structure; the presence of a salt (counter-ion) and/or solvates (water, alcohols) is also captured. Purity, grade, physical form or particle size are not taken into account in the definition of a chemical substance or in the assignment of a Substance ID. 046 */ 047@DatatypeDef(name="SubstanceAmount") 048public class SubstanceAmount extends BackboneElement implements ICompositeType { 049 050 @Block() 051 public static class SubstanceAmountReferenceRangeComponent extends Element implements IBaseDatatypeElement { 052 /** 053 * Lower limit possible or expected. 054 */ 055 @Child(name = "lowLimit", type = {Quantity.class}, order=1, min=0, max=1, modifier=false, summary=true) 056 @Description(shortDefinition="Lower limit possible or expected", formalDefinition="Lower limit possible or expected." ) 057 protected Quantity lowLimit; 058 059 /** 060 * Upper limit possible or expected. 061 */ 062 @Child(name = "highLimit", type = {Quantity.class}, order=2, min=0, max=1, modifier=false, summary=true) 063 @Description(shortDefinition="Upper limit possible or expected", formalDefinition="Upper limit possible or expected." ) 064 protected Quantity highLimit; 065 066 private static final long serialVersionUID = -193230412L; 067 068 /** 069 * Constructor 070 */ 071 public SubstanceAmountReferenceRangeComponent() { 072 super(); 073 } 074 075 /** 076 * @return {@link #lowLimit} (Lower limit possible or expected.) 077 */ 078 public Quantity getLowLimit() { 079 if (this.lowLimit == null) 080 if (Configuration.errorOnAutoCreate()) 081 throw new Error("Attempt to auto-create SubstanceAmountReferenceRangeComponent.lowLimit"); 082 else if (Configuration.doAutoCreate()) 083 this.lowLimit = new Quantity(); // cc 084 return this.lowLimit; 085 } 086 087 public boolean hasLowLimit() { 088 return this.lowLimit != null && !this.lowLimit.isEmpty(); 089 } 090 091 /** 092 * @param value {@link #lowLimit} (Lower limit possible or expected.) 093 */ 094 public SubstanceAmountReferenceRangeComponent setLowLimit(Quantity value) { 095 this.lowLimit = value; 096 return this; 097 } 098 099 /** 100 * @return {@link #highLimit} (Upper limit possible or expected.) 101 */ 102 public Quantity getHighLimit() { 103 if (this.highLimit == null) 104 if (Configuration.errorOnAutoCreate()) 105 throw new Error("Attempt to auto-create SubstanceAmountReferenceRangeComponent.highLimit"); 106 else if (Configuration.doAutoCreate()) 107 this.highLimit = new Quantity(); // cc 108 return this.highLimit; 109 } 110 111 public boolean hasHighLimit() { 112 return this.highLimit != null && !this.highLimit.isEmpty(); 113 } 114 115 /** 116 * @param value {@link #highLimit} (Upper limit possible or expected.) 117 */ 118 public SubstanceAmountReferenceRangeComponent setHighLimit(Quantity value) { 119 this.highLimit = value; 120 return this; 121 } 122 123 protected void listChildren(List<Property> children) { 124 super.listChildren(children); 125 children.add(new Property("lowLimit", "Quantity", "Lower limit possible or expected.", 0, 1, lowLimit)); 126 children.add(new Property("highLimit", "Quantity", "Upper limit possible or expected.", 0, 1, highLimit)); 127 } 128 129 @Override 130 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 131 switch (_hash) { 132 case -1841058617: /*lowLimit*/ return new Property("lowLimit", "Quantity", "Lower limit possible or expected.", 0, 1, lowLimit); 133 case -710757575: /*highLimit*/ return new Property("highLimit", "Quantity", "Upper limit possible or expected.", 0, 1, highLimit); 134 default: return super.getNamedProperty(_hash, _name, _checkValid); 135 } 136 137 } 138 139 @Override 140 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 141 switch (hash) { 142 case -1841058617: /*lowLimit*/ return this.lowLimit == null ? new Base[0] : new Base[] {this.lowLimit}; // Quantity 143 case -710757575: /*highLimit*/ return this.highLimit == null ? new Base[0] : new Base[] {this.highLimit}; // Quantity 144 default: return super.getProperty(hash, name, checkValid); 145 } 146 147 } 148 149 @Override 150 public Base setProperty(int hash, String name, Base value) throws FHIRException { 151 switch (hash) { 152 case -1841058617: // lowLimit 153 this.lowLimit = castToQuantity(value); // Quantity 154 return value; 155 case -710757575: // highLimit 156 this.highLimit = castToQuantity(value); // Quantity 157 return value; 158 default: return super.setProperty(hash, name, value); 159 } 160 161 } 162 163 @Override 164 public Base setProperty(String name, Base value) throws FHIRException { 165 if (name.equals("lowLimit")) { 166 this.lowLimit = castToQuantity(value); // Quantity 167 } else if (name.equals("highLimit")) { 168 this.highLimit = castToQuantity(value); // Quantity 169 } else 170 return super.setProperty(name, value); 171 return value; 172 } 173 174 @Override 175 public Base makeProperty(int hash, String name) throws FHIRException { 176 switch (hash) { 177 case -1841058617: return getLowLimit(); 178 case -710757575: return getHighLimit(); 179 default: return super.makeProperty(hash, name); 180 } 181 182 } 183 184 @Override 185 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 186 switch (hash) { 187 case -1841058617: /*lowLimit*/ return new String[] {"Quantity"}; 188 case -710757575: /*highLimit*/ return new String[] {"Quantity"}; 189 default: return super.getTypesForProperty(hash, name); 190 } 191 192 } 193 194 @Override 195 public Base addChild(String name) throws FHIRException { 196 if (name.equals("lowLimit")) { 197 this.lowLimit = new Quantity(); 198 return this.lowLimit; 199 } 200 else if (name.equals("highLimit")) { 201 this.highLimit = new Quantity(); 202 return this.highLimit; 203 } 204 else 205 return super.addChild(name); 206 } 207 208 public SubstanceAmountReferenceRangeComponent copy() { 209 SubstanceAmountReferenceRangeComponent dst = new SubstanceAmountReferenceRangeComponent(); 210 copyValues(dst); 211 dst.lowLimit = lowLimit == null ? null : lowLimit.copy(); 212 dst.highLimit = highLimit == null ? null : highLimit.copy(); 213 return dst; 214 } 215 216 @Override 217 public boolean equalsDeep(Base other_) { 218 if (!super.equalsDeep(other_)) 219 return false; 220 if (!(other_ instanceof SubstanceAmountReferenceRangeComponent)) 221 return false; 222 SubstanceAmountReferenceRangeComponent o = (SubstanceAmountReferenceRangeComponent) other_; 223 return compareDeep(lowLimit, o.lowLimit, true) && compareDeep(highLimit, o.highLimit, true); 224 } 225 226 @Override 227 public boolean equalsShallow(Base other_) { 228 if (!super.equalsShallow(other_)) 229 return false; 230 if (!(other_ instanceof SubstanceAmountReferenceRangeComponent)) 231 return false; 232 SubstanceAmountReferenceRangeComponent o = (SubstanceAmountReferenceRangeComponent) other_; 233 return true; 234 } 235 236 public boolean isEmpty() { 237 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(lowLimit, highLimit); 238 } 239 240 public String fhirType() { 241 return "SubstanceAmount.referenceRange"; 242 243 } 244 245 } 246 247 /** 248 * Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field. 249 */ 250 @Child(name = "amount", type = {Quantity.class, Range.class, StringType.class}, order=0, min=0, max=1, modifier=false, summary=true) 251 @Description(shortDefinition="Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field", formalDefinition="Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field." ) 252 protected Type amount; 253 254 /** 255 * Most elements that require a quantitative value will also have a field called amount type. Amount type should always be specified because the actual value of the amount is often dependent on it. EXAMPLE: In capturing the actual relative amounts of substances or molecular fragments it is essential to indicate whether the amount refers to a mole ratio or weight ratio. For any given element an effort should be made to use same the amount type for all related definitional elements. 256 */ 257 @Child(name = "amountType", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 258 @Description(shortDefinition="Most elements that require a quantitative value will also have a field called amount type. Amount type should always be specified because the actual value of the amount is often dependent on it. EXAMPLE: In capturing the actual relative amounts of substances or molecular fragments it is essential to indicate whether the amount refers to a mole ratio or weight ratio. For any given element an effort should be made to use same the amount type for all related definitional elements", formalDefinition="Most elements that require a quantitative value will also have a field called amount type. Amount type should always be specified because the actual value of the amount is often dependent on it. EXAMPLE: In capturing the actual relative amounts of substances or molecular fragments it is essential to indicate whether the amount refers to a mole ratio or weight ratio. For any given element an effort should be made to use same the amount type for all related definitional elements." ) 259 protected CodeableConcept amountType; 260 261 /** 262 * A textual comment on a numeric value. 263 */ 264 @Child(name = "amountText", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true) 265 @Description(shortDefinition="A textual comment on a numeric value", formalDefinition="A textual comment on a numeric value." ) 266 protected StringType amountText; 267 268 /** 269 * Reference range of possible or expected values. 270 */ 271 @Child(name = "referenceRange", type = {}, order=3, min=0, max=1, modifier=false, summary=true) 272 @Description(shortDefinition="Reference range of possible or expected values", formalDefinition="Reference range of possible or expected values." ) 273 protected SubstanceAmountReferenceRangeComponent referenceRange; 274 275 private static final long serialVersionUID = -174997548L; 276 277 /** 278 * Constructor 279 */ 280 public SubstanceAmount() { 281 super(); 282 } 283 284 /** 285 * @return {@link #amount} (Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.) 286 */ 287 public Type getAmount() { 288 return this.amount; 289 } 290 291 /** 292 * @return {@link #amount} (Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.) 293 */ 294 public Quantity getAmountQuantity() throws FHIRException { 295 if (this.amount == null) 296 return null; 297 if (!(this.amount instanceof Quantity)) 298 throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.amount.getClass().getName()+" was encountered"); 299 return (Quantity) this.amount; 300 } 301 302 public boolean hasAmountQuantity() { 303 return this != null && this.amount instanceof Quantity; 304 } 305 306 /** 307 * @return {@link #amount} (Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.) 308 */ 309 public Range getAmountRange() throws FHIRException { 310 if (this.amount == null) 311 return null; 312 if (!(this.amount instanceof Range)) 313 throw new FHIRException("Type mismatch: the type Range was expected, but "+this.amount.getClass().getName()+" was encountered"); 314 return (Range) this.amount; 315 } 316 317 public boolean hasAmountRange() { 318 return this != null && this.amount instanceof Range; 319 } 320 321 /** 322 * @return {@link #amount} (Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.) 323 */ 324 public StringType getAmountStringType() throws FHIRException { 325 if (this.amount == null) 326 return null; 327 if (!(this.amount instanceof StringType)) 328 throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.amount.getClass().getName()+" was encountered"); 329 return (StringType) this.amount; 330 } 331 332 public boolean hasAmountStringType() { 333 return this != null && this.amount instanceof StringType; 334 } 335 336 public boolean hasAmount() { 337 return this.amount != null && !this.amount.isEmpty(); 338 } 339 340 /** 341 * @param value {@link #amount} (Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.) 342 */ 343 public SubstanceAmount setAmount(Type value) { 344 if (value != null && !(value instanceof Quantity || value instanceof Range || value instanceof StringType)) 345 throw new Error("Not the right type for SubstanceAmount.amount[x]: "+value.fhirType()); 346 this.amount = value; 347 return this; 348 } 349 350 /** 351 * @return {@link #amountType} (Most elements that require a quantitative value will also have a field called amount type. Amount type should always be specified because the actual value of the amount is often dependent on it. EXAMPLE: In capturing the actual relative amounts of substances or molecular fragments it is essential to indicate whether the amount refers to a mole ratio or weight ratio. For any given element an effort should be made to use same the amount type for all related definitional elements.) 352 */ 353 public CodeableConcept getAmountType() { 354 if (this.amountType == null) 355 if (Configuration.errorOnAutoCreate()) 356 throw new Error("Attempt to auto-create SubstanceAmount.amountType"); 357 else if (Configuration.doAutoCreate()) 358 this.amountType = new CodeableConcept(); // cc 359 return this.amountType; 360 } 361 362 public boolean hasAmountType() { 363 return this.amountType != null && !this.amountType.isEmpty(); 364 } 365 366 /** 367 * @param value {@link #amountType} (Most elements that require a quantitative value will also have a field called amount type. Amount type should always be specified because the actual value of the amount is often dependent on it. EXAMPLE: In capturing the actual relative amounts of substances or molecular fragments it is essential to indicate whether the amount refers to a mole ratio or weight ratio. For any given element an effort should be made to use same the amount type for all related definitional elements.) 368 */ 369 public SubstanceAmount setAmountType(CodeableConcept value) { 370 this.amountType = value; 371 return this; 372 } 373 374 /** 375 * @return {@link #amountText} (A textual comment on a numeric value.). This is the underlying object with id, value and extensions. The accessor "getAmountText" gives direct access to the value 376 */ 377 public StringType getAmountTextElement() { 378 if (this.amountText == null) 379 if (Configuration.errorOnAutoCreate()) 380 throw new Error("Attempt to auto-create SubstanceAmount.amountText"); 381 else if (Configuration.doAutoCreate()) 382 this.amountText = new StringType(); // bb 383 return this.amountText; 384 } 385 386 public boolean hasAmountTextElement() { 387 return this.amountText != null && !this.amountText.isEmpty(); 388 } 389 390 public boolean hasAmountText() { 391 return this.amountText != null && !this.amountText.isEmpty(); 392 } 393 394 /** 395 * @param value {@link #amountText} (A textual comment on a numeric value.). This is the underlying object with id, value and extensions. The accessor "getAmountText" gives direct access to the value 396 */ 397 public SubstanceAmount setAmountTextElement(StringType value) { 398 this.amountText = value; 399 return this; 400 } 401 402 /** 403 * @return A textual comment on a numeric value. 404 */ 405 public String getAmountText() { 406 return this.amountText == null ? null : this.amountText.getValue(); 407 } 408 409 /** 410 * @param value A textual comment on a numeric value. 411 */ 412 public SubstanceAmount setAmountText(String value) { 413 if (Utilities.noString(value)) 414 this.amountText = null; 415 else { 416 if (this.amountText == null) 417 this.amountText = new StringType(); 418 this.amountText.setValue(value); 419 } 420 return this; 421 } 422 423 /** 424 * @return {@link #referenceRange} (Reference range of possible or expected values.) 425 */ 426 public SubstanceAmountReferenceRangeComponent getReferenceRange() { 427 if (this.referenceRange == null) 428 if (Configuration.errorOnAutoCreate()) 429 throw new Error("Attempt to auto-create SubstanceAmount.referenceRange"); 430 else if (Configuration.doAutoCreate()) 431 this.referenceRange = new SubstanceAmountReferenceRangeComponent(); // cc 432 return this.referenceRange; 433 } 434 435 public boolean hasReferenceRange() { 436 return this.referenceRange != null && !this.referenceRange.isEmpty(); 437 } 438 439 /** 440 * @param value {@link #referenceRange} (Reference range of possible or expected values.) 441 */ 442 public SubstanceAmount setReferenceRange(SubstanceAmountReferenceRangeComponent value) { 443 this.referenceRange = value; 444 return this; 445 } 446 447 protected void listChildren(List<Property> children) { 448 super.listChildren(children); 449 children.add(new Property("amount[x]", "Quantity|Range|string", "Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.", 0, 1, amount)); 450 children.add(new Property("amountType", "CodeableConcept", "Most elements that require a quantitative value will also have a field called amount type. Amount type should always be specified because the actual value of the amount is often dependent on it. EXAMPLE: In capturing the actual relative amounts of substances or molecular fragments it is essential to indicate whether the amount refers to a mole ratio or weight ratio. For any given element an effort should be made to use same the amount type for all related definitional elements.", 0, 1, amountType)); 451 children.add(new Property("amountText", "string", "A textual comment on a numeric value.", 0, 1, amountText)); 452 children.add(new Property("referenceRange", "", "Reference range of possible or expected values.", 0, 1, referenceRange)); 453 } 454 455 @Override 456 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 457 switch (_hash) { 458 case 646780200: /*amount[x]*/ return new Property("amount[x]", "Quantity|Range|string", "Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.", 0, 1, amount); 459 case -1413853096: /*amount*/ return new Property("amount[x]", "Quantity|Range|string", "Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.", 0, 1, amount); 460 case 1664303363: /*amountQuantity*/ return new Property("amount[x]", "Quantity|Range|string", "Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.", 0, 1, amount); 461 case -1223462971: /*amountRange*/ return new Property("amount[x]", "Quantity|Range|string", "Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.", 0, 1, amount); 462 case 773651081: /*amountString*/ return new Property("amount[x]", "Quantity|Range|string", "Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.", 0, 1, amount); 463 case -1424857166: /*amountType*/ return new Property("amountType", "CodeableConcept", "Most elements that require a quantitative value will also have a field called amount type. Amount type should always be specified because the actual value of the amount is often dependent on it. EXAMPLE: In capturing the actual relative amounts of substances or molecular fragments it is essential to indicate whether the amount refers to a mole ratio or weight ratio. For any given element an effort should be made to use same the amount type for all related definitional elements.", 0, 1, amountType); 464 case -1424876123: /*amountText*/ return new Property("amountText", "string", "A textual comment on a numeric value.", 0, 1, amountText); 465 case -1912545102: /*referenceRange*/ return new Property("referenceRange", "", "Reference range of possible or expected values.", 0, 1, referenceRange); 466 default: return super.getNamedProperty(_hash, _name, _checkValid); 467 } 468 469 } 470 471 @Override 472 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 473 switch (hash) { 474 case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Type 475 case -1424857166: /*amountType*/ return this.amountType == null ? new Base[0] : new Base[] {this.amountType}; // CodeableConcept 476 case -1424876123: /*amountText*/ return this.amountText == null ? new Base[0] : new Base[] {this.amountText}; // StringType 477 case -1912545102: /*referenceRange*/ return this.referenceRange == null ? new Base[0] : new Base[] {this.referenceRange}; // SubstanceAmountReferenceRangeComponent 478 default: return super.getProperty(hash, name, checkValid); 479 } 480 481 } 482 483 @Override 484 public Base setProperty(int hash, String name, Base value) throws FHIRException { 485 switch (hash) { 486 case -1413853096: // amount 487 this.amount = castToType(value); // Type 488 return value; 489 case -1424857166: // amountType 490 this.amountType = castToCodeableConcept(value); // CodeableConcept 491 return value; 492 case -1424876123: // amountText 493 this.amountText = castToString(value); // StringType 494 return value; 495 case -1912545102: // referenceRange 496 this.referenceRange = (SubstanceAmountReferenceRangeComponent) value; // SubstanceAmountReferenceRangeComponent 497 return value; 498 default: return super.setProperty(hash, name, value); 499 } 500 501 } 502 503 @Override 504 public Base setProperty(String name, Base value) throws FHIRException { 505 if (name.equals("amount[x]")) { 506 this.amount = castToType(value); // Type 507 } else if (name.equals("amountType")) { 508 this.amountType = castToCodeableConcept(value); // CodeableConcept 509 } else if (name.equals("amountText")) { 510 this.amountText = castToString(value); // StringType 511 } else if (name.equals("referenceRange")) { 512 this.referenceRange = (SubstanceAmountReferenceRangeComponent) value; // SubstanceAmountReferenceRangeComponent 513 } else 514 return super.setProperty(name, value); 515 return value; 516 } 517 518 @Override 519 public Base makeProperty(int hash, String name) throws FHIRException { 520 switch (hash) { 521 case 646780200: return getAmount(); 522 case -1413853096: return getAmount(); 523 case -1424857166: return getAmountType(); 524 case -1424876123: return getAmountTextElement(); 525 case -1912545102: return getReferenceRange(); 526 default: return super.makeProperty(hash, name); 527 } 528 529 } 530 531 @Override 532 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 533 switch (hash) { 534 case -1413853096: /*amount*/ return new String[] {"Quantity", "Range", "string"}; 535 case -1424857166: /*amountType*/ return new String[] {"CodeableConcept"}; 536 case -1424876123: /*amountText*/ return new String[] {"string"}; 537 case -1912545102: /*referenceRange*/ return new String[] {}; 538 default: return super.getTypesForProperty(hash, name); 539 } 540 541 } 542 543 @Override 544 public Base addChild(String name) throws FHIRException { 545 if (name.equals("amountQuantity")) { 546 this.amount = new Quantity(); 547 return this.amount; 548 } 549 else if (name.equals("amountRange")) { 550 this.amount = new Range(); 551 return this.amount; 552 } 553 else if (name.equals("amountString")) { 554 this.amount = new StringType(); 555 return this.amount; 556 } 557 else if (name.equals("amountType")) { 558 this.amountType = new CodeableConcept(); 559 return this.amountType; 560 } 561 else if (name.equals("amountText")) { 562 throw new FHIRException("Cannot call addChild on a primitive type SubstanceAmount.amountText"); 563 } 564 else if (name.equals("referenceRange")) { 565 this.referenceRange = new SubstanceAmountReferenceRangeComponent(); 566 return this.referenceRange; 567 } 568 else 569 return super.addChild(name); 570 } 571 572 public String fhirType() { 573 return "SubstanceAmount"; 574 575 } 576 577 public SubstanceAmount copy() { 578 SubstanceAmount dst = new SubstanceAmount(); 579 copyValues(dst); 580 dst.amount = amount == null ? null : amount.copy(); 581 dst.amountType = amountType == null ? null : amountType.copy(); 582 dst.amountText = amountText == null ? null : amountText.copy(); 583 dst.referenceRange = referenceRange == null ? null : referenceRange.copy(); 584 return dst; 585 } 586 587 protected SubstanceAmount typedCopy() { 588 return copy(); 589 } 590 591 @Override 592 public boolean equalsDeep(Base other_) { 593 if (!super.equalsDeep(other_)) 594 return false; 595 if (!(other_ instanceof SubstanceAmount)) 596 return false; 597 SubstanceAmount o = (SubstanceAmount) other_; 598 return compareDeep(amount, o.amount, true) && compareDeep(amountType, o.amountType, true) && compareDeep(amountText, o.amountText, true) 599 && compareDeep(referenceRange, o.referenceRange, true); 600 } 601 602 @Override 603 public boolean equalsShallow(Base other_) { 604 if (!super.equalsShallow(other_)) 605 return false; 606 if (!(other_ instanceof SubstanceAmount)) 607 return false; 608 SubstanceAmount o = (SubstanceAmount) other_; 609 return compareValues(amountText, o.amountText, true); 610 } 611 612 public boolean isEmpty() { 613 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(amount, amountType, amountText 614 , referenceRange); 615 } 616 617 618} 619