
001package org.hl7.fhir.r5.openehr; 002 003 004/* 005 Copyright (c) 2011+, HL7, Inc. 006 All rights reserved. 007 008 Redistribution and use in source and binary forms, with or without modification, \ 009 are permitted provided that the following conditions are met: 010 011 * Redistributions of source code must retain the above copyright notice, this \ 012 list of conditions and the following disclaimer. 013 * Redistributions in binary form must reproduce the above copyright notice, \ 014 this list of conditions and the following disclaimer in the documentation \ 015 and/or other materials provided with the distribution. 016 * Neither the name of HL7 nor the names of its contributors may be used to 017 endorse or promote products derived from this software without specific 018 prior written permission. 019 020 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 021 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 022 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 023 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 024 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 025 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 026 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 027 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 028 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 029 POSSIBILITY OF SUCH DAMAGE. 030 */ 031 032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0 033 034import java.util.ArrayList; 035import java.util.Date; 036import java.util.List; 037import java.math.*; 038import org.hl7.fhir.utilities.Utilities; 039import org.hl7.fhir.r5.openehr.Enumerations.*; 040import org.hl7.fhir.exceptions.FHIRException; 041import org.hl7.fhir.r5.model.*; 042import org.hl7.fhir.instance.model.api.ICompositeType; 043import ca.uhn.fhir.model.api.annotation.Child; 044import ca.uhn.fhir.model.api.annotation.ChildOrder; 045import ca.uhn.fhir.model.api.annotation.DatatypeDef; 046import ca.uhn.fhir.model.api.annotation.Description; 047import ca.uhn.fhir.model.api.annotation.Block; 048 049/** 050 * Quantitified type representing scientific quantities, i.e. quantities expressed as a magnitude and units. Units are expressed in the UCUM syntax (Unified Code for Units of Measure (UCUM), by Gunther Schadow and Clement J. McDonald of The Regenstrief Institute) (case-sensitive form) by default, or another system if units_system is set. 051 052Can also be used for time durations, where it is more convenient to treat these as simply a number of seconds rather than days, months, years (in the latter case, DV_DURATION may be used). 053 */ 054@DatatypeDef(name="DV_QUANTITY") 055public class DV_QUANTITY extends DV_AMOUNT implements ICompositeType { 056 057 /** 058 * Numeric magnitude of the quantity. 059 */ 060 @Child(name = "magnitude", type = {DecimalType.class}, order=0, min=1, max=1, modifier=false, summary=false) 061 @Description(shortDefinition="Numeric magnitude of the quantity", formalDefinition="Numeric magnitude of the quantity." ) 062 protected DecimalType magnitude; 063 064 /** 065 * Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places 066 */ 067 @Child(name = "precision", type = {IntegerType.class}, order=1, min=0, max=1, modifier=false, summary=false) 068 @Description(shortDefinition="Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places", formalDefinition="Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places" ) 069 protected IntegerType precision; 070 071 /** 072 * Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in units_system, when set. 073 074In either case, the value is the code or syntax - normally formed of standard ASCII - which is in principal not the same as the display string, although in simple cases such as 'm' (for meters) it will be. 075 076If the units_display_name field is set, this may be used for display. If not, the implementations must effect the resolution of the units value to a display form locally, e.g. by lookup of reference tables, request to a terminology service etc. 077 078 079Example values from UCUM: 'kg/m^2', 'mm[Hg]', 'ms-1', 'km/h' 080 */ 081 @Child(name = "units", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=false) 082 @Description(shortDefinition="Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in units_system, when set", formalDefinition="Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in units_system, when set.\r\n\r\nIn either case, the value is the code or syntax - normally formed of standard ASCII - which is in principal not the same as the display string, although in simple cases such as 'm' (for meters) it will be.\r\n\r\nIf the units_display_name field is set, this may be used for display. If not, the implementations must effect the resolution of the units value to a display form locally, e.g. by lookup of reference tables, request to a terminology service etc.\r\n\r\n\r\nExample values from UCUM: 'kg/m^2', 'mm[Hg]', 'ms-1', 'km/h'" ) 083 protected StringType units; 084 085 /** 086 * Optional field used to specify a units system from which codes in units are defined. Value is a URI identifying a terminology containing units concepts from the (HL7 FHIR terminologies list). 087 088If not set, the UCUM standard (case-sensitive codes) is assumed as the units system. 089 */ 090 @Child(name = "units_system", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false) 091 @Description(shortDefinition="URI identifying a terminology containing units concepts (from the FHIR terminologies list). UCUM is default", formalDefinition="Optional field used to specify a units system from which codes in units are defined. Value is a URI identifying a terminology containing units concepts from the (HL7 FHIR terminologies list).\r\n\r\nIf not set, the UCUM standard (case-sensitive codes) is assumed as the units system." ) 092 protected StringType units_system; 093 094 /** 095 * Optional field containing the displayable form of the units field, e.g. '°C'. 096 097If not set, the application environment needs to determine the displayable form. 098 */ 099 @Child(name = "units_display_name", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false) 100 @Description(shortDefinition="Optional field containing the displayable form of the units field, e.g. '°C'", formalDefinition="Optional field containing the displayable form of the units field, e.g. '°C'.\r\n\r\nIf not set, the application environment needs to determine the displayable form." ) 101 protected StringType units_display_name; 102 103 private static final long serialVersionUID = -290777252L; 104 105 /** 106 * Constructor 107 */ 108 public DV_QUANTITY() { 109 super(); 110 } 111 112 /** 113 * Constructor 114 */ 115 public DV_QUANTITY(BigDecimal magnitude, String units) { 116 super(); 117 this.setMagnitude(magnitude); 118 this.setUnits(units); 119 } 120 121 /** 122 * @return {@link #magnitude} (Numeric magnitude of the quantity.). This is the underlying object with id, value and extensions. The accessor "getMagnitude" gives direct access to the value 123 */ 124 public DecimalType getMagnitudeElement() { 125 if (this.magnitude == null) 126 if (Configuration.errorOnAutoCreate()) 127 throw new Error("Attempt to auto-create DV_QUANTITY.magnitude"); 128 else if (Configuration.doAutoCreate()) 129 this.magnitude = new DecimalType(); // bb 130 return this.magnitude; 131 } 132 133 public boolean hasMagnitudeElement() { 134 return this.magnitude != null && !this.magnitude.isEmpty(); 135 } 136 137 public boolean hasMagnitude() { 138 return this.magnitude != null && !this.magnitude.isEmpty(); 139 } 140 141 /** 142 * @param value {@link #magnitude} (Numeric magnitude of the quantity.). This is the underlying object with id, value and extensions. The accessor "getMagnitude" gives direct access to the value 143 */ 144 public DV_QUANTITY setMagnitudeElement(DecimalType value) { 145 this.magnitude = value; 146 return this; 147 } 148 149 /** 150 * @return Numeric magnitude of the quantity. 151 */ 152 public BigDecimal getMagnitude() { 153 return this.magnitude == null ? null : this.magnitude.getValue(); 154 } 155 156 /** 157 * @param value Numeric magnitude of the quantity. 158 */ 159 public DV_QUANTITY setMagnitude(BigDecimal value) { 160 if (this.magnitude == null) 161 this.magnitude = new DecimalType(); 162 this.magnitude.setValue(value); 163 return this; 164 } 165 166 /** 167 * @param value Numeric magnitude of the quantity. 168 */ 169 public DV_QUANTITY setMagnitude(long value) { 170 this.magnitude = new DecimalType(); 171 this.magnitude.setValue(value); 172 return this; 173 } 174 175 /** 176 * @param value Numeric magnitude of the quantity. 177 */ 178 public DV_QUANTITY setMagnitude(double value) { 179 this.magnitude = new DecimalType(); 180 this.magnitude.setValue(value); 181 return this; 182 } 183 184 /** 185 * @return {@link #precision} (Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places). This is the underlying object with id, value and extensions. The accessor "getPrecision" gives direct access to the value 186 */ 187 public IntegerType getPrecisionElement() { 188 if (this.precision == null) 189 if (Configuration.errorOnAutoCreate()) 190 throw new Error("Attempt to auto-create DV_QUANTITY.precision"); 191 else if (Configuration.doAutoCreate()) 192 this.precision = new IntegerType(); // bb 193 return this.precision; 194 } 195 196 public boolean hasPrecisionElement() { 197 return this.precision != null && !this.precision.isEmpty(); 198 } 199 200 public boolean hasPrecision() { 201 return this.precision != null && !this.precision.isEmpty(); 202 } 203 204 /** 205 * @param value {@link #precision} (Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places). This is the underlying object with id, value and extensions. The accessor "getPrecision" gives direct access to the value 206 */ 207 public DV_QUANTITY setPrecisionElement(IntegerType value) { 208 this.precision = value; 209 return this; 210 } 211 212 /** 213 * @return Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places 214 */ 215 public int getPrecision() { 216 return this.precision == null || this.precision.isEmpty() ? 0 : this.precision.getValue(); 217 } 218 219 /** 220 * @param value Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places 221 */ 222 public DV_QUANTITY setPrecision(int value) { 223 if (this.precision == null) 224 this.precision = new IntegerType(); 225 this.precision.setValue(value); 226 return this; 227 } 228 229 /** 230 * @return {@link #units} (Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in units_system, when set. 231 232In either case, the value is the code or syntax - normally formed of standard ASCII - which is in principal not the same as the display string, although in simple cases such as 'm' (for meters) it will be. 233 234If the units_display_name field is set, this may be used for display. If not, the implementations must effect the resolution of the units value to a display form locally, e.g. by lookup of reference tables, request to a terminology service etc. 235 236 237Example values from UCUM: 'kg/m^2', 'mm[Hg]', 'ms-1', 'km/h'). This is the underlying object with id, value and extensions. The accessor "getUnits" gives direct access to the value 238 */ 239 public StringType getUnitsElement() { 240 if (this.units == null) 241 if (Configuration.errorOnAutoCreate()) 242 throw new Error("Attempt to auto-create DV_QUANTITY.units"); 243 else if (Configuration.doAutoCreate()) 244 this.units = new StringType(); // bb 245 return this.units; 246 } 247 248 public boolean hasUnitsElement() { 249 return this.units != null && !this.units.isEmpty(); 250 } 251 252 public boolean hasUnits() { 253 return this.units != null && !this.units.isEmpty(); 254 } 255 256 /** 257 * @param value {@link #units} (Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in units_system, when set. 258 259In either case, the value is the code or syntax - normally formed of standard ASCII - which is in principal not the same as the display string, although in simple cases such as 'm' (for meters) it will be. 260 261If the units_display_name field is set, this may be used for display. If not, the implementations must effect the resolution of the units value to a display form locally, e.g. by lookup of reference tables, request to a terminology service etc. 262 263 264Example values from UCUM: 'kg/m^2', 'mm[Hg]', 'ms-1', 'km/h'). This is the underlying object with id, value and extensions. The accessor "getUnits" gives direct access to the value 265 */ 266 public DV_QUANTITY setUnitsElement(StringType value) { 267 this.units = value; 268 return this; 269 } 270 271 /** 272 * @return Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in units_system, when set. 273 274In either case, the value is the code or syntax - normally formed of standard ASCII - which is in principal not the same as the display string, although in simple cases such as 'm' (for meters) it will be. 275 276If the units_display_name field is set, this may be used for display. If not, the implementations must effect the resolution of the units value to a display form locally, e.g. by lookup of reference tables, request to a terminology service etc. 277 278 279Example values from UCUM: 'kg/m^2', 'mm[Hg]', 'ms-1', 'km/h' 280 */ 281 public String getUnits() { 282 return this.units == null ? null : this.units.getValue(); 283 } 284 285 /** 286 * @param value Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in units_system, when set. 287 288In either case, the value is the code or syntax - normally formed of standard ASCII - which is in principal not the same as the display string, although in simple cases such as 'm' (for meters) it will be. 289 290If the units_display_name field is set, this may be used for display. If not, the implementations must effect the resolution of the units value to a display form locally, e.g. by lookup of reference tables, request to a terminology service etc. 291 292 293Example values from UCUM: 'kg/m^2', 'mm[Hg]', 'ms-1', 'km/h' 294 */ 295 public DV_QUANTITY setUnits(String value) { 296 if (this.units == null) 297 this.units = new StringType(); 298 this.units.setValue(value); 299 return this; 300 } 301 302 /** 303 * @return {@link #units_system} (Optional field used to specify a units system from which codes in units are defined. Value is a URI identifying a terminology containing units concepts from the (HL7 FHIR terminologies list). 304 305If not set, the UCUM standard (case-sensitive codes) is assumed as the units system.). This is the underlying object with id, value and extensions. The accessor "getUnits_system" gives direct access to the value 306 */ 307 public StringType getUnits_systemElement() { 308 if (this.units_system == null) 309 if (Configuration.errorOnAutoCreate()) 310 throw new Error("Attempt to auto-create DV_QUANTITY.units_system"); 311 else if (Configuration.doAutoCreate()) 312 this.units_system = new StringType(); // bb 313 return this.units_system; 314 } 315 316 public boolean hasUnits_systemElement() { 317 return this.units_system != null && !this.units_system.isEmpty(); 318 } 319 320 public boolean hasUnits_system() { 321 return this.units_system != null && !this.units_system.isEmpty(); 322 } 323 324 /** 325 * @param value {@link #units_system} (Optional field used to specify a units system from which codes in units are defined. Value is a URI identifying a terminology containing units concepts from the (HL7 FHIR terminologies list). 326 327If not set, the UCUM standard (case-sensitive codes) is assumed as the units system.). This is the underlying object with id, value and extensions. The accessor "getUnits_system" gives direct access to the value 328 */ 329 public DV_QUANTITY setUnits_systemElement(StringType value) { 330 this.units_system = value; 331 return this; 332 } 333 334 /** 335 * @return Optional field used to specify a units system from which codes in units are defined. Value is a URI identifying a terminology containing units concepts from the (HL7 FHIR terminologies list). 336 337If not set, the UCUM standard (case-sensitive codes) is assumed as the units system. 338 */ 339 public String getUnits_system() { 340 return this.units_system == null ? null : this.units_system.getValue(); 341 } 342 343 /** 344 * @param value Optional field used to specify a units system from which codes in units are defined. Value is a URI identifying a terminology containing units concepts from the (HL7 FHIR terminologies list). 345 346If not set, the UCUM standard (case-sensitive codes) is assumed as the units system. 347 */ 348 public DV_QUANTITY setUnits_system(String value) { 349 if (Utilities.noString(value)) 350 this.units_system = null; 351 else { 352 if (this.units_system == null) 353 this.units_system = new StringType(); 354 this.units_system.setValue(value); 355 } 356 return this; 357 } 358 359 /** 360 * @return {@link #units_display_name} (Optional field containing the displayable form of the units field, e.g. '°C'. 361 362If not set, the application environment needs to determine the displayable form.). This is the underlying object with id, value and extensions. The accessor "getUnits_display_name" gives direct access to the value 363 */ 364 public StringType getUnits_display_nameElement() { 365 if (this.units_display_name == null) 366 if (Configuration.errorOnAutoCreate()) 367 throw new Error("Attempt to auto-create DV_QUANTITY.units_display_name"); 368 else if (Configuration.doAutoCreate()) 369 this.units_display_name = new StringType(); // bb 370 return this.units_display_name; 371 } 372 373 public boolean hasUnits_display_nameElement() { 374 return this.units_display_name != null && !this.units_display_name.isEmpty(); 375 } 376 377 public boolean hasUnits_display_name() { 378 return this.units_display_name != null && !this.units_display_name.isEmpty(); 379 } 380 381 /** 382 * @param value {@link #units_display_name} (Optional field containing the displayable form of the units field, e.g. '°C'. 383 384If not set, the application environment needs to determine the displayable form.). This is the underlying object with id, value and extensions. The accessor "getUnits_display_name" gives direct access to the value 385 */ 386 public DV_QUANTITY setUnits_display_nameElement(StringType value) { 387 this.units_display_name = value; 388 return this; 389 } 390 391 /** 392 * @return Optional field containing the displayable form of the units field, e.g. '°C'. 393 394If not set, the application environment needs to determine the displayable form. 395 */ 396 public String getUnits_display_name() { 397 return this.units_display_name == null ? null : this.units_display_name.getValue(); 398 } 399 400 /** 401 * @param value Optional field containing the displayable form of the units field, e.g. '°C'. 402 403If not set, the application environment needs to determine the displayable form. 404 */ 405 public DV_QUANTITY setUnits_display_name(String value) { 406 if (Utilities.noString(value)) 407 this.units_display_name = null; 408 else { 409 if (this.units_display_name == null) 410 this.units_display_name = new StringType(); 411 this.units_display_name.setValue(value); 412 } 413 return this; 414 } 415 416 protected void listChildren(List<Property> children) { 417 super.listChildren(children); 418 children.add(new Property("magnitude", "decimal", "Numeric magnitude of the quantity.", 0, 1, magnitude)); 419 children.add(new Property("precision", "integer", "Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places", 0, 1, precision)); 420 children.add(new Property("units", "string", "Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in units_system, when set.\r\n\r\nIn either case, the value is the code or syntax - normally formed of standard ASCII - which is in principal not the same as the display string, although in simple cases such as 'm' (for meters) it will be.\r\n\r\nIf the units_display_name field is set, this may be used for display. If not, the implementations must effect the resolution of the units value to a display form locally, e.g. by lookup of reference tables, request to a terminology service etc.\r\n\r\n\r\nExample values from UCUM: 'kg/m^2', 'mm[Hg]', 'ms-1', 'km/h'", 0, 1, units)); 421 children.add(new Property("units_system", "string", "Optional field used to specify a units system from which codes in units are defined. Value is a URI identifying a terminology containing units concepts from the (HL7 FHIR terminologies list).\r\n\r\nIf not set, the UCUM standard (case-sensitive codes) is assumed as the units system.", 0, 1, units_system)); 422 children.add(new Property("units_display_name", "string", "Optional field containing the displayable form of the units field, e.g. '°C'.\r\n\r\nIf not set, the application environment needs to determine the displayable form.", 0, 1, units_display_name)); 423 } 424 425 @Override 426 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 427 switch (_hash) { 428 case -2016783856: /*magnitude*/ return new Property("magnitude", "decimal", "Numeric magnitude of the quantity.", 0, 1, magnitude); 429 case -1376177026: /*precision*/ return new Property("precision", "integer", "Precision to which the value of the quantity is expressed, in terms of number of decimal places. The value 0 implies an integral quantity. The value -1 implies no limit, i.e. any number of decimal places", 0, 1, precision); 430 case 111433583: /*units*/ return new Property("units", "string", "Quantity units, expressed as a code or syntax string from either UCUM (the default) or the units system specified in units_system, when set.\r\n\r\nIn either case, the value is the code or syntax - normally formed of standard ASCII - which is in principal not the same as the display string, although in simple cases such as 'm' (for meters) it will be.\r\n\r\nIf the units_display_name field is set, this may be used for display. If not, the implementations must effect the resolution of the units value to a display form locally, e.g. by lookup of reference tables, request to a terminology service etc.\r\n\r\n\r\nExample values from UCUM: 'kg/m^2', 'mm[Hg]', 'ms-1', 'km/h'", 0, 1, units); 431 case -162878209: /*units_system*/ return new Property("units_system", "string", "Optional field used to specify a units system from which codes in units are defined. Value is a URI identifying a terminology containing units concepts from the (HL7 FHIR terminologies list).\r\n\r\nIf not set, the UCUM standard (case-sensitive codes) is assumed as the units system.", 0, 1, units_system); 432 case 359604920: /*units_display_name*/ return new Property("units_display_name", "string", "Optional field containing the displayable form of the units field, e.g. '°C'.\r\n\r\nIf not set, the application environment needs to determine the displayable form.", 0, 1, units_display_name); 433 default: return super.getNamedProperty(_hash, _name, _checkValid); 434 } 435 436 } 437 438 @Override 439 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 440 switch (hash) { 441 case -2016783856: /*magnitude*/ return this.magnitude == null ? new Base[0] : new Base[] {this.magnitude}; // DecimalType 442 case -1376177026: /*precision*/ return this.precision == null ? new Base[0] : new Base[] {this.precision}; // IntegerType 443 case 111433583: /*units*/ return this.units == null ? new Base[0] : new Base[] {this.units}; // StringType 444 case -162878209: /*units_system*/ return this.units_system == null ? new Base[0] : new Base[] {this.units_system}; // StringType 445 case 359604920: /*units_display_name*/ return this.units_display_name == null ? new Base[0] : new Base[] {this.units_display_name}; // StringType 446 default: return super.getProperty(hash, name, checkValid); 447 } 448 449 } 450 451 @Override 452 public Base setProperty(int hash, String name, Base value) throws FHIRException { 453 switch (hash) { 454 case -2016783856: // magnitude 455 this.magnitude = TypeConvertor.castToDecimal(value); // DecimalType 456 return value; 457 case -1376177026: // precision 458 this.precision = TypeConvertor.castToInteger(value); // IntegerType 459 return value; 460 case 111433583: // units 461 this.units = TypeConvertor.castToString(value); // StringType 462 return value; 463 case -162878209: // units_system 464 this.units_system = TypeConvertor.castToString(value); // StringType 465 return value; 466 case 359604920: // units_display_name 467 this.units_display_name = TypeConvertor.castToString(value); // StringType 468 return value; 469 default: return super.setProperty(hash, name, value); 470 } 471 472 } 473 474 @Override 475 public Base setProperty(String name, Base value) throws FHIRException { 476 if (name.equals("magnitude")) { 477 this.magnitude = TypeConvertor.castToDecimal(value); // DecimalType 478 } else if (name.equals("precision")) { 479 this.precision = TypeConvertor.castToInteger(value); // IntegerType 480 } else if (name.equals("units")) { 481 this.units = TypeConvertor.castToString(value); // StringType 482 } else if (name.equals("units_system")) { 483 this.units_system = TypeConvertor.castToString(value); // StringType 484 } else if (name.equals("units_display_name")) { 485 this.units_display_name = TypeConvertor.castToString(value); // StringType 486 } else 487 return super.setProperty(name, value); 488 return value; 489 } 490 491 @Override 492 public Base makeProperty(int hash, String name) throws FHIRException { 493 switch (hash) { 494 case -2016783856: return getMagnitudeElement(); 495 case -1376177026: return getPrecisionElement(); 496 case 111433583: return getUnitsElement(); 497 case -162878209: return getUnits_systemElement(); 498 case 359604920: return getUnits_display_nameElement(); 499 default: return super.makeProperty(hash, name); 500 } 501 502 } 503 504 @Override 505 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 506 switch (hash) { 507 case -2016783856: /*magnitude*/ return new String[] {"decimal"}; 508 case -1376177026: /*precision*/ return new String[] {"integer"}; 509 case 111433583: /*units*/ return new String[] {"string"}; 510 case -162878209: /*units_system*/ return new String[] {"string"}; 511 case 359604920: /*units_display_name*/ return new String[] {"string"}; 512 default: return super.getTypesForProperty(hash, name); 513 } 514 515 } 516 517 @Override 518 public Base addChild(String name) throws FHIRException { 519 if (name.equals("magnitude")) { 520 throw new FHIRException("Cannot call addChild on a singleton property DV_QUANTITY.magnitude"); 521 } 522 else if (name.equals("precision")) { 523 throw new FHIRException("Cannot call addChild on a singleton property DV_QUANTITY.precision"); 524 } 525 else if (name.equals("units")) { 526 throw new FHIRException("Cannot call addChild on a singleton property DV_QUANTITY.units"); 527 } 528 else if (name.equals("units_system")) { 529 throw new FHIRException("Cannot call addChild on a singleton property DV_QUANTITY.units_system"); 530 } 531 else if (name.equals("units_display_name")) { 532 throw new FHIRException("Cannot call addChild on a singleton property DV_QUANTITY.units_display_name"); 533 } 534 else 535 return super.addChild(name); 536 } 537 538 public String fhirType() { 539 return "DV_QUANTITY"; 540 541 } 542 543 public DV_QUANTITY copy() { 544 DV_QUANTITY dst = new DV_QUANTITY(); 545 copyValues(dst); 546 return dst; 547 } 548 549 public void copyValues(DV_QUANTITY dst) { 550 super.copyValues(dst); 551 dst.magnitude = magnitude == null ? null : magnitude.copy(); 552 dst.precision = precision == null ? null : precision.copy(); 553 dst.units = units == null ? null : units.copy(); 554 dst.units_system = units_system == null ? null : units_system.copy(); 555 dst.units_display_name = units_display_name == null ? null : units_display_name.copy(); 556 } 557 558 protected DV_QUANTITY typedCopy() { 559 return copy(); 560 } 561 562 @Override 563 public boolean equalsDeep(Base other_) { 564 if (!super.equalsDeep(other_)) 565 return false; 566 if (!(other_ instanceof DV_QUANTITY)) 567 return false; 568 DV_QUANTITY o = (DV_QUANTITY) other_; 569 return compareDeep(magnitude, o.magnitude, true) && compareDeep(precision, o.precision, true) && compareDeep(units, o.units, true) 570 && compareDeep(units_system, o.units_system, true) && compareDeep(units_display_name, o.units_display_name, true) 571 ; 572 } 573 574 @Override 575 public boolean equalsShallow(Base other_) { 576 if (!super.equalsShallow(other_)) 577 return false; 578 if (!(other_ instanceof DV_QUANTITY)) 579 return false; 580 DV_QUANTITY o = (DV_QUANTITY) other_; 581 return compareValues(magnitude, o.magnitude, true) && compareValues(precision, o.precision, true) && compareValues(units, o.units, true) 582 && compareValues(units_system, o.units_system, true) && compareValues(units_display_name, o.units_display_name, true) 583 ; 584 } 585 586 public boolean isEmpty() { 587 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(magnitude, precision, units 588 , units_system, units_display_name); 589 } 590 591 592} 593