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