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