001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Thu, Dec 27, 2018 10:06-0500 for FHIR v4.0.0
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import ca.uhn.fhir.model.api.annotation.ResourceDef;
038import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.ChildOrder;
041import ca.uhn.fhir.model.api.annotation.Description;
042import ca.uhn.fhir.model.api.annotation.Block;
043import org.hl7.fhir.instance.model.api.*;
044import org.hl7.fhir.exceptions.FHIRException;
045/**
046 * Source material shall capture information on the taxonomic and anatomical origins as well as the fraction of a material that can result in or can be modified to form a substance. This set of data elements shall be used to define polymer substances isolated from biological matrices. Taxonomic and anatomical origins shall be described using a controlled vocabulary as required. This information is captured for naturally derived polymers ( . starch) and structurally diverse substances. For Organisms belonging to the Kingdom Plantae the Substance level defines the fresh material of a single species or infraspecies, the Herbal Drug and the Herbal preparation. For Herbal preparations, the fraction information will be captured at the Substance information level and additional information for herbal extracts will be captured at the Specified Substance Group 1 information level. See for further explanation the Substance Class: Structurally Diverse and the herbal annex.
047 */
048@ResourceDef(name="SubstanceSourceMaterial", profile="http://hl7.org/fhir/StructureDefinition/SubstanceSourceMaterial")
049public class SubstanceSourceMaterial extends DomainResource {
050
051    @Block()
052    public static class SubstanceSourceMaterialFractionDescriptionComponent extends BackboneElement implements IBaseBackboneElement {
053        /**
054         * This element is capturing information about the fraction of a plant part, or human plasma for fractionation.
055         */
056        @Child(name = "fraction", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
057        @Description(shortDefinition="This element is capturing information about the fraction of a plant part, or human plasma for fractionation", formalDefinition="This element is capturing information about the fraction of a plant part, or human plasma for fractionation." )
058        protected StringType fraction;
059
060        /**
061         * The specific type of the material constituting the component. For Herbal preparations the particulars of the extracts (liquid/dry) is described in Specified Substance Group 1.
062         */
063        @Child(name = "materialType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
064        @Description(shortDefinition="The specific type of the material constituting the component. For Herbal preparations the particulars of the extracts (liquid/dry) is described in Specified Substance Group 1", formalDefinition="The specific type of the material constituting the component. For Herbal preparations the particulars of the extracts (liquid/dry) is described in Specified Substance Group 1." )
065        protected CodeableConcept materialType;
066
067        private static final long serialVersionUID = -1118226733L;
068
069    /**
070     * Constructor
071     */
072      public SubstanceSourceMaterialFractionDescriptionComponent() {
073        super();
074      }
075
076        /**
077         * @return {@link #fraction} (This element is capturing information about the fraction of a plant part, or human plasma for fractionation.). This is the underlying object with id, value and extensions. The accessor "getFraction" gives direct access to the value
078         */
079        public StringType getFractionElement() { 
080          if (this.fraction == null)
081            if (Configuration.errorOnAutoCreate())
082              throw new Error("Attempt to auto-create SubstanceSourceMaterialFractionDescriptionComponent.fraction");
083            else if (Configuration.doAutoCreate())
084              this.fraction = new StringType(); // bb
085          return this.fraction;
086        }
087
088        public boolean hasFractionElement() { 
089          return this.fraction != null && !this.fraction.isEmpty();
090        }
091
092        public boolean hasFraction() { 
093          return this.fraction != null && !this.fraction.isEmpty();
094        }
095
096        /**
097         * @param value {@link #fraction} (This element is capturing information about the fraction of a plant part, or human plasma for fractionation.). This is the underlying object with id, value and extensions. The accessor "getFraction" gives direct access to the value
098         */
099        public SubstanceSourceMaterialFractionDescriptionComponent setFractionElement(StringType value) { 
100          this.fraction = value;
101          return this;
102        }
103
104        /**
105         * @return This element is capturing information about the fraction of a plant part, or human plasma for fractionation.
106         */
107        public String getFraction() { 
108          return this.fraction == null ? null : this.fraction.getValue();
109        }
110
111        /**
112         * @param value This element is capturing information about the fraction of a plant part, or human plasma for fractionation.
113         */
114        public SubstanceSourceMaterialFractionDescriptionComponent setFraction(String value) { 
115          if (Utilities.noString(value))
116            this.fraction = null;
117          else {
118            if (this.fraction == null)
119              this.fraction = new StringType();
120            this.fraction.setValue(value);
121          }
122          return this;
123        }
124
125        /**
126         * @return {@link #materialType} (The specific type of the material constituting the component. For Herbal preparations the particulars of the extracts (liquid/dry) is described in Specified Substance Group 1.)
127         */
128        public CodeableConcept getMaterialType() { 
129          if (this.materialType == null)
130            if (Configuration.errorOnAutoCreate())
131              throw new Error("Attempt to auto-create SubstanceSourceMaterialFractionDescriptionComponent.materialType");
132            else if (Configuration.doAutoCreate())
133              this.materialType = new CodeableConcept(); // cc
134          return this.materialType;
135        }
136
137        public boolean hasMaterialType() { 
138          return this.materialType != null && !this.materialType.isEmpty();
139        }
140
141        /**
142         * @param value {@link #materialType} (The specific type of the material constituting the component. For Herbal preparations the particulars of the extracts (liquid/dry) is described in Specified Substance Group 1.)
143         */
144        public SubstanceSourceMaterialFractionDescriptionComponent setMaterialType(CodeableConcept value) { 
145          this.materialType = value;
146          return this;
147        }
148
149        protected void listChildren(List<Property> children) {
150          super.listChildren(children);
151          children.add(new Property("fraction", "string", "This element is capturing information about the fraction of a plant part, or human plasma for fractionation.", 0, 1, fraction));
152          children.add(new Property("materialType", "CodeableConcept", "The specific type of the material constituting the component. For Herbal preparations the particulars of the extracts (liquid/dry) is described in Specified Substance Group 1.", 0, 1, materialType));
153        }
154
155        @Override
156        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
157          switch (_hash) {
158          case -1653751294: /*fraction*/  return new Property("fraction", "string", "This element is capturing information about the fraction of a plant part, or human plasma for fractionation.", 0, 1, fraction);
159          case -2115601151: /*materialType*/  return new Property("materialType", "CodeableConcept", "The specific type of the material constituting the component. For Herbal preparations the particulars of the extracts (liquid/dry) is described in Specified Substance Group 1.", 0, 1, materialType);
160          default: return super.getNamedProperty(_hash, _name, _checkValid);
161          }
162
163        }
164
165      @Override
166      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
167        switch (hash) {
168        case -1653751294: /*fraction*/ return this.fraction == null ? new Base[0] : new Base[] {this.fraction}; // StringType
169        case -2115601151: /*materialType*/ return this.materialType == null ? new Base[0] : new Base[] {this.materialType}; // CodeableConcept
170        default: return super.getProperty(hash, name, checkValid);
171        }
172
173      }
174
175      @Override
176      public Base setProperty(int hash, String name, Base value) throws FHIRException {
177        switch (hash) {
178        case -1653751294: // fraction
179          this.fraction = castToString(value); // StringType
180          return value;
181        case -2115601151: // materialType
182          this.materialType = castToCodeableConcept(value); // CodeableConcept
183          return value;
184        default: return super.setProperty(hash, name, value);
185        }
186
187      }
188
189      @Override
190      public Base setProperty(String name, Base value) throws FHIRException {
191        if (name.equals("fraction")) {
192          this.fraction = castToString(value); // StringType
193        } else if (name.equals("materialType")) {
194          this.materialType = castToCodeableConcept(value); // CodeableConcept
195        } else
196          return super.setProperty(name, value);
197        return value;
198      }
199
200      @Override
201      public Base makeProperty(int hash, String name) throws FHIRException {
202        switch (hash) {
203        case -1653751294:  return getFractionElement();
204        case -2115601151:  return getMaterialType(); 
205        default: return super.makeProperty(hash, name);
206        }
207
208      }
209
210      @Override
211      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
212        switch (hash) {
213        case -1653751294: /*fraction*/ return new String[] {"string"};
214        case -2115601151: /*materialType*/ return new String[] {"CodeableConcept"};
215        default: return super.getTypesForProperty(hash, name);
216        }
217
218      }
219
220      @Override
221      public Base addChild(String name) throws FHIRException {
222        if (name.equals("fraction")) {
223          throw new FHIRException("Cannot call addChild on a primitive type SubstanceSourceMaterial.fraction");
224        }
225        else if (name.equals("materialType")) {
226          this.materialType = new CodeableConcept();
227          return this.materialType;
228        }
229        else
230          return super.addChild(name);
231      }
232
233      public SubstanceSourceMaterialFractionDescriptionComponent copy() {
234        SubstanceSourceMaterialFractionDescriptionComponent dst = new SubstanceSourceMaterialFractionDescriptionComponent();
235        copyValues(dst);
236        dst.fraction = fraction == null ? null : fraction.copy();
237        dst.materialType = materialType == null ? null : materialType.copy();
238        return dst;
239      }
240
241      @Override
242      public boolean equalsDeep(Base other_) {
243        if (!super.equalsDeep(other_))
244          return false;
245        if (!(other_ instanceof SubstanceSourceMaterialFractionDescriptionComponent))
246          return false;
247        SubstanceSourceMaterialFractionDescriptionComponent o = (SubstanceSourceMaterialFractionDescriptionComponent) other_;
248        return compareDeep(fraction, o.fraction, true) && compareDeep(materialType, o.materialType, true)
249          ;
250      }
251
252      @Override
253      public boolean equalsShallow(Base other_) {
254        if (!super.equalsShallow(other_))
255          return false;
256        if (!(other_ instanceof SubstanceSourceMaterialFractionDescriptionComponent))
257          return false;
258        SubstanceSourceMaterialFractionDescriptionComponent o = (SubstanceSourceMaterialFractionDescriptionComponent) other_;
259        return compareValues(fraction, o.fraction, true);
260      }
261
262      public boolean isEmpty() {
263        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(fraction, materialType);
264      }
265
266  public String fhirType() {
267    return "SubstanceSourceMaterial.fractionDescription";
268
269  }
270
271  }
272
273    @Block()
274    public static class SubstanceSourceMaterialOrganismComponent extends BackboneElement implements IBaseBackboneElement {
275        /**
276         * The family of an organism shall be specified.
277         */
278        @Child(name = "family", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
279        @Description(shortDefinition="The family of an organism shall be specified", formalDefinition="The family of an organism shall be specified." )
280        protected CodeableConcept family;
281
282        /**
283         * The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies.
284         */
285        @Child(name = "genus", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
286        @Description(shortDefinition="The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies", formalDefinition="The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies." )
287        protected CodeableConcept genus;
288
289        /**
290         * The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies.
291         */
292        @Child(name = "species", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
293        @Description(shortDefinition="The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies", formalDefinition="The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies." )
294        protected CodeableConcept species;
295
296        /**
297         * The Intraspecific type of an organism shall be specified.
298         */
299        @Child(name = "intraspecificType", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
300        @Description(shortDefinition="The Intraspecific type of an organism shall be specified", formalDefinition="The Intraspecific type of an organism shall be specified." )
301        protected CodeableConcept intraspecificType;
302
303        /**
304         * The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention.
305         */
306        @Child(name = "intraspecificDescription", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
307        @Description(shortDefinition="The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention", formalDefinition="The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention." )
308        protected StringType intraspecificDescription;
309
310        /**
311         * 4.9.13.6.1 Author type (Conditional).
312         */
313        @Child(name = "author", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
314        @Description(shortDefinition="4.9.13.6.1 Author type (Conditional)", formalDefinition="4.9.13.6.1 Author type (Conditional)." )
315        protected List<SubstanceSourceMaterialOrganismAuthorComponent> author;
316
317        /**
318         * 4.9.13.8.1 Hybrid species maternal organism ID (Optional).
319         */
320        @Child(name = "hybrid", type = {}, order=7, min=0, max=1, modifier=false, summary=true)
321        @Description(shortDefinition="4.9.13.8.1 Hybrid species maternal organism ID (Optional)", formalDefinition="4.9.13.8.1 Hybrid species maternal organism ID (Optional)." )
322        protected SubstanceSourceMaterialOrganismHybridComponent hybrid;
323
324        /**
325         * 4.9.13.7.1 Kingdom (Conditional).
326         */
327        @Child(name = "organismGeneral", type = {}, order=8, min=0, max=1, modifier=false, summary=true)
328        @Description(shortDefinition="4.9.13.7.1 Kingdom (Conditional)", formalDefinition="4.9.13.7.1 Kingdom (Conditional)." )
329        protected SubstanceSourceMaterialOrganismOrganismGeneralComponent organismGeneral;
330
331        private static final long serialVersionUID = 941648312L;
332
333    /**
334     * Constructor
335     */
336      public SubstanceSourceMaterialOrganismComponent() {
337        super();
338      }
339
340        /**
341         * @return {@link #family} (The family of an organism shall be specified.)
342         */
343        public CodeableConcept getFamily() { 
344          if (this.family == null)
345            if (Configuration.errorOnAutoCreate())
346              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismComponent.family");
347            else if (Configuration.doAutoCreate())
348              this.family = new CodeableConcept(); // cc
349          return this.family;
350        }
351
352        public boolean hasFamily() { 
353          return this.family != null && !this.family.isEmpty();
354        }
355
356        /**
357         * @param value {@link #family} (The family of an organism shall be specified.)
358         */
359        public SubstanceSourceMaterialOrganismComponent setFamily(CodeableConcept value) { 
360          this.family = value;
361          return this;
362        }
363
364        /**
365         * @return {@link #genus} (The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies.)
366         */
367        public CodeableConcept getGenus() { 
368          if (this.genus == null)
369            if (Configuration.errorOnAutoCreate())
370              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismComponent.genus");
371            else if (Configuration.doAutoCreate())
372              this.genus = new CodeableConcept(); // cc
373          return this.genus;
374        }
375
376        public boolean hasGenus() { 
377          return this.genus != null && !this.genus.isEmpty();
378        }
379
380        /**
381         * @param value {@link #genus} (The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies.)
382         */
383        public SubstanceSourceMaterialOrganismComponent setGenus(CodeableConcept value) { 
384          this.genus = value;
385          return this;
386        }
387
388        /**
389         * @return {@link #species} (The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies.)
390         */
391        public CodeableConcept getSpecies() { 
392          if (this.species == null)
393            if (Configuration.errorOnAutoCreate())
394              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismComponent.species");
395            else if (Configuration.doAutoCreate())
396              this.species = new CodeableConcept(); // cc
397          return this.species;
398        }
399
400        public boolean hasSpecies() { 
401          return this.species != null && !this.species.isEmpty();
402        }
403
404        /**
405         * @param value {@link #species} (The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies.)
406         */
407        public SubstanceSourceMaterialOrganismComponent setSpecies(CodeableConcept value) { 
408          this.species = value;
409          return this;
410        }
411
412        /**
413         * @return {@link #intraspecificType} (The Intraspecific type of an organism shall be specified.)
414         */
415        public CodeableConcept getIntraspecificType() { 
416          if (this.intraspecificType == null)
417            if (Configuration.errorOnAutoCreate())
418              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismComponent.intraspecificType");
419            else if (Configuration.doAutoCreate())
420              this.intraspecificType = new CodeableConcept(); // cc
421          return this.intraspecificType;
422        }
423
424        public boolean hasIntraspecificType() { 
425          return this.intraspecificType != null && !this.intraspecificType.isEmpty();
426        }
427
428        /**
429         * @param value {@link #intraspecificType} (The Intraspecific type of an organism shall be specified.)
430         */
431        public SubstanceSourceMaterialOrganismComponent setIntraspecificType(CodeableConcept value) { 
432          this.intraspecificType = value;
433          return this;
434        }
435
436        /**
437         * @return {@link #intraspecificDescription} (The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention.). This is the underlying object with id, value and extensions. The accessor "getIntraspecificDescription" gives direct access to the value
438         */
439        public StringType getIntraspecificDescriptionElement() { 
440          if (this.intraspecificDescription == null)
441            if (Configuration.errorOnAutoCreate())
442              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismComponent.intraspecificDescription");
443            else if (Configuration.doAutoCreate())
444              this.intraspecificDescription = new StringType(); // bb
445          return this.intraspecificDescription;
446        }
447
448        public boolean hasIntraspecificDescriptionElement() { 
449          return this.intraspecificDescription != null && !this.intraspecificDescription.isEmpty();
450        }
451
452        public boolean hasIntraspecificDescription() { 
453          return this.intraspecificDescription != null && !this.intraspecificDescription.isEmpty();
454        }
455
456        /**
457         * @param value {@link #intraspecificDescription} (The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention.). This is the underlying object with id, value and extensions. The accessor "getIntraspecificDescription" gives direct access to the value
458         */
459        public SubstanceSourceMaterialOrganismComponent setIntraspecificDescriptionElement(StringType value) { 
460          this.intraspecificDescription = value;
461          return this;
462        }
463
464        /**
465         * @return The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention.
466         */
467        public String getIntraspecificDescription() { 
468          return this.intraspecificDescription == null ? null : this.intraspecificDescription.getValue();
469        }
470
471        /**
472         * @param value The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention.
473         */
474        public SubstanceSourceMaterialOrganismComponent setIntraspecificDescription(String value) { 
475          if (Utilities.noString(value))
476            this.intraspecificDescription = null;
477          else {
478            if (this.intraspecificDescription == null)
479              this.intraspecificDescription = new StringType();
480            this.intraspecificDescription.setValue(value);
481          }
482          return this;
483        }
484
485        /**
486         * @return {@link #author} (4.9.13.6.1 Author type (Conditional).)
487         */
488        public List<SubstanceSourceMaterialOrganismAuthorComponent> getAuthor() { 
489          if (this.author == null)
490            this.author = new ArrayList<SubstanceSourceMaterialOrganismAuthorComponent>();
491          return this.author;
492        }
493
494        /**
495         * @return Returns a reference to <code>this</code> for easy method chaining
496         */
497        public SubstanceSourceMaterialOrganismComponent setAuthor(List<SubstanceSourceMaterialOrganismAuthorComponent> theAuthor) { 
498          this.author = theAuthor;
499          return this;
500        }
501
502        public boolean hasAuthor() { 
503          if (this.author == null)
504            return false;
505          for (SubstanceSourceMaterialOrganismAuthorComponent item : this.author)
506            if (!item.isEmpty())
507              return true;
508          return false;
509        }
510
511        public SubstanceSourceMaterialOrganismAuthorComponent addAuthor() { //3
512          SubstanceSourceMaterialOrganismAuthorComponent t = new SubstanceSourceMaterialOrganismAuthorComponent();
513          if (this.author == null)
514            this.author = new ArrayList<SubstanceSourceMaterialOrganismAuthorComponent>();
515          this.author.add(t);
516          return t;
517        }
518
519        public SubstanceSourceMaterialOrganismComponent addAuthor(SubstanceSourceMaterialOrganismAuthorComponent t) { //3
520          if (t == null)
521            return this;
522          if (this.author == null)
523            this.author = new ArrayList<SubstanceSourceMaterialOrganismAuthorComponent>();
524          this.author.add(t);
525          return this;
526        }
527
528        /**
529         * @return The first repetition of repeating field {@link #author}, creating it if it does not already exist
530         */
531        public SubstanceSourceMaterialOrganismAuthorComponent getAuthorFirstRep() { 
532          if (getAuthor().isEmpty()) {
533            addAuthor();
534          }
535          return getAuthor().get(0);
536        }
537
538        /**
539         * @return {@link #hybrid} (4.9.13.8.1 Hybrid species maternal organism ID (Optional).)
540         */
541        public SubstanceSourceMaterialOrganismHybridComponent getHybrid() { 
542          if (this.hybrid == null)
543            if (Configuration.errorOnAutoCreate())
544              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismComponent.hybrid");
545            else if (Configuration.doAutoCreate())
546              this.hybrid = new SubstanceSourceMaterialOrganismHybridComponent(); // cc
547          return this.hybrid;
548        }
549
550        public boolean hasHybrid() { 
551          return this.hybrid != null && !this.hybrid.isEmpty();
552        }
553
554        /**
555         * @param value {@link #hybrid} (4.9.13.8.1 Hybrid species maternal organism ID (Optional).)
556         */
557        public SubstanceSourceMaterialOrganismComponent setHybrid(SubstanceSourceMaterialOrganismHybridComponent value) { 
558          this.hybrid = value;
559          return this;
560        }
561
562        /**
563         * @return {@link #organismGeneral} (4.9.13.7.1 Kingdom (Conditional).)
564         */
565        public SubstanceSourceMaterialOrganismOrganismGeneralComponent getOrganismGeneral() { 
566          if (this.organismGeneral == null)
567            if (Configuration.errorOnAutoCreate())
568              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismComponent.organismGeneral");
569            else if (Configuration.doAutoCreate())
570              this.organismGeneral = new SubstanceSourceMaterialOrganismOrganismGeneralComponent(); // cc
571          return this.organismGeneral;
572        }
573
574        public boolean hasOrganismGeneral() { 
575          return this.organismGeneral != null && !this.organismGeneral.isEmpty();
576        }
577
578        /**
579         * @param value {@link #organismGeneral} (4.9.13.7.1 Kingdom (Conditional).)
580         */
581        public SubstanceSourceMaterialOrganismComponent setOrganismGeneral(SubstanceSourceMaterialOrganismOrganismGeneralComponent value) { 
582          this.organismGeneral = value;
583          return this;
584        }
585
586        protected void listChildren(List<Property> children) {
587          super.listChildren(children);
588          children.add(new Property("family", "CodeableConcept", "The family of an organism shall be specified.", 0, 1, family));
589          children.add(new Property("genus", "CodeableConcept", "The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies.", 0, 1, genus));
590          children.add(new Property("species", "CodeableConcept", "The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies.", 0, 1, species));
591          children.add(new Property("intraspecificType", "CodeableConcept", "The Intraspecific type of an organism shall be specified.", 0, 1, intraspecificType));
592          children.add(new Property("intraspecificDescription", "string", "The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention.", 0, 1, intraspecificDescription));
593          children.add(new Property("author", "", "4.9.13.6.1 Author type (Conditional).", 0, java.lang.Integer.MAX_VALUE, author));
594          children.add(new Property("hybrid", "", "4.9.13.8.1 Hybrid species maternal organism ID (Optional).", 0, 1, hybrid));
595          children.add(new Property("organismGeneral", "", "4.9.13.7.1 Kingdom (Conditional).", 0, 1, organismGeneral));
596        }
597
598        @Override
599        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
600          switch (_hash) {
601          case -1281860764: /*family*/  return new Property("family", "CodeableConcept", "The family of an organism shall be specified.", 0, 1, family);
602          case 98241006: /*genus*/  return new Property("genus", "CodeableConcept", "The genus of an organism shall be specified; refers to the Latin epithet of the genus element of the plant/animal scientific name; it is present in names for genera, species and infraspecies.", 0, 1, genus);
603          case -2008465092: /*species*/  return new Property("species", "CodeableConcept", "The species of an organism shall be specified; refers to the Latin epithet of the species of the plant/animal; it is present in names for species and infraspecies.", 0, 1, species);
604          case 1717161194: /*intraspecificType*/  return new Property("intraspecificType", "CodeableConcept", "The Intraspecific type of an organism shall be specified.", 0, 1, intraspecificType);
605          case -1473085364: /*intraspecificDescription*/  return new Property("intraspecificDescription", "string", "The intraspecific description of an organism shall be specified based on a controlled vocabulary. For Influenza Vaccine, the intraspecific description shall contain the syntax of the antigen in line with the WHO convention.", 0, 1, intraspecificDescription);
606          case -1406328437: /*author*/  return new Property("author", "", "4.9.13.6.1 Author type (Conditional).", 0, java.lang.Integer.MAX_VALUE, author);
607          case -1202757124: /*hybrid*/  return new Property("hybrid", "", "4.9.13.8.1 Hybrid species maternal organism ID (Optional).", 0, 1, hybrid);
608          case -865996874: /*organismGeneral*/  return new Property("organismGeneral", "", "4.9.13.7.1 Kingdom (Conditional).", 0, 1, organismGeneral);
609          default: return super.getNamedProperty(_hash, _name, _checkValid);
610          }
611
612        }
613
614      @Override
615      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
616        switch (hash) {
617        case -1281860764: /*family*/ return this.family == null ? new Base[0] : new Base[] {this.family}; // CodeableConcept
618        case 98241006: /*genus*/ return this.genus == null ? new Base[0] : new Base[] {this.genus}; // CodeableConcept
619        case -2008465092: /*species*/ return this.species == null ? new Base[0] : new Base[] {this.species}; // CodeableConcept
620        case 1717161194: /*intraspecificType*/ return this.intraspecificType == null ? new Base[0] : new Base[] {this.intraspecificType}; // CodeableConcept
621        case -1473085364: /*intraspecificDescription*/ return this.intraspecificDescription == null ? new Base[0] : new Base[] {this.intraspecificDescription}; // StringType
622        case -1406328437: /*author*/ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // SubstanceSourceMaterialOrganismAuthorComponent
623        case -1202757124: /*hybrid*/ return this.hybrid == null ? new Base[0] : new Base[] {this.hybrid}; // SubstanceSourceMaterialOrganismHybridComponent
624        case -865996874: /*organismGeneral*/ return this.organismGeneral == null ? new Base[0] : new Base[] {this.organismGeneral}; // SubstanceSourceMaterialOrganismOrganismGeneralComponent
625        default: return super.getProperty(hash, name, checkValid);
626        }
627
628      }
629
630      @Override
631      public Base setProperty(int hash, String name, Base value) throws FHIRException {
632        switch (hash) {
633        case -1281860764: // family
634          this.family = castToCodeableConcept(value); // CodeableConcept
635          return value;
636        case 98241006: // genus
637          this.genus = castToCodeableConcept(value); // CodeableConcept
638          return value;
639        case -2008465092: // species
640          this.species = castToCodeableConcept(value); // CodeableConcept
641          return value;
642        case 1717161194: // intraspecificType
643          this.intraspecificType = castToCodeableConcept(value); // CodeableConcept
644          return value;
645        case -1473085364: // intraspecificDescription
646          this.intraspecificDescription = castToString(value); // StringType
647          return value;
648        case -1406328437: // author
649          this.getAuthor().add((SubstanceSourceMaterialOrganismAuthorComponent) value); // SubstanceSourceMaterialOrganismAuthorComponent
650          return value;
651        case -1202757124: // hybrid
652          this.hybrid = (SubstanceSourceMaterialOrganismHybridComponent) value; // SubstanceSourceMaterialOrganismHybridComponent
653          return value;
654        case -865996874: // organismGeneral
655          this.organismGeneral = (SubstanceSourceMaterialOrganismOrganismGeneralComponent) value; // SubstanceSourceMaterialOrganismOrganismGeneralComponent
656          return value;
657        default: return super.setProperty(hash, name, value);
658        }
659
660      }
661
662      @Override
663      public Base setProperty(String name, Base value) throws FHIRException {
664        if (name.equals("family")) {
665          this.family = castToCodeableConcept(value); // CodeableConcept
666        } else if (name.equals("genus")) {
667          this.genus = castToCodeableConcept(value); // CodeableConcept
668        } else if (name.equals("species")) {
669          this.species = castToCodeableConcept(value); // CodeableConcept
670        } else if (name.equals("intraspecificType")) {
671          this.intraspecificType = castToCodeableConcept(value); // CodeableConcept
672        } else if (name.equals("intraspecificDescription")) {
673          this.intraspecificDescription = castToString(value); // StringType
674        } else if (name.equals("author")) {
675          this.getAuthor().add((SubstanceSourceMaterialOrganismAuthorComponent) value);
676        } else if (name.equals("hybrid")) {
677          this.hybrid = (SubstanceSourceMaterialOrganismHybridComponent) value; // SubstanceSourceMaterialOrganismHybridComponent
678        } else if (name.equals("organismGeneral")) {
679          this.organismGeneral = (SubstanceSourceMaterialOrganismOrganismGeneralComponent) value; // SubstanceSourceMaterialOrganismOrganismGeneralComponent
680        } else
681          return super.setProperty(name, value);
682        return value;
683      }
684
685      @Override
686      public Base makeProperty(int hash, String name) throws FHIRException {
687        switch (hash) {
688        case -1281860764:  return getFamily(); 
689        case 98241006:  return getGenus(); 
690        case -2008465092:  return getSpecies(); 
691        case 1717161194:  return getIntraspecificType(); 
692        case -1473085364:  return getIntraspecificDescriptionElement();
693        case -1406328437:  return addAuthor(); 
694        case -1202757124:  return getHybrid(); 
695        case -865996874:  return getOrganismGeneral(); 
696        default: return super.makeProperty(hash, name);
697        }
698
699      }
700
701      @Override
702      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
703        switch (hash) {
704        case -1281860764: /*family*/ return new String[] {"CodeableConcept"};
705        case 98241006: /*genus*/ return new String[] {"CodeableConcept"};
706        case -2008465092: /*species*/ return new String[] {"CodeableConcept"};
707        case 1717161194: /*intraspecificType*/ return new String[] {"CodeableConcept"};
708        case -1473085364: /*intraspecificDescription*/ return new String[] {"string"};
709        case -1406328437: /*author*/ return new String[] {};
710        case -1202757124: /*hybrid*/ return new String[] {};
711        case -865996874: /*organismGeneral*/ return new String[] {};
712        default: return super.getTypesForProperty(hash, name);
713        }
714
715      }
716
717      @Override
718      public Base addChild(String name) throws FHIRException {
719        if (name.equals("family")) {
720          this.family = new CodeableConcept();
721          return this.family;
722        }
723        else if (name.equals("genus")) {
724          this.genus = new CodeableConcept();
725          return this.genus;
726        }
727        else if (name.equals("species")) {
728          this.species = new CodeableConcept();
729          return this.species;
730        }
731        else if (name.equals("intraspecificType")) {
732          this.intraspecificType = new CodeableConcept();
733          return this.intraspecificType;
734        }
735        else if (name.equals("intraspecificDescription")) {
736          throw new FHIRException("Cannot call addChild on a primitive type SubstanceSourceMaterial.intraspecificDescription");
737        }
738        else if (name.equals("author")) {
739          return addAuthor();
740        }
741        else if (name.equals("hybrid")) {
742          this.hybrid = new SubstanceSourceMaterialOrganismHybridComponent();
743          return this.hybrid;
744        }
745        else if (name.equals("organismGeneral")) {
746          this.organismGeneral = new SubstanceSourceMaterialOrganismOrganismGeneralComponent();
747          return this.organismGeneral;
748        }
749        else
750          return super.addChild(name);
751      }
752
753      public SubstanceSourceMaterialOrganismComponent copy() {
754        SubstanceSourceMaterialOrganismComponent dst = new SubstanceSourceMaterialOrganismComponent();
755        copyValues(dst);
756        dst.family = family == null ? null : family.copy();
757        dst.genus = genus == null ? null : genus.copy();
758        dst.species = species == null ? null : species.copy();
759        dst.intraspecificType = intraspecificType == null ? null : intraspecificType.copy();
760        dst.intraspecificDescription = intraspecificDescription == null ? null : intraspecificDescription.copy();
761        if (author != null) {
762          dst.author = new ArrayList<SubstanceSourceMaterialOrganismAuthorComponent>();
763          for (SubstanceSourceMaterialOrganismAuthorComponent i : author)
764            dst.author.add(i.copy());
765        };
766        dst.hybrid = hybrid == null ? null : hybrid.copy();
767        dst.organismGeneral = organismGeneral == null ? null : organismGeneral.copy();
768        return dst;
769      }
770
771      @Override
772      public boolean equalsDeep(Base other_) {
773        if (!super.equalsDeep(other_))
774          return false;
775        if (!(other_ instanceof SubstanceSourceMaterialOrganismComponent))
776          return false;
777        SubstanceSourceMaterialOrganismComponent o = (SubstanceSourceMaterialOrganismComponent) other_;
778        return compareDeep(family, o.family, true) && compareDeep(genus, o.genus, true) && compareDeep(species, o.species, true)
779           && compareDeep(intraspecificType, o.intraspecificType, true) && compareDeep(intraspecificDescription, o.intraspecificDescription, true)
780           && compareDeep(author, o.author, true) && compareDeep(hybrid, o.hybrid, true) && compareDeep(organismGeneral, o.organismGeneral, true)
781          ;
782      }
783
784      @Override
785      public boolean equalsShallow(Base other_) {
786        if (!super.equalsShallow(other_))
787          return false;
788        if (!(other_ instanceof SubstanceSourceMaterialOrganismComponent))
789          return false;
790        SubstanceSourceMaterialOrganismComponent o = (SubstanceSourceMaterialOrganismComponent) other_;
791        return compareValues(intraspecificDescription, o.intraspecificDescription, true);
792      }
793
794      public boolean isEmpty() {
795        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(family, genus, species, intraspecificType
796          , intraspecificDescription, author, hybrid, organismGeneral);
797      }
798
799  public String fhirType() {
800    return "SubstanceSourceMaterial.organism";
801
802  }
803
804  }
805
806    @Block()
807    public static class SubstanceSourceMaterialOrganismAuthorComponent extends BackboneElement implements IBaseBackboneElement {
808        /**
809         * The type of author of an organism species shall be specified. The parenthetical author of an organism species refers to the first author who published the plant/animal name (of any rank). The primary author of an organism species refers to the first author(s), who validly published the plant/animal name.
810         */
811        @Child(name = "authorType", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
812        @Description(shortDefinition="The type of author of an organism species shall be specified. The parenthetical author of an organism species refers to the first author who published the plant/animal name (of any rank). The primary author of an organism species refers to the first author(s), who validly published the plant/animal name", formalDefinition="The type of author of an organism species shall be specified. The parenthetical author of an organism species refers to the first author who published the plant/animal name (of any rank). The primary author of an organism species refers to the first author(s), who validly published the plant/animal name." )
813        protected CodeableConcept authorType;
814
815        /**
816         * The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank).
817         */
818        @Child(name = "authorDescription", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
819        @Description(shortDefinition="The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank)", formalDefinition="The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank)." )
820        protected StringType authorDescription;
821
822        private static final long serialVersionUID = 1429770120L;
823
824    /**
825     * Constructor
826     */
827      public SubstanceSourceMaterialOrganismAuthorComponent() {
828        super();
829      }
830
831        /**
832         * @return {@link #authorType} (The type of author of an organism species shall be specified. The parenthetical author of an organism species refers to the first author who published the plant/animal name (of any rank). The primary author of an organism species refers to the first author(s), who validly published the plant/animal name.)
833         */
834        public CodeableConcept getAuthorType() { 
835          if (this.authorType == null)
836            if (Configuration.errorOnAutoCreate())
837              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismAuthorComponent.authorType");
838            else if (Configuration.doAutoCreate())
839              this.authorType = new CodeableConcept(); // cc
840          return this.authorType;
841        }
842
843        public boolean hasAuthorType() { 
844          return this.authorType != null && !this.authorType.isEmpty();
845        }
846
847        /**
848         * @param value {@link #authorType} (The type of author of an organism species shall be specified. The parenthetical author of an organism species refers to the first author who published the plant/animal name (of any rank). The primary author of an organism species refers to the first author(s), who validly published the plant/animal name.)
849         */
850        public SubstanceSourceMaterialOrganismAuthorComponent setAuthorType(CodeableConcept value) { 
851          this.authorType = value;
852          return this;
853        }
854
855        /**
856         * @return {@link #authorDescription} (The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank).). This is the underlying object with id, value and extensions. The accessor "getAuthorDescription" gives direct access to the value
857         */
858        public StringType getAuthorDescriptionElement() { 
859          if (this.authorDescription == null)
860            if (Configuration.errorOnAutoCreate())
861              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismAuthorComponent.authorDescription");
862            else if (Configuration.doAutoCreate())
863              this.authorDescription = new StringType(); // bb
864          return this.authorDescription;
865        }
866
867        public boolean hasAuthorDescriptionElement() { 
868          return this.authorDescription != null && !this.authorDescription.isEmpty();
869        }
870
871        public boolean hasAuthorDescription() { 
872          return this.authorDescription != null && !this.authorDescription.isEmpty();
873        }
874
875        /**
876         * @param value {@link #authorDescription} (The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank).). This is the underlying object with id, value and extensions. The accessor "getAuthorDescription" gives direct access to the value
877         */
878        public SubstanceSourceMaterialOrganismAuthorComponent setAuthorDescriptionElement(StringType value) { 
879          this.authorDescription = value;
880          return this;
881        }
882
883        /**
884         * @return The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank).
885         */
886        public String getAuthorDescription() { 
887          return this.authorDescription == null ? null : this.authorDescription.getValue();
888        }
889
890        /**
891         * @param value The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank).
892         */
893        public SubstanceSourceMaterialOrganismAuthorComponent setAuthorDescription(String value) { 
894          if (Utilities.noString(value))
895            this.authorDescription = null;
896          else {
897            if (this.authorDescription == null)
898              this.authorDescription = new StringType();
899            this.authorDescription.setValue(value);
900          }
901          return this;
902        }
903
904        protected void listChildren(List<Property> children) {
905          super.listChildren(children);
906          children.add(new Property("authorType", "CodeableConcept", "The type of author of an organism species shall be specified. The parenthetical author of an organism species refers to the first author who published the plant/animal name (of any rank). The primary author of an organism species refers to the first author(s), who validly published the plant/animal name.", 0, 1, authorType));
907          children.add(new Property("authorDescription", "string", "The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank).", 0, 1, authorDescription));
908        }
909
910        @Override
911        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
912          switch (_hash) {
913          case -1501337755: /*authorType*/  return new Property("authorType", "CodeableConcept", "The type of author of an organism species shall be specified. The parenthetical author of an organism species refers to the first author who published the plant/animal name (of any rank). The primary author of an organism species refers to the first author(s), who validly published the plant/animal name.", 0, 1, authorType);
914          case -166185615: /*authorDescription*/  return new Property("authorDescription", "string", "The author of an organism species shall be specified. The author year of an organism shall also be specified when applicable; refers to the year in which the first author(s) published the infraspecific plant/animal name (of any rank).", 0, 1, authorDescription);
915          default: return super.getNamedProperty(_hash, _name, _checkValid);
916          }
917
918        }
919
920      @Override
921      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
922        switch (hash) {
923        case -1501337755: /*authorType*/ return this.authorType == null ? new Base[0] : new Base[] {this.authorType}; // CodeableConcept
924        case -166185615: /*authorDescription*/ return this.authorDescription == null ? new Base[0] : new Base[] {this.authorDescription}; // StringType
925        default: return super.getProperty(hash, name, checkValid);
926        }
927
928      }
929
930      @Override
931      public Base setProperty(int hash, String name, Base value) throws FHIRException {
932        switch (hash) {
933        case -1501337755: // authorType
934          this.authorType = castToCodeableConcept(value); // CodeableConcept
935          return value;
936        case -166185615: // authorDescription
937          this.authorDescription = castToString(value); // StringType
938          return value;
939        default: return super.setProperty(hash, name, value);
940        }
941
942      }
943
944      @Override
945      public Base setProperty(String name, Base value) throws FHIRException {
946        if (name.equals("authorType")) {
947          this.authorType = castToCodeableConcept(value); // CodeableConcept
948        } else if (name.equals("authorDescription")) {
949          this.authorDescription = castToString(value); // StringType
950        } else
951          return super.setProperty(name, value);
952        return value;
953      }
954
955      @Override
956      public Base makeProperty(int hash, String name) throws FHIRException {
957        switch (hash) {
958        case -1501337755:  return getAuthorType(); 
959        case -166185615:  return getAuthorDescriptionElement();
960        default: return super.makeProperty(hash, name);
961        }
962
963      }
964
965      @Override
966      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
967        switch (hash) {
968        case -1501337755: /*authorType*/ return new String[] {"CodeableConcept"};
969        case -166185615: /*authorDescription*/ return new String[] {"string"};
970        default: return super.getTypesForProperty(hash, name);
971        }
972
973      }
974
975      @Override
976      public Base addChild(String name) throws FHIRException {
977        if (name.equals("authorType")) {
978          this.authorType = new CodeableConcept();
979          return this.authorType;
980        }
981        else if (name.equals("authorDescription")) {
982          throw new FHIRException("Cannot call addChild on a primitive type SubstanceSourceMaterial.authorDescription");
983        }
984        else
985          return super.addChild(name);
986      }
987
988      public SubstanceSourceMaterialOrganismAuthorComponent copy() {
989        SubstanceSourceMaterialOrganismAuthorComponent dst = new SubstanceSourceMaterialOrganismAuthorComponent();
990        copyValues(dst);
991        dst.authorType = authorType == null ? null : authorType.copy();
992        dst.authorDescription = authorDescription == null ? null : authorDescription.copy();
993        return dst;
994      }
995
996      @Override
997      public boolean equalsDeep(Base other_) {
998        if (!super.equalsDeep(other_))
999          return false;
1000        if (!(other_ instanceof SubstanceSourceMaterialOrganismAuthorComponent))
1001          return false;
1002        SubstanceSourceMaterialOrganismAuthorComponent o = (SubstanceSourceMaterialOrganismAuthorComponent) other_;
1003        return compareDeep(authorType, o.authorType, true) && compareDeep(authorDescription, o.authorDescription, true)
1004          ;
1005      }
1006
1007      @Override
1008      public boolean equalsShallow(Base other_) {
1009        if (!super.equalsShallow(other_))
1010          return false;
1011        if (!(other_ instanceof SubstanceSourceMaterialOrganismAuthorComponent))
1012          return false;
1013        SubstanceSourceMaterialOrganismAuthorComponent o = (SubstanceSourceMaterialOrganismAuthorComponent) other_;
1014        return compareValues(authorDescription, o.authorDescription, true);
1015      }
1016
1017      public boolean isEmpty() {
1018        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(authorType, authorDescription
1019          );
1020      }
1021
1022  public String fhirType() {
1023    return "SubstanceSourceMaterial.organism.author";
1024
1025  }
1026
1027  }
1028
1029    @Block()
1030    public static class SubstanceSourceMaterialOrganismHybridComponent extends BackboneElement implements IBaseBackboneElement {
1031        /**
1032         * The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.
1033         */
1034        @Child(name = "maternalOrganismId", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1035        @Description(shortDefinition="The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal", formalDefinition="The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal." )
1036        protected StringType maternalOrganismId;
1037
1038        /**
1039         * The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.
1040         */
1041        @Child(name = "maternalOrganismName", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1042        @Description(shortDefinition="The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal", formalDefinition="The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal." )
1043        protected StringType maternalOrganismName;
1044
1045        /**
1046         * The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary.
1047         */
1048        @Child(name = "paternalOrganismId", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1049        @Description(shortDefinition="The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary", formalDefinition="The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary." )
1050        protected StringType paternalOrganismId;
1051
1052        /**
1053         * The name of the paternal species constituting the hybrid organism shall be specified.
1054         */
1055        @Child(name = "paternalOrganismName", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1056        @Description(shortDefinition="The name of the paternal species constituting the hybrid organism shall be specified", formalDefinition="The name of the paternal species constituting the hybrid organism shall be specified." )
1057        protected StringType paternalOrganismName;
1058
1059        /**
1060         * The hybrid type of an organism shall be specified.
1061         */
1062        @Child(name = "hybridType", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
1063        @Description(shortDefinition="The hybrid type of an organism shall be specified", formalDefinition="The hybrid type of an organism shall be specified." )
1064        protected CodeableConcept hybridType;
1065
1066        private static final long serialVersionUID = 1981189787L;
1067
1068    /**
1069     * Constructor
1070     */
1071      public SubstanceSourceMaterialOrganismHybridComponent() {
1072        super();
1073      }
1074
1075        /**
1076         * @return {@link #maternalOrganismId} (The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.). This is the underlying object with id, value and extensions. The accessor "getMaternalOrganismId" gives direct access to the value
1077         */
1078        public StringType getMaternalOrganismIdElement() { 
1079          if (this.maternalOrganismId == null)
1080            if (Configuration.errorOnAutoCreate())
1081              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismHybridComponent.maternalOrganismId");
1082            else if (Configuration.doAutoCreate())
1083              this.maternalOrganismId = new StringType(); // bb
1084          return this.maternalOrganismId;
1085        }
1086
1087        public boolean hasMaternalOrganismIdElement() { 
1088          return this.maternalOrganismId != null && !this.maternalOrganismId.isEmpty();
1089        }
1090
1091        public boolean hasMaternalOrganismId() { 
1092          return this.maternalOrganismId != null && !this.maternalOrganismId.isEmpty();
1093        }
1094
1095        /**
1096         * @param value {@link #maternalOrganismId} (The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.). This is the underlying object with id, value and extensions. The accessor "getMaternalOrganismId" gives direct access to the value
1097         */
1098        public SubstanceSourceMaterialOrganismHybridComponent setMaternalOrganismIdElement(StringType value) { 
1099          this.maternalOrganismId = value;
1100          return this;
1101        }
1102
1103        /**
1104         * @return The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.
1105         */
1106        public String getMaternalOrganismId() { 
1107          return this.maternalOrganismId == null ? null : this.maternalOrganismId.getValue();
1108        }
1109
1110        /**
1111         * @param value The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.
1112         */
1113        public SubstanceSourceMaterialOrganismHybridComponent setMaternalOrganismId(String value) { 
1114          if (Utilities.noString(value))
1115            this.maternalOrganismId = null;
1116          else {
1117            if (this.maternalOrganismId == null)
1118              this.maternalOrganismId = new StringType();
1119            this.maternalOrganismId.setValue(value);
1120          }
1121          return this;
1122        }
1123
1124        /**
1125         * @return {@link #maternalOrganismName} (The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.). This is the underlying object with id, value and extensions. The accessor "getMaternalOrganismName" gives direct access to the value
1126         */
1127        public StringType getMaternalOrganismNameElement() { 
1128          if (this.maternalOrganismName == null)
1129            if (Configuration.errorOnAutoCreate())
1130              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismHybridComponent.maternalOrganismName");
1131            else if (Configuration.doAutoCreate())
1132              this.maternalOrganismName = new StringType(); // bb
1133          return this.maternalOrganismName;
1134        }
1135
1136        public boolean hasMaternalOrganismNameElement() { 
1137          return this.maternalOrganismName != null && !this.maternalOrganismName.isEmpty();
1138        }
1139
1140        public boolean hasMaternalOrganismName() { 
1141          return this.maternalOrganismName != null && !this.maternalOrganismName.isEmpty();
1142        }
1143
1144        /**
1145         * @param value {@link #maternalOrganismName} (The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.). This is the underlying object with id, value and extensions. The accessor "getMaternalOrganismName" gives direct access to the value
1146         */
1147        public SubstanceSourceMaterialOrganismHybridComponent setMaternalOrganismNameElement(StringType value) { 
1148          this.maternalOrganismName = value;
1149          return this;
1150        }
1151
1152        /**
1153         * @return The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.
1154         */
1155        public String getMaternalOrganismName() { 
1156          return this.maternalOrganismName == null ? null : this.maternalOrganismName.getValue();
1157        }
1158
1159        /**
1160         * @param value The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.
1161         */
1162        public SubstanceSourceMaterialOrganismHybridComponent setMaternalOrganismName(String value) { 
1163          if (Utilities.noString(value))
1164            this.maternalOrganismName = null;
1165          else {
1166            if (this.maternalOrganismName == null)
1167              this.maternalOrganismName = new StringType();
1168            this.maternalOrganismName.setValue(value);
1169          }
1170          return this;
1171        }
1172
1173        /**
1174         * @return {@link #paternalOrganismId} (The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary.). This is the underlying object with id, value and extensions. The accessor "getPaternalOrganismId" gives direct access to the value
1175         */
1176        public StringType getPaternalOrganismIdElement() { 
1177          if (this.paternalOrganismId == null)
1178            if (Configuration.errorOnAutoCreate())
1179              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismHybridComponent.paternalOrganismId");
1180            else if (Configuration.doAutoCreate())
1181              this.paternalOrganismId = new StringType(); // bb
1182          return this.paternalOrganismId;
1183        }
1184
1185        public boolean hasPaternalOrganismIdElement() { 
1186          return this.paternalOrganismId != null && !this.paternalOrganismId.isEmpty();
1187        }
1188
1189        public boolean hasPaternalOrganismId() { 
1190          return this.paternalOrganismId != null && !this.paternalOrganismId.isEmpty();
1191        }
1192
1193        /**
1194         * @param value {@link #paternalOrganismId} (The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary.). This is the underlying object with id, value and extensions. The accessor "getPaternalOrganismId" gives direct access to the value
1195         */
1196        public SubstanceSourceMaterialOrganismHybridComponent setPaternalOrganismIdElement(StringType value) { 
1197          this.paternalOrganismId = value;
1198          return this;
1199        }
1200
1201        /**
1202         * @return The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary.
1203         */
1204        public String getPaternalOrganismId() { 
1205          return this.paternalOrganismId == null ? null : this.paternalOrganismId.getValue();
1206        }
1207
1208        /**
1209         * @param value The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary.
1210         */
1211        public SubstanceSourceMaterialOrganismHybridComponent setPaternalOrganismId(String value) { 
1212          if (Utilities.noString(value))
1213            this.paternalOrganismId = null;
1214          else {
1215            if (this.paternalOrganismId == null)
1216              this.paternalOrganismId = new StringType();
1217            this.paternalOrganismId.setValue(value);
1218          }
1219          return this;
1220        }
1221
1222        /**
1223         * @return {@link #paternalOrganismName} (The name of the paternal species constituting the hybrid organism shall be specified.). This is the underlying object with id, value and extensions. The accessor "getPaternalOrganismName" gives direct access to the value
1224         */
1225        public StringType getPaternalOrganismNameElement() { 
1226          if (this.paternalOrganismName == null)
1227            if (Configuration.errorOnAutoCreate())
1228              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismHybridComponent.paternalOrganismName");
1229            else if (Configuration.doAutoCreate())
1230              this.paternalOrganismName = new StringType(); // bb
1231          return this.paternalOrganismName;
1232        }
1233
1234        public boolean hasPaternalOrganismNameElement() { 
1235          return this.paternalOrganismName != null && !this.paternalOrganismName.isEmpty();
1236        }
1237
1238        public boolean hasPaternalOrganismName() { 
1239          return this.paternalOrganismName != null && !this.paternalOrganismName.isEmpty();
1240        }
1241
1242        /**
1243         * @param value {@link #paternalOrganismName} (The name of the paternal species constituting the hybrid organism shall be specified.). This is the underlying object with id, value and extensions. The accessor "getPaternalOrganismName" gives direct access to the value
1244         */
1245        public SubstanceSourceMaterialOrganismHybridComponent setPaternalOrganismNameElement(StringType value) { 
1246          this.paternalOrganismName = value;
1247          return this;
1248        }
1249
1250        /**
1251         * @return The name of the paternal species constituting the hybrid organism shall be specified.
1252         */
1253        public String getPaternalOrganismName() { 
1254          return this.paternalOrganismName == null ? null : this.paternalOrganismName.getValue();
1255        }
1256
1257        /**
1258         * @param value The name of the paternal species constituting the hybrid organism shall be specified.
1259         */
1260        public SubstanceSourceMaterialOrganismHybridComponent setPaternalOrganismName(String value) { 
1261          if (Utilities.noString(value))
1262            this.paternalOrganismName = null;
1263          else {
1264            if (this.paternalOrganismName == null)
1265              this.paternalOrganismName = new StringType();
1266            this.paternalOrganismName.setValue(value);
1267          }
1268          return this;
1269        }
1270
1271        /**
1272         * @return {@link #hybridType} (The hybrid type of an organism shall be specified.)
1273         */
1274        public CodeableConcept getHybridType() { 
1275          if (this.hybridType == null)
1276            if (Configuration.errorOnAutoCreate())
1277              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismHybridComponent.hybridType");
1278            else if (Configuration.doAutoCreate())
1279              this.hybridType = new CodeableConcept(); // cc
1280          return this.hybridType;
1281        }
1282
1283        public boolean hasHybridType() { 
1284          return this.hybridType != null && !this.hybridType.isEmpty();
1285        }
1286
1287        /**
1288         * @param value {@link #hybridType} (The hybrid type of an organism shall be specified.)
1289         */
1290        public SubstanceSourceMaterialOrganismHybridComponent setHybridType(CodeableConcept value) { 
1291          this.hybridType = value;
1292          return this;
1293        }
1294
1295        protected void listChildren(List<Property> children) {
1296          super.listChildren(children);
1297          children.add(new Property("maternalOrganismId", "string", "The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.", 0, 1, maternalOrganismId));
1298          children.add(new Property("maternalOrganismName", "string", "The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.", 0, 1, maternalOrganismName));
1299          children.add(new Property("paternalOrganismId", "string", "The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary.", 0, 1, paternalOrganismId));
1300          children.add(new Property("paternalOrganismName", "string", "The name of the paternal species constituting the hybrid organism shall be specified.", 0, 1, paternalOrganismName));
1301          children.add(new Property("hybridType", "CodeableConcept", "The hybrid type of an organism shall be specified.", 0, 1, hybridType));
1302        }
1303
1304        @Override
1305        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1306          switch (_hash) {
1307          case -1179977063: /*maternalOrganismId*/  return new Property("maternalOrganismId", "string", "The identifier of the maternal species constituting the hybrid organism shall be specified based on a controlled vocabulary. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.", 0, 1, maternalOrganismId);
1308          case -86441847: /*maternalOrganismName*/  return new Property("maternalOrganismName", "string", "The name of the maternal species constituting the hybrid organism shall be specified. For plants, the parents aren’t always known, and it is unlikely that it will be known which is maternal and which is paternal.", 0, 1, maternalOrganismName);
1309          case 123773174: /*paternalOrganismId*/  return new Property("paternalOrganismId", "string", "The identifier of the paternal species constituting the hybrid organism shall be specified based on a controlled vocabulary.", 0, 1, paternalOrganismId);
1310          case -1312914522: /*paternalOrganismName*/  return new Property("paternalOrganismName", "string", "The name of the paternal species constituting the hybrid organism shall be specified.", 0, 1, paternalOrganismName);
1311          case 1572734806: /*hybridType*/  return new Property("hybridType", "CodeableConcept", "The hybrid type of an organism shall be specified.", 0, 1, hybridType);
1312          default: return super.getNamedProperty(_hash, _name, _checkValid);
1313          }
1314
1315        }
1316
1317      @Override
1318      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1319        switch (hash) {
1320        case -1179977063: /*maternalOrganismId*/ return this.maternalOrganismId == null ? new Base[0] : new Base[] {this.maternalOrganismId}; // StringType
1321        case -86441847: /*maternalOrganismName*/ return this.maternalOrganismName == null ? new Base[0] : new Base[] {this.maternalOrganismName}; // StringType
1322        case 123773174: /*paternalOrganismId*/ return this.paternalOrganismId == null ? new Base[0] : new Base[] {this.paternalOrganismId}; // StringType
1323        case -1312914522: /*paternalOrganismName*/ return this.paternalOrganismName == null ? new Base[0] : new Base[] {this.paternalOrganismName}; // StringType
1324        case 1572734806: /*hybridType*/ return this.hybridType == null ? new Base[0] : new Base[] {this.hybridType}; // CodeableConcept
1325        default: return super.getProperty(hash, name, checkValid);
1326        }
1327
1328      }
1329
1330      @Override
1331      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1332        switch (hash) {
1333        case -1179977063: // maternalOrganismId
1334          this.maternalOrganismId = castToString(value); // StringType
1335          return value;
1336        case -86441847: // maternalOrganismName
1337          this.maternalOrganismName = castToString(value); // StringType
1338          return value;
1339        case 123773174: // paternalOrganismId
1340          this.paternalOrganismId = castToString(value); // StringType
1341          return value;
1342        case -1312914522: // paternalOrganismName
1343          this.paternalOrganismName = castToString(value); // StringType
1344          return value;
1345        case 1572734806: // hybridType
1346          this.hybridType = castToCodeableConcept(value); // CodeableConcept
1347          return value;
1348        default: return super.setProperty(hash, name, value);
1349        }
1350
1351      }
1352
1353      @Override
1354      public Base setProperty(String name, Base value) throws FHIRException {
1355        if (name.equals("maternalOrganismId")) {
1356          this.maternalOrganismId = castToString(value); // StringType
1357        } else if (name.equals("maternalOrganismName")) {
1358          this.maternalOrganismName = castToString(value); // StringType
1359        } else if (name.equals("paternalOrganismId")) {
1360          this.paternalOrganismId = castToString(value); // StringType
1361        } else if (name.equals("paternalOrganismName")) {
1362          this.paternalOrganismName = castToString(value); // StringType
1363        } else if (name.equals("hybridType")) {
1364          this.hybridType = castToCodeableConcept(value); // CodeableConcept
1365        } else
1366          return super.setProperty(name, value);
1367        return value;
1368      }
1369
1370      @Override
1371      public Base makeProperty(int hash, String name) throws FHIRException {
1372        switch (hash) {
1373        case -1179977063:  return getMaternalOrganismIdElement();
1374        case -86441847:  return getMaternalOrganismNameElement();
1375        case 123773174:  return getPaternalOrganismIdElement();
1376        case -1312914522:  return getPaternalOrganismNameElement();
1377        case 1572734806:  return getHybridType(); 
1378        default: return super.makeProperty(hash, name);
1379        }
1380
1381      }
1382
1383      @Override
1384      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1385        switch (hash) {
1386        case -1179977063: /*maternalOrganismId*/ return new String[] {"string"};
1387        case -86441847: /*maternalOrganismName*/ return new String[] {"string"};
1388        case 123773174: /*paternalOrganismId*/ return new String[] {"string"};
1389        case -1312914522: /*paternalOrganismName*/ return new String[] {"string"};
1390        case 1572734806: /*hybridType*/ return new String[] {"CodeableConcept"};
1391        default: return super.getTypesForProperty(hash, name);
1392        }
1393
1394      }
1395
1396      @Override
1397      public Base addChild(String name) throws FHIRException {
1398        if (name.equals("maternalOrganismId")) {
1399          throw new FHIRException("Cannot call addChild on a primitive type SubstanceSourceMaterial.maternalOrganismId");
1400        }
1401        else if (name.equals("maternalOrganismName")) {
1402          throw new FHIRException("Cannot call addChild on a primitive type SubstanceSourceMaterial.maternalOrganismName");
1403        }
1404        else if (name.equals("paternalOrganismId")) {
1405          throw new FHIRException("Cannot call addChild on a primitive type SubstanceSourceMaterial.paternalOrganismId");
1406        }
1407        else if (name.equals("paternalOrganismName")) {
1408          throw new FHIRException("Cannot call addChild on a primitive type SubstanceSourceMaterial.paternalOrganismName");
1409        }
1410        else if (name.equals("hybridType")) {
1411          this.hybridType = new CodeableConcept();
1412          return this.hybridType;
1413        }
1414        else
1415          return super.addChild(name);
1416      }
1417
1418      public SubstanceSourceMaterialOrganismHybridComponent copy() {
1419        SubstanceSourceMaterialOrganismHybridComponent dst = new SubstanceSourceMaterialOrganismHybridComponent();
1420        copyValues(dst);
1421        dst.maternalOrganismId = maternalOrganismId == null ? null : maternalOrganismId.copy();
1422        dst.maternalOrganismName = maternalOrganismName == null ? null : maternalOrganismName.copy();
1423        dst.paternalOrganismId = paternalOrganismId == null ? null : paternalOrganismId.copy();
1424        dst.paternalOrganismName = paternalOrganismName == null ? null : paternalOrganismName.copy();
1425        dst.hybridType = hybridType == null ? null : hybridType.copy();
1426        return dst;
1427      }
1428
1429      @Override
1430      public boolean equalsDeep(Base other_) {
1431        if (!super.equalsDeep(other_))
1432          return false;
1433        if (!(other_ instanceof SubstanceSourceMaterialOrganismHybridComponent))
1434          return false;
1435        SubstanceSourceMaterialOrganismHybridComponent o = (SubstanceSourceMaterialOrganismHybridComponent) other_;
1436        return compareDeep(maternalOrganismId, o.maternalOrganismId, true) && compareDeep(maternalOrganismName, o.maternalOrganismName, true)
1437           && compareDeep(paternalOrganismId, o.paternalOrganismId, true) && compareDeep(paternalOrganismName, o.paternalOrganismName, true)
1438           && compareDeep(hybridType, o.hybridType, true);
1439      }
1440
1441      @Override
1442      public boolean equalsShallow(Base other_) {
1443        if (!super.equalsShallow(other_))
1444          return false;
1445        if (!(other_ instanceof SubstanceSourceMaterialOrganismHybridComponent))
1446          return false;
1447        SubstanceSourceMaterialOrganismHybridComponent o = (SubstanceSourceMaterialOrganismHybridComponent) other_;
1448        return compareValues(maternalOrganismId, o.maternalOrganismId, true) && compareValues(maternalOrganismName, o.maternalOrganismName, true)
1449           && compareValues(paternalOrganismId, o.paternalOrganismId, true) && compareValues(paternalOrganismName, o.paternalOrganismName, true)
1450          ;
1451      }
1452
1453      public boolean isEmpty() {
1454        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(maternalOrganismId, maternalOrganismName
1455          , paternalOrganismId, paternalOrganismName, hybridType);
1456      }
1457
1458  public String fhirType() {
1459    return "SubstanceSourceMaterial.organism.hybrid";
1460
1461  }
1462
1463  }
1464
1465    @Block()
1466    public static class SubstanceSourceMaterialOrganismOrganismGeneralComponent extends BackboneElement implements IBaseBackboneElement {
1467        /**
1468         * The kingdom of an organism shall be specified.
1469         */
1470        @Child(name = "kingdom", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1471        @Description(shortDefinition="The kingdom of an organism shall be specified", formalDefinition="The kingdom of an organism shall be specified." )
1472        protected CodeableConcept kingdom;
1473
1474        /**
1475         * The phylum of an organism shall be specified.
1476         */
1477        @Child(name = "phylum", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1478        @Description(shortDefinition="The phylum of an organism shall be specified", formalDefinition="The phylum of an organism shall be specified." )
1479        protected CodeableConcept phylum;
1480
1481        /**
1482         * The class of an organism shall be specified.
1483         */
1484        @Child(name = "class", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1485        @Description(shortDefinition="The class of an organism shall be specified", formalDefinition="The class of an organism shall be specified." )
1486        protected CodeableConcept class_;
1487
1488        /**
1489         * The order of an organism shall be specified,.
1490         */
1491        @Child(name = "order", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
1492        @Description(shortDefinition="The order of an organism shall be specified,", formalDefinition="The order of an organism shall be specified,." )
1493        protected CodeableConcept order;
1494
1495        private static final long serialVersionUID = 659838613L;
1496
1497    /**
1498     * Constructor
1499     */
1500      public SubstanceSourceMaterialOrganismOrganismGeneralComponent() {
1501        super();
1502      }
1503
1504        /**
1505         * @return {@link #kingdom} (The kingdom of an organism shall be specified.)
1506         */
1507        public CodeableConcept getKingdom() { 
1508          if (this.kingdom == null)
1509            if (Configuration.errorOnAutoCreate())
1510              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismOrganismGeneralComponent.kingdom");
1511            else if (Configuration.doAutoCreate())
1512              this.kingdom = new CodeableConcept(); // cc
1513          return this.kingdom;
1514        }
1515
1516        public boolean hasKingdom() { 
1517          return this.kingdom != null && !this.kingdom.isEmpty();
1518        }
1519
1520        /**
1521         * @param value {@link #kingdom} (The kingdom of an organism shall be specified.)
1522         */
1523        public SubstanceSourceMaterialOrganismOrganismGeneralComponent setKingdom(CodeableConcept value) { 
1524          this.kingdom = value;
1525          return this;
1526        }
1527
1528        /**
1529         * @return {@link #phylum} (The phylum of an organism shall be specified.)
1530         */
1531        public CodeableConcept getPhylum() { 
1532          if (this.phylum == null)
1533            if (Configuration.errorOnAutoCreate())
1534              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismOrganismGeneralComponent.phylum");
1535            else if (Configuration.doAutoCreate())
1536              this.phylum = new CodeableConcept(); // cc
1537          return this.phylum;
1538        }
1539
1540        public boolean hasPhylum() { 
1541          return this.phylum != null && !this.phylum.isEmpty();
1542        }
1543
1544        /**
1545         * @param value {@link #phylum} (The phylum of an organism shall be specified.)
1546         */
1547        public SubstanceSourceMaterialOrganismOrganismGeneralComponent setPhylum(CodeableConcept value) { 
1548          this.phylum = value;
1549          return this;
1550        }
1551
1552        /**
1553         * @return {@link #class_} (The class of an organism shall be specified.)
1554         */
1555        public CodeableConcept getClass_() { 
1556          if (this.class_ == null)
1557            if (Configuration.errorOnAutoCreate())
1558              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismOrganismGeneralComponent.class_");
1559            else if (Configuration.doAutoCreate())
1560              this.class_ = new CodeableConcept(); // cc
1561          return this.class_;
1562        }
1563
1564        public boolean hasClass_() { 
1565          return this.class_ != null && !this.class_.isEmpty();
1566        }
1567
1568        /**
1569         * @param value {@link #class_} (The class of an organism shall be specified.)
1570         */
1571        public SubstanceSourceMaterialOrganismOrganismGeneralComponent setClass_(CodeableConcept value) { 
1572          this.class_ = value;
1573          return this;
1574        }
1575
1576        /**
1577         * @return {@link #order} (The order of an organism shall be specified,.)
1578         */
1579        public CodeableConcept getOrder() { 
1580          if (this.order == null)
1581            if (Configuration.errorOnAutoCreate())
1582              throw new Error("Attempt to auto-create SubstanceSourceMaterialOrganismOrganismGeneralComponent.order");
1583            else if (Configuration.doAutoCreate())
1584              this.order = new CodeableConcept(); // cc
1585          return this.order;
1586        }
1587
1588        public boolean hasOrder() { 
1589          return this.order != null && !this.order.isEmpty();
1590        }
1591
1592        /**
1593         * @param value {@link #order} (The order of an organism shall be specified,.)
1594         */
1595        public SubstanceSourceMaterialOrganismOrganismGeneralComponent setOrder(CodeableConcept value) { 
1596          this.order = value;
1597          return this;
1598        }
1599
1600        protected void listChildren(List<Property> children) {
1601          super.listChildren(children);
1602          children.add(new Property("kingdom", "CodeableConcept", "The kingdom of an organism shall be specified.", 0, 1, kingdom));
1603          children.add(new Property("phylum", "CodeableConcept", "The phylum of an organism shall be specified.", 0, 1, phylum));
1604          children.add(new Property("class", "CodeableConcept", "The class of an organism shall be specified.", 0, 1, class_));
1605          children.add(new Property("order", "CodeableConcept", "The order of an organism shall be specified,.", 0, 1, order));
1606        }
1607
1608        @Override
1609        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1610          switch (_hash) {
1611          case -710537653: /*kingdom*/  return new Property("kingdom", "CodeableConcept", "The kingdom of an organism shall be specified.", 0, 1, kingdom);
1612          case -988743965: /*phylum*/  return new Property("phylum", "CodeableConcept", "The phylum of an organism shall be specified.", 0, 1, phylum);
1613          case 94742904: /*class*/  return new Property("class", "CodeableConcept", "The class of an organism shall be specified.", 0, 1, class_);
1614          case 106006350: /*order*/  return new Property("order", "CodeableConcept", "The order of an organism shall be specified,.", 0, 1, order);
1615          default: return super.getNamedProperty(_hash, _name, _checkValid);
1616          }
1617
1618        }
1619
1620      @Override
1621      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1622        switch (hash) {
1623        case -710537653: /*kingdom*/ return this.kingdom == null ? new Base[0] : new Base[] {this.kingdom}; // CodeableConcept
1624        case -988743965: /*phylum*/ return this.phylum == null ? new Base[0] : new Base[] {this.phylum}; // CodeableConcept
1625        case 94742904: /*class*/ return this.class_ == null ? new Base[0] : new Base[] {this.class_}; // CodeableConcept
1626        case 106006350: /*order*/ return this.order == null ? new Base[0] : new Base[] {this.order}; // CodeableConcept
1627        default: return super.getProperty(hash, name, checkValid);
1628        }
1629
1630      }
1631
1632      @Override
1633      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1634        switch (hash) {
1635        case -710537653: // kingdom
1636          this.kingdom = castToCodeableConcept(value); // CodeableConcept
1637          return value;
1638        case -988743965: // phylum
1639          this.phylum = castToCodeableConcept(value); // CodeableConcept
1640          return value;
1641        case 94742904: // class
1642          this.class_ = castToCodeableConcept(value); // CodeableConcept
1643          return value;
1644        case 106006350: // order
1645          this.order = castToCodeableConcept(value); // CodeableConcept
1646          return value;
1647        default: return super.setProperty(hash, name, value);
1648        }
1649
1650      }
1651
1652      @Override
1653      public Base setProperty(String name, Base value) throws FHIRException {
1654        if (name.equals("kingdom")) {
1655          this.kingdom = castToCodeableConcept(value); // CodeableConcept
1656        } else if (name.equals("phylum")) {
1657          this.phylum = castToCodeableConcept(value); // CodeableConcept
1658        } else if (name.equals("class")) {
1659          this.class_ = castToCodeableConcept(value); // CodeableConcept
1660        } else if (name.equals("order")) {
1661          this.order = castToCodeableConcept(value); // CodeableConcept
1662        } else
1663          return super.setProperty(name, value);
1664        return value;
1665      }
1666
1667      @Override
1668      public Base makeProperty(int hash, String name) throws FHIRException {
1669        switch (hash) {
1670        case -710537653:  return getKingdom(); 
1671        case -988743965:  return getPhylum(); 
1672        case 94742904:  return getClass_(); 
1673        case 106006350:  return getOrder(); 
1674        default: return super.makeProperty(hash, name);
1675        }
1676
1677      }
1678
1679      @Override
1680      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1681        switch (hash) {
1682        case -710537653: /*kingdom*/ return new String[] {"CodeableConcept"};
1683        case -988743965: /*phylum*/ return new String[] {"CodeableConcept"};
1684        case 94742904: /*class*/ return new String[] {"CodeableConcept"};
1685        case 106006350: /*order*/ return new String[] {"CodeableConcept"};
1686        default: return super.getTypesForProperty(hash, name);
1687        }
1688
1689      }
1690
1691      @Override
1692      public Base addChild(String name) throws FHIRException {
1693        if (name.equals("kingdom")) {
1694          this.kingdom = new CodeableConcept();
1695          return this.kingdom;
1696        }
1697        else if (name.equals("phylum")) {
1698          this.phylum = new CodeableConcept();
1699          return this.phylum;
1700        }
1701        else if (name.equals("class")) {
1702          this.class_ = new CodeableConcept();
1703          return this.class_;
1704        }
1705        else if (name.equals("order")) {
1706          this.order = new CodeableConcept();
1707          return this.order;
1708        }
1709        else
1710          return super.addChild(name);
1711      }
1712
1713      public SubstanceSourceMaterialOrganismOrganismGeneralComponent copy() {
1714        SubstanceSourceMaterialOrganismOrganismGeneralComponent dst = new SubstanceSourceMaterialOrganismOrganismGeneralComponent();
1715        copyValues(dst);
1716        dst.kingdom = kingdom == null ? null : kingdom.copy();
1717        dst.phylum = phylum == null ? null : phylum.copy();
1718        dst.class_ = class_ == null ? null : class_.copy();
1719        dst.order = order == null ? null : order.copy();
1720        return dst;
1721      }
1722
1723      @Override
1724      public boolean equalsDeep(Base other_) {
1725        if (!super.equalsDeep(other_))
1726          return false;
1727        if (!(other_ instanceof SubstanceSourceMaterialOrganismOrganismGeneralComponent))
1728          return false;
1729        SubstanceSourceMaterialOrganismOrganismGeneralComponent o = (SubstanceSourceMaterialOrganismOrganismGeneralComponent) other_;
1730        return compareDeep(kingdom, o.kingdom, true) && compareDeep(phylum, o.phylum, true) && compareDeep(class_, o.class_, true)
1731           && compareDeep(order, o.order, true);
1732      }
1733
1734      @Override
1735      public boolean equalsShallow(Base other_) {
1736        if (!super.equalsShallow(other_))
1737          return false;
1738        if (!(other_ instanceof SubstanceSourceMaterialOrganismOrganismGeneralComponent))
1739          return false;
1740        SubstanceSourceMaterialOrganismOrganismGeneralComponent o = (SubstanceSourceMaterialOrganismOrganismGeneralComponent) other_;
1741        return true;
1742      }
1743
1744      public boolean isEmpty() {
1745        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(kingdom, phylum, class_
1746          , order);
1747      }
1748
1749  public String fhirType() {
1750    return "SubstanceSourceMaterial.organism.organismGeneral";
1751
1752  }
1753
1754  }
1755
1756    @Block()
1757    public static class SubstanceSourceMaterialPartDescriptionComponent extends BackboneElement implements IBaseBackboneElement {
1758        /**
1759         * Entity of anatomical origin of source material within an organism.
1760         */
1761        @Child(name = "part", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1762        @Description(shortDefinition="Entity of anatomical origin of source material within an organism", formalDefinition="Entity of anatomical origin of source material within an organism." )
1763        protected CodeableConcept part;
1764
1765        /**
1766         * The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply.
1767         */
1768        @Child(name = "partLocation", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1769        @Description(shortDefinition="The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply", formalDefinition="The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply." )
1770        protected CodeableConcept partLocation;
1771
1772        private static final long serialVersionUID = 308875915L;
1773
1774    /**
1775     * Constructor
1776     */
1777      public SubstanceSourceMaterialPartDescriptionComponent() {
1778        super();
1779      }
1780
1781        /**
1782         * @return {@link #part} (Entity of anatomical origin of source material within an organism.)
1783         */
1784        public CodeableConcept getPart() { 
1785          if (this.part == null)
1786            if (Configuration.errorOnAutoCreate())
1787              throw new Error("Attempt to auto-create SubstanceSourceMaterialPartDescriptionComponent.part");
1788            else if (Configuration.doAutoCreate())
1789              this.part = new CodeableConcept(); // cc
1790          return this.part;
1791        }
1792
1793        public boolean hasPart() { 
1794          return this.part != null && !this.part.isEmpty();
1795        }
1796
1797        /**
1798         * @param value {@link #part} (Entity of anatomical origin of source material within an organism.)
1799         */
1800        public SubstanceSourceMaterialPartDescriptionComponent setPart(CodeableConcept value) { 
1801          this.part = value;
1802          return this;
1803        }
1804
1805        /**
1806         * @return {@link #partLocation} (The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply.)
1807         */
1808        public CodeableConcept getPartLocation() { 
1809          if (this.partLocation == null)
1810            if (Configuration.errorOnAutoCreate())
1811              throw new Error("Attempt to auto-create SubstanceSourceMaterialPartDescriptionComponent.partLocation");
1812            else if (Configuration.doAutoCreate())
1813              this.partLocation = new CodeableConcept(); // cc
1814          return this.partLocation;
1815        }
1816
1817        public boolean hasPartLocation() { 
1818          return this.partLocation != null && !this.partLocation.isEmpty();
1819        }
1820
1821        /**
1822         * @param value {@link #partLocation} (The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply.)
1823         */
1824        public SubstanceSourceMaterialPartDescriptionComponent setPartLocation(CodeableConcept value) { 
1825          this.partLocation = value;
1826          return this;
1827        }
1828
1829        protected void listChildren(List<Property> children) {
1830          super.listChildren(children);
1831          children.add(new Property("part", "CodeableConcept", "Entity of anatomical origin of source material within an organism.", 0, 1, part));
1832          children.add(new Property("partLocation", "CodeableConcept", "The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply.", 0, 1, partLocation));
1833        }
1834
1835        @Override
1836        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1837          switch (_hash) {
1838          case 3433459: /*part*/  return new Property("part", "CodeableConcept", "Entity of anatomical origin of source material within an organism.", 0, 1, part);
1839          case 893437128: /*partLocation*/  return new Property("partLocation", "CodeableConcept", "The detailed anatomic location when the part can be extracted from different anatomical locations of the organism. Multiple alternative locations may apply.", 0, 1, partLocation);
1840          default: return super.getNamedProperty(_hash, _name, _checkValid);
1841          }
1842
1843        }
1844
1845      @Override
1846      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1847        switch (hash) {
1848        case 3433459: /*part*/ return this.part == null ? new Base[0] : new Base[] {this.part}; // CodeableConcept
1849        case 893437128: /*partLocation*/ return this.partLocation == null ? new Base[0] : new Base[] {this.partLocation}; // CodeableConcept
1850        default: return super.getProperty(hash, name, checkValid);
1851        }
1852
1853      }
1854
1855      @Override
1856      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1857        switch (hash) {
1858        case 3433459: // part
1859          this.part = castToCodeableConcept(value); // CodeableConcept
1860          return value;
1861        case 893437128: // partLocation
1862          this.partLocation = castToCodeableConcept(value); // CodeableConcept
1863          return value;
1864        default: return super.setProperty(hash, name, value);
1865        }
1866
1867      }
1868
1869      @Override
1870      public Base setProperty(String name, Base value) throws FHIRException {
1871        if (name.equals("part")) {
1872          this.part = castToCodeableConcept(value); // CodeableConcept
1873        } else if (name.equals("partLocation")) {
1874          this.partLocation = castToCodeableConcept(value); // CodeableConcept
1875        } else
1876          return super.setProperty(name, value);
1877        return value;
1878      }
1879
1880      @Override
1881      public Base makeProperty(int hash, String name) throws FHIRException {
1882        switch (hash) {
1883        case 3433459:  return getPart(); 
1884        case 893437128:  return getPartLocation(); 
1885        default: return super.makeProperty(hash, name);
1886        }
1887
1888      }
1889
1890      @Override
1891      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1892        switch (hash) {
1893        case 3433459: /*part*/ return new String[] {"CodeableConcept"};
1894        case 893437128: /*partLocation*/ return new String[] {"CodeableConcept"};
1895        default: return super.getTypesForProperty(hash, name);
1896        }
1897
1898      }
1899
1900      @Override
1901      public Base addChild(String name) throws FHIRException {
1902        if (name.equals("part")) {
1903          this.part = new CodeableConcept();
1904          return this.part;
1905        }
1906        else if (name.equals("partLocation")) {
1907          this.partLocation = new CodeableConcept();
1908          return this.partLocation;
1909        }
1910        else
1911          return super.addChild(name);
1912      }
1913
1914      public SubstanceSourceMaterialPartDescriptionComponent copy() {
1915        SubstanceSourceMaterialPartDescriptionComponent dst = new SubstanceSourceMaterialPartDescriptionComponent();
1916        copyValues(dst);
1917        dst.part = part == null ? null : part.copy();
1918        dst.partLocation = partLocation == null ? null : partLocation.copy();
1919        return dst;
1920      }
1921
1922      @Override
1923      public boolean equalsDeep(Base other_) {
1924        if (!super.equalsDeep(other_))
1925          return false;
1926        if (!(other_ instanceof SubstanceSourceMaterialPartDescriptionComponent))
1927          return false;
1928        SubstanceSourceMaterialPartDescriptionComponent o = (SubstanceSourceMaterialPartDescriptionComponent) other_;
1929        return compareDeep(part, o.part, true) && compareDeep(partLocation, o.partLocation, true);
1930      }
1931
1932      @Override
1933      public boolean equalsShallow(Base other_) {
1934        if (!super.equalsShallow(other_))
1935          return false;
1936        if (!(other_ instanceof SubstanceSourceMaterialPartDescriptionComponent))
1937          return false;
1938        SubstanceSourceMaterialPartDescriptionComponent o = (SubstanceSourceMaterialPartDescriptionComponent) other_;
1939        return true;
1940      }
1941
1942      public boolean isEmpty() {
1943        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(part, partLocation);
1944      }
1945
1946  public String fhirType() {
1947    return "SubstanceSourceMaterial.partDescription";
1948
1949  }
1950
1951  }
1952
1953    /**
1954     * General high level classification of the source material specific to the origin of the material.
1955     */
1956    @Child(name = "sourceMaterialClass", type = {CodeableConcept.class}, order=0, min=0, max=1, modifier=false, summary=true)
1957    @Description(shortDefinition="General high level classification of the source material specific to the origin of the material", formalDefinition="General high level classification of the source material specific to the origin of the material." )
1958    protected CodeableConcept sourceMaterialClass;
1959
1960    /**
1961     * The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent.
1962     */
1963    @Child(name = "sourceMaterialType", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1964    @Description(shortDefinition="The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent", formalDefinition="The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent." )
1965    protected CodeableConcept sourceMaterialType;
1966
1967    /**
1968     * The state of the source material when extracted.
1969     */
1970    @Child(name = "sourceMaterialState", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1971    @Description(shortDefinition="The state of the source material when extracted", formalDefinition="The state of the source material when extracted." )
1972    protected CodeableConcept sourceMaterialState;
1973
1974    /**
1975     * The unique identifier associated with the source material parent organism shall be specified.
1976     */
1977    @Child(name = "organismId", type = {Identifier.class}, order=3, min=0, max=1, modifier=false, summary=true)
1978    @Description(shortDefinition="The unique identifier associated with the source material parent organism shall be specified", formalDefinition="The unique identifier associated with the source material parent organism shall be specified." )
1979    protected Identifier organismId;
1980
1981    /**
1982     * The organism accepted Scientific name shall be provided based on the organism taxonomy.
1983     */
1984    @Child(name = "organismName", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1985    @Description(shortDefinition="The organism accepted Scientific name shall be provided based on the organism taxonomy", formalDefinition="The organism accepted Scientific name shall be provided based on the organism taxonomy." )
1986    protected StringType organismName;
1987
1988    /**
1989     * The parent of the herbal drug Ginkgo biloba, Leaf is the substance ID of the substance (fresh) of Ginkgo biloba L. or Ginkgo biloba L. (Whole plant).
1990     */
1991    @Child(name = "parentSubstanceId", type = {Identifier.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1992    @Description(shortDefinition="The parent of the herbal drug Ginkgo biloba, Leaf is the substance ID of the substance (fresh) of Ginkgo biloba L. or Ginkgo biloba L. (Whole plant)", formalDefinition="The parent of the herbal drug Ginkgo biloba, Leaf is the substance ID of the substance (fresh) of Ginkgo biloba L. or Ginkgo biloba L. (Whole plant)." )
1993    protected List<Identifier> parentSubstanceId;
1994
1995    /**
1996     * The parent substance of the Herbal Drug, or Herbal preparation.
1997     */
1998    @Child(name = "parentSubstanceName", type = {StringType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1999    @Description(shortDefinition="The parent substance of the Herbal Drug, or Herbal preparation", formalDefinition="The parent substance of the Herbal Drug, or Herbal preparation." )
2000    protected List<StringType> parentSubstanceName;
2001
2002    /**
2003     * The country where the plant material is harvested or the countries where the plasma is sourced from as laid down in accordance with the Plasma Master File. For “Plasma-derived substances” the attribute country of origin provides information about the countries used for the manufacturing of the Cryopoor plama or Crioprecipitate.
2004     */
2005    @Child(name = "countryOfOrigin", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2006    @Description(shortDefinition="The country where the plant material is harvested or the countries where the plasma is sourced from as laid down in accordance with the Plasma Master File. For “Plasma-derived substances” the attribute country of origin provides information about the countries used for the manufacturing of the Cryopoor plama or Crioprecipitate", formalDefinition="The country where the plant material is harvested or the countries where the plasma is sourced from as laid down in accordance with the Plasma Master File. For “Plasma-derived substances” the attribute country of origin provides information about the countries used for the manufacturing of the Cryopoor plama or Crioprecipitate." )
2007    protected List<CodeableConcept> countryOfOrigin;
2008
2009    /**
2010     * The place/region where the plant is harvested or the places/regions where the animal source material has its habitat.
2011     */
2012    @Child(name = "geographicalLocation", type = {StringType.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2013    @Description(shortDefinition="The place/region where the plant is harvested or the places/regions where the animal source material has its habitat", formalDefinition="The place/region where the plant is harvested or the places/regions where the animal source material has its habitat." )
2014    protected List<StringType> geographicalLocation;
2015
2016    /**
2017     * Stage of life for animals, plants, insects and microorganisms. This information shall be provided only when the substance is significantly different in these stages (e.g. foetal bovine serum).
2018     */
2019    @Child(name = "developmentStage", type = {CodeableConcept.class}, order=9, min=0, max=1, modifier=false, summary=true)
2020    @Description(shortDefinition="Stage of life for animals, plants, insects and microorganisms. This information shall be provided only when the substance is significantly different in these stages (e.g. foetal bovine serum)", formalDefinition="Stage of life for animals, plants, insects and microorganisms. This information shall be provided only when the substance is significantly different in these stages (e.g. foetal bovine serum)." )
2021    protected CodeableConcept developmentStage;
2022
2023    /**
2024     * Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels.
2025     */
2026    @Child(name = "fractionDescription", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2027    @Description(shortDefinition="Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels", formalDefinition="Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels." )
2028    protected List<SubstanceSourceMaterialFractionDescriptionComponent> fractionDescription;
2029
2030    /**
2031     * This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf.
2032     */
2033    @Child(name = "organism", type = {}, order=11, min=0, max=1, modifier=false, summary=true)
2034    @Description(shortDefinition="This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf", formalDefinition="This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf." )
2035    protected SubstanceSourceMaterialOrganismComponent organism;
2036
2037    /**
2038     * To do.
2039     */
2040    @Child(name = "partDescription", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2041    @Description(shortDefinition="To do", formalDefinition="To do." )
2042    protected List<SubstanceSourceMaterialPartDescriptionComponent> partDescription;
2043
2044    private static final long serialVersionUID = 442657667L;
2045
2046  /**
2047   * Constructor
2048   */
2049    public SubstanceSourceMaterial() {
2050      super();
2051    }
2052
2053    /**
2054     * @return {@link #sourceMaterialClass} (General high level classification of the source material specific to the origin of the material.)
2055     */
2056    public CodeableConcept getSourceMaterialClass() { 
2057      if (this.sourceMaterialClass == null)
2058        if (Configuration.errorOnAutoCreate())
2059          throw new Error("Attempt to auto-create SubstanceSourceMaterial.sourceMaterialClass");
2060        else if (Configuration.doAutoCreate())
2061          this.sourceMaterialClass = new CodeableConcept(); // cc
2062      return this.sourceMaterialClass;
2063    }
2064
2065    public boolean hasSourceMaterialClass() { 
2066      return this.sourceMaterialClass != null && !this.sourceMaterialClass.isEmpty();
2067    }
2068
2069    /**
2070     * @param value {@link #sourceMaterialClass} (General high level classification of the source material specific to the origin of the material.)
2071     */
2072    public SubstanceSourceMaterial setSourceMaterialClass(CodeableConcept value) { 
2073      this.sourceMaterialClass = value;
2074      return this;
2075    }
2076
2077    /**
2078     * @return {@link #sourceMaterialType} (The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent.)
2079     */
2080    public CodeableConcept getSourceMaterialType() { 
2081      if (this.sourceMaterialType == null)
2082        if (Configuration.errorOnAutoCreate())
2083          throw new Error("Attempt to auto-create SubstanceSourceMaterial.sourceMaterialType");
2084        else if (Configuration.doAutoCreate())
2085          this.sourceMaterialType = new CodeableConcept(); // cc
2086      return this.sourceMaterialType;
2087    }
2088
2089    public boolean hasSourceMaterialType() { 
2090      return this.sourceMaterialType != null && !this.sourceMaterialType.isEmpty();
2091    }
2092
2093    /**
2094     * @param value {@link #sourceMaterialType} (The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent.)
2095     */
2096    public SubstanceSourceMaterial setSourceMaterialType(CodeableConcept value) { 
2097      this.sourceMaterialType = value;
2098      return this;
2099    }
2100
2101    /**
2102     * @return {@link #sourceMaterialState} (The state of the source material when extracted.)
2103     */
2104    public CodeableConcept getSourceMaterialState() { 
2105      if (this.sourceMaterialState == null)
2106        if (Configuration.errorOnAutoCreate())
2107          throw new Error("Attempt to auto-create SubstanceSourceMaterial.sourceMaterialState");
2108        else if (Configuration.doAutoCreate())
2109          this.sourceMaterialState = new CodeableConcept(); // cc
2110      return this.sourceMaterialState;
2111    }
2112
2113    public boolean hasSourceMaterialState() { 
2114      return this.sourceMaterialState != null && !this.sourceMaterialState.isEmpty();
2115    }
2116
2117    /**
2118     * @param value {@link #sourceMaterialState} (The state of the source material when extracted.)
2119     */
2120    public SubstanceSourceMaterial setSourceMaterialState(CodeableConcept value) { 
2121      this.sourceMaterialState = value;
2122      return this;
2123    }
2124
2125    /**
2126     * @return {@link #organismId} (The unique identifier associated with the source material parent organism shall be specified.)
2127     */
2128    public Identifier getOrganismId() { 
2129      if (this.organismId == null)
2130        if (Configuration.errorOnAutoCreate())
2131          throw new Error("Attempt to auto-create SubstanceSourceMaterial.organismId");
2132        else if (Configuration.doAutoCreate())
2133          this.organismId = new Identifier(); // cc
2134      return this.organismId;
2135    }
2136
2137    public boolean hasOrganismId() { 
2138      return this.organismId != null && !this.organismId.isEmpty();
2139    }
2140
2141    /**
2142     * @param value {@link #organismId} (The unique identifier associated with the source material parent organism shall be specified.)
2143     */
2144    public SubstanceSourceMaterial setOrganismId(Identifier value) { 
2145      this.organismId = value;
2146      return this;
2147    }
2148
2149    /**
2150     * @return {@link #organismName} (The organism accepted Scientific name shall be provided based on the organism taxonomy.). This is the underlying object with id, value and extensions. The accessor "getOrganismName" gives direct access to the value
2151     */
2152    public StringType getOrganismNameElement() { 
2153      if (this.organismName == null)
2154        if (Configuration.errorOnAutoCreate())
2155          throw new Error("Attempt to auto-create SubstanceSourceMaterial.organismName");
2156        else if (Configuration.doAutoCreate())
2157          this.organismName = new StringType(); // bb
2158      return this.organismName;
2159    }
2160
2161    public boolean hasOrganismNameElement() { 
2162      return this.organismName != null && !this.organismName.isEmpty();
2163    }
2164
2165    public boolean hasOrganismName() { 
2166      return this.organismName != null && !this.organismName.isEmpty();
2167    }
2168
2169    /**
2170     * @param value {@link #organismName} (The organism accepted Scientific name shall be provided based on the organism taxonomy.). This is the underlying object with id, value and extensions. The accessor "getOrganismName" gives direct access to the value
2171     */
2172    public SubstanceSourceMaterial setOrganismNameElement(StringType value) { 
2173      this.organismName = value;
2174      return this;
2175    }
2176
2177    /**
2178     * @return The organism accepted Scientific name shall be provided based on the organism taxonomy.
2179     */
2180    public String getOrganismName() { 
2181      return this.organismName == null ? null : this.organismName.getValue();
2182    }
2183
2184    /**
2185     * @param value The organism accepted Scientific name shall be provided based on the organism taxonomy.
2186     */
2187    public SubstanceSourceMaterial setOrganismName(String value) { 
2188      if (Utilities.noString(value))
2189        this.organismName = null;
2190      else {
2191        if (this.organismName == null)
2192          this.organismName = new StringType();
2193        this.organismName.setValue(value);
2194      }
2195      return this;
2196    }
2197
2198    /**
2199     * @return {@link #parentSubstanceId} (The parent of the herbal drug Ginkgo biloba, Leaf is the substance ID of the substance (fresh) of Ginkgo biloba L. or Ginkgo biloba L. (Whole plant).)
2200     */
2201    public List<Identifier> getParentSubstanceId() { 
2202      if (this.parentSubstanceId == null)
2203        this.parentSubstanceId = new ArrayList<Identifier>();
2204      return this.parentSubstanceId;
2205    }
2206
2207    /**
2208     * @return Returns a reference to <code>this</code> for easy method chaining
2209     */
2210    public SubstanceSourceMaterial setParentSubstanceId(List<Identifier> theParentSubstanceId) { 
2211      this.parentSubstanceId = theParentSubstanceId;
2212      return this;
2213    }
2214
2215    public boolean hasParentSubstanceId() { 
2216      if (this.parentSubstanceId == null)
2217        return false;
2218      for (Identifier item : this.parentSubstanceId)
2219        if (!item.isEmpty())
2220          return true;
2221      return false;
2222    }
2223
2224    public Identifier addParentSubstanceId() { //3
2225      Identifier t = new Identifier();
2226      if (this.parentSubstanceId == null)
2227        this.parentSubstanceId = new ArrayList<Identifier>();
2228      this.parentSubstanceId.add(t);
2229      return t;
2230    }
2231
2232    public SubstanceSourceMaterial addParentSubstanceId(Identifier t) { //3
2233      if (t == null)
2234        return this;
2235      if (this.parentSubstanceId == null)
2236        this.parentSubstanceId = new ArrayList<Identifier>();
2237      this.parentSubstanceId.add(t);
2238      return this;
2239    }
2240
2241    /**
2242     * @return The first repetition of repeating field {@link #parentSubstanceId}, creating it if it does not already exist
2243     */
2244    public Identifier getParentSubstanceIdFirstRep() { 
2245      if (getParentSubstanceId().isEmpty()) {
2246        addParentSubstanceId();
2247      }
2248      return getParentSubstanceId().get(0);
2249    }
2250
2251    /**
2252     * @return {@link #parentSubstanceName} (The parent substance of the Herbal Drug, or Herbal preparation.)
2253     */
2254    public List<StringType> getParentSubstanceName() { 
2255      if (this.parentSubstanceName == null)
2256        this.parentSubstanceName = new ArrayList<StringType>();
2257      return this.parentSubstanceName;
2258    }
2259
2260    /**
2261     * @return Returns a reference to <code>this</code> for easy method chaining
2262     */
2263    public SubstanceSourceMaterial setParentSubstanceName(List<StringType> theParentSubstanceName) { 
2264      this.parentSubstanceName = theParentSubstanceName;
2265      return this;
2266    }
2267
2268    public boolean hasParentSubstanceName() { 
2269      if (this.parentSubstanceName == null)
2270        return false;
2271      for (StringType item : this.parentSubstanceName)
2272        if (!item.isEmpty())
2273          return true;
2274      return false;
2275    }
2276
2277    /**
2278     * @return {@link #parentSubstanceName} (The parent substance of the Herbal Drug, or Herbal preparation.)
2279     */
2280    public StringType addParentSubstanceNameElement() {//2 
2281      StringType t = new StringType();
2282      if (this.parentSubstanceName == null)
2283        this.parentSubstanceName = new ArrayList<StringType>();
2284      this.parentSubstanceName.add(t);
2285      return t;
2286    }
2287
2288    /**
2289     * @param value {@link #parentSubstanceName} (The parent substance of the Herbal Drug, or Herbal preparation.)
2290     */
2291    public SubstanceSourceMaterial addParentSubstanceName(String value) { //1
2292      StringType t = new StringType();
2293      t.setValue(value);
2294      if (this.parentSubstanceName == null)
2295        this.parentSubstanceName = new ArrayList<StringType>();
2296      this.parentSubstanceName.add(t);
2297      return this;
2298    }
2299
2300    /**
2301     * @param value {@link #parentSubstanceName} (The parent substance of the Herbal Drug, or Herbal preparation.)
2302     */
2303    public boolean hasParentSubstanceName(String value) { 
2304      if (this.parentSubstanceName == null)
2305        return false;
2306      for (StringType v : this.parentSubstanceName)
2307        if (v.getValue().equals(value)) // string
2308          return true;
2309      return false;
2310    }
2311
2312    /**
2313     * @return {@link #countryOfOrigin} (The country where the plant material is harvested or the countries where the plasma is sourced from as laid down in accordance with the Plasma Master File. For “Plasma-derived substances” the attribute country of origin provides information about the countries used for the manufacturing of the Cryopoor plama or Crioprecipitate.)
2314     */
2315    public List<CodeableConcept> getCountryOfOrigin() { 
2316      if (this.countryOfOrigin == null)
2317        this.countryOfOrigin = new ArrayList<CodeableConcept>();
2318      return this.countryOfOrigin;
2319    }
2320
2321    /**
2322     * @return Returns a reference to <code>this</code> for easy method chaining
2323     */
2324    public SubstanceSourceMaterial setCountryOfOrigin(List<CodeableConcept> theCountryOfOrigin) { 
2325      this.countryOfOrigin = theCountryOfOrigin;
2326      return this;
2327    }
2328
2329    public boolean hasCountryOfOrigin() { 
2330      if (this.countryOfOrigin == null)
2331        return false;
2332      for (CodeableConcept item : this.countryOfOrigin)
2333        if (!item.isEmpty())
2334          return true;
2335      return false;
2336    }
2337
2338    public CodeableConcept addCountryOfOrigin() { //3
2339      CodeableConcept t = new CodeableConcept();
2340      if (this.countryOfOrigin == null)
2341        this.countryOfOrigin = new ArrayList<CodeableConcept>();
2342      this.countryOfOrigin.add(t);
2343      return t;
2344    }
2345
2346    public SubstanceSourceMaterial addCountryOfOrigin(CodeableConcept t) { //3
2347      if (t == null)
2348        return this;
2349      if (this.countryOfOrigin == null)
2350        this.countryOfOrigin = new ArrayList<CodeableConcept>();
2351      this.countryOfOrigin.add(t);
2352      return this;
2353    }
2354
2355    /**
2356     * @return The first repetition of repeating field {@link #countryOfOrigin}, creating it if it does not already exist
2357     */
2358    public CodeableConcept getCountryOfOriginFirstRep() { 
2359      if (getCountryOfOrigin().isEmpty()) {
2360        addCountryOfOrigin();
2361      }
2362      return getCountryOfOrigin().get(0);
2363    }
2364
2365    /**
2366     * @return {@link #geographicalLocation} (The place/region where the plant is harvested or the places/regions where the animal source material has its habitat.)
2367     */
2368    public List<StringType> getGeographicalLocation() { 
2369      if (this.geographicalLocation == null)
2370        this.geographicalLocation = new ArrayList<StringType>();
2371      return this.geographicalLocation;
2372    }
2373
2374    /**
2375     * @return Returns a reference to <code>this</code> for easy method chaining
2376     */
2377    public SubstanceSourceMaterial setGeographicalLocation(List<StringType> theGeographicalLocation) { 
2378      this.geographicalLocation = theGeographicalLocation;
2379      return this;
2380    }
2381
2382    public boolean hasGeographicalLocation() { 
2383      if (this.geographicalLocation == null)
2384        return false;
2385      for (StringType item : this.geographicalLocation)
2386        if (!item.isEmpty())
2387          return true;
2388      return false;
2389    }
2390
2391    /**
2392     * @return {@link #geographicalLocation} (The place/region where the plant is harvested or the places/regions where the animal source material has its habitat.)
2393     */
2394    public StringType addGeographicalLocationElement() {//2 
2395      StringType t = new StringType();
2396      if (this.geographicalLocation == null)
2397        this.geographicalLocation = new ArrayList<StringType>();
2398      this.geographicalLocation.add(t);
2399      return t;
2400    }
2401
2402    /**
2403     * @param value {@link #geographicalLocation} (The place/region where the plant is harvested or the places/regions where the animal source material has its habitat.)
2404     */
2405    public SubstanceSourceMaterial addGeographicalLocation(String value) { //1
2406      StringType t = new StringType();
2407      t.setValue(value);
2408      if (this.geographicalLocation == null)
2409        this.geographicalLocation = new ArrayList<StringType>();
2410      this.geographicalLocation.add(t);
2411      return this;
2412    }
2413
2414    /**
2415     * @param value {@link #geographicalLocation} (The place/region where the plant is harvested or the places/regions where the animal source material has its habitat.)
2416     */
2417    public boolean hasGeographicalLocation(String value) { 
2418      if (this.geographicalLocation == null)
2419        return false;
2420      for (StringType v : this.geographicalLocation)
2421        if (v.getValue().equals(value)) // string
2422          return true;
2423      return false;
2424    }
2425
2426    /**
2427     * @return {@link #developmentStage} (Stage of life for animals, plants, insects and microorganisms. This information shall be provided only when the substance is significantly different in these stages (e.g. foetal bovine serum).)
2428     */
2429    public CodeableConcept getDevelopmentStage() { 
2430      if (this.developmentStage == null)
2431        if (Configuration.errorOnAutoCreate())
2432          throw new Error("Attempt to auto-create SubstanceSourceMaterial.developmentStage");
2433        else if (Configuration.doAutoCreate())
2434          this.developmentStage = new CodeableConcept(); // cc
2435      return this.developmentStage;
2436    }
2437
2438    public boolean hasDevelopmentStage() { 
2439      return this.developmentStage != null && !this.developmentStage.isEmpty();
2440    }
2441
2442    /**
2443     * @param value {@link #developmentStage} (Stage of life for animals, plants, insects and microorganisms. This information shall be provided only when the substance is significantly different in these stages (e.g. foetal bovine serum).)
2444     */
2445    public SubstanceSourceMaterial setDevelopmentStage(CodeableConcept value) { 
2446      this.developmentStage = value;
2447      return this;
2448    }
2449
2450    /**
2451     * @return {@link #fractionDescription} (Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels.)
2452     */
2453    public List<SubstanceSourceMaterialFractionDescriptionComponent> getFractionDescription() { 
2454      if (this.fractionDescription == null)
2455        this.fractionDescription = new ArrayList<SubstanceSourceMaterialFractionDescriptionComponent>();
2456      return this.fractionDescription;
2457    }
2458
2459    /**
2460     * @return Returns a reference to <code>this</code> for easy method chaining
2461     */
2462    public SubstanceSourceMaterial setFractionDescription(List<SubstanceSourceMaterialFractionDescriptionComponent> theFractionDescription) { 
2463      this.fractionDescription = theFractionDescription;
2464      return this;
2465    }
2466
2467    public boolean hasFractionDescription() { 
2468      if (this.fractionDescription == null)
2469        return false;
2470      for (SubstanceSourceMaterialFractionDescriptionComponent item : this.fractionDescription)
2471        if (!item.isEmpty())
2472          return true;
2473      return false;
2474    }
2475
2476    public SubstanceSourceMaterialFractionDescriptionComponent addFractionDescription() { //3
2477      SubstanceSourceMaterialFractionDescriptionComponent t = new SubstanceSourceMaterialFractionDescriptionComponent();
2478      if (this.fractionDescription == null)
2479        this.fractionDescription = new ArrayList<SubstanceSourceMaterialFractionDescriptionComponent>();
2480      this.fractionDescription.add(t);
2481      return t;
2482    }
2483
2484    public SubstanceSourceMaterial addFractionDescription(SubstanceSourceMaterialFractionDescriptionComponent t) { //3
2485      if (t == null)
2486        return this;
2487      if (this.fractionDescription == null)
2488        this.fractionDescription = new ArrayList<SubstanceSourceMaterialFractionDescriptionComponent>();
2489      this.fractionDescription.add(t);
2490      return this;
2491    }
2492
2493    /**
2494     * @return The first repetition of repeating field {@link #fractionDescription}, creating it if it does not already exist
2495     */
2496    public SubstanceSourceMaterialFractionDescriptionComponent getFractionDescriptionFirstRep() { 
2497      if (getFractionDescription().isEmpty()) {
2498        addFractionDescription();
2499      }
2500      return getFractionDescription().get(0);
2501    }
2502
2503    /**
2504     * @return {@link #organism} (This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf.)
2505     */
2506    public SubstanceSourceMaterialOrganismComponent getOrganism() { 
2507      if (this.organism == null)
2508        if (Configuration.errorOnAutoCreate())
2509          throw new Error("Attempt to auto-create SubstanceSourceMaterial.organism");
2510        else if (Configuration.doAutoCreate())
2511          this.organism = new SubstanceSourceMaterialOrganismComponent(); // cc
2512      return this.organism;
2513    }
2514
2515    public boolean hasOrganism() { 
2516      return this.organism != null && !this.organism.isEmpty();
2517    }
2518
2519    /**
2520     * @param value {@link #organism} (This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf.)
2521     */
2522    public SubstanceSourceMaterial setOrganism(SubstanceSourceMaterialOrganismComponent value) { 
2523      this.organism = value;
2524      return this;
2525    }
2526
2527    /**
2528     * @return {@link #partDescription} (To do.)
2529     */
2530    public List<SubstanceSourceMaterialPartDescriptionComponent> getPartDescription() { 
2531      if (this.partDescription == null)
2532        this.partDescription = new ArrayList<SubstanceSourceMaterialPartDescriptionComponent>();
2533      return this.partDescription;
2534    }
2535
2536    /**
2537     * @return Returns a reference to <code>this</code> for easy method chaining
2538     */
2539    public SubstanceSourceMaterial setPartDescription(List<SubstanceSourceMaterialPartDescriptionComponent> thePartDescription) { 
2540      this.partDescription = thePartDescription;
2541      return this;
2542    }
2543
2544    public boolean hasPartDescription() { 
2545      if (this.partDescription == null)
2546        return false;
2547      for (SubstanceSourceMaterialPartDescriptionComponent item : this.partDescription)
2548        if (!item.isEmpty())
2549          return true;
2550      return false;
2551    }
2552
2553    public SubstanceSourceMaterialPartDescriptionComponent addPartDescription() { //3
2554      SubstanceSourceMaterialPartDescriptionComponent t = new SubstanceSourceMaterialPartDescriptionComponent();
2555      if (this.partDescription == null)
2556        this.partDescription = new ArrayList<SubstanceSourceMaterialPartDescriptionComponent>();
2557      this.partDescription.add(t);
2558      return t;
2559    }
2560
2561    public SubstanceSourceMaterial addPartDescription(SubstanceSourceMaterialPartDescriptionComponent t) { //3
2562      if (t == null)
2563        return this;
2564      if (this.partDescription == null)
2565        this.partDescription = new ArrayList<SubstanceSourceMaterialPartDescriptionComponent>();
2566      this.partDescription.add(t);
2567      return this;
2568    }
2569
2570    /**
2571     * @return The first repetition of repeating field {@link #partDescription}, creating it if it does not already exist
2572     */
2573    public SubstanceSourceMaterialPartDescriptionComponent getPartDescriptionFirstRep() { 
2574      if (getPartDescription().isEmpty()) {
2575        addPartDescription();
2576      }
2577      return getPartDescription().get(0);
2578    }
2579
2580      protected void listChildren(List<Property> children) {
2581        super.listChildren(children);
2582        children.add(new Property("sourceMaterialClass", "CodeableConcept", "General high level classification of the source material specific to the origin of the material.", 0, 1, sourceMaterialClass));
2583        children.add(new Property("sourceMaterialType", "CodeableConcept", "The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent.", 0, 1, sourceMaterialType));
2584        children.add(new Property("sourceMaterialState", "CodeableConcept", "The state of the source material when extracted.", 0, 1, sourceMaterialState));
2585        children.add(new Property("organismId", "Identifier", "The unique identifier associated with the source material parent organism shall be specified.", 0, 1, organismId));
2586        children.add(new Property("organismName", "string", "The organism accepted Scientific name shall be provided based on the organism taxonomy.", 0, 1, organismName));
2587        children.add(new Property("parentSubstanceId", "Identifier", "The parent of the herbal drug Ginkgo biloba, Leaf is the substance ID of the substance (fresh) of Ginkgo biloba L. or Ginkgo biloba L. (Whole plant).", 0, java.lang.Integer.MAX_VALUE, parentSubstanceId));
2588        children.add(new Property("parentSubstanceName", "string", "The parent substance of the Herbal Drug, or Herbal preparation.", 0, java.lang.Integer.MAX_VALUE, parentSubstanceName));
2589        children.add(new Property("countryOfOrigin", "CodeableConcept", "The country where the plant material is harvested or the countries where the plasma is sourced from as laid down in accordance with the Plasma Master File. For “Plasma-derived substances” the attribute country of origin provides information about the countries used for the manufacturing of the Cryopoor plama or Crioprecipitate.", 0, java.lang.Integer.MAX_VALUE, countryOfOrigin));
2590        children.add(new Property("geographicalLocation", "string", "The place/region where the plant is harvested or the places/regions where the animal source material has its habitat.", 0, java.lang.Integer.MAX_VALUE, geographicalLocation));
2591        children.add(new Property("developmentStage", "CodeableConcept", "Stage of life for animals, plants, insects and microorganisms. This information shall be provided only when the substance is significantly different in these stages (e.g. foetal bovine serum).", 0, 1, developmentStage));
2592        children.add(new Property("fractionDescription", "", "Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels.", 0, java.lang.Integer.MAX_VALUE, fractionDescription));
2593        children.add(new Property("organism", "", "This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf.", 0, 1, organism));
2594        children.add(new Property("partDescription", "", "To do.", 0, java.lang.Integer.MAX_VALUE, partDescription));
2595      }
2596
2597      @Override
2598      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2599        switch (_hash) {
2600        case -1253081034: /*sourceMaterialClass*/  return new Property("sourceMaterialClass", "CodeableConcept", "General high level classification of the source material specific to the origin of the material.", 0, 1, sourceMaterialClass);
2601        case 1622665404: /*sourceMaterialType*/  return new Property("sourceMaterialType", "CodeableConcept", "The type of the source material shall be specified based on a controlled vocabulary. For vaccines, this subclause refers to the class of infectious agent.", 0, 1, sourceMaterialType);
2602        case -1238066353: /*sourceMaterialState*/  return new Property("sourceMaterialState", "CodeableConcept", "The state of the source material when extracted.", 0, 1, sourceMaterialState);
2603        case -1965449843: /*organismId*/  return new Property("organismId", "Identifier", "The unique identifier associated with the source material parent organism shall be specified.", 0, 1, organismId);
2604        case 988460669: /*organismName*/  return new Property("organismName", "string", "The organism accepted Scientific name shall be provided based on the organism taxonomy.", 0, 1, organismName);
2605        case -675437663: /*parentSubstanceId*/  return new Property("parentSubstanceId", "Identifier", "The parent of the herbal drug Ginkgo biloba, Leaf is the substance ID of the substance (fresh) of Ginkgo biloba L. or Ginkgo biloba L. (Whole plant).", 0, java.lang.Integer.MAX_VALUE, parentSubstanceId);
2606        case -555382895: /*parentSubstanceName*/  return new Property("parentSubstanceName", "string", "The parent substance of the Herbal Drug, or Herbal preparation.", 0, java.lang.Integer.MAX_VALUE, parentSubstanceName);
2607        case 57176467: /*countryOfOrigin*/  return new Property("countryOfOrigin", "CodeableConcept", "The country where the plant material is harvested or the countries where the plasma is sourced from as laid down in accordance with the Plasma Master File. For “Plasma-derived substances” the attribute country of origin provides information about the countries used for the manufacturing of the Cryopoor plama or Crioprecipitate.", 0, java.lang.Integer.MAX_VALUE, countryOfOrigin);
2608        case -1988836681: /*geographicalLocation*/  return new Property("geographicalLocation", "string", "The place/region where the plant is harvested or the places/regions where the animal source material has its habitat.", 0, java.lang.Integer.MAX_VALUE, geographicalLocation);
2609        case 391529091: /*developmentStage*/  return new Property("developmentStage", "CodeableConcept", "Stage of life for animals, plants, insects and microorganisms. This information shall be provided only when the substance is significantly different in these stages (e.g. foetal bovine serum).", 0, 1, developmentStage);
2610        case 1472689306: /*fractionDescription*/  return new Property("fractionDescription", "", "Many complex materials are fractions of parts of plants, animals, or minerals. Fraction elements are often necessary to define both Substances and Specified Group 1 Substances. For substances derived from Plants, fraction information will be captured at the Substance information level ( . Oils, Juices and Exudates). Additional information for Extracts, such as extraction solvent composition, will be captured at the Specified Substance Group 1 information level. For plasma-derived products fraction information will be captured at the Substance and the Specified Substance Group 1 levels.", 0, java.lang.Integer.MAX_VALUE, fractionDescription);
2611        case 1316389074: /*organism*/  return new Property("organism", "", "This subclause describes the organism which the substance is derived from. For vaccines, the parent organism shall be specified based on these subclause elements. As an example, full taxonomy will be described for the Substance Name: ., Leaf.", 0, 1, organism);
2612        case -1803623927: /*partDescription*/  return new Property("partDescription", "", "To do.", 0, java.lang.Integer.MAX_VALUE, partDescription);
2613        default: return super.getNamedProperty(_hash, _name, _checkValid);
2614        }
2615
2616      }
2617
2618      @Override
2619      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2620        switch (hash) {
2621        case -1253081034: /*sourceMaterialClass*/ return this.sourceMaterialClass == null ? new Base[0] : new Base[] {this.sourceMaterialClass}; // CodeableConcept
2622        case 1622665404: /*sourceMaterialType*/ return this.sourceMaterialType == null ? new Base[0] : new Base[] {this.sourceMaterialType}; // CodeableConcept
2623        case -1238066353: /*sourceMaterialState*/ return this.sourceMaterialState == null ? new Base[0] : new Base[] {this.sourceMaterialState}; // CodeableConcept
2624        case -1965449843: /*organismId*/ return this.organismId == null ? new Base[0] : new Base[] {this.organismId}; // Identifier
2625        case 988460669: /*organismName*/ return this.organismName == null ? new Base[0] : new Base[] {this.organismName}; // StringType
2626        case -675437663: /*parentSubstanceId*/ return this.parentSubstanceId == null ? new Base[0] : this.parentSubstanceId.toArray(new Base[this.parentSubstanceId.size()]); // Identifier
2627        case -555382895: /*parentSubstanceName*/ return this.parentSubstanceName == null ? new Base[0] : this.parentSubstanceName.toArray(new Base[this.parentSubstanceName.size()]); // StringType
2628        case 57176467: /*countryOfOrigin*/ return this.countryOfOrigin == null ? new Base[0] : this.countryOfOrigin.toArray(new Base[this.countryOfOrigin.size()]); // CodeableConcept
2629        case -1988836681: /*geographicalLocation*/ return this.geographicalLocation == null ? new Base[0] : this.geographicalLocation.toArray(new Base[this.geographicalLocation.size()]); // StringType
2630        case 391529091: /*developmentStage*/ return this.developmentStage == null ? new Base[0] : new Base[] {this.developmentStage}; // CodeableConcept
2631        case 1472689306: /*fractionDescription*/ return this.fractionDescription == null ? new Base[0] : this.fractionDescription.toArray(new Base[this.fractionDescription.size()]); // SubstanceSourceMaterialFractionDescriptionComponent
2632        case 1316389074: /*organism*/ return this.organism == null ? new Base[0] : new Base[] {this.organism}; // SubstanceSourceMaterialOrganismComponent
2633        case -1803623927: /*partDescription*/ return this.partDescription == null ? new Base[0] : this.partDescription.toArray(new Base[this.partDescription.size()]); // SubstanceSourceMaterialPartDescriptionComponent
2634        default: return super.getProperty(hash, name, checkValid);
2635        }
2636
2637      }
2638
2639      @Override
2640      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2641        switch (hash) {
2642        case -1253081034: // sourceMaterialClass
2643          this.sourceMaterialClass = castToCodeableConcept(value); // CodeableConcept
2644          return value;
2645        case 1622665404: // sourceMaterialType
2646          this.sourceMaterialType = castToCodeableConcept(value); // CodeableConcept
2647          return value;
2648        case -1238066353: // sourceMaterialState
2649          this.sourceMaterialState = castToCodeableConcept(value); // CodeableConcept
2650          return value;
2651        case -1965449843: // organismId
2652          this.organismId = castToIdentifier(value); // Identifier
2653          return value;
2654        case 988460669: // organismName
2655          this.organismName = castToString(value); // StringType
2656          return value;
2657        case -675437663: // parentSubstanceId
2658          this.getParentSubstanceId().add(castToIdentifier(value)); // Identifier
2659          return value;
2660        case -555382895: // parentSubstanceName
2661          this.getParentSubstanceName().add(castToString(value)); // StringType
2662          return value;
2663        case 57176467: // countryOfOrigin
2664          this.getCountryOfOrigin().add(castToCodeableConcept(value)); // CodeableConcept
2665          return value;
2666        case -1988836681: // geographicalLocation
2667          this.getGeographicalLocation().add(castToString(value)); // StringType
2668          return value;
2669        case 391529091: // developmentStage
2670          this.developmentStage = castToCodeableConcept(value); // CodeableConcept
2671          return value;
2672        case 1472689306: // fractionDescription
2673          this.getFractionDescription().add((SubstanceSourceMaterialFractionDescriptionComponent) value); // SubstanceSourceMaterialFractionDescriptionComponent
2674          return value;
2675        case 1316389074: // organism
2676          this.organism = (SubstanceSourceMaterialOrganismComponent) value; // SubstanceSourceMaterialOrganismComponent
2677          return value;
2678        case -1803623927: // partDescription
2679          this.getPartDescription().add((SubstanceSourceMaterialPartDescriptionComponent) value); // SubstanceSourceMaterialPartDescriptionComponent
2680          return value;
2681        default: return super.setProperty(hash, name, value);
2682        }
2683
2684      }
2685
2686      @Override
2687      public Base setProperty(String name, Base value) throws FHIRException {
2688        if (name.equals("sourceMaterialClass")) {
2689          this.sourceMaterialClass = castToCodeableConcept(value); // CodeableConcept
2690        } else if (name.equals("sourceMaterialType")) {
2691          this.sourceMaterialType = castToCodeableConcept(value); // CodeableConcept
2692        } else if (name.equals("sourceMaterialState")) {
2693          this.sourceMaterialState = castToCodeableConcept(value); // CodeableConcept
2694        } else if (name.equals("organismId")) {
2695          this.organismId = castToIdentifier(value); // Identifier
2696        } else if (name.equals("organismName")) {
2697          this.organismName = castToString(value); // StringType
2698        } else if (name.equals("parentSubstanceId")) {
2699          this.getParentSubstanceId().add(castToIdentifier(value));
2700        } else if (name.equals("parentSubstanceName")) {
2701          this.getParentSubstanceName().add(castToString(value));
2702        } else if (name.equals("countryOfOrigin")) {
2703          this.getCountryOfOrigin().add(castToCodeableConcept(value));
2704        } else if (name.equals("geographicalLocation")) {
2705          this.getGeographicalLocation().add(castToString(value));
2706        } else if (name.equals("developmentStage")) {
2707          this.developmentStage = castToCodeableConcept(value); // CodeableConcept
2708        } else if (name.equals("fractionDescription")) {
2709          this.getFractionDescription().add((SubstanceSourceMaterialFractionDescriptionComponent) value);
2710        } else if (name.equals("organism")) {
2711          this.organism = (SubstanceSourceMaterialOrganismComponent) value; // SubstanceSourceMaterialOrganismComponent
2712        } else if (name.equals("partDescription")) {
2713          this.getPartDescription().add((SubstanceSourceMaterialPartDescriptionComponent) value);
2714        } else
2715          return super.setProperty(name, value);
2716        return value;
2717      }
2718
2719      @Override
2720      public Base makeProperty(int hash, String name) throws FHIRException {
2721        switch (hash) {
2722        case -1253081034:  return getSourceMaterialClass(); 
2723        case 1622665404:  return getSourceMaterialType(); 
2724        case -1238066353:  return getSourceMaterialState(); 
2725        case -1965449843:  return getOrganismId(); 
2726        case 988460669:  return getOrganismNameElement();
2727        case -675437663:  return addParentSubstanceId(); 
2728        case -555382895:  return addParentSubstanceNameElement();
2729        case 57176467:  return addCountryOfOrigin(); 
2730        case -1988836681:  return addGeographicalLocationElement();
2731        case 391529091:  return getDevelopmentStage(); 
2732        case 1472689306:  return addFractionDescription(); 
2733        case 1316389074:  return getOrganism(); 
2734        case -1803623927:  return addPartDescription(); 
2735        default: return super.makeProperty(hash, name);
2736        }
2737
2738      }
2739
2740      @Override
2741      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2742        switch (hash) {
2743        case -1253081034: /*sourceMaterialClass*/ return new String[] {"CodeableConcept"};
2744        case 1622665404: /*sourceMaterialType*/ return new String[] {"CodeableConcept"};
2745        case -1238066353: /*sourceMaterialState*/ return new String[] {"CodeableConcept"};
2746        case -1965449843: /*organismId*/ return new String[] {"Identifier"};
2747        case 988460669: /*organismName*/ return new String[] {"string"};
2748        case -675437663: /*parentSubstanceId*/ return new String[] {"Identifier"};
2749        case -555382895: /*parentSubstanceName*/ return new String[] {"string"};
2750        case 57176467: /*countryOfOrigin*/ return new String[] {"CodeableConcept"};
2751        case -1988836681: /*geographicalLocation*/ return new String[] {"string"};
2752        case 391529091: /*developmentStage*/ return new String[] {"CodeableConcept"};
2753        case 1472689306: /*fractionDescription*/ return new String[] {};
2754        case 1316389074: /*organism*/ return new String[] {};
2755        case -1803623927: /*partDescription*/ return new String[] {};
2756        default: return super.getTypesForProperty(hash, name);
2757        }
2758
2759      }
2760
2761      @Override
2762      public Base addChild(String name) throws FHIRException {
2763        if (name.equals("sourceMaterialClass")) {
2764          this.sourceMaterialClass = new CodeableConcept();
2765          return this.sourceMaterialClass;
2766        }
2767        else if (name.equals("sourceMaterialType")) {
2768          this.sourceMaterialType = new CodeableConcept();
2769          return this.sourceMaterialType;
2770        }
2771        else if (name.equals("sourceMaterialState")) {
2772          this.sourceMaterialState = new CodeableConcept();
2773          return this.sourceMaterialState;
2774        }
2775        else if (name.equals("organismId")) {
2776          this.organismId = new Identifier();
2777          return this.organismId;
2778        }
2779        else if (name.equals("organismName")) {
2780          throw new FHIRException("Cannot call addChild on a primitive type SubstanceSourceMaterial.organismName");
2781        }
2782        else if (name.equals("parentSubstanceId")) {
2783          return addParentSubstanceId();
2784        }
2785        else if (name.equals("parentSubstanceName")) {
2786          throw new FHIRException("Cannot call addChild on a primitive type SubstanceSourceMaterial.parentSubstanceName");
2787        }
2788        else if (name.equals("countryOfOrigin")) {
2789          return addCountryOfOrigin();
2790        }
2791        else if (name.equals("geographicalLocation")) {
2792          throw new FHIRException("Cannot call addChild on a primitive type SubstanceSourceMaterial.geographicalLocation");
2793        }
2794        else if (name.equals("developmentStage")) {
2795          this.developmentStage = new CodeableConcept();
2796          return this.developmentStage;
2797        }
2798        else if (name.equals("fractionDescription")) {
2799          return addFractionDescription();
2800        }
2801        else if (name.equals("organism")) {
2802          this.organism = new SubstanceSourceMaterialOrganismComponent();
2803          return this.organism;
2804        }
2805        else if (name.equals("partDescription")) {
2806          return addPartDescription();
2807        }
2808        else
2809          return super.addChild(name);
2810      }
2811
2812  public String fhirType() {
2813    return "SubstanceSourceMaterial";
2814
2815  }
2816
2817      public SubstanceSourceMaterial copy() {
2818        SubstanceSourceMaterial dst = new SubstanceSourceMaterial();
2819        copyValues(dst);
2820        dst.sourceMaterialClass = sourceMaterialClass == null ? null : sourceMaterialClass.copy();
2821        dst.sourceMaterialType = sourceMaterialType == null ? null : sourceMaterialType.copy();
2822        dst.sourceMaterialState = sourceMaterialState == null ? null : sourceMaterialState.copy();
2823        dst.organismId = organismId == null ? null : organismId.copy();
2824        dst.organismName = organismName == null ? null : organismName.copy();
2825        if (parentSubstanceId != null) {
2826          dst.parentSubstanceId = new ArrayList<Identifier>();
2827          for (Identifier i : parentSubstanceId)
2828            dst.parentSubstanceId.add(i.copy());
2829        };
2830        if (parentSubstanceName != null) {
2831          dst.parentSubstanceName = new ArrayList<StringType>();
2832          for (StringType i : parentSubstanceName)
2833            dst.parentSubstanceName.add(i.copy());
2834        };
2835        if (countryOfOrigin != null) {
2836          dst.countryOfOrigin = new ArrayList<CodeableConcept>();
2837          for (CodeableConcept i : countryOfOrigin)
2838            dst.countryOfOrigin.add(i.copy());
2839        };
2840        if (geographicalLocation != null) {
2841          dst.geographicalLocation = new ArrayList<StringType>();
2842          for (StringType i : geographicalLocation)
2843            dst.geographicalLocation.add(i.copy());
2844        };
2845        dst.developmentStage = developmentStage == null ? null : developmentStage.copy();
2846        if (fractionDescription != null) {
2847          dst.fractionDescription = new ArrayList<SubstanceSourceMaterialFractionDescriptionComponent>();
2848          for (SubstanceSourceMaterialFractionDescriptionComponent i : fractionDescription)
2849            dst.fractionDescription.add(i.copy());
2850        };
2851        dst.organism = organism == null ? null : organism.copy();
2852        if (partDescription != null) {
2853          dst.partDescription = new ArrayList<SubstanceSourceMaterialPartDescriptionComponent>();
2854          for (SubstanceSourceMaterialPartDescriptionComponent i : partDescription)
2855            dst.partDescription.add(i.copy());
2856        };
2857        return dst;
2858      }
2859
2860      protected SubstanceSourceMaterial typedCopy() {
2861        return copy();
2862      }
2863
2864      @Override
2865      public boolean equalsDeep(Base other_) {
2866        if (!super.equalsDeep(other_))
2867          return false;
2868        if (!(other_ instanceof SubstanceSourceMaterial))
2869          return false;
2870        SubstanceSourceMaterial o = (SubstanceSourceMaterial) other_;
2871        return compareDeep(sourceMaterialClass, o.sourceMaterialClass, true) && compareDeep(sourceMaterialType, o.sourceMaterialType, true)
2872           && compareDeep(sourceMaterialState, o.sourceMaterialState, true) && compareDeep(organismId, o.organismId, true)
2873           && compareDeep(organismName, o.organismName, true) && compareDeep(parentSubstanceId, o.parentSubstanceId, true)
2874           && compareDeep(parentSubstanceName, o.parentSubstanceName, true) && compareDeep(countryOfOrigin, o.countryOfOrigin, true)
2875           && compareDeep(geographicalLocation, o.geographicalLocation, true) && compareDeep(developmentStage, o.developmentStage, true)
2876           && compareDeep(fractionDescription, o.fractionDescription, true) && compareDeep(organism, o.organism, true)
2877           && compareDeep(partDescription, o.partDescription, true);
2878      }
2879
2880      @Override
2881      public boolean equalsShallow(Base other_) {
2882        if (!super.equalsShallow(other_))
2883          return false;
2884        if (!(other_ instanceof SubstanceSourceMaterial))
2885          return false;
2886        SubstanceSourceMaterial o = (SubstanceSourceMaterial) other_;
2887        return compareValues(organismName, o.organismName, true) && compareValues(parentSubstanceName, o.parentSubstanceName, true)
2888           && compareValues(geographicalLocation, o.geographicalLocation, true);
2889      }
2890
2891      public boolean isEmpty() {
2892        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sourceMaterialClass, sourceMaterialType
2893          , sourceMaterialState, organismId, organismName, parentSubstanceId, parentSubstanceName
2894          , countryOfOrigin, geographicalLocation, developmentStage, fractionDescription, organism
2895          , partDescription);
2896      }
2897
2898  @Override
2899  public ResourceType getResourceType() {
2900    return ResourceType.SubstanceSourceMaterial;
2901   }
2902
2903
2904}
2905