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