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