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