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