001package org.hl7.fhir.r5.model; 002 003 004 005 006/* 007 Copyright (c) 2011+, HL7, Inc. 008 All rights reserved. 009 010 Redistribution and use in source and binary forms, with or without modification, \ 011 are permitted provided that the following conditions are met: 012 013 * Redistributions of source code must retain the above copyright notice, this \ 014 list of conditions and the following disclaimer. 015 * Redistributions in binary form must reproduce the above copyright notice, \ 016 this list of conditions and the following disclaimer in the documentation \ 017 and/or other materials provided with the distribution. 018 * Neither the name of HL7 nor the names of its contributors may be used to 019 endorse or promote products derived from this software without specific 020 prior written permission. 021 022 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \ 023 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \ 024 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \ 025 IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \ 026 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \ 027 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \ 028 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \ 029 WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \ 030 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \ 031 POSSIBILITY OF SUCH DAMAGE. 032 */ 033 034// Generated on Mon, May 11, 2020 09:58+1000 for FHIR vcurrent 035 036import java.util.ArrayList; 037import java.util.Date; 038import java.util.List; 039import org.hl7.fhir.utilities.Utilities; 040import org.hl7.fhir.r5.model.Enumerations.*; 041import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 042import org.hl7.fhir.exceptions.FHIRException; 043import org.hl7.fhir.instance.model.api.ICompositeType; 044import ca.uhn.fhir.model.api.annotation.ResourceDef; 045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; 046import org.hl7.fhir.instance.model.api.IBaseBackboneElement; 047import ca.uhn.fhir.model.api.annotation.Child; 048import ca.uhn.fhir.model.api.annotation.ChildOrder; 049import ca.uhn.fhir.model.api.annotation.Description; 050import ca.uhn.fhir.model.api.annotation.Block; 051 052/** 053 * Todo. 054 */ 055@ResourceDef(name="SubstancePolymer", profile="http://hl7.org/fhir/StructureDefinition/SubstancePolymer") 056public class SubstancePolymer extends DomainResource { 057 058 @Block() 059 public static class SubstancePolymerMonomerSetComponent extends BackboneElement implements IBaseBackboneElement { 060 /** 061 * Todo. 062 */ 063 @Child(name = "ratioType", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 064 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 065 protected CodeableConcept ratioType; 066 067 /** 068 * Todo. 069 */ 070 @Child(name = "startingMaterial", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 071 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 072 protected List<SubstancePolymerMonomerSetStartingMaterialComponent> startingMaterial; 073 074 private static final long serialVersionUID = -933825014L; 075 076 /** 077 * Constructor 078 */ 079 public SubstancePolymerMonomerSetComponent() { 080 super(); 081 } 082 083 /** 084 * @return {@link #ratioType} (Todo.) 085 */ 086 public CodeableConcept getRatioType() { 087 if (this.ratioType == null) 088 if (Configuration.errorOnAutoCreate()) 089 throw new Error("Attempt to auto-create SubstancePolymerMonomerSetComponent.ratioType"); 090 else if (Configuration.doAutoCreate()) 091 this.ratioType = new CodeableConcept(); // cc 092 return this.ratioType; 093 } 094 095 public boolean hasRatioType() { 096 return this.ratioType != null && !this.ratioType.isEmpty(); 097 } 098 099 /** 100 * @param value {@link #ratioType} (Todo.) 101 */ 102 public SubstancePolymerMonomerSetComponent setRatioType(CodeableConcept value) { 103 this.ratioType = value; 104 return this; 105 } 106 107 /** 108 * @return {@link #startingMaterial} (Todo.) 109 */ 110 public List<SubstancePolymerMonomerSetStartingMaterialComponent> getStartingMaterial() { 111 if (this.startingMaterial == null) 112 this.startingMaterial = new ArrayList<SubstancePolymerMonomerSetStartingMaterialComponent>(); 113 return this.startingMaterial; 114 } 115 116 /** 117 * @return Returns a reference to <code>this</code> for easy method chaining 118 */ 119 public SubstancePolymerMonomerSetComponent setStartingMaterial(List<SubstancePolymerMonomerSetStartingMaterialComponent> theStartingMaterial) { 120 this.startingMaterial = theStartingMaterial; 121 return this; 122 } 123 124 public boolean hasStartingMaterial() { 125 if (this.startingMaterial == null) 126 return false; 127 for (SubstancePolymerMonomerSetStartingMaterialComponent item : this.startingMaterial) 128 if (!item.isEmpty()) 129 return true; 130 return false; 131 } 132 133 public SubstancePolymerMonomerSetStartingMaterialComponent addStartingMaterial() { //3 134 SubstancePolymerMonomerSetStartingMaterialComponent t = new SubstancePolymerMonomerSetStartingMaterialComponent(); 135 if (this.startingMaterial == null) 136 this.startingMaterial = new ArrayList<SubstancePolymerMonomerSetStartingMaterialComponent>(); 137 this.startingMaterial.add(t); 138 return t; 139 } 140 141 public SubstancePolymerMonomerSetComponent addStartingMaterial(SubstancePolymerMonomerSetStartingMaterialComponent t) { //3 142 if (t == null) 143 return this; 144 if (this.startingMaterial == null) 145 this.startingMaterial = new ArrayList<SubstancePolymerMonomerSetStartingMaterialComponent>(); 146 this.startingMaterial.add(t); 147 return this; 148 } 149 150 /** 151 * @return The first repetition of repeating field {@link #startingMaterial}, creating it if it does not already exist {3} 152 */ 153 public SubstancePolymerMonomerSetStartingMaterialComponent getStartingMaterialFirstRep() { 154 if (getStartingMaterial().isEmpty()) { 155 addStartingMaterial(); 156 } 157 return getStartingMaterial().get(0); 158 } 159 160 protected void listChildren(List<Property> children) { 161 super.listChildren(children); 162 children.add(new Property("ratioType", "CodeableConcept", "Todo.", 0, 1, ratioType)); 163 children.add(new Property("startingMaterial", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, startingMaterial)); 164 } 165 166 @Override 167 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 168 switch (_hash) { 169 case 344937957: /*ratioType*/ return new Property("ratioType", "CodeableConcept", "Todo.", 0, 1, ratioType); 170 case 442919303: /*startingMaterial*/ return new Property("startingMaterial", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, startingMaterial); 171 default: return super.getNamedProperty(_hash, _name, _checkValid); 172 } 173 174 } 175 176 @Override 177 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 178 switch (hash) { 179 case 344937957: /*ratioType*/ return this.ratioType == null ? new Base[0] : new Base[] {this.ratioType}; // CodeableConcept 180 case 442919303: /*startingMaterial*/ return this.startingMaterial == null ? new Base[0] : this.startingMaterial.toArray(new Base[this.startingMaterial.size()]); // SubstancePolymerMonomerSetStartingMaterialComponent 181 default: return super.getProperty(hash, name, checkValid); 182 } 183 184 } 185 186 @Override 187 public Base setProperty(int hash, String name, Base value) throws FHIRException { 188 switch (hash) { 189 case 344937957: // ratioType 190 this.ratioType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 191 return value; 192 case 442919303: // startingMaterial 193 this.getStartingMaterial().add((SubstancePolymerMonomerSetStartingMaterialComponent) value); // SubstancePolymerMonomerSetStartingMaterialComponent 194 return value; 195 default: return super.setProperty(hash, name, value); 196 } 197 198 } 199 200 @Override 201 public Base setProperty(String name, Base value) throws FHIRException { 202 if (name.equals("ratioType")) { 203 this.ratioType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 204 } else if (name.equals("startingMaterial")) { 205 this.getStartingMaterial().add((SubstancePolymerMonomerSetStartingMaterialComponent) value); 206 } else 207 return super.setProperty(name, value); 208 return value; 209 } 210 211 @Override 212 public Base makeProperty(int hash, String name) throws FHIRException { 213 switch (hash) { 214 case 344937957: return getRatioType(); 215 case 442919303: return addStartingMaterial(); 216 default: return super.makeProperty(hash, name); 217 } 218 219 } 220 221 @Override 222 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 223 switch (hash) { 224 case 344937957: /*ratioType*/ return new String[] {"CodeableConcept"}; 225 case 442919303: /*startingMaterial*/ return new String[] {}; 226 default: return super.getTypesForProperty(hash, name); 227 } 228 229 } 230 231 @Override 232 public Base addChild(String name) throws FHIRException { 233 if (name.equals("ratioType")) { 234 this.ratioType = new CodeableConcept(); 235 return this.ratioType; 236 } 237 else if (name.equals("startingMaterial")) { 238 return addStartingMaterial(); 239 } 240 else 241 return super.addChild(name); 242 } 243 244 public SubstancePolymerMonomerSetComponent copy() { 245 SubstancePolymerMonomerSetComponent dst = new SubstancePolymerMonomerSetComponent(); 246 copyValues(dst); 247 return dst; 248 } 249 250 public void copyValues(SubstancePolymerMonomerSetComponent dst) { 251 super.copyValues(dst); 252 dst.ratioType = ratioType == null ? null : ratioType.copy(); 253 if (startingMaterial != null) { 254 dst.startingMaterial = new ArrayList<SubstancePolymerMonomerSetStartingMaterialComponent>(); 255 for (SubstancePolymerMonomerSetStartingMaterialComponent i : startingMaterial) 256 dst.startingMaterial.add(i.copy()); 257 }; 258 } 259 260 @Override 261 public boolean equalsDeep(Base other_) { 262 if (!super.equalsDeep(other_)) 263 return false; 264 if (!(other_ instanceof SubstancePolymerMonomerSetComponent)) 265 return false; 266 SubstancePolymerMonomerSetComponent o = (SubstancePolymerMonomerSetComponent) other_; 267 return compareDeep(ratioType, o.ratioType, true) && compareDeep(startingMaterial, o.startingMaterial, true) 268 ; 269 } 270 271 @Override 272 public boolean equalsShallow(Base other_) { 273 if (!super.equalsShallow(other_)) 274 return false; 275 if (!(other_ instanceof SubstancePolymerMonomerSetComponent)) 276 return false; 277 SubstancePolymerMonomerSetComponent o = (SubstancePolymerMonomerSetComponent) other_; 278 return true; 279 } 280 281 public boolean isEmpty() { 282 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(ratioType, startingMaterial 283 ); 284 } 285 286 public String fhirType() { 287 return "SubstancePolymer.monomerSet"; 288 289 } 290 291 } 292 293 @Block() 294 public static class SubstancePolymerMonomerSetStartingMaterialComponent extends BackboneElement implements IBaseBackboneElement { 295 /** 296 * Todo. 297 */ 298 @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 299 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 300 protected CodeableConcept code; 301 302 /** 303 * Todo. 304 */ 305 @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 306 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 307 protected CodeableConcept category; 308 309 /** 310 * Todo. 311 */ 312 @Child(name = "isDefining", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true) 313 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 314 protected BooleanType isDefining; 315 316 /** 317 * Todo. 318 */ 319 @Child(name = "amount", type = {SubstanceAmount.class}, order=4, min=0, max=1, modifier=false, summary=true) 320 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 321 protected SubstanceAmount amount; 322 323 private static final long serialVersionUID = -254439457L; 324 325 /** 326 * Constructor 327 */ 328 public SubstancePolymerMonomerSetStartingMaterialComponent() { 329 super(); 330 } 331 332 /** 333 * @return {@link #code} (Todo.) 334 */ 335 public CodeableConcept getCode() { 336 if (this.code == null) 337 if (Configuration.errorOnAutoCreate()) 338 throw new Error("Attempt to auto-create SubstancePolymerMonomerSetStartingMaterialComponent.code"); 339 else if (Configuration.doAutoCreate()) 340 this.code = new CodeableConcept(); // cc 341 return this.code; 342 } 343 344 public boolean hasCode() { 345 return this.code != null && !this.code.isEmpty(); 346 } 347 348 /** 349 * @param value {@link #code} (Todo.) 350 */ 351 public SubstancePolymerMonomerSetStartingMaterialComponent setCode(CodeableConcept value) { 352 this.code = value; 353 return this; 354 } 355 356 /** 357 * @return {@link #category} (Todo.) 358 */ 359 public CodeableConcept getCategory() { 360 if (this.category == null) 361 if (Configuration.errorOnAutoCreate()) 362 throw new Error("Attempt to auto-create SubstancePolymerMonomerSetStartingMaterialComponent.category"); 363 else if (Configuration.doAutoCreate()) 364 this.category = new CodeableConcept(); // cc 365 return this.category; 366 } 367 368 public boolean hasCategory() { 369 return this.category != null && !this.category.isEmpty(); 370 } 371 372 /** 373 * @param value {@link #category} (Todo.) 374 */ 375 public SubstancePolymerMonomerSetStartingMaterialComponent setCategory(CodeableConcept value) { 376 this.category = value; 377 return this; 378 } 379 380 /** 381 * @return {@link #isDefining} (Todo.). This is the underlying object with id, value and extensions. The accessor "getIsDefining" gives direct access to the value 382 */ 383 public BooleanType getIsDefiningElement() { 384 if (this.isDefining == null) 385 if (Configuration.errorOnAutoCreate()) 386 throw new Error("Attempt to auto-create SubstancePolymerMonomerSetStartingMaterialComponent.isDefining"); 387 else if (Configuration.doAutoCreate()) 388 this.isDefining = new BooleanType(); // bb 389 return this.isDefining; 390 } 391 392 public boolean hasIsDefiningElement() { 393 return this.isDefining != null && !this.isDefining.isEmpty(); 394 } 395 396 public boolean hasIsDefining() { 397 return this.isDefining != null && !this.isDefining.isEmpty(); 398 } 399 400 /** 401 * @param value {@link #isDefining} (Todo.). This is the underlying object with id, value and extensions. The accessor "getIsDefining" gives direct access to the value 402 */ 403 public SubstancePolymerMonomerSetStartingMaterialComponent setIsDefiningElement(BooleanType value) { 404 this.isDefining = value; 405 return this; 406 } 407 408 /** 409 * @return Todo. 410 */ 411 public boolean getIsDefining() { 412 return this.isDefining == null || this.isDefining.isEmpty() ? false : this.isDefining.getValue(); 413 } 414 415 /** 416 * @param value Todo. 417 */ 418 public SubstancePolymerMonomerSetStartingMaterialComponent setIsDefining(boolean value) { 419 if (this.isDefining == null) 420 this.isDefining = new BooleanType(); 421 this.isDefining.setValue(value); 422 return this; 423 } 424 425 /** 426 * @return {@link #amount} (Todo.) 427 */ 428 public SubstanceAmount getAmount() { 429 if (this.amount == null) 430 if (Configuration.errorOnAutoCreate()) 431 throw new Error("Attempt to auto-create SubstancePolymerMonomerSetStartingMaterialComponent.amount"); 432 else if (Configuration.doAutoCreate()) 433 this.amount = new SubstanceAmount(); // cc 434 return this.amount; 435 } 436 437 public boolean hasAmount() { 438 return this.amount != null && !this.amount.isEmpty(); 439 } 440 441 /** 442 * @param value {@link #amount} (Todo.) 443 */ 444 public SubstancePolymerMonomerSetStartingMaterialComponent setAmount(SubstanceAmount value) { 445 this.amount = value; 446 return this; 447 } 448 449 protected void listChildren(List<Property> children) { 450 super.listChildren(children); 451 children.add(new Property("code", "CodeableConcept", "Todo.", 0, 1, code)); 452 children.add(new Property("category", "CodeableConcept", "Todo.", 0, 1, category)); 453 children.add(new Property("isDefining", "boolean", "Todo.", 0, 1, isDefining)); 454 children.add(new Property("amount", "SubstanceAmount", "Todo.", 0, 1, amount)); 455 } 456 457 @Override 458 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 459 switch (_hash) { 460 case 3059181: /*code*/ return new Property("code", "CodeableConcept", "Todo.", 0, 1, code); 461 case 50511102: /*category*/ return new Property("category", "CodeableConcept", "Todo.", 0, 1, category); 462 case -141812990: /*isDefining*/ return new Property("isDefining", "boolean", "Todo.", 0, 1, isDefining); 463 case -1413853096: /*amount*/ return new Property("amount", "SubstanceAmount", "Todo.", 0, 1, amount); 464 default: return super.getNamedProperty(_hash, _name, _checkValid); 465 } 466 467 } 468 469 @Override 470 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 471 switch (hash) { 472 case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept 473 case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept 474 case -141812990: /*isDefining*/ return this.isDefining == null ? new Base[0] : new Base[] {this.isDefining}; // BooleanType 475 case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // SubstanceAmount 476 default: return super.getProperty(hash, name, checkValid); 477 } 478 479 } 480 481 @Override 482 public Base setProperty(int hash, String name, Base value) throws FHIRException { 483 switch (hash) { 484 case 3059181: // code 485 this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 486 return value; 487 case 50511102: // category 488 this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 489 return value; 490 case -141812990: // isDefining 491 this.isDefining = TypeConvertor.castToBoolean(value); // BooleanType 492 return value; 493 case -1413853096: // amount 494 this.amount = TypeConvertor.castToSubstanceAmount(value); // SubstanceAmount 495 return value; 496 default: return super.setProperty(hash, name, value); 497 } 498 499 } 500 501 @Override 502 public Base setProperty(String name, Base value) throws FHIRException { 503 if (name.equals("code")) { 504 this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 505 } else if (name.equals("category")) { 506 this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 507 } else if (name.equals("isDefining")) { 508 this.isDefining = TypeConvertor.castToBoolean(value); // BooleanType 509 } else if (name.equals("amount")) { 510 this.amount = TypeConvertor.castToSubstanceAmount(value); // SubstanceAmount 511 } else 512 return super.setProperty(name, value); 513 return value; 514 } 515 516 @Override 517 public Base makeProperty(int hash, String name) throws FHIRException { 518 switch (hash) { 519 case 3059181: return getCode(); 520 case 50511102: return getCategory(); 521 case -141812990: return getIsDefiningElement(); 522 case -1413853096: return getAmount(); 523 default: return super.makeProperty(hash, name); 524 } 525 526 } 527 528 @Override 529 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 530 switch (hash) { 531 case 3059181: /*code*/ return new String[] {"CodeableConcept"}; 532 case 50511102: /*category*/ return new String[] {"CodeableConcept"}; 533 case -141812990: /*isDefining*/ return new String[] {"boolean"}; 534 case -1413853096: /*amount*/ return new String[] {"SubstanceAmount"}; 535 default: return super.getTypesForProperty(hash, name); 536 } 537 538 } 539 540 @Override 541 public Base addChild(String name) throws FHIRException { 542 if (name.equals("code")) { 543 this.code = new CodeableConcept(); 544 return this.code; 545 } 546 else if (name.equals("category")) { 547 this.category = new CodeableConcept(); 548 return this.category; 549 } 550 else if (name.equals("isDefining")) { 551 throw new FHIRException("Cannot call addChild on a primitive type SubstancePolymer.monomerSet.startingMaterial.isDefining"); 552 } 553 else if (name.equals("amount")) { 554 this.amount = new SubstanceAmount(); 555 return this.amount; 556 } 557 else 558 return super.addChild(name); 559 } 560 561 public SubstancePolymerMonomerSetStartingMaterialComponent copy() { 562 SubstancePolymerMonomerSetStartingMaterialComponent dst = new SubstancePolymerMonomerSetStartingMaterialComponent(); 563 copyValues(dst); 564 return dst; 565 } 566 567 public void copyValues(SubstancePolymerMonomerSetStartingMaterialComponent dst) { 568 super.copyValues(dst); 569 dst.code = code == null ? null : code.copy(); 570 dst.category = category == null ? null : category.copy(); 571 dst.isDefining = isDefining == null ? null : isDefining.copy(); 572 dst.amount = amount == null ? null : amount.copy(); 573 } 574 575 @Override 576 public boolean equalsDeep(Base other_) { 577 if (!super.equalsDeep(other_)) 578 return false; 579 if (!(other_ instanceof SubstancePolymerMonomerSetStartingMaterialComponent)) 580 return false; 581 SubstancePolymerMonomerSetStartingMaterialComponent o = (SubstancePolymerMonomerSetStartingMaterialComponent) other_; 582 return compareDeep(code, o.code, true) && compareDeep(category, o.category, true) && compareDeep(isDefining, o.isDefining, true) 583 && compareDeep(amount, o.amount, true); 584 } 585 586 @Override 587 public boolean equalsShallow(Base other_) { 588 if (!super.equalsShallow(other_)) 589 return false; 590 if (!(other_ instanceof SubstancePolymerMonomerSetStartingMaterialComponent)) 591 return false; 592 SubstancePolymerMonomerSetStartingMaterialComponent o = (SubstancePolymerMonomerSetStartingMaterialComponent) other_; 593 return compareValues(isDefining, o.isDefining, true); 594 } 595 596 public boolean isEmpty() { 597 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, category, isDefining 598 , amount); 599 } 600 601 public String fhirType() { 602 return "SubstancePolymer.monomerSet.startingMaterial"; 603 604 } 605 606 } 607 608 @Block() 609 public static class SubstancePolymerRepeatComponent extends BackboneElement implements IBaseBackboneElement { 610 /** 611 * Todo. 612 */ 613 @Child(name = "numberOfUnits", type = {IntegerType.class}, order=1, min=0, max=1, modifier=false, summary=true) 614 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 615 protected IntegerType numberOfUnits; 616 617 /** 618 * Todo. 619 */ 620 @Child(name = "averageMolecularFormula", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true) 621 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 622 protected StringType averageMolecularFormula; 623 624 /** 625 * Todo. 626 */ 627 @Child(name = "repeatUnitAmountType", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 628 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 629 protected CodeableConcept repeatUnitAmountType; 630 631 /** 632 * Todo. 633 */ 634 @Child(name = "repeatUnit", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 635 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 636 protected List<SubstancePolymerRepeatRepeatUnitComponent> repeatUnit; 637 638 private static final long serialVersionUID = -988147059L; 639 640 /** 641 * Constructor 642 */ 643 public SubstancePolymerRepeatComponent() { 644 super(); 645 } 646 647 /** 648 * @return {@link #numberOfUnits} (Todo.). This is the underlying object with id, value and extensions. The accessor "getNumberOfUnits" gives direct access to the value 649 */ 650 public IntegerType getNumberOfUnitsElement() { 651 if (this.numberOfUnits == null) 652 if (Configuration.errorOnAutoCreate()) 653 throw new Error("Attempt to auto-create SubstancePolymerRepeatComponent.numberOfUnits"); 654 else if (Configuration.doAutoCreate()) 655 this.numberOfUnits = new IntegerType(); // bb 656 return this.numberOfUnits; 657 } 658 659 public boolean hasNumberOfUnitsElement() { 660 return this.numberOfUnits != null && !this.numberOfUnits.isEmpty(); 661 } 662 663 public boolean hasNumberOfUnits() { 664 return this.numberOfUnits != null && !this.numberOfUnits.isEmpty(); 665 } 666 667 /** 668 * @param value {@link #numberOfUnits} (Todo.). This is the underlying object with id, value and extensions. The accessor "getNumberOfUnits" gives direct access to the value 669 */ 670 public SubstancePolymerRepeatComponent setNumberOfUnitsElement(IntegerType value) { 671 this.numberOfUnits = value; 672 return this; 673 } 674 675 /** 676 * @return Todo. 677 */ 678 public int getNumberOfUnits() { 679 return this.numberOfUnits == null || this.numberOfUnits.isEmpty() ? 0 : this.numberOfUnits.getValue(); 680 } 681 682 /** 683 * @param value Todo. 684 */ 685 public SubstancePolymerRepeatComponent setNumberOfUnits(int value) { 686 if (this.numberOfUnits == null) 687 this.numberOfUnits = new IntegerType(); 688 this.numberOfUnits.setValue(value); 689 return this; 690 } 691 692 /** 693 * @return {@link #averageMolecularFormula} (Todo.). This is the underlying object with id, value and extensions. The accessor "getAverageMolecularFormula" gives direct access to the value 694 */ 695 public StringType getAverageMolecularFormulaElement() { 696 if (this.averageMolecularFormula == null) 697 if (Configuration.errorOnAutoCreate()) 698 throw new Error("Attempt to auto-create SubstancePolymerRepeatComponent.averageMolecularFormula"); 699 else if (Configuration.doAutoCreate()) 700 this.averageMolecularFormula = new StringType(); // bb 701 return this.averageMolecularFormula; 702 } 703 704 public boolean hasAverageMolecularFormulaElement() { 705 return this.averageMolecularFormula != null && !this.averageMolecularFormula.isEmpty(); 706 } 707 708 public boolean hasAverageMolecularFormula() { 709 return this.averageMolecularFormula != null && !this.averageMolecularFormula.isEmpty(); 710 } 711 712 /** 713 * @param value {@link #averageMolecularFormula} (Todo.). This is the underlying object with id, value and extensions. The accessor "getAverageMolecularFormula" gives direct access to the value 714 */ 715 public SubstancePolymerRepeatComponent setAverageMolecularFormulaElement(StringType value) { 716 this.averageMolecularFormula = value; 717 return this; 718 } 719 720 /** 721 * @return Todo. 722 */ 723 public String getAverageMolecularFormula() { 724 return this.averageMolecularFormula == null ? null : this.averageMolecularFormula.getValue(); 725 } 726 727 /** 728 * @param value Todo. 729 */ 730 public SubstancePolymerRepeatComponent setAverageMolecularFormula(String value) { 731 if (Utilities.noString(value)) 732 this.averageMolecularFormula = null; 733 else { 734 if (this.averageMolecularFormula == null) 735 this.averageMolecularFormula = new StringType(); 736 this.averageMolecularFormula.setValue(value); 737 } 738 return this; 739 } 740 741 /** 742 * @return {@link #repeatUnitAmountType} (Todo.) 743 */ 744 public CodeableConcept getRepeatUnitAmountType() { 745 if (this.repeatUnitAmountType == null) 746 if (Configuration.errorOnAutoCreate()) 747 throw new Error("Attempt to auto-create SubstancePolymerRepeatComponent.repeatUnitAmountType"); 748 else if (Configuration.doAutoCreate()) 749 this.repeatUnitAmountType = new CodeableConcept(); // cc 750 return this.repeatUnitAmountType; 751 } 752 753 public boolean hasRepeatUnitAmountType() { 754 return this.repeatUnitAmountType != null && !this.repeatUnitAmountType.isEmpty(); 755 } 756 757 /** 758 * @param value {@link #repeatUnitAmountType} (Todo.) 759 */ 760 public SubstancePolymerRepeatComponent setRepeatUnitAmountType(CodeableConcept value) { 761 this.repeatUnitAmountType = value; 762 return this; 763 } 764 765 /** 766 * @return {@link #repeatUnit} (Todo.) 767 */ 768 public List<SubstancePolymerRepeatRepeatUnitComponent> getRepeatUnit() { 769 if (this.repeatUnit == null) 770 this.repeatUnit = new ArrayList<SubstancePolymerRepeatRepeatUnitComponent>(); 771 return this.repeatUnit; 772 } 773 774 /** 775 * @return Returns a reference to <code>this</code> for easy method chaining 776 */ 777 public SubstancePolymerRepeatComponent setRepeatUnit(List<SubstancePolymerRepeatRepeatUnitComponent> theRepeatUnit) { 778 this.repeatUnit = theRepeatUnit; 779 return this; 780 } 781 782 public boolean hasRepeatUnit() { 783 if (this.repeatUnit == null) 784 return false; 785 for (SubstancePolymerRepeatRepeatUnitComponent item : this.repeatUnit) 786 if (!item.isEmpty()) 787 return true; 788 return false; 789 } 790 791 public SubstancePolymerRepeatRepeatUnitComponent addRepeatUnit() { //3 792 SubstancePolymerRepeatRepeatUnitComponent t = new SubstancePolymerRepeatRepeatUnitComponent(); 793 if (this.repeatUnit == null) 794 this.repeatUnit = new ArrayList<SubstancePolymerRepeatRepeatUnitComponent>(); 795 this.repeatUnit.add(t); 796 return t; 797 } 798 799 public SubstancePolymerRepeatComponent addRepeatUnit(SubstancePolymerRepeatRepeatUnitComponent t) { //3 800 if (t == null) 801 return this; 802 if (this.repeatUnit == null) 803 this.repeatUnit = new ArrayList<SubstancePolymerRepeatRepeatUnitComponent>(); 804 this.repeatUnit.add(t); 805 return this; 806 } 807 808 /** 809 * @return The first repetition of repeating field {@link #repeatUnit}, creating it if it does not already exist {3} 810 */ 811 public SubstancePolymerRepeatRepeatUnitComponent getRepeatUnitFirstRep() { 812 if (getRepeatUnit().isEmpty()) { 813 addRepeatUnit(); 814 } 815 return getRepeatUnit().get(0); 816 } 817 818 protected void listChildren(List<Property> children) { 819 super.listChildren(children); 820 children.add(new Property("numberOfUnits", "integer", "Todo.", 0, 1, numberOfUnits)); 821 children.add(new Property("averageMolecularFormula", "string", "Todo.", 0, 1, averageMolecularFormula)); 822 children.add(new Property("repeatUnitAmountType", "CodeableConcept", "Todo.", 0, 1, repeatUnitAmountType)); 823 children.add(new Property("repeatUnit", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, repeatUnit)); 824 } 825 826 @Override 827 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 828 switch (_hash) { 829 case -1321430961: /*numberOfUnits*/ return new Property("numberOfUnits", "integer", "Todo.", 0, 1, numberOfUnits); 830 case 111461715: /*averageMolecularFormula*/ return new Property("averageMolecularFormula", "string", "Todo.", 0, 1, averageMolecularFormula); 831 case -1994025263: /*repeatUnitAmountType*/ return new Property("repeatUnitAmountType", "CodeableConcept", "Todo.", 0, 1, repeatUnitAmountType); 832 case 1159607743: /*repeatUnit*/ return new Property("repeatUnit", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, repeatUnit); 833 default: return super.getNamedProperty(_hash, _name, _checkValid); 834 } 835 836 } 837 838 @Override 839 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 840 switch (hash) { 841 case -1321430961: /*numberOfUnits*/ return this.numberOfUnits == null ? new Base[0] : new Base[] {this.numberOfUnits}; // IntegerType 842 case 111461715: /*averageMolecularFormula*/ return this.averageMolecularFormula == null ? new Base[0] : new Base[] {this.averageMolecularFormula}; // StringType 843 case -1994025263: /*repeatUnitAmountType*/ return this.repeatUnitAmountType == null ? new Base[0] : new Base[] {this.repeatUnitAmountType}; // CodeableConcept 844 case 1159607743: /*repeatUnit*/ return this.repeatUnit == null ? new Base[0] : this.repeatUnit.toArray(new Base[this.repeatUnit.size()]); // SubstancePolymerRepeatRepeatUnitComponent 845 default: return super.getProperty(hash, name, checkValid); 846 } 847 848 } 849 850 @Override 851 public Base setProperty(int hash, String name, Base value) throws FHIRException { 852 switch (hash) { 853 case -1321430961: // numberOfUnits 854 this.numberOfUnits = TypeConvertor.castToInteger(value); // IntegerType 855 return value; 856 case 111461715: // averageMolecularFormula 857 this.averageMolecularFormula = TypeConvertor.castToString(value); // StringType 858 return value; 859 case -1994025263: // repeatUnitAmountType 860 this.repeatUnitAmountType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 861 return value; 862 case 1159607743: // repeatUnit 863 this.getRepeatUnit().add((SubstancePolymerRepeatRepeatUnitComponent) value); // SubstancePolymerRepeatRepeatUnitComponent 864 return value; 865 default: return super.setProperty(hash, name, value); 866 } 867 868 } 869 870 @Override 871 public Base setProperty(String name, Base value) throws FHIRException { 872 if (name.equals("numberOfUnits")) { 873 this.numberOfUnits = TypeConvertor.castToInteger(value); // IntegerType 874 } else if (name.equals("averageMolecularFormula")) { 875 this.averageMolecularFormula = TypeConvertor.castToString(value); // StringType 876 } else if (name.equals("repeatUnitAmountType")) { 877 this.repeatUnitAmountType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 878 } else if (name.equals("repeatUnit")) { 879 this.getRepeatUnit().add((SubstancePolymerRepeatRepeatUnitComponent) value); 880 } else 881 return super.setProperty(name, value); 882 return value; 883 } 884 885 @Override 886 public Base makeProperty(int hash, String name) throws FHIRException { 887 switch (hash) { 888 case -1321430961: return getNumberOfUnitsElement(); 889 case 111461715: return getAverageMolecularFormulaElement(); 890 case -1994025263: return getRepeatUnitAmountType(); 891 case 1159607743: return addRepeatUnit(); 892 default: return super.makeProperty(hash, name); 893 } 894 895 } 896 897 @Override 898 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 899 switch (hash) { 900 case -1321430961: /*numberOfUnits*/ return new String[] {"integer"}; 901 case 111461715: /*averageMolecularFormula*/ return new String[] {"string"}; 902 case -1994025263: /*repeatUnitAmountType*/ return new String[] {"CodeableConcept"}; 903 case 1159607743: /*repeatUnit*/ return new String[] {}; 904 default: return super.getTypesForProperty(hash, name); 905 } 906 907 } 908 909 @Override 910 public Base addChild(String name) throws FHIRException { 911 if (name.equals("numberOfUnits")) { 912 throw new FHIRException("Cannot call addChild on a primitive type SubstancePolymer.repeat.numberOfUnits"); 913 } 914 else if (name.equals("averageMolecularFormula")) { 915 throw new FHIRException("Cannot call addChild on a primitive type SubstancePolymer.repeat.averageMolecularFormula"); 916 } 917 else if (name.equals("repeatUnitAmountType")) { 918 this.repeatUnitAmountType = new CodeableConcept(); 919 return this.repeatUnitAmountType; 920 } 921 else if (name.equals("repeatUnit")) { 922 return addRepeatUnit(); 923 } 924 else 925 return super.addChild(name); 926 } 927 928 public SubstancePolymerRepeatComponent copy() { 929 SubstancePolymerRepeatComponent dst = new SubstancePolymerRepeatComponent(); 930 copyValues(dst); 931 return dst; 932 } 933 934 public void copyValues(SubstancePolymerRepeatComponent dst) { 935 super.copyValues(dst); 936 dst.numberOfUnits = numberOfUnits == null ? null : numberOfUnits.copy(); 937 dst.averageMolecularFormula = averageMolecularFormula == null ? null : averageMolecularFormula.copy(); 938 dst.repeatUnitAmountType = repeatUnitAmountType == null ? null : repeatUnitAmountType.copy(); 939 if (repeatUnit != null) { 940 dst.repeatUnit = new ArrayList<SubstancePolymerRepeatRepeatUnitComponent>(); 941 for (SubstancePolymerRepeatRepeatUnitComponent i : repeatUnit) 942 dst.repeatUnit.add(i.copy()); 943 }; 944 } 945 946 @Override 947 public boolean equalsDeep(Base other_) { 948 if (!super.equalsDeep(other_)) 949 return false; 950 if (!(other_ instanceof SubstancePolymerRepeatComponent)) 951 return false; 952 SubstancePolymerRepeatComponent o = (SubstancePolymerRepeatComponent) other_; 953 return compareDeep(numberOfUnits, o.numberOfUnits, true) && compareDeep(averageMolecularFormula, o.averageMolecularFormula, true) 954 && compareDeep(repeatUnitAmountType, o.repeatUnitAmountType, true) && compareDeep(repeatUnit, o.repeatUnit, true) 955 ; 956 } 957 958 @Override 959 public boolean equalsShallow(Base other_) { 960 if (!super.equalsShallow(other_)) 961 return false; 962 if (!(other_ instanceof SubstancePolymerRepeatComponent)) 963 return false; 964 SubstancePolymerRepeatComponent o = (SubstancePolymerRepeatComponent) other_; 965 return compareValues(numberOfUnits, o.numberOfUnits, true) && compareValues(averageMolecularFormula, o.averageMolecularFormula, true) 966 ; 967 } 968 969 public boolean isEmpty() { 970 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(numberOfUnits, averageMolecularFormula 971 , repeatUnitAmountType, repeatUnit); 972 } 973 974 public String fhirType() { 975 return "SubstancePolymer.repeat"; 976 977 } 978 979 } 980 981 @Block() 982 public static class SubstancePolymerRepeatRepeatUnitComponent extends BackboneElement implements IBaseBackboneElement { 983 /** 984 * Todo. 985 */ 986 @Child(name = "unit", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true) 987 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 988 protected StringType unit; 989 990 /** 991 * Todo. 992 */ 993 @Child(name = "orientation", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 994 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 995 protected CodeableConcept orientation; 996 997 /** 998 * Todo. 999 */ 1000 @Child(name = "amount", type = {SubstanceAmount.class}, order=3, min=0, max=1, modifier=false, summary=true) 1001 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1002 protected SubstanceAmount amount; 1003 1004 /** 1005 * Todo. 1006 */ 1007 @Child(name = "degreeOfPolymerisation", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1008 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1009 protected List<SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent> degreeOfPolymerisation; 1010 1011 /** 1012 * Todo. 1013 */ 1014 @Child(name = "structuralRepresentation", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1015 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1016 protected List<SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent> structuralRepresentation; 1017 1018 private static final long serialVersionUID = -1739084500L; 1019 1020 /** 1021 * Constructor 1022 */ 1023 public SubstancePolymerRepeatRepeatUnitComponent() { 1024 super(); 1025 } 1026 1027 /** 1028 * @return {@link #unit} (Todo.). This is the underlying object with id, value and extensions. The accessor "getUnit" gives direct access to the value 1029 */ 1030 public StringType getUnitElement() { 1031 if (this.unit == null) 1032 if (Configuration.errorOnAutoCreate()) 1033 throw new Error("Attempt to auto-create SubstancePolymerRepeatRepeatUnitComponent.unit"); 1034 else if (Configuration.doAutoCreate()) 1035 this.unit = new StringType(); // bb 1036 return this.unit; 1037 } 1038 1039 public boolean hasUnitElement() { 1040 return this.unit != null && !this.unit.isEmpty(); 1041 } 1042 1043 public boolean hasUnit() { 1044 return this.unit != null && !this.unit.isEmpty(); 1045 } 1046 1047 /** 1048 * @param value {@link #unit} (Todo.). This is the underlying object with id, value and extensions. The accessor "getUnit" gives direct access to the value 1049 */ 1050 public SubstancePolymerRepeatRepeatUnitComponent setUnitElement(StringType value) { 1051 this.unit = value; 1052 return this; 1053 } 1054 1055 /** 1056 * @return Todo. 1057 */ 1058 public String getUnit() { 1059 return this.unit == null ? null : this.unit.getValue(); 1060 } 1061 1062 /** 1063 * @param value Todo. 1064 */ 1065 public SubstancePolymerRepeatRepeatUnitComponent setUnit(String value) { 1066 if (Utilities.noString(value)) 1067 this.unit = null; 1068 else { 1069 if (this.unit == null) 1070 this.unit = new StringType(); 1071 this.unit.setValue(value); 1072 } 1073 return this; 1074 } 1075 1076 /** 1077 * @return {@link #orientation} (Todo.) 1078 */ 1079 public CodeableConcept getOrientation() { 1080 if (this.orientation == null) 1081 if (Configuration.errorOnAutoCreate()) 1082 throw new Error("Attempt to auto-create SubstancePolymerRepeatRepeatUnitComponent.orientation"); 1083 else if (Configuration.doAutoCreate()) 1084 this.orientation = new CodeableConcept(); // cc 1085 return this.orientation; 1086 } 1087 1088 public boolean hasOrientation() { 1089 return this.orientation != null && !this.orientation.isEmpty(); 1090 } 1091 1092 /** 1093 * @param value {@link #orientation} (Todo.) 1094 */ 1095 public SubstancePolymerRepeatRepeatUnitComponent setOrientation(CodeableConcept value) { 1096 this.orientation = value; 1097 return this; 1098 } 1099 1100 /** 1101 * @return {@link #amount} (Todo.) 1102 */ 1103 public SubstanceAmount getAmount() { 1104 if (this.amount == null) 1105 if (Configuration.errorOnAutoCreate()) 1106 throw new Error("Attempt to auto-create SubstancePolymerRepeatRepeatUnitComponent.amount"); 1107 else if (Configuration.doAutoCreate()) 1108 this.amount = new SubstanceAmount(); // cc 1109 return this.amount; 1110 } 1111 1112 public boolean hasAmount() { 1113 return this.amount != null && !this.amount.isEmpty(); 1114 } 1115 1116 /** 1117 * @param value {@link #amount} (Todo.) 1118 */ 1119 public SubstancePolymerRepeatRepeatUnitComponent setAmount(SubstanceAmount value) { 1120 this.amount = value; 1121 return this; 1122 } 1123 1124 /** 1125 * @return {@link #degreeOfPolymerisation} (Todo.) 1126 */ 1127 public List<SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent> getDegreeOfPolymerisation() { 1128 if (this.degreeOfPolymerisation == null) 1129 this.degreeOfPolymerisation = new ArrayList<SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent>(); 1130 return this.degreeOfPolymerisation; 1131 } 1132 1133 /** 1134 * @return Returns a reference to <code>this</code> for easy method chaining 1135 */ 1136 public SubstancePolymerRepeatRepeatUnitComponent setDegreeOfPolymerisation(List<SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent> theDegreeOfPolymerisation) { 1137 this.degreeOfPolymerisation = theDegreeOfPolymerisation; 1138 return this; 1139 } 1140 1141 public boolean hasDegreeOfPolymerisation() { 1142 if (this.degreeOfPolymerisation == null) 1143 return false; 1144 for (SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent item : this.degreeOfPolymerisation) 1145 if (!item.isEmpty()) 1146 return true; 1147 return false; 1148 } 1149 1150 public SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent addDegreeOfPolymerisation() { //3 1151 SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent t = new SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(); 1152 if (this.degreeOfPolymerisation == null) 1153 this.degreeOfPolymerisation = new ArrayList<SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent>(); 1154 this.degreeOfPolymerisation.add(t); 1155 return t; 1156 } 1157 1158 public SubstancePolymerRepeatRepeatUnitComponent addDegreeOfPolymerisation(SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent t) { //3 1159 if (t == null) 1160 return this; 1161 if (this.degreeOfPolymerisation == null) 1162 this.degreeOfPolymerisation = new ArrayList<SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent>(); 1163 this.degreeOfPolymerisation.add(t); 1164 return this; 1165 } 1166 1167 /** 1168 * @return The first repetition of repeating field {@link #degreeOfPolymerisation}, creating it if it does not already exist {3} 1169 */ 1170 public SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent getDegreeOfPolymerisationFirstRep() { 1171 if (getDegreeOfPolymerisation().isEmpty()) { 1172 addDegreeOfPolymerisation(); 1173 } 1174 return getDegreeOfPolymerisation().get(0); 1175 } 1176 1177 /** 1178 * @return {@link #structuralRepresentation} (Todo.) 1179 */ 1180 public List<SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent> getStructuralRepresentation() { 1181 if (this.structuralRepresentation == null) 1182 this.structuralRepresentation = new ArrayList<SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent>(); 1183 return this.structuralRepresentation; 1184 } 1185 1186 /** 1187 * @return Returns a reference to <code>this</code> for easy method chaining 1188 */ 1189 public SubstancePolymerRepeatRepeatUnitComponent setStructuralRepresentation(List<SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent> theStructuralRepresentation) { 1190 this.structuralRepresentation = theStructuralRepresentation; 1191 return this; 1192 } 1193 1194 public boolean hasStructuralRepresentation() { 1195 if (this.structuralRepresentation == null) 1196 return false; 1197 for (SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent item : this.structuralRepresentation) 1198 if (!item.isEmpty()) 1199 return true; 1200 return false; 1201 } 1202 1203 public SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent addStructuralRepresentation() { //3 1204 SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent t = new SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(); 1205 if (this.structuralRepresentation == null) 1206 this.structuralRepresentation = new ArrayList<SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent>(); 1207 this.structuralRepresentation.add(t); 1208 return t; 1209 } 1210 1211 public SubstancePolymerRepeatRepeatUnitComponent addStructuralRepresentation(SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent t) { //3 1212 if (t == null) 1213 return this; 1214 if (this.structuralRepresentation == null) 1215 this.structuralRepresentation = new ArrayList<SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent>(); 1216 this.structuralRepresentation.add(t); 1217 return this; 1218 } 1219 1220 /** 1221 * @return The first repetition of repeating field {@link #structuralRepresentation}, creating it if it does not already exist {3} 1222 */ 1223 public SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent getStructuralRepresentationFirstRep() { 1224 if (getStructuralRepresentation().isEmpty()) { 1225 addStructuralRepresentation(); 1226 } 1227 return getStructuralRepresentation().get(0); 1228 } 1229 1230 protected void listChildren(List<Property> children) { 1231 super.listChildren(children); 1232 children.add(new Property("unit", "string", "Todo.", 0, 1, unit)); 1233 children.add(new Property("orientation", "CodeableConcept", "Todo.", 0, 1, orientation)); 1234 children.add(new Property("amount", "SubstanceAmount", "Todo.", 0, 1, amount)); 1235 children.add(new Property("degreeOfPolymerisation", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, degreeOfPolymerisation)); 1236 children.add(new Property("structuralRepresentation", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, structuralRepresentation)); 1237 } 1238 1239 @Override 1240 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1241 switch (_hash) { 1242 case 3594628: /*unit*/ return new Property("unit", "string", "Todo.", 0, 1, unit); 1243 case -1439500848: /*orientation*/ return new Property("orientation", "CodeableConcept", "Todo.", 0, 1, orientation); 1244 case -1413853096: /*amount*/ return new Property("amount", "SubstanceAmount", "Todo.", 0, 1, amount); 1245 case -159251872: /*degreeOfPolymerisation*/ return new Property("degreeOfPolymerisation", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, degreeOfPolymerisation); 1246 case 14311178: /*structuralRepresentation*/ return new Property("structuralRepresentation", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, structuralRepresentation); 1247 default: return super.getNamedProperty(_hash, _name, _checkValid); 1248 } 1249 1250 } 1251 1252 @Override 1253 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1254 switch (hash) { 1255 case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // StringType 1256 case -1439500848: /*orientation*/ return this.orientation == null ? new Base[0] : new Base[] {this.orientation}; // CodeableConcept 1257 case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // SubstanceAmount 1258 case -159251872: /*degreeOfPolymerisation*/ return this.degreeOfPolymerisation == null ? new Base[0] : this.degreeOfPolymerisation.toArray(new Base[this.degreeOfPolymerisation.size()]); // SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent 1259 case 14311178: /*structuralRepresentation*/ return this.structuralRepresentation == null ? new Base[0] : this.structuralRepresentation.toArray(new Base[this.structuralRepresentation.size()]); // SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent 1260 default: return super.getProperty(hash, name, checkValid); 1261 } 1262 1263 } 1264 1265 @Override 1266 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1267 switch (hash) { 1268 case 3594628: // unit 1269 this.unit = TypeConvertor.castToString(value); // StringType 1270 return value; 1271 case -1439500848: // orientation 1272 this.orientation = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1273 return value; 1274 case -1413853096: // amount 1275 this.amount = TypeConvertor.castToSubstanceAmount(value); // SubstanceAmount 1276 return value; 1277 case -159251872: // degreeOfPolymerisation 1278 this.getDegreeOfPolymerisation().add((SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent) value); // SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent 1279 return value; 1280 case 14311178: // structuralRepresentation 1281 this.getStructuralRepresentation().add((SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent) value); // SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent 1282 return value; 1283 default: return super.setProperty(hash, name, value); 1284 } 1285 1286 } 1287 1288 @Override 1289 public Base setProperty(String name, Base value) throws FHIRException { 1290 if (name.equals("unit")) { 1291 this.unit = TypeConvertor.castToString(value); // StringType 1292 } else if (name.equals("orientation")) { 1293 this.orientation = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1294 } else if (name.equals("amount")) { 1295 this.amount = TypeConvertor.castToSubstanceAmount(value); // SubstanceAmount 1296 } else if (name.equals("degreeOfPolymerisation")) { 1297 this.getDegreeOfPolymerisation().add((SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent) value); 1298 } else if (name.equals("structuralRepresentation")) { 1299 this.getStructuralRepresentation().add((SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent) value); 1300 } else 1301 return super.setProperty(name, value); 1302 return value; 1303 } 1304 1305 @Override 1306 public Base makeProperty(int hash, String name) throws FHIRException { 1307 switch (hash) { 1308 case 3594628: return getUnitElement(); 1309 case -1439500848: return getOrientation(); 1310 case -1413853096: return getAmount(); 1311 case -159251872: return addDegreeOfPolymerisation(); 1312 case 14311178: return addStructuralRepresentation(); 1313 default: return super.makeProperty(hash, name); 1314 } 1315 1316 } 1317 1318 @Override 1319 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1320 switch (hash) { 1321 case 3594628: /*unit*/ return new String[] {"string"}; 1322 case -1439500848: /*orientation*/ return new String[] {"CodeableConcept"}; 1323 case -1413853096: /*amount*/ return new String[] {"SubstanceAmount"}; 1324 case -159251872: /*degreeOfPolymerisation*/ return new String[] {}; 1325 case 14311178: /*structuralRepresentation*/ return new String[] {}; 1326 default: return super.getTypesForProperty(hash, name); 1327 } 1328 1329 } 1330 1331 @Override 1332 public Base addChild(String name) throws FHIRException { 1333 if (name.equals("unit")) { 1334 throw new FHIRException("Cannot call addChild on a primitive type SubstancePolymer.repeat.repeatUnit.unit"); 1335 } 1336 else if (name.equals("orientation")) { 1337 this.orientation = new CodeableConcept(); 1338 return this.orientation; 1339 } 1340 else if (name.equals("amount")) { 1341 this.amount = new SubstanceAmount(); 1342 return this.amount; 1343 } 1344 else if (name.equals("degreeOfPolymerisation")) { 1345 return addDegreeOfPolymerisation(); 1346 } 1347 else if (name.equals("structuralRepresentation")) { 1348 return addStructuralRepresentation(); 1349 } 1350 else 1351 return super.addChild(name); 1352 } 1353 1354 public SubstancePolymerRepeatRepeatUnitComponent copy() { 1355 SubstancePolymerRepeatRepeatUnitComponent dst = new SubstancePolymerRepeatRepeatUnitComponent(); 1356 copyValues(dst); 1357 return dst; 1358 } 1359 1360 public void copyValues(SubstancePolymerRepeatRepeatUnitComponent dst) { 1361 super.copyValues(dst); 1362 dst.unit = unit == null ? null : unit.copy(); 1363 dst.orientation = orientation == null ? null : orientation.copy(); 1364 dst.amount = amount == null ? null : amount.copy(); 1365 if (degreeOfPolymerisation != null) { 1366 dst.degreeOfPolymerisation = new ArrayList<SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent>(); 1367 for (SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent i : degreeOfPolymerisation) 1368 dst.degreeOfPolymerisation.add(i.copy()); 1369 }; 1370 if (structuralRepresentation != null) { 1371 dst.structuralRepresentation = new ArrayList<SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent>(); 1372 for (SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent i : structuralRepresentation) 1373 dst.structuralRepresentation.add(i.copy()); 1374 }; 1375 } 1376 1377 @Override 1378 public boolean equalsDeep(Base other_) { 1379 if (!super.equalsDeep(other_)) 1380 return false; 1381 if (!(other_ instanceof SubstancePolymerRepeatRepeatUnitComponent)) 1382 return false; 1383 SubstancePolymerRepeatRepeatUnitComponent o = (SubstancePolymerRepeatRepeatUnitComponent) other_; 1384 return compareDeep(unit, o.unit, true) && compareDeep(orientation, o.orientation, true) && compareDeep(amount, o.amount, true) 1385 && compareDeep(degreeOfPolymerisation, o.degreeOfPolymerisation, true) && compareDeep(structuralRepresentation, o.structuralRepresentation, true) 1386 ; 1387 } 1388 1389 @Override 1390 public boolean equalsShallow(Base other_) { 1391 if (!super.equalsShallow(other_)) 1392 return false; 1393 if (!(other_ instanceof SubstancePolymerRepeatRepeatUnitComponent)) 1394 return false; 1395 SubstancePolymerRepeatRepeatUnitComponent o = (SubstancePolymerRepeatRepeatUnitComponent) other_; 1396 return compareValues(unit, o.unit, true); 1397 } 1398 1399 public boolean isEmpty() { 1400 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(unit, orientation, amount 1401 , degreeOfPolymerisation, structuralRepresentation); 1402 } 1403 1404 public String fhirType() { 1405 return "SubstancePolymer.repeat.repeatUnit"; 1406 1407 } 1408 1409 } 1410 1411 @Block() 1412 public static class SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent extends BackboneElement implements IBaseBackboneElement { 1413 /** 1414 * Todo. 1415 */ 1416 @Child(name = "degree", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 1417 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1418 protected CodeableConcept degree; 1419 1420 /** 1421 * Todo. 1422 */ 1423 @Child(name = "amount", type = {SubstanceAmount.class}, order=2, min=0, max=1, modifier=false, summary=true) 1424 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1425 protected SubstanceAmount amount; 1426 1427 private static final long serialVersionUID = -1487452773L; 1428 1429 /** 1430 * Constructor 1431 */ 1432 public SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent() { 1433 super(); 1434 } 1435 1436 /** 1437 * @return {@link #degree} (Todo.) 1438 */ 1439 public CodeableConcept getDegree() { 1440 if (this.degree == null) 1441 if (Configuration.errorOnAutoCreate()) 1442 throw new Error("Attempt to auto-create SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent.degree"); 1443 else if (Configuration.doAutoCreate()) 1444 this.degree = new CodeableConcept(); // cc 1445 return this.degree; 1446 } 1447 1448 public boolean hasDegree() { 1449 return this.degree != null && !this.degree.isEmpty(); 1450 } 1451 1452 /** 1453 * @param value {@link #degree} (Todo.) 1454 */ 1455 public SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent setDegree(CodeableConcept value) { 1456 this.degree = value; 1457 return this; 1458 } 1459 1460 /** 1461 * @return {@link #amount} (Todo.) 1462 */ 1463 public SubstanceAmount getAmount() { 1464 if (this.amount == null) 1465 if (Configuration.errorOnAutoCreate()) 1466 throw new Error("Attempt to auto-create SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent.amount"); 1467 else if (Configuration.doAutoCreate()) 1468 this.amount = new SubstanceAmount(); // cc 1469 return this.amount; 1470 } 1471 1472 public boolean hasAmount() { 1473 return this.amount != null && !this.amount.isEmpty(); 1474 } 1475 1476 /** 1477 * @param value {@link #amount} (Todo.) 1478 */ 1479 public SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent setAmount(SubstanceAmount value) { 1480 this.amount = value; 1481 return this; 1482 } 1483 1484 protected void listChildren(List<Property> children) { 1485 super.listChildren(children); 1486 children.add(new Property("degree", "CodeableConcept", "Todo.", 0, 1, degree)); 1487 children.add(new Property("amount", "SubstanceAmount", "Todo.", 0, 1, amount)); 1488 } 1489 1490 @Override 1491 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1492 switch (_hash) { 1493 case -1335595316: /*degree*/ return new Property("degree", "CodeableConcept", "Todo.", 0, 1, degree); 1494 case -1413853096: /*amount*/ return new Property("amount", "SubstanceAmount", "Todo.", 0, 1, amount); 1495 default: return super.getNamedProperty(_hash, _name, _checkValid); 1496 } 1497 1498 } 1499 1500 @Override 1501 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1502 switch (hash) { 1503 case -1335595316: /*degree*/ return this.degree == null ? new Base[0] : new Base[] {this.degree}; // CodeableConcept 1504 case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // SubstanceAmount 1505 default: return super.getProperty(hash, name, checkValid); 1506 } 1507 1508 } 1509 1510 @Override 1511 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1512 switch (hash) { 1513 case -1335595316: // degree 1514 this.degree = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1515 return value; 1516 case -1413853096: // amount 1517 this.amount = TypeConvertor.castToSubstanceAmount(value); // SubstanceAmount 1518 return value; 1519 default: return super.setProperty(hash, name, value); 1520 } 1521 1522 } 1523 1524 @Override 1525 public Base setProperty(String name, Base value) throws FHIRException { 1526 if (name.equals("degree")) { 1527 this.degree = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1528 } else if (name.equals("amount")) { 1529 this.amount = TypeConvertor.castToSubstanceAmount(value); // SubstanceAmount 1530 } else 1531 return super.setProperty(name, value); 1532 return value; 1533 } 1534 1535 @Override 1536 public Base makeProperty(int hash, String name) throws FHIRException { 1537 switch (hash) { 1538 case -1335595316: return getDegree(); 1539 case -1413853096: return getAmount(); 1540 default: return super.makeProperty(hash, name); 1541 } 1542 1543 } 1544 1545 @Override 1546 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1547 switch (hash) { 1548 case -1335595316: /*degree*/ return new String[] {"CodeableConcept"}; 1549 case -1413853096: /*amount*/ return new String[] {"SubstanceAmount"}; 1550 default: return super.getTypesForProperty(hash, name); 1551 } 1552 1553 } 1554 1555 @Override 1556 public Base addChild(String name) throws FHIRException { 1557 if (name.equals("degree")) { 1558 this.degree = new CodeableConcept(); 1559 return this.degree; 1560 } 1561 else if (name.equals("amount")) { 1562 this.amount = new SubstanceAmount(); 1563 return this.amount; 1564 } 1565 else 1566 return super.addChild(name); 1567 } 1568 1569 public SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent copy() { 1570 SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent dst = new SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(); 1571 copyValues(dst); 1572 return dst; 1573 } 1574 1575 public void copyValues(SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent dst) { 1576 super.copyValues(dst); 1577 dst.degree = degree == null ? null : degree.copy(); 1578 dst.amount = amount == null ? null : amount.copy(); 1579 } 1580 1581 @Override 1582 public boolean equalsDeep(Base other_) { 1583 if (!super.equalsDeep(other_)) 1584 return false; 1585 if (!(other_ instanceof SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent)) 1586 return false; 1587 SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent o = (SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent) other_; 1588 return compareDeep(degree, o.degree, true) && compareDeep(amount, o.amount, true); 1589 } 1590 1591 @Override 1592 public boolean equalsShallow(Base other_) { 1593 if (!super.equalsShallow(other_)) 1594 return false; 1595 if (!(other_ instanceof SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent)) 1596 return false; 1597 SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent o = (SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent) other_; 1598 return true; 1599 } 1600 1601 public boolean isEmpty() { 1602 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(degree, amount); 1603 } 1604 1605 public String fhirType() { 1606 return "SubstancePolymer.repeat.repeatUnit.degreeOfPolymerisation"; 1607 1608 } 1609 1610 } 1611 1612 @Block() 1613 public static class SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent extends BackboneElement implements IBaseBackboneElement { 1614 /** 1615 * Todo. 1616 */ 1617 @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 1618 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1619 protected CodeableConcept type; 1620 1621 /** 1622 * Todo. 1623 */ 1624 @Child(name = "representation", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true) 1625 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1626 protected StringType representation; 1627 1628 /** 1629 * Todo. 1630 */ 1631 @Child(name = "format", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true) 1632 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1633 protected CodeableConcept format; 1634 1635 /** 1636 * Todo. 1637 */ 1638 @Child(name = "attachment", type = {Attachment.class}, order=4, min=0, max=1, modifier=false, summary=true) 1639 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1640 protected Attachment attachment; 1641 1642 private static final long serialVersionUID = -1385695515L; 1643 1644 /** 1645 * Constructor 1646 */ 1647 public SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent() { 1648 super(); 1649 } 1650 1651 /** 1652 * @return {@link #type} (Todo.) 1653 */ 1654 public CodeableConcept getType() { 1655 if (this.type == null) 1656 if (Configuration.errorOnAutoCreate()) 1657 throw new Error("Attempt to auto-create SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent.type"); 1658 else if (Configuration.doAutoCreate()) 1659 this.type = new CodeableConcept(); // cc 1660 return this.type; 1661 } 1662 1663 public boolean hasType() { 1664 return this.type != null && !this.type.isEmpty(); 1665 } 1666 1667 /** 1668 * @param value {@link #type} (Todo.) 1669 */ 1670 public SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent setType(CodeableConcept value) { 1671 this.type = value; 1672 return this; 1673 } 1674 1675 /** 1676 * @return {@link #representation} (Todo.). This is the underlying object with id, value and extensions. The accessor "getRepresentation" gives direct access to the value 1677 */ 1678 public StringType getRepresentationElement() { 1679 if (this.representation == null) 1680 if (Configuration.errorOnAutoCreate()) 1681 throw new Error("Attempt to auto-create SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent.representation"); 1682 else if (Configuration.doAutoCreate()) 1683 this.representation = new StringType(); // bb 1684 return this.representation; 1685 } 1686 1687 public boolean hasRepresentationElement() { 1688 return this.representation != null && !this.representation.isEmpty(); 1689 } 1690 1691 public boolean hasRepresentation() { 1692 return this.representation != null && !this.representation.isEmpty(); 1693 } 1694 1695 /** 1696 * @param value {@link #representation} (Todo.). This is the underlying object with id, value and extensions. The accessor "getRepresentation" gives direct access to the value 1697 */ 1698 public SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent setRepresentationElement(StringType value) { 1699 this.representation = value; 1700 return this; 1701 } 1702 1703 /** 1704 * @return Todo. 1705 */ 1706 public String getRepresentation() { 1707 return this.representation == null ? null : this.representation.getValue(); 1708 } 1709 1710 /** 1711 * @param value Todo. 1712 */ 1713 public SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent setRepresentation(String value) { 1714 if (Utilities.noString(value)) 1715 this.representation = null; 1716 else { 1717 if (this.representation == null) 1718 this.representation = new StringType(); 1719 this.representation.setValue(value); 1720 } 1721 return this; 1722 } 1723 1724 /** 1725 * @return {@link #format} (Todo.) 1726 */ 1727 public CodeableConcept getFormat() { 1728 if (this.format == null) 1729 if (Configuration.errorOnAutoCreate()) 1730 throw new Error("Attempt to auto-create SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent.format"); 1731 else if (Configuration.doAutoCreate()) 1732 this.format = new CodeableConcept(); // cc 1733 return this.format; 1734 } 1735 1736 public boolean hasFormat() { 1737 return this.format != null && !this.format.isEmpty(); 1738 } 1739 1740 /** 1741 * @param value {@link #format} (Todo.) 1742 */ 1743 public SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent setFormat(CodeableConcept value) { 1744 this.format = value; 1745 return this; 1746 } 1747 1748 /** 1749 * @return {@link #attachment} (Todo.) 1750 */ 1751 public Attachment getAttachment() { 1752 if (this.attachment == null) 1753 if (Configuration.errorOnAutoCreate()) 1754 throw new Error("Attempt to auto-create SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent.attachment"); 1755 else if (Configuration.doAutoCreate()) 1756 this.attachment = new Attachment(); // cc 1757 return this.attachment; 1758 } 1759 1760 public boolean hasAttachment() { 1761 return this.attachment != null && !this.attachment.isEmpty(); 1762 } 1763 1764 /** 1765 * @param value {@link #attachment} (Todo.) 1766 */ 1767 public SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent setAttachment(Attachment value) { 1768 this.attachment = value; 1769 return this; 1770 } 1771 1772 protected void listChildren(List<Property> children) { 1773 super.listChildren(children); 1774 children.add(new Property("type", "CodeableConcept", "Todo.", 0, 1, type)); 1775 children.add(new Property("representation", "string", "Todo.", 0, 1, representation)); 1776 children.add(new Property("format", "CodeableConcept", "Todo.", 0, 1, format)); 1777 children.add(new Property("attachment", "Attachment", "Todo.", 0, 1, attachment)); 1778 } 1779 1780 @Override 1781 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 1782 switch (_hash) { 1783 case 3575610: /*type*/ return new Property("type", "CodeableConcept", "Todo.", 0, 1, type); 1784 case -671065907: /*representation*/ return new Property("representation", "string", "Todo.", 0, 1, representation); 1785 case -1268779017: /*format*/ return new Property("format", "CodeableConcept", "Todo.", 0, 1, format); 1786 case -1963501277: /*attachment*/ return new Property("attachment", "Attachment", "Todo.", 0, 1, attachment); 1787 default: return super.getNamedProperty(_hash, _name, _checkValid); 1788 } 1789 1790 } 1791 1792 @Override 1793 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 1794 switch (hash) { 1795 case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept 1796 case -671065907: /*representation*/ return this.representation == null ? new Base[0] : new Base[] {this.representation}; // StringType 1797 case -1268779017: /*format*/ return this.format == null ? new Base[0] : new Base[] {this.format}; // CodeableConcept 1798 case -1963501277: /*attachment*/ return this.attachment == null ? new Base[0] : new Base[] {this.attachment}; // Attachment 1799 default: return super.getProperty(hash, name, checkValid); 1800 } 1801 1802 } 1803 1804 @Override 1805 public Base setProperty(int hash, String name, Base value) throws FHIRException { 1806 switch (hash) { 1807 case 3575610: // type 1808 this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1809 return value; 1810 case -671065907: // representation 1811 this.representation = TypeConvertor.castToString(value); // StringType 1812 return value; 1813 case -1268779017: // format 1814 this.format = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1815 return value; 1816 case -1963501277: // attachment 1817 this.attachment = TypeConvertor.castToAttachment(value); // Attachment 1818 return value; 1819 default: return super.setProperty(hash, name, value); 1820 } 1821 1822 } 1823 1824 @Override 1825 public Base setProperty(String name, Base value) throws FHIRException { 1826 if (name.equals("type")) { 1827 this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1828 } else if (name.equals("representation")) { 1829 this.representation = TypeConvertor.castToString(value); // StringType 1830 } else if (name.equals("format")) { 1831 this.format = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 1832 } else if (name.equals("attachment")) { 1833 this.attachment = TypeConvertor.castToAttachment(value); // Attachment 1834 } else 1835 return super.setProperty(name, value); 1836 return value; 1837 } 1838 1839 @Override 1840 public Base makeProperty(int hash, String name) throws FHIRException { 1841 switch (hash) { 1842 case 3575610: return getType(); 1843 case -671065907: return getRepresentationElement(); 1844 case -1268779017: return getFormat(); 1845 case -1963501277: return getAttachment(); 1846 default: return super.makeProperty(hash, name); 1847 } 1848 1849 } 1850 1851 @Override 1852 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 1853 switch (hash) { 1854 case 3575610: /*type*/ return new String[] {"CodeableConcept"}; 1855 case -671065907: /*representation*/ return new String[] {"string"}; 1856 case -1268779017: /*format*/ return new String[] {"CodeableConcept"}; 1857 case -1963501277: /*attachment*/ return new String[] {"Attachment"}; 1858 default: return super.getTypesForProperty(hash, name); 1859 } 1860 1861 } 1862 1863 @Override 1864 public Base addChild(String name) throws FHIRException { 1865 if (name.equals("type")) { 1866 this.type = new CodeableConcept(); 1867 return this.type; 1868 } 1869 else if (name.equals("representation")) { 1870 throw new FHIRException("Cannot call addChild on a primitive type SubstancePolymer.repeat.repeatUnit.structuralRepresentation.representation"); 1871 } 1872 else if (name.equals("format")) { 1873 this.format = new CodeableConcept(); 1874 return this.format; 1875 } 1876 else if (name.equals("attachment")) { 1877 this.attachment = new Attachment(); 1878 return this.attachment; 1879 } 1880 else 1881 return super.addChild(name); 1882 } 1883 1884 public SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent copy() { 1885 SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent dst = new SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(); 1886 copyValues(dst); 1887 return dst; 1888 } 1889 1890 public void copyValues(SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent dst) { 1891 super.copyValues(dst); 1892 dst.type = type == null ? null : type.copy(); 1893 dst.representation = representation == null ? null : representation.copy(); 1894 dst.format = format == null ? null : format.copy(); 1895 dst.attachment = attachment == null ? null : attachment.copy(); 1896 } 1897 1898 @Override 1899 public boolean equalsDeep(Base other_) { 1900 if (!super.equalsDeep(other_)) 1901 return false; 1902 if (!(other_ instanceof SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent)) 1903 return false; 1904 SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent o = (SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent) other_; 1905 return compareDeep(type, o.type, true) && compareDeep(representation, o.representation, true) && compareDeep(format, o.format, true) 1906 && compareDeep(attachment, o.attachment, true); 1907 } 1908 1909 @Override 1910 public boolean equalsShallow(Base other_) { 1911 if (!super.equalsShallow(other_)) 1912 return false; 1913 if (!(other_ instanceof SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent)) 1914 return false; 1915 SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent o = (SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent) other_; 1916 return compareValues(representation, o.representation, true); 1917 } 1918 1919 public boolean isEmpty() { 1920 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, representation, format 1921 , attachment); 1922 } 1923 1924 public String fhirType() { 1925 return "SubstancePolymer.repeat.repeatUnit.structuralRepresentation"; 1926 1927 } 1928 1929 } 1930 1931 /** 1932 * Todo. 1933 */ 1934 @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true) 1935 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1936 protected Identifier identifier; 1937 1938 /** 1939 * Todo. 1940 */ 1941 @Child(name = "class", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true) 1942 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1943 protected CodeableConcept class_; 1944 1945 /** 1946 * Todo. 1947 */ 1948 @Child(name = "geometry", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true) 1949 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1950 protected CodeableConcept geometry; 1951 1952 /** 1953 * Todo. 1954 */ 1955 @Child(name = "copolymerConnectivity", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1956 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1957 protected List<CodeableConcept> copolymerConnectivity; 1958 1959 /** 1960 * Todo. This is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder. 1961 */ 1962 @Child(name = "modification", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true) 1963 @Description(shortDefinition="Todo. This is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder", formalDefinition="Todo. This is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder." ) 1964 protected StringType modification; 1965 1966 /** 1967 * Todo. 1968 */ 1969 @Child(name = "monomerSet", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1970 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1971 protected List<SubstancePolymerMonomerSetComponent> monomerSet; 1972 1973 /** 1974 * Todo. 1975 */ 1976 @Child(name = "repeat", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) 1977 @Description(shortDefinition="Todo", formalDefinition="Todo." ) 1978 protected List<SubstancePolymerRepeatComponent> repeat; 1979 1980 private static final long serialVersionUID = 11937102L; 1981 1982 /** 1983 * Constructor 1984 */ 1985 public SubstancePolymer() { 1986 super(); 1987 } 1988 1989 /** 1990 * @return {@link #identifier} (Todo.) 1991 */ 1992 public Identifier getIdentifier() { 1993 if (this.identifier == null) 1994 if (Configuration.errorOnAutoCreate()) 1995 throw new Error("Attempt to auto-create SubstancePolymer.identifier"); 1996 else if (Configuration.doAutoCreate()) 1997 this.identifier = new Identifier(); // cc 1998 return this.identifier; 1999 } 2000 2001 public boolean hasIdentifier() { 2002 return this.identifier != null && !this.identifier.isEmpty(); 2003 } 2004 2005 /** 2006 * @param value {@link #identifier} (Todo.) 2007 */ 2008 public SubstancePolymer setIdentifier(Identifier value) { 2009 this.identifier = value; 2010 return this; 2011 } 2012 2013 /** 2014 * @return {@link #class_} (Todo.) 2015 */ 2016 public CodeableConcept getClass_() { 2017 if (this.class_ == null) 2018 if (Configuration.errorOnAutoCreate()) 2019 throw new Error("Attempt to auto-create SubstancePolymer.class_"); 2020 else if (Configuration.doAutoCreate()) 2021 this.class_ = new CodeableConcept(); // cc 2022 return this.class_; 2023 } 2024 2025 public boolean hasClass_() { 2026 return this.class_ != null && !this.class_.isEmpty(); 2027 } 2028 2029 /** 2030 * @param value {@link #class_} (Todo.) 2031 */ 2032 public SubstancePolymer setClass_(CodeableConcept value) { 2033 this.class_ = value; 2034 return this; 2035 } 2036 2037 /** 2038 * @return {@link #geometry} (Todo.) 2039 */ 2040 public CodeableConcept getGeometry() { 2041 if (this.geometry == null) 2042 if (Configuration.errorOnAutoCreate()) 2043 throw new Error("Attempt to auto-create SubstancePolymer.geometry"); 2044 else if (Configuration.doAutoCreate()) 2045 this.geometry = new CodeableConcept(); // cc 2046 return this.geometry; 2047 } 2048 2049 public boolean hasGeometry() { 2050 return this.geometry != null && !this.geometry.isEmpty(); 2051 } 2052 2053 /** 2054 * @param value {@link #geometry} (Todo.) 2055 */ 2056 public SubstancePolymer setGeometry(CodeableConcept value) { 2057 this.geometry = value; 2058 return this; 2059 } 2060 2061 /** 2062 * @return {@link #copolymerConnectivity} (Todo.) 2063 */ 2064 public List<CodeableConcept> getCopolymerConnectivity() { 2065 if (this.copolymerConnectivity == null) 2066 this.copolymerConnectivity = new ArrayList<CodeableConcept>(); 2067 return this.copolymerConnectivity; 2068 } 2069 2070 /** 2071 * @return Returns a reference to <code>this</code> for easy method chaining 2072 */ 2073 public SubstancePolymer setCopolymerConnectivity(List<CodeableConcept> theCopolymerConnectivity) { 2074 this.copolymerConnectivity = theCopolymerConnectivity; 2075 return this; 2076 } 2077 2078 public boolean hasCopolymerConnectivity() { 2079 if (this.copolymerConnectivity == null) 2080 return false; 2081 for (CodeableConcept item : this.copolymerConnectivity) 2082 if (!item.isEmpty()) 2083 return true; 2084 return false; 2085 } 2086 2087 public CodeableConcept addCopolymerConnectivity() { //3 2088 CodeableConcept t = new CodeableConcept(); 2089 if (this.copolymerConnectivity == null) 2090 this.copolymerConnectivity = new ArrayList<CodeableConcept>(); 2091 this.copolymerConnectivity.add(t); 2092 return t; 2093 } 2094 2095 public SubstancePolymer addCopolymerConnectivity(CodeableConcept t) { //3 2096 if (t == null) 2097 return this; 2098 if (this.copolymerConnectivity == null) 2099 this.copolymerConnectivity = new ArrayList<CodeableConcept>(); 2100 this.copolymerConnectivity.add(t); 2101 return this; 2102 } 2103 2104 /** 2105 * @return The first repetition of repeating field {@link #copolymerConnectivity}, creating it if it does not already exist {3} 2106 */ 2107 public CodeableConcept getCopolymerConnectivityFirstRep() { 2108 if (getCopolymerConnectivity().isEmpty()) { 2109 addCopolymerConnectivity(); 2110 } 2111 return getCopolymerConnectivity().get(0); 2112 } 2113 2114 /** 2115 * @return {@link #modification} (Todo. This is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder.). This is the underlying object with id, value and extensions. The accessor "getModification" gives direct access to the value 2116 */ 2117 public StringType getModificationElement() { 2118 if (this.modification == null) 2119 if (Configuration.errorOnAutoCreate()) 2120 throw new Error("Attempt to auto-create SubstancePolymer.modification"); 2121 else if (Configuration.doAutoCreate()) 2122 this.modification = new StringType(); // bb 2123 return this.modification; 2124 } 2125 2126 public boolean hasModificationElement() { 2127 return this.modification != null && !this.modification.isEmpty(); 2128 } 2129 2130 public boolean hasModification() { 2131 return this.modification != null && !this.modification.isEmpty(); 2132 } 2133 2134 /** 2135 * @param value {@link #modification} (Todo. This is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder.). This is the underlying object with id, value and extensions. The accessor "getModification" gives direct access to the value 2136 */ 2137 public SubstancePolymer setModificationElement(StringType value) { 2138 this.modification = value; 2139 return this; 2140 } 2141 2142 /** 2143 * @return Todo. This is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder. 2144 */ 2145 public String getModification() { 2146 return this.modification == null ? null : this.modification.getValue(); 2147 } 2148 2149 /** 2150 * @param value Todo. This is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder. 2151 */ 2152 public SubstancePolymer setModification(String value) { 2153 if (Utilities.noString(value)) 2154 this.modification = null; 2155 else { 2156 if (this.modification == null) 2157 this.modification = new StringType(); 2158 this.modification.setValue(value); 2159 } 2160 return this; 2161 } 2162 2163 /** 2164 * @return {@link #monomerSet} (Todo.) 2165 */ 2166 public List<SubstancePolymerMonomerSetComponent> getMonomerSet() { 2167 if (this.monomerSet == null) 2168 this.monomerSet = new ArrayList<SubstancePolymerMonomerSetComponent>(); 2169 return this.monomerSet; 2170 } 2171 2172 /** 2173 * @return Returns a reference to <code>this</code> for easy method chaining 2174 */ 2175 public SubstancePolymer setMonomerSet(List<SubstancePolymerMonomerSetComponent> theMonomerSet) { 2176 this.monomerSet = theMonomerSet; 2177 return this; 2178 } 2179 2180 public boolean hasMonomerSet() { 2181 if (this.monomerSet == null) 2182 return false; 2183 for (SubstancePolymerMonomerSetComponent item : this.monomerSet) 2184 if (!item.isEmpty()) 2185 return true; 2186 return false; 2187 } 2188 2189 public SubstancePolymerMonomerSetComponent addMonomerSet() { //3 2190 SubstancePolymerMonomerSetComponent t = new SubstancePolymerMonomerSetComponent(); 2191 if (this.monomerSet == null) 2192 this.monomerSet = new ArrayList<SubstancePolymerMonomerSetComponent>(); 2193 this.monomerSet.add(t); 2194 return t; 2195 } 2196 2197 public SubstancePolymer addMonomerSet(SubstancePolymerMonomerSetComponent t) { //3 2198 if (t == null) 2199 return this; 2200 if (this.monomerSet == null) 2201 this.monomerSet = new ArrayList<SubstancePolymerMonomerSetComponent>(); 2202 this.monomerSet.add(t); 2203 return this; 2204 } 2205 2206 /** 2207 * @return The first repetition of repeating field {@link #monomerSet}, creating it if it does not already exist {3} 2208 */ 2209 public SubstancePolymerMonomerSetComponent getMonomerSetFirstRep() { 2210 if (getMonomerSet().isEmpty()) { 2211 addMonomerSet(); 2212 } 2213 return getMonomerSet().get(0); 2214 } 2215 2216 /** 2217 * @return {@link #repeat} (Todo.) 2218 */ 2219 public List<SubstancePolymerRepeatComponent> getRepeat() { 2220 if (this.repeat == null) 2221 this.repeat = new ArrayList<SubstancePolymerRepeatComponent>(); 2222 return this.repeat; 2223 } 2224 2225 /** 2226 * @return Returns a reference to <code>this</code> for easy method chaining 2227 */ 2228 public SubstancePolymer setRepeat(List<SubstancePolymerRepeatComponent> theRepeat) { 2229 this.repeat = theRepeat; 2230 return this; 2231 } 2232 2233 public boolean hasRepeat() { 2234 if (this.repeat == null) 2235 return false; 2236 for (SubstancePolymerRepeatComponent item : this.repeat) 2237 if (!item.isEmpty()) 2238 return true; 2239 return false; 2240 } 2241 2242 public SubstancePolymerRepeatComponent addRepeat() { //3 2243 SubstancePolymerRepeatComponent t = new SubstancePolymerRepeatComponent(); 2244 if (this.repeat == null) 2245 this.repeat = new ArrayList<SubstancePolymerRepeatComponent>(); 2246 this.repeat.add(t); 2247 return t; 2248 } 2249 2250 public SubstancePolymer addRepeat(SubstancePolymerRepeatComponent t) { //3 2251 if (t == null) 2252 return this; 2253 if (this.repeat == null) 2254 this.repeat = new ArrayList<SubstancePolymerRepeatComponent>(); 2255 this.repeat.add(t); 2256 return this; 2257 } 2258 2259 /** 2260 * @return The first repetition of repeating field {@link #repeat}, creating it if it does not already exist {3} 2261 */ 2262 public SubstancePolymerRepeatComponent getRepeatFirstRep() { 2263 if (getRepeat().isEmpty()) { 2264 addRepeat(); 2265 } 2266 return getRepeat().get(0); 2267 } 2268 2269 protected void listChildren(List<Property> children) { 2270 super.listChildren(children); 2271 children.add(new Property("identifier", "Identifier", "Todo.", 0, 1, identifier)); 2272 children.add(new Property("class", "CodeableConcept", "Todo.", 0, 1, class_)); 2273 children.add(new Property("geometry", "CodeableConcept", "Todo.", 0, 1, geometry)); 2274 children.add(new Property("copolymerConnectivity", "CodeableConcept", "Todo.", 0, java.lang.Integer.MAX_VALUE, copolymerConnectivity)); 2275 children.add(new Property("modification", "string", "Todo. This is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder.", 0, 1, modification)); 2276 children.add(new Property("monomerSet", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, monomerSet)); 2277 children.add(new Property("repeat", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, repeat)); 2278 } 2279 2280 @Override 2281 public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { 2282 switch (_hash) { 2283 case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Todo.", 0, 1, identifier); 2284 case 94742904: /*class*/ return new Property("class", "CodeableConcept", "Todo.", 0, 1, class_); 2285 case 1846020210: /*geometry*/ return new Property("geometry", "CodeableConcept", "Todo.", 0, 1, geometry); 2286 case 997107577: /*copolymerConnectivity*/ return new Property("copolymerConnectivity", "CodeableConcept", "Todo.", 0, java.lang.Integer.MAX_VALUE, copolymerConnectivity); 2287 case -684600932: /*modification*/ return new Property("modification", "string", "Todo. This is intended to connect to a repeating full modification structure, also used by Protein and Nucleic Acid . String is just a placeholder.", 0, 1, modification); 2288 case -1622483765: /*monomerSet*/ return new Property("monomerSet", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, monomerSet); 2289 case -934531685: /*repeat*/ return new Property("repeat", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, repeat); 2290 default: return super.getNamedProperty(_hash, _name, _checkValid); 2291 } 2292 2293 } 2294 2295 @Override 2296 public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { 2297 switch (hash) { 2298 case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier 2299 case 94742904: /*class*/ return this.class_ == null ? new Base[0] : new Base[] {this.class_}; // CodeableConcept 2300 case 1846020210: /*geometry*/ return this.geometry == null ? new Base[0] : new Base[] {this.geometry}; // CodeableConcept 2301 case 997107577: /*copolymerConnectivity*/ return this.copolymerConnectivity == null ? new Base[0] : this.copolymerConnectivity.toArray(new Base[this.copolymerConnectivity.size()]); // CodeableConcept 2302 case -684600932: /*modification*/ return this.modification == null ? new Base[0] : new Base[] {this.modification}; // StringType 2303 case -1622483765: /*monomerSet*/ return this.monomerSet == null ? new Base[0] : this.monomerSet.toArray(new Base[this.monomerSet.size()]); // SubstancePolymerMonomerSetComponent 2304 case -934531685: /*repeat*/ return this.repeat == null ? new Base[0] : this.repeat.toArray(new Base[this.repeat.size()]); // SubstancePolymerRepeatComponent 2305 default: return super.getProperty(hash, name, checkValid); 2306 } 2307 2308 } 2309 2310 @Override 2311 public Base setProperty(int hash, String name, Base value) throws FHIRException { 2312 switch (hash) { 2313 case -1618432855: // identifier 2314 this.identifier = TypeConvertor.castToIdentifier(value); // Identifier 2315 return value; 2316 case 94742904: // class 2317 this.class_ = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 2318 return value; 2319 case 1846020210: // geometry 2320 this.geometry = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 2321 return value; 2322 case 997107577: // copolymerConnectivity 2323 this.getCopolymerConnectivity().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept 2324 return value; 2325 case -684600932: // modification 2326 this.modification = TypeConvertor.castToString(value); // StringType 2327 return value; 2328 case -1622483765: // monomerSet 2329 this.getMonomerSet().add((SubstancePolymerMonomerSetComponent) value); // SubstancePolymerMonomerSetComponent 2330 return value; 2331 case -934531685: // repeat 2332 this.getRepeat().add((SubstancePolymerRepeatComponent) value); // SubstancePolymerRepeatComponent 2333 return value; 2334 default: return super.setProperty(hash, name, value); 2335 } 2336 2337 } 2338 2339 @Override 2340 public Base setProperty(String name, Base value) throws FHIRException { 2341 if (name.equals("identifier")) { 2342 this.identifier = TypeConvertor.castToIdentifier(value); // Identifier 2343 } else if (name.equals("class")) { 2344 this.class_ = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 2345 } else if (name.equals("geometry")) { 2346 this.geometry = TypeConvertor.castToCodeableConcept(value); // CodeableConcept 2347 } else if (name.equals("copolymerConnectivity")) { 2348 this.getCopolymerConnectivity().add(TypeConvertor.castToCodeableConcept(value)); 2349 } else if (name.equals("modification")) { 2350 this.modification = TypeConvertor.castToString(value); // StringType 2351 } else if (name.equals("monomerSet")) { 2352 this.getMonomerSet().add((SubstancePolymerMonomerSetComponent) value); 2353 } else if (name.equals("repeat")) { 2354 this.getRepeat().add((SubstancePolymerRepeatComponent) value); 2355 } else 2356 return super.setProperty(name, value); 2357 return value; 2358 } 2359 2360 @Override 2361 public Base makeProperty(int hash, String name) throws FHIRException { 2362 switch (hash) { 2363 case -1618432855: return getIdentifier(); 2364 case 94742904: return getClass_(); 2365 case 1846020210: return getGeometry(); 2366 case 997107577: return addCopolymerConnectivity(); 2367 case -684600932: return getModificationElement(); 2368 case -1622483765: return addMonomerSet(); 2369 case -934531685: return addRepeat(); 2370 default: return super.makeProperty(hash, name); 2371 } 2372 2373 } 2374 2375 @Override 2376 public String[] getTypesForProperty(int hash, String name) throws FHIRException { 2377 switch (hash) { 2378 case -1618432855: /*identifier*/ return new String[] {"Identifier"}; 2379 case 94742904: /*class*/ return new String[] {"CodeableConcept"}; 2380 case 1846020210: /*geometry*/ return new String[] {"CodeableConcept"}; 2381 case 997107577: /*copolymerConnectivity*/ return new String[] {"CodeableConcept"}; 2382 case -684600932: /*modification*/ return new String[] {"string"}; 2383 case -1622483765: /*monomerSet*/ return new String[] {}; 2384 case -934531685: /*repeat*/ return new String[] {}; 2385 default: return super.getTypesForProperty(hash, name); 2386 } 2387 2388 } 2389 2390 @Override 2391 public Base addChild(String name) throws FHIRException { 2392 if (name.equals("identifier")) { 2393 this.identifier = new Identifier(); 2394 return this.identifier; 2395 } 2396 else if (name.equals("class")) { 2397 this.class_ = new CodeableConcept(); 2398 return this.class_; 2399 } 2400 else if (name.equals("geometry")) { 2401 this.geometry = new CodeableConcept(); 2402 return this.geometry; 2403 } 2404 else if (name.equals("copolymerConnectivity")) { 2405 return addCopolymerConnectivity(); 2406 } 2407 else if (name.equals("modification")) { 2408 throw new FHIRException("Cannot call addChild on a primitive type SubstancePolymer.modification"); 2409 } 2410 else if (name.equals("monomerSet")) { 2411 return addMonomerSet(); 2412 } 2413 else if (name.equals("repeat")) { 2414 return addRepeat(); 2415 } 2416 else 2417 return super.addChild(name); 2418 } 2419 2420 public String fhirType() { 2421 return "SubstancePolymer"; 2422 2423 } 2424 2425 public SubstancePolymer copy() { 2426 SubstancePolymer dst = new SubstancePolymer(); 2427 copyValues(dst); 2428 return dst; 2429 } 2430 2431 public void copyValues(SubstancePolymer dst) { 2432 super.copyValues(dst); 2433 dst.identifier = identifier == null ? null : identifier.copy(); 2434 dst.class_ = class_ == null ? null : class_.copy(); 2435 dst.geometry = geometry == null ? null : geometry.copy(); 2436 if (copolymerConnectivity != null) { 2437 dst.copolymerConnectivity = new ArrayList<CodeableConcept>(); 2438 for (CodeableConcept i : copolymerConnectivity) 2439 dst.copolymerConnectivity.add(i.copy()); 2440 }; 2441 dst.modification = modification == null ? null : modification.copy(); 2442 if (monomerSet != null) { 2443 dst.monomerSet = new ArrayList<SubstancePolymerMonomerSetComponent>(); 2444 for (SubstancePolymerMonomerSetComponent i : monomerSet) 2445 dst.monomerSet.add(i.copy()); 2446 }; 2447 if (repeat != null) { 2448 dst.repeat = new ArrayList<SubstancePolymerRepeatComponent>(); 2449 for (SubstancePolymerRepeatComponent i : repeat) 2450 dst.repeat.add(i.copy()); 2451 }; 2452 } 2453 2454 protected SubstancePolymer typedCopy() { 2455 return copy(); 2456 } 2457 2458 @Override 2459 public boolean equalsDeep(Base other_) { 2460 if (!super.equalsDeep(other_)) 2461 return false; 2462 if (!(other_ instanceof SubstancePolymer)) 2463 return false; 2464 SubstancePolymer o = (SubstancePolymer) other_; 2465 return compareDeep(identifier, o.identifier, true) && compareDeep(class_, o.class_, true) && compareDeep(geometry, o.geometry, true) 2466 && compareDeep(copolymerConnectivity, o.copolymerConnectivity, true) && compareDeep(modification, o.modification, true) 2467 && compareDeep(monomerSet, o.monomerSet, true) && compareDeep(repeat, o.repeat, true); 2468 } 2469 2470 @Override 2471 public boolean equalsShallow(Base other_) { 2472 if (!super.equalsShallow(other_)) 2473 return false; 2474 if (!(other_ instanceof SubstancePolymer)) 2475 return false; 2476 SubstancePolymer o = (SubstancePolymer) other_; 2477 return compareValues(modification, o.modification, true); 2478 } 2479 2480 public boolean isEmpty() { 2481 return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, class_, geometry 2482 , copolymerConnectivity, modification, monomerSet, repeat); 2483 } 2484 2485 @Override 2486 public ResourceType getResourceType() { 2487 return ResourceType.SubstancePolymer; 2488 } 2489 2490 2491}