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