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