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;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045
046/**
047 * Information about a medication that is used to support knowledge.
048 */
049@ResourceDef(name = "MedicationKnowledge", profile = "http://hl7.org/fhir/StructureDefinition/MedicationKnowledge")
050public class MedicationKnowledge extends DomainResource {
051
052  public enum MedicationKnowledgeStatus {
053    /**
054     * The medication is available for use.
055     */
056    ACTIVE,
057    /**
058     * The medication is not available for use.
059     */
060    INACTIVE,
061    /**
062     * The medication was entered in error.
063     */
064    ENTEREDINERROR,
065    /**
066     * added to help the parsers with the generic types
067     */
068    NULL;
069
070    public static MedicationKnowledgeStatus fromCode(String codeString) throws FHIRException {
071      if (codeString == null || "".equals(codeString))
072        return null;
073      if ("active".equals(codeString))
074        return ACTIVE;
075      if ("inactive".equals(codeString))
076        return INACTIVE;
077      if ("entered-in-error".equals(codeString))
078        return ENTEREDINERROR;
079      if (Configuration.isAcceptInvalidEnums())
080        return null;
081      else
082        throw new FHIRException("Unknown MedicationKnowledgeStatus code '" + codeString + "'");
083    }
084
085    public String toCode() {
086      switch (this) {
087      case ACTIVE:
088        return "active";
089      case INACTIVE:
090        return "inactive";
091      case ENTEREDINERROR:
092        return "entered-in-error";
093      case NULL:
094        return null;
095      default:
096        return "?";
097      }
098    }
099
100    public String getSystem() {
101      switch (this) {
102      case ACTIVE:
103        return "http://terminology.hl7.org/CodeSystem/medicationknowledge-status";
104      case INACTIVE:
105        return "http://terminology.hl7.org/CodeSystem/medicationknowledge-status";
106      case ENTEREDINERROR:
107        return "http://terminology.hl7.org/CodeSystem/medicationknowledge-status";
108      case NULL:
109        return null;
110      default:
111        return "?";
112      }
113    }
114
115    public String getDefinition() {
116      switch (this) {
117      case ACTIVE:
118        return "The medication is available for use.";
119      case INACTIVE:
120        return "The medication is not available for use.";
121      case ENTEREDINERROR:
122        return "The medication was entered in error.";
123      case NULL:
124        return null;
125      default:
126        return "?";
127      }
128    }
129
130    public String getDisplay() {
131      switch (this) {
132      case ACTIVE:
133        return "Active";
134      case INACTIVE:
135        return "Inactive";
136      case ENTEREDINERROR:
137        return "Entered in Error";
138      case NULL:
139        return null;
140      default:
141        return "?";
142      }
143    }
144  }
145
146  public static class MedicationKnowledgeStatusEnumFactory implements EnumFactory<MedicationKnowledgeStatus> {
147    public MedicationKnowledgeStatus fromCode(String codeString) throws IllegalArgumentException {
148      if (codeString == null || "".equals(codeString))
149        if (codeString == null || "".equals(codeString))
150          return null;
151      if ("active".equals(codeString))
152        return MedicationKnowledgeStatus.ACTIVE;
153      if ("inactive".equals(codeString))
154        return MedicationKnowledgeStatus.INACTIVE;
155      if ("entered-in-error".equals(codeString))
156        return MedicationKnowledgeStatus.ENTEREDINERROR;
157      throw new IllegalArgumentException("Unknown MedicationKnowledgeStatus code '" + codeString + "'");
158    }
159
160    public Enumeration<MedicationKnowledgeStatus> fromType(PrimitiveType<?> code) throws FHIRException {
161      if (code == null)
162        return null;
163      if (code.isEmpty())
164        return new Enumeration<MedicationKnowledgeStatus>(this, MedicationKnowledgeStatus.NULL, code);
165      String codeString = code.asStringValue();
166      if (codeString == null || "".equals(codeString))
167        return new Enumeration<MedicationKnowledgeStatus>(this, MedicationKnowledgeStatus.NULL, code);
168      if ("active".equals(codeString))
169        return new Enumeration<MedicationKnowledgeStatus>(this, MedicationKnowledgeStatus.ACTIVE, code);
170      if ("inactive".equals(codeString))
171        return new Enumeration<MedicationKnowledgeStatus>(this, MedicationKnowledgeStatus.INACTIVE, code);
172      if ("entered-in-error".equals(codeString))
173        return new Enumeration<MedicationKnowledgeStatus>(this, MedicationKnowledgeStatus.ENTEREDINERROR, code);
174      throw new FHIRException("Unknown MedicationKnowledgeStatus code '" + codeString + "'");
175    }
176
177    public String toCode(MedicationKnowledgeStatus code) {
178      if (code == MedicationKnowledgeStatus.ACTIVE)
179        return "active";
180      if (code == MedicationKnowledgeStatus.INACTIVE)
181        return "inactive";
182      if (code == MedicationKnowledgeStatus.ENTEREDINERROR)
183        return "entered-in-error";
184      return "?";
185    }
186
187    public String toSystem(MedicationKnowledgeStatus code) {
188      return code.getSystem();
189    }
190  }
191
192  @Block()
193  public static class MedicationKnowledgeRelatedMedicationKnowledgeComponent extends BackboneElement
194      implements IBaseBackboneElement {
195    /**
196     * The category of the associated medication knowledge reference.
197     */
198    @Child(name = "type", type = {
199        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
200    @Description(shortDefinition = "Category of medicationKnowledge", formalDefinition = "The category of the associated medication knowledge reference.")
201    protected CodeableConcept type;
202
203    /**
204     * Associated documentation about the associated medication knowledge.
205     */
206    @Child(name = "reference", type = {
207        MedicationKnowledge.class }, order = 2, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
208    @Description(shortDefinition = "Associated documentation about the associated medication knowledge", formalDefinition = "Associated documentation about the associated medication knowledge.")
209    protected List<Reference> reference;
210    /**
211     * The actual objects that are the target of the reference (Associated
212     * documentation about the associated medication knowledge.)
213     */
214    protected List<MedicationKnowledge> referenceTarget;
215
216    private static final long serialVersionUID = 1285880636L;
217
218    /**
219     * Constructor
220     */
221    public MedicationKnowledgeRelatedMedicationKnowledgeComponent() {
222      super();
223    }
224
225    /**
226     * Constructor
227     */
228    public MedicationKnowledgeRelatedMedicationKnowledgeComponent(CodeableConcept type) {
229      super();
230      this.type = type;
231    }
232
233    /**
234     * @return {@link #type} (The category of the associated medication knowledge
235     *         reference.)
236     */
237    public CodeableConcept getType() {
238      if (this.type == null)
239        if (Configuration.errorOnAutoCreate())
240          throw new Error("Attempt to auto-create MedicationKnowledgeRelatedMedicationKnowledgeComponent.type");
241        else if (Configuration.doAutoCreate())
242          this.type = new CodeableConcept(); // cc
243      return this.type;
244    }
245
246    public boolean hasType() {
247      return this.type != null && !this.type.isEmpty();
248    }
249
250    /**
251     * @param value {@link #type} (The category of the associated medication
252     *              knowledge reference.)
253     */
254    public MedicationKnowledgeRelatedMedicationKnowledgeComponent setType(CodeableConcept value) {
255      this.type = value;
256      return this;
257    }
258
259    /**
260     * @return {@link #reference} (Associated documentation about the associated
261     *         medication knowledge.)
262     */
263    public List<Reference> getReference() {
264      if (this.reference == null)
265        this.reference = new ArrayList<Reference>();
266      return this.reference;
267    }
268
269    /**
270     * @return Returns a reference to <code>this</code> for easy method chaining
271     */
272    public MedicationKnowledgeRelatedMedicationKnowledgeComponent setReference(List<Reference> theReference) {
273      this.reference = theReference;
274      return this;
275    }
276
277    public boolean hasReference() {
278      if (this.reference == null)
279        return false;
280      for (Reference item : this.reference)
281        if (!item.isEmpty())
282          return true;
283      return false;
284    }
285
286    public Reference addReference() { // 3
287      Reference t = new Reference();
288      if (this.reference == null)
289        this.reference = new ArrayList<Reference>();
290      this.reference.add(t);
291      return t;
292    }
293
294    public MedicationKnowledgeRelatedMedicationKnowledgeComponent addReference(Reference t) { // 3
295      if (t == null)
296        return this;
297      if (this.reference == null)
298        this.reference = new ArrayList<Reference>();
299      this.reference.add(t);
300      return this;
301    }
302
303    /**
304     * @return The first repetition of repeating field {@link #reference}, creating
305     *         it if it does not already exist
306     */
307    public Reference getReferenceFirstRep() {
308      if (getReference().isEmpty()) {
309        addReference();
310      }
311      return getReference().get(0);
312    }
313
314    /**
315     * @deprecated Use Reference#setResource(IBaseResource) instead
316     */
317    @Deprecated
318    public List<MedicationKnowledge> getReferenceTarget() {
319      if (this.referenceTarget == null)
320        this.referenceTarget = new ArrayList<MedicationKnowledge>();
321      return this.referenceTarget;
322    }
323
324    /**
325     * @deprecated Use Reference#setResource(IBaseResource) instead
326     */
327    @Deprecated
328    public MedicationKnowledge addReferenceTarget() {
329      MedicationKnowledge r = new MedicationKnowledge();
330      if (this.referenceTarget == null)
331        this.referenceTarget = new ArrayList<MedicationKnowledge>();
332      this.referenceTarget.add(r);
333      return r;
334    }
335
336    protected void listChildren(List<Property> children) {
337      super.listChildren(children);
338      children.add(new Property("type", "CodeableConcept",
339          "The category of the associated medication knowledge reference.", 0, 1, type));
340      children.add(new Property("reference", "Reference(MedicationKnowledge)",
341          "Associated documentation about the associated medication knowledge.", 0, java.lang.Integer.MAX_VALUE,
342          reference));
343    }
344
345    @Override
346    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
347      switch (_hash) {
348      case 3575610:
349        /* type */ return new Property("type", "CodeableConcept",
350            "The category of the associated medication knowledge reference.", 0, 1, type);
351      case -925155509:
352        /* reference */ return new Property("reference", "Reference(MedicationKnowledge)",
353            "Associated documentation about the associated medication knowledge.", 0, java.lang.Integer.MAX_VALUE,
354            reference);
355      default:
356        return super.getNamedProperty(_hash, _name, _checkValid);
357      }
358
359    }
360
361    @Override
362    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
363      switch (hash) {
364      case 3575610:
365        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
366      case -925155509:
367        /* reference */ return this.reference == null ? new Base[0]
368            : this.reference.toArray(new Base[this.reference.size()]); // Reference
369      default:
370        return super.getProperty(hash, name, checkValid);
371      }
372
373    }
374
375    @Override
376    public Base setProperty(int hash, String name, Base value) throws FHIRException {
377      switch (hash) {
378      case 3575610: // type
379        this.type = castToCodeableConcept(value); // CodeableConcept
380        return value;
381      case -925155509: // reference
382        this.getReference().add(castToReference(value)); // Reference
383        return value;
384      default:
385        return super.setProperty(hash, name, value);
386      }
387
388    }
389
390    @Override
391    public Base setProperty(String name, Base value) throws FHIRException {
392      if (name.equals("type")) {
393        this.type = castToCodeableConcept(value); // CodeableConcept
394      } else if (name.equals("reference")) {
395        this.getReference().add(castToReference(value));
396      } else
397        return super.setProperty(name, value);
398      return value;
399    }
400
401    @Override
402    public Base makeProperty(int hash, String name) throws FHIRException {
403      switch (hash) {
404      case 3575610:
405        return getType();
406      case -925155509:
407        return addReference();
408      default:
409        return super.makeProperty(hash, name);
410      }
411
412    }
413
414    @Override
415    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
416      switch (hash) {
417      case 3575610:
418        /* type */ return new String[] { "CodeableConcept" };
419      case -925155509:
420        /* reference */ return new String[] { "Reference" };
421      default:
422        return super.getTypesForProperty(hash, name);
423      }
424
425    }
426
427    @Override
428    public Base addChild(String name) throws FHIRException {
429      if (name.equals("type")) {
430        this.type = new CodeableConcept();
431        return this.type;
432      } else if (name.equals("reference")) {
433        return addReference();
434      } else
435        return super.addChild(name);
436    }
437
438    public MedicationKnowledgeRelatedMedicationKnowledgeComponent copy() {
439      MedicationKnowledgeRelatedMedicationKnowledgeComponent dst = new MedicationKnowledgeRelatedMedicationKnowledgeComponent();
440      copyValues(dst);
441      return dst;
442    }
443
444    public void copyValues(MedicationKnowledgeRelatedMedicationKnowledgeComponent dst) {
445      super.copyValues(dst);
446      dst.type = type == null ? null : type.copy();
447      if (reference != null) {
448        dst.reference = new ArrayList<Reference>();
449        for (Reference i : reference)
450          dst.reference.add(i.copy());
451      }
452      ;
453    }
454
455    @Override
456    public boolean equalsDeep(Base other_) {
457      if (!super.equalsDeep(other_))
458        return false;
459      if (!(other_ instanceof MedicationKnowledgeRelatedMedicationKnowledgeComponent))
460        return false;
461      MedicationKnowledgeRelatedMedicationKnowledgeComponent o = (MedicationKnowledgeRelatedMedicationKnowledgeComponent) other_;
462      return compareDeep(type, o.type, true) && compareDeep(reference, o.reference, true);
463    }
464
465    @Override
466    public boolean equalsShallow(Base other_) {
467      if (!super.equalsShallow(other_))
468        return false;
469      if (!(other_ instanceof MedicationKnowledgeRelatedMedicationKnowledgeComponent))
470        return false;
471      MedicationKnowledgeRelatedMedicationKnowledgeComponent o = (MedicationKnowledgeRelatedMedicationKnowledgeComponent) other_;
472      return true;
473    }
474
475    public boolean isEmpty() {
476      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, reference);
477    }
478
479    public String fhirType() {
480      return "MedicationKnowledge.relatedMedicationKnowledge";
481
482    }
483
484  }
485
486  @Block()
487  public static class MedicationKnowledgeMonographComponent extends BackboneElement implements IBaseBackboneElement {
488    /**
489     * The category of documentation about the medication. (e.g. professional
490     * monograph, patient education monograph).
491     */
492    @Child(name = "type", type = {
493        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
494    @Description(shortDefinition = "The category of medication document", formalDefinition = "The category of documentation about the medication. (e.g. professional monograph, patient education monograph).")
495    protected CodeableConcept type;
496
497    /**
498     * Associated documentation about the medication.
499     */
500    @Child(name = "source", type = { DocumentReference.class,
501        Media.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
502    @Description(shortDefinition = "Associated documentation about the medication", formalDefinition = "Associated documentation about the medication.")
503    protected Reference source;
504
505    /**
506     * The actual object that is the target of the reference (Associated
507     * documentation about the medication.)
508     */
509    protected Resource sourceTarget;
510
511    private static final long serialVersionUID = 1392095381L;
512
513    /**
514     * Constructor
515     */
516    public MedicationKnowledgeMonographComponent() {
517      super();
518    }
519
520    /**
521     * @return {@link #type} (The category of documentation about the medication.
522     *         (e.g. professional monograph, patient education monograph).)
523     */
524    public CodeableConcept getType() {
525      if (this.type == null)
526        if (Configuration.errorOnAutoCreate())
527          throw new Error("Attempt to auto-create MedicationKnowledgeMonographComponent.type");
528        else if (Configuration.doAutoCreate())
529          this.type = new CodeableConcept(); // cc
530      return this.type;
531    }
532
533    public boolean hasType() {
534      return this.type != null && !this.type.isEmpty();
535    }
536
537    /**
538     * @param value {@link #type} (The category of documentation about the
539     *              medication. (e.g. professional monograph, patient education
540     *              monograph).)
541     */
542    public MedicationKnowledgeMonographComponent setType(CodeableConcept value) {
543      this.type = value;
544      return this;
545    }
546
547    /**
548     * @return {@link #source} (Associated documentation about the medication.)
549     */
550    public Reference getSource() {
551      if (this.source == null)
552        if (Configuration.errorOnAutoCreate())
553          throw new Error("Attempt to auto-create MedicationKnowledgeMonographComponent.source");
554        else if (Configuration.doAutoCreate())
555          this.source = new Reference(); // cc
556      return this.source;
557    }
558
559    public boolean hasSource() {
560      return this.source != null && !this.source.isEmpty();
561    }
562
563    /**
564     * @param value {@link #source} (Associated documentation about the medication.)
565     */
566    public MedicationKnowledgeMonographComponent setSource(Reference value) {
567      this.source = value;
568      return this;
569    }
570
571    /**
572     * @return {@link #source} The actual object that is the target of the
573     *         reference. The reference library doesn't populate this, but you can
574     *         use it to hold the resource if you resolve it. (Associated
575     *         documentation about the medication.)
576     */
577    public Resource getSourceTarget() {
578      return this.sourceTarget;
579    }
580
581    /**
582     * @param value {@link #source} The actual object that is the target of the
583     *              reference. The reference library doesn't use these, but you can
584     *              use it to hold the resource if you resolve it. (Associated
585     *              documentation about the medication.)
586     */
587    public MedicationKnowledgeMonographComponent setSourceTarget(Resource value) {
588      this.sourceTarget = value;
589      return this;
590    }
591
592    protected void listChildren(List<Property> children) {
593      super.listChildren(children);
594      children.add(new Property("type", "CodeableConcept",
595          "The category of documentation about the medication. (e.g. professional monograph, patient education monograph).",
596          0, 1, type));
597      children.add(new Property("source", "Reference(DocumentReference|Media)",
598          "Associated documentation about the medication.", 0, 1, source));
599    }
600
601    @Override
602    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
603      switch (_hash) {
604      case 3575610:
605        /* type */ return new Property("type", "CodeableConcept",
606            "The category of documentation about the medication. (e.g. professional monograph, patient education monograph).",
607            0, 1, type);
608      case -896505829:
609        /* source */ return new Property("source", "Reference(DocumentReference|Media)",
610            "Associated documentation about the medication.", 0, 1, source);
611      default:
612        return super.getNamedProperty(_hash, _name, _checkValid);
613      }
614
615    }
616
617    @Override
618    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
619      switch (hash) {
620      case 3575610:
621        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
622      case -896505829:
623        /* source */ return this.source == null ? new Base[0] : new Base[] { this.source }; // Reference
624      default:
625        return super.getProperty(hash, name, checkValid);
626      }
627
628    }
629
630    @Override
631    public Base setProperty(int hash, String name, Base value) throws FHIRException {
632      switch (hash) {
633      case 3575610: // type
634        this.type = castToCodeableConcept(value); // CodeableConcept
635        return value;
636      case -896505829: // source
637        this.source = castToReference(value); // Reference
638        return value;
639      default:
640        return super.setProperty(hash, name, value);
641      }
642
643    }
644
645    @Override
646    public Base setProperty(String name, Base value) throws FHIRException {
647      if (name.equals("type")) {
648        this.type = castToCodeableConcept(value); // CodeableConcept
649      } else if (name.equals("source")) {
650        this.source = castToReference(value); // Reference
651      } else
652        return super.setProperty(name, value);
653      return value;
654    }
655
656    @Override
657    public Base makeProperty(int hash, String name) throws FHIRException {
658      switch (hash) {
659      case 3575610:
660        return getType();
661      case -896505829:
662        return getSource();
663      default:
664        return super.makeProperty(hash, name);
665      }
666
667    }
668
669    @Override
670    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
671      switch (hash) {
672      case 3575610:
673        /* type */ return new String[] { "CodeableConcept" };
674      case -896505829:
675        /* source */ return new String[] { "Reference" };
676      default:
677        return super.getTypesForProperty(hash, name);
678      }
679
680    }
681
682    @Override
683    public Base addChild(String name) throws FHIRException {
684      if (name.equals("type")) {
685        this.type = new CodeableConcept();
686        return this.type;
687      } else if (name.equals("source")) {
688        this.source = new Reference();
689        return this.source;
690      } else
691        return super.addChild(name);
692    }
693
694    public MedicationKnowledgeMonographComponent copy() {
695      MedicationKnowledgeMonographComponent dst = new MedicationKnowledgeMonographComponent();
696      copyValues(dst);
697      return dst;
698    }
699
700    public void copyValues(MedicationKnowledgeMonographComponent dst) {
701      super.copyValues(dst);
702      dst.type = type == null ? null : type.copy();
703      dst.source = source == null ? null : source.copy();
704    }
705
706    @Override
707    public boolean equalsDeep(Base other_) {
708      if (!super.equalsDeep(other_))
709        return false;
710      if (!(other_ instanceof MedicationKnowledgeMonographComponent))
711        return false;
712      MedicationKnowledgeMonographComponent o = (MedicationKnowledgeMonographComponent) other_;
713      return compareDeep(type, o.type, true) && compareDeep(source, o.source, true);
714    }
715
716    @Override
717    public boolean equalsShallow(Base other_) {
718      if (!super.equalsShallow(other_))
719        return false;
720      if (!(other_ instanceof MedicationKnowledgeMonographComponent))
721        return false;
722      MedicationKnowledgeMonographComponent o = (MedicationKnowledgeMonographComponent) other_;
723      return true;
724    }
725
726    public boolean isEmpty() {
727      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, source);
728    }
729
730    public String fhirType() {
731      return "MedicationKnowledge.monograph";
732
733    }
734
735  }
736
737  @Block()
738  public static class MedicationKnowledgeIngredientComponent extends BackboneElement implements IBaseBackboneElement {
739    /**
740     * The actual ingredient - either a substance (simple ingredient) or another
741     * medication.
742     */
743    @Child(name = "item", type = { CodeableConcept.class,
744        Substance.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
745    @Description(shortDefinition = "Medication(s) or substance(s) contained in the medication", formalDefinition = "The actual ingredient - either a substance (simple ingredient) or another medication.")
746    protected Type item;
747
748    /**
749     * Indication of whether this ingredient affects the therapeutic action of the
750     * drug.
751     */
752    @Child(name = "isActive", type = {
753        BooleanType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
754    @Description(shortDefinition = "Active ingredient indicator", formalDefinition = "Indication of whether this ingredient affects the therapeutic action of the drug.")
755    protected BooleanType isActive;
756
757    /**
758     * Specifies how many (or how much) of the items there are in this Medication.
759     * For example, 250 mg per tablet. This is expressed as a ratio where the
760     * numerator is 250mg and the denominator is 1 tablet.
761     */
762    @Child(name = "strength", type = { Ratio.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
763    @Description(shortDefinition = "Quantity of ingredient present", formalDefinition = "Specifies how many (or how much) of the items there are in this Medication.  For example, 250 mg per tablet.  This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.")
764    protected Ratio strength;
765
766    private static final long serialVersionUID = 1365103497L;
767
768    /**
769     * Constructor
770     */
771    public MedicationKnowledgeIngredientComponent() {
772      super();
773    }
774
775    /**
776     * Constructor
777     */
778    public MedicationKnowledgeIngredientComponent(Type item) {
779      super();
780      this.item = item;
781    }
782
783    /**
784     * @return {@link #item} (The actual ingredient - either a substance (simple
785     *         ingredient) or another medication.)
786     */
787    public Type getItem() {
788      return this.item;
789    }
790
791    /**
792     * @return {@link #item} (The actual ingredient - either a substance (simple
793     *         ingredient) or another medication.)
794     */
795    public CodeableConcept getItemCodeableConcept() throws FHIRException {
796      if (this.item == null)
797        this.item = new CodeableConcept();
798      if (!(this.item instanceof CodeableConcept))
799        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
800            + this.item.getClass().getName() + " was encountered");
801      return (CodeableConcept) this.item;
802    }
803
804    public boolean hasItemCodeableConcept() {
805      return this != null && this.item instanceof CodeableConcept;
806    }
807
808    /**
809     * @return {@link #item} (The actual ingredient - either a substance (simple
810     *         ingredient) or another medication.)
811     */
812    public Reference getItemReference() throws FHIRException {
813      if (this.item == null)
814        this.item = new Reference();
815      if (!(this.item instanceof Reference))
816        throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.item.getClass().getName()
817            + " was encountered");
818      return (Reference) this.item;
819    }
820
821    public boolean hasItemReference() {
822      return this != null && this.item instanceof Reference;
823    }
824
825    public boolean hasItem() {
826      return this.item != null && !this.item.isEmpty();
827    }
828
829    /**
830     * @param value {@link #item} (The actual ingredient - either a substance
831     *              (simple ingredient) or another medication.)
832     */
833    public MedicationKnowledgeIngredientComponent setItem(Type value) {
834      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
835        throw new Error("Not the right type for MedicationKnowledge.ingredient.item[x]: " + value.fhirType());
836      this.item = value;
837      return this;
838    }
839
840    /**
841     * @return {@link #isActive} (Indication of whether this ingredient affects the
842     *         therapeutic action of the drug.). This is the underlying object with
843     *         id, value and extensions. The accessor "getIsActive" gives direct
844     *         access to the value
845     */
846    public BooleanType getIsActiveElement() {
847      if (this.isActive == null)
848        if (Configuration.errorOnAutoCreate())
849          throw new Error("Attempt to auto-create MedicationKnowledgeIngredientComponent.isActive");
850        else if (Configuration.doAutoCreate())
851          this.isActive = new BooleanType(); // bb
852      return this.isActive;
853    }
854
855    public boolean hasIsActiveElement() {
856      return this.isActive != null && !this.isActive.isEmpty();
857    }
858
859    public boolean hasIsActive() {
860      return this.isActive != null && !this.isActive.isEmpty();
861    }
862
863    /**
864     * @param value {@link #isActive} (Indication of whether this ingredient affects
865     *              the therapeutic action of the drug.). This is the underlying
866     *              object with id, value and extensions. The accessor "getIsActive"
867     *              gives direct access to the value
868     */
869    public MedicationKnowledgeIngredientComponent setIsActiveElement(BooleanType value) {
870      this.isActive = value;
871      return this;
872    }
873
874    /**
875     * @return Indication of whether this ingredient affects the therapeutic action
876     *         of the drug.
877     */
878    public boolean getIsActive() {
879      return this.isActive == null || this.isActive.isEmpty() ? false : this.isActive.getValue();
880    }
881
882    /**
883     * @param value Indication of whether this ingredient affects the therapeutic
884     *              action of the drug.
885     */
886    public MedicationKnowledgeIngredientComponent setIsActive(boolean value) {
887      if (this.isActive == null)
888        this.isActive = new BooleanType();
889      this.isActive.setValue(value);
890      return this;
891    }
892
893    /**
894     * @return {@link #strength} (Specifies how many (or how much) of the items
895     *         there are in this Medication. For example, 250 mg per tablet. This is
896     *         expressed as a ratio where the numerator is 250mg and the denominator
897     *         is 1 tablet.)
898     */
899    public Ratio getStrength() {
900      if (this.strength == null)
901        if (Configuration.errorOnAutoCreate())
902          throw new Error("Attempt to auto-create MedicationKnowledgeIngredientComponent.strength");
903        else if (Configuration.doAutoCreate())
904          this.strength = new Ratio(); // cc
905      return this.strength;
906    }
907
908    public boolean hasStrength() {
909      return this.strength != null && !this.strength.isEmpty();
910    }
911
912    /**
913     * @param value {@link #strength} (Specifies how many (or how much) of the items
914     *              there are in this Medication. For example, 250 mg per tablet.
915     *              This is expressed as a ratio where the numerator is 250mg and
916     *              the denominator is 1 tablet.)
917     */
918    public MedicationKnowledgeIngredientComponent setStrength(Ratio value) {
919      this.strength = value;
920      return this;
921    }
922
923    protected void listChildren(List<Property> children) {
924      super.listChildren(children);
925      children.add(new Property("item[x]", "CodeableConcept|Reference(Substance)",
926          "The actual ingredient - either a substance (simple ingredient) or another medication.", 0, 1, item));
927      children.add(new Property("isActive", "boolean",
928          "Indication of whether this ingredient affects the therapeutic action of the drug.", 0, 1, isActive));
929      children.add(new Property("strength", "Ratio",
930          "Specifies how many (or how much) of the items there are in this Medication.  For example, 250 mg per tablet.  This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.",
931          0, 1, strength));
932    }
933
934    @Override
935    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
936      switch (_hash) {
937      case 2116201613:
938        /* item[x] */ return new Property("item[x]", "CodeableConcept|Reference(Substance)",
939            "The actual ingredient - either a substance (simple ingredient) or another medication.", 0, 1, item);
940      case 3242771:
941        /* item */ return new Property("item[x]", "CodeableConcept|Reference(Substance)",
942            "The actual ingredient - either a substance (simple ingredient) or another medication.", 0, 1, item);
943      case 106644494:
944        /* itemCodeableConcept */ return new Property("item[x]", "CodeableConcept|Reference(Substance)",
945            "The actual ingredient - either a substance (simple ingredient) or another medication.", 0, 1, item);
946      case 1376364920:
947        /* itemReference */ return new Property("item[x]", "CodeableConcept|Reference(Substance)",
948            "The actual ingredient - either a substance (simple ingredient) or another medication.", 0, 1, item);
949      case -748916528:
950        /* isActive */ return new Property("isActive", "boolean",
951            "Indication of whether this ingredient affects the therapeutic action of the drug.", 0, 1, isActive);
952      case 1791316033:
953        /* strength */ return new Property("strength", "Ratio",
954            "Specifies how many (or how much) of the items there are in this Medication.  For example, 250 mg per tablet.  This is expressed as a ratio where the numerator is 250mg and the denominator is 1 tablet.",
955            0, 1, strength);
956      default:
957        return super.getNamedProperty(_hash, _name, _checkValid);
958      }
959
960    }
961
962    @Override
963    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
964      switch (hash) {
965      case 3242771:
966        /* item */ return this.item == null ? new Base[0] : new Base[] { this.item }; // Type
967      case -748916528:
968        /* isActive */ return this.isActive == null ? new Base[0] : new Base[] { this.isActive }; // BooleanType
969      case 1791316033:
970        /* strength */ return this.strength == null ? new Base[0] : new Base[] { this.strength }; // Ratio
971      default:
972        return super.getProperty(hash, name, checkValid);
973      }
974
975    }
976
977    @Override
978    public Base setProperty(int hash, String name, Base value) throws FHIRException {
979      switch (hash) {
980      case 3242771: // item
981        this.item = castToType(value); // Type
982        return value;
983      case -748916528: // isActive
984        this.isActive = castToBoolean(value); // BooleanType
985        return value;
986      case 1791316033: // strength
987        this.strength = castToRatio(value); // Ratio
988        return value;
989      default:
990        return super.setProperty(hash, name, value);
991      }
992
993    }
994
995    @Override
996    public Base setProperty(String name, Base value) throws FHIRException {
997      if (name.equals("item[x]")) {
998        this.item = castToType(value); // Type
999      } else if (name.equals("isActive")) {
1000        this.isActive = castToBoolean(value); // BooleanType
1001      } else if (name.equals("strength")) {
1002        this.strength = castToRatio(value); // Ratio
1003      } else
1004        return super.setProperty(name, value);
1005      return value;
1006    }
1007
1008    @Override
1009    public Base makeProperty(int hash, String name) throws FHIRException {
1010      switch (hash) {
1011      case 2116201613:
1012        return getItem();
1013      case 3242771:
1014        return getItem();
1015      case -748916528:
1016        return getIsActiveElement();
1017      case 1791316033:
1018        return getStrength();
1019      default:
1020        return super.makeProperty(hash, name);
1021      }
1022
1023    }
1024
1025    @Override
1026    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1027      switch (hash) {
1028      case 3242771:
1029        /* item */ return new String[] { "CodeableConcept", "Reference" };
1030      case -748916528:
1031        /* isActive */ return new String[] { "boolean" };
1032      case 1791316033:
1033        /* strength */ return new String[] { "Ratio" };
1034      default:
1035        return super.getTypesForProperty(hash, name);
1036      }
1037
1038    }
1039
1040    @Override
1041    public Base addChild(String name) throws FHIRException {
1042      if (name.equals("itemCodeableConcept")) {
1043        this.item = new CodeableConcept();
1044        return this.item;
1045      } else if (name.equals("itemReference")) {
1046        this.item = new Reference();
1047        return this.item;
1048      } else if (name.equals("isActive")) {
1049        throw new FHIRException("Cannot call addChild on a singleton property MedicationKnowledge.isActive");
1050      } else if (name.equals("strength")) {
1051        this.strength = new Ratio();
1052        return this.strength;
1053      } else
1054        return super.addChild(name);
1055    }
1056
1057    public MedicationKnowledgeIngredientComponent copy() {
1058      MedicationKnowledgeIngredientComponent dst = new MedicationKnowledgeIngredientComponent();
1059      copyValues(dst);
1060      return dst;
1061    }
1062
1063    public void copyValues(MedicationKnowledgeIngredientComponent dst) {
1064      super.copyValues(dst);
1065      dst.item = item == null ? null : item.copy();
1066      dst.isActive = isActive == null ? null : isActive.copy();
1067      dst.strength = strength == null ? null : strength.copy();
1068    }
1069
1070    @Override
1071    public boolean equalsDeep(Base other_) {
1072      if (!super.equalsDeep(other_))
1073        return false;
1074      if (!(other_ instanceof MedicationKnowledgeIngredientComponent))
1075        return false;
1076      MedicationKnowledgeIngredientComponent o = (MedicationKnowledgeIngredientComponent) other_;
1077      return compareDeep(item, o.item, true) && compareDeep(isActive, o.isActive, true)
1078          && compareDeep(strength, o.strength, true);
1079    }
1080
1081    @Override
1082    public boolean equalsShallow(Base other_) {
1083      if (!super.equalsShallow(other_))
1084        return false;
1085      if (!(other_ instanceof MedicationKnowledgeIngredientComponent))
1086        return false;
1087      MedicationKnowledgeIngredientComponent o = (MedicationKnowledgeIngredientComponent) other_;
1088      return compareValues(isActive, o.isActive, true);
1089    }
1090
1091    public boolean isEmpty() {
1092      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(item, isActive, strength);
1093    }
1094
1095    public String fhirType() {
1096      return "MedicationKnowledge.ingredient";
1097
1098    }
1099
1100  }
1101
1102  @Block()
1103  public static class MedicationKnowledgeCostComponent extends BackboneElement implements IBaseBackboneElement {
1104    /**
1105     * The category of the cost information. For example, manufacturers' cost,
1106     * patient cost, claim reimbursement cost, actual acquisition cost.
1107     */
1108    @Child(name = "type", type = {
1109        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1110    @Description(shortDefinition = "The category of the cost information", formalDefinition = "The category of the cost information.  For example, manufacturers' cost, patient cost, claim reimbursement cost, actual acquisition cost.")
1111    protected CodeableConcept type;
1112
1113    /**
1114     * The source or owner that assigns the price to the medication.
1115     */
1116    @Child(name = "source", type = { StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1117    @Description(shortDefinition = "The source or owner for the price information", formalDefinition = "The source or owner that assigns the price to the medication.")
1118    protected StringType source;
1119
1120    /**
1121     * The price of the medication.
1122     */
1123    @Child(name = "cost", type = { Money.class }, order = 3, min = 1, max = 1, modifier = false, summary = false)
1124    @Description(shortDefinition = "The price of the medication", formalDefinition = "The price of the medication.")
1125    protected Money cost;
1126
1127    private static final long serialVersionUID = 244671378L;
1128
1129    /**
1130     * Constructor
1131     */
1132    public MedicationKnowledgeCostComponent() {
1133      super();
1134    }
1135
1136    /**
1137     * Constructor
1138     */
1139    public MedicationKnowledgeCostComponent(CodeableConcept type, Money cost) {
1140      super();
1141      this.type = type;
1142      this.cost = cost;
1143    }
1144
1145    /**
1146     * @return {@link #type} (The category of the cost information. For example,
1147     *         manufacturers' cost, patient cost, claim reimbursement cost, actual
1148     *         acquisition cost.)
1149     */
1150    public CodeableConcept getType() {
1151      if (this.type == null)
1152        if (Configuration.errorOnAutoCreate())
1153          throw new Error("Attempt to auto-create MedicationKnowledgeCostComponent.type");
1154        else if (Configuration.doAutoCreate())
1155          this.type = new CodeableConcept(); // cc
1156      return this.type;
1157    }
1158
1159    public boolean hasType() {
1160      return this.type != null && !this.type.isEmpty();
1161    }
1162
1163    /**
1164     * @param value {@link #type} (The category of the cost information. For
1165     *              example, manufacturers' cost, patient cost, claim reimbursement
1166     *              cost, actual acquisition cost.)
1167     */
1168    public MedicationKnowledgeCostComponent setType(CodeableConcept value) {
1169      this.type = value;
1170      return this;
1171    }
1172
1173    /**
1174     * @return {@link #source} (The source or owner that assigns the price to the
1175     *         medication.). This is the underlying object with id, value and
1176     *         extensions. The accessor "getSource" gives direct access to the value
1177     */
1178    public StringType getSourceElement() {
1179      if (this.source == null)
1180        if (Configuration.errorOnAutoCreate())
1181          throw new Error("Attempt to auto-create MedicationKnowledgeCostComponent.source");
1182        else if (Configuration.doAutoCreate())
1183          this.source = new StringType(); // bb
1184      return this.source;
1185    }
1186
1187    public boolean hasSourceElement() {
1188      return this.source != null && !this.source.isEmpty();
1189    }
1190
1191    public boolean hasSource() {
1192      return this.source != null && !this.source.isEmpty();
1193    }
1194
1195    /**
1196     * @param value {@link #source} (The source or owner that assigns the price to
1197     *              the medication.). This is the underlying object with id, value
1198     *              and extensions. The accessor "getSource" gives direct access to
1199     *              the value
1200     */
1201    public MedicationKnowledgeCostComponent setSourceElement(StringType value) {
1202      this.source = value;
1203      return this;
1204    }
1205
1206    /**
1207     * @return The source or owner that assigns the price to the medication.
1208     */
1209    public String getSource() {
1210      return this.source == null ? null : this.source.getValue();
1211    }
1212
1213    /**
1214     * @param value The source or owner that assigns the price to the medication.
1215     */
1216    public MedicationKnowledgeCostComponent setSource(String value) {
1217      if (Utilities.noString(value))
1218        this.source = null;
1219      else {
1220        if (this.source == null)
1221          this.source = new StringType();
1222        this.source.setValue(value);
1223      }
1224      return this;
1225    }
1226
1227    /**
1228     * @return {@link #cost} (The price of the medication.)
1229     */
1230    public Money getCost() {
1231      if (this.cost == null)
1232        if (Configuration.errorOnAutoCreate())
1233          throw new Error("Attempt to auto-create MedicationKnowledgeCostComponent.cost");
1234        else if (Configuration.doAutoCreate())
1235          this.cost = new Money(); // cc
1236      return this.cost;
1237    }
1238
1239    public boolean hasCost() {
1240      return this.cost != null && !this.cost.isEmpty();
1241    }
1242
1243    /**
1244     * @param value {@link #cost} (The price of the medication.)
1245     */
1246    public MedicationKnowledgeCostComponent setCost(Money value) {
1247      this.cost = value;
1248      return this;
1249    }
1250
1251    protected void listChildren(List<Property> children) {
1252      super.listChildren(children);
1253      children.add(new Property("type", "CodeableConcept",
1254          "The category of the cost information.  For example, manufacturers' cost, patient cost, claim reimbursement cost, actual acquisition cost.",
1255          0, 1, type));
1256      children.add(new Property("source", "string", "The source or owner that assigns the price to the medication.", 0,
1257          1, source));
1258      children.add(new Property("cost", "Money", "The price of the medication.", 0, 1, cost));
1259    }
1260
1261    @Override
1262    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1263      switch (_hash) {
1264      case 3575610:
1265        /* type */ return new Property("type", "CodeableConcept",
1266            "The category of the cost information.  For example, manufacturers' cost, patient cost, claim reimbursement cost, actual acquisition cost.",
1267            0, 1, type);
1268      case -896505829:
1269        /* source */ return new Property("source", "string",
1270            "The source or owner that assigns the price to the medication.", 0, 1, source);
1271      case 3059661:
1272        /* cost */ return new Property("cost", "Money", "The price of the medication.", 0, 1, cost);
1273      default:
1274        return super.getNamedProperty(_hash, _name, _checkValid);
1275      }
1276
1277    }
1278
1279    @Override
1280    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1281      switch (hash) {
1282      case 3575610:
1283        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
1284      case -896505829:
1285        /* source */ return this.source == null ? new Base[0] : new Base[] { this.source }; // StringType
1286      case 3059661:
1287        /* cost */ return this.cost == null ? new Base[0] : new Base[] { this.cost }; // Money
1288      default:
1289        return super.getProperty(hash, name, checkValid);
1290      }
1291
1292    }
1293
1294    @Override
1295    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1296      switch (hash) {
1297      case 3575610: // type
1298        this.type = castToCodeableConcept(value); // CodeableConcept
1299        return value;
1300      case -896505829: // source
1301        this.source = castToString(value); // StringType
1302        return value;
1303      case 3059661: // cost
1304        this.cost = castToMoney(value); // Money
1305        return value;
1306      default:
1307        return super.setProperty(hash, name, value);
1308      }
1309
1310    }
1311
1312    @Override
1313    public Base setProperty(String name, Base value) throws FHIRException {
1314      if (name.equals("type")) {
1315        this.type = castToCodeableConcept(value); // CodeableConcept
1316      } else if (name.equals("source")) {
1317        this.source = castToString(value); // StringType
1318      } else if (name.equals("cost")) {
1319        this.cost = castToMoney(value); // Money
1320      } else
1321        return super.setProperty(name, value);
1322      return value;
1323    }
1324
1325    @Override
1326    public Base makeProperty(int hash, String name) throws FHIRException {
1327      switch (hash) {
1328      case 3575610:
1329        return getType();
1330      case -896505829:
1331        return getSourceElement();
1332      case 3059661:
1333        return getCost();
1334      default:
1335        return super.makeProperty(hash, name);
1336      }
1337
1338    }
1339
1340    @Override
1341    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1342      switch (hash) {
1343      case 3575610:
1344        /* type */ return new String[] { "CodeableConcept" };
1345      case -896505829:
1346        /* source */ return new String[] { "string" };
1347      case 3059661:
1348        /* cost */ return new String[] { "Money" };
1349      default:
1350        return super.getTypesForProperty(hash, name);
1351      }
1352
1353    }
1354
1355    @Override
1356    public Base addChild(String name) throws FHIRException {
1357      if (name.equals("type")) {
1358        this.type = new CodeableConcept();
1359        return this.type;
1360      } else if (name.equals("source")) {
1361        throw new FHIRException("Cannot call addChild on a singleton property MedicationKnowledge.source");
1362      } else if (name.equals("cost")) {
1363        this.cost = new Money();
1364        return this.cost;
1365      } else
1366        return super.addChild(name);
1367    }
1368
1369    public MedicationKnowledgeCostComponent copy() {
1370      MedicationKnowledgeCostComponent dst = new MedicationKnowledgeCostComponent();
1371      copyValues(dst);
1372      return dst;
1373    }
1374
1375    public void copyValues(MedicationKnowledgeCostComponent dst) {
1376      super.copyValues(dst);
1377      dst.type = type == null ? null : type.copy();
1378      dst.source = source == null ? null : source.copy();
1379      dst.cost = cost == null ? null : cost.copy();
1380    }
1381
1382    @Override
1383    public boolean equalsDeep(Base other_) {
1384      if (!super.equalsDeep(other_))
1385        return false;
1386      if (!(other_ instanceof MedicationKnowledgeCostComponent))
1387        return false;
1388      MedicationKnowledgeCostComponent o = (MedicationKnowledgeCostComponent) other_;
1389      return compareDeep(type, o.type, true) && compareDeep(source, o.source, true) && compareDeep(cost, o.cost, true);
1390    }
1391
1392    @Override
1393    public boolean equalsShallow(Base other_) {
1394      if (!super.equalsShallow(other_))
1395        return false;
1396      if (!(other_ instanceof MedicationKnowledgeCostComponent))
1397        return false;
1398      MedicationKnowledgeCostComponent o = (MedicationKnowledgeCostComponent) other_;
1399      return compareValues(source, o.source, true);
1400    }
1401
1402    public boolean isEmpty() {
1403      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, source, cost);
1404    }
1405
1406    public String fhirType() {
1407      return "MedicationKnowledge.cost";
1408
1409    }
1410
1411  }
1412
1413  @Block()
1414  public static class MedicationKnowledgeMonitoringProgramComponent extends BackboneElement
1415      implements IBaseBackboneElement {
1416    /**
1417     * Type of program under which the medication is monitored.
1418     */
1419    @Child(name = "type", type = {
1420        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
1421    @Description(shortDefinition = "Type of program under which the medication is monitored", formalDefinition = "Type of program under which the medication is monitored.")
1422    protected CodeableConcept type;
1423
1424    /**
1425     * Name of the reviewing program.
1426     */
1427    @Child(name = "name", type = { StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1428    @Description(shortDefinition = "Name of the reviewing program", formalDefinition = "Name of the reviewing program.")
1429    protected StringType name;
1430
1431    private static final long serialVersionUID = -280346281L;
1432
1433    /**
1434     * Constructor
1435     */
1436    public MedicationKnowledgeMonitoringProgramComponent() {
1437      super();
1438    }
1439
1440    /**
1441     * @return {@link #type} (Type of program under which the medication is
1442     *         monitored.)
1443     */
1444    public CodeableConcept getType() {
1445      if (this.type == null)
1446        if (Configuration.errorOnAutoCreate())
1447          throw new Error("Attempt to auto-create MedicationKnowledgeMonitoringProgramComponent.type");
1448        else if (Configuration.doAutoCreate())
1449          this.type = new CodeableConcept(); // cc
1450      return this.type;
1451    }
1452
1453    public boolean hasType() {
1454      return this.type != null && !this.type.isEmpty();
1455    }
1456
1457    /**
1458     * @param value {@link #type} (Type of program under which the medication is
1459     *              monitored.)
1460     */
1461    public MedicationKnowledgeMonitoringProgramComponent setType(CodeableConcept value) {
1462      this.type = value;
1463      return this;
1464    }
1465
1466    /**
1467     * @return {@link #name} (Name of the reviewing program.). This is the
1468     *         underlying object with id, value and extensions. The accessor
1469     *         "getName" gives direct access to the value
1470     */
1471    public StringType getNameElement() {
1472      if (this.name == null)
1473        if (Configuration.errorOnAutoCreate())
1474          throw new Error("Attempt to auto-create MedicationKnowledgeMonitoringProgramComponent.name");
1475        else if (Configuration.doAutoCreate())
1476          this.name = new StringType(); // bb
1477      return this.name;
1478    }
1479
1480    public boolean hasNameElement() {
1481      return this.name != null && !this.name.isEmpty();
1482    }
1483
1484    public boolean hasName() {
1485      return this.name != null && !this.name.isEmpty();
1486    }
1487
1488    /**
1489     * @param value {@link #name} (Name of the reviewing program.). This is the
1490     *              underlying object with id, value and extensions. The accessor
1491     *              "getName" gives direct access to the value
1492     */
1493    public MedicationKnowledgeMonitoringProgramComponent setNameElement(StringType value) {
1494      this.name = value;
1495      return this;
1496    }
1497
1498    /**
1499     * @return Name of the reviewing program.
1500     */
1501    public String getName() {
1502      return this.name == null ? null : this.name.getValue();
1503    }
1504
1505    /**
1506     * @param value Name of the reviewing program.
1507     */
1508    public MedicationKnowledgeMonitoringProgramComponent setName(String value) {
1509      if (Utilities.noString(value))
1510        this.name = null;
1511      else {
1512        if (this.name == null)
1513          this.name = new StringType();
1514        this.name.setValue(value);
1515      }
1516      return this;
1517    }
1518
1519    protected void listChildren(List<Property> children) {
1520      super.listChildren(children);
1521      children.add(new Property("type", "CodeableConcept", "Type of program under which the medication is monitored.",
1522          0, 1, type));
1523      children.add(new Property("name", "string", "Name of the reviewing program.", 0, 1, name));
1524    }
1525
1526    @Override
1527    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1528      switch (_hash) {
1529      case 3575610:
1530        /* type */ return new Property("type", "CodeableConcept",
1531            "Type of program under which the medication is monitored.", 0, 1, type);
1532      case 3373707:
1533        /* name */ return new Property("name", "string", "Name of the reviewing program.", 0, 1, name);
1534      default:
1535        return super.getNamedProperty(_hash, _name, _checkValid);
1536      }
1537
1538    }
1539
1540    @Override
1541    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1542      switch (hash) {
1543      case 3575610:
1544        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
1545      case 3373707:
1546        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
1547      default:
1548        return super.getProperty(hash, name, checkValid);
1549      }
1550
1551    }
1552
1553    @Override
1554    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1555      switch (hash) {
1556      case 3575610: // type
1557        this.type = castToCodeableConcept(value); // CodeableConcept
1558        return value;
1559      case 3373707: // name
1560        this.name = castToString(value); // StringType
1561        return value;
1562      default:
1563        return super.setProperty(hash, name, value);
1564      }
1565
1566    }
1567
1568    @Override
1569    public Base setProperty(String name, Base value) throws FHIRException {
1570      if (name.equals("type")) {
1571        this.type = castToCodeableConcept(value); // CodeableConcept
1572      } else if (name.equals("name")) {
1573        this.name = castToString(value); // StringType
1574      } else
1575        return super.setProperty(name, value);
1576      return value;
1577    }
1578
1579    @Override
1580    public Base makeProperty(int hash, String name) throws FHIRException {
1581      switch (hash) {
1582      case 3575610:
1583        return getType();
1584      case 3373707:
1585        return getNameElement();
1586      default:
1587        return super.makeProperty(hash, name);
1588      }
1589
1590    }
1591
1592    @Override
1593    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1594      switch (hash) {
1595      case 3575610:
1596        /* type */ return new String[] { "CodeableConcept" };
1597      case 3373707:
1598        /* name */ return new String[] { "string" };
1599      default:
1600        return super.getTypesForProperty(hash, name);
1601      }
1602
1603    }
1604
1605    @Override
1606    public Base addChild(String name) throws FHIRException {
1607      if (name.equals("type")) {
1608        this.type = new CodeableConcept();
1609        return this.type;
1610      } else if (name.equals("name")) {
1611        throw new FHIRException("Cannot call addChild on a singleton property MedicationKnowledge.name");
1612      } else
1613        return super.addChild(name);
1614    }
1615
1616    public MedicationKnowledgeMonitoringProgramComponent copy() {
1617      MedicationKnowledgeMonitoringProgramComponent dst = new MedicationKnowledgeMonitoringProgramComponent();
1618      copyValues(dst);
1619      return dst;
1620    }
1621
1622    public void copyValues(MedicationKnowledgeMonitoringProgramComponent dst) {
1623      super.copyValues(dst);
1624      dst.type = type == null ? null : type.copy();
1625      dst.name = name == null ? null : name.copy();
1626    }
1627
1628    @Override
1629    public boolean equalsDeep(Base other_) {
1630      if (!super.equalsDeep(other_))
1631        return false;
1632      if (!(other_ instanceof MedicationKnowledgeMonitoringProgramComponent))
1633        return false;
1634      MedicationKnowledgeMonitoringProgramComponent o = (MedicationKnowledgeMonitoringProgramComponent) other_;
1635      return compareDeep(type, o.type, true) && compareDeep(name, o.name, true);
1636    }
1637
1638    @Override
1639    public boolean equalsShallow(Base other_) {
1640      if (!super.equalsShallow(other_))
1641        return false;
1642      if (!(other_ instanceof MedicationKnowledgeMonitoringProgramComponent))
1643        return false;
1644      MedicationKnowledgeMonitoringProgramComponent o = (MedicationKnowledgeMonitoringProgramComponent) other_;
1645      return compareValues(name, o.name, true);
1646    }
1647
1648    public boolean isEmpty() {
1649      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, name);
1650    }
1651
1652    public String fhirType() {
1653      return "MedicationKnowledge.monitoringProgram";
1654
1655    }
1656
1657  }
1658
1659  @Block()
1660  public static class MedicationKnowledgeAdministrationGuidelinesComponent extends BackboneElement
1661      implements IBaseBackboneElement {
1662    /**
1663     * Dosage for the medication for the specific guidelines.
1664     */
1665    @Child(name = "dosage", type = {}, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1666    @Description(shortDefinition = "Dosage for the medication for the specific guidelines", formalDefinition = "Dosage for the medication for the specific guidelines.")
1667    protected List<MedicationKnowledgeAdministrationGuidelinesDosageComponent> dosage;
1668
1669    /**
1670     * Indication for use that apply to the specific administration guidelines.
1671     */
1672    @Child(name = "indication", type = { CodeableConcept.class,
1673        ObservationDefinition.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1674    @Description(shortDefinition = "Indication for use that apply to the specific administration guidelines", formalDefinition = "Indication for use that apply to the specific administration guidelines.")
1675    protected Type indication;
1676
1677    /**
1678     * Characteristics of the patient that are relevant to the administration
1679     * guidelines (for example, height, weight, gender, etc.).
1680     */
1681    @Child(name = "patientCharacteristics", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1682    @Description(shortDefinition = "Characteristics of the patient that are relevant to the administration guidelines", formalDefinition = "Characteristics of the patient that are relevant to the administration guidelines (for example, height, weight, gender, etc.).")
1683    protected List<MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent> patientCharacteristics;
1684
1685    private static final long serialVersionUID = 1196999266L;
1686
1687    /**
1688     * Constructor
1689     */
1690    public MedicationKnowledgeAdministrationGuidelinesComponent() {
1691      super();
1692    }
1693
1694    /**
1695     * @return {@link #dosage} (Dosage for the medication for the specific
1696     *         guidelines.)
1697     */
1698    public List<MedicationKnowledgeAdministrationGuidelinesDosageComponent> getDosage() {
1699      if (this.dosage == null)
1700        this.dosage = new ArrayList<MedicationKnowledgeAdministrationGuidelinesDosageComponent>();
1701      return this.dosage;
1702    }
1703
1704    /**
1705     * @return Returns a reference to <code>this</code> for easy method chaining
1706     */
1707    public MedicationKnowledgeAdministrationGuidelinesComponent setDosage(
1708        List<MedicationKnowledgeAdministrationGuidelinesDosageComponent> theDosage) {
1709      this.dosage = theDosage;
1710      return this;
1711    }
1712
1713    public boolean hasDosage() {
1714      if (this.dosage == null)
1715        return false;
1716      for (MedicationKnowledgeAdministrationGuidelinesDosageComponent item : this.dosage)
1717        if (!item.isEmpty())
1718          return true;
1719      return false;
1720    }
1721
1722    public MedicationKnowledgeAdministrationGuidelinesDosageComponent addDosage() { // 3
1723      MedicationKnowledgeAdministrationGuidelinesDosageComponent t = new MedicationKnowledgeAdministrationGuidelinesDosageComponent();
1724      if (this.dosage == null)
1725        this.dosage = new ArrayList<MedicationKnowledgeAdministrationGuidelinesDosageComponent>();
1726      this.dosage.add(t);
1727      return t;
1728    }
1729
1730    public MedicationKnowledgeAdministrationGuidelinesComponent addDosage(
1731        MedicationKnowledgeAdministrationGuidelinesDosageComponent t) { // 3
1732      if (t == null)
1733        return this;
1734      if (this.dosage == null)
1735        this.dosage = new ArrayList<MedicationKnowledgeAdministrationGuidelinesDosageComponent>();
1736      this.dosage.add(t);
1737      return this;
1738    }
1739
1740    /**
1741     * @return The first repetition of repeating field {@link #dosage}, creating it
1742     *         if it does not already exist
1743     */
1744    public MedicationKnowledgeAdministrationGuidelinesDosageComponent getDosageFirstRep() {
1745      if (getDosage().isEmpty()) {
1746        addDosage();
1747      }
1748      return getDosage().get(0);
1749    }
1750
1751    /**
1752     * @return {@link #indication} (Indication for use that apply to the specific
1753     *         administration guidelines.)
1754     */
1755    public Type getIndication() {
1756      return this.indication;
1757    }
1758
1759    /**
1760     * @return {@link #indication} (Indication for use that apply to the specific
1761     *         administration guidelines.)
1762     */
1763    public CodeableConcept getIndicationCodeableConcept() throws FHIRException {
1764      if (this.indication == null)
1765        this.indication = new CodeableConcept();
1766      if (!(this.indication instanceof CodeableConcept))
1767        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
1768            + this.indication.getClass().getName() + " was encountered");
1769      return (CodeableConcept) this.indication;
1770    }
1771
1772    public boolean hasIndicationCodeableConcept() {
1773      return this != null && this.indication instanceof CodeableConcept;
1774    }
1775
1776    /**
1777     * @return {@link #indication} (Indication for use that apply to the specific
1778     *         administration guidelines.)
1779     */
1780    public Reference getIndicationReference() throws FHIRException {
1781      if (this.indication == null)
1782        this.indication = new Reference();
1783      if (!(this.indication instanceof Reference))
1784        throw new FHIRException("Type mismatch: the type Reference was expected, but "
1785            + this.indication.getClass().getName() + " was encountered");
1786      return (Reference) this.indication;
1787    }
1788
1789    public boolean hasIndicationReference() {
1790      return this != null && this.indication instanceof Reference;
1791    }
1792
1793    public boolean hasIndication() {
1794      return this.indication != null && !this.indication.isEmpty();
1795    }
1796
1797    /**
1798     * @param value {@link #indication} (Indication for use that apply to the
1799     *              specific administration guidelines.)
1800     */
1801    public MedicationKnowledgeAdministrationGuidelinesComponent setIndication(Type value) {
1802      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1803        throw new Error(
1804            "Not the right type for MedicationKnowledge.administrationGuidelines.indication[x]: " + value.fhirType());
1805      this.indication = value;
1806      return this;
1807    }
1808
1809    /**
1810     * @return {@link #patientCharacteristics} (Characteristics of the patient that
1811     *         are relevant to the administration guidelines (for example, height,
1812     *         weight, gender, etc.).)
1813     */
1814    public List<MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent> getPatientCharacteristics() {
1815      if (this.patientCharacteristics == null)
1816        this.patientCharacteristics = new ArrayList<MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent>();
1817      return this.patientCharacteristics;
1818    }
1819
1820    /**
1821     * @return Returns a reference to <code>this</code> for easy method chaining
1822     */
1823    public MedicationKnowledgeAdministrationGuidelinesComponent setPatientCharacteristics(
1824        List<MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent> thePatientCharacteristics) {
1825      this.patientCharacteristics = thePatientCharacteristics;
1826      return this;
1827    }
1828
1829    public boolean hasPatientCharacteristics() {
1830      if (this.patientCharacteristics == null)
1831        return false;
1832      for (MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent item : this.patientCharacteristics)
1833        if (!item.isEmpty())
1834          return true;
1835      return false;
1836    }
1837
1838    public MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent addPatientCharacteristics() { // 3
1839      MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent t = new MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent();
1840      if (this.patientCharacteristics == null)
1841        this.patientCharacteristics = new ArrayList<MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent>();
1842      this.patientCharacteristics.add(t);
1843      return t;
1844    }
1845
1846    public MedicationKnowledgeAdministrationGuidelinesComponent addPatientCharacteristics(
1847        MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent t) { // 3
1848      if (t == null)
1849        return this;
1850      if (this.patientCharacteristics == null)
1851        this.patientCharacteristics = new ArrayList<MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent>();
1852      this.patientCharacteristics.add(t);
1853      return this;
1854    }
1855
1856    /**
1857     * @return The first repetition of repeating field
1858     *         {@link #patientCharacteristics}, creating it if it does not already
1859     *         exist
1860     */
1861    public MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent getPatientCharacteristicsFirstRep() {
1862      if (getPatientCharacteristics().isEmpty()) {
1863        addPatientCharacteristics();
1864      }
1865      return getPatientCharacteristics().get(0);
1866    }
1867
1868    protected void listChildren(List<Property> children) {
1869      super.listChildren(children);
1870      children.add(new Property("dosage", "", "Dosage for the medication for the specific guidelines.", 0,
1871          java.lang.Integer.MAX_VALUE, dosage));
1872      children.add(new Property("indication[x]", "CodeableConcept|Reference(ObservationDefinition)",
1873          "Indication for use that apply to the specific administration guidelines.", 0, 1, indication));
1874      children.add(new Property("patientCharacteristics", "",
1875          "Characteristics of the patient that are relevant to the administration guidelines (for example, height, weight, gender, etc.).",
1876          0, java.lang.Integer.MAX_VALUE, patientCharacteristics));
1877    }
1878
1879    @Override
1880    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1881      switch (_hash) {
1882      case -1326018889:
1883        /* dosage */ return new Property("dosage", "", "Dosage for the medication for the specific guidelines.", 0,
1884            java.lang.Integer.MAX_VALUE, dosage);
1885      case -501208668:
1886        /* indication[x] */ return new Property("indication[x]", "CodeableConcept|Reference(ObservationDefinition)",
1887            "Indication for use that apply to the specific administration guidelines.", 0, 1, indication);
1888      case -597168804:
1889        /* indication */ return new Property("indication[x]", "CodeableConcept|Reference(ObservationDefinition)",
1890            "Indication for use that apply to the specific administration guidelines.", 0, 1, indication);
1891      case -1094003035:
1892        /* indicationCodeableConcept */ return new Property("indication[x]",
1893            "CodeableConcept|Reference(ObservationDefinition)",
1894            "Indication for use that apply to the specific administration guidelines.", 0, 1, indication);
1895      case 803518799:
1896        /* indicationReference */ return new Property("indication[x]",
1897            "CodeableConcept|Reference(ObservationDefinition)",
1898            "Indication for use that apply to the specific administration guidelines.", 0, 1, indication);
1899      case -960531341:
1900        /* patientCharacteristics */ return new Property("patientCharacteristics", "",
1901            "Characteristics of the patient that are relevant to the administration guidelines (for example, height, weight, gender, etc.).",
1902            0, java.lang.Integer.MAX_VALUE, patientCharacteristics);
1903      default:
1904        return super.getNamedProperty(_hash, _name, _checkValid);
1905      }
1906
1907    }
1908
1909    @Override
1910    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1911      switch (hash) {
1912      case -1326018889:
1913        /* dosage */ return this.dosage == null ? new Base[0] : this.dosage.toArray(new Base[this.dosage.size()]); // MedicationKnowledgeAdministrationGuidelinesDosageComponent
1914      case -597168804:
1915        /* indication */ return this.indication == null ? new Base[0] : new Base[] { this.indication }; // Type
1916      case -960531341:
1917        /* patientCharacteristics */ return this.patientCharacteristics == null ? new Base[0]
1918            : this.patientCharacteristics.toArray(new Base[this.patientCharacteristics.size()]); // MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent
1919      default:
1920        return super.getProperty(hash, name, checkValid);
1921      }
1922
1923    }
1924
1925    @Override
1926    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1927      switch (hash) {
1928      case -1326018889: // dosage
1929        this.getDosage().add((MedicationKnowledgeAdministrationGuidelinesDosageComponent) value); // MedicationKnowledgeAdministrationGuidelinesDosageComponent
1930        return value;
1931      case -597168804: // indication
1932        this.indication = castToType(value); // Type
1933        return value;
1934      case -960531341: // patientCharacteristics
1935        this.getPatientCharacteristics()
1936            .add((MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent) value); // MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent
1937        return value;
1938      default:
1939        return super.setProperty(hash, name, value);
1940      }
1941
1942    }
1943
1944    @Override
1945    public Base setProperty(String name, Base value) throws FHIRException {
1946      if (name.equals("dosage")) {
1947        this.getDosage().add((MedicationKnowledgeAdministrationGuidelinesDosageComponent) value);
1948      } else if (name.equals("indication[x]")) {
1949        this.indication = castToType(value); // Type
1950      } else if (name.equals("patientCharacteristics")) {
1951        this.getPatientCharacteristics()
1952            .add((MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent) value);
1953      } else
1954        return super.setProperty(name, value);
1955      return value;
1956    }
1957
1958    @Override
1959    public Base makeProperty(int hash, String name) throws FHIRException {
1960      switch (hash) {
1961      case -1326018889:
1962        return addDosage();
1963      case -501208668:
1964        return getIndication();
1965      case -597168804:
1966        return getIndication();
1967      case -960531341:
1968        return addPatientCharacteristics();
1969      default:
1970        return super.makeProperty(hash, name);
1971      }
1972
1973    }
1974
1975    @Override
1976    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1977      switch (hash) {
1978      case -1326018889:
1979        /* dosage */ return new String[] {};
1980      case -597168804:
1981        /* indication */ return new String[] { "CodeableConcept", "Reference" };
1982      case -960531341:
1983        /* patientCharacteristics */ return new String[] {};
1984      default:
1985        return super.getTypesForProperty(hash, name);
1986      }
1987
1988    }
1989
1990    @Override
1991    public Base addChild(String name) throws FHIRException {
1992      if (name.equals("dosage")) {
1993        return addDosage();
1994      } else if (name.equals("indicationCodeableConcept")) {
1995        this.indication = new CodeableConcept();
1996        return this.indication;
1997      } else if (name.equals("indicationReference")) {
1998        this.indication = new Reference();
1999        return this.indication;
2000      } else if (name.equals("patientCharacteristics")) {
2001        return addPatientCharacteristics();
2002      } else
2003        return super.addChild(name);
2004    }
2005
2006    public MedicationKnowledgeAdministrationGuidelinesComponent copy() {
2007      MedicationKnowledgeAdministrationGuidelinesComponent dst = new MedicationKnowledgeAdministrationGuidelinesComponent();
2008      copyValues(dst);
2009      return dst;
2010    }
2011
2012    public void copyValues(MedicationKnowledgeAdministrationGuidelinesComponent dst) {
2013      super.copyValues(dst);
2014      if (dosage != null) {
2015        dst.dosage = new ArrayList<MedicationKnowledgeAdministrationGuidelinesDosageComponent>();
2016        for (MedicationKnowledgeAdministrationGuidelinesDosageComponent i : dosage)
2017          dst.dosage.add(i.copy());
2018      }
2019      ;
2020      dst.indication = indication == null ? null : indication.copy();
2021      if (patientCharacteristics != null) {
2022        dst.patientCharacteristics = new ArrayList<MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent>();
2023        for (MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent i : patientCharacteristics)
2024          dst.patientCharacteristics.add(i.copy());
2025      }
2026      ;
2027    }
2028
2029    @Override
2030    public boolean equalsDeep(Base other_) {
2031      if (!super.equalsDeep(other_))
2032        return false;
2033      if (!(other_ instanceof MedicationKnowledgeAdministrationGuidelinesComponent))
2034        return false;
2035      MedicationKnowledgeAdministrationGuidelinesComponent o = (MedicationKnowledgeAdministrationGuidelinesComponent) other_;
2036      return compareDeep(dosage, o.dosage, true) && compareDeep(indication, o.indication, true)
2037          && compareDeep(patientCharacteristics, o.patientCharacteristics, true);
2038    }
2039
2040    @Override
2041    public boolean equalsShallow(Base other_) {
2042      if (!super.equalsShallow(other_))
2043        return false;
2044      if (!(other_ instanceof MedicationKnowledgeAdministrationGuidelinesComponent))
2045        return false;
2046      MedicationKnowledgeAdministrationGuidelinesComponent o = (MedicationKnowledgeAdministrationGuidelinesComponent) other_;
2047      return true;
2048    }
2049
2050    public boolean isEmpty() {
2051      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(dosage, indication, patientCharacteristics);
2052    }
2053
2054    public String fhirType() {
2055      return "MedicationKnowledge.administrationGuidelines";
2056
2057    }
2058
2059  }
2060
2061  @Block()
2062  public static class MedicationKnowledgeAdministrationGuidelinesDosageComponent extends BackboneElement
2063      implements IBaseBackboneElement {
2064    /**
2065     * The type of dosage (for example, prophylaxis, maintenance, therapeutic,
2066     * etc.).
2067     */
2068    @Child(name = "type", type = {
2069        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2070    @Description(shortDefinition = "Type of dosage", formalDefinition = "The type of dosage (for example, prophylaxis, maintenance, therapeutic, etc.).")
2071    protected CodeableConcept type;
2072
2073    /**
2074     * Dosage for the medication for the specific guidelines.
2075     */
2076    @Child(name = "dosage", type = {
2077        Dosage.class }, order = 2, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2078    @Description(shortDefinition = "Dosage for the medication for the specific guidelines", formalDefinition = "Dosage for the medication for the specific guidelines.")
2079    protected List<Dosage> dosage;
2080
2081    private static final long serialVersionUID = 1578257961L;
2082
2083    /**
2084     * Constructor
2085     */
2086    public MedicationKnowledgeAdministrationGuidelinesDosageComponent() {
2087      super();
2088    }
2089
2090    /**
2091     * Constructor
2092     */
2093    public MedicationKnowledgeAdministrationGuidelinesDosageComponent(CodeableConcept type) {
2094      super();
2095      this.type = type;
2096    }
2097
2098    /**
2099     * @return {@link #type} (The type of dosage (for example, prophylaxis,
2100     *         maintenance, therapeutic, etc.).)
2101     */
2102    public CodeableConcept getType() {
2103      if (this.type == null)
2104        if (Configuration.errorOnAutoCreate())
2105          throw new Error("Attempt to auto-create MedicationKnowledgeAdministrationGuidelinesDosageComponent.type");
2106        else if (Configuration.doAutoCreate())
2107          this.type = new CodeableConcept(); // cc
2108      return this.type;
2109    }
2110
2111    public boolean hasType() {
2112      return this.type != null && !this.type.isEmpty();
2113    }
2114
2115    /**
2116     * @param value {@link #type} (The type of dosage (for example, prophylaxis,
2117     *              maintenance, therapeutic, etc.).)
2118     */
2119    public MedicationKnowledgeAdministrationGuidelinesDosageComponent setType(CodeableConcept value) {
2120      this.type = value;
2121      return this;
2122    }
2123
2124    /**
2125     * @return {@link #dosage} (Dosage for the medication for the specific
2126     *         guidelines.)
2127     */
2128    public List<Dosage> getDosage() {
2129      if (this.dosage == null)
2130        this.dosage = new ArrayList<Dosage>();
2131      return this.dosage;
2132    }
2133
2134    /**
2135     * @return Returns a reference to <code>this</code> for easy method chaining
2136     */
2137    public MedicationKnowledgeAdministrationGuidelinesDosageComponent setDosage(List<Dosage> theDosage) {
2138      this.dosage = theDosage;
2139      return this;
2140    }
2141
2142    public boolean hasDosage() {
2143      if (this.dosage == null)
2144        return false;
2145      for (Dosage item : this.dosage)
2146        if (!item.isEmpty())
2147          return true;
2148      return false;
2149    }
2150
2151    public Dosage addDosage() { // 3
2152      Dosage t = new Dosage();
2153      if (this.dosage == null)
2154        this.dosage = new ArrayList<Dosage>();
2155      this.dosage.add(t);
2156      return t;
2157    }
2158
2159    public MedicationKnowledgeAdministrationGuidelinesDosageComponent addDosage(Dosage t) { // 3
2160      if (t == null)
2161        return this;
2162      if (this.dosage == null)
2163        this.dosage = new ArrayList<Dosage>();
2164      this.dosage.add(t);
2165      return this;
2166    }
2167
2168    /**
2169     * @return The first repetition of repeating field {@link #dosage}, creating it
2170     *         if it does not already exist
2171     */
2172    public Dosage getDosageFirstRep() {
2173      if (getDosage().isEmpty()) {
2174        addDosage();
2175      }
2176      return getDosage().get(0);
2177    }
2178
2179    protected void listChildren(List<Property> children) {
2180      super.listChildren(children);
2181      children.add(new Property("type", "CodeableConcept",
2182          "The type of dosage (for example, prophylaxis, maintenance, therapeutic, etc.).", 0, 1, type));
2183      children.add(new Property("dosage", "Dosage", "Dosage for the medication for the specific guidelines.", 0,
2184          java.lang.Integer.MAX_VALUE, dosage));
2185    }
2186
2187    @Override
2188    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2189      switch (_hash) {
2190      case 3575610:
2191        /* type */ return new Property("type", "CodeableConcept",
2192            "The type of dosage (for example, prophylaxis, maintenance, therapeutic, etc.).", 0, 1, type);
2193      case -1326018889:
2194        /* dosage */ return new Property("dosage", "Dosage", "Dosage for the medication for the specific guidelines.",
2195            0, java.lang.Integer.MAX_VALUE, dosage);
2196      default:
2197        return super.getNamedProperty(_hash, _name, _checkValid);
2198      }
2199
2200    }
2201
2202    @Override
2203    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2204      switch (hash) {
2205      case 3575610:
2206        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
2207      case -1326018889:
2208        /* dosage */ return this.dosage == null ? new Base[0] : this.dosage.toArray(new Base[this.dosage.size()]); // Dosage
2209      default:
2210        return super.getProperty(hash, name, checkValid);
2211      }
2212
2213    }
2214
2215    @Override
2216    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2217      switch (hash) {
2218      case 3575610: // type
2219        this.type = castToCodeableConcept(value); // CodeableConcept
2220        return value;
2221      case -1326018889: // dosage
2222        this.getDosage().add(castToDosage(value)); // Dosage
2223        return value;
2224      default:
2225        return super.setProperty(hash, name, value);
2226      }
2227
2228    }
2229
2230    @Override
2231    public Base setProperty(String name, Base value) throws FHIRException {
2232      if (name.equals("type")) {
2233        this.type = castToCodeableConcept(value); // CodeableConcept
2234      } else if (name.equals("dosage")) {
2235        this.getDosage().add(castToDosage(value));
2236      } else
2237        return super.setProperty(name, value);
2238      return value;
2239    }
2240
2241    @Override
2242    public Base makeProperty(int hash, String name) throws FHIRException {
2243      switch (hash) {
2244      case 3575610:
2245        return getType();
2246      case -1326018889:
2247        return addDosage();
2248      default:
2249        return super.makeProperty(hash, name);
2250      }
2251
2252    }
2253
2254    @Override
2255    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2256      switch (hash) {
2257      case 3575610:
2258        /* type */ return new String[] { "CodeableConcept" };
2259      case -1326018889:
2260        /* dosage */ return new String[] { "Dosage" };
2261      default:
2262        return super.getTypesForProperty(hash, name);
2263      }
2264
2265    }
2266
2267    @Override
2268    public Base addChild(String name) throws FHIRException {
2269      if (name.equals("type")) {
2270        this.type = new CodeableConcept();
2271        return this.type;
2272      } else if (name.equals("dosage")) {
2273        return addDosage();
2274      } else
2275        return super.addChild(name);
2276    }
2277
2278    public MedicationKnowledgeAdministrationGuidelinesDosageComponent copy() {
2279      MedicationKnowledgeAdministrationGuidelinesDosageComponent dst = new MedicationKnowledgeAdministrationGuidelinesDosageComponent();
2280      copyValues(dst);
2281      return dst;
2282    }
2283
2284    public void copyValues(MedicationKnowledgeAdministrationGuidelinesDosageComponent dst) {
2285      super.copyValues(dst);
2286      dst.type = type == null ? null : type.copy();
2287      if (dosage != null) {
2288        dst.dosage = new ArrayList<Dosage>();
2289        for (Dosage i : dosage)
2290          dst.dosage.add(i.copy());
2291      }
2292      ;
2293    }
2294
2295    @Override
2296    public boolean equalsDeep(Base other_) {
2297      if (!super.equalsDeep(other_))
2298        return false;
2299      if (!(other_ instanceof MedicationKnowledgeAdministrationGuidelinesDosageComponent))
2300        return false;
2301      MedicationKnowledgeAdministrationGuidelinesDosageComponent o = (MedicationKnowledgeAdministrationGuidelinesDosageComponent) other_;
2302      return compareDeep(type, o.type, true) && compareDeep(dosage, o.dosage, true);
2303    }
2304
2305    @Override
2306    public boolean equalsShallow(Base other_) {
2307      if (!super.equalsShallow(other_))
2308        return false;
2309      if (!(other_ instanceof MedicationKnowledgeAdministrationGuidelinesDosageComponent))
2310        return false;
2311      MedicationKnowledgeAdministrationGuidelinesDosageComponent o = (MedicationKnowledgeAdministrationGuidelinesDosageComponent) other_;
2312      return true;
2313    }
2314
2315    public boolean isEmpty() {
2316      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, dosage);
2317    }
2318
2319    public String fhirType() {
2320      return "MedicationKnowledge.administrationGuidelines.dosage";
2321
2322    }
2323
2324  }
2325
2326  @Block()
2327  public static class MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent extends BackboneElement
2328      implements IBaseBackboneElement {
2329    /**
2330     * Specific characteristic that is relevant to the administration guideline
2331     * (e.g. height, weight, gender).
2332     */
2333    @Child(name = "characteristic", type = { CodeableConcept.class,
2334        Quantity.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2335    @Description(shortDefinition = "Specific characteristic that is relevant to the administration guideline", formalDefinition = "Specific characteristic that is relevant to the administration guideline (e.g. height, weight, gender).")
2336    protected Type characteristic;
2337
2338    /**
2339     * The specific characteristic (e.g. height, weight, gender, etc.).
2340     */
2341    @Child(name = "value", type = {
2342        StringType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2343    @Description(shortDefinition = "The specific characteristic", formalDefinition = "The specific characteristic (e.g. height, weight, gender, etc.).")
2344    protected List<StringType> value;
2345
2346    private static final long serialVersionUID = -133608297L;
2347
2348    /**
2349     * Constructor
2350     */
2351    public MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent() {
2352      super();
2353    }
2354
2355    /**
2356     * Constructor
2357     */
2358    public MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(Type characteristic) {
2359      super();
2360      this.characteristic = characteristic;
2361    }
2362
2363    /**
2364     * @return {@link #characteristic} (Specific characteristic that is relevant to
2365     *         the administration guideline (e.g. height, weight, gender).)
2366     */
2367    public Type getCharacteristic() {
2368      return this.characteristic;
2369    }
2370
2371    /**
2372     * @return {@link #characteristic} (Specific characteristic that is relevant to
2373     *         the administration guideline (e.g. height, weight, gender).)
2374     */
2375    public CodeableConcept getCharacteristicCodeableConcept() throws FHIRException {
2376      if (this.characteristic == null)
2377        this.characteristic = new CodeableConcept();
2378      if (!(this.characteristic instanceof CodeableConcept))
2379        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2380            + this.characteristic.getClass().getName() + " was encountered");
2381      return (CodeableConcept) this.characteristic;
2382    }
2383
2384    public boolean hasCharacteristicCodeableConcept() {
2385      return this != null && this.characteristic instanceof CodeableConcept;
2386    }
2387
2388    /**
2389     * @return {@link #characteristic} (Specific characteristic that is relevant to
2390     *         the administration guideline (e.g. height, weight, gender).)
2391     */
2392    public Quantity getCharacteristicQuantity() throws FHIRException {
2393      if (this.characteristic == null)
2394        this.characteristic = new Quantity();
2395      if (!(this.characteristic instanceof Quantity))
2396        throw new FHIRException("Type mismatch: the type Quantity was expected, but "
2397            + this.characteristic.getClass().getName() + " was encountered");
2398      return (Quantity) this.characteristic;
2399    }
2400
2401    public boolean hasCharacteristicQuantity() {
2402      return this != null && this.characteristic instanceof Quantity;
2403    }
2404
2405    public boolean hasCharacteristic() {
2406      return this.characteristic != null && !this.characteristic.isEmpty();
2407    }
2408
2409    /**
2410     * @param value {@link #characteristic} (Specific characteristic that is
2411     *              relevant to the administration guideline (e.g. height, weight,
2412     *              gender).)
2413     */
2414    public MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent setCharacteristic(Type value) {
2415      if (value != null && !(value instanceof CodeableConcept || value instanceof Quantity))
2416        throw new Error(
2417            "Not the right type for MedicationKnowledge.administrationGuidelines.patientCharacteristics.characteristic[x]: "
2418                + value.fhirType());
2419      this.characteristic = value;
2420      return this;
2421    }
2422
2423    /**
2424     * @return {@link #value} (The specific characteristic (e.g. height, weight,
2425     *         gender, etc.).)
2426     */
2427    public List<StringType> getValue() {
2428      if (this.value == null)
2429        this.value = new ArrayList<StringType>();
2430      return this.value;
2431    }
2432
2433    /**
2434     * @return Returns a reference to <code>this</code> for easy method chaining
2435     */
2436    public MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent setValue(
2437        List<StringType> theValue) {
2438      this.value = theValue;
2439      return this;
2440    }
2441
2442    public boolean hasValue() {
2443      if (this.value == null)
2444        return false;
2445      for (StringType item : this.value)
2446        if (!item.isEmpty())
2447          return true;
2448      return false;
2449    }
2450
2451    /**
2452     * @return {@link #value} (The specific characteristic (e.g. height, weight,
2453     *         gender, etc.).)
2454     */
2455    public StringType addValueElement() {// 2
2456      StringType t = new StringType();
2457      if (this.value == null)
2458        this.value = new ArrayList<StringType>();
2459      this.value.add(t);
2460      return t;
2461    }
2462
2463    /**
2464     * @param value {@link #value} (The specific characteristic (e.g. height,
2465     *              weight, gender, etc.).)
2466     */
2467    public MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent addValue(String value) { // 1
2468      StringType t = new StringType();
2469      t.setValue(value);
2470      if (this.value == null)
2471        this.value = new ArrayList<StringType>();
2472      this.value.add(t);
2473      return this;
2474    }
2475
2476    /**
2477     * @param value {@link #value} (The specific characteristic (e.g. height,
2478     *              weight, gender, etc.).)
2479     */
2480    public boolean hasValue(String value) {
2481      if (this.value == null)
2482        return false;
2483      for (StringType v : this.value)
2484        if (v.getValue().equals(value)) // string
2485          return true;
2486      return false;
2487    }
2488
2489    protected void listChildren(List<Property> children) {
2490      super.listChildren(children);
2491      children.add(new Property("characteristic[x]", "CodeableConcept|SimpleQuantity",
2492          "Specific characteristic that is relevant to the administration guideline (e.g. height, weight, gender).", 0,
2493          1, characteristic));
2494      children.add(new Property("value", "string", "The specific characteristic (e.g. height, weight, gender, etc.).",
2495          0, java.lang.Integer.MAX_VALUE, value));
2496    }
2497
2498    @Override
2499    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2500      switch (_hash) {
2501      case -654919419:
2502        /* characteristic[x] */ return new Property("characteristic[x]", "CodeableConcept|SimpleQuantity",
2503            "Specific characteristic that is relevant to the administration guideline (e.g. height, weight, gender).",
2504            0, 1, characteristic);
2505      case 366313883:
2506        /* characteristic */ return new Property("characteristic[x]", "CodeableConcept|SimpleQuantity",
2507            "Specific characteristic that is relevant to the administration guideline (e.g. height, weight, gender).",
2508            0, 1, characteristic);
2509      case -1259840378:
2510        /* characteristicCodeableConcept */ return new Property("characteristic[x]", "CodeableConcept|SimpleQuantity",
2511            "Specific characteristic that is relevant to the administration guideline (e.g. height, weight, gender).",
2512            0, 1, characteristic);
2513      case 1769373510:
2514        /* characteristicQuantity */ return new Property("characteristic[x]", "CodeableConcept|SimpleQuantity",
2515            "Specific characteristic that is relevant to the administration guideline (e.g. height, weight, gender).",
2516            0, 1, characteristic);
2517      case 111972721:
2518        /* value */ return new Property("value", "string",
2519            "The specific characteristic (e.g. height, weight, gender, etc.).", 0, java.lang.Integer.MAX_VALUE, value);
2520      default:
2521        return super.getNamedProperty(_hash, _name, _checkValid);
2522      }
2523
2524    }
2525
2526    @Override
2527    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2528      switch (hash) {
2529      case 366313883:
2530        /* characteristic */ return this.characteristic == null ? new Base[0] : new Base[] { this.characteristic }; // Type
2531      case 111972721:
2532        /* value */ return this.value == null ? new Base[0] : this.value.toArray(new Base[this.value.size()]); // StringType
2533      default:
2534        return super.getProperty(hash, name, checkValid);
2535      }
2536
2537    }
2538
2539    @Override
2540    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2541      switch (hash) {
2542      case 366313883: // characteristic
2543        this.characteristic = castToType(value); // Type
2544        return value;
2545      case 111972721: // value
2546        this.getValue().add(castToString(value)); // StringType
2547        return value;
2548      default:
2549        return super.setProperty(hash, name, value);
2550      }
2551
2552    }
2553
2554    @Override
2555    public Base setProperty(String name, Base value) throws FHIRException {
2556      if (name.equals("characteristic[x]")) {
2557        this.characteristic = castToType(value); // Type
2558      } else if (name.equals("value")) {
2559        this.getValue().add(castToString(value));
2560      } else
2561        return super.setProperty(name, value);
2562      return value;
2563    }
2564
2565    @Override
2566    public Base makeProperty(int hash, String name) throws FHIRException {
2567      switch (hash) {
2568      case -654919419:
2569        return getCharacteristic();
2570      case 366313883:
2571        return getCharacteristic();
2572      case 111972721:
2573        return addValueElement();
2574      default:
2575        return super.makeProperty(hash, name);
2576      }
2577
2578    }
2579
2580    @Override
2581    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2582      switch (hash) {
2583      case 366313883:
2584        /* characteristic */ return new String[] { "CodeableConcept", "SimpleQuantity" };
2585      case 111972721:
2586        /* value */ return new String[] { "string" };
2587      default:
2588        return super.getTypesForProperty(hash, name);
2589      }
2590
2591    }
2592
2593    @Override
2594    public Base addChild(String name) throws FHIRException {
2595      if (name.equals("characteristicCodeableConcept")) {
2596        this.characteristic = new CodeableConcept();
2597        return this.characteristic;
2598      } else if (name.equals("characteristicQuantity")) {
2599        this.characteristic = new Quantity();
2600        return this.characteristic;
2601      } else if (name.equals("value")) {
2602        throw new FHIRException("Cannot call addChild on a singleton property MedicationKnowledge.value");
2603      } else
2604        return super.addChild(name);
2605    }
2606
2607    public MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent copy() {
2608      MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent dst = new MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent();
2609      copyValues(dst);
2610      return dst;
2611    }
2612
2613    public void copyValues(MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent dst) {
2614      super.copyValues(dst);
2615      dst.characteristic = characteristic == null ? null : characteristic.copy();
2616      if (value != null) {
2617        dst.value = new ArrayList<StringType>();
2618        for (StringType i : value)
2619          dst.value.add(i.copy());
2620      }
2621      ;
2622    }
2623
2624    @Override
2625    public boolean equalsDeep(Base other_) {
2626      if (!super.equalsDeep(other_))
2627        return false;
2628      if (!(other_ instanceof MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent))
2629        return false;
2630      MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent o = (MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent) other_;
2631      return compareDeep(characteristic, o.characteristic, true) && compareDeep(value, o.value, true);
2632    }
2633
2634    @Override
2635    public boolean equalsShallow(Base other_) {
2636      if (!super.equalsShallow(other_))
2637        return false;
2638      if (!(other_ instanceof MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent))
2639        return false;
2640      MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent o = (MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent) other_;
2641      return compareValues(value, o.value, true);
2642    }
2643
2644    public boolean isEmpty() {
2645      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(characteristic, value);
2646    }
2647
2648    public String fhirType() {
2649      return "MedicationKnowledge.administrationGuidelines.patientCharacteristics";
2650
2651    }
2652
2653  }
2654
2655  @Block()
2656  public static class MedicationKnowledgeMedicineClassificationComponent extends BackboneElement
2657      implements IBaseBackboneElement {
2658    /**
2659     * The type of category for the medication (for example, therapeutic
2660     * classification, therapeutic sub-classification).
2661     */
2662    @Child(name = "type", type = {
2663        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
2664    @Description(shortDefinition = "The type of category for the medication (for example, therapeutic classification, therapeutic sub-classification)", formalDefinition = "The type of category for the medication (for example, therapeutic classification, therapeutic sub-classification).")
2665    protected CodeableConcept type;
2666
2667    /**
2668     * Specific category assigned to the medication (e.g. anti-infective,
2669     * anti-hypertensive, antibiotic, etc.).
2670     */
2671    @Child(name = "classification", type = {
2672        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2673    @Description(shortDefinition = "Specific category assigned to the medication", formalDefinition = "Specific category assigned to the medication (e.g. anti-infective, anti-hypertensive, antibiotic, etc.).")
2674    protected List<CodeableConcept> classification;
2675
2676    private static final long serialVersionUID = 1562996046L;
2677
2678    /**
2679     * Constructor
2680     */
2681    public MedicationKnowledgeMedicineClassificationComponent() {
2682      super();
2683    }
2684
2685    /**
2686     * Constructor
2687     */
2688    public MedicationKnowledgeMedicineClassificationComponent(CodeableConcept type) {
2689      super();
2690      this.type = type;
2691    }
2692
2693    /**
2694     * @return {@link #type} (The type of category for the medication (for example,
2695     *         therapeutic classification, therapeutic sub-classification).)
2696     */
2697    public CodeableConcept getType() {
2698      if (this.type == null)
2699        if (Configuration.errorOnAutoCreate())
2700          throw new Error("Attempt to auto-create MedicationKnowledgeMedicineClassificationComponent.type");
2701        else if (Configuration.doAutoCreate())
2702          this.type = new CodeableConcept(); // cc
2703      return this.type;
2704    }
2705
2706    public boolean hasType() {
2707      return this.type != null && !this.type.isEmpty();
2708    }
2709
2710    /**
2711     * @param value {@link #type} (The type of category for the medication (for
2712     *              example, therapeutic classification, therapeutic
2713     *              sub-classification).)
2714     */
2715    public MedicationKnowledgeMedicineClassificationComponent setType(CodeableConcept value) {
2716      this.type = value;
2717      return this;
2718    }
2719
2720    /**
2721     * @return {@link #classification} (Specific category assigned to the medication
2722     *         (e.g. anti-infective, anti-hypertensive, antibiotic, etc.).)
2723     */
2724    public List<CodeableConcept> getClassification() {
2725      if (this.classification == null)
2726        this.classification = new ArrayList<CodeableConcept>();
2727      return this.classification;
2728    }
2729
2730    /**
2731     * @return Returns a reference to <code>this</code> for easy method chaining
2732     */
2733    public MedicationKnowledgeMedicineClassificationComponent setClassification(
2734        List<CodeableConcept> theClassification) {
2735      this.classification = theClassification;
2736      return this;
2737    }
2738
2739    public boolean hasClassification() {
2740      if (this.classification == null)
2741        return false;
2742      for (CodeableConcept item : this.classification)
2743        if (!item.isEmpty())
2744          return true;
2745      return false;
2746    }
2747
2748    public CodeableConcept addClassification() { // 3
2749      CodeableConcept t = new CodeableConcept();
2750      if (this.classification == null)
2751        this.classification = new ArrayList<CodeableConcept>();
2752      this.classification.add(t);
2753      return t;
2754    }
2755
2756    public MedicationKnowledgeMedicineClassificationComponent addClassification(CodeableConcept t) { // 3
2757      if (t == null)
2758        return this;
2759      if (this.classification == null)
2760        this.classification = new ArrayList<CodeableConcept>();
2761      this.classification.add(t);
2762      return this;
2763    }
2764
2765    /**
2766     * @return The first repetition of repeating field {@link #classification},
2767     *         creating it if it does not already exist
2768     */
2769    public CodeableConcept getClassificationFirstRep() {
2770      if (getClassification().isEmpty()) {
2771        addClassification();
2772      }
2773      return getClassification().get(0);
2774    }
2775
2776    protected void listChildren(List<Property> children) {
2777      super.listChildren(children);
2778      children.add(new Property("type", "CodeableConcept",
2779          "The type of category for the medication (for example, therapeutic classification, therapeutic sub-classification).",
2780          0, 1, type));
2781      children.add(new Property("classification", "CodeableConcept",
2782          "Specific category assigned to the medication (e.g. anti-infective, anti-hypertensive, antibiotic, etc.).", 0,
2783          java.lang.Integer.MAX_VALUE, classification));
2784    }
2785
2786    @Override
2787    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2788      switch (_hash) {
2789      case 3575610:
2790        /* type */ return new Property("type", "CodeableConcept",
2791            "The type of category for the medication (for example, therapeutic classification, therapeutic sub-classification).",
2792            0, 1, type);
2793      case 382350310:
2794        /* classification */ return new Property("classification", "CodeableConcept",
2795            "Specific category assigned to the medication (e.g. anti-infective, anti-hypertensive, antibiotic, etc.).",
2796            0, java.lang.Integer.MAX_VALUE, classification);
2797      default:
2798        return super.getNamedProperty(_hash, _name, _checkValid);
2799      }
2800
2801    }
2802
2803    @Override
2804    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2805      switch (hash) {
2806      case 3575610:
2807        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
2808      case 382350310:
2809        /* classification */ return this.classification == null ? new Base[0]
2810            : this.classification.toArray(new Base[this.classification.size()]); // CodeableConcept
2811      default:
2812        return super.getProperty(hash, name, checkValid);
2813      }
2814
2815    }
2816
2817    @Override
2818    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2819      switch (hash) {
2820      case 3575610: // type
2821        this.type = castToCodeableConcept(value); // CodeableConcept
2822        return value;
2823      case 382350310: // classification
2824        this.getClassification().add(castToCodeableConcept(value)); // CodeableConcept
2825        return value;
2826      default:
2827        return super.setProperty(hash, name, value);
2828      }
2829
2830    }
2831
2832    @Override
2833    public Base setProperty(String name, Base value) throws FHIRException {
2834      if (name.equals("type")) {
2835        this.type = castToCodeableConcept(value); // CodeableConcept
2836      } else if (name.equals("classification")) {
2837        this.getClassification().add(castToCodeableConcept(value));
2838      } else
2839        return super.setProperty(name, value);
2840      return value;
2841    }
2842
2843    @Override
2844    public Base makeProperty(int hash, String name) throws FHIRException {
2845      switch (hash) {
2846      case 3575610:
2847        return getType();
2848      case 382350310:
2849        return addClassification();
2850      default:
2851        return super.makeProperty(hash, name);
2852      }
2853
2854    }
2855
2856    @Override
2857    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2858      switch (hash) {
2859      case 3575610:
2860        /* type */ return new String[] { "CodeableConcept" };
2861      case 382350310:
2862        /* classification */ return new String[] { "CodeableConcept" };
2863      default:
2864        return super.getTypesForProperty(hash, name);
2865      }
2866
2867    }
2868
2869    @Override
2870    public Base addChild(String name) throws FHIRException {
2871      if (name.equals("type")) {
2872        this.type = new CodeableConcept();
2873        return this.type;
2874      } else if (name.equals("classification")) {
2875        return addClassification();
2876      } else
2877        return super.addChild(name);
2878    }
2879
2880    public MedicationKnowledgeMedicineClassificationComponent copy() {
2881      MedicationKnowledgeMedicineClassificationComponent dst = new MedicationKnowledgeMedicineClassificationComponent();
2882      copyValues(dst);
2883      return dst;
2884    }
2885
2886    public void copyValues(MedicationKnowledgeMedicineClassificationComponent dst) {
2887      super.copyValues(dst);
2888      dst.type = type == null ? null : type.copy();
2889      if (classification != null) {
2890        dst.classification = new ArrayList<CodeableConcept>();
2891        for (CodeableConcept i : classification)
2892          dst.classification.add(i.copy());
2893      }
2894      ;
2895    }
2896
2897    @Override
2898    public boolean equalsDeep(Base other_) {
2899      if (!super.equalsDeep(other_))
2900        return false;
2901      if (!(other_ instanceof MedicationKnowledgeMedicineClassificationComponent))
2902        return false;
2903      MedicationKnowledgeMedicineClassificationComponent o = (MedicationKnowledgeMedicineClassificationComponent) other_;
2904      return compareDeep(type, o.type, true) && compareDeep(classification, o.classification, true);
2905    }
2906
2907    @Override
2908    public boolean equalsShallow(Base other_) {
2909      if (!super.equalsShallow(other_))
2910        return false;
2911      if (!(other_ instanceof MedicationKnowledgeMedicineClassificationComponent))
2912        return false;
2913      MedicationKnowledgeMedicineClassificationComponent o = (MedicationKnowledgeMedicineClassificationComponent) other_;
2914      return true;
2915    }
2916
2917    public boolean isEmpty() {
2918      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, classification);
2919    }
2920
2921    public String fhirType() {
2922      return "MedicationKnowledge.medicineClassification";
2923
2924    }
2925
2926  }
2927
2928  @Block()
2929  public static class MedicationKnowledgePackagingComponent extends BackboneElement implements IBaseBackboneElement {
2930    /**
2931     * A code that defines the specific type of packaging that the medication can be
2932     * found in (e.g. blister sleeve, tube, bottle).
2933     */
2934    @Child(name = "type", type = {
2935        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
2936    @Description(shortDefinition = "A code that defines the specific type of packaging that the medication can be found in", formalDefinition = "A code that defines the specific type of packaging that the medication can be found in (e.g. blister sleeve, tube, bottle).")
2937    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medicationknowledge-package-type")
2938    protected CodeableConcept type;
2939
2940    /**
2941     * The number of product units the package would contain if fully loaded.
2942     */
2943    @Child(name = "quantity", type = { Quantity.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
2944    @Description(shortDefinition = "The number of product units the package would contain if fully loaded", formalDefinition = "The number of product units the package would contain if fully loaded.")
2945    protected Quantity quantity;
2946
2947    private static final long serialVersionUID = -308052041L;
2948
2949    /**
2950     * Constructor
2951     */
2952    public MedicationKnowledgePackagingComponent() {
2953      super();
2954    }
2955
2956    /**
2957     * @return {@link #type} (A code that defines the specific type of packaging
2958     *         that the medication can be found in (e.g. blister sleeve, tube,
2959     *         bottle).)
2960     */
2961    public CodeableConcept getType() {
2962      if (this.type == null)
2963        if (Configuration.errorOnAutoCreate())
2964          throw new Error("Attempt to auto-create MedicationKnowledgePackagingComponent.type");
2965        else if (Configuration.doAutoCreate())
2966          this.type = new CodeableConcept(); // cc
2967      return this.type;
2968    }
2969
2970    public boolean hasType() {
2971      return this.type != null && !this.type.isEmpty();
2972    }
2973
2974    /**
2975     * @param value {@link #type} (A code that defines the specific type of
2976     *              packaging that the medication can be found in (e.g. blister
2977     *              sleeve, tube, bottle).)
2978     */
2979    public MedicationKnowledgePackagingComponent setType(CodeableConcept value) {
2980      this.type = value;
2981      return this;
2982    }
2983
2984    /**
2985     * @return {@link #quantity} (The number of product units the package would
2986     *         contain if fully loaded.)
2987     */
2988    public Quantity getQuantity() {
2989      if (this.quantity == null)
2990        if (Configuration.errorOnAutoCreate())
2991          throw new Error("Attempt to auto-create MedicationKnowledgePackagingComponent.quantity");
2992        else if (Configuration.doAutoCreate())
2993          this.quantity = new Quantity(); // cc
2994      return this.quantity;
2995    }
2996
2997    public boolean hasQuantity() {
2998      return this.quantity != null && !this.quantity.isEmpty();
2999    }
3000
3001    /**
3002     * @param value {@link #quantity} (The number of product units the package would
3003     *              contain if fully loaded.)
3004     */
3005    public MedicationKnowledgePackagingComponent setQuantity(Quantity value) {
3006      this.quantity = value;
3007      return this;
3008    }
3009
3010    protected void listChildren(List<Property> children) {
3011      super.listChildren(children);
3012      children.add(new Property("type", "CodeableConcept",
3013          "A code that defines the specific type of packaging that the medication can be found in (e.g. blister sleeve, tube, bottle).",
3014          0, 1, type));
3015      children.add(new Property("quantity", "SimpleQuantity",
3016          "The number of product units the package would contain if fully loaded.", 0, 1, quantity));
3017    }
3018
3019    @Override
3020    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3021      switch (_hash) {
3022      case 3575610:
3023        /* type */ return new Property("type", "CodeableConcept",
3024            "A code that defines the specific type of packaging that the medication can be found in (e.g. blister sleeve, tube, bottle).",
3025            0, 1, type);
3026      case -1285004149:
3027        /* quantity */ return new Property("quantity", "SimpleQuantity",
3028            "The number of product units the package would contain if fully loaded.", 0, 1, quantity);
3029      default:
3030        return super.getNamedProperty(_hash, _name, _checkValid);
3031      }
3032
3033    }
3034
3035    @Override
3036    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3037      switch (hash) {
3038      case 3575610:
3039        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
3040      case -1285004149:
3041        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
3042      default:
3043        return super.getProperty(hash, name, checkValid);
3044      }
3045
3046    }
3047
3048    @Override
3049    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3050      switch (hash) {
3051      case 3575610: // type
3052        this.type = castToCodeableConcept(value); // CodeableConcept
3053        return value;
3054      case -1285004149: // quantity
3055        this.quantity = castToQuantity(value); // Quantity
3056        return value;
3057      default:
3058        return super.setProperty(hash, name, value);
3059      }
3060
3061    }
3062
3063    @Override
3064    public Base setProperty(String name, Base value) throws FHIRException {
3065      if (name.equals("type")) {
3066        this.type = castToCodeableConcept(value); // CodeableConcept
3067      } else if (name.equals("quantity")) {
3068        this.quantity = castToQuantity(value); // Quantity
3069      } else
3070        return super.setProperty(name, value);
3071      return value;
3072    }
3073
3074    @Override
3075    public Base makeProperty(int hash, String name) throws FHIRException {
3076      switch (hash) {
3077      case 3575610:
3078        return getType();
3079      case -1285004149:
3080        return getQuantity();
3081      default:
3082        return super.makeProperty(hash, name);
3083      }
3084
3085    }
3086
3087    @Override
3088    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3089      switch (hash) {
3090      case 3575610:
3091        /* type */ return new String[] { "CodeableConcept" };
3092      case -1285004149:
3093        /* quantity */ return new String[] { "SimpleQuantity" };
3094      default:
3095        return super.getTypesForProperty(hash, name);
3096      }
3097
3098    }
3099
3100    @Override
3101    public Base addChild(String name) throws FHIRException {
3102      if (name.equals("type")) {
3103        this.type = new CodeableConcept();
3104        return this.type;
3105      } else if (name.equals("quantity")) {
3106        this.quantity = new Quantity();
3107        return this.quantity;
3108      } else
3109        return super.addChild(name);
3110    }
3111
3112    public MedicationKnowledgePackagingComponent copy() {
3113      MedicationKnowledgePackagingComponent dst = new MedicationKnowledgePackagingComponent();
3114      copyValues(dst);
3115      return dst;
3116    }
3117
3118    public void copyValues(MedicationKnowledgePackagingComponent dst) {
3119      super.copyValues(dst);
3120      dst.type = type == null ? null : type.copy();
3121      dst.quantity = quantity == null ? null : quantity.copy();
3122    }
3123
3124    @Override
3125    public boolean equalsDeep(Base other_) {
3126      if (!super.equalsDeep(other_))
3127        return false;
3128      if (!(other_ instanceof MedicationKnowledgePackagingComponent))
3129        return false;
3130      MedicationKnowledgePackagingComponent o = (MedicationKnowledgePackagingComponent) other_;
3131      return compareDeep(type, o.type, true) && compareDeep(quantity, o.quantity, true);
3132    }
3133
3134    @Override
3135    public boolean equalsShallow(Base other_) {
3136      if (!super.equalsShallow(other_))
3137        return false;
3138      if (!(other_ instanceof MedicationKnowledgePackagingComponent))
3139        return false;
3140      MedicationKnowledgePackagingComponent o = (MedicationKnowledgePackagingComponent) other_;
3141      return true;
3142    }
3143
3144    public boolean isEmpty() {
3145      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, quantity);
3146    }
3147
3148    public String fhirType() {
3149      return "MedicationKnowledge.packaging";
3150
3151    }
3152
3153  }
3154
3155  @Block()
3156  public static class MedicationKnowledgeDrugCharacteristicComponent extends BackboneElement
3157      implements IBaseBackboneElement {
3158    /**
3159     * A code specifying which characteristic of the medicine is being described
3160     * (for example, colour, shape, imprint).
3161     */
3162    @Child(name = "type", type = {
3163        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
3164    @Description(shortDefinition = "Code specifying the type of characteristic of medication", formalDefinition = "A code specifying which characteristic of the medicine is being described (for example, colour, shape, imprint).")
3165    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medicationknowledge-characteristic")
3166    protected CodeableConcept type;
3167
3168    /**
3169     * Description of the characteristic.
3170     */
3171    @Child(name = "value", type = { CodeableConcept.class, StringType.class, Quantity.class,
3172        Base64BinaryType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
3173    @Description(shortDefinition = "Description of the characteristic", formalDefinition = "Description of the characteristic.")
3174    protected Type value;
3175
3176    private static final long serialVersionUID = -491121170L;
3177
3178    /**
3179     * Constructor
3180     */
3181    public MedicationKnowledgeDrugCharacteristicComponent() {
3182      super();
3183    }
3184
3185    /**
3186     * @return {@link #type} (A code specifying which characteristic of the medicine
3187     *         is being described (for example, colour, shape, imprint).)
3188     */
3189    public CodeableConcept getType() {
3190      if (this.type == null)
3191        if (Configuration.errorOnAutoCreate())
3192          throw new Error("Attempt to auto-create MedicationKnowledgeDrugCharacteristicComponent.type");
3193        else if (Configuration.doAutoCreate())
3194          this.type = new CodeableConcept(); // cc
3195      return this.type;
3196    }
3197
3198    public boolean hasType() {
3199      return this.type != null && !this.type.isEmpty();
3200    }
3201
3202    /**
3203     * @param value {@link #type} (A code specifying which characteristic of the
3204     *              medicine is being described (for example, colour, shape,
3205     *              imprint).)
3206     */
3207    public MedicationKnowledgeDrugCharacteristicComponent setType(CodeableConcept value) {
3208      this.type = value;
3209      return this;
3210    }
3211
3212    /**
3213     * @return {@link #value} (Description of the characteristic.)
3214     */
3215    public Type getValue() {
3216      return this.value;
3217    }
3218
3219    /**
3220     * @return {@link #value} (Description of the characteristic.)
3221     */
3222    public CodeableConcept getValueCodeableConcept() throws FHIRException {
3223      if (this.value == null)
3224        this.value = new CodeableConcept();
3225      if (!(this.value instanceof CodeableConcept))
3226        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
3227            + this.value.getClass().getName() + " was encountered");
3228      return (CodeableConcept) this.value;
3229    }
3230
3231    public boolean hasValueCodeableConcept() {
3232      return this != null && this.value instanceof CodeableConcept;
3233    }
3234
3235    /**
3236     * @return {@link #value} (Description of the characteristic.)
3237     */
3238    public StringType getValueStringType() throws FHIRException {
3239      if (this.value == null)
3240        this.value = new StringType();
3241      if (!(this.value instanceof StringType))
3242        throw new FHIRException("Type mismatch: the type StringType was expected, but "
3243            + this.value.getClass().getName() + " was encountered");
3244      return (StringType) this.value;
3245    }
3246
3247    public boolean hasValueStringType() {
3248      return this != null && this.value instanceof StringType;
3249    }
3250
3251    /**
3252     * @return {@link #value} (Description of the characteristic.)
3253     */
3254    public Quantity getValueQuantity() throws FHIRException {
3255      if (this.value == null)
3256        this.value = new Quantity();
3257      if (!(this.value instanceof Quantity))
3258        throw new FHIRException("Type mismatch: the type Quantity was expected, but " + this.value.getClass().getName()
3259            + " was encountered");
3260      return (Quantity) this.value;
3261    }
3262
3263    public boolean hasValueQuantity() {
3264      return this != null && this.value instanceof Quantity;
3265    }
3266
3267    /**
3268     * @return {@link #value} (Description of the characteristic.)
3269     */
3270    public Base64BinaryType getValueBase64BinaryType() throws FHIRException {
3271      if (this.value == null)
3272        this.value = new Base64BinaryType();
3273      if (!(this.value instanceof Base64BinaryType))
3274        throw new FHIRException("Type mismatch: the type Base64BinaryType was expected, but "
3275            + this.value.getClass().getName() + " was encountered");
3276      return (Base64BinaryType) this.value;
3277    }
3278
3279    public boolean hasValueBase64BinaryType() {
3280      return this != null && this.value instanceof Base64BinaryType;
3281    }
3282
3283    public boolean hasValue() {
3284      return this.value != null && !this.value.isEmpty();
3285    }
3286
3287    /**
3288     * @param value {@link #value} (Description of the characteristic.)
3289     */
3290    public MedicationKnowledgeDrugCharacteristicComponent setValue(Type value) {
3291      if (value != null && !(value instanceof CodeableConcept || value instanceof StringType
3292          || value instanceof Quantity || value instanceof Base64BinaryType))
3293        throw new Error("Not the right type for MedicationKnowledge.drugCharacteristic.value[x]: " + value.fhirType());
3294      this.value = value;
3295      return this;
3296    }
3297
3298    protected void listChildren(List<Property> children) {
3299      super.listChildren(children);
3300      children.add(new Property("type", "CodeableConcept",
3301          "A code specifying which characteristic of the medicine is being described (for example, colour, shape, imprint).",
3302          0, 1, type));
3303      children.add(new Property("value[x]", "CodeableConcept|string|SimpleQuantity|base64Binary",
3304          "Description of the characteristic.", 0, 1, value));
3305    }
3306
3307    @Override
3308    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3309      switch (_hash) {
3310      case 3575610:
3311        /* type */ return new Property("type", "CodeableConcept",
3312            "A code specifying which characteristic of the medicine is being described (for example, colour, shape, imprint).",
3313            0, 1, type);
3314      case -1410166417:
3315        /* value[x] */ return new Property("value[x]", "CodeableConcept|string|SimpleQuantity|base64Binary",
3316            "Description of the characteristic.", 0, 1, value);
3317      case 111972721:
3318        /* value */ return new Property("value[x]", "CodeableConcept|string|SimpleQuantity|base64Binary",
3319            "Description of the characteristic.", 0, 1, value);
3320      case 924902896:
3321        /* valueCodeableConcept */ return new Property("value[x]", "CodeableConcept|string|SimpleQuantity|base64Binary",
3322            "Description of the characteristic.", 0, 1, value);
3323      case -1424603934:
3324        /* valueString */ return new Property("value[x]", "CodeableConcept|string|SimpleQuantity|base64Binary",
3325            "Description of the characteristic.", 0, 1, value);
3326      case -2029823716:
3327        /* valueQuantity */ return new Property("value[x]", "CodeableConcept|string|SimpleQuantity|base64Binary",
3328            "Description of the characteristic.", 0, 1, value);
3329      case -1535024575:
3330        /* valueBase64Binary */ return new Property("value[x]", "CodeableConcept|string|SimpleQuantity|base64Binary",
3331            "Description of the characteristic.", 0, 1, value);
3332      default:
3333        return super.getNamedProperty(_hash, _name, _checkValid);
3334      }
3335
3336    }
3337
3338    @Override
3339    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3340      switch (hash) {
3341      case 3575610:
3342        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
3343      case 111972721:
3344        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // Type
3345      default:
3346        return super.getProperty(hash, name, checkValid);
3347      }
3348
3349    }
3350
3351    @Override
3352    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3353      switch (hash) {
3354      case 3575610: // type
3355        this.type = castToCodeableConcept(value); // CodeableConcept
3356        return value;
3357      case 111972721: // value
3358        this.value = castToType(value); // Type
3359        return value;
3360      default:
3361        return super.setProperty(hash, name, value);
3362      }
3363
3364    }
3365
3366    @Override
3367    public Base setProperty(String name, Base value) throws FHIRException {
3368      if (name.equals("type")) {
3369        this.type = castToCodeableConcept(value); // CodeableConcept
3370      } else if (name.equals("value[x]")) {
3371        this.value = castToType(value); // Type
3372      } else
3373        return super.setProperty(name, value);
3374      return value;
3375    }
3376
3377    @Override
3378    public Base makeProperty(int hash, String name) throws FHIRException {
3379      switch (hash) {
3380      case 3575610:
3381        return getType();
3382      case -1410166417:
3383        return getValue();
3384      case 111972721:
3385        return getValue();
3386      default:
3387        return super.makeProperty(hash, name);
3388      }
3389
3390    }
3391
3392    @Override
3393    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3394      switch (hash) {
3395      case 3575610:
3396        /* type */ return new String[] { "CodeableConcept" };
3397      case 111972721:
3398        /* value */ return new String[] { "CodeableConcept", "string", "SimpleQuantity", "base64Binary" };
3399      default:
3400        return super.getTypesForProperty(hash, name);
3401      }
3402
3403    }
3404
3405    @Override
3406    public Base addChild(String name) throws FHIRException {
3407      if (name.equals("type")) {
3408        this.type = new CodeableConcept();
3409        return this.type;
3410      } else if (name.equals("valueCodeableConcept")) {
3411        this.value = new CodeableConcept();
3412        return this.value;
3413      } else if (name.equals("valueString")) {
3414        this.value = new StringType();
3415        return this.value;
3416      } else if (name.equals("valueQuantity")) {
3417        this.value = new Quantity();
3418        return this.value;
3419      } else if (name.equals("valueBase64Binary")) {
3420        this.value = new Base64BinaryType();
3421        return this.value;
3422      } else
3423        return super.addChild(name);
3424    }
3425
3426    public MedicationKnowledgeDrugCharacteristicComponent copy() {
3427      MedicationKnowledgeDrugCharacteristicComponent dst = new MedicationKnowledgeDrugCharacteristicComponent();
3428      copyValues(dst);
3429      return dst;
3430    }
3431
3432    public void copyValues(MedicationKnowledgeDrugCharacteristicComponent dst) {
3433      super.copyValues(dst);
3434      dst.type = type == null ? null : type.copy();
3435      dst.value = value == null ? null : value.copy();
3436    }
3437
3438    @Override
3439    public boolean equalsDeep(Base other_) {
3440      if (!super.equalsDeep(other_))
3441        return false;
3442      if (!(other_ instanceof MedicationKnowledgeDrugCharacteristicComponent))
3443        return false;
3444      MedicationKnowledgeDrugCharacteristicComponent o = (MedicationKnowledgeDrugCharacteristicComponent) other_;
3445      return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
3446    }
3447
3448    @Override
3449    public boolean equalsShallow(Base other_) {
3450      if (!super.equalsShallow(other_))
3451        return false;
3452      if (!(other_ instanceof MedicationKnowledgeDrugCharacteristicComponent))
3453        return false;
3454      MedicationKnowledgeDrugCharacteristicComponent o = (MedicationKnowledgeDrugCharacteristicComponent) other_;
3455      return true;
3456    }
3457
3458    public boolean isEmpty() {
3459      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
3460    }
3461
3462    public String fhirType() {
3463      return "MedicationKnowledge.drugCharacteristic";
3464
3465    }
3466
3467  }
3468
3469  @Block()
3470  public static class MedicationKnowledgeRegulatoryComponent extends BackboneElement implements IBaseBackboneElement {
3471    /**
3472     * The authority that is specifying the regulations.
3473     */
3474    @Child(name = "regulatoryAuthority", type = {
3475        Organization.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
3476    @Description(shortDefinition = "Specifies the authority of the regulation", formalDefinition = "The authority that is specifying the regulations.")
3477    protected Reference regulatoryAuthority;
3478
3479    /**
3480     * The actual object that is the target of the reference (The authority that is
3481     * specifying the regulations.)
3482     */
3483    protected Organization regulatoryAuthorityTarget;
3484
3485    /**
3486     * Specifies if changes are allowed when dispensing a medication from a
3487     * regulatory perspective.
3488     */
3489    @Child(name = "substitution", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3490    @Description(shortDefinition = "Specifies if changes are allowed when dispensing a medication from a regulatory perspective", formalDefinition = "Specifies if changes are allowed when dispensing a medication from a regulatory perspective.")
3491    protected List<MedicationKnowledgeRegulatorySubstitutionComponent> substitution;
3492
3493    /**
3494     * Specifies the schedule of a medication in jurisdiction.
3495     */
3496    @Child(name = "schedule", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
3497    @Description(shortDefinition = "Specifies the schedule of a medication in jurisdiction", formalDefinition = "Specifies the schedule of a medication in jurisdiction.")
3498    protected List<MedicationKnowledgeRegulatoryScheduleComponent> schedule;
3499
3500    /**
3501     * The maximum number of units of the medication that can be dispensed in a
3502     * period.
3503     */
3504    @Child(name = "maxDispense", type = {}, order = 4, min = 0, max = 1, modifier = false, summary = false)
3505    @Description(shortDefinition = "The maximum number of units of the medication that can be dispensed in a period", formalDefinition = "The maximum number of units of the medication that can be dispensed in a period.")
3506    protected MedicationKnowledgeRegulatoryMaxDispenseComponent maxDispense;
3507
3508    private static final long serialVersionUID = -1252605487L;
3509
3510    /**
3511     * Constructor
3512     */
3513    public MedicationKnowledgeRegulatoryComponent() {
3514      super();
3515    }
3516
3517    /**
3518     * Constructor
3519     */
3520    public MedicationKnowledgeRegulatoryComponent(Reference regulatoryAuthority) {
3521      super();
3522      this.regulatoryAuthority = regulatoryAuthority;
3523    }
3524
3525    /**
3526     * @return {@link #regulatoryAuthority} (The authority that is specifying the
3527     *         regulations.)
3528     */
3529    public Reference getRegulatoryAuthority() {
3530      if (this.regulatoryAuthority == null)
3531        if (Configuration.errorOnAutoCreate())
3532          throw new Error("Attempt to auto-create MedicationKnowledgeRegulatoryComponent.regulatoryAuthority");
3533        else if (Configuration.doAutoCreate())
3534          this.regulatoryAuthority = new Reference(); // cc
3535      return this.regulatoryAuthority;
3536    }
3537
3538    public boolean hasRegulatoryAuthority() {
3539      return this.regulatoryAuthority != null && !this.regulatoryAuthority.isEmpty();
3540    }
3541
3542    /**
3543     * @param value {@link #regulatoryAuthority} (The authority that is specifying
3544     *              the regulations.)
3545     */
3546    public MedicationKnowledgeRegulatoryComponent setRegulatoryAuthority(Reference value) {
3547      this.regulatoryAuthority = value;
3548      return this;
3549    }
3550
3551    /**
3552     * @return {@link #regulatoryAuthority} The actual object that is the target of
3553     *         the reference. The reference library doesn't populate this, but you
3554     *         can use it to hold the resource if you resolve it. (The authority
3555     *         that is specifying the regulations.)
3556     */
3557    public Organization getRegulatoryAuthorityTarget() {
3558      if (this.regulatoryAuthorityTarget == null)
3559        if (Configuration.errorOnAutoCreate())
3560          throw new Error("Attempt to auto-create MedicationKnowledgeRegulatoryComponent.regulatoryAuthority");
3561        else if (Configuration.doAutoCreate())
3562          this.regulatoryAuthorityTarget = new Organization(); // aa
3563      return this.regulatoryAuthorityTarget;
3564    }
3565
3566    /**
3567     * @param value {@link #regulatoryAuthority} The actual object that is the
3568     *              target of the reference. The reference library doesn't use
3569     *              these, but you can use it to hold the resource if you resolve
3570     *              it. (The authority that is specifying the regulations.)
3571     */
3572    public MedicationKnowledgeRegulatoryComponent setRegulatoryAuthorityTarget(Organization value) {
3573      this.regulatoryAuthorityTarget = value;
3574      return this;
3575    }
3576
3577    /**
3578     * @return {@link #substitution} (Specifies if changes are allowed when
3579     *         dispensing a medication from a regulatory perspective.)
3580     */
3581    public List<MedicationKnowledgeRegulatorySubstitutionComponent> getSubstitution() {
3582      if (this.substitution == null)
3583        this.substitution = new ArrayList<MedicationKnowledgeRegulatorySubstitutionComponent>();
3584      return this.substitution;
3585    }
3586
3587    /**
3588     * @return Returns a reference to <code>this</code> for easy method chaining
3589     */
3590    public MedicationKnowledgeRegulatoryComponent setSubstitution(
3591        List<MedicationKnowledgeRegulatorySubstitutionComponent> theSubstitution) {
3592      this.substitution = theSubstitution;
3593      return this;
3594    }
3595
3596    public boolean hasSubstitution() {
3597      if (this.substitution == null)
3598        return false;
3599      for (MedicationKnowledgeRegulatorySubstitutionComponent item : this.substitution)
3600        if (!item.isEmpty())
3601          return true;
3602      return false;
3603    }
3604
3605    public MedicationKnowledgeRegulatorySubstitutionComponent addSubstitution() { // 3
3606      MedicationKnowledgeRegulatorySubstitutionComponent t = new MedicationKnowledgeRegulatorySubstitutionComponent();
3607      if (this.substitution == null)
3608        this.substitution = new ArrayList<MedicationKnowledgeRegulatorySubstitutionComponent>();
3609      this.substitution.add(t);
3610      return t;
3611    }
3612
3613    public MedicationKnowledgeRegulatoryComponent addSubstitution(
3614        MedicationKnowledgeRegulatorySubstitutionComponent t) { // 3
3615      if (t == null)
3616        return this;
3617      if (this.substitution == null)
3618        this.substitution = new ArrayList<MedicationKnowledgeRegulatorySubstitutionComponent>();
3619      this.substitution.add(t);
3620      return this;
3621    }
3622
3623    /**
3624     * @return The first repetition of repeating field {@link #substitution},
3625     *         creating it if it does not already exist
3626     */
3627    public MedicationKnowledgeRegulatorySubstitutionComponent getSubstitutionFirstRep() {
3628      if (getSubstitution().isEmpty()) {
3629        addSubstitution();
3630      }
3631      return getSubstitution().get(0);
3632    }
3633
3634    /**
3635     * @return {@link #schedule} (Specifies the schedule of a medication in
3636     *         jurisdiction.)
3637     */
3638    public List<MedicationKnowledgeRegulatoryScheduleComponent> getSchedule() {
3639      if (this.schedule == null)
3640        this.schedule = new ArrayList<MedicationKnowledgeRegulatoryScheduleComponent>();
3641      return this.schedule;
3642    }
3643
3644    /**
3645     * @return Returns a reference to <code>this</code> for easy method chaining
3646     */
3647    public MedicationKnowledgeRegulatoryComponent setSchedule(
3648        List<MedicationKnowledgeRegulatoryScheduleComponent> theSchedule) {
3649      this.schedule = theSchedule;
3650      return this;
3651    }
3652
3653    public boolean hasSchedule() {
3654      if (this.schedule == null)
3655        return false;
3656      for (MedicationKnowledgeRegulatoryScheduleComponent item : this.schedule)
3657        if (!item.isEmpty())
3658          return true;
3659      return false;
3660    }
3661
3662    public MedicationKnowledgeRegulatoryScheduleComponent addSchedule() { // 3
3663      MedicationKnowledgeRegulatoryScheduleComponent t = new MedicationKnowledgeRegulatoryScheduleComponent();
3664      if (this.schedule == null)
3665        this.schedule = new ArrayList<MedicationKnowledgeRegulatoryScheduleComponent>();
3666      this.schedule.add(t);
3667      return t;
3668    }
3669
3670    public MedicationKnowledgeRegulatoryComponent addSchedule(MedicationKnowledgeRegulatoryScheduleComponent t) { // 3
3671      if (t == null)
3672        return this;
3673      if (this.schedule == null)
3674        this.schedule = new ArrayList<MedicationKnowledgeRegulatoryScheduleComponent>();
3675      this.schedule.add(t);
3676      return this;
3677    }
3678
3679    /**
3680     * @return The first repetition of repeating field {@link #schedule}, creating
3681     *         it if it does not already exist
3682     */
3683    public MedicationKnowledgeRegulatoryScheduleComponent getScheduleFirstRep() {
3684      if (getSchedule().isEmpty()) {
3685        addSchedule();
3686      }
3687      return getSchedule().get(0);
3688    }
3689
3690    /**
3691     * @return {@link #maxDispense} (The maximum number of units of the medication
3692     *         that can be dispensed in a period.)
3693     */
3694    public MedicationKnowledgeRegulatoryMaxDispenseComponent getMaxDispense() {
3695      if (this.maxDispense == null)
3696        if (Configuration.errorOnAutoCreate())
3697          throw new Error("Attempt to auto-create MedicationKnowledgeRegulatoryComponent.maxDispense");
3698        else if (Configuration.doAutoCreate())
3699          this.maxDispense = new MedicationKnowledgeRegulatoryMaxDispenseComponent(); // cc
3700      return this.maxDispense;
3701    }
3702
3703    public boolean hasMaxDispense() {
3704      return this.maxDispense != null && !this.maxDispense.isEmpty();
3705    }
3706
3707    /**
3708     * @param value {@link #maxDispense} (The maximum number of units of the
3709     *              medication that can be dispensed in a period.)
3710     */
3711    public MedicationKnowledgeRegulatoryComponent setMaxDispense(
3712        MedicationKnowledgeRegulatoryMaxDispenseComponent value) {
3713      this.maxDispense = value;
3714      return this;
3715    }
3716
3717    protected void listChildren(List<Property> children) {
3718      super.listChildren(children);
3719      children.add(new Property("regulatoryAuthority", "Reference(Organization)",
3720          "The authority that is specifying the regulations.", 0, 1, regulatoryAuthority));
3721      children.add(new Property("substitution", "",
3722          "Specifies if changes are allowed when dispensing a medication from a regulatory perspective.", 0,
3723          java.lang.Integer.MAX_VALUE, substitution));
3724      children.add(new Property("schedule", "", "Specifies the schedule of a medication in jurisdiction.", 0,
3725          java.lang.Integer.MAX_VALUE, schedule));
3726      children.add(new Property("maxDispense", "",
3727          "The maximum number of units of the medication that can be dispensed in a period.", 0, 1, maxDispense));
3728    }
3729
3730    @Override
3731    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3732      switch (_hash) {
3733      case 711233419:
3734        /* regulatoryAuthority */ return new Property("regulatoryAuthority", "Reference(Organization)",
3735            "The authority that is specifying the regulations.", 0, 1, regulatoryAuthority);
3736      case 826147581:
3737        /* substitution */ return new Property("substitution", "",
3738            "Specifies if changes are allowed when dispensing a medication from a regulatory perspective.", 0,
3739            java.lang.Integer.MAX_VALUE, substitution);
3740      case -697920873:
3741        /* schedule */ return new Property("schedule", "", "Specifies the schedule of a medication in jurisdiction.", 0,
3742            java.lang.Integer.MAX_VALUE, schedule);
3743      case -1977784607:
3744        /* maxDispense */ return new Property("maxDispense", "",
3745            "The maximum number of units of the medication that can be dispensed in a period.", 0, 1, maxDispense);
3746      default:
3747        return super.getNamedProperty(_hash, _name, _checkValid);
3748      }
3749
3750    }
3751
3752    @Override
3753    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3754      switch (hash) {
3755      case 711233419:
3756        /* regulatoryAuthority */ return this.regulatoryAuthority == null ? new Base[0]
3757            : new Base[] { this.regulatoryAuthority }; // Reference
3758      case 826147581:
3759        /* substitution */ return this.substitution == null ? new Base[0]
3760            : this.substitution.toArray(new Base[this.substitution.size()]); // MedicationKnowledgeRegulatorySubstitutionComponent
3761      case -697920873:
3762        /* schedule */ return this.schedule == null ? new Base[0]
3763            : this.schedule.toArray(new Base[this.schedule.size()]); // MedicationKnowledgeRegulatoryScheduleComponent
3764      case -1977784607:
3765        /* maxDispense */ return this.maxDispense == null ? new Base[0] : new Base[] { this.maxDispense }; // MedicationKnowledgeRegulatoryMaxDispenseComponent
3766      default:
3767        return super.getProperty(hash, name, checkValid);
3768      }
3769
3770    }
3771
3772    @Override
3773    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3774      switch (hash) {
3775      case 711233419: // regulatoryAuthority
3776        this.regulatoryAuthority = castToReference(value); // Reference
3777        return value;
3778      case 826147581: // substitution
3779        this.getSubstitution().add((MedicationKnowledgeRegulatorySubstitutionComponent) value); // MedicationKnowledgeRegulatorySubstitutionComponent
3780        return value;
3781      case -697920873: // schedule
3782        this.getSchedule().add((MedicationKnowledgeRegulatoryScheduleComponent) value); // MedicationKnowledgeRegulatoryScheduleComponent
3783        return value;
3784      case -1977784607: // maxDispense
3785        this.maxDispense = (MedicationKnowledgeRegulatoryMaxDispenseComponent) value; // MedicationKnowledgeRegulatoryMaxDispenseComponent
3786        return value;
3787      default:
3788        return super.setProperty(hash, name, value);
3789      }
3790
3791    }
3792
3793    @Override
3794    public Base setProperty(String name, Base value) throws FHIRException {
3795      if (name.equals("regulatoryAuthority")) {
3796        this.regulatoryAuthority = castToReference(value); // Reference
3797      } else if (name.equals("substitution")) {
3798        this.getSubstitution().add((MedicationKnowledgeRegulatorySubstitutionComponent) value);
3799      } else if (name.equals("schedule")) {
3800        this.getSchedule().add((MedicationKnowledgeRegulatoryScheduleComponent) value);
3801      } else if (name.equals("maxDispense")) {
3802        this.maxDispense = (MedicationKnowledgeRegulatoryMaxDispenseComponent) value; // MedicationKnowledgeRegulatoryMaxDispenseComponent
3803      } else
3804        return super.setProperty(name, value);
3805      return value;
3806    }
3807
3808    @Override
3809    public Base makeProperty(int hash, String name) throws FHIRException {
3810      switch (hash) {
3811      case 711233419:
3812        return getRegulatoryAuthority();
3813      case 826147581:
3814        return addSubstitution();
3815      case -697920873:
3816        return addSchedule();
3817      case -1977784607:
3818        return getMaxDispense();
3819      default:
3820        return super.makeProperty(hash, name);
3821      }
3822
3823    }
3824
3825    @Override
3826    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3827      switch (hash) {
3828      case 711233419:
3829        /* regulatoryAuthority */ return new String[] { "Reference" };
3830      case 826147581:
3831        /* substitution */ return new String[] {};
3832      case -697920873:
3833        /* schedule */ return new String[] {};
3834      case -1977784607:
3835        /* maxDispense */ return new String[] {};
3836      default:
3837        return super.getTypesForProperty(hash, name);
3838      }
3839
3840    }
3841
3842    @Override
3843    public Base addChild(String name) throws FHIRException {
3844      if (name.equals("regulatoryAuthority")) {
3845        this.regulatoryAuthority = new Reference();
3846        return this.regulatoryAuthority;
3847      } else if (name.equals("substitution")) {
3848        return addSubstitution();
3849      } else if (name.equals("schedule")) {
3850        return addSchedule();
3851      } else if (name.equals("maxDispense")) {
3852        this.maxDispense = new MedicationKnowledgeRegulatoryMaxDispenseComponent();
3853        return this.maxDispense;
3854      } else
3855        return super.addChild(name);
3856    }
3857
3858    public MedicationKnowledgeRegulatoryComponent copy() {
3859      MedicationKnowledgeRegulatoryComponent dst = new MedicationKnowledgeRegulatoryComponent();
3860      copyValues(dst);
3861      return dst;
3862    }
3863
3864    public void copyValues(MedicationKnowledgeRegulatoryComponent dst) {
3865      super.copyValues(dst);
3866      dst.regulatoryAuthority = regulatoryAuthority == null ? null : regulatoryAuthority.copy();
3867      if (substitution != null) {
3868        dst.substitution = new ArrayList<MedicationKnowledgeRegulatorySubstitutionComponent>();
3869        for (MedicationKnowledgeRegulatorySubstitutionComponent i : substitution)
3870          dst.substitution.add(i.copy());
3871      }
3872      ;
3873      if (schedule != null) {
3874        dst.schedule = new ArrayList<MedicationKnowledgeRegulatoryScheduleComponent>();
3875        for (MedicationKnowledgeRegulatoryScheduleComponent i : schedule)
3876          dst.schedule.add(i.copy());
3877      }
3878      ;
3879      dst.maxDispense = maxDispense == null ? null : maxDispense.copy();
3880    }
3881
3882    @Override
3883    public boolean equalsDeep(Base other_) {
3884      if (!super.equalsDeep(other_))
3885        return false;
3886      if (!(other_ instanceof MedicationKnowledgeRegulatoryComponent))
3887        return false;
3888      MedicationKnowledgeRegulatoryComponent o = (MedicationKnowledgeRegulatoryComponent) other_;
3889      return compareDeep(regulatoryAuthority, o.regulatoryAuthority, true)
3890          && compareDeep(substitution, o.substitution, true) && compareDeep(schedule, o.schedule, true)
3891          && compareDeep(maxDispense, o.maxDispense, true);
3892    }
3893
3894    @Override
3895    public boolean equalsShallow(Base other_) {
3896      if (!super.equalsShallow(other_))
3897        return false;
3898      if (!(other_ instanceof MedicationKnowledgeRegulatoryComponent))
3899        return false;
3900      MedicationKnowledgeRegulatoryComponent o = (MedicationKnowledgeRegulatoryComponent) other_;
3901      return true;
3902    }
3903
3904    public boolean isEmpty() {
3905      return super.isEmpty()
3906          && ca.uhn.fhir.util.ElementUtil.isEmpty(regulatoryAuthority, substitution, schedule, maxDispense);
3907    }
3908
3909    public String fhirType() {
3910      return "MedicationKnowledge.regulatory";
3911
3912    }
3913
3914  }
3915
3916  @Block()
3917  public static class MedicationKnowledgeRegulatorySubstitutionComponent extends BackboneElement
3918      implements IBaseBackboneElement {
3919    /**
3920     * Specifies the type of substitution allowed.
3921     */
3922    @Child(name = "type", type = {
3923        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
3924    @Description(shortDefinition = "Specifies the type of substitution allowed", formalDefinition = "Specifies the type of substitution allowed.")
3925    protected CodeableConcept type;
3926
3927    /**
3928     * Specifies if regulation allows for changes in the medication when dispensing.
3929     */
3930    @Child(name = "allowed", type = {
3931        BooleanType.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
3932    @Description(shortDefinition = "Specifies if regulation allows for changes in the medication when dispensing", formalDefinition = "Specifies if regulation allows for changes in the medication when dispensing.")
3933    protected BooleanType allowed;
3934
3935    private static final long serialVersionUID = 396354861L;
3936
3937    /**
3938     * Constructor
3939     */
3940    public MedicationKnowledgeRegulatorySubstitutionComponent() {
3941      super();
3942    }
3943
3944    /**
3945     * Constructor
3946     */
3947    public MedicationKnowledgeRegulatorySubstitutionComponent(CodeableConcept type, BooleanType allowed) {
3948      super();
3949      this.type = type;
3950      this.allowed = allowed;
3951    }
3952
3953    /**
3954     * @return {@link #type} (Specifies the type of substitution allowed.)
3955     */
3956    public CodeableConcept getType() {
3957      if (this.type == null)
3958        if (Configuration.errorOnAutoCreate())
3959          throw new Error("Attempt to auto-create MedicationKnowledgeRegulatorySubstitutionComponent.type");
3960        else if (Configuration.doAutoCreate())
3961          this.type = new CodeableConcept(); // cc
3962      return this.type;
3963    }
3964
3965    public boolean hasType() {
3966      return this.type != null && !this.type.isEmpty();
3967    }
3968
3969    /**
3970     * @param value {@link #type} (Specifies the type of substitution allowed.)
3971     */
3972    public MedicationKnowledgeRegulatorySubstitutionComponent setType(CodeableConcept value) {
3973      this.type = value;
3974      return this;
3975    }
3976
3977    /**
3978     * @return {@link #allowed} (Specifies if regulation allows for changes in the
3979     *         medication when dispensing.). This is the underlying object with id,
3980     *         value and extensions. The accessor "getAllowed" gives direct access
3981     *         to the value
3982     */
3983    public BooleanType getAllowedElement() {
3984      if (this.allowed == null)
3985        if (Configuration.errorOnAutoCreate())
3986          throw new Error("Attempt to auto-create MedicationKnowledgeRegulatorySubstitutionComponent.allowed");
3987        else if (Configuration.doAutoCreate())
3988          this.allowed = new BooleanType(); // bb
3989      return this.allowed;
3990    }
3991
3992    public boolean hasAllowedElement() {
3993      return this.allowed != null && !this.allowed.isEmpty();
3994    }
3995
3996    public boolean hasAllowed() {
3997      return this.allowed != null && !this.allowed.isEmpty();
3998    }
3999
4000    /**
4001     * @param value {@link #allowed} (Specifies if regulation allows for changes in
4002     *              the medication when dispensing.). This is the underlying object
4003     *              with id, value and extensions. The accessor "getAllowed" gives
4004     *              direct access to the value
4005     */
4006    public MedicationKnowledgeRegulatorySubstitutionComponent setAllowedElement(BooleanType value) {
4007      this.allowed = value;
4008      return this;
4009    }
4010
4011    /**
4012     * @return Specifies if regulation allows for changes in the medication when
4013     *         dispensing.
4014     */
4015    public boolean getAllowed() {
4016      return this.allowed == null || this.allowed.isEmpty() ? false : this.allowed.getValue();
4017    }
4018
4019    /**
4020     * @param value Specifies if regulation allows for changes in the medication
4021     *              when dispensing.
4022     */
4023    public MedicationKnowledgeRegulatorySubstitutionComponent setAllowed(boolean value) {
4024      if (this.allowed == null)
4025        this.allowed = new BooleanType();
4026      this.allowed.setValue(value);
4027      return this;
4028    }
4029
4030    protected void listChildren(List<Property> children) {
4031      super.listChildren(children);
4032      children.add(new Property("type", "CodeableConcept", "Specifies the type of substitution allowed.", 0, 1, type));
4033      children.add(new Property("allowed", "boolean",
4034          "Specifies if regulation allows for changes in the medication when dispensing.", 0, 1, allowed));
4035    }
4036
4037    @Override
4038    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4039      switch (_hash) {
4040      case 3575610:
4041        /* type */ return new Property("type", "CodeableConcept", "Specifies the type of substitution allowed.", 0, 1,
4042            type);
4043      case -911343192:
4044        /* allowed */ return new Property("allowed", "boolean",
4045            "Specifies if regulation allows for changes in the medication when dispensing.", 0, 1, allowed);
4046      default:
4047        return super.getNamedProperty(_hash, _name, _checkValid);
4048      }
4049
4050    }
4051
4052    @Override
4053    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4054      switch (hash) {
4055      case 3575610:
4056        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
4057      case -911343192:
4058        /* allowed */ return this.allowed == null ? new Base[0] : new Base[] { this.allowed }; // BooleanType
4059      default:
4060        return super.getProperty(hash, name, checkValid);
4061      }
4062
4063    }
4064
4065    @Override
4066    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4067      switch (hash) {
4068      case 3575610: // type
4069        this.type = castToCodeableConcept(value); // CodeableConcept
4070        return value;
4071      case -911343192: // allowed
4072        this.allowed = castToBoolean(value); // BooleanType
4073        return value;
4074      default:
4075        return super.setProperty(hash, name, value);
4076      }
4077
4078    }
4079
4080    @Override
4081    public Base setProperty(String name, Base value) throws FHIRException {
4082      if (name.equals("type")) {
4083        this.type = castToCodeableConcept(value); // CodeableConcept
4084      } else if (name.equals("allowed")) {
4085        this.allowed = castToBoolean(value); // BooleanType
4086      } else
4087        return super.setProperty(name, value);
4088      return value;
4089    }
4090
4091    @Override
4092    public Base makeProperty(int hash, String name) throws FHIRException {
4093      switch (hash) {
4094      case 3575610:
4095        return getType();
4096      case -911343192:
4097        return getAllowedElement();
4098      default:
4099        return super.makeProperty(hash, name);
4100      }
4101
4102    }
4103
4104    @Override
4105    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4106      switch (hash) {
4107      case 3575610:
4108        /* type */ return new String[] { "CodeableConcept" };
4109      case -911343192:
4110        /* allowed */ return new String[] { "boolean" };
4111      default:
4112        return super.getTypesForProperty(hash, name);
4113      }
4114
4115    }
4116
4117    @Override
4118    public Base addChild(String name) throws FHIRException {
4119      if (name.equals("type")) {
4120        this.type = new CodeableConcept();
4121        return this.type;
4122      } else if (name.equals("allowed")) {
4123        throw new FHIRException("Cannot call addChild on a singleton property MedicationKnowledge.allowed");
4124      } else
4125        return super.addChild(name);
4126    }
4127
4128    public MedicationKnowledgeRegulatorySubstitutionComponent copy() {
4129      MedicationKnowledgeRegulatorySubstitutionComponent dst = new MedicationKnowledgeRegulatorySubstitutionComponent();
4130      copyValues(dst);
4131      return dst;
4132    }
4133
4134    public void copyValues(MedicationKnowledgeRegulatorySubstitutionComponent dst) {
4135      super.copyValues(dst);
4136      dst.type = type == null ? null : type.copy();
4137      dst.allowed = allowed == null ? null : allowed.copy();
4138    }
4139
4140    @Override
4141    public boolean equalsDeep(Base other_) {
4142      if (!super.equalsDeep(other_))
4143        return false;
4144      if (!(other_ instanceof MedicationKnowledgeRegulatorySubstitutionComponent))
4145        return false;
4146      MedicationKnowledgeRegulatorySubstitutionComponent o = (MedicationKnowledgeRegulatorySubstitutionComponent) other_;
4147      return compareDeep(type, o.type, true) && compareDeep(allowed, o.allowed, true);
4148    }
4149
4150    @Override
4151    public boolean equalsShallow(Base other_) {
4152      if (!super.equalsShallow(other_))
4153        return false;
4154      if (!(other_ instanceof MedicationKnowledgeRegulatorySubstitutionComponent))
4155        return false;
4156      MedicationKnowledgeRegulatorySubstitutionComponent o = (MedicationKnowledgeRegulatorySubstitutionComponent) other_;
4157      return compareValues(allowed, o.allowed, true);
4158    }
4159
4160    public boolean isEmpty() {
4161      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, allowed);
4162    }
4163
4164    public String fhirType() {
4165      return "MedicationKnowledge.regulatory.substitution";
4166
4167    }
4168
4169  }
4170
4171  @Block()
4172  public static class MedicationKnowledgeRegulatoryScheduleComponent extends BackboneElement
4173      implements IBaseBackboneElement {
4174    /**
4175     * Specifies the specific drug schedule.
4176     */
4177    @Child(name = "schedule", type = {
4178        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4179    @Description(shortDefinition = "Specifies the specific drug schedule", formalDefinition = "Specifies the specific drug schedule.")
4180    protected CodeableConcept schedule;
4181
4182    private static final long serialVersionUID = 1955520912L;
4183
4184    /**
4185     * Constructor
4186     */
4187    public MedicationKnowledgeRegulatoryScheduleComponent() {
4188      super();
4189    }
4190
4191    /**
4192     * Constructor
4193     */
4194    public MedicationKnowledgeRegulatoryScheduleComponent(CodeableConcept schedule) {
4195      super();
4196      this.schedule = schedule;
4197    }
4198
4199    /**
4200     * @return {@link #schedule} (Specifies the specific drug schedule.)
4201     */
4202    public CodeableConcept getSchedule() {
4203      if (this.schedule == null)
4204        if (Configuration.errorOnAutoCreate())
4205          throw new Error("Attempt to auto-create MedicationKnowledgeRegulatoryScheduleComponent.schedule");
4206        else if (Configuration.doAutoCreate())
4207          this.schedule = new CodeableConcept(); // cc
4208      return this.schedule;
4209    }
4210
4211    public boolean hasSchedule() {
4212      return this.schedule != null && !this.schedule.isEmpty();
4213    }
4214
4215    /**
4216     * @param value {@link #schedule} (Specifies the specific drug schedule.)
4217     */
4218    public MedicationKnowledgeRegulatoryScheduleComponent setSchedule(CodeableConcept value) {
4219      this.schedule = value;
4220      return this;
4221    }
4222
4223    protected void listChildren(List<Property> children) {
4224      super.listChildren(children);
4225      children
4226          .add(new Property("schedule", "CodeableConcept", "Specifies the specific drug schedule.", 0, 1, schedule));
4227    }
4228
4229    @Override
4230    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4231      switch (_hash) {
4232      case -697920873:
4233        /* schedule */ return new Property("schedule", "CodeableConcept", "Specifies the specific drug schedule.", 0, 1,
4234            schedule);
4235      default:
4236        return super.getNamedProperty(_hash, _name, _checkValid);
4237      }
4238
4239    }
4240
4241    @Override
4242    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4243      switch (hash) {
4244      case -697920873:
4245        /* schedule */ return this.schedule == null ? new Base[0] : new Base[] { this.schedule }; // CodeableConcept
4246      default:
4247        return super.getProperty(hash, name, checkValid);
4248      }
4249
4250    }
4251
4252    @Override
4253    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4254      switch (hash) {
4255      case -697920873: // schedule
4256        this.schedule = castToCodeableConcept(value); // CodeableConcept
4257        return value;
4258      default:
4259        return super.setProperty(hash, name, value);
4260      }
4261
4262    }
4263
4264    @Override
4265    public Base setProperty(String name, Base value) throws FHIRException {
4266      if (name.equals("schedule")) {
4267        this.schedule = castToCodeableConcept(value); // CodeableConcept
4268      } else
4269        return super.setProperty(name, value);
4270      return value;
4271    }
4272
4273    @Override
4274    public Base makeProperty(int hash, String name) throws FHIRException {
4275      switch (hash) {
4276      case -697920873:
4277        return getSchedule();
4278      default:
4279        return super.makeProperty(hash, name);
4280      }
4281
4282    }
4283
4284    @Override
4285    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4286      switch (hash) {
4287      case -697920873:
4288        /* schedule */ return new String[] { "CodeableConcept" };
4289      default:
4290        return super.getTypesForProperty(hash, name);
4291      }
4292
4293    }
4294
4295    @Override
4296    public Base addChild(String name) throws FHIRException {
4297      if (name.equals("schedule")) {
4298        this.schedule = new CodeableConcept();
4299        return this.schedule;
4300      } else
4301        return super.addChild(name);
4302    }
4303
4304    public MedicationKnowledgeRegulatoryScheduleComponent copy() {
4305      MedicationKnowledgeRegulatoryScheduleComponent dst = new MedicationKnowledgeRegulatoryScheduleComponent();
4306      copyValues(dst);
4307      return dst;
4308    }
4309
4310    public void copyValues(MedicationKnowledgeRegulatoryScheduleComponent dst) {
4311      super.copyValues(dst);
4312      dst.schedule = schedule == null ? null : schedule.copy();
4313    }
4314
4315    @Override
4316    public boolean equalsDeep(Base other_) {
4317      if (!super.equalsDeep(other_))
4318        return false;
4319      if (!(other_ instanceof MedicationKnowledgeRegulatoryScheduleComponent))
4320        return false;
4321      MedicationKnowledgeRegulatoryScheduleComponent o = (MedicationKnowledgeRegulatoryScheduleComponent) other_;
4322      return compareDeep(schedule, o.schedule, true);
4323    }
4324
4325    @Override
4326    public boolean equalsShallow(Base other_) {
4327      if (!super.equalsShallow(other_))
4328        return false;
4329      if (!(other_ instanceof MedicationKnowledgeRegulatoryScheduleComponent))
4330        return false;
4331      MedicationKnowledgeRegulatoryScheduleComponent o = (MedicationKnowledgeRegulatoryScheduleComponent) other_;
4332      return true;
4333    }
4334
4335    public boolean isEmpty() {
4336      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(schedule);
4337    }
4338
4339    public String fhirType() {
4340      return "MedicationKnowledge.regulatory.schedule";
4341
4342    }
4343
4344  }
4345
4346  @Block()
4347  public static class MedicationKnowledgeRegulatoryMaxDispenseComponent extends BackboneElement
4348      implements IBaseBackboneElement {
4349    /**
4350     * The maximum number of units of the medication that can be dispensed.
4351     */
4352    @Child(name = "quantity", type = { Quantity.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4353    @Description(shortDefinition = "The maximum number of units of the medication that can be dispensed", formalDefinition = "The maximum number of units of the medication that can be dispensed.")
4354    protected Quantity quantity;
4355
4356    /**
4357     * The period that applies to the maximum number of units.
4358     */
4359    @Child(name = "period", type = { Duration.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
4360    @Description(shortDefinition = "The period that applies to the maximum number of units", formalDefinition = "The period that applies to the maximum number of units.")
4361    protected Duration period;
4362
4363    private static final long serialVersionUID = -441724185L;
4364
4365    /**
4366     * Constructor
4367     */
4368    public MedicationKnowledgeRegulatoryMaxDispenseComponent() {
4369      super();
4370    }
4371
4372    /**
4373     * Constructor
4374     */
4375    public MedicationKnowledgeRegulatoryMaxDispenseComponent(Quantity quantity) {
4376      super();
4377      this.quantity = quantity;
4378    }
4379
4380    /**
4381     * @return {@link #quantity} (The maximum number of units of the medication that
4382     *         can be dispensed.)
4383     */
4384    public Quantity getQuantity() {
4385      if (this.quantity == null)
4386        if (Configuration.errorOnAutoCreate())
4387          throw new Error("Attempt to auto-create MedicationKnowledgeRegulatoryMaxDispenseComponent.quantity");
4388        else if (Configuration.doAutoCreate())
4389          this.quantity = new Quantity(); // cc
4390      return this.quantity;
4391    }
4392
4393    public boolean hasQuantity() {
4394      return this.quantity != null && !this.quantity.isEmpty();
4395    }
4396
4397    /**
4398     * @param value {@link #quantity} (The maximum number of units of the medication
4399     *              that can be dispensed.)
4400     */
4401    public MedicationKnowledgeRegulatoryMaxDispenseComponent setQuantity(Quantity value) {
4402      this.quantity = value;
4403      return this;
4404    }
4405
4406    /**
4407     * @return {@link #period} (The period that applies to the maximum number of
4408     *         units.)
4409     */
4410    public Duration getPeriod() {
4411      if (this.period == null)
4412        if (Configuration.errorOnAutoCreate())
4413          throw new Error("Attempt to auto-create MedicationKnowledgeRegulatoryMaxDispenseComponent.period");
4414        else if (Configuration.doAutoCreate())
4415          this.period = new Duration(); // cc
4416      return this.period;
4417    }
4418
4419    public boolean hasPeriod() {
4420      return this.period != null && !this.period.isEmpty();
4421    }
4422
4423    /**
4424     * @param value {@link #period} (The period that applies to the maximum number
4425     *              of units.)
4426     */
4427    public MedicationKnowledgeRegulatoryMaxDispenseComponent setPeriod(Duration value) {
4428      this.period = value;
4429      return this;
4430    }
4431
4432    protected void listChildren(List<Property> children) {
4433      super.listChildren(children);
4434      children.add(new Property("quantity", "SimpleQuantity",
4435          "The maximum number of units of the medication that can be dispensed.", 0, 1, quantity));
4436      children.add(
4437          new Property("period", "Duration", "The period that applies to the maximum number of units.", 0, 1, period));
4438    }
4439
4440    @Override
4441    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4442      switch (_hash) {
4443      case -1285004149:
4444        /* quantity */ return new Property("quantity", "SimpleQuantity",
4445            "The maximum number of units of the medication that can be dispensed.", 0, 1, quantity);
4446      case -991726143:
4447        /* period */ return new Property("period", "Duration",
4448            "The period that applies to the maximum number of units.", 0, 1, period);
4449      default:
4450        return super.getNamedProperty(_hash, _name, _checkValid);
4451      }
4452
4453    }
4454
4455    @Override
4456    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4457      switch (hash) {
4458      case -1285004149:
4459        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
4460      case -991726143:
4461        /* period */ return this.period == null ? new Base[0] : new Base[] { this.period }; // Duration
4462      default:
4463        return super.getProperty(hash, name, checkValid);
4464      }
4465
4466    }
4467
4468    @Override
4469    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4470      switch (hash) {
4471      case -1285004149: // quantity
4472        this.quantity = castToQuantity(value); // Quantity
4473        return value;
4474      case -991726143: // period
4475        this.period = castToDuration(value); // Duration
4476        return value;
4477      default:
4478        return super.setProperty(hash, name, value);
4479      }
4480
4481    }
4482
4483    @Override
4484    public Base setProperty(String name, Base value) throws FHIRException {
4485      if (name.equals("quantity")) {
4486        this.quantity = castToQuantity(value); // Quantity
4487      } else if (name.equals("period")) {
4488        this.period = castToDuration(value); // Duration
4489      } else
4490        return super.setProperty(name, value);
4491      return value;
4492    }
4493
4494    @Override
4495    public Base makeProperty(int hash, String name) throws FHIRException {
4496      switch (hash) {
4497      case -1285004149:
4498        return getQuantity();
4499      case -991726143:
4500        return getPeriod();
4501      default:
4502        return super.makeProperty(hash, name);
4503      }
4504
4505    }
4506
4507    @Override
4508    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4509      switch (hash) {
4510      case -1285004149:
4511        /* quantity */ return new String[] { "SimpleQuantity" };
4512      case -991726143:
4513        /* period */ return new String[] { "Duration" };
4514      default:
4515        return super.getTypesForProperty(hash, name);
4516      }
4517
4518    }
4519
4520    @Override
4521    public Base addChild(String name) throws FHIRException {
4522      if (name.equals("quantity")) {
4523        this.quantity = new Quantity();
4524        return this.quantity;
4525      } else if (name.equals("period")) {
4526        this.period = new Duration();
4527        return this.period;
4528      } else
4529        return super.addChild(name);
4530    }
4531
4532    public MedicationKnowledgeRegulatoryMaxDispenseComponent copy() {
4533      MedicationKnowledgeRegulatoryMaxDispenseComponent dst = new MedicationKnowledgeRegulatoryMaxDispenseComponent();
4534      copyValues(dst);
4535      return dst;
4536    }
4537
4538    public void copyValues(MedicationKnowledgeRegulatoryMaxDispenseComponent dst) {
4539      super.copyValues(dst);
4540      dst.quantity = quantity == null ? null : quantity.copy();
4541      dst.period = period == null ? null : period.copy();
4542    }
4543
4544    @Override
4545    public boolean equalsDeep(Base other_) {
4546      if (!super.equalsDeep(other_))
4547        return false;
4548      if (!(other_ instanceof MedicationKnowledgeRegulatoryMaxDispenseComponent))
4549        return false;
4550      MedicationKnowledgeRegulatoryMaxDispenseComponent o = (MedicationKnowledgeRegulatoryMaxDispenseComponent) other_;
4551      return compareDeep(quantity, o.quantity, true) && compareDeep(period, o.period, true);
4552    }
4553
4554    @Override
4555    public boolean equalsShallow(Base other_) {
4556      if (!super.equalsShallow(other_))
4557        return false;
4558      if (!(other_ instanceof MedicationKnowledgeRegulatoryMaxDispenseComponent))
4559        return false;
4560      MedicationKnowledgeRegulatoryMaxDispenseComponent o = (MedicationKnowledgeRegulatoryMaxDispenseComponent) other_;
4561      return true;
4562    }
4563
4564    public boolean isEmpty() {
4565      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(quantity, period);
4566    }
4567
4568    public String fhirType() {
4569      return "MedicationKnowledge.regulatory.maxDispense";
4570
4571    }
4572
4573  }
4574
4575  @Block()
4576  public static class MedicationKnowledgeKineticsComponent extends BackboneElement implements IBaseBackboneElement {
4577    /**
4578     * The drug concentration measured at certain discrete points in time.
4579     */
4580    @Child(name = "areaUnderCurve", type = {
4581        Quantity.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4582    @Description(shortDefinition = "The drug concentration measured at certain discrete points in time", formalDefinition = "The drug concentration measured at certain discrete points in time.")
4583    protected List<Quantity> areaUnderCurve;
4584
4585    /**
4586     * The median lethal dose of a drug.
4587     */
4588    @Child(name = "lethalDose50", type = {
4589        Quantity.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4590    @Description(shortDefinition = "The median lethal dose of a drug", formalDefinition = "The median lethal dose of a drug.")
4591    protected List<Quantity> lethalDose50;
4592
4593    /**
4594     * The time required for any specified property (e.g., the concentration of a
4595     * substance in the body) to decrease by half.
4596     */
4597    @Child(name = "halfLifePeriod", type = {
4598        Duration.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
4599    @Description(shortDefinition = "Time required for concentration in the body to decrease by half", formalDefinition = "The time required for any specified property (e.g., the concentration of a substance in the body) to decrease by half.")
4600    protected Duration halfLifePeriod;
4601
4602    private static final long serialVersionUID = -206244264L;
4603
4604    /**
4605     * Constructor
4606     */
4607    public MedicationKnowledgeKineticsComponent() {
4608      super();
4609    }
4610
4611    /**
4612     * @return {@link #areaUnderCurve} (The drug concentration measured at certain
4613     *         discrete points in time.)
4614     */
4615    public List<Quantity> getAreaUnderCurve() {
4616      if (this.areaUnderCurve == null)
4617        this.areaUnderCurve = new ArrayList<Quantity>();
4618      return this.areaUnderCurve;
4619    }
4620
4621    /**
4622     * @return Returns a reference to <code>this</code> for easy method chaining
4623     */
4624    public MedicationKnowledgeKineticsComponent setAreaUnderCurve(List<Quantity> theAreaUnderCurve) {
4625      this.areaUnderCurve = theAreaUnderCurve;
4626      return this;
4627    }
4628
4629    public boolean hasAreaUnderCurve() {
4630      if (this.areaUnderCurve == null)
4631        return false;
4632      for (Quantity item : this.areaUnderCurve)
4633        if (!item.isEmpty())
4634          return true;
4635      return false;
4636    }
4637
4638    public Quantity addAreaUnderCurve() { // 3
4639      Quantity t = new Quantity();
4640      if (this.areaUnderCurve == null)
4641        this.areaUnderCurve = new ArrayList<Quantity>();
4642      this.areaUnderCurve.add(t);
4643      return t;
4644    }
4645
4646    public MedicationKnowledgeKineticsComponent addAreaUnderCurve(Quantity t) { // 3
4647      if (t == null)
4648        return this;
4649      if (this.areaUnderCurve == null)
4650        this.areaUnderCurve = new ArrayList<Quantity>();
4651      this.areaUnderCurve.add(t);
4652      return this;
4653    }
4654
4655    /**
4656     * @return The first repetition of repeating field {@link #areaUnderCurve},
4657     *         creating it if it does not already exist
4658     */
4659    public Quantity getAreaUnderCurveFirstRep() {
4660      if (getAreaUnderCurve().isEmpty()) {
4661        addAreaUnderCurve();
4662      }
4663      return getAreaUnderCurve().get(0);
4664    }
4665
4666    /**
4667     * @return {@link #lethalDose50} (The median lethal dose of a drug.)
4668     */
4669    public List<Quantity> getLethalDose50() {
4670      if (this.lethalDose50 == null)
4671        this.lethalDose50 = new ArrayList<Quantity>();
4672      return this.lethalDose50;
4673    }
4674
4675    /**
4676     * @return Returns a reference to <code>this</code> for easy method chaining
4677     */
4678    public MedicationKnowledgeKineticsComponent setLethalDose50(List<Quantity> theLethalDose50) {
4679      this.lethalDose50 = theLethalDose50;
4680      return this;
4681    }
4682
4683    public boolean hasLethalDose50() {
4684      if (this.lethalDose50 == null)
4685        return false;
4686      for (Quantity item : this.lethalDose50)
4687        if (!item.isEmpty())
4688          return true;
4689      return false;
4690    }
4691
4692    public Quantity addLethalDose50() { // 3
4693      Quantity t = new Quantity();
4694      if (this.lethalDose50 == null)
4695        this.lethalDose50 = new ArrayList<Quantity>();
4696      this.lethalDose50.add(t);
4697      return t;
4698    }
4699
4700    public MedicationKnowledgeKineticsComponent addLethalDose50(Quantity t) { // 3
4701      if (t == null)
4702        return this;
4703      if (this.lethalDose50 == null)
4704        this.lethalDose50 = new ArrayList<Quantity>();
4705      this.lethalDose50.add(t);
4706      return this;
4707    }
4708
4709    /**
4710     * @return The first repetition of repeating field {@link #lethalDose50},
4711     *         creating it if it does not already exist
4712     */
4713    public Quantity getLethalDose50FirstRep() {
4714      if (getLethalDose50().isEmpty()) {
4715        addLethalDose50();
4716      }
4717      return getLethalDose50().get(0);
4718    }
4719
4720    /**
4721     * @return {@link #halfLifePeriod} (The time required for any specified property
4722     *         (e.g., the concentration of a substance in the body) to decrease by
4723     *         half.)
4724     */
4725    public Duration getHalfLifePeriod() {
4726      if (this.halfLifePeriod == null)
4727        if (Configuration.errorOnAutoCreate())
4728          throw new Error("Attempt to auto-create MedicationKnowledgeKineticsComponent.halfLifePeriod");
4729        else if (Configuration.doAutoCreate())
4730          this.halfLifePeriod = new Duration(); // cc
4731      return this.halfLifePeriod;
4732    }
4733
4734    public boolean hasHalfLifePeriod() {
4735      return this.halfLifePeriod != null && !this.halfLifePeriod.isEmpty();
4736    }
4737
4738    /**
4739     * @param value {@link #halfLifePeriod} (The time required for any specified
4740     *              property (e.g., the concentration of a substance in the body) to
4741     *              decrease by half.)
4742     */
4743    public MedicationKnowledgeKineticsComponent setHalfLifePeriod(Duration value) {
4744      this.halfLifePeriod = value;
4745      return this;
4746    }
4747
4748    protected void listChildren(List<Property> children) {
4749      super.listChildren(children);
4750      children.add(new Property("areaUnderCurve", "SimpleQuantity",
4751          "The drug concentration measured at certain discrete points in time.", 0, java.lang.Integer.MAX_VALUE,
4752          areaUnderCurve));
4753      children.add(new Property("lethalDose50", "SimpleQuantity", "The median lethal dose of a drug.", 0,
4754          java.lang.Integer.MAX_VALUE, lethalDose50));
4755      children.add(new Property("halfLifePeriod", "Duration",
4756          "The time required for any specified property (e.g., the concentration of a substance in the body) to decrease by half.",
4757          0, 1, halfLifePeriod));
4758    }
4759
4760    @Override
4761    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4762      switch (_hash) {
4763      case 1243936100:
4764        /* areaUnderCurve */ return new Property("areaUnderCurve", "SimpleQuantity",
4765            "The drug concentration measured at certain discrete points in time.", 0, java.lang.Integer.MAX_VALUE,
4766            areaUnderCurve);
4767      case 302983216:
4768        /* lethalDose50 */ return new Property("lethalDose50", "SimpleQuantity", "The median lethal dose of a drug.", 0,
4769            java.lang.Integer.MAX_VALUE, lethalDose50);
4770      case -628810640:
4771        /* halfLifePeriod */ return new Property("halfLifePeriod", "Duration",
4772            "The time required for any specified property (e.g., the concentration of a substance in the body) to decrease by half.",
4773            0, 1, halfLifePeriod);
4774      default:
4775        return super.getNamedProperty(_hash, _name, _checkValid);
4776      }
4777
4778    }
4779
4780    @Override
4781    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4782      switch (hash) {
4783      case 1243936100:
4784        /* areaUnderCurve */ return this.areaUnderCurve == null ? new Base[0]
4785            : this.areaUnderCurve.toArray(new Base[this.areaUnderCurve.size()]); // Quantity
4786      case 302983216:
4787        /* lethalDose50 */ return this.lethalDose50 == null ? new Base[0]
4788            : this.lethalDose50.toArray(new Base[this.lethalDose50.size()]); // Quantity
4789      case -628810640:
4790        /* halfLifePeriod */ return this.halfLifePeriod == null ? new Base[0] : new Base[] { this.halfLifePeriod }; // Duration
4791      default:
4792        return super.getProperty(hash, name, checkValid);
4793      }
4794
4795    }
4796
4797    @Override
4798    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4799      switch (hash) {
4800      case 1243936100: // areaUnderCurve
4801        this.getAreaUnderCurve().add(castToQuantity(value)); // Quantity
4802        return value;
4803      case 302983216: // lethalDose50
4804        this.getLethalDose50().add(castToQuantity(value)); // Quantity
4805        return value;
4806      case -628810640: // halfLifePeriod
4807        this.halfLifePeriod = castToDuration(value); // Duration
4808        return value;
4809      default:
4810        return super.setProperty(hash, name, value);
4811      }
4812
4813    }
4814
4815    @Override
4816    public Base setProperty(String name, Base value) throws FHIRException {
4817      if (name.equals("areaUnderCurve")) {
4818        this.getAreaUnderCurve().add(castToQuantity(value));
4819      } else if (name.equals("lethalDose50")) {
4820        this.getLethalDose50().add(castToQuantity(value));
4821      } else if (name.equals("halfLifePeriod")) {
4822        this.halfLifePeriod = castToDuration(value); // Duration
4823      } else
4824        return super.setProperty(name, value);
4825      return value;
4826    }
4827
4828    @Override
4829    public Base makeProperty(int hash, String name) throws FHIRException {
4830      switch (hash) {
4831      case 1243936100:
4832        return addAreaUnderCurve();
4833      case 302983216:
4834        return addLethalDose50();
4835      case -628810640:
4836        return getHalfLifePeriod();
4837      default:
4838        return super.makeProperty(hash, name);
4839      }
4840
4841    }
4842
4843    @Override
4844    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4845      switch (hash) {
4846      case 1243936100:
4847        /* areaUnderCurve */ return new String[] { "SimpleQuantity" };
4848      case 302983216:
4849        /* lethalDose50 */ return new String[] { "SimpleQuantity" };
4850      case -628810640:
4851        /* halfLifePeriod */ return new String[] { "Duration" };
4852      default:
4853        return super.getTypesForProperty(hash, name);
4854      }
4855
4856    }
4857
4858    @Override
4859    public Base addChild(String name) throws FHIRException {
4860      if (name.equals("areaUnderCurve")) {
4861        return addAreaUnderCurve();
4862      } else if (name.equals("lethalDose50")) {
4863        return addLethalDose50();
4864      } else if (name.equals("halfLifePeriod")) {
4865        this.halfLifePeriod = new Duration();
4866        return this.halfLifePeriod;
4867      } else
4868        return super.addChild(name);
4869    }
4870
4871    public MedicationKnowledgeKineticsComponent copy() {
4872      MedicationKnowledgeKineticsComponent dst = new MedicationKnowledgeKineticsComponent();
4873      copyValues(dst);
4874      return dst;
4875    }
4876
4877    public void copyValues(MedicationKnowledgeKineticsComponent dst) {
4878      super.copyValues(dst);
4879      if (areaUnderCurve != null) {
4880        dst.areaUnderCurve = new ArrayList<Quantity>();
4881        for (Quantity i : areaUnderCurve)
4882          dst.areaUnderCurve.add(i.copy());
4883      }
4884      ;
4885      if (lethalDose50 != null) {
4886        dst.lethalDose50 = new ArrayList<Quantity>();
4887        for (Quantity i : lethalDose50)
4888          dst.lethalDose50.add(i.copy());
4889      }
4890      ;
4891      dst.halfLifePeriod = halfLifePeriod == null ? null : halfLifePeriod.copy();
4892    }
4893
4894    @Override
4895    public boolean equalsDeep(Base other_) {
4896      if (!super.equalsDeep(other_))
4897        return false;
4898      if (!(other_ instanceof MedicationKnowledgeKineticsComponent))
4899        return false;
4900      MedicationKnowledgeKineticsComponent o = (MedicationKnowledgeKineticsComponent) other_;
4901      return compareDeep(areaUnderCurve, o.areaUnderCurve, true) && compareDeep(lethalDose50, o.lethalDose50, true)
4902          && compareDeep(halfLifePeriod, o.halfLifePeriod, true);
4903    }
4904
4905    @Override
4906    public boolean equalsShallow(Base other_) {
4907      if (!super.equalsShallow(other_))
4908        return false;
4909      if (!(other_ instanceof MedicationKnowledgeKineticsComponent))
4910        return false;
4911      MedicationKnowledgeKineticsComponent o = (MedicationKnowledgeKineticsComponent) other_;
4912      return true;
4913    }
4914
4915    public boolean isEmpty() {
4916      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(areaUnderCurve, lethalDose50, halfLifePeriod);
4917    }
4918
4919    public String fhirType() {
4920      return "MedicationKnowledge.kinetics";
4921
4922    }
4923
4924  }
4925
4926  /**
4927   * A code that specifies this medication, or a textual description if no code is
4928   * available. Usage note: This could be a standard medication code such as a
4929   * code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local
4930   * formulary code, optionally with translations to other code systems.
4931   */
4932  @Child(name = "code", type = { CodeableConcept.class }, order = 0, min = 0, max = 1, modifier = false, summary = true)
4933  @Description(shortDefinition = "Code that identifies this medication", formalDefinition = "A code that specifies this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.")
4934  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medication-codes")
4935  protected CodeableConcept code;
4936
4937  /**
4938   * A code to indicate if the medication is in active use. The status refers to
4939   * the validity about the information of the medication and not to its medicinal
4940   * properties.
4941   */
4942  @Child(name = "status", type = { CodeType.class }, order = 1, min = 0, max = 1, modifier = true, summary = true)
4943  @Description(shortDefinition = "active | inactive | entered-in-error", formalDefinition = "A code to indicate if the medication is in active use.  The status refers to the validity about the information of the medication and not to its medicinal properties.")
4944  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medicationknowledge-status")
4945  protected Enumeration<MedicationKnowledgeStatus> status;
4946
4947  /**
4948   * Describes the details of the manufacturer of the medication product. This is
4949   * not intended to represent the distributor of a medication product.
4950   */
4951  @Child(name = "manufacturer", type = {
4952      Organization.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
4953  @Description(shortDefinition = "Manufacturer of the item", formalDefinition = "Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.")
4954  protected Reference manufacturer;
4955
4956  /**
4957   * The actual object that is the target of the reference (Describes the details
4958   * of the manufacturer of the medication product. This is not intended to
4959   * represent the distributor of a medication product.)
4960   */
4961  protected Organization manufacturerTarget;
4962
4963  /**
4964   * Describes the form of the item. Powder; tablets; capsule.
4965   */
4966  @Child(name = "doseForm", type = {
4967      CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
4968  @Description(shortDefinition = "powder | tablets | capsule +", formalDefinition = "Describes the form of the item.  Powder; tablets; capsule.")
4969  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medication-form-codes")
4970  protected CodeableConcept doseForm;
4971
4972  /**
4973   * Specific amount of the drug in the packaged product. For example, when
4974   * specifying a product that has the same strength (For example, Insulin
4975   * glargine 100 unit per mL solution for injection), this attribute provides
4976   * additional clarification of the package amount (For example, 3 mL, 10mL,
4977   * etc.).
4978   */
4979  @Child(name = "amount", type = { Quantity.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
4980  @Description(shortDefinition = "Amount of drug in package", formalDefinition = "Specific amount of the drug in the packaged product.  For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).")
4981  protected Quantity amount;
4982
4983  /**
4984   * Additional names for a medication, for example, the name(s) given to a
4985   * medication in different countries. For example, acetaminophen and paracetamol
4986   * or salbutamol and albuterol.
4987   */
4988  @Child(name = "synonym", type = {
4989      StringType.class }, order = 5, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
4990  @Description(shortDefinition = "Additional names for a medication", formalDefinition = "Additional names for a medication, for example, the name(s) given to a medication in different countries.  For example, acetaminophen and paracetamol or salbutamol and albuterol.")
4991  protected List<StringType> synonym;
4992
4993  /**
4994   * Associated or related knowledge about a medication.
4995   */
4996  @Child(name = "relatedMedicationKnowledge", type = {}, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4997  @Description(shortDefinition = "Associated or related medication information", formalDefinition = "Associated or related knowledge about a medication.")
4998  protected List<MedicationKnowledgeRelatedMedicationKnowledgeComponent> relatedMedicationKnowledge;
4999
5000  /**
5001   * Associated or related medications. For example, if the medication is a
5002   * branded product (e.g. Crestor), this is the Therapeutic Moeity (e.g.
5003   * Rosuvastatin) or if this is a generic medication (e.g. Rosuvastatin), this
5004   * would link to a branded product (e.g. Crestor).
5005   */
5006  @Child(name = "associatedMedication", type = {
5007      Medication.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5008  @Description(shortDefinition = "A medication resource that is associated with this medication", formalDefinition = "Associated or related medications.  For example, if the medication is a branded product (e.g. Crestor), this is the Therapeutic Moeity (e.g. Rosuvastatin) or if this is a generic medication (e.g. Rosuvastatin), this would link to a branded product (e.g. Crestor).")
5009  protected List<Reference> associatedMedication;
5010  /**
5011   * The actual objects that are the target of the reference (Associated or
5012   * related medications. For example, if the medication is a branded product
5013   * (e.g. Crestor), this is the Therapeutic Moeity (e.g. Rosuvastatin) or if this
5014   * is a generic medication (e.g. Rosuvastatin), this would link to a branded
5015   * product (e.g. Crestor).)
5016   */
5017  protected List<Medication> associatedMedicationTarget;
5018
5019  /**
5020   * Category of the medication or product (e.g. branded product, therapeutic
5021   * moeity, generic product, innovator product, etc.).
5022   */
5023  @Child(name = "productType", type = {
5024      CodeableConcept.class }, order = 8, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5025  @Description(shortDefinition = "Category of the medication or product", formalDefinition = "Category of the medication or product (e.g. branded product, therapeutic moeity, generic product, innovator product, etc.).")
5026  protected List<CodeableConcept> productType;
5027
5028  /**
5029   * Associated documentation about the medication.
5030   */
5031  @Child(name = "monograph", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5032  @Description(shortDefinition = "Associated documentation about the medication", formalDefinition = "Associated documentation about the medication.")
5033  protected List<MedicationKnowledgeMonographComponent> monograph;
5034
5035  /**
5036   * Identifies a particular constituent of interest in the product.
5037   */
5038  @Child(name = "ingredient", type = {}, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5039  @Description(shortDefinition = "Active or inactive ingredient", formalDefinition = "Identifies a particular constituent of interest in the product.")
5040  protected List<MedicationKnowledgeIngredientComponent> ingredient;
5041
5042  /**
5043   * The instructions for preparing the medication.
5044   */
5045  @Child(name = "preparationInstruction", type = {
5046      MarkdownType.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
5047  @Description(shortDefinition = "The instructions for preparing the medication", formalDefinition = "The instructions for preparing the medication.")
5048  protected MarkdownType preparationInstruction;
5049
5050  /**
5051   * The intended or approved route of administration.
5052   */
5053  @Child(name = "intendedRoute", type = {
5054      CodeableConcept.class }, order = 12, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5055  @Description(shortDefinition = "The intended or approved route of administration", formalDefinition = "The intended or approved route of administration.")
5056  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/route-codes")
5057  protected List<CodeableConcept> intendedRoute;
5058
5059  /**
5060   * The price of the medication.
5061   */
5062  @Child(name = "cost", type = {}, order = 13, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5063  @Description(shortDefinition = "The pricing of the medication", formalDefinition = "The price of the medication.")
5064  protected List<MedicationKnowledgeCostComponent> cost;
5065
5066  /**
5067   * The program under which the medication is reviewed.
5068   */
5069  @Child(name = "monitoringProgram", type = {}, order = 14, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5070  @Description(shortDefinition = "Program under which a medication is reviewed", formalDefinition = "The program under which the medication is reviewed.")
5071  protected List<MedicationKnowledgeMonitoringProgramComponent> monitoringProgram;
5072
5073  /**
5074   * Guidelines for the administration of the medication.
5075   */
5076  @Child(name = "administrationGuidelines", type = {}, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5077  @Description(shortDefinition = "Guidelines for administration of the medication", formalDefinition = "Guidelines for the administration of the medication.")
5078  protected List<MedicationKnowledgeAdministrationGuidelinesComponent> administrationGuidelines;
5079
5080  /**
5081   * Categorization of the medication within a formulary or classification system.
5082   */
5083  @Child(name = "medicineClassification", type = {}, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5084  @Description(shortDefinition = "Categorization of the medication within a formulary or classification system", formalDefinition = "Categorization of the medication within a formulary or classification system.")
5085  protected List<MedicationKnowledgeMedicineClassificationComponent> medicineClassification;
5086
5087  /**
5088   * Information that only applies to packages (not products).
5089   */
5090  @Child(name = "packaging", type = {}, order = 17, min = 0, max = 1, modifier = false, summary = false)
5091  @Description(shortDefinition = "Details about packaged medications", formalDefinition = "Information that only applies to packages (not products).")
5092  protected MedicationKnowledgePackagingComponent packaging;
5093
5094  /**
5095   * Specifies descriptive properties of the medicine, such as color, shape,
5096   * imprints, etc.
5097   */
5098  @Child(name = "drugCharacteristic", type = {}, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5099  @Description(shortDefinition = "Specifies descriptive properties of the medicine", formalDefinition = "Specifies descriptive properties of the medicine, such as color, shape, imprints, etc.")
5100  protected List<MedicationKnowledgeDrugCharacteristicComponent> drugCharacteristic;
5101
5102  /**
5103   * Potential clinical issue with or between medication(s) (for example,
5104   * drug-drug interaction, drug-disease contraindication, drug-allergy
5105   * interaction, etc.).
5106   */
5107  @Child(name = "contraindication", type = {
5108      DetectedIssue.class }, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5109  @Description(shortDefinition = "Potential clinical issue with or between medication(s)", formalDefinition = "Potential clinical issue with or between medication(s) (for example, drug-drug interaction, drug-disease contraindication, drug-allergy interaction, etc.).")
5110  protected List<Reference> contraindication;
5111  /**
5112   * The actual objects that are the target of the reference (Potential clinical
5113   * issue with or between medication(s) (for example, drug-drug interaction,
5114   * drug-disease contraindication, drug-allergy interaction, etc.).)
5115   */
5116  protected List<DetectedIssue> contraindicationTarget;
5117
5118  /**
5119   * Regulatory information about a medication.
5120   */
5121  @Child(name = "regulatory", type = {}, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5122  @Description(shortDefinition = "Regulatory information about a medication", formalDefinition = "Regulatory information about a medication.")
5123  protected List<MedicationKnowledgeRegulatoryComponent> regulatory;
5124
5125  /**
5126   * The time course of drug absorption, distribution, metabolism and excretion of
5127   * a medication from the body.
5128   */
5129  @Child(name = "kinetics", type = {}, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
5130  @Description(shortDefinition = "The time course of drug absorption, distribution, metabolism and excretion of a medication from the body", formalDefinition = "The time course of drug absorption, distribution, metabolism and excretion of a medication from the body.")
5131  protected List<MedicationKnowledgeKineticsComponent> kinetics;
5132
5133  private static final long serialVersionUID = -1230067857L;
5134
5135  /**
5136   * Constructor
5137   */
5138  public MedicationKnowledge() {
5139    super();
5140  }
5141
5142  /**
5143   * @return {@link #code} (A code that specifies this medication, or a textual
5144   *         description if no code is available. Usage note: This could be a
5145   *         standard medication code such as a code from RxNorm, SNOMED CT, IDMP
5146   *         etc. It could also be a national or local formulary code, optionally
5147   *         with translations to other code systems.)
5148   */
5149  public CodeableConcept getCode() {
5150    if (this.code == null)
5151      if (Configuration.errorOnAutoCreate())
5152        throw new Error("Attempt to auto-create MedicationKnowledge.code");
5153      else if (Configuration.doAutoCreate())
5154        this.code = new CodeableConcept(); // cc
5155    return this.code;
5156  }
5157
5158  public boolean hasCode() {
5159    return this.code != null && !this.code.isEmpty();
5160  }
5161
5162  /**
5163   * @param value {@link #code} (A code that specifies this medication, or a
5164   *              textual description if no code is available. Usage note: This
5165   *              could be a standard medication code such as a code from RxNorm,
5166   *              SNOMED CT, IDMP etc. It could also be a national or local
5167   *              formulary code, optionally with translations to other code
5168   *              systems.)
5169   */
5170  public MedicationKnowledge setCode(CodeableConcept value) {
5171    this.code = value;
5172    return this;
5173  }
5174
5175  /**
5176   * @return {@link #status} (A code to indicate if the medication is in active
5177   *         use. The status refers to the validity about the information of the
5178   *         medication and not to its medicinal properties.). This is the
5179   *         underlying object with id, value and extensions. The accessor
5180   *         "getStatus" gives direct access to the value
5181   */
5182  public Enumeration<MedicationKnowledgeStatus> getStatusElement() {
5183    if (this.status == null)
5184      if (Configuration.errorOnAutoCreate())
5185        throw new Error("Attempt to auto-create MedicationKnowledge.status");
5186      else if (Configuration.doAutoCreate())
5187        this.status = new Enumeration<MedicationKnowledgeStatus>(new MedicationKnowledgeStatusEnumFactory()); // bb
5188    return this.status;
5189  }
5190
5191  public boolean hasStatusElement() {
5192    return this.status != null && !this.status.isEmpty();
5193  }
5194
5195  public boolean hasStatus() {
5196    return this.status != null && !this.status.isEmpty();
5197  }
5198
5199  /**
5200   * @param value {@link #status} (A code to indicate if the medication is in
5201   *              active use. The status refers to the validity about the
5202   *              information of the medication and not to its medicinal
5203   *              properties.). This is the underlying object with id, value and
5204   *              extensions. The accessor "getStatus" gives direct access to the
5205   *              value
5206   */
5207  public MedicationKnowledge setStatusElement(Enumeration<MedicationKnowledgeStatus> value) {
5208    this.status = value;
5209    return this;
5210  }
5211
5212  /**
5213   * @return A code to indicate if the medication is in active use. The status
5214   *         refers to the validity about the information of the medication and
5215   *         not to its medicinal properties.
5216   */
5217  public MedicationKnowledgeStatus getStatus() {
5218    return this.status == null ? null : this.status.getValue();
5219  }
5220
5221  /**
5222   * @param value A code to indicate if the medication is in active use. The
5223   *              status refers to the validity about the information of the
5224   *              medication and not to its medicinal properties.
5225   */
5226  public MedicationKnowledge setStatus(MedicationKnowledgeStatus value) {
5227    if (value == null)
5228      this.status = null;
5229    else {
5230      if (this.status == null)
5231        this.status = new Enumeration<MedicationKnowledgeStatus>(new MedicationKnowledgeStatusEnumFactory());
5232      this.status.setValue(value);
5233    }
5234    return this;
5235  }
5236
5237  /**
5238   * @return {@link #manufacturer} (Describes the details of the manufacturer of
5239   *         the medication product. This is not intended to represent the
5240   *         distributor of a medication product.)
5241   */
5242  public Reference getManufacturer() {
5243    if (this.manufacturer == null)
5244      if (Configuration.errorOnAutoCreate())
5245        throw new Error("Attempt to auto-create MedicationKnowledge.manufacturer");
5246      else if (Configuration.doAutoCreate())
5247        this.manufacturer = new Reference(); // cc
5248    return this.manufacturer;
5249  }
5250
5251  public boolean hasManufacturer() {
5252    return this.manufacturer != null && !this.manufacturer.isEmpty();
5253  }
5254
5255  /**
5256   * @param value {@link #manufacturer} (Describes the details of the manufacturer
5257   *              of the medication product. This is not intended to represent the
5258   *              distributor of a medication product.)
5259   */
5260  public MedicationKnowledge setManufacturer(Reference value) {
5261    this.manufacturer = value;
5262    return this;
5263  }
5264
5265  /**
5266   * @return {@link #manufacturer} The actual object that is the target of the
5267   *         reference. The reference library doesn't populate this, but you can
5268   *         use it to hold the resource if you resolve it. (Describes the details
5269   *         of the manufacturer of the medication product. This is not intended
5270   *         to represent the distributor of a medication product.)
5271   */
5272  public Organization getManufacturerTarget() {
5273    if (this.manufacturerTarget == null)
5274      if (Configuration.errorOnAutoCreate())
5275        throw new Error("Attempt to auto-create MedicationKnowledge.manufacturer");
5276      else if (Configuration.doAutoCreate())
5277        this.manufacturerTarget = new Organization(); // aa
5278    return this.manufacturerTarget;
5279  }
5280
5281  /**
5282   * @param value {@link #manufacturer} The actual object that is the target of
5283   *              the reference. The reference library doesn't use these, but you
5284   *              can use it to hold the resource if you resolve it. (Describes
5285   *              the details of the manufacturer of the medication product. This
5286   *              is not intended to represent the distributor of a medication
5287   *              product.)
5288   */
5289  public MedicationKnowledge setManufacturerTarget(Organization value) {
5290    this.manufacturerTarget = value;
5291    return this;
5292  }
5293
5294  /**
5295   * @return {@link #doseForm} (Describes the form of the item. Powder; tablets;
5296   *         capsule.)
5297   */
5298  public CodeableConcept getDoseForm() {
5299    if (this.doseForm == null)
5300      if (Configuration.errorOnAutoCreate())
5301        throw new Error("Attempt to auto-create MedicationKnowledge.doseForm");
5302      else if (Configuration.doAutoCreate())
5303        this.doseForm = new CodeableConcept(); // cc
5304    return this.doseForm;
5305  }
5306
5307  public boolean hasDoseForm() {
5308    return this.doseForm != null && !this.doseForm.isEmpty();
5309  }
5310
5311  /**
5312   * @param value {@link #doseForm} (Describes the form of the item. Powder;
5313   *              tablets; capsule.)
5314   */
5315  public MedicationKnowledge setDoseForm(CodeableConcept value) {
5316    this.doseForm = value;
5317    return this;
5318  }
5319
5320  /**
5321   * @return {@link #amount} (Specific amount of the drug in the packaged product.
5322   *         For example, when specifying a product that has the same strength
5323   *         (For example, Insulin glargine 100 unit per mL solution for
5324   *         injection), this attribute provides additional clarification of the
5325   *         package amount (For example, 3 mL, 10mL, etc.).)
5326   */
5327  public Quantity getAmount() {
5328    if (this.amount == null)
5329      if (Configuration.errorOnAutoCreate())
5330        throw new Error("Attempt to auto-create MedicationKnowledge.amount");
5331      else if (Configuration.doAutoCreate())
5332        this.amount = new Quantity(); // cc
5333    return this.amount;
5334  }
5335
5336  public boolean hasAmount() {
5337    return this.amount != null && !this.amount.isEmpty();
5338  }
5339
5340  /**
5341   * @param value {@link #amount} (Specific amount of the drug in the packaged
5342   *              product. For example, when specifying a product that has the
5343   *              same strength (For example, Insulin glargine 100 unit per mL
5344   *              solution for injection), this attribute provides additional
5345   *              clarification of the package amount (For example, 3 mL, 10mL,
5346   *              etc.).)
5347   */
5348  public MedicationKnowledge setAmount(Quantity value) {
5349    this.amount = value;
5350    return this;
5351  }
5352
5353  /**
5354   * @return {@link #synonym} (Additional names for a medication, for example, the
5355   *         name(s) given to a medication in different countries. For example,
5356   *         acetaminophen and paracetamol or salbutamol and albuterol.)
5357   */
5358  public List<StringType> getSynonym() {
5359    if (this.synonym == null)
5360      this.synonym = new ArrayList<StringType>();
5361    return this.synonym;
5362  }
5363
5364  /**
5365   * @return Returns a reference to <code>this</code> for easy method chaining
5366   */
5367  public MedicationKnowledge setSynonym(List<StringType> theSynonym) {
5368    this.synonym = theSynonym;
5369    return this;
5370  }
5371
5372  public boolean hasSynonym() {
5373    if (this.synonym == null)
5374      return false;
5375    for (StringType item : this.synonym)
5376      if (!item.isEmpty())
5377        return true;
5378    return false;
5379  }
5380
5381  /**
5382   * @return {@link #synonym} (Additional names for a medication, for example, the
5383   *         name(s) given to a medication in different countries. For example,
5384   *         acetaminophen and paracetamol or salbutamol and albuterol.)
5385   */
5386  public StringType addSynonymElement() {// 2
5387    StringType t = new StringType();
5388    if (this.synonym == null)
5389      this.synonym = new ArrayList<StringType>();
5390    this.synonym.add(t);
5391    return t;
5392  }
5393
5394  /**
5395   * @param value {@link #synonym} (Additional names for a medication, for
5396   *              example, the name(s) given to a medication in different
5397   *              countries. For example, acetaminophen and paracetamol or
5398   *              salbutamol and albuterol.)
5399   */
5400  public MedicationKnowledge addSynonym(String value) { // 1
5401    StringType t = new StringType();
5402    t.setValue(value);
5403    if (this.synonym == null)
5404      this.synonym = new ArrayList<StringType>();
5405    this.synonym.add(t);
5406    return this;
5407  }
5408
5409  /**
5410   * @param value {@link #synonym} (Additional names for a medication, for
5411   *              example, the name(s) given to a medication in different
5412   *              countries. For example, acetaminophen and paracetamol or
5413   *              salbutamol and albuterol.)
5414   */
5415  public boolean hasSynonym(String value) {
5416    if (this.synonym == null)
5417      return false;
5418    for (StringType v : this.synonym)
5419      if (v.getValue().equals(value)) // string
5420        return true;
5421    return false;
5422  }
5423
5424  /**
5425   * @return {@link #relatedMedicationKnowledge} (Associated or related knowledge
5426   *         about a medication.)
5427   */
5428  public List<MedicationKnowledgeRelatedMedicationKnowledgeComponent> getRelatedMedicationKnowledge() {
5429    if (this.relatedMedicationKnowledge == null)
5430      this.relatedMedicationKnowledge = new ArrayList<MedicationKnowledgeRelatedMedicationKnowledgeComponent>();
5431    return this.relatedMedicationKnowledge;
5432  }
5433
5434  /**
5435   * @return Returns a reference to <code>this</code> for easy method chaining
5436   */
5437  public MedicationKnowledge setRelatedMedicationKnowledge(
5438      List<MedicationKnowledgeRelatedMedicationKnowledgeComponent> theRelatedMedicationKnowledge) {
5439    this.relatedMedicationKnowledge = theRelatedMedicationKnowledge;
5440    return this;
5441  }
5442
5443  public boolean hasRelatedMedicationKnowledge() {
5444    if (this.relatedMedicationKnowledge == null)
5445      return false;
5446    for (MedicationKnowledgeRelatedMedicationKnowledgeComponent item : this.relatedMedicationKnowledge)
5447      if (!item.isEmpty())
5448        return true;
5449    return false;
5450  }
5451
5452  public MedicationKnowledgeRelatedMedicationKnowledgeComponent addRelatedMedicationKnowledge() { // 3
5453    MedicationKnowledgeRelatedMedicationKnowledgeComponent t = new MedicationKnowledgeRelatedMedicationKnowledgeComponent();
5454    if (this.relatedMedicationKnowledge == null)
5455      this.relatedMedicationKnowledge = new ArrayList<MedicationKnowledgeRelatedMedicationKnowledgeComponent>();
5456    this.relatedMedicationKnowledge.add(t);
5457    return t;
5458  }
5459
5460  public MedicationKnowledge addRelatedMedicationKnowledge(MedicationKnowledgeRelatedMedicationKnowledgeComponent t) { // 3
5461    if (t == null)
5462      return this;
5463    if (this.relatedMedicationKnowledge == null)
5464      this.relatedMedicationKnowledge = new ArrayList<MedicationKnowledgeRelatedMedicationKnowledgeComponent>();
5465    this.relatedMedicationKnowledge.add(t);
5466    return this;
5467  }
5468
5469  /**
5470   * @return The first repetition of repeating field
5471   *         {@link #relatedMedicationKnowledge}, creating it if it does not
5472   *         already exist
5473   */
5474  public MedicationKnowledgeRelatedMedicationKnowledgeComponent getRelatedMedicationKnowledgeFirstRep() {
5475    if (getRelatedMedicationKnowledge().isEmpty()) {
5476      addRelatedMedicationKnowledge();
5477    }
5478    return getRelatedMedicationKnowledge().get(0);
5479  }
5480
5481  /**
5482   * @return {@link #associatedMedication} (Associated or related medications. For
5483   *         example, if the medication is a branded product (e.g. Crestor), this
5484   *         is the Therapeutic Moeity (e.g. Rosuvastatin) or if this is a generic
5485   *         medication (e.g. Rosuvastatin), this would link to a branded product
5486   *         (e.g. Crestor).)
5487   */
5488  public List<Reference> getAssociatedMedication() {
5489    if (this.associatedMedication == null)
5490      this.associatedMedication = new ArrayList<Reference>();
5491    return this.associatedMedication;
5492  }
5493
5494  /**
5495   * @return Returns a reference to <code>this</code> for easy method chaining
5496   */
5497  public MedicationKnowledge setAssociatedMedication(List<Reference> theAssociatedMedication) {
5498    this.associatedMedication = theAssociatedMedication;
5499    return this;
5500  }
5501
5502  public boolean hasAssociatedMedication() {
5503    if (this.associatedMedication == null)
5504      return false;
5505    for (Reference item : this.associatedMedication)
5506      if (!item.isEmpty())
5507        return true;
5508    return false;
5509  }
5510
5511  public Reference addAssociatedMedication() { // 3
5512    Reference t = new Reference();
5513    if (this.associatedMedication == null)
5514      this.associatedMedication = new ArrayList<Reference>();
5515    this.associatedMedication.add(t);
5516    return t;
5517  }
5518
5519  public MedicationKnowledge addAssociatedMedication(Reference t) { // 3
5520    if (t == null)
5521      return this;
5522    if (this.associatedMedication == null)
5523      this.associatedMedication = new ArrayList<Reference>();
5524    this.associatedMedication.add(t);
5525    return this;
5526  }
5527
5528  /**
5529   * @return The first repetition of repeating field
5530   *         {@link #associatedMedication}, creating it if it does not already
5531   *         exist
5532   */
5533  public Reference getAssociatedMedicationFirstRep() {
5534    if (getAssociatedMedication().isEmpty()) {
5535      addAssociatedMedication();
5536    }
5537    return getAssociatedMedication().get(0);
5538  }
5539
5540  /**
5541   * @deprecated Use Reference#setResource(IBaseResource) instead
5542   */
5543  @Deprecated
5544  public List<Medication> getAssociatedMedicationTarget() {
5545    if (this.associatedMedicationTarget == null)
5546      this.associatedMedicationTarget = new ArrayList<Medication>();
5547    return this.associatedMedicationTarget;
5548  }
5549
5550  /**
5551   * @deprecated Use Reference#setResource(IBaseResource) instead
5552   */
5553  @Deprecated
5554  public Medication addAssociatedMedicationTarget() {
5555    Medication r = new Medication();
5556    if (this.associatedMedicationTarget == null)
5557      this.associatedMedicationTarget = new ArrayList<Medication>();
5558    this.associatedMedicationTarget.add(r);
5559    return r;
5560  }
5561
5562  /**
5563   * @return {@link #productType} (Category of the medication or product (e.g.
5564   *         branded product, therapeutic moeity, generic product, innovator
5565   *         product, etc.).)
5566   */
5567  public List<CodeableConcept> getProductType() {
5568    if (this.productType == null)
5569      this.productType = new ArrayList<CodeableConcept>();
5570    return this.productType;
5571  }
5572
5573  /**
5574   * @return Returns a reference to <code>this</code> for easy method chaining
5575   */
5576  public MedicationKnowledge setProductType(List<CodeableConcept> theProductType) {
5577    this.productType = theProductType;
5578    return this;
5579  }
5580
5581  public boolean hasProductType() {
5582    if (this.productType == null)
5583      return false;
5584    for (CodeableConcept item : this.productType)
5585      if (!item.isEmpty())
5586        return true;
5587    return false;
5588  }
5589
5590  public CodeableConcept addProductType() { // 3
5591    CodeableConcept t = new CodeableConcept();
5592    if (this.productType == null)
5593      this.productType = new ArrayList<CodeableConcept>();
5594    this.productType.add(t);
5595    return t;
5596  }
5597
5598  public MedicationKnowledge addProductType(CodeableConcept t) { // 3
5599    if (t == null)
5600      return this;
5601    if (this.productType == null)
5602      this.productType = new ArrayList<CodeableConcept>();
5603    this.productType.add(t);
5604    return this;
5605  }
5606
5607  /**
5608   * @return The first repetition of repeating field {@link #productType},
5609   *         creating it if it does not already exist
5610   */
5611  public CodeableConcept getProductTypeFirstRep() {
5612    if (getProductType().isEmpty()) {
5613      addProductType();
5614    }
5615    return getProductType().get(0);
5616  }
5617
5618  /**
5619   * @return {@link #monograph} (Associated documentation about the medication.)
5620   */
5621  public List<MedicationKnowledgeMonographComponent> getMonograph() {
5622    if (this.monograph == null)
5623      this.monograph = new ArrayList<MedicationKnowledgeMonographComponent>();
5624    return this.monograph;
5625  }
5626
5627  /**
5628   * @return Returns a reference to <code>this</code> for easy method chaining
5629   */
5630  public MedicationKnowledge setMonograph(List<MedicationKnowledgeMonographComponent> theMonograph) {
5631    this.monograph = theMonograph;
5632    return this;
5633  }
5634
5635  public boolean hasMonograph() {
5636    if (this.monograph == null)
5637      return false;
5638    for (MedicationKnowledgeMonographComponent item : this.monograph)
5639      if (!item.isEmpty())
5640        return true;
5641    return false;
5642  }
5643
5644  public MedicationKnowledgeMonographComponent addMonograph() { // 3
5645    MedicationKnowledgeMonographComponent t = new MedicationKnowledgeMonographComponent();
5646    if (this.monograph == null)
5647      this.monograph = new ArrayList<MedicationKnowledgeMonographComponent>();
5648    this.monograph.add(t);
5649    return t;
5650  }
5651
5652  public MedicationKnowledge addMonograph(MedicationKnowledgeMonographComponent t) { // 3
5653    if (t == null)
5654      return this;
5655    if (this.monograph == null)
5656      this.monograph = new ArrayList<MedicationKnowledgeMonographComponent>();
5657    this.monograph.add(t);
5658    return this;
5659  }
5660
5661  /**
5662   * @return The first repetition of repeating field {@link #monograph}, creating
5663   *         it if it does not already exist
5664   */
5665  public MedicationKnowledgeMonographComponent getMonographFirstRep() {
5666    if (getMonograph().isEmpty()) {
5667      addMonograph();
5668    }
5669    return getMonograph().get(0);
5670  }
5671
5672  /**
5673   * @return {@link #ingredient} (Identifies a particular constituent of interest
5674   *         in the product.)
5675   */
5676  public List<MedicationKnowledgeIngredientComponent> getIngredient() {
5677    if (this.ingredient == null)
5678      this.ingredient = new ArrayList<MedicationKnowledgeIngredientComponent>();
5679    return this.ingredient;
5680  }
5681
5682  /**
5683   * @return Returns a reference to <code>this</code> for easy method chaining
5684   */
5685  public MedicationKnowledge setIngredient(List<MedicationKnowledgeIngredientComponent> theIngredient) {
5686    this.ingredient = theIngredient;
5687    return this;
5688  }
5689
5690  public boolean hasIngredient() {
5691    if (this.ingredient == null)
5692      return false;
5693    for (MedicationKnowledgeIngredientComponent item : this.ingredient)
5694      if (!item.isEmpty())
5695        return true;
5696    return false;
5697  }
5698
5699  public MedicationKnowledgeIngredientComponent addIngredient() { // 3
5700    MedicationKnowledgeIngredientComponent t = new MedicationKnowledgeIngredientComponent();
5701    if (this.ingredient == null)
5702      this.ingredient = new ArrayList<MedicationKnowledgeIngredientComponent>();
5703    this.ingredient.add(t);
5704    return t;
5705  }
5706
5707  public MedicationKnowledge addIngredient(MedicationKnowledgeIngredientComponent t) { // 3
5708    if (t == null)
5709      return this;
5710    if (this.ingredient == null)
5711      this.ingredient = new ArrayList<MedicationKnowledgeIngredientComponent>();
5712    this.ingredient.add(t);
5713    return this;
5714  }
5715
5716  /**
5717   * @return The first repetition of repeating field {@link #ingredient}, creating
5718   *         it if it does not already exist
5719   */
5720  public MedicationKnowledgeIngredientComponent getIngredientFirstRep() {
5721    if (getIngredient().isEmpty()) {
5722      addIngredient();
5723    }
5724    return getIngredient().get(0);
5725  }
5726
5727  /**
5728   * @return {@link #preparationInstruction} (The instructions for preparing the
5729   *         medication.). This is the underlying object with id, value and
5730   *         extensions. The accessor "getPreparationInstruction" gives direct
5731   *         access to the value
5732   */
5733  public MarkdownType getPreparationInstructionElement() {
5734    if (this.preparationInstruction == null)
5735      if (Configuration.errorOnAutoCreate())
5736        throw new Error("Attempt to auto-create MedicationKnowledge.preparationInstruction");
5737      else if (Configuration.doAutoCreate())
5738        this.preparationInstruction = new MarkdownType(); // bb
5739    return this.preparationInstruction;
5740  }
5741
5742  public boolean hasPreparationInstructionElement() {
5743    return this.preparationInstruction != null && !this.preparationInstruction.isEmpty();
5744  }
5745
5746  public boolean hasPreparationInstruction() {
5747    return this.preparationInstruction != null && !this.preparationInstruction.isEmpty();
5748  }
5749
5750  /**
5751   * @param value {@link #preparationInstruction} (The instructions for preparing
5752   *              the medication.). This is the underlying object with id, value
5753   *              and extensions. The accessor "getPreparationInstruction" gives
5754   *              direct access to the value
5755   */
5756  public MedicationKnowledge setPreparationInstructionElement(MarkdownType value) {
5757    this.preparationInstruction = value;
5758    return this;
5759  }
5760
5761  /**
5762   * @return The instructions for preparing the medication.
5763   */
5764  public String getPreparationInstruction() {
5765    return this.preparationInstruction == null ? null : this.preparationInstruction.getValue();
5766  }
5767
5768  /**
5769   * @param value The instructions for preparing the medication.
5770   */
5771  public MedicationKnowledge setPreparationInstruction(String value) {
5772    if (value == null)
5773      this.preparationInstruction = null;
5774    else {
5775      if (this.preparationInstruction == null)
5776        this.preparationInstruction = new MarkdownType();
5777      this.preparationInstruction.setValue(value);
5778    }
5779    return this;
5780  }
5781
5782  /**
5783   * @return {@link #intendedRoute} (The intended or approved route of
5784   *         administration.)
5785   */
5786  public List<CodeableConcept> getIntendedRoute() {
5787    if (this.intendedRoute == null)
5788      this.intendedRoute = new ArrayList<CodeableConcept>();
5789    return this.intendedRoute;
5790  }
5791
5792  /**
5793   * @return Returns a reference to <code>this</code> for easy method chaining
5794   */
5795  public MedicationKnowledge setIntendedRoute(List<CodeableConcept> theIntendedRoute) {
5796    this.intendedRoute = theIntendedRoute;
5797    return this;
5798  }
5799
5800  public boolean hasIntendedRoute() {
5801    if (this.intendedRoute == null)
5802      return false;
5803    for (CodeableConcept item : this.intendedRoute)
5804      if (!item.isEmpty())
5805        return true;
5806    return false;
5807  }
5808
5809  public CodeableConcept addIntendedRoute() { // 3
5810    CodeableConcept t = new CodeableConcept();
5811    if (this.intendedRoute == null)
5812      this.intendedRoute = new ArrayList<CodeableConcept>();
5813    this.intendedRoute.add(t);
5814    return t;
5815  }
5816
5817  public MedicationKnowledge addIntendedRoute(CodeableConcept t) { // 3
5818    if (t == null)
5819      return this;
5820    if (this.intendedRoute == null)
5821      this.intendedRoute = new ArrayList<CodeableConcept>();
5822    this.intendedRoute.add(t);
5823    return this;
5824  }
5825
5826  /**
5827   * @return The first repetition of repeating field {@link #intendedRoute},
5828   *         creating it if it does not already exist
5829   */
5830  public CodeableConcept getIntendedRouteFirstRep() {
5831    if (getIntendedRoute().isEmpty()) {
5832      addIntendedRoute();
5833    }
5834    return getIntendedRoute().get(0);
5835  }
5836
5837  /**
5838   * @return {@link #cost} (The price of the medication.)
5839   */
5840  public List<MedicationKnowledgeCostComponent> getCost() {
5841    if (this.cost == null)
5842      this.cost = new ArrayList<MedicationKnowledgeCostComponent>();
5843    return this.cost;
5844  }
5845
5846  /**
5847   * @return Returns a reference to <code>this</code> for easy method chaining
5848   */
5849  public MedicationKnowledge setCost(List<MedicationKnowledgeCostComponent> theCost) {
5850    this.cost = theCost;
5851    return this;
5852  }
5853
5854  public boolean hasCost() {
5855    if (this.cost == null)
5856      return false;
5857    for (MedicationKnowledgeCostComponent item : this.cost)
5858      if (!item.isEmpty())
5859        return true;
5860    return false;
5861  }
5862
5863  public MedicationKnowledgeCostComponent addCost() { // 3
5864    MedicationKnowledgeCostComponent t = new MedicationKnowledgeCostComponent();
5865    if (this.cost == null)
5866      this.cost = new ArrayList<MedicationKnowledgeCostComponent>();
5867    this.cost.add(t);
5868    return t;
5869  }
5870
5871  public MedicationKnowledge addCost(MedicationKnowledgeCostComponent t) { // 3
5872    if (t == null)
5873      return this;
5874    if (this.cost == null)
5875      this.cost = new ArrayList<MedicationKnowledgeCostComponent>();
5876    this.cost.add(t);
5877    return this;
5878  }
5879
5880  /**
5881   * @return The first repetition of repeating field {@link #cost}, creating it if
5882   *         it does not already exist
5883   */
5884  public MedicationKnowledgeCostComponent getCostFirstRep() {
5885    if (getCost().isEmpty()) {
5886      addCost();
5887    }
5888    return getCost().get(0);
5889  }
5890
5891  /**
5892   * @return {@link #monitoringProgram} (The program under which the medication is
5893   *         reviewed.)
5894   */
5895  public List<MedicationKnowledgeMonitoringProgramComponent> getMonitoringProgram() {
5896    if (this.monitoringProgram == null)
5897      this.monitoringProgram = new ArrayList<MedicationKnowledgeMonitoringProgramComponent>();
5898    return this.monitoringProgram;
5899  }
5900
5901  /**
5902   * @return Returns a reference to <code>this</code> for easy method chaining
5903   */
5904  public MedicationKnowledge setMonitoringProgram(
5905      List<MedicationKnowledgeMonitoringProgramComponent> theMonitoringProgram) {
5906    this.monitoringProgram = theMonitoringProgram;
5907    return this;
5908  }
5909
5910  public boolean hasMonitoringProgram() {
5911    if (this.monitoringProgram == null)
5912      return false;
5913    for (MedicationKnowledgeMonitoringProgramComponent item : this.monitoringProgram)
5914      if (!item.isEmpty())
5915        return true;
5916    return false;
5917  }
5918
5919  public MedicationKnowledgeMonitoringProgramComponent addMonitoringProgram() { // 3
5920    MedicationKnowledgeMonitoringProgramComponent t = new MedicationKnowledgeMonitoringProgramComponent();
5921    if (this.monitoringProgram == null)
5922      this.monitoringProgram = new ArrayList<MedicationKnowledgeMonitoringProgramComponent>();
5923    this.monitoringProgram.add(t);
5924    return t;
5925  }
5926
5927  public MedicationKnowledge addMonitoringProgram(MedicationKnowledgeMonitoringProgramComponent t) { // 3
5928    if (t == null)
5929      return this;
5930    if (this.monitoringProgram == null)
5931      this.monitoringProgram = new ArrayList<MedicationKnowledgeMonitoringProgramComponent>();
5932    this.monitoringProgram.add(t);
5933    return this;
5934  }
5935
5936  /**
5937   * @return The first repetition of repeating field {@link #monitoringProgram},
5938   *         creating it if it does not already exist
5939   */
5940  public MedicationKnowledgeMonitoringProgramComponent getMonitoringProgramFirstRep() {
5941    if (getMonitoringProgram().isEmpty()) {
5942      addMonitoringProgram();
5943    }
5944    return getMonitoringProgram().get(0);
5945  }
5946
5947  /**
5948   * @return {@link #administrationGuidelines} (Guidelines for the administration
5949   *         of the medication.)
5950   */
5951  public List<MedicationKnowledgeAdministrationGuidelinesComponent> getAdministrationGuidelines() {
5952    if (this.administrationGuidelines == null)
5953      this.administrationGuidelines = new ArrayList<MedicationKnowledgeAdministrationGuidelinesComponent>();
5954    return this.administrationGuidelines;
5955  }
5956
5957  /**
5958   * @return Returns a reference to <code>this</code> for easy method chaining
5959   */
5960  public MedicationKnowledge setAdministrationGuidelines(
5961      List<MedicationKnowledgeAdministrationGuidelinesComponent> theAdministrationGuidelines) {
5962    this.administrationGuidelines = theAdministrationGuidelines;
5963    return this;
5964  }
5965
5966  public boolean hasAdministrationGuidelines() {
5967    if (this.administrationGuidelines == null)
5968      return false;
5969    for (MedicationKnowledgeAdministrationGuidelinesComponent item : this.administrationGuidelines)
5970      if (!item.isEmpty())
5971        return true;
5972    return false;
5973  }
5974
5975  public MedicationKnowledgeAdministrationGuidelinesComponent addAdministrationGuidelines() { // 3
5976    MedicationKnowledgeAdministrationGuidelinesComponent t = new MedicationKnowledgeAdministrationGuidelinesComponent();
5977    if (this.administrationGuidelines == null)
5978      this.administrationGuidelines = new ArrayList<MedicationKnowledgeAdministrationGuidelinesComponent>();
5979    this.administrationGuidelines.add(t);
5980    return t;
5981  }
5982
5983  public MedicationKnowledge addAdministrationGuidelines(MedicationKnowledgeAdministrationGuidelinesComponent t) { // 3
5984    if (t == null)
5985      return this;
5986    if (this.administrationGuidelines == null)
5987      this.administrationGuidelines = new ArrayList<MedicationKnowledgeAdministrationGuidelinesComponent>();
5988    this.administrationGuidelines.add(t);
5989    return this;
5990  }
5991
5992  /**
5993   * @return The first repetition of repeating field
5994   *         {@link #administrationGuidelines}, creating it if it does not already
5995   *         exist
5996   */
5997  public MedicationKnowledgeAdministrationGuidelinesComponent getAdministrationGuidelinesFirstRep() {
5998    if (getAdministrationGuidelines().isEmpty()) {
5999      addAdministrationGuidelines();
6000    }
6001    return getAdministrationGuidelines().get(0);
6002  }
6003
6004  /**
6005   * @return {@link #medicineClassification} (Categorization of the medication
6006   *         within a formulary or classification system.)
6007   */
6008  public List<MedicationKnowledgeMedicineClassificationComponent> getMedicineClassification() {
6009    if (this.medicineClassification == null)
6010      this.medicineClassification = new ArrayList<MedicationKnowledgeMedicineClassificationComponent>();
6011    return this.medicineClassification;
6012  }
6013
6014  /**
6015   * @return Returns a reference to <code>this</code> for easy method chaining
6016   */
6017  public MedicationKnowledge setMedicineClassification(
6018      List<MedicationKnowledgeMedicineClassificationComponent> theMedicineClassification) {
6019    this.medicineClassification = theMedicineClassification;
6020    return this;
6021  }
6022
6023  public boolean hasMedicineClassification() {
6024    if (this.medicineClassification == null)
6025      return false;
6026    for (MedicationKnowledgeMedicineClassificationComponent item : this.medicineClassification)
6027      if (!item.isEmpty())
6028        return true;
6029    return false;
6030  }
6031
6032  public MedicationKnowledgeMedicineClassificationComponent addMedicineClassification() { // 3
6033    MedicationKnowledgeMedicineClassificationComponent t = new MedicationKnowledgeMedicineClassificationComponent();
6034    if (this.medicineClassification == null)
6035      this.medicineClassification = new ArrayList<MedicationKnowledgeMedicineClassificationComponent>();
6036    this.medicineClassification.add(t);
6037    return t;
6038  }
6039
6040  public MedicationKnowledge addMedicineClassification(MedicationKnowledgeMedicineClassificationComponent t) { // 3
6041    if (t == null)
6042      return this;
6043    if (this.medicineClassification == null)
6044      this.medicineClassification = new ArrayList<MedicationKnowledgeMedicineClassificationComponent>();
6045    this.medicineClassification.add(t);
6046    return this;
6047  }
6048
6049  /**
6050   * @return The first repetition of repeating field
6051   *         {@link #medicineClassification}, creating it if it does not already
6052   *         exist
6053   */
6054  public MedicationKnowledgeMedicineClassificationComponent getMedicineClassificationFirstRep() {
6055    if (getMedicineClassification().isEmpty()) {
6056      addMedicineClassification();
6057    }
6058    return getMedicineClassification().get(0);
6059  }
6060
6061  /**
6062   * @return {@link #packaging} (Information that only applies to packages (not
6063   *         products).)
6064   */
6065  public MedicationKnowledgePackagingComponent getPackaging() {
6066    if (this.packaging == null)
6067      if (Configuration.errorOnAutoCreate())
6068        throw new Error("Attempt to auto-create MedicationKnowledge.packaging");
6069      else if (Configuration.doAutoCreate())
6070        this.packaging = new MedicationKnowledgePackagingComponent(); // cc
6071    return this.packaging;
6072  }
6073
6074  public boolean hasPackaging() {
6075    return this.packaging != null && !this.packaging.isEmpty();
6076  }
6077
6078  /**
6079   * @param value {@link #packaging} (Information that only applies to packages
6080   *              (not products).)
6081   */
6082  public MedicationKnowledge setPackaging(MedicationKnowledgePackagingComponent value) {
6083    this.packaging = value;
6084    return this;
6085  }
6086
6087  /**
6088   * @return {@link #drugCharacteristic} (Specifies descriptive properties of the
6089   *         medicine, such as color, shape, imprints, etc.)
6090   */
6091  public List<MedicationKnowledgeDrugCharacteristicComponent> getDrugCharacteristic() {
6092    if (this.drugCharacteristic == null)
6093      this.drugCharacteristic = new ArrayList<MedicationKnowledgeDrugCharacteristicComponent>();
6094    return this.drugCharacteristic;
6095  }
6096
6097  /**
6098   * @return Returns a reference to <code>this</code> for easy method chaining
6099   */
6100  public MedicationKnowledge setDrugCharacteristic(
6101      List<MedicationKnowledgeDrugCharacteristicComponent> theDrugCharacteristic) {
6102    this.drugCharacteristic = theDrugCharacteristic;
6103    return this;
6104  }
6105
6106  public boolean hasDrugCharacteristic() {
6107    if (this.drugCharacteristic == null)
6108      return false;
6109    for (MedicationKnowledgeDrugCharacteristicComponent item : this.drugCharacteristic)
6110      if (!item.isEmpty())
6111        return true;
6112    return false;
6113  }
6114
6115  public MedicationKnowledgeDrugCharacteristicComponent addDrugCharacteristic() { // 3
6116    MedicationKnowledgeDrugCharacteristicComponent t = new MedicationKnowledgeDrugCharacteristicComponent();
6117    if (this.drugCharacteristic == null)
6118      this.drugCharacteristic = new ArrayList<MedicationKnowledgeDrugCharacteristicComponent>();
6119    this.drugCharacteristic.add(t);
6120    return t;
6121  }
6122
6123  public MedicationKnowledge addDrugCharacteristic(MedicationKnowledgeDrugCharacteristicComponent t) { // 3
6124    if (t == null)
6125      return this;
6126    if (this.drugCharacteristic == null)
6127      this.drugCharacteristic = new ArrayList<MedicationKnowledgeDrugCharacteristicComponent>();
6128    this.drugCharacteristic.add(t);
6129    return this;
6130  }
6131
6132  /**
6133   * @return The first repetition of repeating field {@link #drugCharacteristic},
6134   *         creating it if it does not already exist
6135   */
6136  public MedicationKnowledgeDrugCharacteristicComponent getDrugCharacteristicFirstRep() {
6137    if (getDrugCharacteristic().isEmpty()) {
6138      addDrugCharacteristic();
6139    }
6140    return getDrugCharacteristic().get(0);
6141  }
6142
6143  /**
6144   * @return {@link #contraindication} (Potential clinical issue with or between
6145   *         medication(s) (for example, drug-drug interaction, drug-disease
6146   *         contraindication, drug-allergy interaction, etc.).)
6147   */
6148  public List<Reference> getContraindication() {
6149    if (this.contraindication == null)
6150      this.contraindication = new ArrayList<Reference>();
6151    return this.contraindication;
6152  }
6153
6154  /**
6155   * @return Returns a reference to <code>this</code> for easy method chaining
6156   */
6157  public MedicationKnowledge setContraindication(List<Reference> theContraindication) {
6158    this.contraindication = theContraindication;
6159    return this;
6160  }
6161
6162  public boolean hasContraindication() {
6163    if (this.contraindication == null)
6164      return false;
6165    for (Reference item : this.contraindication)
6166      if (!item.isEmpty())
6167        return true;
6168    return false;
6169  }
6170
6171  public Reference addContraindication() { // 3
6172    Reference t = new Reference();
6173    if (this.contraindication == null)
6174      this.contraindication = new ArrayList<Reference>();
6175    this.contraindication.add(t);
6176    return t;
6177  }
6178
6179  public MedicationKnowledge addContraindication(Reference t) { // 3
6180    if (t == null)
6181      return this;
6182    if (this.contraindication == null)
6183      this.contraindication = new ArrayList<Reference>();
6184    this.contraindication.add(t);
6185    return this;
6186  }
6187
6188  /**
6189   * @return The first repetition of repeating field {@link #contraindication},
6190   *         creating it if it does not already exist
6191   */
6192  public Reference getContraindicationFirstRep() {
6193    if (getContraindication().isEmpty()) {
6194      addContraindication();
6195    }
6196    return getContraindication().get(0);
6197  }
6198
6199  /**
6200   * @deprecated Use Reference#setResource(IBaseResource) instead
6201   */
6202  @Deprecated
6203  public List<DetectedIssue> getContraindicationTarget() {
6204    if (this.contraindicationTarget == null)
6205      this.contraindicationTarget = new ArrayList<DetectedIssue>();
6206    return this.contraindicationTarget;
6207  }
6208
6209  /**
6210   * @deprecated Use Reference#setResource(IBaseResource) instead
6211   */
6212  @Deprecated
6213  public DetectedIssue addContraindicationTarget() {
6214    DetectedIssue r = new DetectedIssue();
6215    if (this.contraindicationTarget == null)
6216      this.contraindicationTarget = new ArrayList<DetectedIssue>();
6217    this.contraindicationTarget.add(r);
6218    return r;
6219  }
6220
6221  /**
6222   * @return {@link #regulatory} (Regulatory information about a medication.)
6223   */
6224  public List<MedicationKnowledgeRegulatoryComponent> getRegulatory() {
6225    if (this.regulatory == null)
6226      this.regulatory = new ArrayList<MedicationKnowledgeRegulatoryComponent>();
6227    return this.regulatory;
6228  }
6229
6230  /**
6231   * @return Returns a reference to <code>this</code> for easy method chaining
6232   */
6233  public MedicationKnowledge setRegulatory(List<MedicationKnowledgeRegulatoryComponent> theRegulatory) {
6234    this.regulatory = theRegulatory;
6235    return this;
6236  }
6237
6238  public boolean hasRegulatory() {
6239    if (this.regulatory == null)
6240      return false;
6241    for (MedicationKnowledgeRegulatoryComponent item : this.regulatory)
6242      if (!item.isEmpty())
6243        return true;
6244    return false;
6245  }
6246
6247  public MedicationKnowledgeRegulatoryComponent addRegulatory() { // 3
6248    MedicationKnowledgeRegulatoryComponent t = new MedicationKnowledgeRegulatoryComponent();
6249    if (this.regulatory == null)
6250      this.regulatory = new ArrayList<MedicationKnowledgeRegulatoryComponent>();
6251    this.regulatory.add(t);
6252    return t;
6253  }
6254
6255  public MedicationKnowledge addRegulatory(MedicationKnowledgeRegulatoryComponent t) { // 3
6256    if (t == null)
6257      return this;
6258    if (this.regulatory == null)
6259      this.regulatory = new ArrayList<MedicationKnowledgeRegulatoryComponent>();
6260    this.regulatory.add(t);
6261    return this;
6262  }
6263
6264  /**
6265   * @return The first repetition of repeating field {@link #regulatory}, creating
6266   *         it if it does not already exist
6267   */
6268  public MedicationKnowledgeRegulatoryComponent getRegulatoryFirstRep() {
6269    if (getRegulatory().isEmpty()) {
6270      addRegulatory();
6271    }
6272    return getRegulatory().get(0);
6273  }
6274
6275  /**
6276   * @return {@link #kinetics} (The time course of drug absorption, distribution,
6277   *         metabolism and excretion of a medication from the body.)
6278   */
6279  public List<MedicationKnowledgeKineticsComponent> getKinetics() {
6280    if (this.kinetics == null)
6281      this.kinetics = new ArrayList<MedicationKnowledgeKineticsComponent>();
6282    return this.kinetics;
6283  }
6284
6285  /**
6286   * @return Returns a reference to <code>this</code> for easy method chaining
6287   */
6288  public MedicationKnowledge setKinetics(List<MedicationKnowledgeKineticsComponent> theKinetics) {
6289    this.kinetics = theKinetics;
6290    return this;
6291  }
6292
6293  public boolean hasKinetics() {
6294    if (this.kinetics == null)
6295      return false;
6296    for (MedicationKnowledgeKineticsComponent item : this.kinetics)
6297      if (!item.isEmpty())
6298        return true;
6299    return false;
6300  }
6301
6302  public MedicationKnowledgeKineticsComponent addKinetics() { // 3
6303    MedicationKnowledgeKineticsComponent t = new MedicationKnowledgeKineticsComponent();
6304    if (this.kinetics == null)
6305      this.kinetics = new ArrayList<MedicationKnowledgeKineticsComponent>();
6306    this.kinetics.add(t);
6307    return t;
6308  }
6309
6310  public MedicationKnowledge addKinetics(MedicationKnowledgeKineticsComponent t) { // 3
6311    if (t == null)
6312      return this;
6313    if (this.kinetics == null)
6314      this.kinetics = new ArrayList<MedicationKnowledgeKineticsComponent>();
6315    this.kinetics.add(t);
6316    return this;
6317  }
6318
6319  /**
6320   * @return The first repetition of repeating field {@link #kinetics}, creating
6321   *         it if it does not already exist
6322   */
6323  public MedicationKnowledgeKineticsComponent getKineticsFirstRep() {
6324    if (getKinetics().isEmpty()) {
6325      addKinetics();
6326    }
6327    return getKinetics().get(0);
6328  }
6329
6330  protected void listChildren(List<Property> children) {
6331    super.listChildren(children);
6332    children.add(new Property("code", "CodeableConcept",
6333        "A code that specifies this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.",
6334        0, 1, code));
6335    children.add(new Property("status", "code",
6336        "A code to indicate if the medication is in active use.  The status refers to the validity about the information of the medication and not to its medicinal properties.",
6337        0, 1, status));
6338    children.add(new Property("manufacturer", "Reference(Organization)",
6339        "Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.",
6340        0, 1, manufacturer));
6341    children.add(new Property("doseForm", "CodeableConcept",
6342        "Describes the form of the item.  Powder; tablets; capsule.", 0, 1, doseForm));
6343    children.add(new Property("amount", "SimpleQuantity",
6344        "Specific amount of the drug in the packaged product.  For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).",
6345        0, 1, amount));
6346    children.add(new Property("synonym", "string",
6347        "Additional names for a medication, for example, the name(s) given to a medication in different countries.  For example, acetaminophen and paracetamol or salbutamol and albuterol.",
6348        0, java.lang.Integer.MAX_VALUE, synonym));
6349    children.add(new Property("relatedMedicationKnowledge", "", "Associated or related knowledge about a medication.",
6350        0, java.lang.Integer.MAX_VALUE, relatedMedicationKnowledge));
6351    children.add(new Property("associatedMedication", "Reference(Medication)",
6352        "Associated or related medications.  For example, if the medication is a branded product (e.g. Crestor), this is the Therapeutic Moeity (e.g. Rosuvastatin) or if this is a generic medication (e.g. Rosuvastatin), this would link to a branded product (e.g. Crestor).",
6353        0, java.lang.Integer.MAX_VALUE, associatedMedication));
6354    children.add(new Property("productType", "CodeableConcept",
6355        "Category of the medication or product (e.g. branded product, therapeutic moeity, generic product, innovator product, etc.).",
6356        0, java.lang.Integer.MAX_VALUE, productType));
6357    children.add(new Property("monograph", "", "Associated documentation about the medication.", 0,
6358        java.lang.Integer.MAX_VALUE, monograph));
6359    children.add(new Property("ingredient", "", "Identifies a particular constituent of interest in the product.", 0,
6360        java.lang.Integer.MAX_VALUE, ingredient));
6361    children.add(new Property("preparationInstruction", "markdown", "The instructions for preparing the medication.", 0,
6362        1, preparationInstruction));
6363    children.add(new Property("intendedRoute", "CodeableConcept", "The intended or approved route of administration.",
6364        0, java.lang.Integer.MAX_VALUE, intendedRoute));
6365    children.add(new Property("cost", "", "The price of the medication.", 0, java.lang.Integer.MAX_VALUE, cost));
6366    children.add(new Property("monitoringProgram", "", "The program under which the medication is reviewed.", 0,
6367        java.lang.Integer.MAX_VALUE, monitoringProgram));
6368    children.add(new Property("administrationGuidelines", "", "Guidelines for the administration of the medication.", 0,
6369        java.lang.Integer.MAX_VALUE, administrationGuidelines));
6370    children.add(new Property("medicineClassification", "",
6371        "Categorization of the medication within a formulary or classification system.", 0, java.lang.Integer.MAX_VALUE,
6372        medicineClassification));
6373    children.add(
6374        new Property("packaging", "", "Information that only applies to packages (not products).", 0, 1, packaging));
6375    children.add(new Property("drugCharacteristic", "",
6376        "Specifies descriptive properties of the medicine, such as color, shape, imprints, etc.", 0,
6377        java.lang.Integer.MAX_VALUE, drugCharacteristic));
6378    children.add(new Property("contraindication", "Reference(DetectedIssue)",
6379        "Potential clinical issue with or between medication(s) (for example, drug-drug interaction, drug-disease contraindication, drug-allergy interaction, etc.).",
6380        0, java.lang.Integer.MAX_VALUE, contraindication));
6381    children.add(new Property("regulatory", "", "Regulatory information about a medication.", 0,
6382        java.lang.Integer.MAX_VALUE, regulatory));
6383    children.add(new Property("kinetics", "",
6384        "The time course of drug absorption, distribution, metabolism and excretion of a medication from the body.", 0,
6385        java.lang.Integer.MAX_VALUE, kinetics));
6386  }
6387
6388  @Override
6389  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6390    switch (_hash) {
6391    case 3059181:
6392      /* code */ return new Property("code", "CodeableConcept",
6393          "A code that specifies this medication, or a textual description if no code is available. Usage note: This could be a standard medication code such as a code from RxNorm, SNOMED CT, IDMP etc. It could also be a national or local formulary code, optionally with translations to other code systems.",
6394          0, 1, code);
6395    case -892481550:
6396      /* status */ return new Property("status", "code",
6397          "A code to indicate if the medication is in active use.  The status refers to the validity about the information of the medication and not to its medicinal properties.",
6398          0, 1, status);
6399    case -1969347631:
6400      /* manufacturer */ return new Property("manufacturer", "Reference(Organization)",
6401          "Describes the details of the manufacturer of the medication product.  This is not intended to represent the distributor of a medication product.",
6402          0, 1, manufacturer);
6403    case 1303858817:
6404      /* doseForm */ return new Property("doseForm", "CodeableConcept",
6405          "Describes the form of the item.  Powder; tablets; capsule.", 0, 1, doseForm);
6406    case -1413853096:
6407      /* amount */ return new Property("amount", "SimpleQuantity",
6408          "Specific amount of the drug in the packaged product.  For example, when specifying a product that has the same strength (For example, Insulin glargine 100 unit per mL solution for injection), this attribute provides additional clarification of the package amount (For example, 3 mL, 10mL, etc.).",
6409          0, 1, amount);
6410    case -1742128133:
6411      /* synonym */ return new Property("synonym", "string",
6412          "Additional names for a medication, for example, the name(s) given to a medication in different countries.  For example, acetaminophen and paracetamol or salbutamol and albuterol.",
6413          0, java.lang.Integer.MAX_VALUE, synonym);
6414    case 723067972:
6415      /* relatedMedicationKnowledge */ return new Property("relatedMedicationKnowledge", "",
6416          "Associated or related knowledge about a medication.", 0, java.lang.Integer.MAX_VALUE,
6417          relatedMedicationKnowledge);
6418    case 1312779381:
6419      /* associatedMedication */ return new Property("associatedMedication", "Reference(Medication)",
6420          "Associated or related medications.  For example, if the medication is a branded product (e.g. Crestor), this is the Therapeutic Moeity (e.g. Rosuvastatin) or if this is a generic medication (e.g. Rosuvastatin), this would link to a branded product (e.g. Crestor).",
6421          0, java.lang.Integer.MAX_VALUE, associatedMedication);
6422    case -1491615543:
6423      /* productType */ return new Property("productType", "CodeableConcept",
6424          "Category of the medication or product (e.g. branded product, therapeutic moeity, generic product, innovator product, etc.).",
6425          0, java.lang.Integer.MAX_VALUE, productType);
6426    case -1442980789:
6427      /* monograph */ return new Property("monograph", "", "Associated documentation about the medication.", 0,
6428          java.lang.Integer.MAX_VALUE, monograph);
6429    case -206409263:
6430      /* ingredient */ return new Property("ingredient", "",
6431          "Identifies a particular constituent of interest in the product.", 0, java.lang.Integer.MAX_VALUE,
6432          ingredient);
6433    case 1025456503:
6434      /* preparationInstruction */ return new Property("preparationInstruction", "markdown",
6435          "The instructions for preparing the medication.", 0, 1, preparationInstruction);
6436    case -767798050:
6437      /* intendedRoute */ return new Property("intendedRoute", "CodeableConcept",
6438          "The intended or approved route of administration.", 0, java.lang.Integer.MAX_VALUE, intendedRoute);
6439    case 3059661:
6440      /* cost */ return new Property("cost", "", "The price of the medication.", 0, java.lang.Integer.MAX_VALUE, cost);
6441    case 569848092:
6442      /* monitoringProgram */ return new Property("monitoringProgram", "",
6443          "The program under which the medication is reviewed.", 0, java.lang.Integer.MAX_VALUE, monitoringProgram);
6444    case 496930945:
6445      /* administrationGuidelines */ return new Property("administrationGuidelines", "",
6446          "Guidelines for the administration of the medication.", 0, java.lang.Integer.MAX_VALUE,
6447          administrationGuidelines);
6448    case 1791551680:
6449      /* medicineClassification */ return new Property("medicineClassification", "",
6450          "Categorization of the medication within a formulary or classification system.", 0,
6451          java.lang.Integer.MAX_VALUE, medicineClassification);
6452    case 1802065795:
6453      /* packaging */ return new Property("packaging", "", "Information that only applies to packages (not products).",
6454          0, 1, packaging);
6455    case -844126885:
6456      /* drugCharacteristic */ return new Property("drugCharacteristic", "",
6457          "Specifies descriptive properties of the medicine, such as color, shape, imprints, etc.", 0,
6458          java.lang.Integer.MAX_VALUE, drugCharacteristic);
6459    case 107135229:
6460      /* contraindication */ return new Property("contraindication", "Reference(DetectedIssue)",
6461          "Potential clinical issue with or between medication(s) (for example, drug-drug interaction, drug-disease contraindication, drug-allergy interaction, etc.).",
6462          0, java.lang.Integer.MAX_VALUE, contraindication);
6463    case -27327848:
6464      /* regulatory */ return new Property("regulatory", "", "Regulatory information about a medication.", 0,
6465          java.lang.Integer.MAX_VALUE, regulatory);
6466    case -553207110:
6467      /* kinetics */ return new Property("kinetics", "",
6468          "The time course of drug absorption, distribution, metabolism and excretion of a medication from the body.",
6469          0, java.lang.Integer.MAX_VALUE, kinetics);
6470    default:
6471      return super.getNamedProperty(_hash, _name, _checkValid);
6472    }
6473
6474  }
6475
6476  @Override
6477  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6478    switch (hash) {
6479    case 3059181:
6480      /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
6481    case -892481550:
6482      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<MedicationKnowledgeStatus>
6483    case -1969347631:
6484      /* manufacturer */ return this.manufacturer == null ? new Base[0] : new Base[] { this.manufacturer }; // Reference
6485    case 1303858817:
6486      /* doseForm */ return this.doseForm == null ? new Base[0] : new Base[] { this.doseForm }; // CodeableConcept
6487    case -1413853096:
6488      /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Quantity
6489    case -1742128133:
6490      /* synonym */ return this.synonym == null ? new Base[0] : this.synonym.toArray(new Base[this.synonym.size()]); // StringType
6491    case 723067972:
6492      /* relatedMedicationKnowledge */ return this.relatedMedicationKnowledge == null ? new Base[0]
6493          : this.relatedMedicationKnowledge.toArray(new Base[this.relatedMedicationKnowledge.size()]); // MedicationKnowledgeRelatedMedicationKnowledgeComponent
6494    case 1312779381:
6495      /* associatedMedication */ return this.associatedMedication == null ? new Base[0]
6496          : this.associatedMedication.toArray(new Base[this.associatedMedication.size()]); // Reference
6497    case -1491615543:
6498      /* productType */ return this.productType == null ? new Base[0]
6499          : this.productType.toArray(new Base[this.productType.size()]); // CodeableConcept
6500    case -1442980789:
6501      /* monograph */ return this.monograph == null ? new Base[0]
6502          : this.monograph.toArray(new Base[this.monograph.size()]); // MedicationKnowledgeMonographComponent
6503    case -206409263:
6504      /* ingredient */ return this.ingredient == null ? new Base[0]
6505          : this.ingredient.toArray(new Base[this.ingredient.size()]); // MedicationKnowledgeIngredientComponent
6506    case 1025456503:
6507      /* preparationInstruction */ return this.preparationInstruction == null ? new Base[0]
6508          : new Base[] { this.preparationInstruction }; // MarkdownType
6509    case -767798050:
6510      /* intendedRoute */ return this.intendedRoute == null ? new Base[0]
6511          : this.intendedRoute.toArray(new Base[this.intendedRoute.size()]); // CodeableConcept
6512    case 3059661:
6513      /* cost */ return this.cost == null ? new Base[0] : this.cost.toArray(new Base[this.cost.size()]); // MedicationKnowledgeCostComponent
6514    case 569848092:
6515      /* monitoringProgram */ return this.monitoringProgram == null ? new Base[0]
6516          : this.monitoringProgram.toArray(new Base[this.monitoringProgram.size()]); // MedicationKnowledgeMonitoringProgramComponent
6517    case 496930945:
6518      /* administrationGuidelines */ return this.administrationGuidelines == null ? new Base[0]
6519          : this.administrationGuidelines.toArray(new Base[this.administrationGuidelines.size()]); // MedicationKnowledgeAdministrationGuidelinesComponent
6520    case 1791551680:
6521      /* medicineClassification */ return this.medicineClassification == null ? new Base[0]
6522          : this.medicineClassification.toArray(new Base[this.medicineClassification.size()]); // MedicationKnowledgeMedicineClassificationComponent
6523    case 1802065795:
6524      /* packaging */ return this.packaging == null ? new Base[0] : new Base[] { this.packaging }; // MedicationKnowledgePackagingComponent
6525    case -844126885:
6526      /* drugCharacteristic */ return this.drugCharacteristic == null ? new Base[0]
6527          : this.drugCharacteristic.toArray(new Base[this.drugCharacteristic.size()]); // MedicationKnowledgeDrugCharacteristicComponent
6528    case 107135229:
6529      /* contraindication */ return this.contraindication == null ? new Base[0]
6530          : this.contraindication.toArray(new Base[this.contraindication.size()]); // Reference
6531    case -27327848:
6532      /* regulatory */ return this.regulatory == null ? new Base[0]
6533          : this.regulatory.toArray(new Base[this.regulatory.size()]); // MedicationKnowledgeRegulatoryComponent
6534    case -553207110:
6535      /* kinetics */ return this.kinetics == null ? new Base[0] : this.kinetics.toArray(new Base[this.kinetics.size()]); // MedicationKnowledgeKineticsComponent
6536    default:
6537      return super.getProperty(hash, name, checkValid);
6538    }
6539
6540  }
6541
6542  @Override
6543  public Base setProperty(int hash, String name, Base value) throws FHIRException {
6544    switch (hash) {
6545    case 3059181: // code
6546      this.code = castToCodeableConcept(value); // CodeableConcept
6547      return value;
6548    case -892481550: // status
6549      value = new MedicationKnowledgeStatusEnumFactory().fromType(castToCode(value));
6550      this.status = (Enumeration) value; // Enumeration<MedicationKnowledgeStatus>
6551      return value;
6552    case -1969347631: // manufacturer
6553      this.manufacturer = castToReference(value); // Reference
6554      return value;
6555    case 1303858817: // doseForm
6556      this.doseForm = castToCodeableConcept(value); // CodeableConcept
6557      return value;
6558    case -1413853096: // amount
6559      this.amount = castToQuantity(value); // Quantity
6560      return value;
6561    case -1742128133: // synonym
6562      this.getSynonym().add(castToString(value)); // StringType
6563      return value;
6564    case 723067972: // relatedMedicationKnowledge
6565      this.getRelatedMedicationKnowledge().add((MedicationKnowledgeRelatedMedicationKnowledgeComponent) value); // MedicationKnowledgeRelatedMedicationKnowledgeComponent
6566      return value;
6567    case 1312779381: // associatedMedication
6568      this.getAssociatedMedication().add(castToReference(value)); // Reference
6569      return value;
6570    case -1491615543: // productType
6571      this.getProductType().add(castToCodeableConcept(value)); // CodeableConcept
6572      return value;
6573    case -1442980789: // monograph
6574      this.getMonograph().add((MedicationKnowledgeMonographComponent) value); // MedicationKnowledgeMonographComponent
6575      return value;
6576    case -206409263: // ingredient
6577      this.getIngredient().add((MedicationKnowledgeIngredientComponent) value); // MedicationKnowledgeIngredientComponent
6578      return value;
6579    case 1025456503: // preparationInstruction
6580      this.preparationInstruction = castToMarkdown(value); // MarkdownType
6581      return value;
6582    case -767798050: // intendedRoute
6583      this.getIntendedRoute().add(castToCodeableConcept(value)); // CodeableConcept
6584      return value;
6585    case 3059661: // cost
6586      this.getCost().add((MedicationKnowledgeCostComponent) value); // MedicationKnowledgeCostComponent
6587      return value;
6588    case 569848092: // monitoringProgram
6589      this.getMonitoringProgram().add((MedicationKnowledgeMonitoringProgramComponent) value); // MedicationKnowledgeMonitoringProgramComponent
6590      return value;
6591    case 496930945: // administrationGuidelines
6592      this.getAdministrationGuidelines().add((MedicationKnowledgeAdministrationGuidelinesComponent) value); // MedicationKnowledgeAdministrationGuidelinesComponent
6593      return value;
6594    case 1791551680: // medicineClassification
6595      this.getMedicineClassification().add((MedicationKnowledgeMedicineClassificationComponent) value); // MedicationKnowledgeMedicineClassificationComponent
6596      return value;
6597    case 1802065795: // packaging
6598      this.packaging = (MedicationKnowledgePackagingComponent) value; // MedicationKnowledgePackagingComponent
6599      return value;
6600    case -844126885: // drugCharacteristic
6601      this.getDrugCharacteristic().add((MedicationKnowledgeDrugCharacteristicComponent) value); // MedicationKnowledgeDrugCharacteristicComponent
6602      return value;
6603    case 107135229: // contraindication
6604      this.getContraindication().add(castToReference(value)); // Reference
6605      return value;
6606    case -27327848: // regulatory
6607      this.getRegulatory().add((MedicationKnowledgeRegulatoryComponent) value); // MedicationKnowledgeRegulatoryComponent
6608      return value;
6609    case -553207110: // kinetics
6610      this.getKinetics().add((MedicationKnowledgeKineticsComponent) value); // MedicationKnowledgeKineticsComponent
6611      return value;
6612    default:
6613      return super.setProperty(hash, name, value);
6614    }
6615
6616  }
6617
6618  @Override
6619  public Base setProperty(String name, Base value) throws FHIRException {
6620    if (name.equals("code")) {
6621      this.code = castToCodeableConcept(value); // CodeableConcept
6622    } else if (name.equals("status")) {
6623      value = new MedicationKnowledgeStatusEnumFactory().fromType(castToCode(value));
6624      this.status = (Enumeration) value; // Enumeration<MedicationKnowledgeStatus>
6625    } else if (name.equals("manufacturer")) {
6626      this.manufacturer = castToReference(value); // Reference
6627    } else if (name.equals("doseForm")) {
6628      this.doseForm = castToCodeableConcept(value); // CodeableConcept
6629    } else if (name.equals("amount")) {
6630      this.amount = castToQuantity(value); // Quantity
6631    } else if (name.equals("synonym")) {
6632      this.getSynonym().add(castToString(value));
6633    } else if (name.equals("relatedMedicationKnowledge")) {
6634      this.getRelatedMedicationKnowledge().add((MedicationKnowledgeRelatedMedicationKnowledgeComponent) value);
6635    } else if (name.equals("associatedMedication")) {
6636      this.getAssociatedMedication().add(castToReference(value));
6637    } else if (name.equals("productType")) {
6638      this.getProductType().add(castToCodeableConcept(value));
6639    } else if (name.equals("monograph")) {
6640      this.getMonograph().add((MedicationKnowledgeMonographComponent) value);
6641    } else if (name.equals("ingredient")) {
6642      this.getIngredient().add((MedicationKnowledgeIngredientComponent) value);
6643    } else if (name.equals("preparationInstruction")) {
6644      this.preparationInstruction = castToMarkdown(value); // MarkdownType
6645    } else if (name.equals("intendedRoute")) {
6646      this.getIntendedRoute().add(castToCodeableConcept(value));
6647    } else if (name.equals("cost")) {
6648      this.getCost().add((MedicationKnowledgeCostComponent) value);
6649    } else if (name.equals("monitoringProgram")) {
6650      this.getMonitoringProgram().add((MedicationKnowledgeMonitoringProgramComponent) value);
6651    } else if (name.equals("administrationGuidelines")) {
6652      this.getAdministrationGuidelines().add((MedicationKnowledgeAdministrationGuidelinesComponent) value);
6653    } else if (name.equals("medicineClassification")) {
6654      this.getMedicineClassification().add((MedicationKnowledgeMedicineClassificationComponent) value);
6655    } else if (name.equals("packaging")) {
6656      this.packaging = (MedicationKnowledgePackagingComponent) value; // MedicationKnowledgePackagingComponent
6657    } else if (name.equals("drugCharacteristic")) {
6658      this.getDrugCharacteristic().add((MedicationKnowledgeDrugCharacteristicComponent) value);
6659    } else if (name.equals("contraindication")) {
6660      this.getContraindication().add(castToReference(value));
6661    } else if (name.equals("regulatory")) {
6662      this.getRegulatory().add((MedicationKnowledgeRegulatoryComponent) value);
6663    } else if (name.equals("kinetics")) {
6664      this.getKinetics().add((MedicationKnowledgeKineticsComponent) value);
6665    } else
6666      return super.setProperty(name, value);
6667    return value;
6668  }
6669
6670  @Override
6671  public Base makeProperty(int hash, String name) throws FHIRException {
6672    switch (hash) {
6673    case 3059181:
6674      return getCode();
6675    case -892481550:
6676      return getStatusElement();
6677    case -1969347631:
6678      return getManufacturer();
6679    case 1303858817:
6680      return getDoseForm();
6681    case -1413853096:
6682      return getAmount();
6683    case -1742128133:
6684      return addSynonymElement();
6685    case 723067972:
6686      return addRelatedMedicationKnowledge();
6687    case 1312779381:
6688      return addAssociatedMedication();
6689    case -1491615543:
6690      return addProductType();
6691    case -1442980789:
6692      return addMonograph();
6693    case -206409263:
6694      return addIngredient();
6695    case 1025456503:
6696      return getPreparationInstructionElement();
6697    case -767798050:
6698      return addIntendedRoute();
6699    case 3059661:
6700      return addCost();
6701    case 569848092:
6702      return addMonitoringProgram();
6703    case 496930945:
6704      return addAdministrationGuidelines();
6705    case 1791551680:
6706      return addMedicineClassification();
6707    case 1802065795:
6708      return getPackaging();
6709    case -844126885:
6710      return addDrugCharacteristic();
6711    case 107135229:
6712      return addContraindication();
6713    case -27327848:
6714      return addRegulatory();
6715    case -553207110:
6716      return addKinetics();
6717    default:
6718      return super.makeProperty(hash, name);
6719    }
6720
6721  }
6722
6723  @Override
6724  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6725    switch (hash) {
6726    case 3059181:
6727      /* code */ return new String[] { "CodeableConcept" };
6728    case -892481550:
6729      /* status */ return new String[] { "code" };
6730    case -1969347631:
6731      /* manufacturer */ return new String[] { "Reference" };
6732    case 1303858817:
6733      /* doseForm */ return new String[] { "CodeableConcept" };
6734    case -1413853096:
6735      /* amount */ return new String[] { "SimpleQuantity" };
6736    case -1742128133:
6737      /* synonym */ return new String[] { "string" };
6738    case 723067972:
6739      /* relatedMedicationKnowledge */ return new String[] {};
6740    case 1312779381:
6741      /* associatedMedication */ return new String[] { "Reference" };
6742    case -1491615543:
6743      /* productType */ return new String[] { "CodeableConcept" };
6744    case -1442980789:
6745      /* monograph */ return new String[] {};
6746    case -206409263:
6747      /* ingredient */ return new String[] {};
6748    case 1025456503:
6749      /* preparationInstruction */ return new String[] { "markdown" };
6750    case -767798050:
6751      /* intendedRoute */ return new String[] { "CodeableConcept" };
6752    case 3059661:
6753      /* cost */ return new String[] {};
6754    case 569848092:
6755      /* monitoringProgram */ return new String[] {};
6756    case 496930945:
6757      /* administrationGuidelines */ return new String[] {};
6758    case 1791551680:
6759      /* medicineClassification */ return new String[] {};
6760    case 1802065795:
6761      /* packaging */ return new String[] {};
6762    case -844126885:
6763      /* drugCharacteristic */ return new String[] {};
6764    case 107135229:
6765      /* contraindication */ return new String[] { "Reference" };
6766    case -27327848:
6767      /* regulatory */ return new String[] {};
6768    case -553207110:
6769      /* kinetics */ return new String[] {};
6770    default:
6771      return super.getTypesForProperty(hash, name);
6772    }
6773
6774  }
6775
6776  @Override
6777  public Base addChild(String name) throws FHIRException {
6778    if (name.equals("code")) {
6779      this.code = new CodeableConcept();
6780      return this.code;
6781    } else if (name.equals("status")) {
6782      throw new FHIRException("Cannot call addChild on a singleton property MedicationKnowledge.status");
6783    } else if (name.equals("manufacturer")) {
6784      this.manufacturer = new Reference();
6785      return this.manufacturer;
6786    } else if (name.equals("doseForm")) {
6787      this.doseForm = new CodeableConcept();
6788      return this.doseForm;
6789    } else if (name.equals("amount")) {
6790      this.amount = new Quantity();
6791      return this.amount;
6792    } else if (name.equals("synonym")) {
6793      throw new FHIRException("Cannot call addChild on a singleton property MedicationKnowledge.synonym");
6794    } else if (name.equals("relatedMedicationKnowledge")) {
6795      return addRelatedMedicationKnowledge();
6796    } else if (name.equals("associatedMedication")) {
6797      return addAssociatedMedication();
6798    } else if (name.equals("productType")) {
6799      return addProductType();
6800    } else if (name.equals("monograph")) {
6801      return addMonograph();
6802    } else if (name.equals("ingredient")) {
6803      return addIngredient();
6804    } else if (name.equals("preparationInstruction")) {
6805      throw new FHIRException("Cannot call addChild on a singleton property MedicationKnowledge.preparationInstruction");
6806    } else if (name.equals("intendedRoute")) {
6807      return addIntendedRoute();
6808    } else if (name.equals("cost")) {
6809      return addCost();
6810    } else if (name.equals("monitoringProgram")) {
6811      return addMonitoringProgram();
6812    } else if (name.equals("administrationGuidelines")) {
6813      return addAdministrationGuidelines();
6814    } else if (name.equals("medicineClassification")) {
6815      return addMedicineClassification();
6816    } else if (name.equals("packaging")) {
6817      this.packaging = new MedicationKnowledgePackagingComponent();
6818      return this.packaging;
6819    } else if (name.equals("drugCharacteristic")) {
6820      return addDrugCharacteristic();
6821    } else if (name.equals("contraindication")) {
6822      return addContraindication();
6823    } else if (name.equals("regulatory")) {
6824      return addRegulatory();
6825    } else if (name.equals("kinetics")) {
6826      return addKinetics();
6827    } else
6828      return super.addChild(name);
6829  }
6830
6831  public String fhirType() {
6832    return "MedicationKnowledge";
6833
6834  }
6835
6836  public MedicationKnowledge copy() {
6837    MedicationKnowledge dst = new MedicationKnowledge();
6838    copyValues(dst);
6839    return dst;
6840  }
6841
6842  public void copyValues(MedicationKnowledge dst) {
6843    super.copyValues(dst);
6844    dst.code = code == null ? null : code.copy();
6845    dst.status = status == null ? null : status.copy();
6846    dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
6847    dst.doseForm = doseForm == null ? null : doseForm.copy();
6848    dst.amount = amount == null ? null : amount.copy();
6849    if (synonym != null) {
6850      dst.synonym = new ArrayList<StringType>();
6851      for (StringType i : synonym)
6852        dst.synonym.add(i.copy());
6853    }
6854    ;
6855    if (relatedMedicationKnowledge != null) {
6856      dst.relatedMedicationKnowledge = new ArrayList<MedicationKnowledgeRelatedMedicationKnowledgeComponent>();
6857      for (MedicationKnowledgeRelatedMedicationKnowledgeComponent i : relatedMedicationKnowledge)
6858        dst.relatedMedicationKnowledge.add(i.copy());
6859    }
6860    ;
6861    if (associatedMedication != null) {
6862      dst.associatedMedication = new ArrayList<Reference>();
6863      for (Reference i : associatedMedication)
6864        dst.associatedMedication.add(i.copy());
6865    }
6866    ;
6867    if (productType != null) {
6868      dst.productType = new ArrayList<CodeableConcept>();
6869      for (CodeableConcept i : productType)
6870        dst.productType.add(i.copy());
6871    }
6872    ;
6873    if (monograph != null) {
6874      dst.monograph = new ArrayList<MedicationKnowledgeMonographComponent>();
6875      for (MedicationKnowledgeMonographComponent i : monograph)
6876        dst.monograph.add(i.copy());
6877    }
6878    ;
6879    if (ingredient != null) {
6880      dst.ingredient = new ArrayList<MedicationKnowledgeIngredientComponent>();
6881      for (MedicationKnowledgeIngredientComponent i : ingredient)
6882        dst.ingredient.add(i.copy());
6883    }
6884    ;
6885    dst.preparationInstruction = preparationInstruction == null ? null : preparationInstruction.copy();
6886    if (intendedRoute != null) {
6887      dst.intendedRoute = new ArrayList<CodeableConcept>();
6888      for (CodeableConcept i : intendedRoute)
6889        dst.intendedRoute.add(i.copy());
6890    }
6891    ;
6892    if (cost != null) {
6893      dst.cost = new ArrayList<MedicationKnowledgeCostComponent>();
6894      for (MedicationKnowledgeCostComponent i : cost)
6895        dst.cost.add(i.copy());
6896    }
6897    ;
6898    if (monitoringProgram != null) {
6899      dst.monitoringProgram = new ArrayList<MedicationKnowledgeMonitoringProgramComponent>();
6900      for (MedicationKnowledgeMonitoringProgramComponent i : monitoringProgram)
6901        dst.monitoringProgram.add(i.copy());
6902    }
6903    ;
6904    if (administrationGuidelines != null) {
6905      dst.administrationGuidelines = new ArrayList<MedicationKnowledgeAdministrationGuidelinesComponent>();
6906      for (MedicationKnowledgeAdministrationGuidelinesComponent i : administrationGuidelines)
6907        dst.administrationGuidelines.add(i.copy());
6908    }
6909    ;
6910    if (medicineClassification != null) {
6911      dst.medicineClassification = new ArrayList<MedicationKnowledgeMedicineClassificationComponent>();
6912      for (MedicationKnowledgeMedicineClassificationComponent i : medicineClassification)
6913        dst.medicineClassification.add(i.copy());
6914    }
6915    ;
6916    dst.packaging = packaging == null ? null : packaging.copy();
6917    if (drugCharacteristic != null) {
6918      dst.drugCharacteristic = new ArrayList<MedicationKnowledgeDrugCharacteristicComponent>();
6919      for (MedicationKnowledgeDrugCharacteristicComponent i : drugCharacteristic)
6920        dst.drugCharacteristic.add(i.copy());
6921    }
6922    ;
6923    if (contraindication != null) {
6924      dst.contraindication = new ArrayList<Reference>();
6925      for (Reference i : contraindication)
6926        dst.contraindication.add(i.copy());
6927    }
6928    ;
6929    if (regulatory != null) {
6930      dst.regulatory = new ArrayList<MedicationKnowledgeRegulatoryComponent>();
6931      for (MedicationKnowledgeRegulatoryComponent i : regulatory)
6932        dst.regulatory.add(i.copy());
6933    }
6934    ;
6935    if (kinetics != null) {
6936      dst.kinetics = new ArrayList<MedicationKnowledgeKineticsComponent>();
6937      for (MedicationKnowledgeKineticsComponent i : kinetics)
6938        dst.kinetics.add(i.copy());
6939    }
6940    ;
6941  }
6942
6943  protected MedicationKnowledge typedCopy() {
6944    return copy();
6945  }
6946
6947  @Override
6948  public boolean equalsDeep(Base other_) {
6949    if (!super.equalsDeep(other_))
6950      return false;
6951    if (!(other_ instanceof MedicationKnowledge))
6952      return false;
6953    MedicationKnowledge o = (MedicationKnowledge) other_;
6954    return compareDeep(code, o.code, true) && compareDeep(status, o.status, true)
6955        && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(doseForm, o.doseForm, true)
6956        && compareDeep(amount, o.amount, true) && compareDeep(synonym, o.synonym, true)
6957        && compareDeep(relatedMedicationKnowledge, o.relatedMedicationKnowledge, true)
6958        && compareDeep(associatedMedication, o.associatedMedication, true)
6959        && compareDeep(productType, o.productType, true) && compareDeep(monograph, o.monograph, true)
6960        && compareDeep(ingredient, o.ingredient, true)
6961        && compareDeep(preparationInstruction, o.preparationInstruction, true)
6962        && compareDeep(intendedRoute, o.intendedRoute, true) && compareDeep(cost, o.cost, true)
6963        && compareDeep(monitoringProgram, o.monitoringProgram, true)
6964        && compareDeep(administrationGuidelines, o.administrationGuidelines, true)
6965        && compareDeep(medicineClassification, o.medicineClassification, true)
6966        && compareDeep(packaging, o.packaging, true) && compareDeep(drugCharacteristic, o.drugCharacteristic, true)
6967        && compareDeep(contraindication, o.contraindication, true) && compareDeep(regulatory, o.regulatory, true)
6968        && compareDeep(kinetics, o.kinetics, true);
6969  }
6970
6971  @Override
6972  public boolean equalsShallow(Base other_) {
6973    if (!super.equalsShallow(other_))
6974      return false;
6975    if (!(other_ instanceof MedicationKnowledge))
6976      return false;
6977    MedicationKnowledge o = (MedicationKnowledge) other_;
6978    return compareValues(status, o.status, true) && compareValues(synonym, o.synonym, true)
6979        && compareValues(preparationInstruction, o.preparationInstruction, true);
6980  }
6981
6982  public boolean isEmpty() {
6983    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, status, manufacturer, doseForm, amount,
6984        synonym, relatedMedicationKnowledge, associatedMedication, productType, monograph, ingredient,
6985        preparationInstruction, intendedRoute, cost, monitoringProgram, administrationGuidelines,
6986        medicineClassification, packaging, drugCharacteristic, contraindication, regulatory, kinetics);
6987  }
6988
6989  @Override
6990  public ResourceType getResourceType() {
6991    return ResourceType.MedicationKnowledge;
6992  }
6993
6994  /**
6995   * Search parameter: <b>code</b>
6996   * <p>
6997   * Description: <b>Code that identifies this medication</b><br>
6998   * Type: <b>token</b><br>
6999   * Path: <b>MedicationKnowledge.code</b><br>
7000   * </p>
7001   */
7002  @SearchParamDefinition(name = "code", path = "MedicationKnowledge.code", description = "Code that identifies this medication", type = "token")
7003  public static final String SP_CODE = "code";
7004  /**
7005   * <b>Fluent Client</b> search parameter constant for <b>code</b>
7006   * <p>
7007   * Description: <b>Code that identifies this medication</b><br>
7008   * Type: <b>token</b><br>
7009   * Path: <b>MedicationKnowledge.code</b><br>
7010   * </p>
7011   */
7012  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
7013      SP_CODE);
7014
7015  /**
7016   * Search parameter: <b>ingredient</b>
7017   * <p>
7018   * Description: <b>Medication(s) or substance(s) contained in the
7019   * medication</b><br>
7020   * Type: <b>reference</b><br>
7021   * Path: <b>MedicationKnowledge.ingredient.itemReference</b><br>
7022   * </p>
7023   */
7024  @SearchParamDefinition(name = "ingredient", path = "(MedicationKnowledge.ingredient.item as Reference)", description = "Medication(s) or substance(s) contained in the medication", type = "reference", target = {
7025      Substance.class })
7026  public static final String SP_INGREDIENT = "ingredient";
7027  /**
7028   * <b>Fluent Client</b> search parameter constant for <b>ingredient</b>
7029   * <p>
7030   * Description: <b>Medication(s) or substance(s) contained in the
7031   * medication</b><br>
7032   * Type: <b>reference</b><br>
7033   * Path: <b>MedicationKnowledge.ingredient.itemReference</b><br>
7034   * </p>
7035   */
7036  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INGREDIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
7037      SP_INGREDIENT);
7038
7039  /**
7040   * Constant for fluent queries to be used to add include statements. Specifies
7041   * the path value of "<b>MedicationKnowledge:ingredient</b>".
7042   */
7043  public static final ca.uhn.fhir.model.api.Include INCLUDE_INGREDIENT = new ca.uhn.fhir.model.api.Include(
7044      "MedicationKnowledge:ingredient").toLocked();
7045
7046  /**
7047   * Search parameter: <b>doseform</b>
7048   * <p>
7049   * Description: <b>powder | tablets | capsule +</b><br>
7050   * Type: <b>token</b><br>
7051   * Path: <b>MedicationKnowledge.doseForm</b><br>
7052   * </p>
7053   */
7054  @SearchParamDefinition(name = "doseform", path = "MedicationKnowledge.doseForm", description = "powder | tablets | capsule +", type = "token")
7055  public static final String SP_DOSEFORM = "doseform";
7056  /**
7057   * <b>Fluent Client</b> search parameter constant for <b>doseform</b>
7058   * <p>
7059   * Description: <b>powder | tablets | capsule +</b><br>
7060   * Type: <b>token</b><br>
7061   * Path: <b>MedicationKnowledge.doseForm</b><br>
7062   * </p>
7063   */
7064  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DOSEFORM = new ca.uhn.fhir.rest.gclient.TokenClientParam(
7065      SP_DOSEFORM);
7066
7067  /**
7068   * Search parameter: <b>classification-type</b>
7069   * <p>
7070   * Description: <b>The type of category for the medication (for example,
7071   * therapeutic classification, therapeutic sub-classification)</b><br>
7072   * Type: <b>token</b><br>
7073   * Path: <b>MedicationKnowledge.medicineClassification.type</b><br>
7074   * </p>
7075   */
7076  @SearchParamDefinition(name = "classification-type", path = "MedicationKnowledge.medicineClassification.type", description = "The type of category for the medication (for example, therapeutic classification, therapeutic sub-classification)", type = "token")
7077  public static final String SP_CLASSIFICATION_TYPE = "classification-type";
7078  /**
7079   * <b>Fluent Client</b> search parameter constant for <b>classification-type</b>
7080   * <p>
7081   * Description: <b>The type of category for the medication (for example,
7082   * therapeutic classification, therapeutic sub-classification)</b><br>
7083   * Type: <b>token</b><br>
7084   * Path: <b>MedicationKnowledge.medicineClassification.type</b><br>
7085   * </p>
7086   */
7087  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLASSIFICATION_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
7088      SP_CLASSIFICATION_TYPE);
7089
7090  /**
7091   * Search parameter: <b>monograph-type</b>
7092   * <p>
7093   * Description: <b>The category of medication document</b><br>
7094   * Type: <b>token</b><br>
7095   * Path: <b>MedicationKnowledge.monograph.type</b><br>
7096   * </p>
7097   */
7098  @SearchParamDefinition(name = "monograph-type", path = "MedicationKnowledge.monograph.type", description = "The category of medication document", type = "token")
7099  public static final String SP_MONOGRAPH_TYPE = "monograph-type";
7100  /**
7101   * <b>Fluent Client</b> search parameter constant for <b>monograph-type</b>
7102   * <p>
7103   * Description: <b>The category of medication document</b><br>
7104   * Type: <b>token</b><br>
7105   * Path: <b>MedicationKnowledge.monograph.type</b><br>
7106   * </p>
7107   */
7108  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MONOGRAPH_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
7109      SP_MONOGRAPH_TYPE);
7110
7111  /**
7112   * Search parameter: <b>classification</b>
7113   * <p>
7114   * Description: <b>Specific category assigned to the medication</b><br>
7115   * Type: <b>token</b><br>
7116   * Path: <b>MedicationKnowledge.medicineClassification.classification</b><br>
7117   * </p>
7118   */
7119  @SearchParamDefinition(name = "classification", path = "MedicationKnowledge.medicineClassification.classification", description = "Specific category assigned to the medication", type = "token")
7120  public static final String SP_CLASSIFICATION = "classification";
7121  /**
7122   * <b>Fluent Client</b> search parameter constant for <b>classification</b>
7123   * <p>
7124   * Description: <b>Specific category assigned to the medication</b><br>
7125   * Type: <b>token</b><br>
7126   * Path: <b>MedicationKnowledge.medicineClassification.classification</b><br>
7127   * </p>
7128   */
7129  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLASSIFICATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(
7130      SP_CLASSIFICATION);
7131
7132  /**
7133   * Search parameter: <b>manufacturer</b>
7134   * <p>
7135   * Description: <b>Manufacturer of the item</b><br>
7136   * Type: <b>reference</b><br>
7137   * Path: <b>MedicationKnowledge.manufacturer</b><br>
7138   * </p>
7139   */
7140  @SearchParamDefinition(name = "manufacturer", path = "MedicationKnowledge.manufacturer", description = "Manufacturer of the item", type = "reference", target = {
7141      Organization.class })
7142  public static final String SP_MANUFACTURER = "manufacturer";
7143  /**
7144   * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b>
7145   * <p>
7146   * Description: <b>Manufacturer of the item</b><br>
7147   * Type: <b>reference</b><br>
7148   * Path: <b>MedicationKnowledge.manufacturer</b><br>
7149   * </p>
7150   */
7151  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
7152      SP_MANUFACTURER);
7153
7154  /**
7155   * Constant for fluent queries to be used to add include statements. Specifies
7156   * the path value of "<b>MedicationKnowledge:manufacturer</b>".
7157   */
7158  public static final ca.uhn.fhir.model.api.Include INCLUDE_MANUFACTURER = new ca.uhn.fhir.model.api.Include(
7159      "MedicationKnowledge:manufacturer").toLocked();
7160
7161  /**
7162   * Search parameter: <b>ingredient-code</b>
7163   * <p>
7164   * Description: <b>Medication(s) or substance(s) contained in the
7165   * medication</b><br>
7166   * Type: <b>token</b><br>
7167   * Path: <b>MedicationKnowledge.ingredient.itemCodeableConcept</b><br>
7168   * </p>
7169   */
7170  @SearchParamDefinition(name = "ingredient-code", path = "(MedicationKnowledge.ingredient.item as CodeableConcept)", description = "Medication(s) or substance(s) contained in the medication", type = "token")
7171  public static final String SP_INGREDIENT_CODE = "ingredient-code";
7172  /**
7173   * <b>Fluent Client</b> search parameter constant for <b>ingredient-code</b>
7174   * <p>
7175   * Description: <b>Medication(s) or substance(s) contained in the
7176   * medication</b><br>
7177   * Type: <b>token</b><br>
7178   * Path: <b>MedicationKnowledge.ingredient.itemCodeableConcept</b><br>
7179   * </p>
7180   */
7181  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INGREDIENT_CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
7182      SP_INGREDIENT_CODE);
7183
7184  /**
7185   * Search parameter: <b>source-cost</b>
7186   * <p>
7187   * Description: <b>The source or owner for the price information</b><br>
7188   * Type: <b>token</b><br>
7189   * Path: <b>MedicationKnowledge.cost.source</b><br>
7190   * </p>
7191   */
7192  @SearchParamDefinition(name = "source-cost", path = "MedicationKnowledge.cost.source", description = "The source or owner for the price information", type = "token")
7193  public static final String SP_SOURCE_COST = "source-cost";
7194  /**
7195   * <b>Fluent Client</b> search parameter constant for <b>source-cost</b>
7196   * <p>
7197   * Description: <b>The source or owner for the price information</b><br>
7198   * Type: <b>token</b><br>
7199   * Path: <b>MedicationKnowledge.cost.source</b><br>
7200   * </p>
7201   */
7202  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SOURCE_COST = new ca.uhn.fhir.rest.gclient.TokenClientParam(
7203      SP_SOURCE_COST);
7204
7205  /**
7206   * Search parameter: <b>monograph</b>
7207   * <p>
7208   * Description: <b>Associated documentation about the medication</b><br>
7209   * Type: <b>reference</b><br>
7210   * Path: <b>MedicationKnowledge.monograph.source</b><br>
7211   * </p>
7212   */
7213  @SearchParamDefinition(name = "monograph", path = "MedicationKnowledge.monograph.source", description = "Associated documentation about the medication", type = "reference", target = {
7214      DocumentReference.class, Media.class })
7215  public static final String SP_MONOGRAPH = "monograph";
7216  /**
7217   * <b>Fluent Client</b> search parameter constant for <b>monograph</b>
7218   * <p>
7219   * Description: <b>Associated documentation about the medication</b><br>
7220   * Type: <b>reference</b><br>
7221   * Path: <b>MedicationKnowledge.monograph.source</b><br>
7222   * </p>
7223   */
7224  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MONOGRAPH = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
7225      SP_MONOGRAPH);
7226
7227  /**
7228   * Constant for fluent queries to be used to add include statements. Specifies
7229   * the path value of "<b>MedicationKnowledge:monograph</b>".
7230   */
7231  public static final ca.uhn.fhir.model.api.Include INCLUDE_MONOGRAPH = new ca.uhn.fhir.model.api.Include(
7232      "MedicationKnowledge:monograph").toLocked();
7233
7234  /**
7235   * Search parameter: <b>monitoring-program-name</b>
7236   * <p>
7237   * Description: <b>Name of the reviewing program</b><br>
7238   * Type: <b>token</b><br>
7239   * Path: <b>MedicationKnowledge.monitoringProgram.name</b><br>
7240   * </p>
7241   */
7242  @SearchParamDefinition(name = "monitoring-program-name", path = "MedicationKnowledge.monitoringProgram.name", description = "Name of the reviewing program", type = "token")
7243  public static final String SP_MONITORING_PROGRAM_NAME = "monitoring-program-name";
7244  /**
7245   * <b>Fluent Client</b> search parameter constant for
7246   * <b>monitoring-program-name</b>
7247   * <p>
7248   * Description: <b>Name of the reviewing program</b><br>
7249   * Type: <b>token</b><br>
7250   * Path: <b>MedicationKnowledge.monitoringProgram.name</b><br>
7251   * </p>
7252   */
7253  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MONITORING_PROGRAM_NAME = new ca.uhn.fhir.rest.gclient.TokenClientParam(
7254      SP_MONITORING_PROGRAM_NAME);
7255
7256  /**
7257   * Search parameter: <b>monitoring-program-type</b>
7258   * <p>
7259   * Description: <b>Type of program under which the medication is
7260   * monitored</b><br>
7261   * Type: <b>token</b><br>
7262   * Path: <b>MedicationKnowledge.monitoringProgram.type</b><br>
7263   * </p>
7264   */
7265  @SearchParamDefinition(name = "monitoring-program-type", path = "MedicationKnowledge.monitoringProgram.type", description = "Type of program under which the medication is monitored", type = "token")
7266  public static final String SP_MONITORING_PROGRAM_TYPE = "monitoring-program-type";
7267  /**
7268   * <b>Fluent Client</b> search parameter constant for
7269   * <b>monitoring-program-type</b>
7270   * <p>
7271   * Description: <b>Type of program under which the medication is
7272   * monitored</b><br>
7273   * Type: <b>token</b><br>
7274   * Path: <b>MedicationKnowledge.monitoringProgram.type</b><br>
7275   * </p>
7276   */
7277  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MONITORING_PROGRAM_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
7278      SP_MONITORING_PROGRAM_TYPE);
7279
7280  /**
7281   * Search parameter: <b>status</b>
7282   * <p>
7283   * Description: <b>active | inactive | entered-in-error</b><br>
7284   * Type: <b>token</b><br>
7285   * Path: <b>MedicationKnowledge.status</b><br>
7286   * </p>
7287   */
7288  @SearchParamDefinition(name = "status", path = "MedicationKnowledge.status", description = "active | inactive | entered-in-error", type = "token")
7289  public static final String SP_STATUS = "status";
7290  /**
7291   * <b>Fluent Client</b> search parameter constant for <b>status</b>
7292   * <p>
7293   * Description: <b>active | inactive | entered-in-error</b><br>
7294   * Type: <b>token</b><br>
7295   * Path: <b>MedicationKnowledge.status</b><br>
7296   * </p>
7297   */
7298  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
7299      SP_STATUS);
7300
7301}