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