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