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