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