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