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