001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * This resource allows for the definition of various types of plans as a sharable, consumable, and executable artifact. The resource is general enough to support the description of a broad range of clinical and non-clinical artifacts such as clinical decision support rules, order sets, protocols, and drug quality specifications.
052 */
053@ResourceDef(name="PlanDefinition", profile="http://hl7.org/fhir/StructureDefinition/PlanDefinition")
054public class PlanDefinition extends MetadataResource {
055
056    @Block()
057    public static class PlanDefinitionGoalComponent extends BackboneElement implements IBaseBackboneElement {
058        /**
059         * Indicates a category the goal falls within.
060         */
061        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
062        @Description(shortDefinition="E.g. Treatment, dietary, behavioral", formalDefinition="Indicates a category the goal falls within." )
063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-category")
064        protected CodeableConcept category;
065
066        /**
067         * Human-readable and/or coded description of a specific desired objective of care, such as "control blood pressure" or "negotiate an obstacle course" or "dance with child at wedding".
068         */
069        @Child(name = "description", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=false)
070        @Description(shortDefinition="Code or text describing the goal", formalDefinition="Human-readable and/or coded description of a specific desired objective of care, such as \"control blood pressure\" or \"negotiate an obstacle course\" or \"dance with child at wedding\"." )
071        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/clinical-findings")
072        protected CodeableConcept description;
073
074        /**
075         * Identifies the expected level of importance associated with reaching/sustaining the defined goal.
076         */
077        @Child(name = "priority", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
078        @Description(shortDefinition="high-priority | medium-priority | low-priority", formalDefinition="Identifies the expected level of importance associated with reaching/sustaining the defined goal." )
079        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-priority")
080        protected CodeableConcept priority;
081
082        /**
083         * The event after which the goal should begin being pursued.
084         */
085        @Child(name = "start", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
086        @Description(shortDefinition="When goal pursuit begins", formalDefinition="The event after which the goal should begin being pursued." )
087        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/goal-start-event")
088        protected CodeableConcept start;
089
090        /**
091         * Identifies problems, conditions, issues, or concerns the goal is intended to address.
092         */
093        @Child(name = "addresses", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
094        @Description(shortDefinition="What does the goal address", formalDefinition="Identifies problems, conditions, issues, or concerns the goal is intended to address." )
095        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code")
096        protected List<CodeableConcept> addresses;
097
098        /**
099         * Didactic or other informational resources associated with the goal that provide further supporting information about the goal. Information resources can include inline text commentary and links to web resources.
100         */
101        @Child(name = "documentation", type = {RelatedArtifact.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
102        @Description(shortDefinition="Supporting documentation for the goal", formalDefinition="Didactic or other informational resources associated with the goal that provide further supporting information about the goal. Information resources can include inline text commentary and links to web resources." )
103        protected List<RelatedArtifact> documentation;
104
105        /**
106         * Indicates what should be done and within what timeframe.
107         */
108        @Child(name = "target", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
109        @Description(shortDefinition="Target outcome for the goal", formalDefinition="Indicates what should be done and within what timeframe." )
110        protected List<PlanDefinitionGoalTargetComponent> target;
111
112        private static final long serialVersionUID = -795308926L;
113
114    /**
115     * Constructor
116     */
117      public PlanDefinitionGoalComponent() {
118        super();
119      }
120
121    /**
122     * Constructor
123     */
124      public PlanDefinitionGoalComponent(CodeableConcept description) {
125        super();
126        this.setDescription(description);
127      }
128
129        /**
130         * @return {@link #category} (Indicates a category the goal falls within.)
131         */
132        public CodeableConcept getCategory() { 
133          if (this.category == null)
134            if (Configuration.errorOnAutoCreate())
135              throw new Error("Attempt to auto-create PlanDefinitionGoalComponent.category");
136            else if (Configuration.doAutoCreate())
137              this.category = new CodeableConcept(); // cc
138          return this.category;
139        }
140
141        public boolean hasCategory() { 
142          return this.category != null && !this.category.isEmpty();
143        }
144
145        /**
146         * @param value {@link #category} (Indicates a category the goal falls within.)
147         */
148        public PlanDefinitionGoalComponent setCategory(CodeableConcept value) { 
149          this.category = value;
150          return this;
151        }
152
153        /**
154         * @return {@link #description} (Human-readable and/or coded description of a specific desired objective of care, such as "control blood pressure" or "negotiate an obstacle course" or "dance with child at wedding".)
155         */
156        public CodeableConcept getDescription() { 
157          if (this.description == null)
158            if (Configuration.errorOnAutoCreate())
159              throw new Error("Attempt to auto-create PlanDefinitionGoalComponent.description");
160            else if (Configuration.doAutoCreate())
161              this.description = new CodeableConcept(); // cc
162          return this.description;
163        }
164
165        public boolean hasDescription() { 
166          return this.description != null && !this.description.isEmpty();
167        }
168
169        /**
170         * @param value {@link #description} (Human-readable and/or coded description of a specific desired objective of care, such as "control blood pressure" or "negotiate an obstacle course" or "dance with child at wedding".)
171         */
172        public PlanDefinitionGoalComponent setDescription(CodeableConcept value) { 
173          this.description = value;
174          return this;
175        }
176
177        /**
178         * @return {@link #priority} (Identifies the expected level of importance associated with reaching/sustaining the defined goal.)
179         */
180        public CodeableConcept getPriority() { 
181          if (this.priority == null)
182            if (Configuration.errorOnAutoCreate())
183              throw new Error("Attempt to auto-create PlanDefinitionGoalComponent.priority");
184            else if (Configuration.doAutoCreate())
185              this.priority = new CodeableConcept(); // cc
186          return this.priority;
187        }
188
189        public boolean hasPriority() { 
190          return this.priority != null && !this.priority.isEmpty();
191        }
192
193        /**
194         * @param value {@link #priority} (Identifies the expected level of importance associated with reaching/sustaining the defined goal.)
195         */
196        public PlanDefinitionGoalComponent setPriority(CodeableConcept value) { 
197          this.priority = value;
198          return this;
199        }
200
201        /**
202         * @return {@link #start} (The event after which the goal should begin being pursued.)
203         */
204        public CodeableConcept getStart() { 
205          if (this.start == null)
206            if (Configuration.errorOnAutoCreate())
207              throw new Error("Attempt to auto-create PlanDefinitionGoalComponent.start");
208            else if (Configuration.doAutoCreate())
209              this.start = new CodeableConcept(); // cc
210          return this.start;
211        }
212
213        public boolean hasStart() { 
214          return this.start != null && !this.start.isEmpty();
215        }
216
217        /**
218         * @param value {@link #start} (The event after which the goal should begin being pursued.)
219         */
220        public PlanDefinitionGoalComponent setStart(CodeableConcept value) { 
221          this.start = value;
222          return this;
223        }
224
225        /**
226         * @return {@link #addresses} (Identifies problems, conditions, issues, or concerns the goal is intended to address.)
227         */
228        public List<CodeableConcept> getAddresses() { 
229          if (this.addresses == null)
230            this.addresses = new ArrayList<CodeableConcept>();
231          return this.addresses;
232        }
233
234        /**
235         * @return Returns a reference to <code>this</code> for easy method chaining
236         */
237        public PlanDefinitionGoalComponent setAddresses(List<CodeableConcept> theAddresses) { 
238          this.addresses = theAddresses;
239          return this;
240        }
241
242        public boolean hasAddresses() { 
243          if (this.addresses == null)
244            return false;
245          for (CodeableConcept item : this.addresses)
246            if (!item.isEmpty())
247              return true;
248          return false;
249        }
250
251        public CodeableConcept addAddresses() { //3
252          CodeableConcept t = new CodeableConcept();
253          if (this.addresses == null)
254            this.addresses = new ArrayList<CodeableConcept>();
255          this.addresses.add(t);
256          return t;
257        }
258
259        public PlanDefinitionGoalComponent addAddresses(CodeableConcept t) { //3
260          if (t == null)
261            return this;
262          if (this.addresses == null)
263            this.addresses = new ArrayList<CodeableConcept>();
264          this.addresses.add(t);
265          return this;
266        }
267
268        /**
269         * @return The first repetition of repeating field {@link #addresses}, creating it if it does not already exist {3}
270         */
271        public CodeableConcept getAddressesFirstRep() { 
272          if (getAddresses().isEmpty()) {
273            addAddresses();
274          }
275          return getAddresses().get(0);
276        }
277
278        /**
279         * @return {@link #documentation} (Didactic or other informational resources associated with the goal that provide further supporting information about the goal. Information resources can include inline text commentary and links to web resources.)
280         */
281        public List<RelatedArtifact> getDocumentation() { 
282          if (this.documentation == null)
283            this.documentation = new ArrayList<RelatedArtifact>();
284          return this.documentation;
285        }
286
287        /**
288         * @return Returns a reference to <code>this</code> for easy method chaining
289         */
290        public PlanDefinitionGoalComponent setDocumentation(List<RelatedArtifact> theDocumentation) { 
291          this.documentation = theDocumentation;
292          return this;
293        }
294
295        public boolean hasDocumentation() { 
296          if (this.documentation == null)
297            return false;
298          for (RelatedArtifact item : this.documentation)
299            if (!item.isEmpty())
300              return true;
301          return false;
302        }
303
304        public RelatedArtifact addDocumentation() { //3
305          RelatedArtifact t = new RelatedArtifact();
306          if (this.documentation == null)
307            this.documentation = new ArrayList<RelatedArtifact>();
308          this.documentation.add(t);
309          return t;
310        }
311
312        public PlanDefinitionGoalComponent addDocumentation(RelatedArtifact t) { //3
313          if (t == null)
314            return this;
315          if (this.documentation == null)
316            this.documentation = new ArrayList<RelatedArtifact>();
317          this.documentation.add(t);
318          return this;
319        }
320
321        /**
322         * @return The first repetition of repeating field {@link #documentation}, creating it if it does not already exist {3}
323         */
324        public RelatedArtifact getDocumentationFirstRep() { 
325          if (getDocumentation().isEmpty()) {
326            addDocumentation();
327          }
328          return getDocumentation().get(0);
329        }
330
331        /**
332         * @return {@link #target} (Indicates what should be done and within what timeframe.)
333         */
334        public List<PlanDefinitionGoalTargetComponent> getTarget() { 
335          if (this.target == null)
336            this.target = new ArrayList<PlanDefinitionGoalTargetComponent>();
337          return this.target;
338        }
339
340        /**
341         * @return Returns a reference to <code>this</code> for easy method chaining
342         */
343        public PlanDefinitionGoalComponent setTarget(List<PlanDefinitionGoalTargetComponent> theTarget) { 
344          this.target = theTarget;
345          return this;
346        }
347
348        public boolean hasTarget() { 
349          if (this.target == null)
350            return false;
351          for (PlanDefinitionGoalTargetComponent item : this.target)
352            if (!item.isEmpty())
353              return true;
354          return false;
355        }
356
357        public PlanDefinitionGoalTargetComponent addTarget() { //3
358          PlanDefinitionGoalTargetComponent t = new PlanDefinitionGoalTargetComponent();
359          if (this.target == null)
360            this.target = new ArrayList<PlanDefinitionGoalTargetComponent>();
361          this.target.add(t);
362          return t;
363        }
364
365        public PlanDefinitionGoalComponent addTarget(PlanDefinitionGoalTargetComponent t) { //3
366          if (t == null)
367            return this;
368          if (this.target == null)
369            this.target = new ArrayList<PlanDefinitionGoalTargetComponent>();
370          this.target.add(t);
371          return this;
372        }
373
374        /**
375         * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist {3}
376         */
377        public PlanDefinitionGoalTargetComponent getTargetFirstRep() { 
378          if (getTarget().isEmpty()) {
379            addTarget();
380          }
381          return getTarget().get(0);
382        }
383
384        protected void listChildren(List<Property> children) {
385          super.listChildren(children);
386          children.add(new Property("category", "CodeableConcept", "Indicates a category the goal falls within.", 0, 1, category));
387          children.add(new Property("description", "CodeableConcept", "Human-readable and/or coded description of a specific desired objective of care, such as \"control blood pressure\" or \"negotiate an obstacle course\" or \"dance with child at wedding\".", 0, 1, description));
388          children.add(new Property("priority", "CodeableConcept", "Identifies the expected level of importance associated with reaching/sustaining the defined goal.", 0, 1, priority));
389          children.add(new Property("start", "CodeableConcept", "The event after which the goal should begin being pursued.", 0, 1, start));
390          children.add(new Property("addresses", "CodeableConcept", "Identifies problems, conditions, issues, or concerns the goal is intended to address.", 0, java.lang.Integer.MAX_VALUE, addresses));
391          children.add(new Property("documentation", "RelatedArtifact", "Didactic or other informational resources associated with the goal that provide further supporting information about the goal. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation));
392          children.add(new Property("target", "", "Indicates what should be done and within what timeframe.", 0, java.lang.Integer.MAX_VALUE, target));
393        }
394
395        @Override
396        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
397          switch (_hash) {
398          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Indicates a category the goal falls within.", 0, 1, category);
399          case -1724546052: /*description*/  return new Property("description", "CodeableConcept", "Human-readable and/or coded description of a specific desired objective of care, such as \"control blood pressure\" or \"negotiate an obstacle course\" or \"dance with child at wedding\".", 0, 1, description);
400          case -1165461084: /*priority*/  return new Property("priority", "CodeableConcept", "Identifies the expected level of importance associated with reaching/sustaining the defined goal.", 0, 1, priority);
401          case 109757538: /*start*/  return new Property("start", "CodeableConcept", "The event after which the goal should begin being pursued.", 0, 1, start);
402          case 874544034: /*addresses*/  return new Property("addresses", "CodeableConcept", "Identifies problems, conditions, issues, or concerns the goal is intended to address.", 0, java.lang.Integer.MAX_VALUE, addresses);
403          case 1587405498: /*documentation*/  return new Property("documentation", "RelatedArtifact", "Didactic or other informational resources associated with the goal that provide further supporting information about the goal. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation);
404          case -880905839: /*target*/  return new Property("target", "", "Indicates what should be done and within what timeframe.", 0, java.lang.Integer.MAX_VALUE, target);
405          default: return super.getNamedProperty(_hash, _name, _checkValid);
406          }
407
408        }
409
410      @Override
411      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
412        switch (hash) {
413        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
414        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // CodeableConcept
415        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // CodeableConcept
416        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // CodeableConcept
417        case 874544034: /*addresses*/ return this.addresses == null ? new Base[0] : this.addresses.toArray(new Base[this.addresses.size()]); // CodeableConcept
418        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : this.documentation.toArray(new Base[this.documentation.size()]); // RelatedArtifact
419        case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // PlanDefinitionGoalTargetComponent
420        default: return super.getProperty(hash, name, checkValid);
421        }
422
423      }
424
425      @Override
426      public Base setProperty(int hash, String name, Base value) throws FHIRException {
427        switch (hash) {
428        case 50511102: // category
429          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
430          return value;
431        case -1724546052: // description
432          this.description = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
433          return value;
434        case -1165461084: // priority
435          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
436          return value;
437        case 109757538: // start
438          this.start = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
439          return value;
440        case 874544034: // addresses
441          this.getAddresses().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
442          return value;
443        case 1587405498: // documentation
444          this.getDocumentation().add(TypeConvertor.castToRelatedArtifact(value)); // RelatedArtifact
445          return value;
446        case -880905839: // target
447          this.getTarget().add((PlanDefinitionGoalTargetComponent) value); // PlanDefinitionGoalTargetComponent
448          return value;
449        default: return super.setProperty(hash, name, value);
450        }
451
452      }
453
454      @Override
455      public Base setProperty(String name, Base value) throws FHIRException {
456        if (name.equals("category")) {
457          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
458        } else if (name.equals("description")) {
459          this.description = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
460        } else if (name.equals("priority")) {
461          this.priority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
462        } else if (name.equals("start")) {
463          this.start = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
464        } else if (name.equals("addresses")) {
465          this.getAddresses().add(TypeConvertor.castToCodeableConcept(value));
466        } else if (name.equals("documentation")) {
467          this.getDocumentation().add(TypeConvertor.castToRelatedArtifact(value));
468        } else if (name.equals("target")) {
469          this.getTarget().add((PlanDefinitionGoalTargetComponent) value);
470        } else
471          return super.setProperty(name, value);
472        return value;
473      }
474
475      @Override
476      public Base makeProperty(int hash, String name) throws FHIRException {
477        switch (hash) {
478        case 50511102:  return getCategory();
479        case -1724546052:  return getDescription();
480        case -1165461084:  return getPriority();
481        case 109757538:  return getStart();
482        case 874544034:  return addAddresses(); 
483        case 1587405498:  return addDocumentation(); 
484        case -880905839:  return addTarget(); 
485        default: return super.makeProperty(hash, name);
486        }
487
488      }
489
490      @Override
491      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
492        switch (hash) {
493        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
494        case -1724546052: /*description*/ return new String[] {"CodeableConcept"};
495        case -1165461084: /*priority*/ return new String[] {"CodeableConcept"};
496        case 109757538: /*start*/ return new String[] {"CodeableConcept"};
497        case 874544034: /*addresses*/ return new String[] {"CodeableConcept"};
498        case 1587405498: /*documentation*/ return new String[] {"RelatedArtifact"};
499        case -880905839: /*target*/ return new String[] {};
500        default: return super.getTypesForProperty(hash, name);
501        }
502
503      }
504
505      @Override
506      public Base addChild(String name) throws FHIRException {
507        if (name.equals("category")) {
508          this.category = new CodeableConcept();
509          return this.category;
510        }
511        else if (name.equals("description")) {
512          this.description = new CodeableConcept();
513          return this.description;
514        }
515        else if (name.equals("priority")) {
516          this.priority = new CodeableConcept();
517          return this.priority;
518        }
519        else if (name.equals("start")) {
520          this.start = new CodeableConcept();
521          return this.start;
522        }
523        else if (name.equals("addresses")) {
524          return addAddresses();
525        }
526        else if (name.equals("documentation")) {
527          return addDocumentation();
528        }
529        else if (name.equals("target")) {
530          return addTarget();
531        }
532        else
533          return super.addChild(name);
534      }
535
536      public PlanDefinitionGoalComponent copy() {
537        PlanDefinitionGoalComponent dst = new PlanDefinitionGoalComponent();
538        copyValues(dst);
539        return dst;
540      }
541
542      public void copyValues(PlanDefinitionGoalComponent dst) {
543        super.copyValues(dst);
544        dst.category = category == null ? null : category.copy();
545        dst.description = description == null ? null : description.copy();
546        dst.priority = priority == null ? null : priority.copy();
547        dst.start = start == null ? null : start.copy();
548        if (addresses != null) {
549          dst.addresses = new ArrayList<CodeableConcept>();
550          for (CodeableConcept i : addresses)
551            dst.addresses.add(i.copy());
552        };
553        if (documentation != null) {
554          dst.documentation = new ArrayList<RelatedArtifact>();
555          for (RelatedArtifact i : documentation)
556            dst.documentation.add(i.copy());
557        };
558        if (target != null) {
559          dst.target = new ArrayList<PlanDefinitionGoalTargetComponent>();
560          for (PlanDefinitionGoalTargetComponent i : target)
561            dst.target.add(i.copy());
562        };
563      }
564
565      @Override
566      public boolean equalsDeep(Base other_) {
567        if (!super.equalsDeep(other_))
568          return false;
569        if (!(other_ instanceof PlanDefinitionGoalComponent))
570          return false;
571        PlanDefinitionGoalComponent o = (PlanDefinitionGoalComponent) other_;
572        return compareDeep(category, o.category, true) && compareDeep(description, o.description, true)
573           && compareDeep(priority, o.priority, true) && compareDeep(start, o.start, true) && compareDeep(addresses, o.addresses, true)
574           && compareDeep(documentation, o.documentation, true) && compareDeep(target, o.target, true);
575      }
576
577      @Override
578      public boolean equalsShallow(Base other_) {
579        if (!super.equalsShallow(other_))
580          return false;
581        if (!(other_ instanceof PlanDefinitionGoalComponent))
582          return false;
583        PlanDefinitionGoalComponent o = (PlanDefinitionGoalComponent) other_;
584        return true;
585      }
586
587      public boolean isEmpty() {
588        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, description, priority
589          , start, addresses, documentation, target);
590      }
591
592  public String fhirType() {
593    return "PlanDefinition.goal";
594
595  }
596
597  }
598
599    @Block()
600    public static class PlanDefinitionGoalTargetComponent extends BackboneElement implements IBaseBackboneElement {
601        /**
602         * The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.
603         */
604        @Child(name = "measure", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
605        @Description(shortDefinition="The parameter whose value is to be tracked", formalDefinition="The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level." )
606        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/observation-codes")
607        protected CodeableConcept measure;
608
609        /**
610         * The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.
611         */
612        @Child(name = "detail", type = {Quantity.class, Range.class, CodeableConcept.class, StringType.class, BooleanType.class, IntegerType.class, Ratio.class}, order=2, min=0, max=1, modifier=false, summary=false)
613        @Description(shortDefinition="The target value to be achieved", formalDefinition="The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value." )
614        protected DataType detail;
615
616        /**
617         * Indicates the timeframe after the start of the goal in which the goal should be met.
618         */
619        @Child(name = "due", type = {Duration.class}, order=3, min=0, max=1, modifier=false, summary=false)
620        @Description(shortDefinition="Reach goal within", formalDefinition="Indicates the timeframe after the start of the goal in which the goal should be met." )
621        protected Duration due;
622
623        private static final long serialVersionUID = -1464475626L;
624
625    /**
626     * Constructor
627     */
628      public PlanDefinitionGoalTargetComponent() {
629        super();
630      }
631
632        /**
633         * @return {@link #measure} (The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.)
634         */
635        public CodeableConcept getMeasure() { 
636          if (this.measure == null)
637            if (Configuration.errorOnAutoCreate())
638              throw new Error("Attempt to auto-create PlanDefinitionGoalTargetComponent.measure");
639            else if (Configuration.doAutoCreate())
640              this.measure = new CodeableConcept(); // cc
641          return this.measure;
642        }
643
644        public boolean hasMeasure() { 
645          return this.measure != null && !this.measure.isEmpty();
646        }
647
648        /**
649         * @param value {@link #measure} (The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.)
650         */
651        public PlanDefinitionGoalTargetComponent setMeasure(CodeableConcept value) { 
652          this.measure = value;
653          return this;
654        }
655
656        /**
657         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
658         */
659        public DataType getDetail() { 
660          return this.detail;
661        }
662
663        /**
664         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
665         */
666        public Quantity getDetailQuantity() throws FHIRException { 
667          if (this.detail == null)
668            this.detail = new Quantity();
669          if (!(this.detail instanceof Quantity))
670            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.detail.getClass().getName()+" was encountered");
671          return (Quantity) this.detail;
672        }
673
674        public boolean hasDetailQuantity() { 
675          return this != null && this.detail instanceof Quantity;
676        }
677
678        /**
679         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
680         */
681        public Range getDetailRange() throws FHIRException { 
682          if (this.detail == null)
683            this.detail = new Range();
684          if (!(this.detail instanceof Range))
685            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.detail.getClass().getName()+" was encountered");
686          return (Range) this.detail;
687        }
688
689        public boolean hasDetailRange() { 
690          return this != null && this.detail instanceof Range;
691        }
692
693        /**
694         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
695         */
696        public CodeableConcept getDetailCodeableConcept() throws FHIRException { 
697          if (this.detail == null)
698            this.detail = new CodeableConcept();
699          if (!(this.detail instanceof CodeableConcept))
700            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.detail.getClass().getName()+" was encountered");
701          return (CodeableConcept) this.detail;
702        }
703
704        public boolean hasDetailCodeableConcept() { 
705          return this != null && this.detail instanceof CodeableConcept;
706        }
707
708        /**
709         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
710         */
711        public StringType getDetailStringType() throws FHIRException { 
712          if (this.detail == null)
713            this.detail = new StringType();
714          if (!(this.detail instanceof StringType))
715            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.detail.getClass().getName()+" was encountered");
716          return (StringType) this.detail;
717        }
718
719        public boolean hasDetailStringType() { 
720          return this != null && this.detail instanceof StringType;
721        }
722
723        /**
724         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
725         */
726        public BooleanType getDetailBooleanType() throws FHIRException { 
727          if (this.detail == null)
728            this.detail = new BooleanType();
729          if (!(this.detail instanceof BooleanType))
730            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.detail.getClass().getName()+" was encountered");
731          return (BooleanType) this.detail;
732        }
733
734        public boolean hasDetailBooleanType() { 
735          return this != null && this.detail instanceof BooleanType;
736        }
737
738        /**
739         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
740         */
741        public IntegerType getDetailIntegerType() throws FHIRException { 
742          if (this.detail == null)
743            this.detail = new IntegerType();
744          if (!(this.detail instanceof IntegerType))
745            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.detail.getClass().getName()+" was encountered");
746          return (IntegerType) this.detail;
747        }
748
749        public boolean hasDetailIntegerType() { 
750          return this != null && this.detail instanceof IntegerType;
751        }
752
753        /**
754         * @return {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
755         */
756        public Ratio getDetailRatio() throws FHIRException { 
757          if (this.detail == null)
758            this.detail = new Ratio();
759          if (!(this.detail instanceof Ratio))
760            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.detail.getClass().getName()+" was encountered");
761          return (Ratio) this.detail;
762        }
763
764        public boolean hasDetailRatio() { 
765          return this != null && this.detail instanceof Ratio;
766        }
767
768        public boolean hasDetail() { 
769          return this.detail != null && !this.detail.isEmpty();
770        }
771
772        /**
773         * @param value {@link #detail} (The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.)
774         */
775        public PlanDefinitionGoalTargetComponent setDetail(DataType value) { 
776          if (value != null && !(value instanceof Quantity || value instanceof Range || value instanceof CodeableConcept || value instanceof StringType || value instanceof BooleanType || value instanceof IntegerType || value instanceof Ratio))
777            throw new FHIRException("Not the right type for PlanDefinition.goal.target.detail[x]: "+value.fhirType());
778          this.detail = value;
779          return this;
780        }
781
782        /**
783         * @return {@link #due} (Indicates the timeframe after the start of the goal in which the goal should be met.)
784         */
785        public Duration getDue() { 
786          if (this.due == null)
787            if (Configuration.errorOnAutoCreate())
788              throw new Error("Attempt to auto-create PlanDefinitionGoalTargetComponent.due");
789            else if (Configuration.doAutoCreate())
790              this.due = new Duration(); // cc
791          return this.due;
792        }
793
794        public boolean hasDue() { 
795          return this.due != null && !this.due.isEmpty();
796        }
797
798        /**
799         * @param value {@link #due} (Indicates the timeframe after the start of the goal in which the goal should be met.)
800         */
801        public PlanDefinitionGoalTargetComponent setDue(Duration value) { 
802          this.due = value;
803          return this;
804        }
805
806        protected void listChildren(List<Property> children) {
807          super.listChildren(children);
808          children.add(new Property("measure", "CodeableConcept", "The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.", 0, 1, measure));
809          children.add(new Property("detail[x]", "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail));
810          children.add(new Property("due", "Duration", "Indicates the timeframe after the start of the goal in which the goal should be met.", 0, 1, due));
811        }
812
813        @Override
814        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
815          switch (_hash) {
816          case 938321246: /*measure*/  return new Property("measure", "CodeableConcept", "The parameter whose value is to be tracked, e.g. body weight, blood pressure, or hemoglobin A1c level.", 0, 1, measure);
817          case -1973084529: /*detail[x]*/  return new Property("detail[x]", "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
818          case -1335224239: /*detail*/  return new Property("detail[x]", "Quantity|Range|CodeableConcept|string|boolean|integer|Ratio", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
819          case -1313079300: /*detailQuantity*/  return new Property("detail[x]", "Quantity", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
820          case -2062632084: /*detailRange*/  return new Property("detail[x]", "Range", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
821          case -175586544: /*detailCodeableConcept*/  return new Property("detail[x]", "CodeableConcept", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
822          case 529212354: /*detailString*/  return new Property("detail[x]", "string", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
823          case 1172184727: /*detailBoolean*/  return new Property("detail[x]", "boolean", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
824          case -1229442131: /*detailInteger*/  return new Property("detail[x]", "integer", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
825          case -2062626246: /*detailRatio*/  return new Property("detail[x]", "Ratio", "The target value of the measure to be achieved to signify fulfillment of the goal, e.g. 150 pounds or 7.0%, or in the case of pharmaceutical quality - NMT 0.6%, Clear solution, etc. Either the high or low or both values of the range can be specified. When a low value is missing, it indicates that the goal is achieved at any value at or below the high value. Similarly, if the high value is missing, it indicates that the goal is achieved at any value at or above the low value.", 0, 1, detail);
826          case 99828: /*due*/  return new Property("due", "Duration", "Indicates the timeframe after the start of the goal in which the goal should be met.", 0, 1, due);
827          default: return super.getNamedProperty(_hash, _name, _checkValid);
828          }
829
830        }
831
832      @Override
833      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
834        switch (hash) {
835        case 938321246: /*measure*/ return this.measure == null ? new Base[0] : new Base[] {this.measure}; // CodeableConcept
836        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : new Base[] {this.detail}; // DataType
837        case 99828: /*due*/ return this.due == null ? new Base[0] : new Base[] {this.due}; // Duration
838        default: return super.getProperty(hash, name, checkValid);
839        }
840
841      }
842
843      @Override
844      public Base setProperty(int hash, String name, Base value) throws FHIRException {
845        switch (hash) {
846        case 938321246: // measure
847          this.measure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
848          return value;
849        case -1335224239: // detail
850          this.detail = TypeConvertor.castToType(value); // DataType
851          return value;
852        case 99828: // due
853          this.due = TypeConvertor.castToDuration(value); // Duration
854          return value;
855        default: return super.setProperty(hash, name, value);
856        }
857
858      }
859
860      @Override
861      public Base setProperty(String name, Base value) throws FHIRException {
862        if (name.equals("measure")) {
863          this.measure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
864        } else if (name.equals("detail[x]")) {
865          this.detail = TypeConvertor.castToType(value); // DataType
866        } else if (name.equals("due")) {
867          this.due = TypeConvertor.castToDuration(value); // Duration
868        } else
869          return super.setProperty(name, value);
870        return value;
871      }
872
873      @Override
874      public Base makeProperty(int hash, String name) throws FHIRException {
875        switch (hash) {
876        case 938321246:  return getMeasure();
877        case -1973084529:  return getDetail();
878        case -1335224239:  return getDetail();
879        case 99828:  return getDue();
880        default: return super.makeProperty(hash, name);
881        }
882
883      }
884
885      @Override
886      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
887        switch (hash) {
888        case 938321246: /*measure*/ return new String[] {"CodeableConcept"};
889        case -1335224239: /*detail*/ return new String[] {"Quantity", "Range", "CodeableConcept", "string", "boolean", "integer", "Ratio"};
890        case 99828: /*due*/ return new String[] {"Duration"};
891        default: return super.getTypesForProperty(hash, name);
892        }
893
894      }
895
896      @Override
897      public Base addChild(String name) throws FHIRException {
898        if (name.equals("measure")) {
899          this.measure = new CodeableConcept();
900          return this.measure;
901        }
902        else if (name.equals("detailQuantity")) {
903          this.detail = new Quantity();
904          return this.detail;
905        }
906        else if (name.equals("detailRange")) {
907          this.detail = new Range();
908          return this.detail;
909        }
910        else if (name.equals("detailCodeableConcept")) {
911          this.detail = new CodeableConcept();
912          return this.detail;
913        }
914        else if (name.equals("detailString")) {
915          this.detail = new StringType();
916          return this.detail;
917        }
918        else if (name.equals("detailBoolean")) {
919          this.detail = new BooleanType();
920          return this.detail;
921        }
922        else if (name.equals("detailInteger")) {
923          this.detail = new IntegerType();
924          return this.detail;
925        }
926        else if (name.equals("detailRatio")) {
927          this.detail = new Ratio();
928          return this.detail;
929        }
930        else if (name.equals("due")) {
931          this.due = new Duration();
932          return this.due;
933        }
934        else
935          return super.addChild(name);
936      }
937
938      public PlanDefinitionGoalTargetComponent copy() {
939        PlanDefinitionGoalTargetComponent dst = new PlanDefinitionGoalTargetComponent();
940        copyValues(dst);
941        return dst;
942      }
943
944      public void copyValues(PlanDefinitionGoalTargetComponent dst) {
945        super.copyValues(dst);
946        dst.measure = measure == null ? null : measure.copy();
947        dst.detail = detail == null ? null : detail.copy();
948        dst.due = due == null ? null : due.copy();
949      }
950
951      @Override
952      public boolean equalsDeep(Base other_) {
953        if (!super.equalsDeep(other_))
954          return false;
955        if (!(other_ instanceof PlanDefinitionGoalTargetComponent))
956          return false;
957        PlanDefinitionGoalTargetComponent o = (PlanDefinitionGoalTargetComponent) other_;
958        return compareDeep(measure, o.measure, true) && compareDeep(detail, o.detail, true) && compareDeep(due, o.due, true)
959          ;
960      }
961
962      @Override
963      public boolean equalsShallow(Base other_) {
964        if (!super.equalsShallow(other_))
965          return false;
966        if (!(other_ instanceof PlanDefinitionGoalTargetComponent))
967          return false;
968        PlanDefinitionGoalTargetComponent o = (PlanDefinitionGoalTargetComponent) other_;
969        return true;
970      }
971
972      public boolean isEmpty() {
973        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(measure, detail, due);
974      }
975
976  public String fhirType() {
977    return "PlanDefinition.goal.target";
978
979  }
980
981  }
982
983    @Block()
984    public static class PlanDefinitionActorComponent extends BackboneElement implements IBaseBackboneElement {
985        /**
986         * A descriptive label for the actor.
987         */
988        @Child(name = "title", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
989        @Description(shortDefinition="User-visible title", formalDefinition="A descriptive label for the actor." )
990        protected StringType title;
991
992        /**
993         * A description of how the actor fits into the overall actions of the plan definition.
994         */
995        @Child(name = "description", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=false)
996        @Description(shortDefinition="Describes the actor", formalDefinition="A description of how the actor fits into the overall actions of the plan definition." )
997        protected MarkdownType description;
998
999        /**
1000         * The characteristics of the candidates that could serve as the actor.
1001         */
1002        @Child(name = "option", type = {}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1003        @Description(shortDefinition="Who or what can be this actor", formalDefinition="The characteristics of the candidates that could serve as the actor." )
1004        protected List<PlanDefinitionActorOptionComponent> option;
1005
1006        private static final long serialVersionUID = -571302300L;
1007
1008    /**
1009     * Constructor
1010     */
1011      public PlanDefinitionActorComponent() {
1012        super();
1013      }
1014
1015    /**
1016     * Constructor
1017     */
1018      public PlanDefinitionActorComponent(PlanDefinitionActorOptionComponent option) {
1019        super();
1020        this.addOption(option);
1021      }
1022
1023        /**
1024         * @return {@link #title} (A descriptive label for the actor.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1025         */
1026        public StringType getTitleElement() { 
1027          if (this.title == null)
1028            if (Configuration.errorOnAutoCreate())
1029              throw new Error("Attempt to auto-create PlanDefinitionActorComponent.title");
1030            else if (Configuration.doAutoCreate())
1031              this.title = new StringType(); // bb
1032          return this.title;
1033        }
1034
1035        public boolean hasTitleElement() { 
1036          return this.title != null && !this.title.isEmpty();
1037        }
1038
1039        public boolean hasTitle() { 
1040          return this.title != null && !this.title.isEmpty();
1041        }
1042
1043        /**
1044         * @param value {@link #title} (A descriptive label for the actor.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1045         */
1046        public PlanDefinitionActorComponent setTitleElement(StringType value) { 
1047          this.title = value;
1048          return this;
1049        }
1050
1051        /**
1052         * @return A descriptive label for the actor.
1053         */
1054        public String getTitle() { 
1055          return this.title == null ? null : this.title.getValue();
1056        }
1057
1058        /**
1059         * @param value A descriptive label for the actor.
1060         */
1061        public PlanDefinitionActorComponent setTitle(String value) { 
1062          if (Utilities.noString(value))
1063            this.title = null;
1064          else {
1065            if (this.title == null)
1066              this.title = new StringType();
1067            this.title.setValue(value);
1068          }
1069          return this;
1070        }
1071
1072        /**
1073         * @return {@link #description} (A description of how the actor fits into the overall actions of the plan definition.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1074         */
1075        public MarkdownType getDescriptionElement() { 
1076          if (this.description == null)
1077            if (Configuration.errorOnAutoCreate())
1078              throw new Error("Attempt to auto-create PlanDefinitionActorComponent.description");
1079            else if (Configuration.doAutoCreate())
1080              this.description = new MarkdownType(); // bb
1081          return this.description;
1082        }
1083
1084        public boolean hasDescriptionElement() { 
1085          return this.description != null && !this.description.isEmpty();
1086        }
1087
1088        public boolean hasDescription() { 
1089          return this.description != null && !this.description.isEmpty();
1090        }
1091
1092        /**
1093         * @param value {@link #description} (A description of how the actor fits into the overall actions of the plan definition.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1094         */
1095        public PlanDefinitionActorComponent setDescriptionElement(MarkdownType value) { 
1096          this.description = value;
1097          return this;
1098        }
1099
1100        /**
1101         * @return A description of how the actor fits into the overall actions of the plan definition.
1102         */
1103        public String getDescription() { 
1104          return this.description == null ? null : this.description.getValue();
1105        }
1106
1107        /**
1108         * @param value A description of how the actor fits into the overall actions of the plan definition.
1109         */
1110        public PlanDefinitionActorComponent setDescription(String value) { 
1111          if (Utilities.noString(value))
1112            this.description = null;
1113          else {
1114            if (this.description == null)
1115              this.description = new MarkdownType();
1116            this.description.setValue(value);
1117          }
1118          return this;
1119        }
1120
1121        /**
1122         * @return {@link #option} (The characteristics of the candidates that could serve as the actor.)
1123         */
1124        public List<PlanDefinitionActorOptionComponent> getOption() { 
1125          if (this.option == null)
1126            this.option = new ArrayList<PlanDefinitionActorOptionComponent>();
1127          return this.option;
1128        }
1129
1130        /**
1131         * @return Returns a reference to <code>this</code> for easy method chaining
1132         */
1133        public PlanDefinitionActorComponent setOption(List<PlanDefinitionActorOptionComponent> theOption) { 
1134          this.option = theOption;
1135          return this;
1136        }
1137
1138        public boolean hasOption() { 
1139          if (this.option == null)
1140            return false;
1141          for (PlanDefinitionActorOptionComponent item : this.option)
1142            if (!item.isEmpty())
1143              return true;
1144          return false;
1145        }
1146
1147        public PlanDefinitionActorOptionComponent addOption() { //3
1148          PlanDefinitionActorOptionComponent t = new PlanDefinitionActorOptionComponent();
1149          if (this.option == null)
1150            this.option = new ArrayList<PlanDefinitionActorOptionComponent>();
1151          this.option.add(t);
1152          return t;
1153        }
1154
1155        public PlanDefinitionActorComponent addOption(PlanDefinitionActorOptionComponent t) { //3
1156          if (t == null)
1157            return this;
1158          if (this.option == null)
1159            this.option = new ArrayList<PlanDefinitionActorOptionComponent>();
1160          this.option.add(t);
1161          return this;
1162        }
1163
1164        /**
1165         * @return The first repetition of repeating field {@link #option}, creating it if it does not already exist {3}
1166         */
1167        public PlanDefinitionActorOptionComponent getOptionFirstRep() { 
1168          if (getOption().isEmpty()) {
1169            addOption();
1170          }
1171          return getOption().get(0);
1172        }
1173
1174        protected void listChildren(List<Property> children) {
1175          super.listChildren(children);
1176          children.add(new Property("title", "string", "A descriptive label for the actor.", 0, 1, title));
1177          children.add(new Property("description", "markdown", "A description of how the actor fits into the overall actions of the plan definition.", 0, 1, description));
1178          children.add(new Property("option", "", "The characteristics of the candidates that could serve as the actor.", 0, java.lang.Integer.MAX_VALUE, option));
1179        }
1180
1181        @Override
1182        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1183          switch (_hash) {
1184          case 110371416: /*title*/  return new Property("title", "string", "A descriptive label for the actor.", 0, 1, title);
1185          case -1724546052: /*description*/  return new Property("description", "markdown", "A description of how the actor fits into the overall actions of the plan definition.", 0, 1, description);
1186          case -1010136971: /*option*/  return new Property("option", "", "The characteristics of the candidates that could serve as the actor.", 0, java.lang.Integer.MAX_VALUE, option);
1187          default: return super.getNamedProperty(_hash, _name, _checkValid);
1188          }
1189
1190        }
1191
1192      @Override
1193      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1194        switch (hash) {
1195        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
1196        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
1197        case -1010136971: /*option*/ return this.option == null ? new Base[0] : this.option.toArray(new Base[this.option.size()]); // PlanDefinitionActorOptionComponent
1198        default: return super.getProperty(hash, name, checkValid);
1199        }
1200
1201      }
1202
1203      @Override
1204      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1205        switch (hash) {
1206        case 110371416: // title
1207          this.title = TypeConvertor.castToString(value); // StringType
1208          return value;
1209        case -1724546052: // description
1210          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
1211          return value;
1212        case -1010136971: // option
1213          this.getOption().add((PlanDefinitionActorOptionComponent) value); // PlanDefinitionActorOptionComponent
1214          return value;
1215        default: return super.setProperty(hash, name, value);
1216        }
1217
1218      }
1219
1220      @Override
1221      public Base setProperty(String name, Base value) throws FHIRException {
1222        if (name.equals("title")) {
1223          this.title = TypeConvertor.castToString(value); // StringType
1224        } else if (name.equals("description")) {
1225          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
1226        } else if (name.equals("option")) {
1227          this.getOption().add((PlanDefinitionActorOptionComponent) value);
1228        } else
1229          return super.setProperty(name, value);
1230        return value;
1231      }
1232
1233      @Override
1234      public Base makeProperty(int hash, String name) throws FHIRException {
1235        switch (hash) {
1236        case 110371416:  return getTitleElement();
1237        case -1724546052:  return getDescriptionElement();
1238        case -1010136971:  return addOption(); 
1239        default: return super.makeProperty(hash, name);
1240        }
1241
1242      }
1243
1244      @Override
1245      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1246        switch (hash) {
1247        case 110371416: /*title*/ return new String[] {"string"};
1248        case -1724546052: /*description*/ return new String[] {"markdown"};
1249        case -1010136971: /*option*/ return new String[] {};
1250        default: return super.getTypesForProperty(hash, name);
1251        }
1252
1253      }
1254
1255      @Override
1256      public Base addChild(String name) throws FHIRException {
1257        if (name.equals("title")) {
1258          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.actor.title");
1259        }
1260        else if (name.equals("description")) {
1261          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.actor.description");
1262        }
1263        else if (name.equals("option")) {
1264          return addOption();
1265        }
1266        else
1267          return super.addChild(name);
1268      }
1269
1270      public PlanDefinitionActorComponent copy() {
1271        PlanDefinitionActorComponent dst = new PlanDefinitionActorComponent();
1272        copyValues(dst);
1273        return dst;
1274      }
1275
1276      public void copyValues(PlanDefinitionActorComponent dst) {
1277        super.copyValues(dst);
1278        dst.title = title == null ? null : title.copy();
1279        dst.description = description == null ? null : description.copy();
1280        if (option != null) {
1281          dst.option = new ArrayList<PlanDefinitionActorOptionComponent>();
1282          for (PlanDefinitionActorOptionComponent i : option)
1283            dst.option.add(i.copy());
1284        };
1285      }
1286
1287      @Override
1288      public boolean equalsDeep(Base other_) {
1289        if (!super.equalsDeep(other_))
1290          return false;
1291        if (!(other_ instanceof PlanDefinitionActorComponent))
1292          return false;
1293        PlanDefinitionActorComponent o = (PlanDefinitionActorComponent) other_;
1294        return compareDeep(title, o.title, true) && compareDeep(description, o.description, true) && compareDeep(option, o.option, true)
1295          ;
1296      }
1297
1298      @Override
1299      public boolean equalsShallow(Base other_) {
1300        if (!super.equalsShallow(other_))
1301          return false;
1302        if (!(other_ instanceof PlanDefinitionActorComponent))
1303          return false;
1304        PlanDefinitionActorComponent o = (PlanDefinitionActorComponent) other_;
1305        return compareValues(title, o.title, true) && compareValues(description, o.description, true);
1306      }
1307
1308      public boolean isEmpty() {
1309        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(title, description, option
1310          );
1311      }
1312
1313  public String fhirType() {
1314    return "PlanDefinition.actor";
1315
1316  }
1317
1318  }
1319
1320    @Block()
1321    public static class PlanDefinitionActorOptionComponent extends BackboneElement implements IBaseBackboneElement {
1322        /**
1323         * The type of participant in the action.
1324         */
1325        @Child(name = "type", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1326        @Description(shortDefinition="careteam | device | group | healthcareservice | location | organization | patient | practitioner | practitionerrole | relatedperson", formalDefinition="The type of participant in the action." )
1327        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-participant-type")
1328        protected Enumeration<ActionParticipantType> type;
1329
1330        /**
1331         * The type of participant in the action.
1332         */
1333        @Child(name = "typeCanonical", type = {CanonicalType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1334        @Description(shortDefinition="Who or what can participate", formalDefinition="The type of participant in the action." )
1335        protected CanonicalType typeCanonical;
1336
1337        /**
1338         * The type of participant in the action.
1339         */
1340        @Child(name = "typeReference", type = {CareTeam.class, Device.class, DeviceDefinition.class, Endpoint.class, Group.class, HealthcareService.class, Location.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=3, min=0, max=1, modifier=false, summary=false)
1341        @Description(shortDefinition="Who or what can participate", formalDefinition="The type of participant in the action." )
1342        protected Reference typeReference;
1343
1344        /**
1345         * The role the participant should play in performing the described action.
1346         */
1347        @Child(name = "role", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1348        @Description(shortDefinition="E.g. Nurse, Surgeon, Parent", formalDefinition="The role the participant should play in performing the described action." )
1349        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/action-participant-role")
1350        protected CodeableConcept role;
1351
1352        private static final long serialVersionUID = 1881639157L;
1353
1354    /**
1355     * Constructor
1356     */
1357      public PlanDefinitionActorOptionComponent() {
1358        super();
1359      }
1360
1361        /**
1362         * @return {@link #type} (The type of participant in the action.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1363         */
1364        public Enumeration<ActionParticipantType> getTypeElement() { 
1365          if (this.type == null)
1366            if (Configuration.errorOnAutoCreate())
1367              throw new Error("Attempt to auto-create PlanDefinitionActorOptionComponent.type");
1368            else if (Configuration.doAutoCreate())
1369              this.type = new Enumeration<ActionParticipantType>(new ActionParticipantTypeEnumFactory()); // bb
1370          return this.type;
1371        }
1372
1373        public boolean hasTypeElement() { 
1374          return this.type != null && !this.type.isEmpty();
1375        }
1376
1377        public boolean hasType() { 
1378          return this.type != null && !this.type.isEmpty();
1379        }
1380
1381        /**
1382         * @param value {@link #type} (The type of participant in the action.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1383         */
1384        public PlanDefinitionActorOptionComponent setTypeElement(Enumeration<ActionParticipantType> value) { 
1385          this.type = value;
1386          return this;
1387        }
1388
1389        /**
1390         * @return The type of participant in the action.
1391         */
1392        public ActionParticipantType getType() { 
1393          return this.type == null ? null : this.type.getValue();
1394        }
1395
1396        /**
1397         * @param value The type of participant in the action.
1398         */
1399        public PlanDefinitionActorOptionComponent setType(ActionParticipantType value) { 
1400          if (value == null)
1401            this.type = null;
1402          else {
1403            if (this.type == null)
1404              this.type = new Enumeration<ActionParticipantType>(new ActionParticipantTypeEnumFactory());
1405            this.type.setValue(value);
1406          }
1407          return this;
1408        }
1409
1410        /**
1411         * @return {@link #typeCanonical} (The type of participant in the action.). This is the underlying object with id, value and extensions. The accessor "getTypeCanonical" gives direct access to the value
1412         */
1413        public CanonicalType getTypeCanonicalElement() { 
1414          if (this.typeCanonical == null)
1415            if (Configuration.errorOnAutoCreate())
1416              throw new Error("Attempt to auto-create PlanDefinitionActorOptionComponent.typeCanonical");
1417            else if (Configuration.doAutoCreate())
1418              this.typeCanonical = new CanonicalType(); // bb
1419          return this.typeCanonical;
1420        }
1421
1422        public boolean hasTypeCanonicalElement() { 
1423          return this.typeCanonical != null && !this.typeCanonical.isEmpty();
1424        }
1425
1426        public boolean hasTypeCanonical() { 
1427          return this.typeCanonical != null && !this.typeCanonical.isEmpty();
1428        }
1429
1430        /**
1431         * @param value {@link #typeCanonical} (The type of participant in the action.). This is the underlying object with id, value and extensions. The accessor "getTypeCanonical" gives direct access to the value
1432         */
1433        public PlanDefinitionActorOptionComponent setTypeCanonicalElement(CanonicalType value) { 
1434          this.typeCanonical = value;
1435          return this;
1436        }
1437
1438        /**
1439         * @return The type of participant in the action.
1440         */
1441        public String getTypeCanonical() { 
1442          return this.typeCanonical == null ? null : this.typeCanonical.getValue();
1443        }
1444
1445        /**
1446         * @param value The type of participant in the action.
1447         */
1448        public PlanDefinitionActorOptionComponent setTypeCanonical(String value) { 
1449          if (Utilities.noString(value))
1450            this.typeCanonical = null;
1451          else {
1452            if (this.typeCanonical == null)
1453              this.typeCanonical = new CanonicalType();
1454            this.typeCanonical.setValue(value);
1455          }
1456          return this;
1457        }
1458
1459        /**
1460         * @return {@link #typeReference} (The type of participant in the action.)
1461         */
1462        public Reference getTypeReference() { 
1463          if (this.typeReference == null)
1464            if (Configuration.errorOnAutoCreate())
1465              throw new Error("Attempt to auto-create PlanDefinitionActorOptionComponent.typeReference");
1466            else if (Configuration.doAutoCreate())
1467              this.typeReference = new Reference(); // cc
1468          return this.typeReference;
1469        }
1470
1471        public boolean hasTypeReference() { 
1472          return this.typeReference != null && !this.typeReference.isEmpty();
1473        }
1474
1475        /**
1476         * @param value {@link #typeReference} (The type of participant in the action.)
1477         */
1478        public PlanDefinitionActorOptionComponent setTypeReference(Reference value) { 
1479          this.typeReference = value;
1480          return this;
1481        }
1482
1483        /**
1484         * @return {@link #role} (The role the participant should play in performing the described action.)
1485         */
1486        public CodeableConcept getRole() { 
1487          if (this.role == null)
1488            if (Configuration.errorOnAutoCreate())
1489              throw new Error("Attempt to auto-create PlanDefinitionActorOptionComponent.role");
1490            else if (Configuration.doAutoCreate())
1491              this.role = new CodeableConcept(); // cc
1492          return this.role;
1493        }
1494
1495        public boolean hasRole() { 
1496          return this.role != null && !this.role.isEmpty();
1497        }
1498
1499        /**
1500         * @param value {@link #role} (The role the participant should play in performing the described action.)
1501         */
1502        public PlanDefinitionActorOptionComponent setRole(CodeableConcept value) { 
1503          this.role = value;
1504          return this;
1505        }
1506
1507        protected void listChildren(List<Property> children) {
1508          super.listChildren(children);
1509          children.add(new Property("type", "code", "The type of participant in the action.", 0, 1, type));
1510          children.add(new Property("typeCanonical", "canonical(CapabilityStatement)", "The type of participant in the action.", 0, 1, typeCanonical));
1511          children.add(new Property("typeReference", "Reference(CareTeam|Device|DeviceDefinition|Endpoint|Group|HealthcareService|Location|Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "The type of participant in the action.", 0, 1, typeReference));
1512          children.add(new Property("role", "CodeableConcept", "The role the participant should play in performing the described action.", 0, 1, role));
1513        }
1514
1515        @Override
1516        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1517          switch (_hash) {
1518          case 3575610: /*type*/  return new Property("type", "code", "The type of participant in the action.", 0, 1, type);
1519          case -466635046: /*typeCanonical*/  return new Property("typeCanonical", "canonical(CapabilityStatement)", "The type of participant in the action.", 0, 1, typeCanonical);
1520          case 2074825009: /*typeReference*/  return new Property("typeReference", "Reference(CareTeam|Device|DeviceDefinition|Endpoint|Group|HealthcareService|Location|Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "The type of participant in the action.", 0, 1, typeReference);
1521          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The role the participant should play in performing the described action.", 0, 1, role);
1522          default: return super.getNamedProperty(_hash, _name, _checkValid);
1523          }
1524
1525        }
1526
1527      @Override
1528      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1529        switch (hash) {
1530        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<ActionParticipantType>
1531        case -466635046: /*typeCanonical*/ return this.typeCanonical == null ? new Base[0] : new Base[] {this.typeCanonical}; // CanonicalType
1532        case 2074825009: /*typeReference*/ return this.typeReference == null ? new Base[0] : new Base[] {this.typeReference}; // Reference
1533        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
1534        default: return super.getProperty(hash, name, checkValid);
1535        }
1536
1537      }
1538
1539      @Override
1540      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1541        switch (hash) {
1542        case 3575610: // type
1543          value = new ActionParticipantTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1544          this.type = (Enumeration) value; // Enumeration<ActionParticipantType>
1545          return value;
1546        case -466635046: // typeCanonical
1547          this.typeCanonical = TypeConvertor.castToCanonical(value); // CanonicalType
1548          return value;
1549        case 2074825009: // typeReference
1550          this.typeReference = TypeConvertor.castToReference(value); // Reference
1551          return value;
1552        case 3506294: // role
1553          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1554          return value;
1555        default: return super.setProperty(hash, name, value);
1556        }
1557
1558      }
1559
1560      @Override
1561      public Base setProperty(String name, Base value) throws FHIRException {
1562        if (name.equals("type")) {
1563          value = new ActionParticipantTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1564          this.type = (Enumeration) value; // Enumeration<ActionParticipantType>
1565        } else if (name.equals("typeCanonical")) {
1566          this.typeCanonical = TypeConvertor.castToCanonical(value); // CanonicalType
1567        } else if (name.equals("typeReference")) {
1568          this.typeReference = TypeConvertor.castToReference(value); // Reference
1569        } else if (name.equals("role")) {
1570          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1571        } else
1572          return super.setProperty(name, value);
1573        return value;
1574      }
1575
1576      @Override
1577      public Base makeProperty(int hash, String name) throws FHIRException {
1578        switch (hash) {
1579        case 3575610:  return getTypeElement();
1580        case -466635046:  return getTypeCanonicalElement();
1581        case 2074825009:  return getTypeReference();
1582        case 3506294:  return getRole();
1583        default: return super.makeProperty(hash, name);
1584        }
1585
1586      }
1587
1588      @Override
1589      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1590        switch (hash) {
1591        case 3575610: /*type*/ return new String[] {"code"};
1592        case -466635046: /*typeCanonical*/ return new String[] {"canonical"};
1593        case 2074825009: /*typeReference*/ return new String[] {"Reference"};
1594        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
1595        default: return super.getTypesForProperty(hash, name);
1596        }
1597
1598      }
1599
1600      @Override
1601      public Base addChild(String name) throws FHIRException {
1602        if (name.equals("type")) {
1603          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.actor.option.type");
1604        }
1605        else if (name.equals("typeCanonical")) {
1606          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.actor.option.typeCanonical");
1607        }
1608        else if (name.equals("typeReference")) {
1609          this.typeReference = new Reference();
1610          return this.typeReference;
1611        }
1612        else if (name.equals("role")) {
1613          this.role = new CodeableConcept();
1614          return this.role;
1615        }
1616        else
1617          return super.addChild(name);
1618      }
1619
1620      public PlanDefinitionActorOptionComponent copy() {
1621        PlanDefinitionActorOptionComponent dst = new PlanDefinitionActorOptionComponent();
1622        copyValues(dst);
1623        return dst;
1624      }
1625
1626      public void copyValues(PlanDefinitionActorOptionComponent dst) {
1627        super.copyValues(dst);
1628        dst.type = type == null ? null : type.copy();
1629        dst.typeCanonical = typeCanonical == null ? null : typeCanonical.copy();
1630        dst.typeReference = typeReference == null ? null : typeReference.copy();
1631        dst.role = role == null ? null : role.copy();
1632      }
1633
1634      @Override
1635      public boolean equalsDeep(Base other_) {
1636        if (!super.equalsDeep(other_))
1637          return false;
1638        if (!(other_ instanceof PlanDefinitionActorOptionComponent))
1639          return false;
1640        PlanDefinitionActorOptionComponent o = (PlanDefinitionActorOptionComponent) other_;
1641        return compareDeep(type, o.type, true) && compareDeep(typeCanonical, o.typeCanonical, true) && compareDeep(typeReference, o.typeReference, true)
1642           && compareDeep(role, o.role, true);
1643      }
1644
1645      @Override
1646      public boolean equalsShallow(Base other_) {
1647        if (!super.equalsShallow(other_))
1648          return false;
1649        if (!(other_ instanceof PlanDefinitionActorOptionComponent))
1650          return false;
1651        PlanDefinitionActorOptionComponent o = (PlanDefinitionActorOptionComponent) other_;
1652        return compareValues(type, o.type, true) && compareValues(typeCanonical, o.typeCanonical, true);
1653      }
1654
1655      public boolean isEmpty() {
1656        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, typeCanonical, typeReference
1657          , role);
1658      }
1659
1660  public String fhirType() {
1661    return "PlanDefinition.actor.option";
1662
1663  }
1664
1665  }
1666
1667    @Block()
1668    public static class PlanDefinitionActionComponent extends BackboneElement implements IBaseBackboneElement {
1669        /**
1670         * An identifier that is unique within the PlanDefinition to allow linkage within the realized CarePlan and/or RequestOrchestration.
1671         */
1672        @Child(name = "linkId", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1673        @Description(shortDefinition="Unique id for the action in the PlanDefinition", formalDefinition="An identifier that is unique within the PlanDefinition to allow linkage within the realized CarePlan and/or RequestOrchestration." )
1674        protected StringType linkId;
1675
1676        /**
1677         * A user-visible prefix for the action. For example a section or item numbering such as 1. or A.
1678         */
1679        @Child(name = "prefix", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1680        @Description(shortDefinition="User-visible prefix for the action (e.g. 1. or A.)", formalDefinition="A user-visible prefix for the action. For example a section or item numbering such as 1. or A." )
1681        protected StringType prefix;
1682
1683        /**
1684         * The textual description of the action displayed to a user. For example, when the action is a test to be performed, the title would be the title of the test such as Assay by HPLC.
1685         */
1686        @Child(name = "title", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1687        @Description(shortDefinition="User-visible title", formalDefinition="The textual description of the action displayed to a user. For example, when the action is a test to be performed, the title would be the title of the test such as Assay by HPLC." )
1688        protected StringType title;
1689
1690        /**
1691         * A brief description of the action used to provide a summary to display to the user.
1692         */
1693        @Child(name = "description", type = {MarkdownType.class}, order=4, min=0, max=1, modifier=false, summary=false)
1694        @Description(shortDefinition="Brief description of the action", formalDefinition="A brief description of the action used to provide a summary to display to the user." )
1695        protected MarkdownType description;
1696
1697        /**
1698         * A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.
1699         */
1700        @Child(name = "textEquivalent", type = {MarkdownType.class}, order=5, min=0, max=1, modifier=false, summary=false)
1701        @Description(shortDefinition="Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system", formalDefinition="A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically." )
1702        protected MarkdownType textEquivalent;
1703
1704        /**
1705         * Indicates how quickly the action should be addressed with respect to other actions.
1706         */
1707        @Child(name = "priority", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=false)
1708        @Description(shortDefinition="routine | urgent | asap | stat", formalDefinition="Indicates how quickly the action should be addressed with respect to other actions." )
1709        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority")
1710        protected Enumeration<RequestPriority> priority;
1711
1712        /**
1713         * A code that provides a meaning, grouping, or classification for the action or action group. For example, a section may have a LOINC code for the section of a documentation template. In pharmaceutical quality, an action (Test) such as pH could be classified as a physical property.
1714         */
1715        @Child(name = "code", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
1716        @Description(shortDefinition="Code representing the meaning of the action or sub-actions", formalDefinition="A code that provides a meaning, grouping, or classification for the action or action group. For example, a section may have a LOINC code for the section of a documentation template. In pharmaceutical quality, an action (Test) such as pH could be classified as a physical property." )
1717        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-code")
1718        protected CodeableConcept code;
1719
1720        /**
1721         * A description of why this action is necessary or appropriate.
1722         */
1723        @Child(name = "reason", type = {CodeableConcept.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1724        @Description(shortDefinition="Why the action should be performed", formalDefinition="A description of why this action is necessary or appropriate." )
1725        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-reason-code")
1726        protected List<CodeableConcept> reason;
1727
1728        /**
1729         * Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.
1730         */
1731        @Child(name = "documentation", type = {RelatedArtifact.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1732        @Description(shortDefinition="Supporting documentation for the intended performer of the action", formalDefinition="Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources." )
1733        protected List<RelatedArtifact> documentation;
1734
1735        /**
1736         * Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition. In pharmaceutical quality, a goal represents acceptance criteria (Goal) for a given action (Test), so the goalId would be the unique id of a defined goal element establishing the acceptance criteria for the action.
1737         */
1738        @Child(name = "goalId", type = {IdType.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1739        @Description(shortDefinition="What goals this action supports", formalDefinition="Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition. In pharmaceutical quality, a goal represents acceptance criteria (Goal) for a given action (Test), so the goalId would be the unique id of a defined goal element establishing the acceptance criteria for the action." )
1740        protected List<IdType> goalId;
1741
1742        /**
1743         * A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.
1744         */
1745        @Child(name = "subject", type = {CodeableConcept.class, Group.class, CanonicalType.class}, order=11, min=0, max=1, modifier=false, summary=false)
1746        @Description(shortDefinition="Type of individual the action is focused on", formalDefinition="A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource." )
1747        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participant-resource-types")
1748        protected DataType subject;
1749
1750        /**
1751         * A description of when the action should be triggered. When multiple triggers are specified on an action, any triggering event invokes the action.
1752         */
1753        @Child(name = "trigger", type = {TriggerDefinition.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1754        @Description(shortDefinition="When the action should be triggered", formalDefinition="A description of when the action should be triggered. When multiple triggers are specified on an action, any triggering event invokes the action." )
1755        protected List<TriggerDefinition> trigger;
1756
1757        /**
1758         * An expression that describes applicability criteria or start/stop conditions for the action.
1759         */
1760        @Child(name = "condition", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1761        @Description(shortDefinition="Whether or not the action is applicable", formalDefinition="An expression that describes applicability criteria or start/stop conditions for the action." )
1762        protected List<PlanDefinitionActionConditionComponent> condition;
1763
1764        /**
1765         * Defines input data requirements for the action.
1766         */
1767        @Child(name = "input", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1768        @Description(shortDefinition="Input data requirements", formalDefinition="Defines input data requirements for the action." )
1769        protected List<PlanDefinitionActionInputComponent> input;
1770
1771        /**
1772         * Defines the outputs of the action, if any.
1773         */
1774        @Child(name = "output", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1775        @Description(shortDefinition="Output data definition", formalDefinition="Defines the outputs of the action, if any." )
1776        protected List<PlanDefinitionActionOutputComponent> output;
1777
1778        /**
1779         * A relationship to another action such as "before" or "30-60 minutes after start of".
1780         */
1781        @Child(name = "relatedAction", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1782        @Description(shortDefinition="Relationship to another action", formalDefinition="A relationship to another action such as \"before\" or \"30-60 minutes after start of\"." )
1783        protected List<PlanDefinitionActionRelatedActionComponent> relatedAction;
1784
1785        /**
1786         * An optional value describing when the action should be performed.
1787         */
1788        @Child(name = "timing", type = {Age.class, Duration.class, Range.class, Timing.class}, order=17, min=0, max=1, modifier=false, summary=false)
1789        @Description(shortDefinition="When the action should take place", formalDefinition="An optional value describing when the action should be performed." )
1790        protected DataType timing;
1791
1792        /**
1793         * Identifies the facility where the action will occur; e.g. home, hospital, specific clinic, etc.
1794         */
1795        @Child(name = "location", type = {CodeableReference.class}, order=18, min=0, max=1, modifier=false, summary=false)
1796        @Description(shortDefinition="Where it should happen", formalDefinition="Identifies the facility where the action will occur; e.g. home, hospital, specific clinic, etc." )
1797        protected CodeableReference location;
1798
1799        /**
1800         * Indicates who should participate in performing the action described.
1801         */
1802        @Child(name = "participant", type = {}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1803        @Description(shortDefinition="Who should participate in the action", formalDefinition="Indicates who should participate in performing the action described." )
1804        protected List<PlanDefinitionActionParticipantComponent> participant;
1805
1806        /**
1807         * The type of action to perform (create, update, remove).
1808         */
1809        @Child(name = "type", type = {CodeableConcept.class}, order=20, min=0, max=1, modifier=false, summary=false)
1810        @Description(shortDefinition="create | update | remove | fire-event", formalDefinition="The type of action to perform (create, update, remove)." )
1811        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-type")
1812        protected CodeableConcept type;
1813
1814        /**
1815         * Defines the grouping behavior for the action and its children.
1816         */
1817        @Child(name = "groupingBehavior", type = {CodeType.class}, order=21, min=0, max=1, modifier=false, summary=false)
1818        @Description(shortDefinition="visual-group | logical-group | sentence-group", formalDefinition="Defines the grouping behavior for the action and its children." )
1819        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-grouping-behavior")
1820        protected Enumeration<ActionGroupingBehavior> groupingBehavior;
1821
1822        /**
1823         * Defines the selection behavior for the action and its children.
1824         */
1825        @Child(name = "selectionBehavior", type = {CodeType.class}, order=22, min=0, max=1, modifier=false, summary=false)
1826        @Description(shortDefinition="any | all | all-or-none | exactly-one | at-most-one | one-or-more", formalDefinition="Defines the selection behavior for the action and its children." )
1827        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-selection-behavior")
1828        protected Enumeration<ActionSelectionBehavior> selectionBehavior;
1829
1830        /**
1831         * Defines the required behavior for the action.
1832         */
1833        @Child(name = "requiredBehavior", type = {CodeType.class}, order=23, min=0, max=1, modifier=false, summary=false)
1834        @Description(shortDefinition="must | could | must-unless-documented", formalDefinition="Defines the required behavior for the action." )
1835        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-required-behavior")
1836        protected Enumeration<ActionRequiredBehavior> requiredBehavior;
1837
1838        /**
1839         * Defines whether the action should usually be preselected.
1840         */
1841        @Child(name = "precheckBehavior", type = {CodeType.class}, order=24, min=0, max=1, modifier=false, summary=false)
1842        @Description(shortDefinition="yes | no", formalDefinition="Defines whether the action should usually be preselected." )
1843        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-precheck-behavior")
1844        protected Enumeration<ActionPrecheckBehavior> precheckBehavior;
1845
1846        /**
1847         * Defines whether the action can be selected multiple times.
1848         */
1849        @Child(name = "cardinalityBehavior", type = {CodeType.class}, order=25, min=0, max=1, modifier=false, summary=false)
1850        @Description(shortDefinition="single | multiple", formalDefinition="Defines whether the action can be selected multiple times." )
1851        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-cardinality-behavior")
1852        protected Enumeration<ActionCardinalityBehavior> cardinalityBehavior;
1853
1854        /**
1855         * A reference to an ActivityDefinition that describes the action to be taken in detail, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.
1856         */
1857        @Child(name = "definition", type = {CanonicalType.class, UriType.class}, order=26, min=0, max=1, modifier=false, summary=false)
1858        @Description(shortDefinition="Description of the activity to be performed", formalDefinition="A reference to an ActivityDefinition that describes the action to be taken in detail, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured." )
1859        protected DataType definition;
1860
1861        /**
1862         * A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.
1863         */
1864        @Child(name = "transform", type = {CanonicalType.class}, order=27, min=0, max=1, modifier=false, summary=false)
1865        @Description(shortDefinition="Transform to apply the template", formalDefinition="A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input." )
1866        protected CanonicalType transform;
1867
1868        /**
1869         * Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.
1870         */
1871        @Child(name = "dynamicValue", type = {}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1872        @Description(shortDefinition="Dynamic aspects of the definition", formalDefinition="Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result." )
1873        protected List<PlanDefinitionActionDynamicValueComponent> dynamicValue;
1874
1875        /**
1876         * Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.
1877         */
1878        @Child(name = "action", type = {PlanDefinitionActionComponent.class}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1879        @Description(shortDefinition="A sub-action", formalDefinition="Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition." )
1880        protected List<PlanDefinitionActionComponent> action;
1881
1882        private static final long serialVersionUID = 1296604536L;
1883
1884    /**
1885     * Constructor
1886     */
1887      public PlanDefinitionActionComponent() {
1888        super();
1889      }
1890
1891        /**
1892         * @return {@link #linkId} (An identifier that is unique within the PlanDefinition to allow linkage within the realized CarePlan and/or RequestOrchestration.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value
1893         */
1894        public StringType getLinkIdElement() { 
1895          if (this.linkId == null)
1896            if (Configuration.errorOnAutoCreate())
1897              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.linkId");
1898            else if (Configuration.doAutoCreate())
1899              this.linkId = new StringType(); // bb
1900          return this.linkId;
1901        }
1902
1903        public boolean hasLinkIdElement() { 
1904          return this.linkId != null && !this.linkId.isEmpty();
1905        }
1906
1907        public boolean hasLinkId() { 
1908          return this.linkId != null && !this.linkId.isEmpty();
1909        }
1910
1911        /**
1912         * @param value {@link #linkId} (An identifier that is unique within the PlanDefinition to allow linkage within the realized CarePlan and/or RequestOrchestration.). This is the underlying object with id, value and extensions. The accessor "getLinkId" gives direct access to the value
1913         */
1914        public PlanDefinitionActionComponent setLinkIdElement(StringType value) { 
1915          this.linkId = value;
1916          return this;
1917        }
1918
1919        /**
1920         * @return An identifier that is unique within the PlanDefinition to allow linkage within the realized CarePlan and/or RequestOrchestration.
1921         */
1922        public String getLinkId() { 
1923          return this.linkId == null ? null : this.linkId.getValue();
1924        }
1925
1926        /**
1927         * @param value An identifier that is unique within the PlanDefinition to allow linkage within the realized CarePlan and/or RequestOrchestration.
1928         */
1929        public PlanDefinitionActionComponent setLinkId(String value) { 
1930          if (Utilities.noString(value))
1931            this.linkId = null;
1932          else {
1933            if (this.linkId == null)
1934              this.linkId = new StringType();
1935            this.linkId.setValue(value);
1936          }
1937          return this;
1938        }
1939
1940        /**
1941         * @return {@link #prefix} (A user-visible prefix for the action. For example a section or item numbering such as 1. or A.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
1942         */
1943        public StringType getPrefixElement() { 
1944          if (this.prefix == null)
1945            if (Configuration.errorOnAutoCreate())
1946              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.prefix");
1947            else if (Configuration.doAutoCreate())
1948              this.prefix = new StringType(); // bb
1949          return this.prefix;
1950        }
1951
1952        public boolean hasPrefixElement() { 
1953          return this.prefix != null && !this.prefix.isEmpty();
1954        }
1955
1956        public boolean hasPrefix() { 
1957          return this.prefix != null && !this.prefix.isEmpty();
1958        }
1959
1960        /**
1961         * @param value {@link #prefix} (A user-visible prefix for the action. For example a section or item numbering such as 1. or A.). This is the underlying object with id, value and extensions. The accessor "getPrefix" gives direct access to the value
1962         */
1963        public PlanDefinitionActionComponent setPrefixElement(StringType value) { 
1964          this.prefix = value;
1965          return this;
1966        }
1967
1968        /**
1969         * @return A user-visible prefix for the action. For example a section or item numbering such as 1. or A.
1970         */
1971        public String getPrefix() { 
1972          return this.prefix == null ? null : this.prefix.getValue();
1973        }
1974
1975        /**
1976         * @param value A user-visible prefix for the action. For example a section or item numbering such as 1. or A.
1977         */
1978        public PlanDefinitionActionComponent setPrefix(String value) { 
1979          if (Utilities.noString(value))
1980            this.prefix = null;
1981          else {
1982            if (this.prefix == null)
1983              this.prefix = new StringType();
1984            this.prefix.setValue(value);
1985          }
1986          return this;
1987        }
1988
1989        /**
1990         * @return {@link #title} (The textual description of the action displayed to a user. For example, when the action is a test to be performed, the title would be the title of the test such as Assay by HPLC.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1991         */
1992        public StringType getTitleElement() { 
1993          if (this.title == null)
1994            if (Configuration.errorOnAutoCreate())
1995              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.title");
1996            else if (Configuration.doAutoCreate())
1997              this.title = new StringType(); // bb
1998          return this.title;
1999        }
2000
2001        public boolean hasTitleElement() { 
2002          return this.title != null && !this.title.isEmpty();
2003        }
2004
2005        public boolean hasTitle() { 
2006          return this.title != null && !this.title.isEmpty();
2007        }
2008
2009        /**
2010         * @param value {@link #title} (The textual description of the action displayed to a user. For example, when the action is a test to be performed, the title would be the title of the test such as Assay by HPLC.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
2011         */
2012        public PlanDefinitionActionComponent setTitleElement(StringType value) { 
2013          this.title = value;
2014          return this;
2015        }
2016
2017        /**
2018         * @return The textual description of the action displayed to a user. For example, when the action is a test to be performed, the title would be the title of the test such as Assay by HPLC.
2019         */
2020        public String getTitle() { 
2021          return this.title == null ? null : this.title.getValue();
2022        }
2023
2024        /**
2025         * @param value The textual description of the action displayed to a user. For example, when the action is a test to be performed, the title would be the title of the test such as Assay by HPLC.
2026         */
2027        public PlanDefinitionActionComponent setTitle(String value) { 
2028          if (Utilities.noString(value))
2029            this.title = null;
2030          else {
2031            if (this.title == null)
2032              this.title = new StringType();
2033            this.title.setValue(value);
2034          }
2035          return this;
2036        }
2037
2038        /**
2039         * @return {@link #description} (A brief description of the action used to provide a summary to display to the user.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2040         */
2041        public MarkdownType getDescriptionElement() { 
2042          if (this.description == null)
2043            if (Configuration.errorOnAutoCreate())
2044              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.description");
2045            else if (Configuration.doAutoCreate())
2046              this.description = new MarkdownType(); // bb
2047          return this.description;
2048        }
2049
2050        public boolean hasDescriptionElement() { 
2051          return this.description != null && !this.description.isEmpty();
2052        }
2053
2054        public boolean hasDescription() { 
2055          return this.description != null && !this.description.isEmpty();
2056        }
2057
2058        /**
2059         * @param value {@link #description} (A brief description of the action used to provide a summary to display to the user.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
2060         */
2061        public PlanDefinitionActionComponent setDescriptionElement(MarkdownType value) { 
2062          this.description = value;
2063          return this;
2064        }
2065
2066        /**
2067         * @return A brief description of the action used to provide a summary to display to the user.
2068         */
2069        public String getDescription() { 
2070          return this.description == null ? null : this.description.getValue();
2071        }
2072
2073        /**
2074         * @param value A brief description of the action used to provide a summary to display to the user.
2075         */
2076        public PlanDefinitionActionComponent setDescription(String value) { 
2077          if (Utilities.noString(value))
2078            this.description = null;
2079          else {
2080            if (this.description == null)
2081              this.description = new MarkdownType();
2082            this.description.setValue(value);
2083          }
2084          return this;
2085        }
2086
2087        /**
2088         * @return {@link #textEquivalent} (A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.). This is the underlying object with id, value and extensions. The accessor "getTextEquivalent" gives direct access to the value
2089         */
2090        public MarkdownType getTextEquivalentElement() { 
2091          if (this.textEquivalent == null)
2092            if (Configuration.errorOnAutoCreate())
2093              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.textEquivalent");
2094            else if (Configuration.doAutoCreate())
2095              this.textEquivalent = new MarkdownType(); // bb
2096          return this.textEquivalent;
2097        }
2098
2099        public boolean hasTextEquivalentElement() { 
2100          return this.textEquivalent != null && !this.textEquivalent.isEmpty();
2101        }
2102
2103        public boolean hasTextEquivalent() { 
2104          return this.textEquivalent != null && !this.textEquivalent.isEmpty();
2105        }
2106
2107        /**
2108         * @param value {@link #textEquivalent} (A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.). This is the underlying object with id, value and extensions. The accessor "getTextEquivalent" gives direct access to the value
2109         */
2110        public PlanDefinitionActionComponent setTextEquivalentElement(MarkdownType value) { 
2111          this.textEquivalent = value;
2112          return this;
2113        }
2114
2115        /**
2116         * @return A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.
2117         */
2118        public String getTextEquivalent() { 
2119          return this.textEquivalent == null ? null : this.textEquivalent.getValue();
2120        }
2121
2122        /**
2123         * @param value A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.
2124         */
2125        public PlanDefinitionActionComponent setTextEquivalent(String value) { 
2126          if (Utilities.noString(value))
2127            this.textEquivalent = null;
2128          else {
2129            if (this.textEquivalent == null)
2130              this.textEquivalent = new MarkdownType();
2131            this.textEquivalent.setValue(value);
2132          }
2133          return this;
2134        }
2135
2136        /**
2137         * @return {@link #priority} (Indicates how quickly the action should be addressed with respect to other actions.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
2138         */
2139        public Enumeration<RequestPriority> getPriorityElement() { 
2140          if (this.priority == null)
2141            if (Configuration.errorOnAutoCreate())
2142              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.priority");
2143            else if (Configuration.doAutoCreate())
2144              this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory()); // bb
2145          return this.priority;
2146        }
2147
2148        public boolean hasPriorityElement() { 
2149          return this.priority != null && !this.priority.isEmpty();
2150        }
2151
2152        public boolean hasPriority() { 
2153          return this.priority != null && !this.priority.isEmpty();
2154        }
2155
2156        /**
2157         * @param value {@link #priority} (Indicates how quickly the action should be addressed with respect to other actions.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value
2158         */
2159        public PlanDefinitionActionComponent setPriorityElement(Enumeration<RequestPriority> value) { 
2160          this.priority = value;
2161          return this;
2162        }
2163
2164        /**
2165         * @return Indicates how quickly the action should be addressed with respect to other actions.
2166         */
2167        public RequestPriority getPriority() { 
2168          return this.priority == null ? null : this.priority.getValue();
2169        }
2170
2171        /**
2172         * @param value Indicates how quickly the action should be addressed with respect to other actions.
2173         */
2174        public PlanDefinitionActionComponent setPriority(RequestPriority value) { 
2175          if (value == null)
2176            this.priority = null;
2177          else {
2178            if (this.priority == null)
2179              this.priority = new Enumeration<RequestPriority>(new RequestPriorityEnumFactory());
2180            this.priority.setValue(value);
2181          }
2182          return this;
2183        }
2184
2185        /**
2186         * @return {@link #code} (A code that provides a meaning, grouping, or classification for the action or action group. For example, a section may have a LOINC code for the section of a documentation template. In pharmaceutical quality, an action (Test) such as pH could be classified as a physical property.)
2187         */
2188        public CodeableConcept getCode() { 
2189          if (this.code == null)
2190            if (Configuration.errorOnAutoCreate())
2191              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.code");
2192            else if (Configuration.doAutoCreate())
2193              this.code = new CodeableConcept(); // cc
2194          return this.code;
2195        }
2196
2197        public boolean hasCode() { 
2198          return this.code != null && !this.code.isEmpty();
2199        }
2200
2201        /**
2202         * @param value {@link #code} (A code that provides a meaning, grouping, or classification for the action or action group. For example, a section may have a LOINC code for the section of a documentation template. In pharmaceutical quality, an action (Test) such as pH could be classified as a physical property.)
2203         */
2204        public PlanDefinitionActionComponent setCode(CodeableConcept value) { 
2205          this.code = value;
2206          return this;
2207        }
2208
2209        /**
2210         * @return {@link #reason} (A description of why this action is necessary or appropriate.)
2211         */
2212        public List<CodeableConcept> getReason() { 
2213          if (this.reason == null)
2214            this.reason = new ArrayList<CodeableConcept>();
2215          return this.reason;
2216        }
2217
2218        /**
2219         * @return Returns a reference to <code>this</code> for easy method chaining
2220         */
2221        public PlanDefinitionActionComponent setReason(List<CodeableConcept> theReason) { 
2222          this.reason = theReason;
2223          return this;
2224        }
2225
2226        public boolean hasReason() { 
2227          if (this.reason == null)
2228            return false;
2229          for (CodeableConcept item : this.reason)
2230            if (!item.isEmpty())
2231              return true;
2232          return false;
2233        }
2234
2235        public CodeableConcept addReason() { //3
2236          CodeableConcept t = new CodeableConcept();
2237          if (this.reason == null)
2238            this.reason = new ArrayList<CodeableConcept>();
2239          this.reason.add(t);
2240          return t;
2241        }
2242
2243        public PlanDefinitionActionComponent addReason(CodeableConcept t) { //3
2244          if (t == null)
2245            return this;
2246          if (this.reason == null)
2247            this.reason = new ArrayList<CodeableConcept>();
2248          this.reason.add(t);
2249          return this;
2250        }
2251
2252        /**
2253         * @return The first repetition of repeating field {@link #reason}, creating it if it does not already exist {3}
2254         */
2255        public CodeableConcept getReasonFirstRep() { 
2256          if (getReason().isEmpty()) {
2257            addReason();
2258          }
2259          return getReason().get(0);
2260        }
2261
2262        /**
2263         * @return {@link #documentation} (Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.)
2264         */
2265        public List<RelatedArtifact> getDocumentation() { 
2266          if (this.documentation == null)
2267            this.documentation = new ArrayList<RelatedArtifact>();
2268          return this.documentation;
2269        }
2270
2271        /**
2272         * @return Returns a reference to <code>this</code> for easy method chaining
2273         */
2274        public PlanDefinitionActionComponent setDocumentation(List<RelatedArtifact> theDocumentation) { 
2275          this.documentation = theDocumentation;
2276          return this;
2277        }
2278
2279        public boolean hasDocumentation() { 
2280          if (this.documentation == null)
2281            return false;
2282          for (RelatedArtifact item : this.documentation)
2283            if (!item.isEmpty())
2284              return true;
2285          return false;
2286        }
2287
2288        public RelatedArtifact addDocumentation() { //3
2289          RelatedArtifact t = new RelatedArtifact();
2290          if (this.documentation == null)
2291            this.documentation = new ArrayList<RelatedArtifact>();
2292          this.documentation.add(t);
2293          return t;
2294        }
2295
2296        public PlanDefinitionActionComponent addDocumentation(RelatedArtifact t) { //3
2297          if (t == null)
2298            return this;
2299          if (this.documentation == null)
2300            this.documentation = new ArrayList<RelatedArtifact>();
2301          this.documentation.add(t);
2302          return this;
2303        }
2304
2305        /**
2306         * @return The first repetition of repeating field {@link #documentation}, creating it if it does not already exist {3}
2307         */
2308        public RelatedArtifact getDocumentationFirstRep() { 
2309          if (getDocumentation().isEmpty()) {
2310            addDocumentation();
2311          }
2312          return getDocumentation().get(0);
2313        }
2314
2315        /**
2316         * @return {@link #goalId} (Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition. In pharmaceutical quality, a goal represents acceptance criteria (Goal) for a given action (Test), so the goalId would be the unique id of a defined goal element establishing the acceptance criteria for the action.)
2317         */
2318        public List<IdType> getGoalId() { 
2319          if (this.goalId == null)
2320            this.goalId = new ArrayList<IdType>();
2321          return this.goalId;
2322        }
2323
2324        /**
2325         * @return Returns a reference to <code>this</code> for easy method chaining
2326         */
2327        public PlanDefinitionActionComponent setGoalId(List<IdType> theGoalId) { 
2328          this.goalId = theGoalId;
2329          return this;
2330        }
2331
2332        public boolean hasGoalId() { 
2333          if (this.goalId == null)
2334            return false;
2335          for (IdType item : this.goalId)
2336            if (!item.isEmpty())
2337              return true;
2338          return false;
2339        }
2340
2341        /**
2342         * @return {@link #goalId} (Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition. In pharmaceutical quality, a goal represents acceptance criteria (Goal) for a given action (Test), so the goalId would be the unique id of a defined goal element establishing the acceptance criteria for the action.)
2343         */
2344        public IdType addGoalIdElement() {//2 
2345          IdType t = new IdType();
2346          if (this.goalId == null)
2347            this.goalId = new ArrayList<IdType>();
2348          this.goalId.add(t);
2349          return t;
2350        }
2351
2352        /**
2353         * @param value {@link #goalId} (Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition. In pharmaceutical quality, a goal represents acceptance criteria (Goal) for a given action (Test), so the goalId would be the unique id of a defined goal element establishing the acceptance criteria for the action.)
2354         */
2355        public PlanDefinitionActionComponent addGoalId(String value) { //1
2356          IdType t = new IdType();
2357          t.setValue(value);
2358          if (this.goalId == null)
2359            this.goalId = new ArrayList<IdType>();
2360          this.goalId.add(t);
2361          return this;
2362        }
2363
2364        /**
2365         * @param value {@link #goalId} (Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition. In pharmaceutical quality, a goal represents acceptance criteria (Goal) for a given action (Test), so the goalId would be the unique id of a defined goal element establishing the acceptance criteria for the action.)
2366         */
2367        public boolean hasGoalId(String value) { 
2368          if (this.goalId == null)
2369            return false;
2370          for (IdType v : this.goalId)
2371            if (v.getValue().equals(value)) // id
2372              return true;
2373          return false;
2374        }
2375
2376        /**
2377         * @return {@link #subject} (A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.)
2378         */
2379        public DataType getSubject() { 
2380          return this.subject;
2381        }
2382
2383        /**
2384         * @return {@link #subject} (A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.)
2385         */
2386        public CodeableConcept getSubjectCodeableConcept() throws FHIRException { 
2387          if (this.subject == null)
2388            this.subject = new CodeableConcept();
2389          if (!(this.subject instanceof CodeableConcept))
2390            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.subject.getClass().getName()+" was encountered");
2391          return (CodeableConcept) this.subject;
2392        }
2393
2394        public boolean hasSubjectCodeableConcept() { 
2395          return this != null && this.subject instanceof CodeableConcept;
2396        }
2397
2398        /**
2399         * @return {@link #subject} (A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.)
2400         */
2401        public Reference getSubjectReference() throws FHIRException { 
2402          if (this.subject == null)
2403            this.subject = new Reference();
2404          if (!(this.subject instanceof Reference))
2405            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.subject.getClass().getName()+" was encountered");
2406          return (Reference) this.subject;
2407        }
2408
2409        public boolean hasSubjectReference() { 
2410          return this != null && this.subject instanceof Reference;
2411        }
2412
2413        /**
2414         * @return {@link #subject} (A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.)
2415         */
2416        public CanonicalType getSubjectCanonicalType() throws FHIRException { 
2417          if (this.subject == null)
2418            this.subject = new CanonicalType();
2419          if (!(this.subject instanceof CanonicalType))
2420            throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.subject.getClass().getName()+" was encountered");
2421          return (CanonicalType) this.subject;
2422        }
2423
2424        public boolean hasSubjectCanonicalType() { 
2425          return this != null && this.subject instanceof CanonicalType;
2426        }
2427
2428        public boolean hasSubject() { 
2429          return this.subject != null && !this.subject.isEmpty();
2430        }
2431
2432        /**
2433         * @param value {@link #subject} (A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.)
2434         */
2435        public PlanDefinitionActionComponent setSubject(DataType value) { 
2436          if (value != null && !(value instanceof CodeableConcept || value instanceof Reference || value instanceof CanonicalType))
2437            throw new FHIRException("Not the right type for PlanDefinition.action.subject[x]: "+value.fhirType());
2438          this.subject = value;
2439          return this;
2440        }
2441
2442        /**
2443         * @return {@link #trigger} (A description of when the action should be triggered. When multiple triggers are specified on an action, any triggering event invokes the action.)
2444         */
2445        public List<TriggerDefinition> getTrigger() { 
2446          if (this.trigger == null)
2447            this.trigger = new ArrayList<TriggerDefinition>();
2448          return this.trigger;
2449        }
2450
2451        /**
2452         * @return Returns a reference to <code>this</code> for easy method chaining
2453         */
2454        public PlanDefinitionActionComponent setTrigger(List<TriggerDefinition> theTrigger) { 
2455          this.trigger = theTrigger;
2456          return this;
2457        }
2458
2459        public boolean hasTrigger() { 
2460          if (this.trigger == null)
2461            return false;
2462          for (TriggerDefinition item : this.trigger)
2463            if (!item.isEmpty())
2464              return true;
2465          return false;
2466        }
2467
2468        public TriggerDefinition addTrigger() { //3
2469          TriggerDefinition t = new TriggerDefinition();
2470          if (this.trigger == null)
2471            this.trigger = new ArrayList<TriggerDefinition>();
2472          this.trigger.add(t);
2473          return t;
2474        }
2475
2476        public PlanDefinitionActionComponent addTrigger(TriggerDefinition t) { //3
2477          if (t == null)
2478            return this;
2479          if (this.trigger == null)
2480            this.trigger = new ArrayList<TriggerDefinition>();
2481          this.trigger.add(t);
2482          return this;
2483        }
2484
2485        /**
2486         * @return The first repetition of repeating field {@link #trigger}, creating it if it does not already exist {3}
2487         */
2488        public TriggerDefinition getTriggerFirstRep() { 
2489          if (getTrigger().isEmpty()) {
2490            addTrigger();
2491          }
2492          return getTrigger().get(0);
2493        }
2494
2495        /**
2496         * @return {@link #condition} (An expression that describes applicability criteria or start/stop conditions for the action.)
2497         */
2498        public List<PlanDefinitionActionConditionComponent> getCondition() { 
2499          if (this.condition == null)
2500            this.condition = new ArrayList<PlanDefinitionActionConditionComponent>();
2501          return this.condition;
2502        }
2503
2504        /**
2505         * @return Returns a reference to <code>this</code> for easy method chaining
2506         */
2507        public PlanDefinitionActionComponent setCondition(List<PlanDefinitionActionConditionComponent> theCondition) { 
2508          this.condition = theCondition;
2509          return this;
2510        }
2511
2512        public boolean hasCondition() { 
2513          if (this.condition == null)
2514            return false;
2515          for (PlanDefinitionActionConditionComponent item : this.condition)
2516            if (!item.isEmpty())
2517              return true;
2518          return false;
2519        }
2520
2521        public PlanDefinitionActionConditionComponent addCondition() { //3
2522          PlanDefinitionActionConditionComponent t = new PlanDefinitionActionConditionComponent();
2523          if (this.condition == null)
2524            this.condition = new ArrayList<PlanDefinitionActionConditionComponent>();
2525          this.condition.add(t);
2526          return t;
2527        }
2528
2529        public PlanDefinitionActionComponent addCondition(PlanDefinitionActionConditionComponent t) { //3
2530          if (t == null)
2531            return this;
2532          if (this.condition == null)
2533            this.condition = new ArrayList<PlanDefinitionActionConditionComponent>();
2534          this.condition.add(t);
2535          return this;
2536        }
2537
2538        /**
2539         * @return The first repetition of repeating field {@link #condition}, creating it if it does not already exist {3}
2540         */
2541        public PlanDefinitionActionConditionComponent getConditionFirstRep() { 
2542          if (getCondition().isEmpty()) {
2543            addCondition();
2544          }
2545          return getCondition().get(0);
2546        }
2547
2548        /**
2549         * @return {@link #input} (Defines input data requirements for the action.)
2550         */
2551        public List<PlanDefinitionActionInputComponent> getInput() { 
2552          if (this.input == null)
2553            this.input = new ArrayList<PlanDefinitionActionInputComponent>();
2554          return this.input;
2555        }
2556
2557        /**
2558         * @return Returns a reference to <code>this</code> for easy method chaining
2559         */
2560        public PlanDefinitionActionComponent setInput(List<PlanDefinitionActionInputComponent> theInput) { 
2561          this.input = theInput;
2562          return this;
2563        }
2564
2565        public boolean hasInput() { 
2566          if (this.input == null)
2567            return false;
2568          for (PlanDefinitionActionInputComponent item : this.input)
2569            if (!item.isEmpty())
2570              return true;
2571          return false;
2572        }
2573
2574        public PlanDefinitionActionInputComponent addInput() { //3
2575          PlanDefinitionActionInputComponent t = new PlanDefinitionActionInputComponent();
2576          if (this.input == null)
2577            this.input = new ArrayList<PlanDefinitionActionInputComponent>();
2578          this.input.add(t);
2579          return t;
2580        }
2581
2582        public PlanDefinitionActionComponent addInput(PlanDefinitionActionInputComponent t) { //3
2583          if (t == null)
2584            return this;
2585          if (this.input == null)
2586            this.input = new ArrayList<PlanDefinitionActionInputComponent>();
2587          this.input.add(t);
2588          return this;
2589        }
2590
2591        /**
2592         * @return The first repetition of repeating field {@link #input}, creating it if it does not already exist {3}
2593         */
2594        public PlanDefinitionActionInputComponent getInputFirstRep() { 
2595          if (getInput().isEmpty()) {
2596            addInput();
2597          }
2598          return getInput().get(0);
2599        }
2600
2601        /**
2602         * @return {@link #output} (Defines the outputs of the action, if any.)
2603         */
2604        public List<PlanDefinitionActionOutputComponent> getOutput() { 
2605          if (this.output == null)
2606            this.output = new ArrayList<PlanDefinitionActionOutputComponent>();
2607          return this.output;
2608        }
2609
2610        /**
2611         * @return Returns a reference to <code>this</code> for easy method chaining
2612         */
2613        public PlanDefinitionActionComponent setOutput(List<PlanDefinitionActionOutputComponent> theOutput) { 
2614          this.output = theOutput;
2615          return this;
2616        }
2617
2618        public boolean hasOutput() { 
2619          if (this.output == null)
2620            return false;
2621          for (PlanDefinitionActionOutputComponent item : this.output)
2622            if (!item.isEmpty())
2623              return true;
2624          return false;
2625        }
2626
2627        public PlanDefinitionActionOutputComponent addOutput() { //3
2628          PlanDefinitionActionOutputComponent t = new PlanDefinitionActionOutputComponent();
2629          if (this.output == null)
2630            this.output = new ArrayList<PlanDefinitionActionOutputComponent>();
2631          this.output.add(t);
2632          return t;
2633        }
2634
2635        public PlanDefinitionActionComponent addOutput(PlanDefinitionActionOutputComponent t) { //3
2636          if (t == null)
2637            return this;
2638          if (this.output == null)
2639            this.output = new ArrayList<PlanDefinitionActionOutputComponent>();
2640          this.output.add(t);
2641          return this;
2642        }
2643
2644        /**
2645         * @return The first repetition of repeating field {@link #output}, creating it if it does not already exist {3}
2646         */
2647        public PlanDefinitionActionOutputComponent getOutputFirstRep() { 
2648          if (getOutput().isEmpty()) {
2649            addOutput();
2650          }
2651          return getOutput().get(0);
2652        }
2653
2654        /**
2655         * @return {@link #relatedAction} (A relationship to another action such as "before" or "30-60 minutes after start of".)
2656         */
2657        public List<PlanDefinitionActionRelatedActionComponent> getRelatedAction() { 
2658          if (this.relatedAction == null)
2659            this.relatedAction = new ArrayList<PlanDefinitionActionRelatedActionComponent>();
2660          return this.relatedAction;
2661        }
2662
2663        /**
2664         * @return Returns a reference to <code>this</code> for easy method chaining
2665         */
2666        public PlanDefinitionActionComponent setRelatedAction(List<PlanDefinitionActionRelatedActionComponent> theRelatedAction) { 
2667          this.relatedAction = theRelatedAction;
2668          return this;
2669        }
2670
2671        public boolean hasRelatedAction() { 
2672          if (this.relatedAction == null)
2673            return false;
2674          for (PlanDefinitionActionRelatedActionComponent item : this.relatedAction)
2675            if (!item.isEmpty())
2676              return true;
2677          return false;
2678        }
2679
2680        public PlanDefinitionActionRelatedActionComponent addRelatedAction() { //3
2681          PlanDefinitionActionRelatedActionComponent t = new PlanDefinitionActionRelatedActionComponent();
2682          if (this.relatedAction == null)
2683            this.relatedAction = new ArrayList<PlanDefinitionActionRelatedActionComponent>();
2684          this.relatedAction.add(t);
2685          return t;
2686        }
2687
2688        public PlanDefinitionActionComponent addRelatedAction(PlanDefinitionActionRelatedActionComponent t) { //3
2689          if (t == null)
2690            return this;
2691          if (this.relatedAction == null)
2692            this.relatedAction = new ArrayList<PlanDefinitionActionRelatedActionComponent>();
2693          this.relatedAction.add(t);
2694          return this;
2695        }
2696
2697        /**
2698         * @return The first repetition of repeating field {@link #relatedAction}, creating it if it does not already exist {3}
2699         */
2700        public PlanDefinitionActionRelatedActionComponent getRelatedActionFirstRep() { 
2701          if (getRelatedAction().isEmpty()) {
2702            addRelatedAction();
2703          }
2704          return getRelatedAction().get(0);
2705        }
2706
2707        /**
2708         * @return {@link #timing} (An optional value describing when the action should be performed.)
2709         */
2710        public DataType getTiming() { 
2711          return this.timing;
2712        }
2713
2714        /**
2715         * @return {@link #timing} (An optional value describing when the action should be performed.)
2716         */
2717        public Age getTimingAge() throws FHIRException { 
2718          if (this.timing == null)
2719            this.timing = new Age();
2720          if (!(this.timing instanceof Age))
2721            throw new FHIRException("Type mismatch: the type Age was expected, but "+this.timing.getClass().getName()+" was encountered");
2722          return (Age) this.timing;
2723        }
2724
2725        public boolean hasTimingAge() { 
2726          return this != null && this.timing instanceof Age;
2727        }
2728
2729        /**
2730         * @return {@link #timing} (An optional value describing when the action should be performed.)
2731         */
2732        public Duration getTimingDuration() throws FHIRException { 
2733          if (this.timing == null)
2734            this.timing = new Duration();
2735          if (!(this.timing instanceof Duration))
2736            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.timing.getClass().getName()+" was encountered");
2737          return (Duration) this.timing;
2738        }
2739
2740        public boolean hasTimingDuration() { 
2741          return this != null && this.timing instanceof Duration;
2742        }
2743
2744        /**
2745         * @return {@link #timing} (An optional value describing when the action should be performed.)
2746         */
2747        public Range getTimingRange() throws FHIRException { 
2748          if (this.timing == null)
2749            this.timing = new Range();
2750          if (!(this.timing instanceof Range))
2751            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.timing.getClass().getName()+" was encountered");
2752          return (Range) this.timing;
2753        }
2754
2755        public boolean hasTimingRange() { 
2756          return this != null && this.timing instanceof Range;
2757        }
2758
2759        /**
2760         * @return {@link #timing} (An optional value describing when the action should be performed.)
2761         */
2762        public Timing getTimingTiming() throws FHIRException { 
2763          if (this.timing == null)
2764            this.timing = new Timing();
2765          if (!(this.timing instanceof Timing))
2766            throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered");
2767          return (Timing) this.timing;
2768        }
2769
2770        public boolean hasTimingTiming() { 
2771          return this != null && this.timing instanceof Timing;
2772        }
2773
2774        public boolean hasTiming() { 
2775          return this.timing != null && !this.timing.isEmpty();
2776        }
2777
2778        /**
2779         * @param value {@link #timing} (An optional value describing when the action should be performed.)
2780         */
2781        public PlanDefinitionActionComponent setTiming(DataType value) { 
2782          if (value != null && !(value instanceof Age || value instanceof Duration || value instanceof Range || value instanceof Timing))
2783            throw new FHIRException("Not the right type for PlanDefinition.action.timing[x]: "+value.fhirType());
2784          this.timing = value;
2785          return this;
2786        }
2787
2788        /**
2789         * @return {@link #location} (Identifies the facility where the action will occur; e.g. home, hospital, specific clinic, etc.)
2790         */
2791        public CodeableReference getLocation() { 
2792          if (this.location == null)
2793            if (Configuration.errorOnAutoCreate())
2794              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.location");
2795            else if (Configuration.doAutoCreate())
2796              this.location = new CodeableReference(); // cc
2797          return this.location;
2798        }
2799
2800        public boolean hasLocation() { 
2801          return this.location != null && !this.location.isEmpty();
2802        }
2803
2804        /**
2805         * @param value {@link #location} (Identifies the facility where the action will occur; e.g. home, hospital, specific clinic, etc.)
2806         */
2807        public PlanDefinitionActionComponent setLocation(CodeableReference value) { 
2808          this.location = value;
2809          return this;
2810        }
2811
2812        /**
2813         * @return {@link #participant} (Indicates who should participate in performing the action described.)
2814         */
2815        public List<PlanDefinitionActionParticipantComponent> getParticipant() { 
2816          if (this.participant == null)
2817            this.participant = new ArrayList<PlanDefinitionActionParticipantComponent>();
2818          return this.participant;
2819        }
2820
2821        /**
2822         * @return Returns a reference to <code>this</code> for easy method chaining
2823         */
2824        public PlanDefinitionActionComponent setParticipant(List<PlanDefinitionActionParticipantComponent> theParticipant) { 
2825          this.participant = theParticipant;
2826          return this;
2827        }
2828
2829        public boolean hasParticipant() { 
2830          if (this.participant == null)
2831            return false;
2832          for (PlanDefinitionActionParticipantComponent item : this.participant)
2833            if (!item.isEmpty())
2834              return true;
2835          return false;
2836        }
2837
2838        public PlanDefinitionActionParticipantComponent addParticipant() { //3
2839          PlanDefinitionActionParticipantComponent t = new PlanDefinitionActionParticipantComponent();
2840          if (this.participant == null)
2841            this.participant = new ArrayList<PlanDefinitionActionParticipantComponent>();
2842          this.participant.add(t);
2843          return t;
2844        }
2845
2846        public PlanDefinitionActionComponent addParticipant(PlanDefinitionActionParticipantComponent t) { //3
2847          if (t == null)
2848            return this;
2849          if (this.participant == null)
2850            this.participant = new ArrayList<PlanDefinitionActionParticipantComponent>();
2851          this.participant.add(t);
2852          return this;
2853        }
2854
2855        /**
2856         * @return The first repetition of repeating field {@link #participant}, creating it if it does not already exist {3}
2857         */
2858        public PlanDefinitionActionParticipantComponent getParticipantFirstRep() { 
2859          if (getParticipant().isEmpty()) {
2860            addParticipant();
2861          }
2862          return getParticipant().get(0);
2863        }
2864
2865        /**
2866         * @return {@link #type} (The type of action to perform (create, update, remove).)
2867         */
2868        public CodeableConcept getType() { 
2869          if (this.type == null)
2870            if (Configuration.errorOnAutoCreate())
2871              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.type");
2872            else if (Configuration.doAutoCreate())
2873              this.type = new CodeableConcept(); // cc
2874          return this.type;
2875        }
2876
2877        public boolean hasType() { 
2878          return this.type != null && !this.type.isEmpty();
2879        }
2880
2881        /**
2882         * @param value {@link #type} (The type of action to perform (create, update, remove).)
2883         */
2884        public PlanDefinitionActionComponent setType(CodeableConcept value) { 
2885          this.type = value;
2886          return this;
2887        }
2888
2889        /**
2890         * @return {@link #groupingBehavior} (Defines the grouping behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getGroupingBehavior" gives direct access to the value
2891         */
2892        public Enumeration<ActionGroupingBehavior> getGroupingBehaviorElement() { 
2893          if (this.groupingBehavior == null)
2894            if (Configuration.errorOnAutoCreate())
2895              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.groupingBehavior");
2896            else if (Configuration.doAutoCreate())
2897              this.groupingBehavior = new Enumeration<ActionGroupingBehavior>(new ActionGroupingBehaviorEnumFactory()); // bb
2898          return this.groupingBehavior;
2899        }
2900
2901        public boolean hasGroupingBehaviorElement() { 
2902          return this.groupingBehavior != null && !this.groupingBehavior.isEmpty();
2903        }
2904
2905        public boolean hasGroupingBehavior() { 
2906          return this.groupingBehavior != null && !this.groupingBehavior.isEmpty();
2907        }
2908
2909        /**
2910         * @param value {@link #groupingBehavior} (Defines the grouping behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getGroupingBehavior" gives direct access to the value
2911         */
2912        public PlanDefinitionActionComponent setGroupingBehaviorElement(Enumeration<ActionGroupingBehavior> value) { 
2913          this.groupingBehavior = value;
2914          return this;
2915        }
2916
2917        /**
2918         * @return Defines the grouping behavior for the action and its children.
2919         */
2920        public ActionGroupingBehavior getGroupingBehavior() { 
2921          return this.groupingBehavior == null ? null : this.groupingBehavior.getValue();
2922        }
2923
2924        /**
2925         * @param value Defines the grouping behavior for the action and its children.
2926         */
2927        public PlanDefinitionActionComponent setGroupingBehavior(ActionGroupingBehavior value) { 
2928          if (value == null)
2929            this.groupingBehavior = null;
2930          else {
2931            if (this.groupingBehavior == null)
2932              this.groupingBehavior = new Enumeration<ActionGroupingBehavior>(new ActionGroupingBehaviorEnumFactory());
2933            this.groupingBehavior.setValue(value);
2934          }
2935          return this;
2936        }
2937
2938        /**
2939         * @return {@link #selectionBehavior} (Defines the selection behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getSelectionBehavior" gives direct access to the value
2940         */
2941        public Enumeration<ActionSelectionBehavior> getSelectionBehaviorElement() { 
2942          if (this.selectionBehavior == null)
2943            if (Configuration.errorOnAutoCreate())
2944              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.selectionBehavior");
2945            else if (Configuration.doAutoCreate())
2946              this.selectionBehavior = new Enumeration<ActionSelectionBehavior>(new ActionSelectionBehaviorEnumFactory()); // bb
2947          return this.selectionBehavior;
2948        }
2949
2950        public boolean hasSelectionBehaviorElement() { 
2951          return this.selectionBehavior != null && !this.selectionBehavior.isEmpty();
2952        }
2953
2954        public boolean hasSelectionBehavior() { 
2955          return this.selectionBehavior != null && !this.selectionBehavior.isEmpty();
2956        }
2957
2958        /**
2959         * @param value {@link #selectionBehavior} (Defines the selection behavior for the action and its children.). This is the underlying object with id, value and extensions. The accessor "getSelectionBehavior" gives direct access to the value
2960         */
2961        public PlanDefinitionActionComponent setSelectionBehaviorElement(Enumeration<ActionSelectionBehavior> value) { 
2962          this.selectionBehavior = value;
2963          return this;
2964        }
2965
2966        /**
2967         * @return Defines the selection behavior for the action and its children.
2968         */
2969        public ActionSelectionBehavior getSelectionBehavior() { 
2970          return this.selectionBehavior == null ? null : this.selectionBehavior.getValue();
2971        }
2972
2973        /**
2974         * @param value Defines the selection behavior for the action and its children.
2975         */
2976        public PlanDefinitionActionComponent setSelectionBehavior(ActionSelectionBehavior value) { 
2977          if (value == null)
2978            this.selectionBehavior = null;
2979          else {
2980            if (this.selectionBehavior == null)
2981              this.selectionBehavior = new Enumeration<ActionSelectionBehavior>(new ActionSelectionBehaviorEnumFactory());
2982            this.selectionBehavior.setValue(value);
2983          }
2984          return this;
2985        }
2986
2987        /**
2988         * @return {@link #requiredBehavior} (Defines the required behavior for the action.). This is the underlying object with id, value and extensions. The accessor "getRequiredBehavior" gives direct access to the value
2989         */
2990        public Enumeration<ActionRequiredBehavior> getRequiredBehaviorElement() { 
2991          if (this.requiredBehavior == null)
2992            if (Configuration.errorOnAutoCreate())
2993              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.requiredBehavior");
2994            else if (Configuration.doAutoCreate())
2995              this.requiredBehavior = new Enumeration<ActionRequiredBehavior>(new ActionRequiredBehaviorEnumFactory()); // bb
2996          return this.requiredBehavior;
2997        }
2998
2999        public boolean hasRequiredBehaviorElement() { 
3000          return this.requiredBehavior != null && !this.requiredBehavior.isEmpty();
3001        }
3002
3003        public boolean hasRequiredBehavior() { 
3004          return this.requiredBehavior != null && !this.requiredBehavior.isEmpty();
3005        }
3006
3007        /**
3008         * @param value {@link #requiredBehavior} (Defines the required behavior for the action.). This is the underlying object with id, value and extensions. The accessor "getRequiredBehavior" gives direct access to the value
3009         */
3010        public PlanDefinitionActionComponent setRequiredBehaviorElement(Enumeration<ActionRequiredBehavior> value) { 
3011          this.requiredBehavior = value;
3012          return this;
3013        }
3014
3015        /**
3016         * @return Defines the required behavior for the action.
3017         */
3018        public ActionRequiredBehavior getRequiredBehavior() { 
3019          return this.requiredBehavior == null ? null : this.requiredBehavior.getValue();
3020        }
3021
3022        /**
3023         * @param value Defines the required behavior for the action.
3024         */
3025        public PlanDefinitionActionComponent setRequiredBehavior(ActionRequiredBehavior value) { 
3026          if (value == null)
3027            this.requiredBehavior = null;
3028          else {
3029            if (this.requiredBehavior == null)
3030              this.requiredBehavior = new Enumeration<ActionRequiredBehavior>(new ActionRequiredBehaviorEnumFactory());
3031            this.requiredBehavior.setValue(value);
3032          }
3033          return this;
3034        }
3035
3036        /**
3037         * @return {@link #precheckBehavior} (Defines whether the action should usually be preselected.). This is the underlying object with id, value and extensions. The accessor "getPrecheckBehavior" gives direct access to the value
3038         */
3039        public Enumeration<ActionPrecheckBehavior> getPrecheckBehaviorElement() { 
3040          if (this.precheckBehavior == null)
3041            if (Configuration.errorOnAutoCreate())
3042              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.precheckBehavior");
3043            else if (Configuration.doAutoCreate())
3044              this.precheckBehavior = new Enumeration<ActionPrecheckBehavior>(new ActionPrecheckBehaviorEnumFactory()); // bb
3045          return this.precheckBehavior;
3046        }
3047
3048        public boolean hasPrecheckBehaviorElement() { 
3049          return this.precheckBehavior != null && !this.precheckBehavior.isEmpty();
3050        }
3051
3052        public boolean hasPrecheckBehavior() { 
3053          return this.precheckBehavior != null && !this.precheckBehavior.isEmpty();
3054        }
3055
3056        /**
3057         * @param value {@link #precheckBehavior} (Defines whether the action should usually be preselected.). This is the underlying object with id, value and extensions. The accessor "getPrecheckBehavior" gives direct access to the value
3058         */
3059        public PlanDefinitionActionComponent setPrecheckBehaviorElement(Enumeration<ActionPrecheckBehavior> value) { 
3060          this.precheckBehavior = value;
3061          return this;
3062        }
3063
3064        /**
3065         * @return Defines whether the action should usually be preselected.
3066         */
3067        public ActionPrecheckBehavior getPrecheckBehavior() { 
3068          return this.precheckBehavior == null ? null : this.precheckBehavior.getValue();
3069        }
3070
3071        /**
3072         * @param value Defines whether the action should usually be preselected.
3073         */
3074        public PlanDefinitionActionComponent setPrecheckBehavior(ActionPrecheckBehavior value) { 
3075          if (value == null)
3076            this.precheckBehavior = null;
3077          else {
3078            if (this.precheckBehavior == null)
3079              this.precheckBehavior = new Enumeration<ActionPrecheckBehavior>(new ActionPrecheckBehaviorEnumFactory());
3080            this.precheckBehavior.setValue(value);
3081          }
3082          return this;
3083        }
3084
3085        /**
3086         * @return {@link #cardinalityBehavior} (Defines whether the action can be selected multiple times.). This is the underlying object with id, value and extensions. The accessor "getCardinalityBehavior" gives direct access to the value
3087         */
3088        public Enumeration<ActionCardinalityBehavior> getCardinalityBehaviorElement() { 
3089          if (this.cardinalityBehavior == null)
3090            if (Configuration.errorOnAutoCreate())
3091              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.cardinalityBehavior");
3092            else if (Configuration.doAutoCreate())
3093              this.cardinalityBehavior = new Enumeration<ActionCardinalityBehavior>(new ActionCardinalityBehaviorEnumFactory()); // bb
3094          return this.cardinalityBehavior;
3095        }
3096
3097        public boolean hasCardinalityBehaviorElement() { 
3098          return this.cardinalityBehavior != null && !this.cardinalityBehavior.isEmpty();
3099        }
3100
3101        public boolean hasCardinalityBehavior() { 
3102          return this.cardinalityBehavior != null && !this.cardinalityBehavior.isEmpty();
3103        }
3104
3105        /**
3106         * @param value {@link #cardinalityBehavior} (Defines whether the action can be selected multiple times.). This is the underlying object with id, value and extensions. The accessor "getCardinalityBehavior" gives direct access to the value
3107         */
3108        public PlanDefinitionActionComponent setCardinalityBehaviorElement(Enumeration<ActionCardinalityBehavior> value) { 
3109          this.cardinalityBehavior = value;
3110          return this;
3111        }
3112
3113        /**
3114         * @return Defines whether the action can be selected multiple times.
3115         */
3116        public ActionCardinalityBehavior getCardinalityBehavior() { 
3117          return this.cardinalityBehavior == null ? null : this.cardinalityBehavior.getValue();
3118        }
3119
3120        /**
3121         * @param value Defines whether the action can be selected multiple times.
3122         */
3123        public PlanDefinitionActionComponent setCardinalityBehavior(ActionCardinalityBehavior value) { 
3124          if (value == null)
3125            this.cardinalityBehavior = null;
3126          else {
3127            if (this.cardinalityBehavior == null)
3128              this.cardinalityBehavior = new Enumeration<ActionCardinalityBehavior>(new ActionCardinalityBehaviorEnumFactory());
3129            this.cardinalityBehavior.setValue(value);
3130          }
3131          return this;
3132        }
3133
3134        /**
3135         * @return {@link #definition} (A reference to an ActivityDefinition that describes the action to be taken in detail, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.)
3136         */
3137        public DataType getDefinition() { 
3138          return this.definition;
3139        }
3140
3141        /**
3142         * @return {@link #definition} (A reference to an ActivityDefinition that describes the action to be taken in detail, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.)
3143         */
3144        public CanonicalType getDefinitionCanonicalType() throws FHIRException { 
3145          if (this.definition == null)
3146            this.definition = new CanonicalType();
3147          if (!(this.definition instanceof CanonicalType))
3148            throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.definition.getClass().getName()+" was encountered");
3149          return (CanonicalType) this.definition;
3150        }
3151
3152        public boolean hasDefinitionCanonicalType() { 
3153          return this != null && this.definition instanceof CanonicalType;
3154        }
3155
3156        /**
3157         * @return {@link #definition} (A reference to an ActivityDefinition that describes the action to be taken in detail, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.)
3158         */
3159        public UriType getDefinitionUriType() throws FHIRException { 
3160          if (this.definition == null)
3161            this.definition = new UriType();
3162          if (!(this.definition instanceof UriType))
3163            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.definition.getClass().getName()+" was encountered");
3164          return (UriType) this.definition;
3165        }
3166
3167        public boolean hasDefinitionUriType() { 
3168          return this != null && this.definition instanceof UriType;
3169        }
3170
3171        public boolean hasDefinition() { 
3172          return this.definition != null && !this.definition.isEmpty();
3173        }
3174
3175        /**
3176         * @param value {@link #definition} (A reference to an ActivityDefinition that describes the action to be taken in detail, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.)
3177         */
3178        public PlanDefinitionActionComponent setDefinition(DataType value) { 
3179          if (value != null && !(value instanceof CanonicalType || value instanceof UriType))
3180            throw new FHIRException("Not the right type for PlanDefinition.action.definition[x]: "+value.fhirType());
3181          this.definition = value;
3182          return this;
3183        }
3184
3185        /**
3186         * @return {@link #transform} (A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.). This is the underlying object with id, value and extensions. The accessor "getTransform" gives direct access to the value
3187         */
3188        public CanonicalType getTransformElement() { 
3189          if (this.transform == null)
3190            if (Configuration.errorOnAutoCreate())
3191              throw new Error("Attempt to auto-create PlanDefinitionActionComponent.transform");
3192            else if (Configuration.doAutoCreate())
3193              this.transform = new CanonicalType(); // bb
3194          return this.transform;
3195        }
3196
3197        public boolean hasTransformElement() { 
3198          return this.transform != null && !this.transform.isEmpty();
3199        }
3200
3201        public boolean hasTransform() { 
3202          return this.transform != null && !this.transform.isEmpty();
3203        }
3204
3205        /**
3206         * @param value {@link #transform} (A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.). This is the underlying object with id, value and extensions. The accessor "getTransform" gives direct access to the value
3207         */
3208        public PlanDefinitionActionComponent setTransformElement(CanonicalType value) { 
3209          this.transform = value;
3210          return this;
3211        }
3212
3213        /**
3214         * @return A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.
3215         */
3216        public String getTransform() { 
3217          return this.transform == null ? null : this.transform.getValue();
3218        }
3219
3220        /**
3221         * @param value A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.
3222         */
3223        public PlanDefinitionActionComponent setTransform(String value) { 
3224          if (Utilities.noString(value))
3225            this.transform = null;
3226          else {
3227            if (this.transform == null)
3228              this.transform = new CanonicalType();
3229            this.transform.setValue(value);
3230          }
3231          return this;
3232        }
3233
3234        /**
3235         * @return {@link #dynamicValue} (Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.)
3236         */
3237        public List<PlanDefinitionActionDynamicValueComponent> getDynamicValue() { 
3238          if (this.dynamicValue == null)
3239            this.dynamicValue = new ArrayList<PlanDefinitionActionDynamicValueComponent>();
3240          return this.dynamicValue;
3241        }
3242
3243        /**
3244         * @return Returns a reference to <code>this</code> for easy method chaining
3245         */
3246        public PlanDefinitionActionComponent setDynamicValue(List<PlanDefinitionActionDynamicValueComponent> theDynamicValue) { 
3247          this.dynamicValue = theDynamicValue;
3248          return this;
3249        }
3250
3251        public boolean hasDynamicValue() { 
3252          if (this.dynamicValue == null)
3253            return false;
3254          for (PlanDefinitionActionDynamicValueComponent item : this.dynamicValue)
3255            if (!item.isEmpty())
3256              return true;
3257          return false;
3258        }
3259
3260        public PlanDefinitionActionDynamicValueComponent addDynamicValue() { //3
3261          PlanDefinitionActionDynamicValueComponent t = new PlanDefinitionActionDynamicValueComponent();
3262          if (this.dynamicValue == null)
3263            this.dynamicValue = new ArrayList<PlanDefinitionActionDynamicValueComponent>();
3264          this.dynamicValue.add(t);
3265          return t;
3266        }
3267
3268        public PlanDefinitionActionComponent addDynamicValue(PlanDefinitionActionDynamicValueComponent t) { //3
3269          if (t == null)
3270            return this;
3271          if (this.dynamicValue == null)
3272            this.dynamicValue = new ArrayList<PlanDefinitionActionDynamicValueComponent>();
3273          this.dynamicValue.add(t);
3274          return this;
3275        }
3276
3277        /**
3278         * @return The first repetition of repeating field {@link #dynamicValue}, creating it if it does not already exist {3}
3279         */
3280        public PlanDefinitionActionDynamicValueComponent getDynamicValueFirstRep() { 
3281          if (getDynamicValue().isEmpty()) {
3282            addDynamicValue();
3283          }
3284          return getDynamicValue().get(0);
3285        }
3286
3287        /**
3288         * @return {@link #action} (Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.)
3289         */
3290        public List<PlanDefinitionActionComponent> getAction() { 
3291          if (this.action == null)
3292            this.action = new ArrayList<PlanDefinitionActionComponent>();
3293          return this.action;
3294        }
3295
3296        /**
3297         * @return Returns a reference to <code>this</code> for easy method chaining
3298         */
3299        public PlanDefinitionActionComponent setAction(List<PlanDefinitionActionComponent> theAction) { 
3300          this.action = theAction;
3301          return this;
3302        }
3303
3304        public boolean hasAction() { 
3305          if (this.action == null)
3306            return false;
3307          for (PlanDefinitionActionComponent item : this.action)
3308            if (!item.isEmpty())
3309              return true;
3310          return false;
3311        }
3312
3313        public PlanDefinitionActionComponent addAction() { //3
3314          PlanDefinitionActionComponent t = new PlanDefinitionActionComponent();
3315          if (this.action == null)
3316            this.action = new ArrayList<PlanDefinitionActionComponent>();
3317          this.action.add(t);
3318          return t;
3319        }
3320
3321        public PlanDefinitionActionComponent addAction(PlanDefinitionActionComponent t) { //3
3322          if (t == null)
3323            return this;
3324          if (this.action == null)
3325            this.action = new ArrayList<PlanDefinitionActionComponent>();
3326          this.action.add(t);
3327          return this;
3328        }
3329
3330        /**
3331         * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist {3}
3332         */
3333        public PlanDefinitionActionComponent getActionFirstRep() { 
3334          if (getAction().isEmpty()) {
3335            addAction();
3336          }
3337          return getAction().get(0);
3338        }
3339
3340        protected void listChildren(List<Property> children) {
3341          super.listChildren(children);
3342          children.add(new Property("linkId", "string", "An identifier that is unique within the PlanDefinition to allow linkage within the realized CarePlan and/or RequestOrchestration.", 0, 1, linkId));
3343          children.add(new Property("prefix", "string", "A user-visible prefix for the action. For example a section or item numbering such as 1. or A.", 0, 1, prefix));
3344          children.add(new Property("title", "string", "The textual description of the action displayed to a user. For example, when the action is a test to be performed, the title would be the title of the test such as Assay by HPLC.", 0, 1, title));
3345          children.add(new Property("description", "markdown", "A brief description of the action used to provide a summary to display to the user.", 0, 1, description));
3346          children.add(new Property("textEquivalent", "markdown", "A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.", 0, 1, textEquivalent));
3347          children.add(new Property("priority", "code", "Indicates how quickly the action should be addressed with respect to other actions.", 0, 1, priority));
3348          children.add(new Property("code", "CodeableConcept", "A code that provides a meaning, grouping, or classification for the action or action group. For example, a section may have a LOINC code for the section of a documentation template. In pharmaceutical quality, an action (Test) such as pH could be classified as a physical property.", 0, 1, code));
3349          children.add(new Property("reason", "CodeableConcept", "A description of why this action is necessary or appropriate.", 0, java.lang.Integer.MAX_VALUE, reason));
3350          children.add(new Property("documentation", "RelatedArtifact", "Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation));
3351          children.add(new Property("goalId", "id", "Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition. In pharmaceutical quality, a goal represents acceptance criteria (Goal) for a given action (Test), so the goalId would be the unique id of a defined goal element establishing the acceptance criteria for the action.", 0, java.lang.Integer.MAX_VALUE, goalId));
3352          children.add(new Property("subject[x]", "CodeableConcept|Reference(Group)|canonical", "A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject));
3353          children.add(new Property("trigger", "TriggerDefinition", "A description of when the action should be triggered. When multiple triggers are specified on an action, any triggering event invokes the action.", 0, java.lang.Integer.MAX_VALUE, trigger));
3354          children.add(new Property("condition", "", "An expression that describes applicability criteria or start/stop conditions for the action.", 0, java.lang.Integer.MAX_VALUE, condition));
3355          children.add(new Property("input", "", "Defines input data requirements for the action.", 0, java.lang.Integer.MAX_VALUE, input));
3356          children.add(new Property("output", "", "Defines the outputs of the action, if any.", 0, java.lang.Integer.MAX_VALUE, output));
3357          children.add(new Property("relatedAction", "", "A relationship to another action such as \"before\" or \"30-60 minutes after start of\".", 0, java.lang.Integer.MAX_VALUE, relatedAction));
3358          children.add(new Property("timing[x]", "Age|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing));
3359          children.add(new Property("location", "CodeableReference(Location)", "Identifies the facility where the action will occur; e.g. home, hospital, specific clinic, etc.", 0, 1, location));
3360          children.add(new Property("participant", "", "Indicates who should participate in performing the action described.", 0, java.lang.Integer.MAX_VALUE, participant));
3361          children.add(new Property("type", "CodeableConcept", "The type of action to perform (create, update, remove).", 0, 1, type));
3362          children.add(new Property("groupingBehavior", "code", "Defines the grouping behavior for the action and its children.", 0, 1, groupingBehavior));
3363          children.add(new Property("selectionBehavior", "code", "Defines the selection behavior for the action and its children.", 0, 1, selectionBehavior));
3364          children.add(new Property("requiredBehavior", "code", "Defines the required behavior for the action.", 0, 1, requiredBehavior));
3365          children.add(new Property("precheckBehavior", "code", "Defines whether the action should usually be preselected.", 0, 1, precheckBehavior));
3366          children.add(new Property("cardinalityBehavior", "code", "Defines whether the action can be selected multiple times.", 0, 1, cardinalityBehavior));
3367          children.add(new Property("definition[x]", "canonical(ActivityDefinition|MessageDefinition|ObservationDefinition|PlanDefinition|Questionnaire|SpecimenDefinition)|uri", "A reference to an ActivityDefinition that describes the action to be taken in detail, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.", 0, 1, definition));
3368          children.add(new Property("transform", "canonical(StructureMap)", "A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.", 0, 1, transform));
3369          children.add(new Property("dynamicValue", "", "Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.", 0, java.lang.Integer.MAX_VALUE, dynamicValue));
3370          children.add(new Property("action", "@PlanDefinition.action", "Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.", 0, java.lang.Integer.MAX_VALUE, action));
3371        }
3372
3373        @Override
3374        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3375          switch (_hash) {
3376          case -1102667083: /*linkId*/  return new Property("linkId", "string", "An identifier that is unique within the PlanDefinition to allow linkage within the realized CarePlan and/or RequestOrchestration.", 0, 1, linkId);
3377          case -980110702: /*prefix*/  return new Property("prefix", "string", "A user-visible prefix for the action. For example a section or item numbering such as 1. or A.", 0, 1, prefix);
3378          case 110371416: /*title*/  return new Property("title", "string", "The textual description of the action displayed to a user. For example, when the action is a test to be performed, the title would be the title of the test such as Assay by HPLC.", 0, 1, title);
3379          case -1724546052: /*description*/  return new Property("description", "markdown", "A brief description of the action used to provide a summary to display to the user.", 0, 1, description);
3380          case -900391049: /*textEquivalent*/  return new Property("textEquivalent", "markdown", "A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that might not be capable of interpreting it dynamically.", 0, 1, textEquivalent);
3381          case -1165461084: /*priority*/  return new Property("priority", "code", "Indicates how quickly the action should be addressed with respect to other actions.", 0, 1, priority);
3382          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "A code that provides a meaning, grouping, or classification for the action or action group. For example, a section may have a LOINC code for the section of a documentation template. In pharmaceutical quality, an action (Test) such as pH could be classified as a physical property.", 0, 1, code);
3383          case -934964668: /*reason*/  return new Property("reason", "CodeableConcept", "A description of why this action is necessary or appropriate.", 0, java.lang.Integer.MAX_VALUE, reason);
3384          case 1587405498: /*documentation*/  return new Property("documentation", "RelatedArtifact", "Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation);
3385          case -1240658034: /*goalId*/  return new Property("goalId", "id", "Identifies goals that this action supports. The reference must be to a goal element defined within this plan definition. In pharmaceutical quality, a goal represents acceptance criteria (Goal) for a given action (Test), so the goalId would be the unique id of a defined goal element establishing the acceptance criteria for the action.", 0, java.lang.Integer.MAX_VALUE, goalId);
3386          case -573640748: /*subject[x]*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)|canonical", "A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject);
3387          case -1867885268: /*subject*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)|canonical", "A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject);
3388          case -1257122603: /*subjectCodeableConcept*/  return new Property("subject[x]", "CodeableConcept", "A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject);
3389          case 772938623: /*subjectReference*/  return new Property("subject[x]", "Reference(Group)", "A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject);
3390          case -1768521432: /*subjectCanonical*/  return new Property("subject[x]", "canonical", "A code, group definition, or canonical reference that describes the intended subject of the action and its children, if any. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject);
3391          case -1059891784: /*trigger*/  return new Property("trigger", "TriggerDefinition", "A description of when the action should be triggered. When multiple triggers are specified on an action, any triggering event invokes the action.", 0, java.lang.Integer.MAX_VALUE, trigger);
3392          case -861311717: /*condition*/  return new Property("condition", "", "An expression that describes applicability criteria or start/stop conditions for the action.", 0, java.lang.Integer.MAX_VALUE, condition);
3393          case 100358090: /*input*/  return new Property("input", "", "Defines input data requirements for the action.", 0, java.lang.Integer.MAX_VALUE, input);
3394          case -1005512447: /*output*/  return new Property("output", "", "Defines the outputs of the action, if any.", 0, java.lang.Integer.MAX_VALUE, output);
3395          case -384107967: /*relatedAction*/  return new Property("relatedAction", "", "A relationship to another action such as \"before\" or \"30-60 minutes after start of\".", 0, java.lang.Integer.MAX_VALUE, relatedAction);
3396          case 164632566: /*timing[x]*/  return new Property("timing[x]", "Age|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
3397          case -873664438: /*timing*/  return new Property("timing[x]", "Age|Duration|Range|Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
3398          case 164607061: /*timingAge*/  return new Property("timing[x]", "Age", "An optional value describing when the action should be performed.", 0, 1, timing);
3399          case -1327253506: /*timingDuration*/  return new Property("timing[x]", "Duration", "An optional value describing when the action should be performed.", 0, 1, timing);
3400          case -710871277: /*timingRange*/  return new Property("timing[x]", "Range", "An optional value describing when the action should be performed.", 0, 1, timing);
3401          case -497554124: /*timingTiming*/  return new Property("timing[x]", "Timing", "An optional value describing when the action should be performed.", 0, 1, timing);
3402          case 1901043637: /*location*/  return new Property("location", "CodeableReference(Location)", "Identifies the facility where the action will occur; e.g. home, hospital, specific clinic, etc.", 0, 1, location);
3403          case 767422259: /*participant*/  return new Property("participant", "", "Indicates who should participate in performing the action described.", 0, java.lang.Integer.MAX_VALUE, participant);
3404          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of action to perform (create, update, remove).", 0, 1, type);
3405          case 586678389: /*groupingBehavior*/  return new Property("groupingBehavior", "code", "Defines the grouping behavior for the action and its children.", 0, 1, groupingBehavior);
3406          case 168639486: /*selectionBehavior*/  return new Property("selectionBehavior", "code", "Defines the selection behavior for the action and its children.", 0, 1, selectionBehavior);
3407          case -1163906287: /*requiredBehavior*/  return new Property("requiredBehavior", "code", "Defines the required behavior for the action.", 0, 1, requiredBehavior);
3408          case -1174249033: /*precheckBehavior*/  return new Property("precheckBehavior", "code", "Defines whether the action should usually be preselected.", 0, 1, precheckBehavior);
3409          case -922577408: /*cardinalityBehavior*/  return new Property("cardinalityBehavior", "code", "Defines whether the action can be selected multiple times.", 0, 1, cardinalityBehavior);
3410          case -1139422643: /*definition[x]*/  return new Property("definition[x]", "canonical(ActivityDefinition|MessageDefinition|ObservationDefinition|PlanDefinition|Questionnaire|SpecimenDefinition)|uri", "A reference to an ActivityDefinition that describes the action to be taken in detail, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.", 0, 1, definition);
3411          case -1014418093: /*definition*/  return new Property("definition[x]", "canonical(ActivityDefinition|MessageDefinition|ObservationDefinition|PlanDefinition|Questionnaire|SpecimenDefinition)|uri", "A reference to an ActivityDefinition that describes the action to be taken in detail, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.", 0, 1, definition);
3412          case 933485793: /*definitionCanonical*/  return new Property("definition[x]", "canonical(ActivityDefinition|MessageDefinition|ObservationDefinition|PlanDefinition|Questionnaire|SpecimenDefinition)", "A reference to an ActivityDefinition that describes the action to be taken in detail, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.", 0, 1, definition);
3413          case -1139428583: /*definitionUri*/  return new Property("definition[x]", "uri", "A reference to an ActivityDefinition that describes the action to be taken in detail, a MessageDefinition describing a message to be snet, a PlanDefinition that describes a series of actions to be taken, a Questionnaire that should be filled out, a SpecimenDefinition describing a specimen to be collected, or an ObservationDefinition that specifies what observation should be captured.", 0, 1, definition);
3414          case 1052666732: /*transform*/  return new Property("transform", "canonical(StructureMap)", "A reference to a StructureMap resource that defines a transform that can be executed to produce the intent resource using the ActivityDefinition instance as the input.", 0, 1, transform);
3415          case 572625010: /*dynamicValue*/  return new Property("dynamicValue", "", "Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.", 0, java.lang.Integer.MAX_VALUE, dynamicValue);
3416          case -1422950858: /*action*/  return new Property("action", "@PlanDefinition.action", "Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.", 0, java.lang.Integer.MAX_VALUE, action);
3417          default: return super.getNamedProperty(_hash, _name, _checkValid);
3418          }
3419
3420        }
3421
3422      @Override
3423      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3424        switch (hash) {
3425        case -1102667083: /*linkId*/ return this.linkId == null ? new Base[0] : new Base[] {this.linkId}; // StringType
3426        case -980110702: /*prefix*/ return this.prefix == null ? new Base[0] : new Base[] {this.prefix}; // StringType
3427        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
3428        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
3429        case -900391049: /*textEquivalent*/ return this.textEquivalent == null ? new Base[0] : new Base[] {this.textEquivalent}; // MarkdownType
3430        case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration<RequestPriority>
3431        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
3432        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : this.reason.toArray(new Base[this.reason.size()]); // CodeableConcept
3433        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : this.documentation.toArray(new Base[this.documentation.size()]); // RelatedArtifact
3434        case -1240658034: /*goalId*/ return this.goalId == null ? new Base[0] : this.goalId.toArray(new Base[this.goalId.size()]); // IdType
3435        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // DataType
3436        case -1059891784: /*trigger*/ return this.trigger == null ? new Base[0] : this.trigger.toArray(new Base[this.trigger.size()]); // TriggerDefinition
3437        case -861311717: /*condition*/ return this.condition == null ? new Base[0] : this.condition.toArray(new Base[this.condition.size()]); // PlanDefinitionActionConditionComponent
3438        case 100358090: /*input*/ return this.input == null ? new Base[0] : this.input.toArray(new Base[this.input.size()]); // PlanDefinitionActionInputComponent
3439        case -1005512447: /*output*/ return this.output == null ? new Base[0] : this.output.toArray(new Base[this.output.size()]); // PlanDefinitionActionOutputComponent
3440        case -384107967: /*relatedAction*/ return this.relatedAction == null ? new Base[0] : this.relatedAction.toArray(new Base[this.relatedAction.size()]); // PlanDefinitionActionRelatedActionComponent
3441        case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // DataType
3442        case 1901043637: /*location*/ return this.location == null ? new Base[0] : new Base[] {this.location}; // CodeableReference
3443        case 767422259: /*participant*/ return this.participant == null ? new Base[0] : this.participant.toArray(new Base[this.participant.size()]); // PlanDefinitionActionParticipantComponent
3444        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3445        case 586678389: /*groupingBehavior*/ return this.groupingBehavior == null ? new Base[0] : new Base[] {this.groupingBehavior}; // Enumeration<ActionGroupingBehavior>
3446        case 168639486: /*selectionBehavior*/ return this.selectionBehavior == null ? new Base[0] : new Base[] {this.selectionBehavior}; // Enumeration<ActionSelectionBehavior>
3447        case -1163906287: /*requiredBehavior*/ return this.requiredBehavior == null ? new Base[0] : new Base[] {this.requiredBehavior}; // Enumeration<ActionRequiredBehavior>
3448        case -1174249033: /*precheckBehavior*/ return this.precheckBehavior == null ? new Base[0] : new Base[] {this.precheckBehavior}; // Enumeration<ActionPrecheckBehavior>
3449        case -922577408: /*cardinalityBehavior*/ return this.cardinalityBehavior == null ? new Base[0] : new Base[] {this.cardinalityBehavior}; // Enumeration<ActionCardinalityBehavior>
3450        case -1014418093: /*definition*/ return this.definition == null ? new Base[0] : new Base[] {this.definition}; // DataType
3451        case 1052666732: /*transform*/ return this.transform == null ? new Base[0] : new Base[] {this.transform}; // CanonicalType
3452        case 572625010: /*dynamicValue*/ return this.dynamicValue == null ? new Base[0] : this.dynamicValue.toArray(new Base[this.dynamicValue.size()]); // PlanDefinitionActionDynamicValueComponent
3453        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // PlanDefinitionActionComponent
3454        default: return super.getProperty(hash, name, checkValid);
3455        }
3456
3457      }
3458
3459      @Override
3460      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3461        switch (hash) {
3462        case -1102667083: // linkId
3463          this.linkId = TypeConvertor.castToString(value); // StringType
3464          return value;
3465        case -980110702: // prefix
3466          this.prefix = TypeConvertor.castToString(value); // StringType
3467          return value;
3468        case 110371416: // title
3469          this.title = TypeConvertor.castToString(value); // StringType
3470          return value;
3471        case -1724546052: // description
3472          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
3473          return value;
3474        case -900391049: // textEquivalent
3475          this.textEquivalent = TypeConvertor.castToMarkdown(value); // MarkdownType
3476          return value;
3477        case -1165461084: // priority
3478          value = new RequestPriorityEnumFactory().fromType(TypeConvertor.castToCode(value));
3479          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
3480          return value;
3481        case 3059181: // code
3482          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3483          return value;
3484        case -934964668: // reason
3485          this.getReason().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3486          return value;
3487        case 1587405498: // documentation
3488          this.getDocumentation().add(TypeConvertor.castToRelatedArtifact(value)); // RelatedArtifact
3489          return value;
3490        case -1240658034: // goalId
3491          this.getGoalId().add(TypeConvertor.castToId(value)); // IdType
3492          return value;
3493        case -1867885268: // subject
3494          this.subject = TypeConvertor.castToType(value); // DataType
3495          return value;
3496        case -1059891784: // trigger
3497          this.getTrigger().add(TypeConvertor.castToTriggerDefinition(value)); // TriggerDefinition
3498          return value;
3499        case -861311717: // condition
3500          this.getCondition().add((PlanDefinitionActionConditionComponent) value); // PlanDefinitionActionConditionComponent
3501          return value;
3502        case 100358090: // input
3503          this.getInput().add((PlanDefinitionActionInputComponent) value); // PlanDefinitionActionInputComponent
3504          return value;
3505        case -1005512447: // output
3506          this.getOutput().add((PlanDefinitionActionOutputComponent) value); // PlanDefinitionActionOutputComponent
3507          return value;
3508        case -384107967: // relatedAction
3509          this.getRelatedAction().add((PlanDefinitionActionRelatedActionComponent) value); // PlanDefinitionActionRelatedActionComponent
3510          return value;
3511        case -873664438: // timing
3512          this.timing = TypeConvertor.castToType(value); // DataType
3513          return value;
3514        case 1901043637: // location
3515          this.location = TypeConvertor.castToCodeableReference(value); // CodeableReference
3516          return value;
3517        case 767422259: // participant
3518          this.getParticipant().add((PlanDefinitionActionParticipantComponent) value); // PlanDefinitionActionParticipantComponent
3519          return value;
3520        case 3575610: // type
3521          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3522          return value;
3523        case 586678389: // groupingBehavior
3524          value = new ActionGroupingBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
3525          this.groupingBehavior = (Enumeration) value; // Enumeration<ActionGroupingBehavior>
3526          return value;
3527        case 168639486: // selectionBehavior
3528          value = new ActionSelectionBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
3529          this.selectionBehavior = (Enumeration) value; // Enumeration<ActionSelectionBehavior>
3530          return value;
3531        case -1163906287: // requiredBehavior
3532          value = new ActionRequiredBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
3533          this.requiredBehavior = (Enumeration) value; // Enumeration<ActionRequiredBehavior>
3534          return value;
3535        case -1174249033: // precheckBehavior
3536          value = new ActionPrecheckBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
3537          this.precheckBehavior = (Enumeration) value; // Enumeration<ActionPrecheckBehavior>
3538          return value;
3539        case -922577408: // cardinalityBehavior
3540          value = new ActionCardinalityBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
3541          this.cardinalityBehavior = (Enumeration) value; // Enumeration<ActionCardinalityBehavior>
3542          return value;
3543        case -1014418093: // definition
3544          this.definition = TypeConvertor.castToType(value); // DataType
3545          return value;
3546        case 1052666732: // transform
3547          this.transform = TypeConvertor.castToCanonical(value); // CanonicalType
3548          return value;
3549        case 572625010: // dynamicValue
3550          this.getDynamicValue().add((PlanDefinitionActionDynamicValueComponent) value); // PlanDefinitionActionDynamicValueComponent
3551          return value;
3552        case -1422950858: // action
3553          this.getAction().add((PlanDefinitionActionComponent) value); // PlanDefinitionActionComponent
3554          return value;
3555        default: return super.setProperty(hash, name, value);
3556        }
3557
3558      }
3559
3560      @Override
3561      public Base setProperty(String name, Base value) throws FHIRException {
3562        if (name.equals("linkId")) {
3563          this.linkId = TypeConvertor.castToString(value); // StringType
3564        } else if (name.equals("prefix")) {
3565          this.prefix = TypeConvertor.castToString(value); // StringType
3566        } else if (name.equals("title")) {
3567          this.title = TypeConvertor.castToString(value); // StringType
3568        } else if (name.equals("description")) {
3569          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
3570        } else if (name.equals("textEquivalent")) {
3571          this.textEquivalent = TypeConvertor.castToMarkdown(value); // MarkdownType
3572        } else if (name.equals("priority")) {
3573          value = new RequestPriorityEnumFactory().fromType(TypeConvertor.castToCode(value));
3574          this.priority = (Enumeration) value; // Enumeration<RequestPriority>
3575        } else if (name.equals("code")) {
3576          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3577        } else if (name.equals("reason")) {
3578          this.getReason().add(TypeConvertor.castToCodeableConcept(value));
3579        } else if (name.equals("documentation")) {
3580          this.getDocumentation().add(TypeConvertor.castToRelatedArtifact(value));
3581        } else if (name.equals("goalId")) {
3582          this.getGoalId().add(TypeConvertor.castToId(value));
3583        } else if (name.equals("subject[x]")) {
3584          this.subject = TypeConvertor.castToType(value); // DataType
3585        } else if (name.equals("trigger")) {
3586          this.getTrigger().add(TypeConvertor.castToTriggerDefinition(value));
3587        } else if (name.equals("condition")) {
3588          this.getCondition().add((PlanDefinitionActionConditionComponent) value);
3589        } else if (name.equals("input")) {
3590          this.getInput().add((PlanDefinitionActionInputComponent) value);
3591        } else if (name.equals("output")) {
3592          this.getOutput().add((PlanDefinitionActionOutputComponent) value);
3593        } else if (name.equals("relatedAction")) {
3594          this.getRelatedAction().add((PlanDefinitionActionRelatedActionComponent) value);
3595        } else if (name.equals("timing[x]")) {
3596          this.timing = TypeConvertor.castToType(value); // DataType
3597        } else if (name.equals("location")) {
3598          this.location = TypeConvertor.castToCodeableReference(value); // CodeableReference
3599        } else if (name.equals("participant")) {
3600          this.getParticipant().add((PlanDefinitionActionParticipantComponent) value);
3601        } else if (name.equals("type")) {
3602          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3603        } else if (name.equals("groupingBehavior")) {
3604          value = new ActionGroupingBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
3605          this.groupingBehavior = (Enumeration) value; // Enumeration<ActionGroupingBehavior>
3606        } else if (name.equals("selectionBehavior")) {
3607          value = new ActionSelectionBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
3608          this.selectionBehavior = (Enumeration) value; // Enumeration<ActionSelectionBehavior>
3609        } else if (name.equals("requiredBehavior")) {
3610          value = new ActionRequiredBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
3611          this.requiredBehavior = (Enumeration) value; // Enumeration<ActionRequiredBehavior>
3612        } else if (name.equals("precheckBehavior")) {
3613          value = new ActionPrecheckBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
3614          this.precheckBehavior = (Enumeration) value; // Enumeration<ActionPrecheckBehavior>
3615        } else if (name.equals("cardinalityBehavior")) {
3616          value = new ActionCardinalityBehaviorEnumFactory().fromType(TypeConvertor.castToCode(value));
3617          this.cardinalityBehavior = (Enumeration) value; // Enumeration<ActionCardinalityBehavior>
3618        } else if (name.equals("definition[x]")) {
3619          this.definition = TypeConvertor.castToType(value); // DataType
3620        } else if (name.equals("transform")) {
3621          this.transform = TypeConvertor.castToCanonical(value); // CanonicalType
3622        } else if (name.equals("dynamicValue")) {
3623          this.getDynamicValue().add((PlanDefinitionActionDynamicValueComponent) value);
3624        } else if (name.equals("action")) {
3625          this.getAction().add((PlanDefinitionActionComponent) value);
3626        } else
3627          return super.setProperty(name, value);
3628        return value;
3629      }
3630
3631      @Override
3632      public Base makeProperty(int hash, String name) throws FHIRException {
3633        switch (hash) {
3634        case -1102667083:  return getLinkIdElement();
3635        case -980110702:  return getPrefixElement();
3636        case 110371416:  return getTitleElement();
3637        case -1724546052:  return getDescriptionElement();
3638        case -900391049:  return getTextEquivalentElement();
3639        case -1165461084:  return getPriorityElement();
3640        case 3059181:  return getCode();
3641        case -934964668:  return addReason(); 
3642        case 1587405498:  return addDocumentation(); 
3643        case -1240658034:  return addGoalIdElement();
3644        case -573640748:  return getSubject();
3645        case -1867885268:  return getSubject();
3646        case -1059891784:  return addTrigger(); 
3647        case -861311717:  return addCondition(); 
3648        case 100358090:  return addInput(); 
3649        case -1005512447:  return addOutput(); 
3650        case -384107967:  return addRelatedAction(); 
3651        case 164632566:  return getTiming();
3652        case -873664438:  return getTiming();
3653        case 1901043637:  return getLocation();
3654        case 767422259:  return addParticipant(); 
3655        case 3575610:  return getType();
3656        case 586678389:  return getGroupingBehaviorElement();
3657        case 168639486:  return getSelectionBehaviorElement();
3658        case -1163906287:  return getRequiredBehaviorElement();
3659        case -1174249033:  return getPrecheckBehaviorElement();
3660        case -922577408:  return getCardinalityBehaviorElement();
3661        case -1139422643:  return getDefinition();
3662        case -1014418093:  return getDefinition();
3663        case 1052666732:  return getTransformElement();
3664        case 572625010:  return addDynamicValue(); 
3665        case -1422950858:  return addAction(); 
3666        default: return super.makeProperty(hash, name);
3667        }
3668
3669      }
3670
3671      @Override
3672      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3673        switch (hash) {
3674        case -1102667083: /*linkId*/ return new String[] {"string"};
3675        case -980110702: /*prefix*/ return new String[] {"string"};
3676        case 110371416: /*title*/ return new String[] {"string"};
3677        case -1724546052: /*description*/ return new String[] {"markdown"};
3678        case -900391049: /*textEquivalent*/ return new String[] {"markdown"};
3679        case -1165461084: /*priority*/ return new String[] {"code"};
3680        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
3681        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
3682        case 1587405498: /*documentation*/ return new String[] {"RelatedArtifact"};
3683        case -1240658034: /*goalId*/ return new String[] {"id"};
3684        case -1867885268: /*subject*/ return new String[] {"CodeableConcept", "Reference", "canonical"};
3685        case -1059891784: /*trigger*/ return new String[] {"TriggerDefinition"};
3686        case -861311717: /*condition*/ return new String[] {};
3687        case 100358090: /*input*/ return new String[] {};
3688        case -1005512447: /*output*/ return new String[] {};
3689        case -384107967: /*relatedAction*/ return new String[] {};
3690        case -873664438: /*timing*/ return new String[] {"Age", "Duration", "Range", "Timing"};
3691        case 1901043637: /*location*/ return new String[] {"CodeableReference"};
3692        case 767422259: /*participant*/ return new String[] {};
3693        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3694        case 586678389: /*groupingBehavior*/ return new String[] {"code"};
3695        case 168639486: /*selectionBehavior*/ return new String[] {"code"};
3696        case -1163906287: /*requiredBehavior*/ return new String[] {"code"};
3697        case -1174249033: /*precheckBehavior*/ return new String[] {"code"};
3698        case -922577408: /*cardinalityBehavior*/ return new String[] {"code"};
3699        case -1014418093: /*definition*/ return new String[] {"canonical", "uri"};
3700        case 1052666732: /*transform*/ return new String[] {"canonical"};
3701        case 572625010: /*dynamicValue*/ return new String[] {};
3702        case -1422950858: /*action*/ return new String[] {"@PlanDefinition.action"};
3703        default: return super.getTypesForProperty(hash, name);
3704        }
3705
3706      }
3707
3708      @Override
3709      public Base addChild(String name) throws FHIRException {
3710        if (name.equals("linkId")) {
3711          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.linkId");
3712        }
3713        else if (name.equals("prefix")) {
3714          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.prefix");
3715        }
3716        else if (name.equals("title")) {
3717          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.title");
3718        }
3719        else if (name.equals("description")) {
3720          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.description");
3721        }
3722        else if (name.equals("textEquivalent")) {
3723          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.textEquivalent");
3724        }
3725        else if (name.equals("priority")) {
3726          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.priority");
3727        }
3728        else if (name.equals("code")) {
3729          this.code = new CodeableConcept();
3730          return this.code;
3731        }
3732        else if (name.equals("reason")) {
3733          return addReason();
3734        }
3735        else if (name.equals("documentation")) {
3736          return addDocumentation();
3737        }
3738        else if (name.equals("goalId")) {
3739          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.goalId");
3740        }
3741        else if (name.equals("subjectCodeableConcept")) {
3742          this.subject = new CodeableConcept();
3743          return this.subject;
3744        }
3745        else if (name.equals("subjectReference")) {
3746          this.subject = new Reference();
3747          return this.subject;
3748        }
3749        else if (name.equals("subjectCanonical")) {
3750          this.subject = new CanonicalType();
3751          return this.subject;
3752        }
3753        else if (name.equals("trigger")) {
3754          return addTrigger();
3755        }
3756        else if (name.equals("condition")) {
3757          return addCondition();
3758        }
3759        else if (name.equals("input")) {
3760          return addInput();
3761        }
3762        else if (name.equals("output")) {
3763          return addOutput();
3764        }
3765        else if (name.equals("relatedAction")) {
3766          return addRelatedAction();
3767        }
3768        else if (name.equals("timingAge")) {
3769          this.timing = new Age();
3770          return this.timing;
3771        }
3772        else if (name.equals("timingDuration")) {
3773          this.timing = new Duration();
3774          return this.timing;
3775        }
3776        else if (name.equals("timingRange")) {
3777          this.timing = new Range();
3778          return this.timing;
3779        }
3780        else if (name.equals("timingTiming")) {
3781          this.timing = new Timing();
3782          return this.timing;
3783        }
3784        else if (name.equals("location")) {
3785          this.location = new CodeableReference();
3786          return this.location;
3787        }
3788        else if (name.equals("participant")) {
3789          return addParticipant();
3790        }
3791        else if (name.equals("type")) {
3792          this.type = new CodeableConcept();
3793          return this.type;
3794        }
3795        else if (name.equals("groupingBehavior")) {
3796          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.groupingBehavior");
3797        }
3798        else if (name.equals("selectionBehavior")) {
3799          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.selectionBehavior");
3800        }
3801        else if (name.equals("requiredBehavior")) {
3802          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.requiredBehavior");
3803        }
3804        else if (name.equals("precheckBehavior")) {
3805          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.precheckBehavior");
3806        }
3807        else if (name.equals("cardinalityBehavior")) {
3808          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.cardinalityBehavior");
3809        }
3810        else if (name.equals("definitionCanonical")) {
3811          this.definition = new CanonicalType();
3812          return this.definition;
3813        }
3814        else if (name.equals("definitionUri")) {
3815          this.definition = new UriType();
3816          return this.definition;
3817        }
3818        else if (name.equals("transform")) {
3819          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.transform");
3820        }
3821        else if (name.equals("dynamicValue")) {
3822          return addDynamicValue();
3823        }
3824        else if (name.equals("action")) {
3825          return addAction();
3826        }
3827        else
3828          return super.addChild(name);
3829      }
3830
3831      public PlanDefinitionActionComponent copy() {
3832        PlanDefinitionActionComponent dst = new PlanDefinitionActionComponent();
3833        copyValues(dst);
3834        return dst;
3835      }
3836
3837      public void copyValues(PlanDefinitionActionComponent dst) {
3838        super.copyValues(dst);
3839        dst.linkId = linkId == null ? null : linkId.copy();
3840        dst.prefix = prefix == null ? null : prefix.copy();
3841        dst.title = title == null ? null : title.copy();
3842        dst.description = description == null ? null : description.copy();
3843        dst.textEquivalent = textEquivalent == null ? null : textEquivalent.copy();
3844        dst.priority = priority == null ? null : priority.copy();
3845        dst.code = code == null ? null : code.copy();
3846        if (reason != null) {
3847          dst.reason = new ArrayList<CodeableConcept>();
3848          for (CodeableConcept i : reason)
3849            dst.reason.add(i.copy());
3850        };
3851        if (documentation != null) {
3852          dst.documentation = new ArrayList<RelatedArtifact>();
3853          for (RelatedArtifact i : documentation)
3854            dst.documentation.add(i.copy());
3855        };
3856        if (goalId != null) {
3857          dst.goalId = new ArrayList<IdType>();
3858          for (IdType i : goalId)
3859            dst.goalId.add(i.copy());
3860        };
3861        dst.subject = subject == null ? null : subject.copy();
3862        if (trigger != null) {
3863          dst.trigger = new ArrayList<TriggerDefinition>();
3864          for (TriggerDefinition i : trigger)
3865            dst.trigger.add(i.copy());
3866        };
3867        if (condition != null) {
3868          dst.condition = new ArrayList<PlanDefinitionActionConditionComponent>();
3869          for (PlanDefinitionActionConditionComponent i : condition)
3870            dst.condition.add(i.copy());
3871        };
3872        if (input != null) {
3873          dst.input = new ArrayList<PlanDefinitionActionInputComponent>();
3874          for (PlanDefinitionActionInputComponent i : input)
3875            dst.input.add(i.copy());
3876        };
3877        if (output != null) {
3878          dst.output = new ArrayList<PlanDefinitionActionOutputComponent>();
3879          for (PlanDefinitionActionOutputComponent i : output)
3880            dst.output.add(i.copy());
3881        };
3882        if (relatedAction != null) {
3883          dst.relatedAction = new ArrayList<PlanDefinitionActionRelatedActionComponent>();
3884          for (PlanDefinitionActionRelatedActionComponent i : relatedAction)
3885            dst.relatedAction.add(i.copy());
3886        };
3887        dst.timing = timing == null ? null : timing.copy();
3888        dst.location = location == null ? null : location.copy();
3889        if (participant != null) {
3890          dst.participant = new ArrayList<PlanDefinitionActionParticipantComponent>();
3891          for (PlanDefinitionActionParticipantComponent i : participant)
3892            dst.participant.add(i.copy());
3893        };
3894        dst.type = type == null ? null : type.copy();
3895        dst.groupingBehavior = groupingBehavior == null ? null : groupingBehavior.copy();
3896        dst.selectionBehavior = selectionBehavior == null ? null : selectionBehavior.copy();
3897        dst.requiredBehavior = requiredBehavior == null ? null : requiredBehavior.copy();
3898        dst.precheckBehavior = precheckBehavior == null ? null : precheckBehavior.copy();
3899        dst.cardinalityBehavior = cardinalityBehavior == null ? null : cardinalityBehavior.copy();
3900        dst.definition = definition == null ? null : definition.copy();
3901        dst.transform = transform == null ? null : transform.copy();
3902        if (dynamicValue != null) {
3903          dst.dynamicValue = new ArrayList<PlanDefinitionActionDynamicValueComponent>();
3904          for (PlanDefinitionActionDynamicValueComponent i : dynamicValue)
3905            dst.dynamicValue.add(i.copy());
3906        };
3907        if (action != null) {
3908          dst.action = new ArrayList<PlanDefinitionActionComponent>();
3909          for (PlanDefinitionActionComponent i : action)
3910            dst.action.add(i.copy());
3911        };
3912      }
3913
3914      @Override
3915      public boolean equalsDeep(Base other_) {
3916        if (!super.equalsDeep(other_))
3917          return false;
3918        if (!(other_ instanceof PlanDefinitionActionComponent))
3919          return false;
3920        PlanDefinitionActionComponent o = (PlanDefinitionActionComponent) other_;
3921        return compareDeep(linkId, o.linkId, true) && compareDeep(prefix, o.prefix, true) && compareDeep(title, o.title, true)
3922           && compareDeep(description, o.description, true) && compareDeep(textEquivalent, o.textEquivalent, true)
3923           && compareDeep(priority, o.priority, true) && compareDeep(code, o.code, true) && compareDeep(reason, o.reason, true)
3924           && compareDeep(documentation, o.documentation, true) && compareDeep(goalId, o.goalId, true) && compareDeep(subject, o.subject, true)
3925           && compareDeep(trigger, o.trigger, true) && compareDeep(condition, o.condition, true) && compareDeep(input, o.input, true)
3926           && compareDeep(output, o.output, true) && compareDeep(relatedAction, o.relatedAction, true) && compareDeep(timing, o.timing, true)
3927           && compareDeep(location, o.location, true) && compareDeep(participant, o.participant, true) && compareDeep(type, o.type, true)
3928           && compareDeep(groupingBehavior, o.groupingBehavior, true) && compareDeep(selectionBehavior, o.selectionBehavior, true)
3929           && compareDeep(requiredBehavior, o.requiredBehavior, true) && compareDeep(precheckBehavior, o.precheckBehavior, true)
3930           && compareDeep(cardinalityBehavior, o.cardinalityBehavior, true) && compareDeep(definition, o.definition, true)
3931           && compareDeep(transform, o.transform, true) && compareDeep(dynamicValue, o.dynamicValue, true)
3932           && compareDeep(action, o.action, true);
3933      }
3934
3935      @Override
3936      public boolean equalsShallow(Base other_) {
3937        if (!super.equalsShallow(other_))
3938          return false;
3939        if (!(other_ instanceof PlanDefinitionActionComponent))
3940          return false;
3941        PlanDefinitionActionComponent o = (PlanDefinitionActionComponent) other_;
3942        return compareValues(linkId, o.linkId, true) && compareValues(prefix, o.prefix, true) && compareValues(title, o.title, true)
3943           && compareValues(description, o.description, true) && compareValues(textEquivalent, o.textEquivalent, true)
3944           && compareValues(priority, o.priority, true) && compareValues(goalId, o.goalId, true) && compareValues(groupingBehavior, o.groupingBehavior, true)
3945           && compareValues(selectionBehavior, o.selectionBehavior, true) && compareValues(requiredBehavior, o.requiredBehavior, true)
3946           && compareValues(precheckBehavior, o.precheckBehavior, true) && compareValues(cardinalityBehavior, o.cardinalityBehavior, true)
3947           && compareValues(transform, o.transform, true);
3948      }
3949
3950      public boolean isEmpty() {
3951        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(linkId, prefix, title, description
3952          , textEquivalent, priority, code, reason, documentation, goalId, subject, trigger
3953          , condition, input, output, relatedAction, timing, location, participant, type
3954          , groupingBehavior, selectionBehavior, requiredBehavior, precheckBehavior, cardinalityBehavior
3955          , definition, transform, dynamicValue, action);
3956      }
3957
3958  public String fhirType() {
3959    return "PlanDefinition.action";
3960
3961  }
3962
3963  }
3964
3965    @Block()
3966    public static class PlanDefinitionActionConditionComponent extends BackboneElement implements IBaseBackboneElement {
3967        /**
3968         * The kind of condition.
3969         */
3970        @Child(name = "kind", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3971        @Description(shortDefinition="applicability | start | stop", formalDefinition="The kind of condition." )
3972        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-condition-kind")
3973        protected Enumeration<ActionConditionKind> kind;
3974
3975        /**
3976         * An expression that returns true or false, indicating whether the condition is satisfied.
3977         */
3978        @Child(name = "expression", type = {Expression.class}, order=2, min=0, max=1, modifier=false, summary=false)
3979        @Description(shortDefinition="Boolean-valued expression", formalDefinition="An expression that returns true or false, indicating whether the condition is satisfied." )
3980        protected Expression expression;
3981
3982        private static final long serialVersionUID = -455150438L;
3983
3984    /**
3985     * Constructor
3986     */
3987      public PlanDefinitionActionConditionComponent() {
3988        super();
3989      }
3990
3991    /**
3992     * Constructor
3993     */
3994      public PlanDefinitionActionConditionComponent(ActionConditionKind kind) {
3995        super();
3996        this.setKind(kind);
3997      }
3998
3999        /**
4000         * @return {@link #kind} (The kind of condition.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
4001         */
4002        public Enumeration<ActionConditionKind> getKindElement() { 
4003          if (this.kind == null)
4004            if (Configuration.errorOnAutoCreate())
4005              throw new Error("Attempt to auto-create PlanDefinitionActionConditionComponent.kind");
4006            else if (Configuration.doAutoCreate())
4007              this.kind = new Enumeration<ActionConditionKind>(new ActionConditionKindEnumFactory()); // bb
4008          return this.kind;
4009        }
4010
4011        public boolean hasKindElement() { 
4012          return this.kind != null && !this.kind.isEmpty();
4013        }
4014
4015        public boolean hasKind() { 
4016          return this.kind != null && !this.kind.isEmpty();
4017        }
4018
4019        /**
4020         * @param value {@link #kind} (The kind of condition.). This is the underlying object with id, value and extensions. The accessor "getKind" gives direct access to the value
4021         */
4022        public PlanDefinitionActionConditionComponent setKindElement(Enumeration<ActionConditionKind> value) { 
4023          this.kind = value;
4024          return this;
4025        }
4026
4027        /**
4028         * @return The kind of condition.
4029         */
4030        public ActionConditionKind getKind() { 
4031          return this.kind == null ? null : this.kind.getValue();
4032        }
4033
4034        /**
4035         * @param value The kind of condition.
4036         */
4037        public PlanDefinitionActionConditionComponent setKind(ActionConditionKind value) { 
4038            if (this.kind == null)
4039              this.kind = new Enumeration<ActionConditionKind>(new ActionConditionKindEnumFactory());
4040            this.kind.setValue(value);
4041          return this;
4042        }
4043
4044        /**
4045         * @return {@link #expression} (An expression that returns true or false, indicating whether the condition is satisfied.)
4046         */
4047        public Expression getExpression() { 
4048          if (this.expression == null)
4049            if (Configuration.errorOnAutoCreate())
4050              throw new Error("Attempt to auto-create PlanDefinitionActionConditionComponent.expression");
4051            else if (Configuration.doAutoCreate())
4052              this.expression = new Expression(); // cc
4053          return this.expression;
4054        }
4055
4056        public boolean hasExpression() { 
4057          return this.expression != null && !this.expression.isEmpty();
4058        }
4059
4060        /**
4061         * @param value {@link #expression} (An expression that returns true or false, indicating whether the condition is satisfied.)
4062         */
4063        public PlanDefinitionActionConditionComponent setExpression(Expression value) { 
4064          this.expression = value;
4065          return this;
4066        }
4067
4068        protected void listChildren(List<Property> children) {
4069          super.listChildren(children);
4070          children.add(new Property("kind", "code", "The kind of condition.", 0, 1, kind));
4071          children.add(new Property("expression", "Expression", "An expression that returns true or false, indicating whether the condition is satisfied.", 0, 1, expression));
4072        }
4073
4074        @Override
4075        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4076          switch (_hash) {
4077          case 3292052: /*kind*/  return new Property("kind", "code", "The kind of condition.", 0, 1, kind);
4078          case -1795452264: /*expression*/  return new Property("expression", "Expression", "An expression that returns true or false, indicating whether the condition is satisfied.", 0, 1, expression);
4079          default: return super.getNamedProperty(_hash, _name, _checkValid);
4080          }
4081
4082        }
4083
4084      @Override
4085      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4086        switch (hash) {
4087        case 3292052: /*kind*/ return this.kind == null ? new Base[0] : new Base[] {this.kind}; // Enumeration<ActionConditionKind>
4088        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // Expression
4089        default: return super.getProperty(hash, name, checkValid);
4090        }
4091
4092      }
4093
4094      @Override
4095      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4096        switch (hash) {
4097        case 3292052: // kind
4098          value = new ActionConditionKindEnumFactory().fromType(TypeConvertor.castToCode(value));
4099          this.kind = (Enumeration) value; // Enumeration<ActionConditionKind>
4100          return value;
4101        case -1795452264: // expression
4102          this.expression = TypeConvertor.castToExpression(value); // Expression
4103          return value;
4104        default: return super.setProperty(hash, name, value);
4105        }
4106
4107      }
4108
4109      @Override
4110      public Base setProperty(String name, Base value) throws FHIRException {
4111        if (name.equals("kind")) {
4112          value = new ActionConditionKindEnumFactory().fromType(TypeConvertor.castToCode(value));
4113          this.kind = (Enumeration) value; // Enumeration<ActionConditionKind>
4114        } else if (name.equals("expression")) {
4115          this.expression = TypeConvertor.castToExpression(value); // Expression
4116        } else
4117          return super.setProperty(name, value);
4118        return value;
4119      }
4120
4121      @Override
4122      public Base makeProperty(int hash, String name) throws FHIRException {
4123        switch (hash) {
4124        case 3292052:  return getKindElement();
4125        case -1795452264:  return getExpression();
4126        default: return super.makeProperty(hash, name);
4127        }
4128
4129      }
4130
4131      @Override
4132      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4133        switch (hash) {
4134        case 3292052: /*kind*/ return new String[] {"code"};
4135        case -1795452264: /*expression*/ return new String[] {"Expression"};
4136        default: return super.getTypesForProperty(hash, name);
4137        }
4138
4139      }
4140
4141      @Override
4142      public Base addChild(String name) throws FHIRException {
4143        if (name.equals("kind")) {
4144          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.condition.kind");
4145        }
4146        else if (name.equals("expression")) {
4147          this.expression = new Expression();
4148          return this.expression;
4149        }
4150        else
4151          return super.addChild(name);
4152      }
4153
4154      public PlanDefinitionActionConditionComponent copy() {
4155        PlanDefinitionActionConditionComponent dst = new PlanDefinitionActionConditionComponent();
4156        copyValues(dst);
4157        return dst;
4158      }
4159
4160      public void copyValues(PlanDefinitionActionConditionComponent dst) {
4161        super.copyValues(dst);
4162        dst.kind = kind == null ? null : kind.copy();
4163        dst.expression = expression == null ? null : expression.copy();
4164      }
4165
4166      @Override
4167      public boolean equalsDeep(Base other_) {
4168        if (!super.equalsDeep(other_))
4169          return false;
4170        if (!(other_ instanceof PlanDefinitionActionConditionComponent))
4171          return false;
4172        PlanDefinitionActionConditionComponent o = (PlanDefinitionActionConditionComponent) other_;
4173        return compareDeep(kind, o.kind, true) && compareDeep(expression, o.expression, true);
4174      }
4175
4176      @Override
4177      public boolean equalsShallow(Base other_) {
4178        if (!super.equalsShallow(other_))
4179          return false;
4180        if (!(other_ instanceof PlanDefinitionActionConditionComponent))
4181          return false;
4182        PlanDefinitionActionConditionComponent o = (PlanDefinitionActionConditionComponent) other_;
4183        return compareValues(kind, o.kind, true);
4184      }
4185
4186      public boolean isEmpty() {
4187        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(kind, expression);
4188      }
4189
4190  public String fhirType() {
4191    return "PlanDefinition.action.condition";
4192
4193  }
4194
4195  }
4196
4197    @Block()
4198    public static class PlanDefinitionActionInputComponent extends BackboneElement implements IBaseBackboneElement {
4199        /**
4200         * A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.
4201         */
4202        @Child(name = "title", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
4203        @Description(shortDefinition="User-visible title", formalDefinition="A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers." )
4204        protected StringType title;
4205
4206        /**
4207         * Defines the data that is to be provided as input to the action.
4208         */
4209        @Child(name = "requirement", type = {DataRequirement.class}, order=2, min=0, max=1, modifier=false, summary=false)
4210        @Description(shortDefinition="What data is provided", formalDefinition="Defines the data that is to be provided as input to the action." )
4211        protected DataRequirement requirement;
4212
4213        /**
4214         * Points to an existing input or output element that provides data to this input.
4215         */
4216        @Child(name = "relatedData", type = {IdType.class}, order=3, min=0, max=1, modifier=false, summary=false)
4217        @Description(shortDefinition="What data is provided", formalDefinition="Points to an existing input or output element that provides data to this input." )
4218        protected IdType relatedData;
4219
4220        private static final long serialVersionUID = -1064046709L;
4221
4222    /**
4223     * Constructor
4224     */
4225      public PlanDefinitionActionInputComponent() {
4226        super();
4227      }
4228
4229        /**
4230         * @return {@link #title} (A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
4231         */
4232        public StringType getTitleElement() { 
4233          if (this.title == null)
4234            if (Configuration.errorOnAutoCreate())
4235              throw new Error("Attempt to auto-create PlanDefinitionActionInputComponent.title");
4236            else if (Configuration.doAutoCreate())
4237              this.title = new StringType(); // bb
4238          return this.title;
4239        }
4240
4241        public boolean hasTitleElement() { 
4242          return this.title != null && !this.title.isEmpty();
4243        }
4244
4245        public boolean hasTitle() { 
4246          return this.title != null && !this.title.isEmpty();
4247        }
4248
4249        /**
4250         * @param value {@link #title} (A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
4251         */
4252        public PlanDefinitionActionInputComponent setTitleElement(StringType value) { 
4253          this.title = value;
4254          return this;
4255        }
4256
4257        /**
4258         * @return A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.
4259         */
4260        public String getTitle() { 
4261          return this.title == null ? null : this.title.getValue();
4262        }
4263
4264        /**
4265         * @param value A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.
4266         */
4267        public PlanDefinitionActionInputComponent setTitle(String value) { 
4268          if (Utilities.noString(value))
4269            this.title = null;
4270          else {
4271            if (this.title == null)
4272              this.title = new StringType();
4273            this.title.setValue(value);
4274          }
4275          return this;
4276        }
4277
4278        /**
4279         * @return {@link #requirement} (Defines the data that is to be provided as input to the action.)
4280         */
4281        public DataRequirement getRequirement() { 
4282          if (this.requirement == null)
4283            if (Configuration.errorOnAutoCreate())
4284              throw new Error("Attempt to auto-create PlanDefinitionActionInputComponent.requirement");
4285            else if (Configuration.doAutoCreate())
4286              this.requirement = new DataRequirement(); // cc
4287          return this.requirement;
4288        }
4289
4290        public boolean hasRequirement() { 
4291          return this.requirement != null && !this.requirement.isEmpty();
4292        }
4293
4294        /**
4295         * @param value {@link #requirement} (Defines the data that is to be provided as input to the action.)
4296         */
4297        public PlanDefinitionActionInputComponent setRequirement(DataRequirement value) { 
4298          this.requirement = value;
4299          return this;
4300        }
4301
4302        /**
4303         * @return {@link #relatedData} (Points to an existing input or output element that provides data to this input.). This is the underlying object with id, value and extensions. The accessor "getRelatedData" gives direct access to the value
4304         */
4305        public IdType getRelatedDataElement() { 
4306          if (this.relatedData == null)
4307            if (Configuration.errorOnAutoCreate())
4308              throw new Error("Attempt to auto-create PlanDefinitionActionInputComponent.relatedData");
4309            else if (Configuration.doAutoCreate())
4310              this.relatedData = new IdType(); // bb
4311          return this.relatedData;
4312        }
4313
4314        public boolean hasRelatedDataElement() { 
4315          return this.relatedData != null && !this.relatedData.isEmpty();
4316        }
4317
4318        public boolean hasRelatedData() { 
4319          return this.relatedData != null && !this.relatedData.isEmpty();
4320        }
4321
4322        /**
4323         * @param value {@link #relatedData} (Points to an existing input or output element that provides data to this input.). This is the underlying object with id, value and extensions. The accessor "getRelatedData" gives direct access to the value
4324         */
4325        public PlanDefinitionActionInputComponent setRelatedDataElement(IdType value) { 
4326          this.relatedData = value;
4327          return this;
4328        }
4329
4330        /**
4331         * @return Points to an existing input or output element that provides data to this input.
4332         */
4333        public String getRelatedData() { 
4334          return this.relatedData == null ? null : this.relatedData.getValue();
4335        }
4336
4337        /**
4338         * @param value Points to an existing input or output element that provides data to this input.
4339         */
4340        public PlanDefinitionActionInputComponent setRelatedData(String value) { 
4341          if (Utilities.noString(value))
4342            this.relatedData = null;
4343          else {
4344            if (this.relatedData == null)
4345              this.relatedData = new IdType();
4346            this.relatedData.setValue(value);
4347          }
4348          return this;
4349        }
4350
4351        protected void listChildren(List<Property> children) {
4352          super.listChildren(children);
4353          children.add(new Property("title", "string", "A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.", 0, 1, title));
4354          children.add(new Property("requirement", "DataRequirement", "Defines the data that is to be provided as input to the action.", 0, 1, requirement));
4355          children.add(new Property("relatedData", "id", "Points to an existing input or output element that provides data to this input.", 0, 1, relatedData));
4356        }
4357
4358        @Override
4359        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4360          switch (_hash) {
4361          case 110371416: /*title*/  return new Property("title", "string", "A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.", 0, 1, title);
4362          case 363387971: /*requirement*/  return new Property("requirement", "DataRequirement", "Defines the data that is to be provided as input to the action.", 0, 1, requirement);
4363          case 1112535669: /*relatedData*/  return new Property("relatedData", "id", "Points to an existing input or output element that provides data to this input.", 0, 1, relatedData);
4364          default: return super.getNamedProperty(_hash, _name, _checkValid);
4365          }
4366
4367        }
4368
4369      @Override
4370      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4371        switch (hash) {
4372        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
4373        case 363387971: /*requirement*/ return this.requirement == null ? new Base[0] : new Base[] {this.requirement}; // DataRequirement
4374        case 1112535669: /*relatedData*/ return this.relatedData == null ? new Base[0] : new Base[] {this.relatedData}; // IdType
4375        default: return super.getProperty(hash, name, checkValid);
4376        }
4377
4378      }
4379
4380      @Override
4381      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4382        switch (hash) {
4383        case 110371416: // title
4384          this.title = TypeConvertor.castToString(value); // StringType
4385          return value;
4386        case 363387971: // requirement
4387          this.requirement = TypeConvertor.castToDataRequirement(value); // DataRequirement
4388          return value;
4389        case 1112535669: // relatedData
4390          this.relatedData = TypeConvertor.castToId(value); // IdType
4391          return value;
4392        default: return super.setProperty(hash, name, value);
4393        }
4394
4395      }
4396
4397      @Override
4398      public Base setProperty(String name, Base value) throws FHIRException {
4399        if (name.equals("title")) {
4400          this.title = TypeConvertor.castToString(value); // StringType
4401        } else if (name.equals("requirement")) {
4402          this.requirement = TypeConvertor.castToDataRequirement(value); // DataRequirement
4403        } else if (name.equals("relatedData")) {
4404          this.relatedData = TypeConvertor.castToId(value); // IdType
4405        } else
4406          return super.setProperty(name, value);
4407        return value;
4408      }
4409
4410      @Override
4411      public Base makeProperty(int hash, String name) throws FHIRException {
4412        switch (hash) {
4413        case 110371416:  return getTitleElement();
4414        case 363387971:  return getRequirement();
4415        case 1112535669:  return getRelatedDataElement();
4416        default: return super.makeProperty(hash, name);
4417        }
4418
4419      }
4420
4421      @Override
4422      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4423        switch (hash) {
4424        case 110371416: /*title*/ return new String[] {"string"};
4425        case 363387971: /*requirement*/ return new String[] {"DataRequirement"};
4426        case 1112535669: /*relatedData*/ return new String[] {"id"};
4427        default: return super.getTypesForProperty(hash, name);
4428        }
4429
4430      }
4431
4432      @Override
4433      public Base addChild(String name) throws FHIRException {
4434        if (name.equals("title")) {
4435          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.input.title");
4436        }
4437        else if (name.equals("requirement")) {
4438          this.requirement = new DataRequirement();
4439          return this.requirement;
4440        }
4441        else if (name.equals("relatedData")) {
4442          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.input.relatedData");
4443        }
4444        else
4445          return super.addChild(name);
4446      }
4447
4448      public PlanDefinitionActionInputComponent copy() {
4449        PlanDefinitionActionInputComponent dst = new PlanDefinitionActionInputComponent();
4450        copyValues(dst);
4451        return dst;
4452      }
4453
4454      public void copyValues(PlanDefinitionActionInputComponent dst) {
4455        super.copyValues(dst);
4456        dst.title = title == null ? null : title.copy();
4457        dst.requirement = requirement == null ? null : requirement.copy();
4458        dst.relatedData = relatedData == null ? null : relatedData.copy();
4459      }
4460
4461      @Override
4462      public boolean equalsDeep(Base other_) {
4463        if (!super.equalsDeep(other_))
4464          return false;
4465        if (!(other_ instanceof PlanDefinitionActionInputComponent))
4466          return false;
4467        PlanDefinitionActionInputComponent o = (PlanDefinitionActionInputComponent) other_;
4468        return compareDeep(title, o.title, true) && compareDeep(requirement, o.requirement, true) && compareDeep(relatedData, o.relatedData, true)
4469          ;
4470      }
4471
4472      @Override
4473      public boolean equalsShallow(Base other_) {
4474        if (!super.equalsShallow(other_))
4475          return false;
4476        if (!(other_ instanceof PlanDefinitionActionInputComponent))
4477          return false;
4478        PlanDefinitionActionInputComponent o = (PlanDefinitionActionInputComponent) other_;
4479        return compareValues(title, o.title, true) && compareValues(relatedData, o.relatedData, true);
4480      }
4481
4482      public boolean isEmpty() {
4483        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(title, requirement, relatedData
4484          );
4485      }
4486
4487  public String fhirType() {
4488    return "PlanDefinition.action.input";
4489
4490  }
4491
4492  }
4493
4494    @Block()
4495    public static class PlanDefinitionActionOutputComponent extends BackboneElement implements IBaseBackboneElement {
4496        /**
4497         * A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.
4498         */
4499        @Child(name = "title", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
4500        @Description(shortDefinition="User-visible title", formalDefinition="A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers." )
4501        protected StringType title;
4502
4503        /**
4504         * Defines the data that results as output from the action.
4505         */
4506        @Child(name = "requirement", type = {DataRequirement.class}, order=2, min=0, max=1, modifier=false, summary=false)
4507        @Description(shortDefinition="What data is provided", formalDefinition="Defines the data that results as output from the action." )
4508        protected DataRequirement requirement;
4509
4510        /**
4511         * Points to an existing input or output element that is results as output from the action.
4512         */
4513        @Child(name = "relatedData", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
4514        @Description(shortDefinition="What data is provided", formalDefinition="Points to an existing input or output element that is results as output from the action." )
4515        protected StringType relatedData;
4516
4517        private static final long serialVersionUID = 1822414421L;
4518
4519    /**
4520     * Constructor
4521     */
4522      public PlanDefinitionActionOutputComponent() {
4523        super();
4524      }
4525
4526        /**
4527         * @return {@link #title} (A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
4528         */
4529        public StringType getTitleElement() { 
4530          if (this.title == null)
4531            if (Configuration.errorOnAutoCreate())
4532              throw new Error("Attempt to auto-create PlanDefinitionActionOutputComponent.title");
4533            else if (Configuration.doAutoCreate())
4534              this.title = new StringType(); // bb
4535          return this.title;
4536        }
4537
4538        public boolean hasTitleElement() { 
4539          return this.title != null && !this.title.isEmpty();
4540        }
4541
4542        public boolean hasTitle() { 
4543          return this.title != null && !this.title.isEmpty();
4544        }
4545
4546        /**
4547         * @param value {@link #title} (A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
4548         */
4549        public PlanDefinitionActionOutputComponent setTitleElement(StringType value) { 
4550          this.title = value;
4551          return this;
4552        }
4553
4554        /**
4555         * @return A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.
4556         */
4557        public String getTitle() { 
4558          return this.title == null ? null : this.title.getValue();
4559        }
4560
4561        /**
4562         * @param value A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.
4563         */
4564        public PlanDefinitionActionOutputComponent setTitle(String value) { 
4565          if (Utilities.noString(value))
4566            this.title = null;
4567          else {
4568            if (this.title == null)
4569              this.title = new StringType();
4570            this.title.setValue(value);
4571          }
4572          return this;
4573        }
4574
4575        /**
4576         * @return {@link #requirement} (Defines the data that results as output from the action.)
4577         */
4578        public DataRequirement getRequirement() { 
4579          if (this.requirement == null)
4580            if (Configuration.errorOnAutoCreate())
4581              throw new Error("Attempt to auto-create PlanDefinitionActionOutputComponent.requirement");
4582            else if (Configuration.doAutoCreate())
4583              this.requirement = new DataRequirement(); // cc
4584          return this.requirement;
4585        }
4586
4587        public boolean hasRequirement() { 
4588          return this.requirement != null && !this.requirement.isEmpty();
4589        }
4590
4591        /**
4592         * @param value {@link #requirement} (Defines the data that results as output from the action.)
4593         */
4594        public PlanDefinitionActionOutputComponent setRequirement(DataRequirement value) { 
4595          this.requirement = value;
4596          return this;
4597        }
4598
4599        /**
4600         * @return {@link #relatedData} (Points to an existing input or output element that is results as output from the action.). This is the underlying object with id, value and extensions. The accessor "getRelatedData" gives direct access to the value
4601         */
4602        public StringType getRelatedDataElement() { 
4603          if (this.relatedData == null)
4604            if (Configuration.errorOnAutoCreate())
4605              throw new Error("Attempt to auto-create PlanDefinitionActionOutputComponent.relatedData");
4606            else if (Configuration.doAutoCreate())
4607              this.relatedData = new StringType(); // bb
4608          return this.relatedData;
4609        }
4610
4611        public boolean hasRelatedDataElement() { 
4612          return this.relatedData != null && !this.relatedData.isEmpty();
4613        }
4614
4615        public boolean hasRelatedData() { 
4616          return this.relatedData != null && !this.relatedData.isEmpty();
4617        }
4618
4619        /**
4620         * @param value {@link #relatedData} (Points to an existing input or output element that is results as output from the action.). This is the underlying object with id, value and extensions. The accessor "getRelatedData" gives direct access to the value
4621         */
4622        public PlanDefinitionActionOutputComponent setRelatedDataElement(StringType value) { 
4623          this.relatedData = value;
4624          return this;
4625        }
4626
4627        /**
4628         * @return Points to an existing input or output element that is results as output from the action.
4629         */
4630        public String getRelatedData() { 
4631          return this.relatedData == null ? null : this.relatedData.getValue();
4632        }
4633
4634        /**
4635         * @param value Points to an existing input or output element that is results as output from the action.
4636         */
4637        public PlanDefinitionActionOutputComponent setRelatedData(String value) { 
4638          if (Utilities.noString(value))
4639            this.relatedData = null;
4640          else {
4641            if (this.relatedData == null)
4642              this.relatedData = new StringType();
4643            this.relatedData.setValue(value);
4644          }
4645          return this;
4646        }
4647
4648        protected void listChildren(List<Property> children) {
4649          super.listChildren(children);
4650          children.add(new Property("title", "string", "A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.", 0, 1, title));
4651          children.add(new Property("requirement", "DataRequirement", "Defines the data that results as output from the action.", 0, 1, requirement));
4652          children.add(new Property("relatedData", "string", "Points to an existing input or output element that is results as output from the action.", 0, 1, relatedData));
4653        }
4654
4655        @Override
4656        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4657          switch (_hash) {
4658          case 110371416: /*title*/  return new Property("title", "string", "A human-readable label for the data requirement used to label data flows in BPMN or similar diagrams. Also provides a human readable label when rendering the data requirement that conveys its purpose to human readers.", 0, 1, title);
4659          case 363387971: /*requirement*/  return new Property("requirement", "DataRequirement", "Defines the data that results as output from the action.", 0, 1, requirement);
4660          case 1112535669: /*relatedData*/  return new Property("relatedData", "string", "Points to an existing input or output element that is results as output from the action.", 0, 1, relatedData);
4661          default: return super.getNamedProperty(_hash, _name, _checkValid);
4662          }
4663
4664        }
4665
4666      @Override
4667      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4668        switch (hash) {
4669        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
4670        case 363387971: /*requirement*/ return this.requirement == null ? new Base[0] : new Base[] {this.requirement}; // DataRequirement
4671        case 1112535669: /*relatedData*/ return this.relatedData == null ? new Base[0] : new Base[] {this.relatedData}; // StringType
4672        default: return super.getProperty(hash, name, checkValid);
4673        }
4674
4675      }
4676
4677      @Override
4678      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4679        switch (hash) {
4680        case 110371416: // title
4681          this.title = TypeConvertor.castToString(value); // StringType
4682          return value;
4683        case 363387971: // requirement
4684          this.requirement = TypeConvertor.castToDataRequirement(value); // DataRequirement
4685          return value;
4686        case 1112535669: // relatedData
4687          this.relatedData = TypeConvertor.castToString(value); // StringType
4688          return value;
4689        default: return super.setProperty(hash, name, value);
4690        }
4691
4692      }
4693
4694      @Override
4695      public Base setProperty(String name, Base value) throws FHIRException {
4696        if (name.equals("title")) {
4697          this.title = TypeConvertor.castToString(value); // StringType
4698        } else if (name.equals("requirement")) {
4699          this.requirement = TypeConvertor.castToDataRequirement(value); // DataRequirement
4700        } else if (name.equals("relatedData")) {
4701          this.relatedData = TypeConvertor.castToString(value); // StringType
4702        } else
4703          return super.setProperty(name, value);
4704        return value;
4705      }
4706
4707      @Override
4708      public Base makeProperty(int hash, String name) throws FHIRException {
4709        switch (hash) {
4710        case 110371416:  return getTitleElement();
4711        case 363387971:  return getRequirement();
4712        case 1112535669:  return getRelatedDataElement();
4713        default: return super.makeProperty(hash, name);
4714        }
4715
4716      }
4717
4718      @Override
4719      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4720        switch (hash) {
4721        case 110371416: /*title*/ return new String[] {"string"};
4722        case 363387971: /*requirement*/ return new String[] {"DataRequirement"};
4723        case 1112535669: /*relatedData*/ return new String[] {"string"};
4724        default: return super.getTypesForProperty(hash, name);
4725        }
4726
4727      }
4728
4729      @Override
4730      public Base addChild(String name) throws FHIRException {
4731        if (name.equals("title")) {
4732          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.output.title");
4733        }
4734        else if (name.equals("requirement")) {
4735          this.requirement = new DataRequirement();
4736          return this.requirement;
4737        }
4738        else if (name.equals("relatedData")) {
4739          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.output.relatedData");
4740        }
4741        else
4742          return super.addChild(name);
4743      }
4744
4745      public PlanDefinitionActionOutputComponent copy() {
4746        PlanDefinitionActionOutputComponent dst = new PlanDefinitionActionOutputComponent();
4747        copyValues(dst);
4748        return dst;
4749      }
4750
4751      public void copyValues(PlanDefinitionActionOutputComponent dst) {
4752        super.copyValues(dst);
4753        dst.title = title == null ? null : title.copy();
4754        dst.requirement = requirement == null ? null : requirement.copy();
4755        dst.relatedData = relatedData == null ? null : relatedData.copy();
4756      }
4757
4758      @Override
4759      public boolean equalsDeep(Base other_) {
4760        if (!super.equalsDeep(other_))
4761          return false;
4762        if (!(other_ instanceof PlanDefinitionActionOutputComponent))
4763          return false;
4764        PlanDefinitionActionOutputComponent o = (PlanDefinitionActionOutputComponent) other_;
4765        return compareDeep(title, o.title, true) && compareDeep(requirement, o.requirement, true) && compareDeep(relatedData, o.relatedData, true)
4766          ;
4767      }
4768
4769      @Override
4770      public boolean equalsShallow(Base other_) {
4771        if (!super.equalsShallow(other_))
4772          return false;
4773        if (!(other_ instanceof PlanDefinitionActionOutputComponent))
4774          return false;
4775        PlanDefinitionActionOutputComponent o = (PlanDefinitionActionOutputComponent) other_;
4776        return compareValues(title, o.title, true) && compareValues(relatedData, o.relatedData, true);
4777      }
4778
4779      public boolean isEmpty() {
4780        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(title, requirement, relatedData
4781          );
4782      }
4783
4784  public String fhirType() {
4785    return "PlanDefinition.action.output";
4786
4787  }
4788
4789  }
4790
4791    @Block()
4792    public static class PlanDefinitionActionRelatedActionComponent extends BackboneElement implements IBaseBackboneElement {
4793        /**
4794         * The element id of the target related action.
4795         */
4796        @Child(name = "targetId", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=false)
4797        @Description(shortDefinition="What action is this related to", formalDefinition="The element id of the target related action." )
4798        protected IdType targetId;
4799
4800        /**
4801         * The relationship of the start of this action to the related action.
4802         */
4803        @Child(name = "relationship", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
4804        @Description(shortDefinition="before | before-start | before-end | concurrent | concurrent-with-start | concurrent-with-end | after | after-start | after-end", formalDefinition="The relationship of the start of this action to the related action." )
4805        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-relationship-type")
4806        protected Enumeration<ActionRelationshipType> relationship;
4807
4808        /**
4809         * The relationship of the end of this action to the related action.
4810         */
4811        @Child(name = "endRelationship", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
4812        @Description(shortDefinition="before | before-start | before-end | concurrent | concurrent-with-start | concurrent-with-end | after | after-start | after-end", formalDefinition="The relationship of the end of this action to the related action." )
4813        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-relationship-type")
4814        protected Enumeration<ActionRelationshipType> endRelationship;
4815
4816        /**
4817         * A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.
4818         */
4819        @Child(name = "offset", type = {Duration.class, Range.class}, order=4, min=0, max=1, modifier=false, summary=false)
4820        @Description(shortDefinition="Time offset for the relationship", formalDefinition="A duration or range of durations to apply to the relationship. For example, 30-60 minutes before." )
4821        protected DataType offset;
4822
4823        private static final long serialVersionUID = 1997058061L;
4824
4825    /**
4826     * Constructor
4827     */
4828      public PlanDefinitionActionRelatedActionComponent() {
4829        super();
4830      }
4831
4832    /**
4833     * Constructor
4834     */
4835      public PlanDefinitionActionRelatedActionComponent(String targetId, ActionRelationshipType relationship) {
4836        super();
4837        this.setTargetId(targetId);
4838        this.setRelationship(relationship);
4839      }
4840
4841        /**
4842         * @return {@link #targetId} (The element id of the target related action.). This is the underlying object with id, value and extensions. The accessor "getTargetId" gives direct access to the value
4843         */
4844        public IdType getTargetIdElement() { 
4845          if (this.targetId == null)
4846            if (Configuration.errorOnAutoCreate())
4847              throw new Error("Attempt to auto-create PlanDefinitionActionRelatedActionComponent.targetId");
4848            else if (Configuration.doAutoCreate())
4849              this.targetId = new IdType(); // bb
4850          return this.targetId;
4851        }
4852
4853        public boolean hasTargetIdElement() { 
4854          return this.targetId != null && !this.targetId.isEmpty();
4855        }
4856
4857        public boolean hasTargetId() { 
4858          return this.targetId != null && !this.targetId.isEmpty();
4859        }
4860
4861        /**
4862         * @param value {@link #targetId} (The element id of the target related action.). This is the underlying object with id, value and extensions. The accessor "getTargetId" gives direct access to the value
4863         */
4864        public PlanDefinitionActionRelatedActionComponent setTargetIdElement(IdType value) { 
4865          this.targetId = value;
4866          return this;
4867        }
4868
4869        /**
4870         * @return The element id of the target related action.
4871         */
4872        public String getTargetId() { 
4873          return this.targetId == null ? null : this.targetId.getValue();
4874        }
4875
4876        /**
4877         * @param value The element id of the target related action.
4878         */
4879        public PlanDefinitionActionRelatedActionComponent setTargetId(String value) { 
4880            if (this.targetId == null)
4881              this.targetId = new IdType();
4882            this.targetId.setValue(value);
4883          return this;
4884        }
4885
4886        /**
4887         * @return {@link #relationship} (The relationship of the start of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getRelationship" gives direct access to the value
4888         */
4889        public Enumeration<ActionRelationshipType> getRelationshipElement() { 
4890          if (this.relationship == null)
4891            if (Configuration.errorOnAutoCreate())
4892              throw new Error("Attempt to auto-create PlanDefinitionActionRelatedActionComponent.relationship");
4893            else if (Configuration.doAutoCreate())
4894              this.relationship = new Enumeration<ActionRelationshipType>(new ActionRelationshipTypeEnumFactory()); // bb
4895          return this.relationship;
4896        }
4897
4898        public boolean hasRelationshipElement() { 
4899          return this.relationship != null && !this.relationship.isEmpty();
4900        }
4901
4902        public boolean hasRelationship() { 
4903          return this.relationship != null && !this.relationship.isEmpty();
4904        }
4905
4906        /**
4907         * @param value {@link #relationship} (The relationship of the start of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getRelationship" gives direct access to the value
4908         */
4909        public PlanDefinitionActionRelatedActionComponent setRelationshipElement(Enumeration<ActionRelationshipType> value) { 
4910          this.relationship = value;
4911          return this;
4912        }
4913
4914        /**
4915         * @return The relationship of the start of this action to the related action.
4916         */
4917        public ActionRelationshipType getRelationship() { 
4918          return this.relationship == null ? null : this.relationship.getValue();
4919        }
4920
4921        /**
4922         * @param value The relationship of the start of this action to the related action.
4923         */
4924        public PlanDefinitionActionRelatedActionComponent setRelationship(ActionRelationshipType value) { 
4925            if (this.relationship == null)
4926              this.relationship = new Enumeration<ActionRelationshipType>(new ActionRelationshipTypeEnumFactory());
4927            this.relationship.setValue(value);
4928          return this;
4929        }
4930
4931        /**
4932         * @return {@link #endRelationship} (The relationship of the end of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getEndRelationship" gives direct access to the value
4933         */
4934        public Enumeration<ActionRelationshipType> getEndRelationshipElement() { 
4935          if (this.endRelationship == null)
4936            if (Configuration.errorOnAutoCreate())
4937              throw new Error("Attempt to auto-create PlanDefinitionActionRelatedActionComponent.endRelationship");
4938            else if (Configuration.doAutoCreate())
4939              this.endRelationship = new Enumeration<ActionRelationshipType>(new ActionRelationshipTypeEnumFactory()); // bb
4940          return this.endRelationship;
4941        }
4942
4943        public boolean hasEndRelationshipElement() { 
4944          return this.endRelationship != null && !this.endRelationship.isEmpty();
4945        }
4946
4947        public boolean hasEndRelationship() { 
4948          return this.endRelationship != null && !this.endRelationship.isEmpty();
4949        }
4950
4951        /**
4952         * @param value {@link #endRelationship} (The relationship of the end of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getEndRelationship" gives direct access to the value
4953         */
4954        public PlanDefinitionActionRelatedActionComponent setEndRelationshipElement(Enumeration<ActionRelationshipType> value) { 
4955          this.endRelationship = value;
4956          return this;
4957        }
4958
4959        /**
4960         * @return The relationship of the end of this action to the related action.
4961         */
4962        public ActionRelationshipType getEndRelationship() { 
4963          return this.endRelationship == null ? null : this.endRelationship.getValue();
4964        }
4965
4966        /**
4967         * @param value The relationship of the end of this action to the related action.
4968         */
4969        public PlanDefinitionActionRelatedActionComponent setEndRelationship(ActionRelationshipType value) { 
4970          if (value == null)
4971            this.endRelationship = null;
4972          else {
4973            if (this.endRelationship == null)
4974              this.endRelationship = new Enumeration<ActionRelationshipType>(new ActionRelationshipTypeEnumFactory());
4975            this.endRelationship.setValue(value);
4976          }
4977          return this;
4978        }
4979
4980        /**
4981         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
4982         */
4983        public DataType getOffset() { 
4984          return this.offset;
4985        }
4986
4987        /**
4988         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
4989         */
4990        public Duration getOffsetDuration() throws FHIRException { 
4991          if (this.offset == null)
4992            this.offset = new Duration();
4993          if (!(this.offset instanceof Duration))
4994            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.offset.getClass().getName()+" was encountered");
4995          return (Duration) this.offset;
4996        }
4997
4998        public boolean hasOffsetDuration() { 
4999          return this != null && this.offset instanceof Duration;
5000        }
5001
5002        /**
5003         * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
5004         */
5005        public Range getOffsetRange() throws FHIRException { 
5006          if (this.offset == null)
5007            this.offset = new Range();
5008          if (!(this.offset instanceof Range))
5009            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.offset.getClass().getName()+" was encountered");
5010          return (Range) this.offset;
5011        }
5012
5013        public boolean hasOffsetRange() { 
5014          return this != null && this.offset instanceof Range;
5015        }
5016
5017        public boolean hasOffset() { 
5018          return this.offset != null && !this.offset.isEmpty();
5019        }
5020
5021        /**
5022         * @param value {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
5023         */
5024        public PlanDefinitionActionRelatedActionComponent setOffset(DataType value) { 
5025          if (value != null && !(value instanceof Duration || value instanceof Range))
5026            throw new FHIRException("Not the right type for PlanDefinition.action.relatedAction.offset[x]: "+value.fhirType());
5027          this.offset = value;
5028          return this;
5029        }
5030
5031        protected void listChildren(List<Property> children) {
5032          super.listChildren(children);
5033          children.add(new Property("targetId", "id", "The element id of the target related action.", 0, 1, targetId));
5034          children.add(new Property("relationship", "code", "The relationship of the start of this action to the related action.", 0, 1, relationship));
5035          children.add(new Property("endRelationship", "code", "The relationship of the end of this action to the related action.", 0, 1, endRelationship));
5036          children.add(new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset));
5037        }
5038
5039        @Override
5040        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5041          switch (_hash) {
5042          case -441951604: /*targetId*/  return new Property("targetId", "id", "The element id of the target related action.", 0, 1, targetId);
5043          case -261851592: /*relationship*/  return new Property("relationship", "code", "The relationship of the start of this action to the related action.", 0, 1, relationship);
5044          case -1506024781: /*endRelationship*/  return new Property("endRelationship", "code", "The relationship of the end of this action to the related action.", 0, 1, endRelationship);
5045          case -1960684787: /*offset[x]*/  return new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
5046          case -1019779949: /*offset*/  return new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
5047          case 134075207: /*offsetDuration*/  return new Property("offset[x]", "Duration", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
5048          case 1263585386: /*offsetRange*/  return new Property("offset[x]", "Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, 1, offset);
5049          default: return super.getNamedProperty(_hash, _name, _checkValid);
5050          }
5051
5052        }
5053
5054      @Override
5055      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5056        switch (hash) {
5057        case -441951604: /*targetId*/ return this.targetId == null ? new Base[0] : new Base[] {this.targetId}; // IdType
5058        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Enumeration<ActionRelationshipType>
5059        case -1506024781: /*endRelationship*/ return this.endRelationship == null ? new Base[0] : new Base[] {this.endRelationship}; // Enumeration<ActionRelationshipType>
5060        case -1019779949: /*offset*/ return this.offset == null ? new Base[0] : new Base[] {this.offset}; // DataType
5061        default: return super.getProperty(hash, name, checkValid);
5062        }
5063
5064      }
5065
5066      @Override
5067      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5068        switch (hash) {
5069        case -441951604: // targetId
5070          this.targetId = TypeConvertor.castToId(value); // IdType
5071          return value;
5072        case -261851592: // relationship
5073          value = new ActionRelationshipTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
5074          this.relationship = (Enumeration) value; // Enumeration<ActionRelationshipType>
5075          return value;
5076        case -1506024781: // endRelationship
5077          value = new ActionRelationshipTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
5078          this.endRelationship = (Enumeration) value; // Enumeration<ActionRelationshipType>
5079          return value;
5080        case -1019779949: // offset
5081          this.offset = TypeConvertor.castToType(value); // DataType
5082          return value;
5083        default: return super.setProperty(hash, name, value);
5084        }
5085
5086      }
5087
5088      @Override
5089      public Base setProperty(String name, Base value) throws FHIRException {
5090        if (name.equals("targetId")) {
5091          this.targetId = TypeConvertor.castToId(value); // IdType
5092        } else if (name.equals("relationship")) {
5093          value = new ActionRelationshipTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
5094          this.relationship = (Enumeration) value; // Enumeration<ActionRelationshipType>
5095        } else if (name.equals("endRelationship")) {
5096          value = new ActionRelationshipTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
5097          this.endRelationship = (Enumeration) value; // Enumeration<ActionRelationshipType>
5098        } else if (name.equals("offset[x]")) {
5099          this.offset = TypeConvertor.castToType(value); // DataType
5100        } else
5101          return super.setProperty(name, value);
5102        return value;
5103      }
5104
5105      @Override
5106      public Base makeProperty(int hash, String name) throws FHIRException {
5107        switch (hash) {
5108        case -441951604:  return getTargetIdElement();
5109        case -261851592:  return getRelationshipElement();
5110        case -1506024781:  return getEndRelationshipElement();
5111        case -1960684787:  return getOffset();
5112        case -1019779949:  return getOffset();
5113        default: return super.makeProperty(hash, name);
5114        }
5115
5116      }
5117
5118      @Override
5119      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5120        switch (hash) {
5121        case -441951604: /*targetId*/ return new String[] {"id"};
5122        case -261851592: /*relationship*/ return new String[] {"code"};
5123        case -1506024781: /*endRelationship*/ return new String[] {"code"};
5124        case -1019779949: /*offset*/ return new String[] {"Duration", "Range"};
5125        default: return super.getTypesForProperty(hash, name);
5126        }
5127
5128      }
5129
5130      @Override
5131      public Base addChild(String name) throws FHIRException {
5132        if (name.equals("targetId")) {
5133          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.relatedAction.targetId");
5134        }
5135        else if (name.equals("relationship")) {
5136          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.relatedAction.relationship");
5137        }
5138        else if (name.equals("endRelationship")) {
5139          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.relatedAction.endRelationship");
5140        }
5141        else if (name.equals("offsetDuration")) {
5142          this.offset = new Duration();
5143          return this.offset;
5144        }
5145        else if (name.equals("offsetRange")) {
5146          this.offset = new Range();
5147          return this.offset;
5148        }
5149        else
5150          return super.addChild(name);
5151      }
5152
5153      public PlanDefinitionActionRelatedActionComponent copy() {
5154        PlanDefinitionActionRelatedActionComponent dst = new PlanDefinitionActionRelatedActionComponent();
5155        copyValues(dst);
5156        return dst;
5157      }
5158
5159      public void copyValues(PlanDefinitionActionRelatedActionComponent dst) {
5160        super.copyValues(dst);
5161        dst.targetId = targetId == null ? null : targetId.copy();
5162        dst.relationship = relationship == null ? null : relationship.copy();
5163        dst.endRelationship = endRelationship == null ? null : endRelationship.copy();
5164        dst.offset = offset == null ? null : offset.copy();
5165      }
5166
5167      @Override
5168      public boolean equalsDeep(Base other_) {
5169        if (!super.equalsDeep(other_))
5170          return false;
5171        if (!(other_ instanceof PlanDefinitionActionRelatedActionComponent))
5172          return false;
5173        PlanDefinitionActionRelatedActionComponent o = (PlanDefinitionActionRelatedActionComponent) other_;
5174        return compareDeep(targetId, o.targetId, true) && compareDeep(relationship, o.relationship, true)
5175           && compareDeep(endRelationship, o.endRelationship, true) && compareDeep(offset, o.offset, true)
5176          ;
5177      }
5178
5179      @Override
5180      public boolean equalsShallow(Base other_) {
5181        if (!super.equalsShallow(other_))
5182          return false;
5183        if (!(other_ instanceof PlanDefinitionActionRelatedActionComponent))
5184          return false;
5185        PlanDefinitionActionRelatedActionComponent o = (PlanDefinitionActionRelatedActionComponent) other_;
5186        return compareValues(targetId, o.targetId, true) && compareValues(relationship, o.relationship, true)
5187           && compareValues(endRelationship, o.endRelationship, true);
5188      }
5189
5190      public boolean isEmpty() {
5191        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(targetId, relationship, endRelationship
5192          , offset);
5193      }
5194
5195  public String fhirType() {
5196    return "PlanDefinition.action.relatedAction";
5197
5198  }
5199
5200  }
5201
5202    @Block()
5203    public static class PlanDefinitionActionParticipantComponent extends BackboneElement implements IBaseBackboneElement {
5204        /**
5205         * A reference to the id element of the actor who will participate in this action.
5206         */
5207        @Child(name = "actorId", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
5208        @Description(shortDefinition="What actor", formalDefinition="A reference to the id element of the actor who will participate in this action." )
5209        protected StringType actorId;
5210
5211        /**
5212         * The type of participant in the action.
5213         */
5214        @Child(name = "type", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
5215        @Description(shortDefinition="careteam | device | group | healthcareservice | location | organization | patient | practitioner | practitionerrole | relatedperson", formalDefinition="The type of participant in the action." )
5216        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-participant-type")
5217        protected Enumeration<ActionParticipantType> type;
5218
5219        /**
5220         * The type of participant in the action.
5221         */
5222        @Child(name = "typeCanonical", type = {CanonicalType.class}, order=3, min=0, max=1, modifier=false, summary=false)
5223        @Description(shortDefinition="Who or what can participate", formalDefinition="The type of participant in the action." )
5224        protected CanonicalType typeCanonical;
5225
5226        /**
5227         * The type of participant in the action.
5228         */
5229        @Child(name = "typeReference", type = {CareTeam.class, Device.class, DeviceDefinition.class, Endpoint.class, Group.class, HealthcareService.class, Location.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}, order=4, min=0, max=1, modifier=false, summary=false)
5230        @Description(shortDefinition="Who or what can participate", formalDefinition="The type of participant in the action." )
5231        protected Reference typeReference;
5232
5233        /**
5234         * The role the participant should play in performing the described action.
5235         */
5236        @Child(name = "role", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=false)
5237        @Description(shortDefinition="E.g. Nurse, Surgeon, Parent", formalDefinition="The role the participant should play in performing the described action." )
5238        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/action-participant-role")
5239        protected CodeableConcept role;
5240
5241        /**
5242         * Indicates how the actor will be involved in the action - author, reviewer, witness, etc.
5243         */
5244        @Child(name = "function", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
5245        @Description(shortDefinition="E.g. Author, Reviewer, Witness, etc", formalDefinition="Indicates how the actor will be involved in the action - author, reviewer, witness, etc." )
5246        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/action-participant-function")
5247        protected CodeableConcept function;
5248
5249        private static final long serialVersionUID = -1467052283L;
5250
5251    /**
5252     * Constructor
5253     */
5254      public PlanDefinitionActionParticipantComponent() {
5255        super();
5256      }
5257
5258        /**
5259         * @return {@link #actorId} (A reference to the id element of the actor who will participate in this action.). This is the underlying object with id, value and extensions. The accessor "getActorId" gives direct access to the value
5260         */
5261        public StringType getActorIdElement() { 
5262          if (this.actorId == null)
5263            if (Configuration.errorOnAutoCreate())
5264              throw new Error("Attempt to auto-create PlanDefinitionActionParticipantComponent.actorId");
5265            else if (Configuration.doAutoCreate())
5266              this.actorId = new StringType(); // bb
5267          return this.actorId;
5268        }
5269
5270        public boolean hasActorIdElement() { 
5271          return this.actorId != null && !this.actorId.isEmpty();
5272        }
5273
5274        public boolean hasActorId() { 
5275          return this.actorId != null && !this.actorId.isEmpty();
5276        }
5277
5278        /**
5279         * @param value {@link #actorId} (A reference to the id element of the actor who will participate in this action.). This is the underlying object with id, value and extensions. The accessor "getActorId" gives direct access to the value
5280         */
5281        public PlanDefinitionActionParticipantComponent setActorIdElement(StringType value) { 
5282          this.actorId = value;
5283          return this;
5284        }
5285
5286        /**
5287         * @return A reference to the id element of the actor who will participate in this action.
5288         */
5289        public String getActorId() { 
5290          return this.actorId == null ? null : this.actorId.getValue();
5291        }
5292
5293        /**
5294         * @param value A reference to the id element of the actor who will participate in this action.
5295         */
5296        public PlanDefinitionActionParticipantComponent setActorId(String value) { 
5297          if (Utilities.noString(value))
5298            this.actorId = null;
5299          else {
5300            if (this.actorId == null)
5301              this.actorId = new StringType();
5302            this.actorId.setValue(value);
5303          }
5304          return this;
5305        }
5306
5307        /**
5308         * @return {@link #type} (The type of participant in the action.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
5309         */
5310        public Enumeration<ActionParticipantType> getTypeElement() { 
5311          if (this.type == null)
5312            if (Configuration.errorOnAutoCreate())
5313              throw new Error("Attempt to auto-create PlanDefinitionActionParticipantComponent.type");
5314            else if (Configuration.doAutoCreate())
5315              this.type = new Enumeration<ActionParticipantType>(new ActionParticipantTypeEnumFactory()); // bb
5316          return this.type;
5317        }
5318
5319        public boolean hasTypeElement() { 
5320          return this.type != null && !this.type.isEmpty();
5321        }
5322
5323        public boolean hasType() { 
5324          return this.type != null && !this.type.isEmpty();
5325        }
5326
5327        /**
5328         * @param value {@link #type} (The type of participant in the action.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
5329         */
5330        public PlanDefinitionActionParticipantComponent setTypeElement(Enumeration<ActionParticipantType> value) { 
5331          this.type = value;
5332          return this;
5333        }
5334
5335        /**
5336         * @return The type of participant in the action.
5337         */
5338        public ActionParticipantType getType() { 
5339          return this.type == null ? null : this.type.getValue();
5340        }
5341
5342        /**
5343         * @param value The type of participant in the action.
5344         */
5345        public PlanDefinitionActionParticipantComponent setType(ActionParticipantType value) { 
5346          if (value == null)
5347            this.type = null;
5348          else {
5349            if (this.type == null)
5350              this.type = new Enumeration<ActionParticipantType>(new ActionParticipantTypeEnumFactory());
5351            this.type.setValue(value);
5352          }
5353          return this;
5354        }
5355
5356        /**
5357         * @return {@link #typeCanonical} (The type of participant in the action.). This is the underlying object with id, value and extensions. The accessor "getTypeCanonical" gives direct access to the value
5358         */
5359        public CanonicalType getTypeCanonicalElement() { 
5360          if (this.typeCanonical == null)
5361            if (Configuration.errorOnAutoCreate())
5362              throw new Error("Attempt to auto-create PlanDefinitionActionParticipantComponent.typeCanonical");
5363            else if (Configuration.doAutoCreate())
5364              this.typeCanonical = new CanonicalType(); // bb
5365          return this.typeCanonical;
5366        }
5367
5368        public boolean hasTypeCanonicalElement() { 
5369          return this.typeCanonical != null && !this.typeCanonical.isEmpty();
5370        }
5371
5372        public boolean hasTypeCanonical() { 
5373          return this.typeCanonical != null && !this.typeCanonical.isEmpty();
5374        }
5375
5376        /**
5377         * @param value {@link #typeCanonical} (The type of participant in the action.). This is the underlying object with id, value and extensions. The accessor "getTypeCanonical" gives direct access to the value
5378         */
5379        public PlanDefinitionActionParticipantComponent setTypeCanonicalElement(CanonicalType value) { 
5380          this.typeCanonical = value;
5381          return this;
5382        }
5383
5384        /**
5385         * @return The type of participant in the action.
5386         */
5387        public String getTypeCanonical() { 
5388          return this.typeCanonical == null ? null : this.typeCanonical.getValue();
5389        }
5390
5391        /**
5392         * @param value The type of participant in the action.
5393         */
5394        public PlanDefinitionActionParticipantComponent setTypeCanonical(String value) { 
5395          if (Utilities.noString(value))
5396            this.typeCanonical = null;
5397          else {
5398            if (this.typeCanonical == null)
5399              this.typeCanonical = new CanonicalType();
5400            this.typeCanonical.setValue(value);
5401          }
5402          return this;
5403        }
5404
5405        /**
5406         * @return {@link #typeReference} (The type of participant in the action.)
5407         */
5408        public Reference getTypeReference() { 
5409          if (this.typeReference == null)
5410            if (Configuration.errorOnAutoCreate())
5411              throw new Error("Attempt to auto-create PlanDefinitionActionParticipantComponent.typeReference");
5412            else if (Configuration.doAutoCreate())
5413              this.typeReference = new Reference(); // cc
5414          return this.typeReference;
5415        }
5416
5417        public boolean hasTypeReference() { 
5418          return this.typeReference != null && !this.typeReference.isEmpty();
5419        }
5420
5421        /**
5422         * @param value {@link #typeReference} (The type of participant in the action.)
5423         */
5424        public PlanDefinitionActionParticipantComponent setTypeReference(Reference value) { 
5425          this.typeReference = value;
5426          return this;
5427        }
5428
5429        /**
5430         * @return {@link #role} (The role the participant should play in performing the described action.)
5431         */
5432        public CodeableConcept getRole() { 
5433          if (this.role == null)
5434            if (Configuration.errorOnAutoCreate())
5435              throw new Error("Attempt to auto-create PlanDefinitionActionParticipantComponent.role");
5436            else if (Configuration.doAutoCreate())
5437              this.role = new CodeableConcept(); // cc
5438          return this.role;
5439        }
5440
5441        public boolean hasRole() { 
5442          return this.role != null && !this.role.isEmpty();
5443        }
5444
5445        /**
5446         * @param value {@link #role} (The role the participant should play in performing the described action.)
5447         */
5448        public PlanDefinitionActionParticipantComponent setRole(CodeableConcept value) { 
5449          this.role = value;
5450          return this;
5451        }
5452
5453        /**
5454         * @return {@link #function} (Indicates how the actor will be involved in the action - author, reviewer, witness, etc.)
5455         */
5456        public CodeableConcept getFunction() { 
5457          if (this.function == null)
5458            if (Configuration.errorOnAutoCreate())
5459              throw new Error("Attempt to auto-create PlanDefinitionActionParticipantComponent.function");
5460            else if (Configuration.doAutoCreate())
5461              this.function = new CodeableConcept(); // cc
5462          return this.function;
5463        }
5464
5465        public boolean hasFunction() { 
5466          return this.function != null && !this.function.isEmpty();
5467        }
5468
5469        /**
5470         * @param value {@link #function} (Indicates how the actor will be involved in the action - author, reviewer, witness, etc.)
5471         */
5472        public PlanDefinitionActionParticipantComponent setFunction(CodeableConcept value) { 
5473          this.function = value;
5474          return this;
5475        }
5476
5477        protected void listChildren(List<Property> children) {
5478          super.listChildren(children);
5479          children.add(new Property("actorId", "string", "A reference to the id element of the actor who will participate in this action.", 0, 1, actorId));
5480          children.add(new Property("type", "code", "The type of participant in the action.", 0, 1, type));
5481          children.add(new Property("typeCanonical", "canonical(CapabilityStatement)", "The type of participant in the action.", 0, 1, typeCanonical));
5482          children.add(new Property("typeReference", "Reference(CareTeam|Device|DeviceDefinition|Endpoint|Group|HealthcareService|Location|Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "The type of participant in the action.", 0, 1, typeReference));
5483          children.add(new Property("role", "CodeableConcept", "The role the participant should play in performing the described action.", 0, 1, role));
5484          children.add(new Property("function", "CodeableConcept", "Indicates how the actor will be involved in the action - author, reviewer, witness, etc.", 0, 1, function));
5485        }
5486
5487        @Override
5488        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5489          switch (_hash) {
5490          case -1161623056: /*actorId*/  return new Property("actorId", "string", "A reference to the id element of the actor who will participate in this action.", 0, 1, actorId);
5491          case 3575610: /*type*/  return new Property("type", "code", "The type of participant in the action.", 0, 1, type);
5492          case -466635046: /*typeCanonical*/  return new Property("typeCanonical", "canonical(CapabilityStatement)", "The type of participant in the action.", 0, 1, typeCanonical);
5493          case 2074825009: /*typeReference*/  return new Property("typeReference", "Reference(CareTeam|Device|DeviceDefinition|Endpoint|Group|HealthcareService|Location|Organization|Patient|Practitioner|PractitionerRole|RelatedPerson)", "The type of participant in the action.", 0, 1, typeReference);
5494          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "The role the participant should play in performing the described action.", 0, 1, role);
5495          case 1380938712: /*function*/  return new Property("function", "CodeableConcept", "Indicates how the actor will be involved in the action - author, reviewer, witness, etc.", 0, 1, function);
5496          default: return super.getNamedProperty(_hash, _name, _checkValid);
5497          }
5498
5499        }
5500
5501      @Override
5502      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5503        switch (hash) {
5504        case -1161623056: /*actorId*/ return this.actorId == null ? new Base[0] : new Base[] {this.actorId}; // StringType
5505        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<ActionParticipantType>
5506        case -466635046: /*typeCanonical*/ return this.typeCanonical == null ? new Base[0] : new Base[] {this.typeCanonical}; // CanonicalType
5507        case 2074825009: /*typeReference*/ return this.typeReference == null ? new Base[0] : new Base[] {this.typeReference}; // Reference
5508        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
5509        case 1380938712: /*function*/ return this.function == null ? new Base[0] : new Base[] {this.function}; // CodeableConcept
5510        default: return super.getProperty(hash, name, checkValid);
5511        }
5512
5513      }
5514
5515      @Override
5516      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5517        switch (hash) {
5518        case -1161623056: // actorId
5519          this.actorId = TypeConvertor.castToString(value); // StringType
5520          return value;
5521        case 3575610: // type
5522          value = new ActionParticipantTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
5523          this.type = (Enumeration) value; // Enumeration<ActionParticipantType>
5524          return value;
5525        case -466635046: // typeCanonical
5526          this.typeCanonical = TypeConvertor.castToCanonical(value); // CanonicalType
5527          return value;
5528        case 2074825009: // typeReference
5529          this.typeReference = TypeConvertor.castToReference(value); // Reference
5530          return value;
5531        case 3506294: // role
5532          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5533          return value;
5534        case 1380938712: // function
5535          this.function = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5536          return value;
5537        default: return super.setProperty(hash, name, value);
5538        }
5539
5540      }
5541
5542      @Override
5543      public Base setProperty(String name, Base value) throws FHIRException {
5544        if (name.equals("actorId")) {
5545          this.actorId = TypeConvertor.castToString(value); // StringType
5546        } else if (name.equals("type")) {
5547          value = new ActionParticipantTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
5548          this.type = (Enumeration) value; // Enumeration<ActionParticipantType>
5549        } else if (name.equals("typeCanonical")) {
5550          this.typeCanonical = TypeConvertor.castToCanonical(value); // CanonicalType
5551        } else if (name.equals("typeReference")) {
5552          this.typeReference = TypeConvertor.castToReference(value); // Reference
5553        } else if (name.equals("role")) {
5554          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5555        } else if (name.equals("function")) {
5556          this.function = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5557        } else
5558          return super.setProperty(name, value);
5559        return value;
5560      }
5561
5562      @Override
5563      public Base makeProperty(int hash, String name) throws FHIRException {
5564        switch (hash) {
5565        case -1161623056:  return getActorIdElement();
5566        case 3575610:  return getTypeElement();
5567        case -466635046:  return getTypeCanonicalElement();
5568        case 2074825009:  return getTypeReference();
5569        case 3506294:  return getRole();
5570        case 1380938712:  return getFunction();
5571        default: return super.makeProperty(hash, name);
5572        }
5573
5574      }
5575
5576      @Override
5577      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5578        switch (hash) {
5579        case -1161623056: /*actorId*/ return new String[] {"string"};
5580        case 3575610: /*type*/ return new String[] {"code"};
5581        case -466635046: /*typeCanonical*/ return new String[] {"canonical"};
5582        case 2074825009: /*typeReference*/ return new String[] {"Reference"};
5583        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
5584        case 1380938712: /*function*/ return new String[] {"CodeableConcept"};
5585        default: return super.getTypesForProperty(hash, name);
5586        }
5587
5588      }
5589
5590      @Override
5591      public Base addChild(String name) throws FHIRException {
5592        if (name.equals("actorId")) {
5593          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.participant.actorId");
5594        }
5595        else if (name.equals("type")) {
5596          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.participant.type");
5597        }
5598        else if (name.equals("typeCanonical")) {
5599          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.participant.typeCanonical");
5600        }
5601        else if (name.equals("typeReference")) {
5602          this.typeReference = new Reference();
5603          return this.typeReference;
5604        }
5605        else if (name.equals("role")) {
5606          this.role = new CodeableConcept();
5607          return this.role;
5608        }
5609        else if (name.equals("function")) {
5610          this.function = new CodeableConcept();
5611          return this.function;
5612        }
5613        else
5614          return super.addChild(name);
5615      }
5616
5617      public PlanDefinitionActionParticipantComponent copy() {
5618        PlanDefinitionActionParticipantComponent dst = new PlanDefinitionActionParticipantComponent();
5619        copyValues(dst);
5620        return dst;
5621      }
5622
5623      public void copyValues(PlanDefinitionActionParticipantComponent dst) {
5624        super.copyValues(dst);
5625        dst.actorId = actorId == null ? null : actorId.copy();
5626        dst.type = type == null ? null : type.copy();
5627        dst.typeCanonical = typeCanonical == null ? null : typeCanonical.copy();
5628        dst.typeReference = typeReference == null ? null : typeReference.copy();
5629        dst.role = role == null ? null : role.copy();
5630        dst.function = function == null ? null : function.copy();
5631      }
5632
5633      @Override
5634      public boolean equalsDeep(Base other_) {
5635        if (!super.equalsDeep(other_))
5636          return false;
5637        if (!(other_ instanceof PlanDefinitionActionParticipantComponent))
5638          return false;
5639        PlanDefinitionActionParticipantComponent o = (PlanDefinitionActionParticipantComponent) other_;
5640        return compareDeep(actorId, o.actorId, true) && compareDeep(type, o.type, true) && compareDeep(typeCanonical, o.typeCanonical, true)
5641           && compareDeep(typeReference, o.typeReference, true) && compareDeep(role, o.role, true) && compareDeep(function, o.function, true)
5642          ;
5643      }
5644
5645      @Override
5646      public boolean equalsShallow(Base other_) {
5647        if (!super.equalsShallow(other_))
5648          return false;
5649        if (!(other_ instanceof PlanDefinitionActionParticipantComponent))
5650          return false;
5651        PlanDefinitionActionParticipantComponent o = (PlanDefinitionActionParticipantComponent) other_;
5652        return compareValues(actorId, o.actorId, true) && compareValues(type, o.type, true) && compareValues(typeCanonical, o.typeCanonical, true)
5653          ;
5654      }
5655
5656      public boolean isEmpty() {
5657        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(actorId, type, typeCanonical
5658          , typeReference, role, function);
5659      }
5660
5661  public String fhirType() {
5662    return "PlanDefinition.action.participant";
5663
5664  }
5665
5666  }
5667
5668    @Block()
5669    public static class PlanDefinitionActionDynamicValueComponent extends BackboneElement implements IBaseBackboneElement {
5670        /**
5671         * The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression. The specified path SHALL be a FHIRPath resolvable on the specified target type of the ActivityDefinition, and SHALL consist only of identifiers, constant indexers, and a restricted subset of functions. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).
5672         */
5673        @Child(name = "path", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
5674        @Description(shortDefinition="The path to the element to be set dynamically", formalDefinition="The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression. The specified path SHALL be a FHIRPath resolvable on the specified target type of the ActivityDefinition, and SHALL consist only of identifiers, constant indexers, and a restricted subset of functions. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details)." )
5675        protected StringType path;
5676
5677        /**
5678         * An expression specifying the value of the customized element.
5679         */
5680        @Child(name = "expression", type = {Expression.class}, order=2, min=0, max=1, modifier=false, summary=false)
5681        @Description(shortDefinition="An expression that provides the dynamic value for the customization", formalDefinition="An expression specifying the value of the customized element." )
5682        protected Expression expression;
5683
5684        private static final long serialVersionUID = 1064529082L;
5685
5686    /**
5687     * Constructor
5688     */
5689      public PlanDefinitionActionDynamicValueComponent() {
5690        super();
5691      }
5692
5693        /**
5694         * @return {@link #path} (The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression. The specified path SHALL be a FHIRPath resolvable on the specified target type of the ActivityDefinition, and SHALL consist only of identifiers, constant indexers, and a restricted subset of functions. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
5695         */
5696        public StringType getPathElement() { 
5697          if (this.path == null)
5698            if (Configuration.errorOnAutoCreate())
5699              throw new Error("Attempt to auto-create PlanDefinitionActionDynamicValueComponent.path");
5700            else if (Configuration.doAutoCreate())
5701              this.path = new StringType(); // bb
5702          return this.path;
5703        }
5704
5705        public boolean hasPathElement() { 
5706          return this.path != null && !this.path.isEmpty();
5707        }
5708
5709        public boolean hasPath() { 
5710          return this.path != null && !this.path.isEmpty();
5711        }
5712
5713        /**
5714         * @param value {@link #path} (The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression. The specified path SHALL be a FHIRPath resolvable on the specified target type of the ActivityDefinition, and SHALL consist only of identifiers, constant indexers, and a restricted subset of functions. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
5715         */
5716        public PlanDefinitionActionDynamicValueComponent setPathElement(StringType value) { 
5717          this.path = value;
5718          return this;
5719        }
5720
5721        /**
5722         * @return The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression. The specified path SHALL be a FHIRPath resolvable on the specified target type of the ActivityDefinition, and SHALL consist only of identifiers, constant indexers, and a restricted subset of functions. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).
5723         */
5724        public String getPath() { 
5725          return this.path == null ? null : this.path.getValue();
5726        }
5727
5728        /**
5729         * @param value The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression. The specified path SHALL be a FHIRPath resolvable on the specified target type of the ActivityDefinition, and SHALL consist only of identifiers, constant indexers, and a restricted subset of functions. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).
5730         */
5731        public PlanDefinitionActionDynamicValueComponent setPath(String value) { 
5732          if (Utilities.noString(value))
5733            this.path = null;
5734          else {
5735            if (this.path == null)
5736              this.path = new StringType();
5737            this.path.setValue(value);
5738          }
5739          return this;
5740        }
5741
5742        /**
5743         * @return {@link #expression} (An expression specifying the value of the customized element.)
5744         */
5745        public Expression getExpression() { 
5746          if (this.expression == null)
5747            if (Configuration.errorOnAutoCreate())
5748              throw new Error("Attempt to auto-create PlanDefinitionActionDynamicValueComponent.expression");
5749            else if (Configuration.doAutoCreate())
5750              this.expression = new Expression(); // cc
5751          return this.expression;
5752        }
5753
5754        public boolean hasExpression() { 
5755          return this.expression != null && !this.expression.isEmpty();
5756        }
5757
5758        /**
5759         * @param value {@link #expression} (An expression specifying the value of the customized element.)
5760         */
5761        public PlanDefinitionActionDynamicValueComponent setExpression(Expression value) { 
5762          this.expression = value;
5763          return this;
5764        }
5765
5766        protected void listChildren(List<Property> children) {
5767          super.listChildren(children);
5768          children.add(new Property("path", "string", "The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression. The specified path SHALL be a FHIRPath resolvable on the specified target type of the ActivityDefinition, and SHALL consist only of identifiers, constant indexers, and a restricted subset of functions. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).", 0, 1, path));
5769          children.add(new Property("expression", "Expression", "An expression specifying the value of the customized element.", 0, 1, expression));
5770        }
5771
5772        @Override
5773        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5774          switch (_hash) {
5775          case 3433509: /*path*/  return new Property("path", "string", "The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression. The specified path SHALL be a FHIRPath resolvable on the specified target type of the ActivityDefinition, and SHALL consist only of identifiers, constant indexers, and a restricted subset of functions. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).", 0, 1, path);
5776          case -1795452264: /*expression*/  return new Property("expression", "Expression", "An expression specifying the value of the customized element.", 0, 1, expression);
5777          default: return super.getNamedProperty(_hash, _name, _checkValid);
5778          }
5779
5780        }
5781
5782      @Override
5783      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5784        switch (hash) {
5785        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
5786        case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // Expression
5787        default: return super.getProperty(hash, name, checkValid);
5788        }
5789
5790      }
5791
5792      @Override
5793      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5794        switch (hash) {
5795        case 3433509: // path
5796          this.path = TypeConvertor.castToString(value); // StringType
5797          return value;
5798        case -1795452264: // expression
5799          this.expression = TypeConvertor.castToExpression(value); // Expression
5800          return value;
5801        default: return super.setProperty(hash, name, value);
5802        }
5803
5804      }
5805
5806      @Override
5807      public Base setProperty(String name, Base value) throws FHIRException {
5808        if (name.equals("path")) {
5809          this.path = TypeConvertor.castToString(value); // StringType
5810        } else if (name.equals("expression")) {
5811          this.expression = TypeConvertor.castToExpression(value); // Expression
5812        } else
5813          return super.setProperty(name, value);
5814        return value;
5815      }
5816
5817      @Override
5818      public Base makeProperty(int hash, String name) throws FHIRException {
5819        switch (hash) {
5820        case 3433509:  return getPathElement();
5821        case -1795452264:  return getExpression();
5822        default: return super.makeProperty(hash, name);
5823        }
5824
5825      }
5826
5827      @Override
5828      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5829        switch (hash) {
5830        case 3433509: /*path*/ return new String[] {"string"};
5831        case -1795452264: /*expression*/ return new String[] {"Expression"};
5832        default: return super.getTypesForProperty(hash, name);
5833        }
5834
5835      }
5836
5837      @Override
5838      public Base addChild(String name) throws FHIRException {
5839        if (name.equals("path")) {
5840          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.action.dynamicValue.path");
5841        }
5842        else if (name.equals("expression")) {
5843          this.expression = new Expression();
5844          return this.expression;
5845        }
5846        else
5847          return super.addChild(name);
5848      }
5849
5850      public PlanDefinitionActionDynamicValueComponent copy() {
5851        PlanDefinitionActionDynamicValueComponent dst = new PlanDefinitionActionDynamicValueComponent();
5852        copyValues(dst);
5853        return dst;
5854      }
5855
5856      public void copyValues(PlanDefinitionActionDynamicValueComponent dst) {
5857        super.copyValues(dst);
5858        dst.path = path == null ? null : path.copy();
5859        dst.expression = expression == null ? null : expression.copy();
5860      }
5861
5862      @Override
5863      public boolean equalsDeep(Base other_) {
5864        if (!super.equalsDeep(other_))
5865          return false;
5866        if (!(other_ instanceof PlanDefinitionActionDynamicValueComponent))
5867          return false;
5868        PlanDefinitionActionDynamicValueComponent o = (PlanDefinitionActionDynamicValueComponent) other_;
5869        return compareDeep(path, o.path, true) && compareDeep(expression, o.expression, true);
5870      }
5871
5872      @Override
5873      public boolean equalsShallow(Base other_) {
5874        if (!super.equalsShallow(other_))
5875          return false;
5876        if (!(other_ instanceof PlanDefinitionActionDynamicValueComponent))
5877          return false;
5878        PlanDefinitionActionDynamicValueComponent o = (PlanDefinitionActionDynamicValueComponent) other_;
5879        return compareValues(path, o.path, true);
5880      }
5881
5882      public boolean isEmpty() {
5883        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, expression);
5884      }
5885
5886  public String fhirType() {
5887    return "PlanDefinition.action.dynamicValue";
5888
5889  }
5890
5891  }
5892
5893    /**
5894     * An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.
5895     */
5896    @Child(name = "url", type = {UriType.class}, order=0, min=0, max=1, modifier=false, summary=true)
5897    @Description(shortDefinition="Canonical identifier for this plan definition, represented as a URI (globally unique)", formalDefinition="An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers." )
5898    protected UriType url;
5899
5900    /**
5901     * A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance.
5902     */
5903    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5904    @Description(shortDefinition="Additional identifier for the plan definition", formalDefinition="A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance." )
5905    protected List<Identifier> identifier;
5906
5907    /**
5908     * The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.
5909     */
5910    @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
5911    @Description(shortDefinition="Business version of the plan definition", formalDefinition="The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts." )
5912    protected StringType version;
5913
5914    /**
5915     * Indicates the mechanism used to compare versions to determine which is more current.
5916     */
5917    @Child(name = "versionAlgorithm", type = {StringType.class, Coding.class}, order=3, min=0, max=1, modifier=false, summary=true)
5918    @Description(shortDefinition="How to compare versions", formalDefinition="Indicates the mechanism used to compare versions to determine which is more current." )
5919    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/version-algorithm")
5920    protected DataType versionAlgorithm;
5921
5922    /**
5923     * A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
5924     */
5925    @Child(name = "name", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
5926    @Description(shortDefinition="Name for this plan definition (computer friendly)", formalDefinition="A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation." )
5927    protected StringType name;
5928
5929    /**
5930     * A short, descriptive, user-friendly title for the plan definition.
5931     */
5932    @Child(name = "title", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
5933    @Description(shortDefinition="Name for this plan definition (human friendly)", formalDefinition="A short, descriptive, user-friendly title for the plan definition." )
5934    protected StringType title;
5935
5936    /**
5937     * An explanatory or alternate title for the plan definition giving additional information about its content.
5938     */
5939    @Child(name = "subtitle", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
5940    @Description(shortDefinition="Subordinate title of the plan definition", formalDefinition="An explanatory or alternate title for the plan definition giving additional information about its content." )
5941    protected StringType subtitle;
5942
5943    /**
5944     * A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition.
5945     */
5946    @Child(name = "type", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
5947    @Description(shortDefinition="order-set | clinical-protocol | eca-rule | workflow-definition", formalDefinition="A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition." )
5948    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/plan-definition-type")
5949    protected CodeableConcept type;
5950
5951    /**
5952     * The status of this plan definition. Enables tracking the life-cycle of the content.
5953     */
5954    @Child(name = "status", type = {CodeType.class}, order=8, min=1, max=1, modifier=true, summary=true)
5955    @Description(shortDefinition="draft | active | retired | unknown", formalDefinition="The status of this plan definition. Enables tracking the life-cycle of the content." )
5956    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/publication-status")
5957    protected Enumeration<PublicationStatus> status;
5958
5959    /**
5960     * A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
5961     */
5962    @Child(name = "experimental", type = {BooleanType.class}, order=9, min=0, max=1, modifier=false, summary=true)
5963    @Description(shortDefinition="For testing purposes, not real usage", formalDefinition="A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage." )
5964    protected BooleanType experimental;
5965
5966    /**
5967     * A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.
5968     */
5969    @Child(name = "subject", type = {CodeableConcept.class, Group.class, MedicinalProductDefinition.class, SubstanceDefinition.class, AdministrableProductDefinition.class, ManufacturedItemDefinition.class, PackagedProductDefinition.class, CanonicalType.class}, order=10, min=0, max=1, modifier=false, summary=false)
5970    @Description(shortDefinition="Type of individual the plan definition is focused on", formalDefinition="A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource." )
5971    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participant-resource-types")
5972    protected DataType subject;
5973
5974    /**
5975     * The date  (and optionally time) when the plan definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.
5976     */
5977    @Child(name = "date", type = {DateTimeType.class}, order=11, min=0, max=1, modifier=false, summary=true)
5978    @Description(shortDefinition="Date last changed", formalDefinition="The date  (and optionally time) when the plan definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes." )
5979    protected DateTimeType date;
5980
5981    /**
5982     * The name of the organization or individual responsible for the release and ongoing maintenance of the plan definition.
5983     */
5984    @Child(name = "publisher", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=true)
5985    @Description(shortDefinition="Name of the publisher/steward (organization or individual)", formalDefinition="The name of the organization or individual responsible for the release and ongoing maintenance of the plan definition." )
5986    protected StringType publisher;
5987
5988    /**
5989     * Contact details to assist a user in finding and communicating with the publisher.
5990     */
5991    @Child(name = "contact", type = {ContactDetail.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5992    @Description(shortDefinition="Contact details for the publisher", formalDefinition="Contact details to assist a user in finding and communicating with the publisher." )
5993    protected List<ContactDetail> contact;
5994
5995    /**
5996     * A free text natural language description of the plan definition from a consumer's perspective.
5997     */
5998    @Child(name = "description", type = {MarkdownType.class}, order=14, min=0, max=1, modifier=false, summary=true)
5999    @Description(shortDefinition="Natural language description of the plan definition", formalDefinition="A free text natural language description of the plan definition from a consumer's perspective." )
6000    protected MarkdownType description;
6001
6002    /**
6003     * The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate plan definition instances.
6004     */
6005    @Child(name = "useContext", type = {UsageContext.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6006    @Description(shortDefinition="The context that the content is intended to support", formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate plan definition instances." )
6007    protected List<UsageContext> useContext;
6008
6009    /**
6010     * A legal or geographic region in which the plan definition is intended to be used.
6011     */
6012    @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6013    @Description(shortDefinition="Intended jurisdiction for plan definition (if applicable)", formalDefinition="A legal or geographic region in which the plan definition is intended to be used." )
6014    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/jurisdiction")
6015    protected List<CodeableConcept> jurisdiction;
6016
6017    /**
6018     * Explanation of why this plan definition is needed and why it has been designed as it has.
6019     */
6020    @Child(name = "purpose", type = {MarkdownType.class}, order=17, min=0, max=1, modifier=false, summary=false)
6021    @Description(shortDefinition="Why this plan definition is defined", formalDefinition="Explanation of why this plan definition is needed and why it has been designed as it has." )
6022    protected MarkdownType purpose;
6023
6024    /**
6025     * A detailed description of how the plan definition is used from a clinical perspective.
6026     */
6027    @Child(name = "usage", type = {MarkdownType.class}, order=18, min=0, max=1, modifier=false, summary=false)
6028    @Description(shortDefinition="Describes the clinical usage of the plan", formalDefinition="A detailed description of how the plan definition is used from a clinical perspective." )
6029    protected MarkdownType usage;
6030
6031    /**
6032     * A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.
6033     */
6034    @Child(name = "copyright", type = {MarkdownType.class}, order=19, min=0, max=1, modifier=false, summary=false)
6035    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition." )
6036    protected MarkdownType copyright;
6037
6038    /**
6039     * A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').
6040     */
6041    @Child(name = "copyrightLabel", type = {StringType.class}, order=20, min=0, max=1, modifier=false, summary=false)
6042    @Description(shortDefinition="Copyright holder and year(s)", formalDefinition="A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved')." )
6043    protected StringType copyrightLabel;
6044
6045    /**
6046     * The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
6047     */
6048    @Child(name = "approvalDate", type = {DateType.class}, order=21, min=0, max=1, modifier=false, summary=false)
6049    @Description(shortDefinition="When the plan definition was approved by publisher", formalDefinition="The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage." )
6050    protected DateType approvalDate;
6051
6052    /**
6053     * The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
6054     */
6055    @Child(name = "lastReviewDate", type = {DateType.class}, order=22, min=0, max=1, modifier=false, summary=false)
6056    @Description(shortDefinition="When the plan definition was last reviewed by the publisher", formalDefinition="The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date." )
6057    protected DateType lastReviewDate;
6058
6059    /**
6060     * The period during which the plan definition content was or is planned to be in active use.
6061     */
6062    @Child(name = "effectivePeriod", type = {Period.class}, order=23, min=0, max=1, modifier=false, summary=true)
6063    @Description(shortDefinition="When the plan definition is expected to be used", formalDefinition="The period during which the plan definition content was or is planned to be in active use." )
6064    protected Period effectivePeriod;
6065
6066    /**
6067     * Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching.
6068     */
6069    @Child(name = "topic", type = {CodeableConcept.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6070    @Description(shortDefinition="E.g. Education, Treatment, Assessment", formalDefinition="Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching." )
6071    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/definition-topic")
6072    protected List<CodeableConcept> topic;
6073
6074    /**
6075     * An individiual or organization primarily involved in the creation and maintenance of the content.
6076     */
6077    @Child(name = "author", type = {ContactDetail.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6078    @Description(shortDefinition="Who authored the content", formalDefinition="An individiual or organization primarily involved in the creation and maintenance of the content." )
6079    protected List<ContactDetail> author;
6080
6081    /**
6082     * An individual or organization primarily responsible for internal coherence of the content.
6083     */
6084    @Child(name = "editor", type = {ContactDetail.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6085    @Description(shortDefinition="Who edited the content", formalDefinition="An individual or organization primarily responsible for internal coherence of the content." )
6086    protected List<ContactDetail> editor;
6087
6088    /**
6089     * An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the content.
6090     */
6091    @Child(name = "reviewer", type = {ContactDetail.class}, order=27, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6092    @Description(shortDefinition="Who reviewed the content", formalDefinition="An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the content." )
6093    protected List<ContactDetail> reviewer;
6094
6095    /**
6096     * An individual or organization asserted by the publisher to be responsible for officially endorsing the content for use in some setting.
6097     */
6098    @Child(name = "endorser", type = {ContactDetail.class}, order=28, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6099    @Description(shortDefinition="Who endorsed the content", formalDefinition="An individual or organization asserted by the publisher to be responsible for officially endorsing the content for use in some setting." )
6100    protected List<ContactDetail> endorser;
6101
6102    /**
6103     * Related artifacts such as additional documentation, justification, or bibliographic references.
6104     */
6105    @Child(name = "relatedArtifact", type = {RelatedArtifact.class}, order=29, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6106    @Description(shortDefinition="Additional documentation, citations", formalDefinition="Related artifacts such as additional documentation, justification, or bibliographic references." )
6107    protected List<RelatedArtifact> relatedArtifact;
6108
6109    /**
6110     * A reference to a Library resource containing any formal logic used by the plan definition.
6111     */
6112    @Child(name = "library", type = {CanonicalType.class}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6113    @Description(shortDefinition="Logic used by the plan definition", formalDefinition="A reference to a Library resource containing any formal logic used by the plan definition." )
6114    protected List<CanonicalType> library;
6115
6116    /**
6117     * A goal describes an expected outcome that activities within the plan are intended to achieve. For example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, meeting the acceptance criteria for a test as specified by a quality specification, etc.
6118     */
6119    @Child(name = "goal", type = {}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6120    @Description(shortDefinition="What the plan is trying to accomplish", formalDefinition="A goal describes an expected outcome that activities within the plan are intended to achieve. For example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, meeting the acceptance criteria for a test as specified by a quality specification, etc." )
6121    protected List<PlanDefinitionGoalComponent> goal;
6122
6123    /**
6124     * Actors represent the individuals or groups involved in the execution of the defined set of activities.
6125     */
6126    @Child(name = "actor", type = {}, order=32, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6127    @Description(shortDefinition="Actors within the plan", formalDefinition="Actors represent the individuals or groups involved in the execution of the defined set of activities." )
6128    protected List<PlanDefinitionActorComponent> actor;
6129
6130    /**
6131     * An action or group of actions to be taken as part of the plan. For example, in clinical care, an action would be to prescribe a particular indicated medication, or perform a particular test as appropriate. In pharmaceutical quality, an action would be the test that needs to be performed on a drug product as defined in the quality specification.
6132     */
6133    @Child(name = "action", type = {}, order=33, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6134    @Description(shortDefinition="Action defined by the plan", formalDefinition="An action or group of actions to be taken as part of the plan. For example, in clinical care, an action would be to prescribe a particular indicated medication, or perform a particular test as appropriate. In pharmaceutical quality, an action would be the test that needs to be performed on a drug product as defined in the quality specification." )
6135    protected List<PlanDefinitionActionComponent> action;
6136
6137    /**
6138     * If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example "pain", "on flare-up", etc.
6139     */
6140    @Child(name = "asNeeded", type = {BooleanType.class, CodeableConcept.class}, order=34, min=0, max=1, modifier=false, summary=true)
6141    @Description(shortDefinition="Preconditions for service", formalDefinition="If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example \"pain\", \"on flare-up\", etc." )
6142    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-as-needed-reason")
6143    protected DataType asNeeded;
6144
6145    private static final long serialVersionUID = 324754414L;
6146
6147  /**
6148   * Constructor
6149   */
6150    public PlanDefinition() {
6151      super();
6152    }
6153
6154  /**
6155   * Constructor
6156   */
6157    public PlanDefinition(PublicationStatus status) {
6158      super();
6159      this.setStatus(status);
6160    }
6161
6162    /**
6163     * @return {@link #url} (An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
6164     */
6165    public UriType getUrlElement() { 
6166      if (this.url == null)
6167        if (Configuration.errorOnAutoCreate())
6168          throw new Error("Attempt to auto-create PlanDefinition.url");
6169        else if (Configuration.doAutoCreate())
6170          this.url = new UriType(); // bb
6171      return this.url;
6172    }
6173
6174    public boolean hasUrlElement() { 
6175      return this.url != null && !this.url.isEmpty();
6176    }
6177
6178    public boolean hasUrl() { 
6179      return this.url != null && !this.url.isEmpty();
6180    }
6181
6182    /**
6183     * @param value {@link #url} (An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
6184     */
6185    public PlanDefinition setUrlElement(UriType value) { 
6186      this.url = value;
6187      return this;
6188    }
6189
6190    /**
6191     * @return An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.
6192     */
6193    public String getUrl() { 
6194      return this.url == null ? null : this.url.getValue();
6195    }
6196
6197    /**
6198     * @param value An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.
6199     */
6200    public PlanDefinition setUrl(String value) { 
6201      if (Utilities.noString(value))
6202        this.url = null;
6203      else {
6204        if (this.url == null)
6205          this.url = new UriType();
6206        this.url.setValue(value);
6207      }
6208      return this;
6209    }
6210
6211    /**
6212     * @return {@link #identifier} (A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance.)
6213     */
6214    public List<Identifier> getIdentifier() { 
6215      if (this.identifier == null)
6216        this.identifier = new ArrayList<Identifier>();
6217      return this.identifier;
6218    }
6219
6220    /**
6221     * @return Returns a reference to <code>this</code> for easy method chaining
6222     */
6223    public PlanDefinition setIdentifier(List<Identifier> theIdentifier) { 
6224      this.identifier = theIdentifier;
6225      return this;
6226    }
6227
6228    public boolean hasIdentifier() { 
6229      if (this.identifier == null)
6230        return false;
6231      for (Identifier item : this.identifier)
6232        if (!item.isEmpty())
6233          return true;
6234      return false;
6235    }
6236
6237    public Identifier addIdentifier() { //3
6238      Identifier t = new Identifier();
6239      if (this.identifier == null)
6240        this.identifier = new ArrayList<Identifier>();
6241      this.identifier.add(t);
6242      return t;
6243    }
6244
6245    public PlanDefinition addIdentifier(Identifier t) { //3
6246      if (t == null)
6247        return this;
6248      if (this.identifier == null)
6249        this.identifier = new ArrayList<Identifier>();
6250      this.identifier.add(t);
6251      return this;
6252    }
6253
6254    /**
6255     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
6256     */
6257    public Identifier getIdentifierFirstRep() { 
6258      if (getIdentifier().isEmpty()) {
6259        addIdentifier();
6260      }
6261      return getIdentifier().get(0);
6262    }
6263
6264    /**
6265     * @return {@link #version} (The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
6266     */
6267    public StringType getVersionElement() { 
6268      if (this.version == null)
6269        if (Configuration.errorOnAutoCreate())
6270          throw new Error("Attempt to auto-create PlanDefinition.version");
6271        else if (Configuration.doAutoCreate())
6272          this.version = new StringType(); // bb
6273      return this.version;
6274    }
6275
6276    public boolean hasVersionElement() { 
6277      return this.version != null && !this.version.isEmpty();
6278    }
6279
6280    public boolean hasVersion() { 
6281      return this.version != null && !this.version.isEmpty();
6282    }
6283
6284    /**
6285     * @param value {@link #version} (The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
6286     */
6287    public PlanDefinition setVersionElement(StringType value) { 
6288      this.version = value;
6289      return this;
6290    }
6291
6292    /**
6293     * @return The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.
6294     */
6295    public String getVersion() { 
6296      return this.version == null ? null : this.version.getValue();
6297    }
6298
6299    /**
6300     * @param value The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.
6301     */
6302    public PlanDefinition setVersion(String value) { 
6303      if (Utilities.noString(value))
6304        this.version = null;
6305      else {
6306        if (this.version == null)
6307          this.version = new StringType();
6308        this.version.setValue(value);
6309      }
6310      return this;
6311    }
6312
6313    /**
6314     * @return {@link #versionAlgorithm} (Indicates the mechanism used to compare versions to determine which is more current.)
6315     */
6316    public DataType getVersionAlgorithm() { 
6317      return this.versionAlgorithm;
6318    }
6319
6320    /**
6321     * @return {@link #versionAlgorithm} (Indicates the mechanism used to compare versions to determine which is more current.)
6322     */
6323    public StringType getVersionAlgorithmStringType() throws FHIRException { 
6324      if (this.versionAlgorithm == null)
6325        this.versionAlgorithm = new StringType();
6326      if (!(this.versionAlgorithm instanceof StringType))
6327        throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.versionAlgorithm.getClass().getName()+" was encountered");
6328      return (StringType) this.versionAlgorithm;
6329    }
6330
6331    public boolean hasVersionAlgorithmStringType() { 
6332      return this != null && this.versionAlgorithm instanceof StringType;
6333    }
6334
6335    /**
6336     * @return {@link #versionAlgorithm} (Indicates the mechanism used to compare versions to determine which is more current.)
6337     */
6338    public Coding getVersionAlgorithmCoding() throws FHIRException { 
6339      if (this.versionAlgorithm == null)
6340        this.versionAlgorithm = new Coding();
6341      if (!(this.versionAlgorithm instanceof Coding))
6342        throw new FHIRException("Type mismatch: the type Coding was expected, but "+this.versionAlgorithm.getClass().getName()+" was encountered");
6343      return (Coding) this.versionAlgorithm;
6344    }
6345
6346    public boolean hasVersionAlgorithmCoding() { 
6347      return this != null && this.versionAlgorithm instanceof Coding;
6348    }
6349
6350    public boolean hasVersionAlgorithm() { 
6351      return this.versionAlgorithm != null && !this.versionAlgorithm.isEmpty();
6352    }
6353
6354    /**
6355     * @param value {@link #versionAlgorithm} (Indicates the mechanism used to compare versions to determine which is more current.)
6356     */
6357    public PlanDefinition setVersionAlgorithm(DataType value) { 
6358      if (value != null && !(value instanceof StringType || value instanceof Coding))
6359        throw new FHIRException("Not the right type for PlanDefinition.versionAlgorithm[x]: "+value.fhirType());
6360      this.versionAlgorithm = value;
6361      return this;
6362    }
6363
6364    /**
6365     * @return {@link #name} (A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
6366     */
6367    public StringType getNameElement() { 
6368      if (this.name == null)
6369        if (Configuration.errorOnAutoCreate())
6370          throw new Error("Attempt to auto-create PlanDefinition.name");
6371        else if (Configuration.doAutoCreate())
6372          this.name = new StringType(); // bb
6373      return this.name;
6374    }
6375
6376    public boolean hasNameElement() { 
6377      return this.name != null && !this.name.isEmpty();
6378    }
6379
6380    public boolean hasName() { 
6381      return this.name != null && !this.name.isEmpty();
6382    }
6383
6384    /**
6385     * @param value {@link #name} (A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
6386     */
6387    public PlanDefinition setNameElement(StringType value) { 
6388      this.name = value;
6389      return this;
6390    }
6391
6392    /**
6393     * @return A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
6394     */
6395    public String getName() { 
6396      return this.name == null ? null : this.name.getValue();
6397    }
6398
6399    /**
6400     * @param value A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
6401     */
6402    public PlanDefinition setName(String value) { 
6403      if (Utilities.noString(value))
6404        this.name = null;
6405      else {
6406        if (this.name == null)
6407          this.name = new StringType();
6408        this.name.setValue(value);
6409      }
6410      return this;
6411    }
6412
6413    /**
6414     * @return {@link #title} (A short, descriptive, user-friendly title for the plan definition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
6415     */
6416    public StringType getTitleElement() { 
6417      if (this.title == null)
6418        if (Configuration.errorOnAutoCreate())
6419          throw new Error("Attempt to auto-create PlanDefinition.title");
6420        else if (Configuration.doAutoCreate())
6421          this.title = new StringType(); // bb
6422      return this.title;
6423    }
6424
6425    public boolean hasTitleElement() { 
6426      return this.title != null && !this.title.isEmpty();
6427    }
6428
6429    public boolean hasTitle() { 
6430      return this.title != null && !this.title.isEmpty();
6431    }
6432
6433    /**
6434     * @param value {@link #title} (A short, descriptive, user-friendly title for the plan definition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
6435     */
6436    public PlanDefinition setTitleElement(StringType value) { 
6437      this.title = value;
6438      return this;
6439    }
6440
6441    /**
6442     * @return A short, descriptive, user-friendly title for the plan definition.
6443     */
6444    public String getTitle() { 
6445      return this.title == null ? null : this.title.getValue();
6446    }
6447
6448    /**
6449     * @param value A short, descriptive, user-friendly title for the plan definition.
6450     */
6451    public PlanDefinition setTitle(String value) { 
6452      if (Utilities.noString(value))
6453        this.title = null;
6454      else {
6455        if (this.title == null)
6456          this.title = new StringType();
6457        this.title.setValue(value);
6458      }
6459      return this;
6460    }
6461
6462    /**
6463     * @return {@link #subtitle} (An explanatory or alternate title for the plan definition giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getSubtitle" gives direct access to the value
6464     */
6465    public StringType getSubtitleElement() { 
6466      if (this.subtitle == null)
6467        if (Configuration.errorOnAutoCreate())
6468          throw new Error("Attempt to auto-create PlanDefinition.subtitle");
6469        else if (Configuration.doAutoCreate())
6470          this.subtitle = new StringType(); // bb
6471      return this.subtitle;
6472    }
6473
6474    public boolean hasSubtitleElement() { 
6475      return this.subtitle != null && !this.subtitle.isEmpty();
6476    }
6477
6478    public boolean hasSubtitle() { 
6479      return this.subtitle != null && !this.subtitle.isEmpty();
6480    }
6481
6482    /**
6483     * @param value {@link #subtitle} (An explanatory or alternate title for the plan definition giving additional information about its content.). This is the underlying object with id, value and extensions. The accessor "getSubtitle" gives direct access to the value
6484     */
6485    public PlanDefinition setSubtitleElement(StringType value) { 
6486      this.subtitle = value;
6487      return this;
6488    }
6489
6490    /**
6491     * @return An explanatory or alternate title for the plan definition giving additional information about its content.
6492     */
6493    public String getSubtitle() { 
6494      return this.subtitle == null ? null : this.subtitle.getValue();
6495    }
6496
6497    /**
6498     * @param value An explanatory or alternate title for the plan definition giving additional information about its content.
6499     */
6500    public PlanDefinition setSubtitle(String value) { 
6501      if (Utilities.noString(value))
6502        this.subtitle = null;
6503      else {
6504        if (this.subtitle == null)
6505          this.subtitle = new StringType();
6506        this.subtitle.setValue(value);
6507      }
6508      return this;
6509    }
6510
6511    /**
6512     * @return {@link #type} (A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition.)
6513     */
6514    public CodeableConcept getType() { 
6515      if (this.type == null)
6516        if (Configuration.errorOnAutoCreate())
6517          throw new Error("Attempt to auto-create PlanDefinition.type");
6518        else if (Configuration.doAutoCreate())
6519          this.type = new CodeableConcept(); // cc
6520      return this.type;
6521    }
6522
6523    public boolean hasType() { 
6524      return this.type != null && !this.type.isEmpty();
6525    }
6526
6527    /**
6528     * @param value {@link #type} (A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition.)
6529     */
6530    public PlanDefinition setType(CodeableConcept value) { 
6531      this.type = value;
6532      return this;
6533    }
6534
6535    /**
6536     * @return {@link #status} (The status of this plan definition. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
6537     */
6538    public Enumeration<PublicationStatus> getStatusElement() { 
6539      if (this.status == null)
6540        if (Configuration.errorOnAutoCreate())
6541          throw new Error("Attempt to auto-create PlanDefinition.status");
6542        else if (Configuration.doAutoCreate())
6543          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
6544      return this.status;
6545    }
6546
6547    public boolean hasStatusElement() { 
6548      return this.status != null && !this.status.isEmpty();
6549    }
6550
6551    public boolean hasStatus() { 
6552      return this.status != null && !this.status.isEmpty();
6553    }
6554
6555    /**
6556     * @param value {@link #status} (The status of this plan definition. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
6557     */
6558    public PlanDefinition setStatusElement(Enumeration<PublicationStatus> value) { 
6559      this.status = value;
6560      return this;
6561    }
6562
6563    /**
6564     * @return The status of this plan definition. Enables tracking the life-cycle of the content.
6565     */
6566    public PublicationStatus getStatus() { 
6567      return this.status == null ? null : this.status.getValue();
6568    }
6569
6570    /**
6571     * @param value The status of this plan definition. Enables tracking the life-cycle of the content.
6572     */
6573    public PlanDefinition setStatus(PublicationStatus value) { 
6574        if (this.status == null)
6575          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
6576        this.status.setValue(value);
6577      return this;
6578    }
6579
6580    /**
6581     * @return {@link #experimental} (A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
6582     */
6583    public BooleanType getExperimentalElement() { 
6584      if (this.experimental == null)
6585        if (Configuration.errorOnAutoCreate())
6586          throw new Error("Attempt to auto-create PlanDefinition.experimental");
6587        else if (Configuration.doAutoCreate())
6588          this.experimental = new BooleanType(); // bb
6589      return this.experimental;
6590    }
6591
6592    public boolean hasExperimentalElement() { 
6593      return this.experimental != null && !this.experimental.isEmpty();
6594    }
6595
6596    public boolean hasExperimental() { 
6597      return this.experimental != null && !this.experimental.isEmpty();
6598    }
6599
6600    /**
6601     * @param value {@link #experimental} (A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
6602     */
6603    public PlanDefinition setExperimentalElement(BooleanType value) { 
6604      this.experimental = value;
6605      return this;
6606    }
6607
6608    /**
6609     * @return A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
6610     */
6611    public boolean getExperimental() { 
6612      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
6613    }
6614
6615    /**
6616     * @param value A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.
6617     */
6618    public PlanDefinition setExperimental(boolean value) { 
6619        if (this.experimental == null)
6620          this.experimental = new BooleanType();
6621        this.experimental.setValue(value);
6622      return this;
6623    }
6624
6625    /**
6626     * @return {@link #subject} (A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.)
6627     */
6628    public DataType getSubject() { 
6629      return this.subject;
6630    }
6631
6632    /**
6633     * @return {@link #subject} (A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.)
6634     */
6635    public CodeableConcept getSubjectCodeableConcept() throws FHIRException { 
6636      if (this.subject == null)
6637        this.subject = new CodeableConcept();
6638      if (!(this.subject instanceof CodeableConcept))
6639        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.subject.getClass().getName()+" was encountered");
6640      return (CodeableConcept) this.subject;
6641    }
6642
6643    public boolean hasSubjectCodeableConcept() { 
6644      return this != null && this.subject instanceof CodeableConcept;
6645    }
6646
6647    /**
6648     * @return {@link #subject} (A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.)
6649     */
6650    public Reference getSubjectReference() throws FHIRException { 
6651      if (this.subject == null)
6652        this.subject = new Reference();
6653      if (!(this.subject instanceof Reference))
6654        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.subject.getClass().getName()+" was encountered");
6655      return (Reference) this.subject;
6656    }
6657
6658    public boolean hasSubjectReference() { 
6659      return this != null && this.subject instanceof Reference;
6660    }
6661
6662    /**
6663     * @return {@link #subject} (A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.)
6664     */
6665    public CanonicalType getSubjectCanonicalType() throws FHIRException { 
6666      if (this.subject == null)
6667        this.subject = new CanonicalType();
6668      if (!(this.subject instanceof CanonicalType))
6669        throw new FHIRException("Type mismatch: the type CanonicalType was expected, but "+this.subject.getClass().getName()+" was encountered");
6670      return (CanonicalType) this.subject;
6671    }
6672
6673    public boolean hasSubjectCanonicalType() { 
6674      return this != null && this.subject instanceof CanonicalType;
6675    }
6676
6677    public boolean hasSubject() { 
6678      return this.subject != null && !this.subject.isEmpty();
6679    }
6680
6681    /**
6682     * @param value {@link #subject} (A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.)
6683     */
6684    public PlanDefinition setSubject(DataType value) { 
6685      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference || value instanceof CanonicalType))
6686        throw new FHIRException("Not the right type for PlanDefinition.subject[x]: "+value.fhirType());
6687      this.subject = value;
6688      return this;
6689    }
6690
6691    /**
6692     * @return {@link #date} (The date  (and optionally time) when the plan definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
6693     */
6694    public DateTimeType getDateElement() { 
6695      if (this.date == null)
6696        if (Configuration.errorOnAutoCreate())
6697          throw new Error("Attempt to auto-create PlanDefinition.date");
6698        else if (Configuration.doAutoCreate())
6699          this.date = new DateTimeType(); // bb
6700      return this.date;
6701    }
6702
6703    public boolean hasDateElement() { 
6704      return this.date != null && !this.date.isEmpty();
6705    }
6706
6707    public boolean hasDate() { 
6708      return this.date != null && !this.date.isEmpty();
6709    }
6710
6711    /**
6712     * @param value {@link #date} (The date  (and optionally time) when the plan definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
6713     */
6714    public PlanDefinition setDateElement(DateTimeType value) { 
6715      this.date = value;
6716      return this;
6717    }
6718
6719    /**
6720     * @return The date  (and optionally time) when the plan definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.
6721     */
6722    public Date getDate() { 
6723      return this.date == null ? null : this.date.getValue();
6724    }
6725
6726    /**
6727     * @param value The date  (and optionally time) when the plan definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.
6728     */
6729    public PlanDefinition setDate(Date value) { 
6730      if (value == null)
6731        this.date = null;
6732      else {
6733        if (this.date == null)
6734          this.date = new DateTimeType();
6735        this.date.setValue(value);
6736      }
6737      return this;
6738    }
6739
6740    /**
6741     * @return {@link #publisher} (The name of the organization or individual responsible for the release and ongoing maintenance of the plan definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
6742     */
6743    public StringType getPublisherElement() { 
6744      if (this.publisher == null)
6745        if (Configuration.errorOnAutoCreate())
6746          throw new Error("Attempt to auto-create PlanDefinition.publisher");
6747        else if (Configuration.doAutoCreate())
6748          this.publisher = new StringType(); // bb
6749      return this.publisher;
6750    }
6751
6752    public boolean hasPublisherElement() { 
6753      return this.publisher != null && !this.publisher.isEmpty();
6754    }
6755
6756    public boolean hasPublisher() { 
6757      return this.publisher != null && !this.publisher.isEmpty();
6758    }
6759
6760    /**
6761     * @param value {@link #publisher} (The name of the organization or individual responsible for the release and ongoing maintenance of the plan definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
6762     */
6763    public PlanDefinition setPublisherElement(StringType value) { 
6764      this.publisher = value;
6765      return this;
6766    }
6767
6768    /**
6769     * @return The name of the organization or individual responsible for the release and ongoing maintenance of the plan definition.
6770     */
6771    public String getPublisher() { 
6772      return this.publisher == null ? null : this.publisher.getValue();
6773    }
6774
6775    /**
6776     * @param value The name of the organization or individual responsible for the release and ongoing maintenance of the plan definition.
6777     */
6778    public PlanDefinition setPublisher(String value) { 
6779      if (Utilities.noString(value))
6780        this.publisher = null;
6781      else {
6782        if (this.publisher == null)
6783          this.publisher = new StringType();
6784        this.publisher.setValue(value);
6785      }
6786      return this;
6787    }
6788
6789    /**
6790     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
6791     */
6792    public List<ContactDetail> getContact() { 
6793      if (this.contact == null)
6794        this.contact = new ArrayList<ContactDetail>();
6795      return this.contact;
6796    }
6797
6798    /**
6799     * @return Returns a reference to <code>this</code> for easy method chaining
6800     */
6801    public PlanDefinition setContact(List<ContactDetail> theContact) { 
6802      this.contact = theContact;
6803      return this;
6804    }
6805
6806    public boolean hasContact() { 
6807      if (this.contact == null)
6808        return false;
6809      for (ContactDetail item : this.contact)
6810        if (!item.isEmpty())
6811          return true;
6812      return false;
6813    }
6814
6815    public ContactDetail addContact() { //3
6816      ContactDetail t = new ContactDetail();
6817      if (this.contact == null)
6818        this.contact = new ArrayList<ContactDetail>();
6819      this.contact.add(t);
6820      return t;
6821    }
6822
6823    public PlanDefinition addContact(ContactDetail t) { //3
6824      if (t == null)
6825        return this;
6826      if (this.contact == null)
6827        this.contact = new ArrayList<ContactDetail>();
6828      this.contact.add(t);
6829      return this;
6830    }
6831
6832    /**
6833     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
6834     */
6835    public ContactDetail getContactFirstRep() { 
6836      if (getContact().isEmpty()) {
6837        addContact();
6838      }
6839      return getContact().get(0);
6840    }
6841
6842    /**
6843     * @return {@link #description} (A free text natural language description of the plan definition from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
6844     */
6845    public MarkdownType getDescriptionElement() { 
6846      if (this.description == null)
6847        if (Configuration.errorOnAutoCreate())
6848          throw new Error("Attempt to auto-create PlanDefinition.description");
6849        else if (Configuration.doAutoCreate())
6850          this.description = new MarkdownType(); // bb
6851      return this.description;
6852    }
6853
6854    public boolean hasDescriptionElement() { 
6855      return this.description != null && !this.description.isEmpty();
6856    }
6857
6858    public boolean hasDescription() { 
6859      return this.description != null && !this.description.isEmpty();
6860    }
6861
6862    /**
6863     * @param value {@link #description} (A free text natural language description of the plan definition from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
6864     */
6865    public PlanDefinition setDescriptionElement(MarkdownType value) { 
6866      this.description = value;
6867      return this;
6868    }
6869
6870    /**
6871     * @return A free text natural language description of the plan definition from a consumer's perspective.
6872     */
6873    public String getDescription() { 
6874      return this.description == null ? null : this.description.getValue();
6875    }
6876
6877    /**
6878     * @param value A free text natural language description of the plan definition from a consumer's perspective.
6879     */
6880    public PlanDefinition setDescription(String value) { 
6881      if (Utilities.noString(value))
6882        this.description = null;
6883      else {
6884        if (this.description == null)
6885          this.description = new MarkdownType();
6886        this.description.setValue(value);
6887      }
6888      return this;
6889    }
6890
6891    /**
6892     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate plan definition instances.)
6893     */
6894    public List<UsageContext> getUseContext() { 
6895      if (this.useContext == null)
6896        this.useContext = new ArrayList<UsageContext>();
6897      return this.useContext;
6898    }
6899
6900    /**
6901     * @return Returns a reference to <code>this</code> for easy method chaining
6902     */
6903    public PlanDefinition setUseContext(List<UsageContext> theUseContext) { 
6904      this.useContext = theUseContext;
6905      return this;
6906    }
6907
6908    public boolean hasUseContext() { 
6909      if (this.useContext == null)
6910        return false;
6911      for (UsageContext item : this.useContext)
6912        if (!item.isEmpty())
6913          return true;
6914      return false;
6915    }
6916
6917    public UsageContext addUseContext() { //3
6918      UsageContext t = new UsageContext();
6919      if (this.useContext == null)
6920        this.useContext = new ArrayList<UsageContext>();
6921      this.useContext.add(t);
6922      return t;
6923    }
6924
6925    public PlanDefinition addUseContext(UsageContext t) { //3
6926      if (t == null)
6927        return this;
6928      if (this.useContext == null)
6929        this.useContext = new ArrayList<UsageContext>();
6930      this.useContext.add(t);
6931      return this;
6932    }
6933
6934    /**
6935     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist {3}
6936     */
6937    public UsageContext getUseContextFirstRep() { 
6938      if (getUseContext().isEmpty()) {
6939        addUseContext();
6940      }
6941      return getUseContext().get(0);
6942    }
6943
6944    /**
6945     * @return {@link #jurisdiction} (A legal or geographic region in which the plan definition is intended to be used.)
6946     */
6947    public List<CodeableConcept> getJurisdiction() { 
6948      if (this.jurisdiction == null)
6949        this.jurisdiction = new ArrayList<CodeableConcept>();
6950      return this.jurisdiction;
6951    }
6952
6953    /**
6954     * @return Returns a reference to <code>this</code> for easy method chaining
6955     */
6956    public PlanDefinition setJurisdiction(List<CodeableConcept> theJurisdiction) { 
6957      this.jurisdiction = theJurisdiction;
6958      return this;
6959    }
6960
6961    public boolean hasJurisdiction() { 
6962      if (this.jurisdiction == null)
6963        return false;
6964      for (CodeableConcept item : this.jurisdiction)
6965        if (!item.isEmpty())
6966          return true;
6967      return false;
6968    }
6969
6970    public CodeableConcept addJurisdiction() { //3
6971      CodeableConcept t = new CodeableConcept();
6972      if (this.jurisdiction == null)
6973        this.jurisdiction = new ArrayList<CodeableConcept>();
6974      this.jurisdiction.add(t);
6975      return t;
6976    }
6977
6978    public PlanDefinition addJurisdiction(CodeableConcept t) { //3
6979      if (t == null)
6980        return this;
6981      if (this.jurisdiction == null)
6982        this.jurisdiction = new ArrayList<CodeableConcept>();
6983      this.jurisdiction.add(t);
6984      return this;
6985    }
6986
6987    /**
6988     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist {3}
6989     */
6990    public CodeableConcept getJurisdictionFirstRep() { 
6991      if (getJurisdiction().isEmpty()) {
6992        addJurisdiction();
6993      }
6994      return getJurisdiction().get(0);
6995    }
6996
6997    /**
6998     * @return {@link #purpose} (Explanation of why this plan definition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
6999     */
7000    public MarkdownType getPurposeElement() { 
7001      if (this.purpose == null)
7002        if (Configuration.errorOnAutoCreate())
7003          throw new Error("Attempt to auto-create PlanDefinition.purpose");
7004        else if (Configuration.doAutoCreate())
7005          this.purpose = new MarkdownType(); // bb
7006      return this.purpose;
7007    }
7008
7009    public boolean hasPurposeElement() { 
7010      return this.purpose != null && !this.purpose.isEmpty();
7011    }
7012
7013    public boolean hasPurpose() { 
7014      return this.purpose != null && !this.purpose.isEmpty();
7015    }
7016
7017    /**
7018     * @param value {@link #purpose} (Explanation of why this plan definition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
7019     */
7020    public PlanDefinition setPurposeElement(MarkdownType value) { 
7021      this.purpose = value;
7022      return this;
7023    }
7024
7025    /**
7026     * @return Explanation of why this plan definition is needed and why it has been designed as it has.
7027     */
7028    public String getPurpose() { 
7029      return this.purpose == null ? null : this.purpose.getValue();
7030    }
7031
7032    /**
7033     * @param value Explanation of why this plan definition is needed and why it has been designed as it has.
7034     */
7035    public PlanDefinition setPurpose(String value) { 
7036      if (Utilities.noString(value))
7037        this.purpose = null;
7038      else {
7039        if (this.purpose == null)
7040          this.purpose = new MarkdownType();
7041        this.purpose.setValue(value);
7042      }
7043      return this;
7044    }
7045
7046    /**
7047     * @return {@link #usage} (A detailed description of how the plan definition is used from a clinical perspective.). This is the underlying object with id, value and extensions. The accessor "getUsage" gives direct access to the value
7048     */
7049    public MarkdownType getUsageElement() { 
7050      if (this.usage == null)
7051        if (Configuration.errorOnAutoCreate())
7052          throw new Error("Attempt to auto-create PlanDefinition.usage");
7053        else if (Configuration.doAutoCreate())
7054          this.usage = new MarkdownType(); // bb
7055      return this.usage;
7056    }
7057
7058    public boolean hasUsageElement() { 
7059      return this.usage != null && !this.usage.isEmpty();
7060    }
7061
7062    public boolean hasUsage() { 
7063      return this.usage != null && !this.usage.isEmpty();
7064    }
7065
7066    /**
7067     * @param value {@link #usage} (A detailed description of how the plan definition is used from a clinical perspective.). This is the underlying object with id, value and extensions. The accessor "getUsage" gives direct access to the value
7068     */
7069    public PlanDefinition setUsageElement(MarkdownType value) { 
7070      this.usage = value;
7071      return this;
7072    }
7073
7074    /**
7075     * @return A detailed description of how the plan definition is used from a clinical perspective.
7076     */
7077    public String getUsage() { 
7078      return this.usage == null ? null : this.usage.getValue();
7079    }
7080
7081    /**
7082     * @param value A detailed description of how the plan definition is used from a clinical perspective.
7083     */
7084    public PlanDefinition setUsage(String value) { 
7085      if (Utilities.noString(value))
7086        this.usage = null;
7087      else {
7088        if (this.usage == null)
7089          this.usage = new MarkdownType();
7090        this.usage.setValue(value);
7091      }
7092      return this;
7093    }
7094
7095    /**
7096     * @return {@link #copyright} (A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
7097     */
7098    public MarkdownType getCopyrightElement() { 
7099      if (this.copyright == null)
7100        if (Configuration.errorOnAutoCreate())
7101          throw new Error("Attempt to auto-create PlanDefinition.copyright");
7102        else if (Configuration.doAutoCreate())
7103          this.copyright = new MarkdownType(); // bb
7104      return this.copyright;
7105    }
7106
7107    public boolean hasCopyrightElement() { 
7108      return this.copyright != null && !this.copyright.isEmpty();
7109    }
7110
7111    public boolean hasCopyright() { 
7112      return this.copyright != null && !this.copyright.isEmpty();
7113    }
7114
7115    /**
7116     * @param value {@link #copyright} (A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
7117     */
7118    public PlanDefinition setCopyrightElement(MarkdownType value) { 
7119      this.copyright = value;
7120      return this;
7121    }
7122
7123    /**
7124     * @return A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.
7125     */
7126    public String getCopyright() { 
7127      return this.copyright == null ? null : this.copyright.getValue();
7128    }
7129
7130    /**
7131     * @param value A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.
7132     */
7133    public PlanDefinition setCopyright(String value) { 
7134      if (Utilities.noString(value))
7135        this.copyright = null;
7136      else {
7137        if (this.copyright == null)
7138          this.copyright = new MarkdownType();
7139        this.copyright.setValue(value);
7140      }
7141      return this;
7142    }
7143
7144    /**
7145     * @return {@link #copyrightLabel} (A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').). This is the underlying object with id, value and extensions. The accessor "getCopyrightLabel" gives direct access to the value
7146     */
7147    public StringType getCopyrightLabelElement() { 
7148      if (this.copyrightLabel == null)
7149        if (Configuration.errorOnAutoCreate())
7150          throw new Error("Attempt to auto-create PlanDefinition.copyrightLabel");
7151        else if (Configuration.doAutoCreate())
7152          this.copyrightLabel = new StringType(); // bb
7153      return this.copyrightLabel;
7154    }
7155
7156    public boolean hasCopyrightLabelElement() { 
7157      return this.copyrightLabel != null && !this.copyrightLabel.isEmpty();
7158    }
7159
7160    public boolean hasCopyrightLabel() { 
7161      return this.copyrightLabel != null && !this.copyrightLabel.isEmpty();
7162    }
7163
7164    /**
7165     * @param value {@link #copyrightLabel} (A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').). This is the underlying object with id, value and extensions. The accessor "getCopyrightLabel" gives direct access to the value
7166     */
7167    public PlanDefinition setCopyrightLabelElement(StringType value) { 
7168      this.copyrightLabel = value;
7169      return this;
7170    }
7171
7172    /**
7173     * @return A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').
7174     */
7175    public String getCopyrightLabel() { 
7176      return this.copyrightLabel == null ? null : this.copyrightLabel.getValue();
7177    }
7178
7179    /**
7180     * @param value A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').
7181     */
7182    public PlanDefinition setCopyrightLabel(String value) { 
7183      if (Utilities.noString(value))
7184        this.copyrightLabel = null;
7185      else {
7186        if (this.copyrightLabel == null)
7187          this.copyrightLabel = new StringType();
7188        this.copyrightLabel.setValue(value);
7189      }
7190      return this;
7191    }
7192
7193    /**
7194     * @return {@link #approvalDate} (The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
7195     */
7196    public DateType getApprovalDateElement() { 
7197      if (this.approvalDate == null)
7198        if (Configuration.errorOnAutoCreate())
7199          throw new Error("Attempt to auto-create PlanDefinition.approvalDate");
7200        else if (Configuration.doAutoCreate())
7201          this.approvalDate = new DateType(); // bb
7202      return this.approvalDate;
7203    }
7204
7205    public boolean hasApprovalDateElement() { 
7206      return this.approvalDate != null && !this.approvalDate.isEmpty();
7207    }
7208
7209    public boolean hasApprovalDate() { 
7210      return this.approvalDate != null && !this.approvalDate.isEmpty();
7211    }
7212
7213    /**
7214     * @param value {@link #approvalDate} (The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.). This is the underlying object with id, value and extensions. The accessor "getApprovalDate" gives direct access to the value
7215     */
7216    public PlanDefinition setApprovalDateElement(DateType value) { 
7217      this.approvalDate = value;
7218      return this;
7219    }
7220
7221    /**
7222     * @return The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
7223     */
7224    public Date getApprovalDate() { 
7225      return this.approvalDate == null ? null : this.approvalDate.getValue();
7226    }
7227
7228    /**
7229     * @param value The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.
7230     */
7231    public PlanDefinition setApprovalDate(Date value) { 
7232      if (value == null)
7233        this.approvalDate = null;
7234      else {
7235        if (this.approvalDate == null)
7236          this.approvalDate = new DateType();
7237        this.approvalDate.setValue(value);
7238      }
7239      return this;
7240    }
7241
7242    /**
7243     * @return {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
7244     */
7245    public DateType getLastReviewDateElement() { 
7246      if (this.lastReviewDate == null)
7247        if (Configuration.errorOnAutoCreate())
7248          throw new Error("Attempt to auto-create PlanDefinition.lastReviewDate");
7249        else if (Configuration.doAutoCreate())
7250          this.lastReviewDate = new DateType(); // bb
7251      return this.lastReviewDate;
7252    }
7253
7254    public boolean hasLastReviewDateElement() { 
7255      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
7256    }
7257
7258    public boolean hasLastReviewDate() { 
7259      return this.lastReviewDate != null && !this.lastReviewDate.isEmpty();
7260    }
7261
7262    /**
7263     * @param value {@link #lastReviewDate} (The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.). This is the underlying object with id, value and extensions. The accessor "getLastReviewDate" gives direct access to the value
7264     */
7265    public PlanDefinition setLastReviewDateElement(DateType value) { 
7266      this.lastReviewDate = value;
7267      return this;
7268    }
7269
7270    /**
7271     * @return The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
7272     */
7273    public Date getLastReviewDate() { 
7274      return this.lastReviewDate == null ? null : this.lastReviewDate.getValue();
7275    }
7276
7277    /**
7278     * @param value The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.
7279     */
7280    public PlanDefinition setLastReviewDate(Date value) { 
7281      if (value == null)
7282        this.lastReviewDate = null;
7283      else {
7284        if (this.lastReviewDate == null)
7285          this.lastReviewDate = new DateType();
7286        this.lastReviewDate.setValue(value);
7287      }
7288      return this;
7289    }
7290
7291    /**
7292     * @return {@link #effectivePeriod} (The period during which the plan definition content was or is planned to be in active use.)
7293     */
7294    public Period getEffectivePeriod() { 
7295      if (this.effectivePeriod == null)
7296        if (Configuration.errorOnAutoCreate())
7297          throw new Error("Attempt to auto-create PlanDefinition.effectivePeriod");
7298        else if (Configuration.doAutoCreate())
7299          this.effectivePeriod = new Period(); // cc
7300      return this.effectivePeriod;
7301    }
7302
7303    public boolean hasEffectivePeriod() { 
7304      return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
7305    }
7306
7307    /**
7308     * @param value {@link #effectivePeriod} (The period during which the plan definition content was or is planned to be in active use.)
7309     */
7310    public PlanDefinition setEffectivePeriod(Period value) { 
7311      this.effectivePeriod = value;
7312      return this;
7313    }
7314
7315    /**
7316     * @return {@link #topic} (Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching.)
7317     */
7318    public List<CodeableConcept> getTopic() { 
7319      if (this.topic == null)
7320        this.topic = new ArrayList<CodeableConcept>();
7321      return this.topic;
7322    }
7323
7324    /**
7325     * @return Returns a reference to <code>this</code> for easy method chaining
7326     */
7327    public PlanDefinition setTopic(List<CodeableConcept> theTopic) { 
7328      this.topic = theTopic;
7329      return this;
7330    }
7331
7332    public boolean hasTopic() { 
7333      if (this.topic == null)
7334        return false;
7335      for (CodeableConcept item : this.topic)
7336        if (!item.isEmpty())
7337          return true;
7338      return false;
7339    }
7340
7341    public CodeableConcept addTopic() { //3
7342      CodeableConcept t = new CodeableConcept();
7343      if (this.topic == null)
7344        this.topic = new ArrayList<CodeableConcept>();
7345      this.topic.add(t);
7346      return t;
7347    }
7348
7349    public PlanDefinition addTopic(CodeableConcept t) { //3
7350      if (t == null)
7351        return this;
7352      if (this.topic == null)
7353        this.topic = new ArrayList<CodeableConcept>();
7354      this.topic.add(t);
7355      return this;
7356    }
7357
7358    /**
7359     * @return The first repetition of repeating field {@link #topic}, creating it if it does not already exist {3}
7360     */
7361    public CodeableConcept getTopicFirstRep() { 
7362      if (getTopic().isEmpty()) {
7363        addTopic();
7364      }
7365      return getTopic().get(0);
7366    }
7367
7368    /**
7369     * @return {@link #author} (An individiual or organization primarily involved in the creation and maintenance of the content.)
7370     */
7371    public List<ContactDetail> getAuthor() { 
7372      if (this.author == null)
7373        this.author = new ArrayList<ContactDetail>();
7374      return this.author;
7375    }
7376
7377    /**
7378     * @return Returns a reference to <code>this</code> for easy method chaining
7379     */
7380    public PlanDefinition setAuthor(List<ContactDetail> theAuthor) { 
7381      this.author = theAuthor;
7382      return this;
7383    }
7384
7385    public boolean hasAuthor() { 
7386      if (this.author == null)
7387        return false;
7388      for (ContactDetail item : this.author)
7389        if (!item.isEmpty())
7390          return true;
7391      return false;
7392    }
7393
7394    public ContactDetail addAuthor() { //3
7395      ContactDetail t = new ContactDetail();
7396      if (this.author == null)
7397        this.author = new ArrayList<ContactDetail>();
7398      this.author.add(t);
7399      return t;
7400    }
7401
7402    public PlanDefinition addAuthor(ContactDetail t) { //3
7403      if (t == null)
7404        return this;
7405      if (this.author == null)
7406        this.author = new ArrayList<ContactDetail>();
7407      this.author.add(t);
7408      return this;
7409    }
7410
7411    /**
7412     * @return The first repetition of repeating field {@link #author}, creating it if it does not already exist {3}
7413     */
7414    public ContactDetail getAuthorFirstRep() { 
7415      if (getAuthor().isEmpty()) {
7416        addAuthor();
7417      }
7418      return getAuthor().get(0);
7419    }
7420
7421    /**
7422     * @return {@link #editor} (An individual or organization primarily responsible for internal coherence of the content.)
7423     */
7424    public List<ContactDetail> getEditor() { 
7425      if (this.editor == null)
7426        this.editor = new ArrayList<ContactDetail>();
7427      return this.editor;
7428    }
7429
7430    /**
7431     * @return Returns a reference to <code>this</code> for easy method chaining
7432     */
7433    public PlanDefinition setEditor(List<ContactDetail> theEditor) { 
7434      this.editor = theEditor;
7435      return this;
7436    }
7437
7438    public boolean hasEditor() { 
7439      if (this.editor == null)
7440        return false;
7441      for (ContactDetail item : this.editor)
7442        if (!item.isEmpty())
7443          return true;
7444      return false;
7445    }
7446
7447    public ContactDetail addEditor() { //3
7448      ContactDetail t = new ContactDetail();
7449      if (this.editor == null)
7450        this.editor = new ArrayList<ContactDetail>();
7451      this.editor.add(t);
7452      return t;
7453    }
7454
7455    public PlanDefinition addEditor(ContactDetail t) { //3
7456      if (t == null)
7457        return this;
7458      if (this.editor == null)
7459        this.editor = new ArrayList<ContactDetail>();
7460      this.editor.add(t);
7461      return this;
7462    }
7463
7464    /**
7465     * @return The first repetition of repeating field {@link #editor}, creating it if it does not already exist {3}
7466     */
7467    public ContactDetail getEditorFirstRep() { 
7468      if (getEditor().isEmpty()) {
7469        addEditor();
7470      }
7471      return getEditor().get(0);
7472    }
7473
7474    /**
7475     * @return {@link #reviewer} (An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the content.)
7476     */
7477    public List<ContactDetail> getReviewer() { 
7478      if (this.reviewer == null)
7479        this.reviewer = new ArrayList<ContactDetail>();
7480      return this.reviewer;
7481    }
7482
7483    /**
7484     * @return Returns a reference to <code>this</code> for easy method chaining
7485     */
7486    public PlanDefinition setReviewer(List<ContactDetail> theReviewer) { 
7487      this.reviewer = theReviewer;
7488      return this;
7489    }
7490
7491    public boolean hasReviewer() { 
7492      if (this.reviewer == null)
7493        return false;
7494      for (ContactDetail item : this.reviewer)
7495        if (!item.isEmpty())
7496          return true;
7497      return false;
7498    }
7499
7500    public ContactDetail addReviewer() { //3
7501      ContactDetail t = new ContactDetail();
7502      if (this.reviewer == null)
7503        this.reviewer = new ArrayList<ContactDetail>();
7504      this.reviewer.add(t);
7505      return t;
7506    }
7507
7508    public PlanDefinition addReviewer(ContactDetail t) { //3
7509      if (t == null)
7510        return this;
7511      if (this.reviewer == null)
7512        this.reviewer = new ArrayList<ContactDetail>();
7513      this.reviewer.add(t);
7514      return this;
7515    }
7516
7517    /**
7518     * @return The first repetition of repeating field {@link #reviewer}, creating it if it does not already exist {3}
7519     */
7520    public ContactDetail getReviewerFirstRep() { 
7521      if (getReviewer().isEmpty()) {
7522        addReviewer();
7523      }
7524      return getReviewer().get(0);
7525    }
7526
7527    /**
7528     * @return {@link #endorser} (An individual or organization asserted by the publisher to be responsible for officially endorsing the content for use in some setting.)
7529     */
7530    public List<ContactDetail> getEndorser() { 
7531      if (this.endorser == null)
7532        this.endorser = new ArrayList<ContactDetail>();
7533      return this.endorser;
7534    }
7535
7536    /**
7537     * @return Returns a reference to <code>this</code> for easy method chaining
7538     */
7539    public PlanDefinition setEndorser(List<ContactDetail> theEndorser) { 
7540      this.endorser = theEndorser;
7541      return this;
7542    }
7543
7544    public boolean hasEndorser() { 
7545      if (this.endorser == null)
7546        return false;
7547      for (ContactDetail item : this.endorser)
7548        if (!item.isEmpty())
7549          return true;
7550      return false;
7551    }
7552
7553    public ContactDetail addEndorser() { //3
7554      ContactDetail t = new ContactDetail();
7555      if (this.endorser == null)
7556        this.endorser = new ArrayList<ContactDetail>();
7557      this.endorser.add(t);
7558      return t;
7559    }
7560
7561    public PlanDefinition addEndorser(ContactDetail t) { //3
7562      if (t == null)
7563        return this;
7564      if (this.endorser == null)
7565        this.endorser = new ArrayList<ContactDetail>();
7566      this.endorser.add(t);
7567      return this;
7568    }
7569
7570    /**
7571     * @return The first repetition of repeating field {@link #endorser}, creating it if it does not already exist {3}
7572     */
7573    public ContactDetail getEndorserFirstRep() { 
7574      if (getEndorser().isEmpty()) {
7575        addEndorser();
7576      }
7577      return getEndorser().get(0);
7578    }
7579
7580    /**
7581     * @return {@link #relatedArtifact} (Related artifacts such as additional documentation, justification, or bibliographic references.)
7582     */
7583    public List<RelatedArtifact> getRelatedArtifact() { 
7584      if (this.relatedArtifact == null)
7585        this.relatedArtifact = new ArrayList<RelatedArtifact>();
7586      return this.relatedArtifact;
7587    }
7588
7589    /**
7590     * @return Returns a reference to <code>this</code> for easy method chaining
7591     */
7592    public PlanDefinition setRelatedArtifact(List<RelatedArtifact> theRelatedArtifact) { 
7593      this.relatedArtifact = theRelatedArtifact;
7594      return this;
7595    }
7596
7597    public boolean hasRelatedArtifact() { 
7598      if (this.relatedArtifact == null)
7599        return false;
7600      for (RelatedArtifact item : this.relatedArtifact)
7601        if (!item.isEmpty())
7602          return true;
7603      return false;
7604    }
7605
7606    public RelatedArtifact addRelatedArtifact() { //3
7607      RelatedArtifact t = new RelatedArtifact();
7608      if (this.relatedArtifact == null)
7609        this.relatedArtifact = new ArrayList<RelatedArtifact>();
7610      this.relatedArtifact.add(t);
7611      return t;
7612    }
7613
7614    public PlanDefinition addRelatedArtifact(RelatedArtifact t) { //3
7615      if (t == null)
7616        return this;
7617      if (this.relatedArtifact == null)
7618        this.relatedArtifact = new ArrayList<RelatedArtifact>();
7619      this.relatedArtifact.add(t);
7620      return this;
7621    }
7622
7623    /**
7624     * @return The first repetition of repeating field {@link #relatedArtifact}, creating it if it does not already exist {3}
7625     */
7626    public RelatedArtifact getRelatedArtifactFirstRep() { 
7627      if (getRelatedArtifact().isEmpty()) {
7628        addRelatedArtifact();
7629      }
7630      return getRelatedArtifact().get(0);
7631    }
7632
7633    /**
7634     * @return {@link #library} (A reference to a Library resource containing any formal logic used by the plan definition.)
7635     */
7636    public List<CanonicalType> getLibrary() { 
7637      if (this.library == null)
7638        this.library = new ArrayList<CanonicalType>();
7639      return this.library;
7640    }
7641
7642    /**
7643     * @return Returns a reference to <code>this</code> for easy method chaining
7644     */
7645    public PlanDefinition setLibrary(List<CanonicalType> theLibrary) { 
7646      this.library = theLibrary;
7647      return this;
7648    }
7649
7650    public boolean hasLibrary() { 
7651      if (this.library == null)
7652        return false;
7653      for (CanonicalType item : this.library)
7654        if (!item.isEmpty())
7655          return true;
7656      return false;
7657    }
7658
7659    /**
7660     * @return {@link #library} (A reference to a Library resource containing any formal logic used by the plan definition.)
7661     */
7662    public CanonicalType addLibraryElement() {//2 
7663      CanonicalType t = new CanonicalType();
7664      if (this.library == null)
7665        this.library = new ArrayList<CanonicalType>();
7666      this.library.add(t);
7667      return t;
7668    }
7669
7670    /**
7671     * @param value {@link #library} (A reference to a Library resource containing any formal logic used by the plan definition.)
7672     */
7673    public PlanDefinition addLibrary(String value) { //1
7674      CanonicalType t = new CanonicalType();
7675      t.setValue(value);
7676      if (this.library == null)
7677        this.library = new ArrayList<CanonicalType>();
7678      this.library.add(t);
7679      return this;
7680    }
7681
7682    /**
7683     * @param value {@link #library} (A reference to a Library resource containing any formal logic used by the plan definition.)
7684     */
7685    public boolean hasLibrary(String value) { 
7686      if (this.library == null)
7687        return false;
7688      for (CanonicalType v : this.library)
7689        if (v.getValue().equals(value)) // canonical
7690          return true;
7691      return false;
7692    }
7693
7694    /**
7695     * @return {@link #goal} (A goal describes an expected outcome that activities within the plan are intended to achieve. For example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, meeting the acceptance criteria for a test as specified by a quality specification, etc.)
7696     */
7697    public List<PlanDefinitionGoalComponent> getGoal() { 
7698      if (this.goal == null)
7699        this.goal = new ArrayList<PlanDefinitionGoalComponent>();
7700      return this.goal;
7701    }
7702
7703    /**
7704     * @return Returns a reference to <code>this</code> for easy method chaining
7705     */
7706    public PlanDefinition setGoal(List<PlanDefinitionGoalComponent> theGoal) { 
7707      this.goal = theGoal;
7708      return this;
7709    }
7710
7711    public boolean hasGoal() { 
7712      if (this.goal == null)
7713        return false;
7714      for (PlanDefinitionGoalComponent item : this.goal)
7715        if (!item.isEmpty())
7716          return true;
7717      return false;
7718    }
7719
7720    public PlanDefinitionGoalComponent addGoal() { //3
7721      PlanDefinitionGoalComponent t = new PlanDefinitionGoalComponent();
7722      if (this.goal == null)
7723        this.goal = new ArrayList<PlanDefinitionGoalComponent>();
7724      this.goal.add(t);
7725      return t;
7726    }
7727
7728    public PlanDefinition addGoal(PlanDefinitionGoalComponent t) { //3
7729      if (t == null)
7730        return this;
7731      if (this.goal == null)
7732        this.goal = new ArrayList<PlanDefinitionGoalComponent>();
7733      this.goal.add(t);
7734      return this;
7735    }
7736
7737    /**
7738     * @return The first repetition of repeating field {@link #goal}, creating it if it does not already exist {3}
7739     */
7740    public PlanDefinitionGoalComponent getGoalFirstRep() { 
7741      if (getGoal().isEmpty()) {
7742        addGoal();
7743      }
7744      return getGoal().get(0);
7745    }
7746
7747    /**
7748     * @return {@link #actor} (Actors represent the individuals or groups involved in the execution of the defined set of activities.)
7749     */
7750    public List<PlanDefinitionActorComponent> getActor() { 
7751      if (this.actor == null)
7752        this.actor = new ArrayList<PlanDefinitionActorComponent>();
7753      return this.actor;
7754    }
7755
7756    /**
7757     * @return Returns a reference to <code>this</code> for easy method chaining
7758     */
7759    public PlanDefinition setActor(List<PlanDefinitionActorComponent> theActor) { 
7760      this.actor = theActor;
7761      return this;
7762    }
7763
7764    public boolean hasActor() { 
7765      if (this.actor == null)
7766        return false;
7767      for (PlanDefinitionActorComponent item : this.actor)
7768        if (!item.isEmpty())
7769          return true;
7770      return false;
7771    }
7772
7773    public PlanDefinitionActorComponent addActor() { //3
7774      PlanDefinitionActorComponent t = new PlanDefinitionActorComponent();
7775      if (this.actor == null)
7776        this.actor = new ArrayList<PlanDefinitionActorComponent>();
7777      this.actor.add(t);
7778      return t;
7779    }
7780
7781    public PlanDefinition addActor(PlanDefinitionActorComponent t) { //3
7782      if (t == null)
7783        return this;
7784      if (this.actor == null)
7785        this.actor = new ArrayList<PlanDefinitionActorComponent>();
7786      this.actor.add(t);
7787      return this;
7788    }
7789
7790    /**
7791     * @return The first repetition of repeating field {@link #actor}, creating it if it does not already exist {3}
7792     */
7793    public PlanDefinitionActorComponent getActorFirstRep() { 
7794      if (getActor().isEmpty()) {
7795        addActor();
7796      }
7797      return getActor().get(0);
7798    }
7799
7800    /**
7801     * @return {@link #action} (An action or group of actions to be taken as part of the plan. For example, in clinical care, an action would be to prescribe a particular indicated medication, or perform a particular test as appropriate. In pharmaceutical quality, an action would be the test that needs to be performed on a drug product as defined in the quality specification.)
7802     */
7803    public List<PlanDefinitionActionComponent> getAction() { 
7804      if (this.action == null)
7805        this.action = new ArrayList<PlanDefinitionActionComponent>();
7806      return this.action;
7807    }
7808
7809    /**
7810     * @return Returns a reference to <code>this</code> for easy method chaining
7811     */
7812    public PlanDefinition setAction(List<PlanDefinitionActionComponent> theAction) { 
7813      this.action = theAction;
7814      return this;
7815    }
7816
7817    public boolean hasAction() { 
7818      if (this.action == null)
7819        return false;
7820      for (PlanDefinitionActionComponent item : this.action)
7821        if (!item.isEmpty())
7822          return true;
7823      return false;
7824    }
7825
7826    public PlanDefinitionActionComponent addAction() { //3
7827      PlanDefinitionActionComponent t = new PlanDefinitionActionComponent();
7828      if (this.action == null)
7829        this.action = new ArrayList<PlanDefinitionActionComponent>();
7830      this.action.add(t);
7831      return t;
7832    }
7833
7834    public PlanDefinition addAction(PlanDefinitionActionComponent t) { //3
7835      if (t == null)
7836        return this;
7837      if (this.action == null)
7838        this.action = new ArrayList<PlanDefinitionActionComponent>();
7839      this.action.add(t);
7840      return this;
7841    }
7842
7843    /**
7844     * @return The first repetition of repeating field {@link #action}, creating it if it does not already exist {3}
7845     */
7846    public PlanDefinitionActionComponent getActionFirstRep() { 
7847      if (getAction().isEmpty()) {
7848        addAction();
7849      }
7850      return getAction().get(0);
7851    }
7852
7853    /**
7854     * @return {@link #asNeeded} (If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example "pain", "on flare-up", etc.)
7855     */
7856    public DataType getAsNeeded() { 
7857      return this.asNeeded;
7858    }
7859
7860    /**
7861     * @return {@link #asNeeded} (If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example "pain", "on flare-up", etc.)
7862     */
7863    public BooleanType getAsNeededBooleanType() throws FHIRException { 
7864      if (this.asNeeded == null)
7865        this.asNeeded = new BooleanType();
7866      if (!(this.asNeeded instanceof BooleanType))
7867        throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.asNeeded.getClass().getName()+" was encountered");
7868      return (BooleanType) this.asNeeded;
7869    }
7870
7871    public boolean hasAsNeededBooleanType() { 
7872      return this != null && this.asNeeded instanceof BooleanType;
7873    }
7874
7875    /**
7876     * @return {@link #asNeeded} (If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example "pain", "on flare-up", etc.)
7877     */
7878    public CodeableConcept getAsNeededCodeableConcept() throws FHIRException { 
7879      if (this.asNeeded == null)
7880        this.asNeeded = new CodeableConcept();
7881      if (!(this.asNeeded instanceof CodeableConcept))
7882        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.asNeeded.getClass().getName()+" was encountered");
7883      return (CodeableConcept) this.asNeeded;
7884    }
7885
7886    public boolean hasAsNeededCodeableConcept() { 
7887      return this != null && this.asNeeded instanceof CodeableConcept;
7888    }
7889
7890    public boolean hasAsNeeded() { 
7891      return this.asNeeded != null && !this.asNeeded.isEmpty();
7892    }
7893
7894    /**
7895     * @param value {@link #asNeeded} (If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example "pain", "on flare-up", etc.)
7896     */
7897    public PlanDefinition setAsNeeded(DataType value) { 
7898      if (value != null && !(value instanceof BooleanType || value instanceof CodeableConcept))
7899        throw new FHIRException("Not the right type for PlanDefinition.asNeeded[x]: "+value.fhirType());
7900      this.asNeeded = value;
7901      return this;
7902    }
7903
7904      protected void listChildren(List<Property> children) {
7905        super.listChildren(children);
7906        children.add(new Property("url", "uri", "An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.", 0, 1, url));
7907        children.add(new Property("identifier", "Identifier", "A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
7908        children.add(new Property("version", "string", "The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.", 0, 1, version));
7909        children.add(new Property("versionAlgorithm[x]", "string|Coding", "Indicates the mechanism used to compare versions to determine which is more current.", 0, 1, versionAlgorithm));
7910        children.add(new Property("name", "string", "A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name));
7911        children.add(new Property("title", "string", "A short, descriptive, user-friendly title for the plan definition.", 0, 1, title));
7912        children.add(new Property("subtitle", "string", "An explanatory or alternate title for the plan definition giving additional information about its content.", 0, 1, subtitle));
7913        children.add(new Property("type", "CodeableConcept", "A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition.", 0, 1, type));
7914        children.add(new Property("status", "code", "The status of this plan definition. Enables tracking the life-cycle of the content.", 0, 1, status));
7915        children.add(new Property("experimental", "boolean", "A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental));
7916        children.add(new Property("subject[x]", "CodeableConcept|Reference(Group|MedicinalProductDefinition|SubstanceDefinition|AdministrableProductDefinition|ManufacturedItemDefinition|PackagedProductDefinition)|canonical(EvidenceVariable)", "A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject));
7917        children.add(new Property("date", "dateTime", "The date  (and optionally time) when the plan definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.", 0, 1, date));
7918        children.add(new Property("publisher", "string", "The name of the organization or individual responsible for the release and ongoing maintenance of the plan definition.", 0, 1, publisher));
7919        children.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
7920        children.add(new Property("description", "markdown", "A free text natural language description of the plan definition from a consumer's perspective.", 0, 1, description));
7921        children.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate plan definition instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
7922        children.add(new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the plan definition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
7923        children.add(new Property("purpose", "markdown", "Explanation of why this plan definition is needed and why it has been designed as it has.", 0, 1, purpose));
7924        children.add(new Property("usage", "markdown", "A detailed description of how the plan definition is used from a clinical perspective.", 0, 1, usage));
7925        children.add(new Property("copyright", "markdown", "A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.", 0, 1, copyright));
7926        children.add(new Property("copyrightLabel", "string", "A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').", 0, 1, copyrightLabel));
7927        children.add(new Property("approvalDate", "date", "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate));
7928        children.add(new Property("lastReviewDate", "date", "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.", 0, 1, lastReviewDate));
7929        children.add(new Property("effectivePeriod", "Period", "The period during which the plan definition content was or is planned to be in active use.", 0, 1, effectivePeriod));
7930        children.add(new Property("topic", "CodeableConcept", "Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching.", 0, java.lang.Integer.MAX_VALUE, topic));
7931        children.add(new Property("author", "ContactDetail", "An individiual or organization primarily involved in the creation and maintenance of the content.", 0, java.lang.Integer.MAX_VALUE, author));
7932        children.add(new Property("editor", "ContactDetail", "An individual or organization primarily responsible for internal coherence of the content.", 0, java.lang.Integer.MAX_VALUE, editor));
7933        children.add(new Property("reviewer", "ContactDetail", "An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the content.", 0, java.lang.Integer.MAX_VALUE, reviewer));
7934        children.add(new Property("endorser", "ContactDetail", "An individual or organization asserted by the publisher to be responsible for officially endorsing the content for use in some setting.", 0, java.lang.Integer.MAX_VALUE, endorser));
7935        children.add(new Property("relatedArtifact", "RelatedArtifact", "Related artifacts such as additional documentation, justification, or bibliographic references.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact));
7936        children.add(new Property("library", "canonical(Library)", "A reference to a Library resource containing any formal logic used by the plan definition.", 0, java.lang.Integer.MAX_VALUE, library));
7937        children.add(new Property("goal", "", "A goal describes an expected outcome that activities within the plan are intended to achieve. For example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, meeting the acceptance criteria for a test as specified by a quality specification, etc.", 0, java.lang.Integer.MAX_VALUE, goal));
7938        children.add(new Property("actor", "", "Actors represent the individuals or groups involved in the execution of the defined set of activities.", 0, java.lang.Integer.MAX_VALUE, actor));
7939        children.add(new Property("action", "", "An action or group of actions to be taken as part of the plan. For example, in clinical care, an action would be to prescribe a particular indicated medication, or perform a particular test as appropriate. In pharmaceutical quality, an action would be the test that needs to be performed on a drug product as defined in the quality specification.", 0, java.lang.Integer.MAX_VALUE, action));
7940        children.add(new Property("asNeeded[x]", "boolean|CodeableConcept", "If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example \"pain\", \"on flare-up\", etc.", 0, 1, asNeeded));
7941      }
7942
7943      @Override
7944      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7945        switch (_hash) {
7946        case 116079: /*url*/  return new Property("url", "uri", "An absolute URI that is used to identify this plan definition when it is referenced in a specification, model, design or an instance; also called its canonical identifier. This SHOULD be globally unique and SHOULD be a literal address at which an authoritative instance of this plan definition is (or will be) published. This URL can be the target of a canonical reference. It SHALL remain the same when the plan definition is stored on different servers.", 0, 1, url);
7947        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A formal identifier that is used to identify this plan definition when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier);
7948        case 351608024: /*version*/  return new Property("version", "string", "The identifier that is used to identify this version of the plan definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the plan definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge assets, refer to the Decision Support Service specification. Note that a version is required for non-experimental active artifacts.", 0, 1, version);
7949        case -115699031: /*versionAlgorithm[x]*/  return new Property("versionAlgorithm[x]", "string|Coding", "Indicates the mechanism used to compare versions to determine which is more current.", 0, 1, versionAlgorithm);
7950        case 1508158071: /*versionAlgorithm*/  return new Property("versionAlgorithm[x]", "string|Coding", "Indicates the mechanism used to compare versions to determine which is more current.", 0, 1, versionAlgorithm);
7951        case 1836908904: /*versionAlgorithmString*/  return new Property("versionAlgorithm[x]", "string", "Indicates the mechanism used to compare versions to determine which is more current.", 0, 1, versionAlgorithm);
7952        case 1373807809: /*versionAlgorithmCoding*/  return new Property("versionAlgorithm[x]", "Coding", "Indicates the mechanism used to compare versions to determine which is more current.", 0, 1, versionAlgorithm);
7953        case 3373707: /*name*/  return new Property("name", "string", "A natural language name identifying the plan definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, 1, name);
7954        case 110371416: /*title*/  return new Property("title", "string", "A short, descriptive, user-friendly title for the plan definition.", 0, 1, title);
7955        case -2060497896: /*subtitle*/  return new Property("subtitle", "string", "An explanatory or alternate title for the plan definition giving additional information about its content.", 0, 1, subtitle);
7956        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A high-level category for the plan definition that distinguishes the kinds of systems that would be interested in the plan definition.", 0, 1, type);
7957        case -892481550: /*status*/  return new Property("status", "code", "The status of this plan definition. Enables tracking the life-cycle of the content.", 0, 1, status);
7958        case -404562712: /*experimental*/  return new Property("experimental", "boolean", "A Boolean value to indicate that this plan definition is authored for testing purposes (or education/evaluation/marketing) and is not intended to be used for genuine usage.", 0, 1, experimental);
7959        case -573640748: /*subject[x]*/  return new Property("subject[x]", "CodeableConcept|Reference(Group|MedicinalProductDefinition|SubstanceDefinition|AdministrableProductDefinition|ManufacturedItemDefinition|PackagedProductDefinition)|canonical(EvidenceVariable)", "A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject);
7960        case -1867885268: /*subject*/  return new Property("subject[x]", "CodeableConcept|Reference(Group|MedicinalProductDefinition|SubstanceDefinition|AdministrableProductDefinition|ManufacturedItemDefinition|PackagedProductDefinition)|canonical(EvidenceVariable)", "A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject);
7961        case -1257122603: /*subjectCodeableConcept*/  return new Property("subject[x]", "CodeableConcept", "A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject);
7962        case 772938623: /*subjectReference*/  return new Property("subject[x]", "Reference(Group|MedicinalProductDefinition|SubstanceDefinition|AdministrableProductDefinition|ManufacturedItemDefinition|PackagedProductDefinition)", "A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject);
7963        case -1768521432: /*subjectCanonical*/  return new Property("subject[x]", "canonical(EvidenceVariable)", "A code, group definition, or canonical reference that describes  or identifies the intended subject of the plan definition. Canonical references are allowed to support the definition of protocols for drug and substance quality specifications, and is allowed to reference a MedicinalProductDefinition, SubstanceDefinition, AdministrableProductDefinition, ManufacturedItemDefinition, or PackagedProductDefinition resource.", 0, 1, subject);
7964        case 3076014: /*date*/  return new Property("date", "dateTime", "The date  (and optionally time) when the plan definition was last significantly changed. The date must change when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the plan definition changes.", 0, 1, date);
7965        case 1447404028: /*publisher*/  return new Property("publisher", "string", "The name of the organization or individual responsible for the release and ongoing maintenance of the plan definition.", 0, 1, publisher);
7966        case 951526432: /*contact*/  return new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact);
7967        case -1724546052: /*description*/  return new Property("description", "markdown", "A free text natural language description of the plan definition from a consumer's perspective.", 0, 1, description);
7968        case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These contexts may be general categories (gender, age, ...) or may be references to specific programs (insurance plans, studies, ...) and may be used to assist with indexing and searching for appropriate plan definition instances.", 0, java.lang.Integer.MAX_VALUE, useContext);
7969        case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the plan definition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
7970        case -220463842: /*purpose*/  return new Property("purpose", "markdown", "Explanation of why this plan definition is needed and why it has been designed as it has.", 0, 1, purpose);
7971        case 111574433: /*usage*/  return new Property("usage", "markdown", "A detailed description of how the plan definition is used from a clinical perspective.", 0, 1, usage);
7972        case 1522889671: /*copyright*/  return new Property("copyright", "markdown", "A copyright statement relating to the plan definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the plan definition.", 0, 1, copyright);
7973        case 765157229: /*copyrightLabel*/  return new Property("copyrightLabel", "string", "A short string (<50 characters), suitable for inclusion in a page footer that identifies the copyright holder, effective period, and optionally whether rights are resctricted. (e.g. 'All rights reserved', 'Some rights reserved').", 0, 1, copyrightLabel);
7974        case 223539345: /*approvalDate*/  return new Property("approvalDate", "date", "The date on which the resource content was approved by the publisher. Approval happens once when the content is officially approved for usage.", 0, 1, approvalDate);
7975        case -1687512484: /*lastReviewDate*/  return new Property("lastReviewDate", "date", "The date on which the resource content was last reviewed. Review happens periodically after approval but does not change the original approval date.", 0, 1, lastReviewDate);
7976        case -403934648: /*effectivePeriod*/  return new Property("effectivePeriod", "Period", "The period during which the plan definition content was or is planned to be in active use.", 0, 1, effectivePeriod);
7977        case 110546223: /*topic*/  return new Property("topic", "CodeableConcept", "Descriptive topics related to the content of the plan definition. Topics provide a high-level categorization of the definition that can be useful for filtering and searching.", 0, java.lang.Integer.MAX_VALUE, topic);
7978        case -1406328437: /*author*/  return new Property("author", "ContactDetail", "An individiual or organization primarily involved in the creation and maintenance of the content.", 0, java.lang.Integer.MAX_VALUE, author);
7979        case -1307827859: /*editor*/  return new Property("editor", "ContactDetail", "An individual or organization primarily responsible for internal coherence of the content.", 0, java.lang.Integer.MAX_VALUE, editor);
7980        case -261190139: /*reviewer*/  return new Property("reviewer", "ContactDetail", "An individual or organization asserted by the publisher to be primarily responsible for review of some aspect of the content.", 0, java.lang.Integer.MAX_VALUE, reviewer);
7981        case 1740277666: /*endorser*/  return new Property("endorser", "ContactDetail", "An individual or organization asserted by the publisher to be responsible for officially endorsing the content for use in some setting.", 0, java.lang.Integer.MAX_VALUE, endorser);
7982        case 666807069: /*relatedArtifact*/  return new Property("relatedArtifact", "RelatedArtifact", "Related artifacts such as additional documentation, justification, or bibliographic references.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact);
7983        case 166208699: /*library*/  return new Property("library", "canonical(Library)", "A reference to a Library resource containing any formal logic used by the plan definition.", 0, java.lang.Integer.MAX_VALUE, library);
7984        case 3178259: /*goal*/  return new Property("goal", "", "A goal describes an expected outcome that activities within the plan are intended to achieve. For example, weight loss, restoring an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, meeting the acceptance criteria for a test as specified by a quality specification, etc.", 0, java.lang.Integer.MAX_VALUE, goal);
7985        case 92645877: /*actor*/  return new Property("actor", "", "Actors represent the individuals or groups involved in the execution of the defined set of activities.", 0, java.lang.Integer.MAX_VALUE, actor);
7986        case -1422950858: /*action*/  return new Property("action", "", "An action or group of actions to be taken as part of the plan. For example, in clinical care, an action would be to prescribe a particular indicated medication, or perform a particular test as appropriate. In pharmaceutical quality, an action would be the test that needs to be performed on a drug product as defined in the quality specification.", 0, java.lang.Integer.MAX_VALUE, action);
7987        case -544329575: /*asNeeded[x]*/  return new Property("asNeeded[x]", "boolean|CodeableConcept", "If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example \"pain\", \"on flare-up\", etc.", 0, 1, asNeeded);
7988        case -1432923513: /*asNeeded*/  return new Property("asNeeded[x]", "boolean|CodeableConcept", "If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example \"pain\", \"on flare-up\", etc.", 0, 1, asNeeded);
7989        case -591717471: /*asNeededBoolean*/  return new Property("asNeeded[x]", "boolean", "If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example \"pain\", \"on flare-up\", etc.", 0, 1, asNeeded);
7990        case 1556420122: /*asNeededCodeableConcept*/  return new Property("asNeeded[x]", "CodeableConcept", "If a CodeableConcept is present, it indicates the pre-condition for performing the service.  For example \"pain\", \"on flare-up\", etc.", 0, 1, asNeeded);
7991        default: return super.getNamedProperty(_hash, _name, _checkValid);
7992        }
7993
7994      }
7995
7996      @Override
7997      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7998        switch (hash) {
7999        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
8000        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
8001        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
8002        case 1508158071: /*versionAlgorithm*/ return this.versionAlgorithm == null ? new Base[0] : new Base[] {this.versionAlgorithm}; // DataType
8003        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
8004        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
8005        case -2060497896: /*subtitle*/ return this.subtitle == null ? new Base[0] : new Base[] {this.subtitle}; // StringType
8006        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
8007        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
8008        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
8009        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // DataType
8010        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
8011        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
8012        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
8013        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
8014        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
8015        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
8016        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
8017        case 111574433: /*usage*/ return this.usage == null ? new Base[0] : new Base[] {this.usage}; // MarkdownType
8018        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
8019        case 765157229: /*copyrightLabel*/ return this.copyrightLabel == null ? new Base[0] : new Base[] {this.copyrightLabel}; // StringType
8020        case 223539345: /*approvalDate*/ return this.approvalDate == null ? new Base[0] : new Base[] {this.approvalDate}; // DateType
8021        case -1687512484: /*lastReviewDate*/ return this.lastReviewDate == null ? new Base[0] : new Base[] {this.lastReviewDate}; // DateType
8022        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
8023        case 110546223: /*topic*/ return this.topic == null ? new Base[0] : this.topic.toArray(new Base[this.topic.size()]); // CodeableConcept
8024        case -1406328437: /*author*/ return this.author == null ? new Base[0] : this.author.toArray(new Base[this.author.size()]); // ContactDetail
8025        case -1307827859: /*editor*/ return this.editor == null ? new Base[0] : this.editor.toArray(new Base[this.editor.size()]); // ContactDetail
8026        case -261190139: /*reviewer*/ return this.reviewer == null ? new Base[0] : this.reviewer.toArray(new Base[this.reviewer.size()]); // ContactDetail
8027        case 1740277666: /*endorser*/ return this.endorser == null ? new Base[0] : this.endorser.toArray(new Base[this.endorser.size()]); // ContactDetail
8028        case 666807069: /*relatedArtifact*/ return this.relatedArtifact == null ? new Base[0] : this.relatedArtifact.toArray(new Base[this.relatedArtifact.size()]); // RelatedArtifact
8029        case 166208699: /*library*/ return this.library == null ? new Base[0] : this.library.toArray(new Base[this.library.size()]); // CanonicalType
8030        case 3178259: /*goal*/ return this.goal == null ? new Base[0] : this.goal.toArray(new Base[this.goal.size()]); // PlanDefinitionGoalComponent
8031        case 92645877: /*actor*/ return this.actor == null ? new Base[0] : this.actor.toArray(new Base[this.actor.size()]); // PlanDefinitionActorComponent
8032        case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // PlanDefinitionActionComponent
8033        case -1432923513: /*asNeeded*/ return this.asNeeded == null ? new Base[0] : new Base[] {this.asNeeded}; // DataType
8034        default: return super.getProperty(hash, name, checkValid);
8035        }
8036
8037      }
8038
8039      @Override
8040      public Base setProperty(int hash, String name, Base value) throws FHIRException {
8041        switch (hash) {
8042        case 116079: // url
8043          this.url = TypeConvertor.castToUri(value); // UriType
8044          return value;
8045        case -1618432855: // identifier
8046          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
8047          return value;
8048        case 351608024: // version
8049          this.version = TypeConvertor.castToString(value); // StringType
8050          return value;
8051        case 1508158071: // versionAlgorithm
8052          this.versionAlgorithm = TypeConvertor.castToType(value); // DataType
8053          return value;
8054        case 3373707: // name
8055          this.name = TypeConvertor.castToString(value); // StringType
8056          return value;
8057        case 110371416: // title
8058          this.title = TypeConvertor.castToString(value); // StringType
8059          return value;
8060        case -2060497896: // subtitle
8061          this.subtitle = TypeConvertor.castToString(value); // StringType
8062          return value;
8063        case 3575610: // type
8064          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8065          return value;
8066        case -892481550: // status
8067          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
8068          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
8069          return value;
8070        case -404562712: // experimental
8071          this.experimental = TypeConvertor.castToBoolean(value); // BooleanType
8072          return value;
8073        case -1867885268: // subject
8074          this.subject = TypeConvertor.castToType(value); // DataType
8075          return value;
8076        case 3076014: // date
8077          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
8078          return value;
8079        case 1447404028: // publisher
8080          this.publisher = TypeConvertor.castToString(value); // StringType
8081          return value;
8082        case 951526432: // contact
8083          this.getContact().add(TypeConvertor.castToContactDetail(value)); // ContactDetail
8084          return value;
8085        case -1724546052: // description
8086          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
8087          return value;
8088        case -669707736: // useContext
8089          this.getUseContext().add(TypeConvertor.castToUsageContext(value)); // UsageContext
8090          return value;
8091        case -507075711: // jurisdiction
8092          this.getJurisdiction().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
8093          return value;
8094        case -220463842: // purpose
8095          this.purpose = TypeConvertor.castToMarkdown(value); // MarkdownType
8096          return value;
8097        case 111574433: // usage
8098          this.usage = TypeConvertor.castToMarkdown(value); // MarkdownType
8099          return value;
8100        case 1522889671: // copyright
8101          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
8102          return value;
8103        case 765157229: // copyrightLabel
8104          this.copyrightLabel = TypeConvertor.castToString(value); // StringType
8105          return value;
8106        case 223539345: // approvalDate
8107          this.approvalDate = TypeConvertor.castToDate(value); // DateType
8108          return value;
8109        case -1687512484: // lastReviewDate
8110          this.lastReviewDate = TypeConvertor.castToDate(value); // DateType
8111          return value;
8112        case -403934648: // effectivePeriod
8113          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
8114          return value;
8115        case 110546223: // topic
8116          this.getTopic().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
8117          return value;
8118        case -1406328437: // author
8119          this.getAuthor().add(TypeConvertor.castToContactDetail(value)); // ContactDetail
8120          return value;
8121        case -1307827859: // editor
8122          this.getEditor().add(TypeConvertor.castToContactDetail(value)); // ContactDetail
8123          return value;
8124        case -261190139: // reviewer
8125          this.getReviewer().add(TypeConvertor.castToContactDetail(value)); // ContactDetail
8126          return value;
8127        case 1740277666: // endorser
8128          this.getEndorser().add(TypeConvertor.castToContactDetail(value)); // ContactDetail
8129          return value;
8130        case 666807069: // relatedArtifact
8131          this.getRelatedArtifact().add(TypeConvertor.castToRelatedArtifact(value)); // RelatedArtifact
8132          return value;
8133        case 166208699: // library
8134          this.getLibrary().add(TypeConvertor.castToCanonical(value)); // CanonicalType
8135          return value;
8136        case 3178259: // goal
8137          this.getGoal().add((PlanDefinitionGoalComponent) value); // PlanDefinitionGoalComponent
8138          return value;
8139        case 92645877: // actor
8140          this.getActor().add((PlanDefinitionActorComponent) value); // PlanDefinitionActorComponent
8141          return value;
8142        case -1422950858: // action
8143          this.getAction().add((PlanDefinitionActionComponent) value); // PlanDefinitionActionComponent
8144          return value;
8145        case -1432923513: // asNeeded
8146          this.asNeeded = TypeConvertor.castToType(value); // DataType
8147          return value;
8148        default: return super.setProperty(hash, name, value);
8149        }
8150
8151      }
8152
8153      @Override
8154      public Base setProperty(String name, Base value) throws FHIRException {
8155        if (name.equals("url")) {
8156          this.url = TypeConvertor.castToUri(value); // UriType
8157        } else if (name.equals("identifier")) {
8158          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
8159        } else if (name.equals("version")) {
8160          this.version = TypeConvertor.castToString(value); // StringType
8161        } else if (name.equals("versionAlgorithm[x]")) {
8162          this.versionAlgorithm = TypeConvertor.castToType(value); // DataType
8163        } else if (name.equals("name")) {
8164          this.name = TypeConvertor.castToString(value); // StringType
8165        } else if (name.equals("title")) {
8166          this.title = TypeConvertor.castToString(value); // StringType
8167        } else if (name.equals("subtitle")) {
8168          this.subtitle = TypeConvertor.castToString(value); // StringType
8169        } else if (name.equals("type")) {
8170          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
8171        } else if (name.equals("status")) {
8172          value = new PublicationStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
8173          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
8174        } else if (name.equals("experimental")) {
8175          this.experimental = TypeConvertor.castToBoolean(value); // BooleanType
8176        } else if (name.equals("subject[x]")) {
8177          this.subject = TypeConvertor.castToType(value); // DataType
8178        } else if (name.equals("date")) {
8179          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
8180        } else if (name.equals("publisher")) {
8181          this.publisher = TypeConvertor.castToString(value); // StringType
8182        } else if (name.equals("contact")) {
8183          this.getContact().add(TypeConvertor.castToContactDetail(value));
8184        } else if (name.equals("description")) {
8185          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
8186        } else if (name.equals("useContext")) {
8187          this.getUseContext().add(TypeConvertor.castToUsageContext(value));
8188        } else if (name.equals("jurisdiction")) {
8189          this.getJurisdiction().add(TypeConvertor.castToCodeableConcept(value));
8190        } else if (name.equals("purpose")) {
8191          this.purpose = TypeConvertor.castToMarkdown(value); // MarkdownType
8192        } else if (name.equals("usage")) {
8193          this.usage = TypeConvertor.castToMarkdown(value); // MarkdownType
8194        } else if (name.equals("copyright")) {
8195          this.copyright = TypeConvertor.castToMarkdown(value); // MarkdownType
8196        } else if (name.equals("copyrightLabel")) {
8197          this.copyrightLabel = TypeConvertor.castToString(value); // StringType
8198        } else if (name.equals("approvalDate")) {
8199          this.approvalDate = TypeConvertor.castToDate(value); // DateType
8200        } else if (name.equals("lastReviewDate")) {
8201          this.lastReviewDate = TypeConvertor.castToDate(value); // DateType
8202        } else if (name.equals("effectivePeriod")) {
8203          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
8204        } else if (name.equals("topic")) {
8205          this.getTopic().add(TypeConvertor.castToCodeableConcept(value));
8206        } else if (name.equals("author")) {
8207          this.getAuthor().add(TypeConvertor.castToContactDetail(value));
8208        } else if (name.equals("editor")) {
8209          this.getEditor().add(TypeConvertor.castToContactDetail(value));
8210        } else if (name.equals("reviewer")) {
8211          this.getReviewer().add(TypeConvertor.castToContactDetail(value));
8212        } else if (name.equals("endorser")) {
8213          this.getEndorser().add(TypeConvertor.castToContactDetail(value));
8214        } else if (name.equals("relatedArtifact")) {
8215          this.getRelatedArtifact().add(TypeConvertor.castToRelatedArtifact(value));
8216        } else if (name.equals("library")) {
8217          this.getLibrary().add(TypeConvertor.castToCanonical(value));
8218        } else if (name.equals("goal")) {
8219          this.getGoal().add((PlanDefinitionGoalComponent) value);
8220        } else if (name.equals("actor")) {
8221          this.getActor().add((PlanDefinitionActorComponent) value);
8222        } else if (name.equals("action")) {
8223          this.getAction().add((PlanDefinitionActionComponent) value);
8224        } else if (name.equals("asNeeded[x]")) {
8225          this.asNeeded = TypeConvertor.castToType(value); // DataType
8226        } else
8227          return super.setProperty(name, value);
8228        return value;
8229      }
8230
8231      @Override
8232      public Base makeProperty(int hash, String name) throws FHIRException {
8233        switch (hash) {
8234        case 116079:  return getUrlElement();
8235        case -1618432855:  return addIdentifier(); 
8236        case 351608024:  return getVersionElement();
8237        case -115699031:  return getVersionAlgorithm();
8238        case 1508158071:  return getVersionAlgorithm();
8239        case 3373707:  return getNameElement();
8240        case 110371416:  return getTitleElement();
8241        case -2060497896:  return getSubtitleElement();
8242        case 3575610:  return getType();
8243        case -892481550:  return getStatusElement();
8244        case -404562712:  return getExperimentalElement();
8245        case -573640748:  return getSubject();
8246        case -1867885268:  return getSubject();
8247        case 3076014:  return getDateElement();
8248        case 1447404028:  return getPublisherElement();
8249        case 951526432:  return addContact(); 
8250        case -1724546052:  return getDescriptionElement();
8251        case -669707736:  return addUseContext(); 
8252        case -507075711:  return addJurisdiction(); 
8253        case -220463842:  return getPurposeElement();
8254        case 111574433:  return getUsageElement();
8255        case 1522889671:  return getCopyrightElement();
8256        case 765157229:  return getCopyrightLabelElement();
8257        case 223539345:  return getApprovalDateElement();
8258        case -1687512484:  return getLastReviewDateElement();
8259        case -403934648:  return getEffectivePeriod();
8260        case 110546223:  return addTopic(); 
8261        case -1406328437:  return addAuthor(); 
8262        case -1307827859:  return addEditor(); 
8263        case -261190139:  return addReviewer(); 
8264        case 1740277666:  return addEndorser(); 
8265        case 666807069:  return addRelatedArtifact(); 
8266        case 166208699:  return addLibraryElement();
8267        case 3178259:  return addGoal(); 
8268        case 92645877:  return addActor(); 
8269        case -1422950858:  return addAction(); 
8270        case -544329575:  return getAsNeeded();
8271        case -1432923513:  return getAsNeeded();
8272        default: return super.makeProperty(hash, name);
8273        }
8274
8275      }
8276
8277      @Override
8278      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
8279        switch (hash) {
8280        case 116079: /*url*/ return new String[] {"uri"};
8281        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
8282        case 351608024: /*version*/ return new String[] {"string"};
8283        case 1508158071: /*versionAlgorithm*/ return new String[] {"string", "Coding"};
8284        case 3373707: /*name*/ return new String[] {"string"};
8285        case 110371416: /*title*/ return new String[] {"string"};
8286        case -2060497896: /*subtitle*/ return new String[] {"string"};
8287        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
8288        case -892481550: /*status*/ return new String[] {"code"};
8289        case -404562712: /*experimental*/ return new String[] {"boolean"};
8290        case -1867885268: /*subject*/ return new String[] {"CodeableConcept", "Reference", "canonical"};
8291        case 3076014: /*date*/ return new String[] {"dateTime"};
8292        case 1447404028: /*publisher*/ return new String[] {"string"};
8293        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
8294        case -1724546052: /*description*/ return new String[] {"markdown"};
8295        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
8296        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
8297        case -220463842: /*purpose*/ return new String[] {"markdown"};
8298        case 111574433: /*usage*/ return new String[] {"markdown"};
8299        case 1522889671: /*copyright*/ return new String[] {"markdown"};
8300        case 765157229: /*copyrightLabel*/ return new String[] {"string"};
8301        case 223539345: /*approvalDate*/ return new String[] {"date"};
8302        case -1687512484: /*lastReviewDate*/ return new String[] {"date"};
8303        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
8304        case 110546223: /*topic*/ return new String[] {"CodeableConcept"};
8305        case -1406328437: /*author*/ return new String[] {"ContactDetail"};
8306        case -1307827859: /*editor*/ return new String[] {"ContactDetail"};
8307        case -261190139: /*reviewer*/ return new String[] {"ContactDetail"};
8308        case 1740277666: /*endorser*/ return new String[] {"ContactDetail"};
8309        case 666807069: /*relatedArtifact*/ return new String[] {"RelatedArtifact"};
8310        case 166208699: /*library*/ return new String[] {"canonical"};
8311        case 3178259: /*goal*/ return new String[] {};
8312        case 92645877: /*actor*/ return new String[] {};
8313        case -1422950858: /*action*/ return new String[] {};
8314        case -1432923513: /*asNeeded*/ return new String[] {"boolean", "CodeableConcept"};
8315        default: return super.getTypesForProperty(hash, name);
8316        }
8317
8318      }
8319
8320      @Override
8321      public Base addChild(String name) throws FHIRException {
8322        if (name.equals("url")) {
8323          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.url");
8324        }
8325        else if (name.equals("identifier")) {
8326          return addIdentifier();
8327        }
8328        else if (name.equals("version")) {
8329          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.version");
8330        }
8331        else if (name.equals("versionAlgorithmString")) {
8332          this.versionAlgorithm = new StringType();
8333          return this.versionAlgorithm;
8334        }
8335        else if (name.equals("versionAlgorithmCoding")) {
8336          this.versionAlgorithm = new Coding();
8337          return this.versionAlgorithm;
8338        }
8339        else if (name.equals("name")) {
8340          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.name");
8341        }
8342        else if (name.equals("title")) {
8343          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.title");
8344        }
8345        else if (name.equals("subtitle")) {
8346          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.subtitle");
8347        }
8348        else if (name.equals("type")) {
8349          this.type = new CodeableConcept();
8350          return this.type;
8351        }
8352        else if (name.equals("status")) {
8353          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.status");
8354        }
8355        else if (name.equals("experimental")) {
8356          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.experimental");
8357        }
8358        else if (name.equals("subjectCodeableConcept")) {
8359          this.subject = new CodeableConcept();
8360          return this.subject;
8361        }
8362        else if (name.equals("subjectReference")) {
8363          this.subject = new Reference();
8364          return this.subject;
8365        }
8366        else if (name.equals("subjectCanonical")) {
8367          this.subject = new CanonicalType();
8368          return this.subject;
8369        }
8370        else if (name.equals("date")) {
8371          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.date");
8372        }
8373        else if (name.equals("publisher")) {
8374          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.publisher");
8375        }
8376        else if (name.equals("contact")) {
8377          return addContact();
8378        }
8379        else if (name.equals("description")) {
8380          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.description");
8381        }
8382        else if (name.equals("useContext")) {
8383          return addUseContext();
8384        }
8385        else if (name.equals("jurisdiction")) {
8386          return addJurisdiction();
8387        }
8388        else if (name.equals("purpose")) {
8389          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.purpose");
8390        }
8391        else if (name.equals("usage")) {
8392          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.usage");
8393        }
8394        else if (name.equals("copyright")) {
8395          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.copyright");
8396        }
8397        else if (name.equals("copyrightLabel")) {
8398          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.copyrightLabel");
8399        }
8400        else if (name.equals("approvalDate")) {
8401          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.approvalDate");
8402        }
8403        else if (name.equals("lastReviewDate")) {
8404          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.lastReviewDate");
8405        }
8406        else if (name.equals("effectivePeriod")) {
8407          this.effectivePeriod = new Period();
8408          return this.effectivePeriod;
8409        }
8410        else if (name.equals("topic")) {
8411          return addTopic();
8412        }
8413        else if (name.equals("author")) {
8414          return addAuthor();
8415        }
8416        else if (name.equals("editor")) {
8417          return addEditor();
8418        }
8419        else if (name.equals("reviewer")) {
8420          return addReviewer();
8421        }
8422        else if (name.equals("endorser")) {
8423          return addEndorser();
8424        }
8425        else if (name.equals("relatedArtifact")) {
8426          return addRelatedArtifact();
8427        }
8428        else if (name.equals("library")) {
8429          throw new FHIRException("Cannot call addChild on a singleton property PlanDefinition.library");
8430        }
8431        else if (name.equals("goal")) {
8432          return addGoal();
8433        }
8434        else if (name.equals("actor")) {
8435          return addActor();
8436        }
8437        else if (name.equals("action")) {
8438          return addAction();
8439        }
8440        else if (name.equals("asNeededBoolean")) {
8441          this.asNeeded = new BooleanType();
8442          return this.asNeeded;
8443        }
8444        else if (name.equals("asNeededCodeableConcept")) {
8445          this.asNeeded = new CodeableConcept();
8446          return this.asNeeded;
8447        }
8448        else
8449          return super.addChild(name);
8450      }
8451
8452  public String fhirType() {
8453    return "PlanDefinition";
8454
8455  }
8456
8457      public PlanDefinition copy() {
8458        PlanDefinition dst = new PlanDefinition();
8459        copyValues(dst);
8460        return dst;
8461      }
8462
8463      public void copyValues(PlanDefinition dst) {
8464        super.copyValues(dst);
8465        dst.url = url == null ? null : url.copy();
8466        if (identifier != null) {
8467          dst.identifier = new ArrayList<Identifier>();
8468          for (Identifier i : identifier)
8469            dst.identifier.add(i.copy());
8470        };
8471        dst.version = version == null ? null : version.copy();
8472        dst.versionAlgorithm = versionAlgorithm == null ? null : versionAlgorithm.copy();
8473        dst.name = name == null ? null : name.copy();
8474        dst.title = title == null ? null : title.copy();
8475        dst.subtitle = subtitle == null ? null : subtitle.copy();
8476        dst.type = type == null ? null : type.copy();
8477        dst.status = status == null ? null : status.copy();
8478        dst.experimental = experimental == null ? null : experimental.copy();
8479        dst.subject = subject == null ? null : subject.copy();
8480        dst.date = date == null ? null : date.copy();
8481        dst.publisher = publisher == null ? null : publisher.copy();
8482        if (contact != null) {
8483          dst.contact = new ArrayList<ContactDetail>();
8484          for (ContactDetail i : contact)
8485            dst.contact.add(i.copy());
8486        };
8487        dst.description = description == null ? null : description.copy();
8488        if (useContext != null) {
8489          dst.useContext = new ArrayList<UsageContext>();
8490          for (UsageContext i : useContext)
8491            dst.useContext.add(i.copy());
8492        };
8493        if (jurisdiction != null) {
8494          dst.jurisdiction = new ArrayList<CodeableConcept>();
8495          for (CodeableConcept i : jurisdiction)
8496            dst.jurisdiction.add(i.copy());
8497        };
8498        dst.purpose = purpose == null ? null : purpose.copy();
8499        dst.usage = usage == null ? null : usage.copy();
8500        dst.copyright = copyright == null ? null : copyright.copy();
8501        dst.copyrightLabel = copyrightLabel == null ? null : copyrightLabel.copy();
8502        dst.approvalDate = approvalDate == null ? null : approvalDate.copy();
8503        dst.lastReviewDate = lastReviewDate == null ? null : lastReviewDate.copy();
8504        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
8505        if (topic != null) {
8506          dst.topic = new ArrayList<CodeableConcept>();
8507          for (CodeableConcept i : topic)
8508            dst.topic.add(i.copy());
8509        };
8510        if (author != null) {
8511          dst.author = new ArrayList<ContactDetail>();
8512          for (ContactDetail i : author)
8513            dst.author.add(i.copy());
8514        };
8515        if (editor != null) {
8516          dst.editor = new ArrayList<ContactDetail>();
8517          for (ContactDetail i : editor)
8518            dst.editor.add(i.copy());
8519        };
8520        if (reviewer != null) {
8521          dst.reviewer = new ArrayList<ContactDetail>();
8522          for (ContactDetail i : reviewer)
8523            dst.reviewer.add(i.copy());
8524        };
8525        if (endorser != null) {
8526          dst.endorser = new ArrayList<ContactDetail>();
8527          for (ContactDetail i : endorser)
8528            dst.endorser.add(i.copy());
8529        };
8530        if (relatedArtifact != null) {
8531          dst.relatedArtifact = new ArrayList<RelatedArtifact>();
8532          for (RelatedArtifact i : relatedArtifact)
8533            dst.relatedArtifact.add(i.copy());
8534        };
8535        if (library != null) {
8536          dst.library = new ArrayList<CanonicalType>();
8537          for (CanonicalType i : library)
8538            dst.library.add(i.copy());
8539        };
8540        if (goal != null) {
8541          dst.goal = new ArrayList<PlanDefinitionGoalComponent>();
8542          for (PlanDefinitionGoalComponent i : goal)
8543            dst.goal.add(i.copy());
8544        };
8545        if (actor != null) {
8546          dst.actor = new ArrayList<PlanDefinitionActorComponent>();
8547          for (PlanDefinitionActorComponent i : actor)
8548            dst.actor.add(i.copy());
8549        };
8550        if (action != null) {
8551          dst.action = new ArrayList<PlanDefinitionActionComponent>();
8552          for (PlanDefinitionActionComponent i : action)
8553            dst.action.add(i.copy());
8554        };
8555        dst.asNeeded = asNeeded == null ? null : asNeeded.copy();
8556      }
8557
8558      protected PlanDefinition typedCopy() {
8559        return copy();
8560      }
8561
8562      @Override
8563      public boolean equalsDeep(Base other_) {
8564        if (!super.equalsDeep(other_))
8565          return false;
8566        if (!(other_ instanceof PlanDefinition))
8567          return false;
8568        PlanDefinition o = (PlanDefinition) other_;
8569        return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
8570           && compareDeep(versionAlgorithm, o.versionAlgorithm, true) && compareDeep(name, o.name, true) && compareDeep(title, o.title, true)
8571           && compareDeep(subtitle, o.subtitle, true) && compareDeep(type, o.type, true) && compareDeep(status, o.status, true)
8572