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