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