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