001package org.hl7.fhir.dstu2.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
036import java.util.ArrayList;
037import java.util.List;
038
039import org.hl7.fhir.dstu2.model.Enumerations.BindingStrength;
040import org.hl7.fhir.dstu2.model.Enumerations.BindingStrengthEnumFactory;
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.DatatypeDef;
044import ca.uhn.fhir.model.api.annotation.Description;
045import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
046import org.hl7.fhir.instance.model.api.ICompositeType;
047import org.hl7.fhir.exceptions.FHIRException;
048import org.hl7.fhir.utilities.Utilities;
049/**
050 * Captures constraints on each element within the resource, profile, or extension.
051 */
052@DatatypeDef(name="ElementDefinition")
053public class ElementDefinition extends Type implements ICompositeType {
054
055    public enum PropertyRepresentation {
056        /**
057         * In XML, this property is represented as an attribute not an element.
058         */
059        XMLATTR, 
060        /**
061         * added to help the parsers
062         */
063        NULL;
064        public static PropertyRepresentation fromCode(String codeString) throws FHIRException {
065            if (codeString == null || "".equals(codeString))
066                return null;
067        if ("xmlAttr".equals(codeString))
068          return XMLATTR;
069        throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
070        }
071        public String toCode() {
072          switch (this) {
073            case XMLATTR: return "xmlAttr";
074            default: return "?";
075          }
076        }
077        public String getSystem() {
078          switch (this) {
079            case XMLATTR: return "http://hl7.org/fhir/property-representation";
080            default: return "?";
081          }
082        }
083        public String getDefinition() {
084          switch (this) {
085            case XMLATTR: return "In XML, this property is represented as an attribute not an element.";
086            default: return "?";
087          }
088        }
089        public String getDisplay() {
090          switch (this) {
091            case XMLATTR: return "XML Attribute";
092            default: return "?";
093          }
094        }
095    }
096
097  public static class PropertyRepresentationEnumFactory implements EnumFactory<PropertyRepresentation> {
098    public PropertyRepresentation fromCode(String codeString) throws IllegalArgumentException {
099      if (codeString == null || "".equals(codeString))
100            if (codeString == null || "".equals(codeString))
101                return null;
102        if ("xmlAttr".equals(codeString))
103          return PropertyRepresentation.XMLATTR;
104        throw new IllegalArgumentException("Unknown PropertyRepresentation code '"+codeString+"'");
105        }
106        public Enumeration<PropertyRepresentation> fromType(Base code) throws FHIRException {
107          if (code == null || code.isEmpty())
108            return null;
109          String codeString = ((PrimitiveType) code).asStringValue();
110          if (codeString == null || "".equals(codeString))
111            return null;
112        if ("xmlAttr".equals(codeString))
113          return new Enumeration<PropertyRepresentation>(this, PropertyRepresentation.XMLATTR);
114        throw new FHIRException("Unknown PropertyRepresentation code '"+codeString+"'");
115        }
116    public String toCode(PropertyRepresentation code) {
117      if (code == PropertyRepresentation.XMLATTR)
118        return "xmlAttr";
119      return "?";
120      }
121    }
122
123    public enum SlicingRules {
124        /**
125         * No additional content is allowed other than that described by the slices in this profile.
126         */
127        CLOSED, 
128        /**
129         * Additional content is allowed anywhere in the list.
130         */
131        OPEN, 
132        /**
133         * Additional content is allowed, but only at the end of the list. Note that using this requires that the slices be ordered, which makes it hard to share uses. This should only be done where absolutely required.
134         */
135        OPENATEND, 
136        /**
137         * added to help the parsers
138         */
139        NULL;
140        public static SlicingRules fromCode(String codeString) throws FHIRException {
141            if (codeString == null || "".equals(codeString))
142                return null;
143        if ("closed".equals(codeString))
144          return CLOSED;
145        if ("open".equals(codeString))
146          return OPEN;
147        if ("openAtEnd".equals(codeString))
148          return OPENATEND;
149        throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
150        }
151        public String toCode() {
152          switch (this) {
153            case CLOSED: return "closed";
154            case OPEN: return "open";
155            case OPENATEND: return "openAtEnd";
156            default: return "?";
157          }
158        }
159        public String getSystem() {
160          switch (this) {
161            case CLOSED: return "http://hl7.org/fhir/resource-slicing-rules";
162            case OPEN: return "http://hl7.org/fhir/resource-slicing-rules";
163            case OPENATEND: return "http://hl7.org/fhir/resource-slicing-rules";
164            default: return "?";
165          }
166        }
167        public String getDefinition() {
168          switch (this) {
169            case CLOSED: return "No additional content is allowed other than that described by the slices in this profile.";
170            case OPEN: return "Additional content is allowed anywhere in the list.";
171            case OPENATEND: return "Additional content is allowed, but only at the end of the list. Note that using this requires that the slices be ordered, which makes it hard to share uses. This should only be done where absolutely required.";
172            default: return "?";
173          }
174        }
175        public String getDisplay() {
176          switch (this) {
177            case CLOSED: return "Closed";
178            case OPEN: return "Open";
179            case OPENATEND: return "Open at End";
180            default: return "?";
181          }
182        }
183    }
184
185  public static class SlicingRulesEnumFactory implements EnumFactory<SlicingRules> {
186    public SlicingRules fromCode(String codeString) throws IllegalArgumentException {
187      if (codeString == null || "".equals(codeString))
188            if (codeString == null || "".equals(codeString))
189                return null;
190        if ("closed".equals(codeString))
191          return SlicingRules.CLOSED;
192        if ("open".equals(codeString))
193          return SlicingRules.OPEN;
194        if ("openAtEnd".equals(codeString))
195          return SlicingRules.OPENATEND;
196        throw new IllegalArgumentException("Unknown SlicingRules code '"+codeString+"'");
197        }
198        public Enumeration<SlicingRules> fromType(Base code) throws FHIRException {
199          if (code == null || code.isEmpty())
200            return null;
201          String codeString = ((PrimitiveType) code).asStringValue();
202          if (codeString == null || "".equals(codeString))
203            return null;
204        if ("closed".equals(codeString))
205          return new Enumeration<SlicingRules>(this, SlicingRules.CLOSED);
206        if ("open".equals(codeString))
207          return new Enumeration<SlicingRules>(this, SlicingRules.OPEN);
208        if ("openAtEnd".equals(codeString))
209          return new Enumeration<SlicingRules>(this, SlicingRules.OPENATEND);
210        throw new FHIRException("Unknown SlicingRules code '"+codeString+"'");
211        }
212    public String toCode(SlicingRules code) {
213      if (code == SlicingRules.CLOSED)
214        return "closed";
215      if (code == SlicingRules.OPEN)
216        return "open";
217      if (code == SlicingRules.OPENATEND)
218        return "openAtEnd";
219      return "?";
220      }
221    }
222
223    public enum AggregationMode {
224        /**
225         * The reference is a local reference to a contained resource.
226         */
227        CONTAINED, 
228        /**
229         * The reference to a resource that has to be resolved externally to the resource that includes the reference.
230         */
231        REFERENCED, 
232        /**
233         * The resource the reference points to will be found in the same bundle as the resource that includes the reference.
234         */
235        BUNDLED, 
236        /**
237         * added to help the parsers
238         */
239        NULL;
240        public static AggregationMode fromCode(String codeString) throws FHIRException {
241            if (codeString == null || "".equals(codeString))
242                return null;
243        if ("contained".equals(codeString))
244          return CONTAINED;
245        if ("referenced".equals(codeString))
246          return REFERENCED;
247        if ("bundled".equals(codeString))
248          return BUNDLED;
249        throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
250        }
251        public String toCode() {
252          switch (this) {
253            case CONTAINED: return "contained";
254            case REFERENCED: return "referenced";
255            case BUNDLED: return "bundled";
256            default: return "?";
257          }
258        }
259        public String getSystem() {
260          switch (this) {
261            case CONTAINED: return "http://hl7.org/fhir/resource-aggregation-mode";
262            case REFERENCED: return "http://hl7.org/fhir/resource-aggregation-mode";
263            case BUNDLED: return "http://hl7.org/fhir/resource-aggregation-mode";
264            default: return "?";
265          }
266        }
267        public String getDefinition() {
268          switch (this) {
269            case CONTAINED: return "The reference is a local reference to a contained resource.";
270            case REFERENCED: return "The reference to a resource that has to be resolved externally to the resource that includes the reference.";
271            case BUNDLED: return "The resource the reference points to will be found in the same bundle as the resource that includes the reference.";
272            default: return "?";
273          }
274        }
275        public String getDisplay() {
276          switch (this) {
277            case CONTAINED: return "Contained";
278            case REFERENCED: return "Referenced";
279            case BUNDLED: return "Bundled";
280            default: return "?";
281          }
282        }
283    }
284
285  public static class AggregationModeEnumFactory implements EnumFactory<AggregationMode> {
286    public AggregationMode fromCode(String codeString) throws IllegalArgumentException {
287      if (codeString == null || "".equals(codeString))
288            if (codeString == null || "".equals(codeString))
289                return null;
290        if ("contained".equals(codeString))
291          return AggregationMode.CONTAINED;
292        if ("referenced".equals(codeString))
293          return AggregationMode.REFERENCED;
294        if ("bundled".equals(codeString))
295          return AggregationMode.BUNDLED;
296        throw new IllegalArgumentException("Unknown AggregationMode code '"+codeString+"'");
297        }
298        public Enumeration<AggregationMode> fromType(Base code) throws FHIRException {
299          if (code == null || code.isEmpty())
300            return null;
301          String codeString = ((PrimitiveType) code).asStringValue();
302          if (codeString == null || "".equals(codeString))
303            return null;
304        if ("contained".equals(codeString))
305          return new Enumeration<AggregationMode>(this, AggregationMode.CONTAINED);
306        if ("referenced".equals(codeString))
307          return new Enumeration<AggregationMode>(this, AggregationMode.REFERENCED);
308        if ("bundled".equals(codeString))
309          return new Enumeration<AggregationMode>(this, AggregationMode.BUNDLED);
310        throw new FHIRException("Unknown AggregationMode code '"+codeString+"'");
311        }
312    public String toCode(AggregationMode code) {
313      if (code == AggregationMode.CONTAINED)
314        return "contained";
315      if (code == AggregationMode.REFERENCED)
316        return "referenced";
317      if (code == AggregationMode.BUNDLED)
318        return "bundled";
319      return "?";
320      }
321    }
322
323    public enum ConstraintSeverity {
324        /**
325         * If the constraint is violated, the resource is not conformant.
326         */
327        ERROR, 
328        /**
329         * If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.
330         */
331        WARNING, 
332        /**
333         * added to help the parsers
334         */
335        NULL;
336        public static ConstraintSeverity fromCode(String codeString) throws FHIRException {
337            if (codeString == null || "".equals(codeString))
338                return null;
339        if ("error".equals(codeString))
340          return ERROR;
341        if ("warning".equals(codeString))
342          return WARNING;
343        throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
344        }
345        public String toCode() {
346          switch (this) {
347            case ERROR: return "error";
348            case WARNING: return "warning";
349            default: return "?";
350          }
351        }
352        public String getSystem() {
353          switch (this) {
354            case ERROR: return "http://hl7.org/fhir/constraint-severity";
355            case WARNING: return "http://hl7.org/fhir/constraint-severity";
356            default: return "?";
357          }
358        }
359        public String getDefinition() {
360          switch (this) {
361            case ERROR: return "If the constraint is violated, the resource is not conformant.";
362            case WARNING: return "If the constraint is violated, the resource is conformant, but it is not necessarily following best practice.";
363            default: return "?";
364          }
365        }
366        public String getDisplay() {
367          switch (this) {
368            case ERROR: return "Error";
369            case WARNING: return "Warning";
370            default: return "?";
371          }
372        }
373    }
374
375  public static class ConstraintSeverityEnumFactory implements EnumFactory<ConstraintSeverity> {
376    public ConstraintSeverity fromCode(String codeString) throws IllegalArgumentException {
377      if (codeString == null || "".equals(codeString))
378            if (codeString == null || "".equals(codeString))
379                return null;
380        if ("error".equals(codeString))
381          return ConstraintSeverity.ERROR;
382        if ("warning".equals(codeString))
383          return ConstraintSeverity.WARNING;
384        throw new IllegalArgumentException("Unknown ConstraintSeverity code '"+codeString+"'");
385        }
386        public Enumeration<ConstraintSeverity> fromType(Base code) throws FHIRException {
387          if (code == null || code.isEmpty())
388            return null;
389          String codeString = ((PrimitiveType) code).asStringValue();
390          if (codeString == null || "".equals(codeString))
391            return null;
392        if ("error".equals(codeString))
393          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.ERROR);
394        if ("warning".equals(codeString))
395          return new Enumeration<ConstraintSeverity>(this, ConstraintSeverity.WARNING);
396        throw new FHIRException("Unknown ConstraintSeverity code '"+codeString+"'");
397        }
398    public String toCode(ConstraintSeverity code) {
399      if (code == ConstraintSeverity.ERROR)
400        return "error";
401      if (code == ConstraintSeverity.WARNING)
402        return "warning";
403      return "?";
404      }
405    }
406
407    @Block()
408    public static class ElementDefinitionSlicingComponent extends Element implements IBaseDatatypeElement {
409        /**
410         * Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.
411         */
412        @Child(name = "discriminator", type = {StringType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
413        @Description(shortDefinition="Element values that used to distinguish the slices", formalDefinition="Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices." )
414        protected List<StringType> discriminator;
415
416        /**
417         * A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.
418         */
419        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
420        @Description(shortDefinition="Text description of how slicing works (or not)", formalDefinition="A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated." )
421        protected StringType description;
422
423        /**
424         * If the matching elements have to occur in the same order as defined in the profile.
425         */
426        @Child(name = "ordered", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
427        @Description(shortDefinition="If elements must be in same order as slices", formalDefinition="If the matching elements have to occur in the same order as defined in the profile." )
428        protected BooleanType ordered;
429
430        /**
431         * Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.
432         */
433        @Child(name = "rules", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=true)
434        @Description(shortDefinition="closed | open | openAtEnd", formalDefinition="Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end." )
435        protected Enumeration<SlicingRules> rules;
436
437        private static final long serialVersionUID = 233544215L;
438
439    /*
440     * Constructor
441     */
442      public ElementDefinitionSlicingComponent() {
443        super();
444      }
445
446    /*
447     * Constructor
448     */
449      public ElementDefinitionSlicingComponent(Enumeration<SlicingRules> rules) {
450        super();
451        this.rules = rules;
452      }
453
454        /**
455         * @return {@link #discriminator} (Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.)
456         */
457        public List<StringType> getDiscriminator() { 
458          if (this.discriminator == null)
459            this.discriminator = new ArrayList<StringType>();
460          return this.discriminator;
461        }
462
463        public boolean hasDiscriminator() { 
464          if (this.discriminator == null)
465            return false;
466          for (StringType item : this.discriminator)
467            if (!item.isEmpty())
468              return true;
469          return false;
470        }
471
472        /**
473         * @return {@link #discriminator} (Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.)
474         */
475    // syntactic sugar
476        public StringType addDiscriminatorElement() {//2 
477          StringType t = new StringType();
478          if (this.discriminator == null)
479            this.discriminator = new ArrayList<StringType>();
480          this.discriminator.add(t);
481          return t;
482        }
483
484        /**
485         * @param value {@link #discriminator} (Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.)
486         */
487        public ElementDefinitionSlicingComponent addDiscriminator(String value) { //1
488          StringType t = new StringType();
489          t.setValue(value);
490          if (this.discriminator == null)
491            this.discriminator = new ArrayList<StringType>();
492          this.discriminator.add(t);
493          return this;
494        }
495
496        /**
497         * @param value {@link #discriminator} (Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.)
498         */
499        public boolean hasDiscriminator(String value) { 
500          if (this.discriminator == null)
501            return false;
502          for (StringType v : this.discriminator)
503            if (v.equals(value)) // string
504              return true;
505          return false;
506        }
507
508        /**
509         * @return {@link #description} (A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
510         */
511        public StringType getDescriptionElement() { 
512          if (this.description == null)
513            if (Configuration.errorOnAutoCreate())
514              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.description");
515            else if (Configuration.doAutoCreate())
516              this.description = new StringType(); // bb
517          return this.description;
518        }
519
520        public boolean hasDescriptionElement() { 
521          return this.description != null && !this.description.isEmpty();
522        }
523
524        public boolean hasDescription() { 
525          return this.description != null && !this.description.isEmpty();
526        }
527
528        /**
529         * @param value {@link #description} (A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
530         */
531        public ElementDefinitionSlicingComponent setDescriptionElement(StringType value) { 
532          this.description = value;
533          return this;
534        }
535
536        /**
537         * @return A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.
538         */
539        public String getDescription() { 
540          return this.description == null ? null : this.description.getValue();
541        }
542
543        /**
544         * @param value A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.
545         */
546        public ElementDefinitionSlicingComponent setDescription(String value) { 
547          if (Utilities.noString(value))
548            this.description = null;
549          else {
550            if (this.description == null)
551              this.description = new StringType();
552            this.description.setValue(value);
553          }
554          return this;
555        }
556
557        /**
558         * @return {@link #ordered} (If the matching elements have to occur in the same order as defined in the profile.). This is the underlying object with id, value and extensions. The accessor "getOrdered" gives direct access to the value
559         */
560        public BooleanType getOrderedElement() { 
561          if (this.ordered == null)
562            if (Configuration.errorOnAutoCreate())
563              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.ordered");
564            else if (Configuration.doAutoCreate())
565              this.ordered = new BooleanType(); // bb
566          return this.ordered;
567        }
568
569        public boolean hasOrderedElement() { 
570          return this.ordered != null && !this.ordered.isEmpty();
571        }
572
573        public boolean hasOrdered() { 
574          return this.ordered != null && !this.ordered.isEmpty();
575        }
576
577        /**
578         * @param value {@link #ordered} (If the matching elements have to occur in the same order as defined in the profile.). This is the underlying object with id, value and extensions. The accessor "getOrdered" gives direct access to the value
579         */
580        public ElementDefinitionSlicingComponent setOrderedElement(BooleanType value) { 
581          this.ordered = value;
582          return this;
583        }
584
585        /**
586         * @return If the matching elements have to occur in the same order as defined in the profile.
587         */
588        public boolean getOrdered() { 
589          return this.ordered == null || this.ordered.isEmpty() ? false : this.ordered.getValue();
590        }
591
592        /**
593         * @param value If the matching elements have to occur in the same order as defined in the profile.
594         */
595        public ElementDefinitionSlicingComponent setOrdered(boolean value) { 
596            if (this.ordered == null)
597              this.ordered = new BooleanType();
598            this.ordered.setValue(value);
599          return this;
600        }
601
602        /**
603         * @return {@link #rules} (Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.). This is the underlying object with id, value and extensions. The accessor "getRules" gives direct access to the value
604         */
605        public Enumeration<SlicingRules> getRulesElement() { 
606          if (this.rules == null)
607            if (Configuration.errorOnAutoCreate())
608              throw new Error("Attempt to auto-create ElementDefinitionSlicingComponent.rules");
609            else if (Configuration.doAutoCreate())
610              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory()); // bb
611          return this.rules;
612        }
613
614        public boolean hasRulesElement() { 
615          return this.rules != null && !this.rules.isEmpty();
616        }
617
618        public boolean hasRules() { 
619          return this.rules != null && !this.rules.isEmpty();
620        }
621
622        /**
623         * @param value {@link #rules} (Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.). This is the underlying object with id, value and extensions. The accessor "getRules" gives direct access to the value
624         */
625        public ElementDefinitionSlicingComponent setRulesElement(Enumeration<SlicingRules> value) { 
626          this.rules = value;
627          return this;
628        }
629
630        /**
631         * @return Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.
632         */
633        public SlicingRules getRules() { 
634          return this.rules == null ? null : this.rules.getValue();
635        }
636
637        /**
638         * @param value Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.
639         */
640        public ElementDefinitionSlicingComponent setRules(SlicingRules value) { 
641            if (this.rules == null)
642              this.rules = new Enumeration<SlicingRules>(new SlicingRulesEnumFactory());
643            this.rules.setValue(value);
644          return this;
645        }
646
647        protected void listChildren(List<Property> childrenList) {
648          super.listChildren(childrenList);
649          childrenList.add(new Property("discriminator", "string", "Designates which child elements are used to discriminate between the slices when processing an instance. If one or more discriminators are provided, the value of the child elements in the instance data SHALL completely distinguish which slice the element in the resource matches based on the allowed values for those elements in each of the slices.", 0, java.lang.Integer.MAX_VALUE, discriminator));
650          childrenList.add(new Property("description", "string", "A human-readable text description of how the slicing works. If there is no discriminator, this is required to be present to provide whatever information is possible about how the slices can be differentiated.", 0, java.lang.Integer.MAX_VALUE, description));
651          childrenList.add(new Property("ordered", "boolean", "If the matching elements have to occur in the same order as defined in the profile.", 0, java.lang.Integer.MAX_VALUE, ordered));
652          childrenList.add(new Property("rules", "code", "Whether additional slices are allowed or not. When the slices are ordered, profile authors can also say that additional slices are only allowed at the end.", 0, java.lang.Integer.MAX_VALUE, rules));
653        }
654
655      @Override
656      public void setProperty(String name, Base value) throws FHIRException {
657        if (name.equals("discriminator"))
658          this.getDiscriminator().add(castToString(value));
659        else if (name.equals("description"))
660          this.description = castToString(value); // StringType
661        else if (name.equals("ordered"))
662          this.ordered = castToBoolean(value); // BooleanType
663        else if (name.equals("rules"))
664          this.rules = new SlicingRulesEnumFactory().fromType(value); // Enumeration<SlicingRules>
665        else
666          super.setProperty(name, value);
667      }
668
669      @Override
670      public Base addChild(String name) throws FHIRException {
671        if (name.equals("discriminator")) {
672          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.discriminator");
673        }
674        else if (name.equals("description")) {
675          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.description");
676        }
677        else if (name.equals("ordered")) {
678          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.ordered");
679        }
680        else if (name.equals("rules")) {
681          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.rules");
682        }
683        else
684          return super.addChild(name);
685      }
686
687      public ElementDefinitionSlicingComponent copy() {
688        ElementDefinitionSlicingComponent dst = new ElementDefinitionSlicingComponent();
689        copyValues(dst);
690        if (discriminator != null) {
691          dst.discriminator = new ArrayList<StringType>();
692          for (StringType i : discriminator)
693            dst.discriminator.add(i.copy());
694        };
695        dst.description = description == null ? null : description.copy();
696        dst.ordered = ordered == null ? null : ordered.copy();
697        dst.rules = rules == null ? null : rules.copy();
698        return dst;
699      }
700
701      @Override
702      public boolean equalsDeep(Base other) {
703        if (!super.equalsDeep(other))
704          return false;
705        if (!(other instanceof ElementDefinitionSlicingComponent))
706          return false;
707        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other;
708        return compareDeep(discriminator, o.discriminator, true) && compareDeep(description, o.description, true)
709           && compareDeep(ordered, o.ordered, true) && compareDeep(rules, o.rules, true);
710      }
711
712      @Override
713      public boolean equalsShallow(Base other) {
714        if (!super.equalsShallow(other))
715          return false;
716        if (!(other instanceof ElementDefinitionSlicingComponent))
717          return false;
718        ElementDefinitionSlicingComponent o = (ElementDefinitionSlicingComponent) other;
719        return compareValues(discriminator, o.discriminator, true) && compareValues(description, o.description, true)
720           && compareValues(ordered, o.ordered, true) && compareValues(rules, o.rules, true);
721      }
722
723      public boolean isEmpty() {
724        return super.isEmpty() && (discriminator == null || discriminator.isEmpty()) && (description == null || description.isEmpty())
725           && (ordered == null || ordered.isEmpty()) && (rules == null || rules.isEmpty());
726      }
727
728  public String fhirType() {
729    return "ElementDefinition.slicing";
730
731  }
732
733  }
734
735    @Block()
736    public static class ElementDefinitionBaseComponent extends Element implements IBaseDatatypeElement {
737        /**
738         * The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [[[StructureDefinition]]] without a StructureDefinition.base.
739         */
740        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
741        @Description(shortDefinition="Path that identifies the base element", formalDefinition="The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [[[StructureDefinition]]] without a StructureDefinition.base." )
742        protected StringType path;
743
744        /**
745         * Minimum cardinality of the base element identified by the path.
746         */
747        @Child(name = "min", type = {IntegerType.class}, order=2, min=1, max=1, modifier=false, summary=true)
748        @Description(shortDefinition="Min cardinality of the base element", formalDefinition="Minimum cardinality of the base element identified by the path." )
749        protected IntegerType min;
750
751        /**
752         * Maximum cardinality of the base element identified by the path.
753         */
754        @Child(name = "max", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
755        @Description(shortDefinition="Max cardinality of the base element", formalDefinition="Maximum cardinality of the base element identified by the path." )
756        protected StringType max;
757
758        private static final long serialVersionUID = 232204455L;
759
760    /*
761     * Constructor
762     */
763      public ElementDefinitionBaseComponent() {
764        super();
765      }
766
767    /*
768     * Constructor
769     */
770      public ElementDefinitionBaseComponent(StringType path, IntegerType min, StringType max) {
771        super();
772        this.path = path;
773        this.min = min;
774        this.max = max;
775      }
776
777        /**
778         * @return {@link #path} (The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [[[StructureDefinition]]] without a StructureDefinition.base.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
779         */
780        public StringType getPathElement() { 
781          if (this.path == null)
782            if (Configuration.errorOnAutoCreate())
783              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.path");
784            else if (Configuration.doAutoCreate())
785              this.path = new StringType(); // bb
786          return this.path;
787        }
788
789        public boolean hasPathElement() { 
790          return this.path != null && !this.path.isEmpty();
791        }
792
793        public boolean hasPath() { 
794          return this.path != null && !this.path.isEmpty();
795        }
796
797        /**
798         * @param value {@link #path} (The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [[[StructureDefinition]]] without a StructureDefinition.base.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
799         */
800        public ElementDefinitionBaseComponent setPathElement(StringType value) { 
801          this.path = value;
802          return this;
803        }
804
805        /**
806         * @return The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [[[StructureDefinition]]] without a StructureDefinition.base.
807         */
808        public String getPath() { 
809          return this.path == null ? null : this.path.getValue();
810        }
811
812        /**
813         * @param value The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [[[StructureDefinition]]] without a StructureDefinition.base.
814         */
815        public ElementDefinitionBaseComponent setPath(String value) { 
816            if (this.path == null)
817              this.path = new StringType();
818            this.path.setValue(value);
819          return this;
820        }
821
822        /**
823         * @return {@link #min} (Minimum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
824         */
825        public IntegerType getMinElement() { 
826          if (this.min == null)
827            if (Configuration.errorOnAutoCreate())
828              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.min");
829            else if (Configuration.doAutoCreate())
830              this.min = new IntegerType(); // bb
831          return this.min;
832        }
833
834        public boolean hasMinElement() { 
835          return this.min != null && !this.min.isEmpty();
836        }
837
838        public boolean hasMin() { 
839          return this.min != null && !this.min.isEmpty();
840        }
841
842        /**
843         * @param value {@link #min} (Minimum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
844         */
845        public ElementDefinitionBaseComponent setMinElement(IntegerType value) { 
846          this.min = value;
847          return this;
848        }
849
850        /**
851         * @return Minimum cardinality of the base element identified by the path.
852         */
853        public int getMin() { 
854          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
855        }
856
857        /**
858         * @param value Minimum cardinality of the base element identified by the path.
859         */
860        public ElementDefinitionBaseComponent setMin(int value) { 
861            if (this.min == null)
862              this.min = new IntegerType();
863            this.min.setValue(value);
864          return this;
865        }
866
867        /**
868         * @return {@link #max} (Maximum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
869         */
870        public StringType getMaxElement() { 
871          if (this.max == null)
872            if (Configuration.errorOnAutoCreate())
873              throw new Error("Attempt to auto-create ElementDefinitionBaseComponent.max");
874            else if (Configuration.doAutoCreate())
875              this.max = new StringType(); // bb
876          return this.max;
877        }
878
879        public boolean hasMaxElement() { 
880          return this.max != null && !this.max.isEmpty();
881        }
882
883        public boolean hasMax() { 
884          return this.max != null && !this.max.isEmpty();
885        }
886
887        /**
888         * @param value {@link #max} (Maximum cardinality of the base element identified by the path.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
889         */
890        public ElementDefinitionBaseComponent setMaxElement(StringType value) { 
891          this.max = value;
892          return this;
893        }
894
895        /**
896         * @return Maximum cardinality of the base element identified by the path.
897         */
898        public String getMax() { 
899          return this.max == null ? null : this.max.getValue();
900        }
901
902        /**
903         * @param value Maximum cardinality of the base element identified by the path.
904         */
905        public ElementDefinitionBaseComponent setMax(String value) { 
906            if (this.max == null)
907              this.max = new StringType();
908            this.max.setValue(value);
909          return this;
910        }
911
912        protected void listChildren(List<Property> childrenList) {
913          super.listChildren(childrenList);
914          childrenList.add(new Property("path", "string", "The Path that identifies the base element - this matches the ElementDefinition.path for that element. Across FHIR, there is only one base definition of any element - that is, an element definition on a [[[StructureDefinition]]] without a StructureDefinition.base.", 0, java.lang.Integer.MAX_VALUE, path));
915          childrenList.add(new Property("min", "integer", "Minimum cardinality of the base element identified by the path.", 0, java.lang.Integer.MAX_VALUE, min));
916          childrenList.add(new Property("max", "string", "Maximum cardinality of the base element identified by the path.", 0, java.lang.Integer.MAX_VALUE, max));
917        }
918
919      @Override
920      public void setProperty(String name, Base value) throws FHIRException {
921        if (name.equals("path"))
922          this.path = castToString(value); // StringType
923        else if (name.equals("min"))
924          this.min = castToInteger(value); // IntegerType
925        else if (name.equals("max"))
926          this.max = castToString(value); // StringType
927        else
928          super.setProperty(name, value);
929      }
930
931      @Override
932      public Base addChild(String name) throws FHIRException {
933        if (name.equals("path")) {
934          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.path");
935        }
936        else if (name.equals("min")) {
937          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.min");
938        }
939        else if (name.equals("max")) {
940          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.max");
941        }
942        else
943          return super.addChild(name);
944      }
945
946      public ElementDefinitionBaseComponent copy() {
947        ElementDefinitionBaseComponent dst = new ElementDefinitionBaseComponent();
948        copyValues(dst);
949        dst.path = path == null ? null : path.copy();
950        dst.min = min == null ? null : min.copy();
951        dst.max = max == null ? null : max.copy();
952        return dst;
953      }
954
955      @Override
956      public boolean equalsDeep(Base other) {
957        if (!super.equalsDeep(other))
958          return false;
959        if (!(other instanceof ElementDefinitionBaseComponent))
960          return false;
961        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other;
962        return compareDeep(path, o.path, true) && compareDeep(min, o.min, true) && compareDeep(max, o.max, true)
963          ;
964      }
965
966      @Override
967      public boolean equalsShallow(Base other) {
968        if (!super.equalsShallow(other))
969          return false;
970        if (!(other instanceof ElementDefinitionBaseComponent))
971          return false;
972        ElementDefinitionBaseComponent o = (ElementDefinitionBaseComponent) other;
973        return compareValues(path, o.path, true) && compareValues(min, o.min, true) && compareValues(max, o.max, true)
974          ;
975      }
976
977      public boolean isEmpty() {
978        return super.isEmpty() && (path == null || path.isEmpty()) && (min == null || min.isEmpty())
979           && (max == null || max.isEmpty());
980      }
981
982  public String fhirType() {
983    return "ElementDefinition.base";
984
985  }
986
987  }
988
989    @Block()
990    public static class TypeRefComponent extends Element implements IBaseDatatypeElement {
991        /**
992         * Name of Data type or Resource that is a(or the) type used for this element.
993         */
994        @Child(name = "code", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
995        @Description(shortDefinition="Name of Data type or Resource", formalDefinition="Name of Data type or Resource that is a(or the) type used for this element." )
996        protected CodeType code;
997
998        /**
999         * Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.
1000         */
1001        @Child(name = "profile", type = {UriType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1002        @Description(shortDefinition="Profile (StructureDefinition) to apply (or IG)", formalDefinition="Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide." )
1003        protected List<UriType> profile;
1004
1005        /**
1006         * If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.
1007         */
1008        @Child(name = "aggregation", type = {CodeType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1009        @Description(shortDefinition="contained | referenced | bundled - how aggregated", formalDefinition="If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle." )
1010        protected List<Enumeration<AggregationMode>> aggregation;
1011
1012        private static final long serialVersionUID = -988693373L;
1013
1014    /*
1015     * Constructor
1016     */
1017      public TypeRefComponent() {
1018        super();
1019      }
1020
1021    /*
1022     * Constructor
1023     */
1024      public TypeRefComponent(CodeType code) {
1025        super();
1026        this.code = code;
1027      }
1028
1029        /**
1030         * @return {@link #code} (Name of Data type or Resource that is a(or the) type used for this element.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1031         */
1032        public CodeType getCodeElement() { 
1033          if (this.code == null)
1034            if (Configuration.errorOnAutoCreate())
1035              throw new Error("Attempt to auto-create TypeRefComponent.code");
1036            else if (Configuration.doAutoCreate())
1037              this.code = new CodeType(); // bb
1038          return this.code;
1039        }
1040
1041        public boolean hasCodeElement() { 
1042          return this.code != null && !this.code.isEmpty();
1043        }
1044
1045        public boolean hasCode() { 
1046          return this.code != null && !this.code.isEmpty();
1047        }
1048
1049        /**
1050         * @param value {@link #code} (Name of Data type or Resource that is a(or the) type used for this element.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1051         */
1052        public TypeRefComponent setCodeElement(CodeType value) { 
1053          this.code = value;
1054          return this;
1055        }
1056
1057        /**
1058         * @return Name of Data type or Resource that is a(or the) type used for this element.
1059         */
1060        public String getCode() { 
1061          return this.code == null ? null : this.code.getValue();
1062        }
1063
1064        /**
1065         * @param value Name of Data type or Resource that is a(or the) type used for this element.
1066         */
1067        public TypeRefComponent setCode(String value) { 
1068            if (this.code == null)
1069              this.code = new CodeType();
1070            this.code.setValue(value);
1071          return this;
1072        }
1073
1074        /**
1075         * @return {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1076         */
1077        public List<UriType> getProfile() { 
1078          if (this.profile == null)
1079            this.profile = new ArrayList<UriType>();
1080          return this.profile;
1081        }
1082
1083        public boolean hasProfile() { 
1084          if (this.profile == null)
1085            return false;
1086          for (UriType item : this.profile)
1087            if (!item.isEmpty())
1088              return true;
1089          return false;
1090        }
1091
1092        /**
1093         * @return {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1094         */
1095    // syntactic sugar
1096        public UriType addProfileElement() {//2 
1097          UriType t = new UriType();
1098          if (this.profile == null)
1099            this.profile = new ArrayList<UriType>();
1100          this.profile.add(t);
1101          return t;
1102        }
1103
1104        /**
1105         * @param value {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1106         */
1107        public TypeRefComponent addProfile(String value) { //1
1108          UriType t = new UriType();
1109          t.setValue(value);
1110          if (this.profile == null)
1111            this.profile = new ArrayList<UriType>();
1112          this.profile.add(t);
1113          return this;
1114        }
1115
1116        /**
1117         * @param value {@link #profile} (Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.)
1118         */
1119        public boolean hasProfile(String value) { 
1120          if (this.profile == null)
1121            return false;
1122          for (UriType v : this.profile)
1123            if (v.equals(value)) // uri
1124              return true;
1125          return false;
1126        }
1127
1128        /**
1129         * @return {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
1130         */
1131        public List<Enumeration<AggregationMode>> getAggregation() { 
1132          if (this.aggregation == null)
1133            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1134          return this.aggregation;
1135        }
1136
1137        public TypeRefComponent setAggregation(List<Enumeration<AggregationMode>> aggregation) {
1138            this.aggregation = aggregation;
1139            return this;
1140        }
1141
1142        public boolean hasAggregation() {
1143          if (this.aggregation == null)
1144            return false;
1145          for (Enumeration<AggregationMode> item : this.aggregation)
1146            if (!item.isEmpty())
1147              return true;
1148          return false;
1149        }
1150
1151        /**
1152         * @return {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
1153         */
1154    // syntactic sugar
1155        public Enumeration<AggregationMode> addAggregationElement() {//2 
1156          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
1157          if (this.aggregation == null)
1158            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1159          this.aggregation.add(t);
1160          return t;
1161        }
1162
1163        /**
1164         * @param value {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
1165         */
1166        public TypeRefComponent addAggregation(AggregationMode value) { //1
1167          Enumeration<AggregationMode> t = new Enumeration<AggregationMode>(new AggregationModeEnumFactory());
1168          t.setValue(value);
1169          if (this.aggregation == null)
1170            this.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1171          this.aggregation.add(t);
1172          return this;
1173        }
1174
1175        /**
1176         * @param value {@link #aggregation} (If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.)
1177         */
1178        public boolean hasAggregation(AggregationMode value) { 
1179          if (this.aggregation == null)
1180            return false;
1181          for (Enumeration<AggregationMode> v : this.aggregation)
1182            if (v.equals(value)) // code
1183              return true;
1184          return false;
1185        }
1186
1187        protected void listChildren(List<Property> childrenList) {
1188          super.listChildren(childrenList);
1189          childrenList.add(new Property("code", "code", "Name of Data type or Resource that is a(or the) type used for this element.", 0, java.lang.Integer.MAX_VALUE, code));
1190          childrenList.add(new Property("profile", "uri", "Identifies a profile structure or implementation Guide that SHALL hold for resources or datatypes referenced as the type of this element. Can be a local reference - to another structure in this profile, or a reference to a structure in another profile. When more than one profile is specified, the content must conform to all of them. When an implementation guide is specified, the resource SHALL conform to at least one profile defined in the implementation guide.", 0, java.lang.Integer.MAX_VALUE, profile));
1191          childrenList.add(new Property("aggregation", "code", "If the type is a reference to another resource, how the resource is or can be aggregated - is it a contained resource, or a reference, and if the context is a bundle, is it included in the bundle.", 0, java.lang.Integer.MAX_VALUE, aggregation));
1192        }
1193
1194      @Override
1195      public void setProperty(String name, Base value) throws FHIRException {
1196        if (name.equals("code"))
1197          this.code = castToCode(value); // CodeType
1198        else if (name.equals("profile"))
1199          this.getProfile().add(castToUri(value));
1200        else if (name.equals("aggregation"))
1201          this.getAggregation().add(new AggregationModeEnumFactory().fromType(value));
1202        else
1203          super.setProperty(name, value);
1204      }
1205
1206      @Override
1207      public Base addChild(String name) throws FHIRException {
1208        if (name.equals("code")) {
1209          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.code");
1210        }
1211        else if (name.equals("profile")) {
1212          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.profile");
1213        }
1214        else if (name.equals("aggregation")) {
1215          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.aggregation");
1216        }
1217        else
1218          return super.addChild(name);
1219      }
1220
1221      public TypeRefComponent copy() {
1222        TypeRefComponent dst = new TypeRefComponent();
1223        copyValues(dst);
1224        dst.code = code == null ? null : code.copy();
1225        if (profile != null) {
1226          dst.profile = new ArrayList<UriType>();
1227          for (UriType i : profile)
1228            dst.profile.add(i.copy());
1229        };
1230        if (aggregation != null) {
1231          dst.aggregation = new ArrayList<Enumeration<AggregationMode>>();
1232          for (Enumeration<AggregationMode> i : aggregation)
1233            dst.aggregation.add(i.copy());
1234        };
1235        return dst;
1236      }
1237
1238      @Override
1239      public boolean equalsDeep(Base other) {
1240        if (!super.equalsDeep(other))
1241          return false;
1242        if (!(other instanceof TypeRefComponent))
1243          return false;
1244        TypeRefComponent o = (TypeRefComponent) other;
1245        return compareDeep(code, o.code, true) && compareDeep(profile, o.profile, true) && compareDeep(aggregation, o.aggregation, true)
1246          ;
1247      }
1248
1249      @Override
1250      public boolean equalsShallow(Base other) {
1251        if (!super.equalsShallow(other))
1252          return false;
1253        if (!(other instanceof TypeRefComponent))
1254          return false;
1255        TypeRefComponent o = (TypeRefComponent) other;
1256        return compareValues(code, o.code, true) && compareValues(profile, o.profile, true) && compareValues(aggregation, o.aggregation, true)
1257          ;
1258      }
1259
1260      public boolean isEmpty() {
1261        return super.isEmpty() && (code == null || code.isEmpty()) && (profile == null || profile.isEmpty())
1262           && (aggregation == null || aggregation.isEmpty());
1263      }
1264
1265  public String fhirType() {
1266    return "ElementDefinition.type";
1267
1268  }
1269
1270  public boolean hasTarget() {
1271    return Utilities.existsInList(getCode(), "Reference");
1272
1273  }
1274
1275  }
1276
1277    @Block()
1278    public static class ElementDefinitionConstraintComponent extends Element implements IBaseDatatypeElement {
1279        /**
1280         * Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
1281         */
1282        @Child(name = "key", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1283        @Description(shortDefinition="Target of 'condition' reference above", formalDefinition="Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality." )
1284        protected IdType key;
1285
1286        /**
1287         * Description of why this constraint is necessary or appropriate.
1288         */
1289        @Child(name = "requirements", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1290        @Description(shortDefinition="Why this constraint necessary or appropriate", formalDefinition="Description of why this constraint is necessary or appropriate." )
1291        protected StringType requirements;
1292
1293        /**
1294         * Identifies the impact constraint violation has on the conformance of the instance.
1295         */
1296        @Child(name = "severity", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1297        @Description(shortDefinition="error | warning", formalDefinition="Identifies the impact constraint violation has on the conformance of the instance." )
1298        protected Enumeration<ConstraintSeverity> severity;
1299
1300        /**
1301         * Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
1302         */
1303        @Child(name = "human", type = {StringType.class}, order=4, min=1, max=1, modifier=false, summary=true)
1304        @Description(shortDefinition="Human description of constraint", formalDefinition="Text that can be used to describe the constraint in messages identifying that the constraint has been violated." )
1305        protected StringType human;
1306
1307        /**
1308         * An XPath expression of constraint that can be executed to see if this constraint is met.
1309         */
1310        @Child(name = "xpath", type = {StringType.class}, order=5, min=1, max=1, modifier=false, summary=true)
1311        @Description(shortDefinition="XPath expression of constraint", formalDefinition="An XPath expression of constraint that can be executed to see if this constraint is met." )
1312        protected StringType xpath;
1313
1314        private static final long serialVersionUID = 854521265L;
1315
1316    /*
1317     * Constructor
1318     */
1319      public ElementDefinitionConstraintComponent() {
1320        super();
1321      }
1322
1323    /*
1324     * Constructor
1325     */
1326      public ElementDefinitionConstraintComponent(IdType key, Enumeration<ConstraintSeverity> severity, StringType human, StringType xpath) {
1327        super();
1328        this.key = key;
1329        this.severity = severity;
1330        this.human = human;
1331        this.xpath = xpath;
1332      }
1333
1334        /**
1335         * @return {@link #key} (Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.). This is the underlying object with id, value and extensions. The accessor "getKey" gives direct access to the value
1336         */
1337        public IdType getKeyElement() { 
1338          if (this.key == null)
1339            if (Configuration.errorOnAutoCreate())
1340              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.key");
1341            else if (Configuration.doAutoCreate())
1342              this.key = new IdType(); // bb
1343          return this.key;
1344        }
1345
1346        public boolean hasKeyElement() { 
1347          return this.key != null && !this.key.isEmpty();
1348        }
1349
1350        public boolean hasKey() { 
1351          return this.key != null && !this.key.isEmpty();
1352        }
1353
1354        /**
1355         * @param value {@link #key} (Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.). This is the underlying object with id, value and extensions. The accessor "getKey" gives direct access to the value
1356         */
1357        public ElementDefinitionConstraintComponent setKeyElement(IdType value) { 
1358          this.key = value;
1359          return this;
1360        }
1361
1362        /**
1363         * @return Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
1364         */
1365        public String getKey() { 
1366          return this.key == null ? null : this.key.getValue();
1367        }
1368
1369        /**
1370         * @param value Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.
1371         */
1372        public ElementDefinitionConstraintComponent setKey(String value) { 
1373            if (this.key == null)
1374              this.key = new IdType();
1375            this.key.setValue(value);
1376          return this;
1377        }
1378
1379        /**
1380         * @return {@link #requirements} (Description of why this constraint is necessary or appropriate.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
1381         */
1382        public StringType getRequirementsElement() { 
1383          if (this.requirements == null)
1384            if (Configuration.errorOnAutoCreate())
1385              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.requirements");
1386            else if (Configuration.doAutoCreate())
1387              this.requirements = new StringType(); // bb
1388          return this.requirements;
1389        }
1390
1391        public boolean hasRequirementsElement() { 
1392          return this.requirements != null && !this.requirements.isEmpty();
1393        }
1394
1395        public boolean hasRequirements() { 
1396          return this.requirements != null && !this.requirements.isEmpty();
1397        }
1398
1399        /**
1400         * @param value {@link #requirements} (Description of why this constraint is necessary or appropriate.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
1401         */
1402        public ElementDefinitionConstraintComponent setRequirementsElement(StringType value) { 
1403          this.requirements = value;
1404          return this;
1405        }
1406
1407        /**
1408         * @return Description of why this constraint is necessary or appropriate.
1409         */
1410        public String getRequirements() { 
1411          return this.requirements == null ? null : this.requirements.getValue();
1412        }
1413
1414        /**
1415         * @param value Description of why this constraint is necessary or appropriate.
1416         */
1417        public ElementDefinitionConstraintComponent setRequirements(String value) { 
1418          if (Utilities.noString(value))
1419            this.requirements = null;
1420          else {
1421            if (this.requirements == null)
1422              this.requirements = new StringType();
1423            this.requirements.setValue(value);
1424          }
1425          return this;
1426        }
1427
1428        /**
1429         * @return {@link #severity} (Identifies the impact constraint violation has on the conformance of the instance.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
1430         */
1431        public Enumeration<ConstraintSeverity> getSeverityElement() { 
1432          if (this.severity == null)
1433            if (Configuration.errorOnAutoCreate())
1434              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.severity");
1435            else if (Configuration.doAutoCreate())
1436              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory()); // bb
1437          return this.severity;
1438        }
1439
1440        public boolean hasSeverityElement() { 
1441          return this.severity != null && !this.severity.isEmpty();
1442        }
1443
1444        public boolean hasSeverity() { 
1445          return this.severity != null && !this.severity.isEmpty();
1446        }
1447
1448        /**
1449         * @param value {@link #severity} (Identifies the impact constraint violation has on the conformance of the instance.). This is the underlying object with id, value and extensions. The accessor "getSeverity" gives direct access to the value
1450         */
1451        public ElementDefinitionConstraintComponent setSeverityElement(Enumeration<ConstraintSeverity> value) { 
1452          this.severity = value;
1453          return this;
1454        }
1455
1456        /**
1457         * @return Identifies the impact constraint violation has on the conformance of the instance.
1458         */
1459        public ConstraintSeverity getSeverity() { 
1460          return this.severity == null ? null : this.severity.getValue();
1461        }
1462
1463        /**
1464         * @param value Identifies the impact constraint violation has on the conformance of the instance.
1465         */
1466        public ElementDefinitionConstraintComponent setSeverity(ConstraintSeverity value) { 
1467            if (this.severity == null)
1468              this.severity = new Enumeration<ConstraintSeverity>(new ConstraintSeverityEnumFactory());
1469            this.severity.setValue(value);
1470          return this;
1471        }
1472
1473        /**
1474         * @return {@link #human} (Text that can be used to describe the constraint in messages identifying that the constraint has been violated.). This is the underlying object with id, value and extensions. The accessor "getHuman" gives direct access to the value
1475         */
1476        public StringType getHumanElement() { 
1477          if (this.human == null)
1478            if (Configuration.errorOnAutoCreate())
1479              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.human");
1480            else if (Configuration.doAutoCreate())
1481              this.human = new StringType(); // bb
1482          return this.human;
1483        }
1484
1485        public boolean hasHumanElement() { 
1486          return this.human != null && !this.human.isEmpty();
1487        }
1488
1489        public boolean hasHuman() { 
1490          return this.human != null && !this.human.isEmpty();
1491        }
1492
1493        /**
1494         * @param value {@link #human} (Text that can be used to describe the constraint in messages identifying that the constraint has been violated.). This is the underlying object with id, value and extensions. The accessor "getHuman" gives direct access to the value
1495         */
1496        public ElementDefinitionConstraintComponent setHumanElement(StringType value) { 
1497          this.human = value;
1498          return this;
1499        }
1500
1501        /**
1502         * @return Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
1503         */
1504        public String getHuman() { 
1505          return this.human == null ? null : this.human.getValue();
1506        }
1507
1508        /**
1509         * @param value Text that can be used to describe the constraint in messages identifying that the constraint has been violated.
1510         */
1511        public ElementDefinitionConstraintComponent setHuman(String value) { 
1512            if (this.human == null)
1513              this.human = new StringType();
1514            this.human.setValue(value);
1515          return this;
1516        }
1517
1518        /**
1519         * @return {@link #xpath} (An XPath expression of constraint that can be executed to see if this constraint is met.). This is the underlying object with id, value and extensions. The accessor "getXpath" gives direct access to the value
1520         */
1521        public StringType getXpathElement() { 
1522          if (this.xpath == null)
1523            if (Configuration.errorOnAutoCreate())
1524              throw new Error("Attempt to auto-create ElementDefinitionConstraintComponent.xpath");
1525            else if (Configuration.doAutoCreate())
1526              this.xpath = new StringType(); // bb
1527          return this.xpath;
1528        }
1529
1530        public boolean hasXpathElement() { 
1531          return this.xpath != null && !this.xpath.isEmpty();
1532        }
1533
1534        public boolean hasXpath() { 
1535          return this.xpath != null && !this.xpath.isEmpty();
1536        }
1537
1538        /**
1539         * @param value {@link #xpath} (An XPath expression of constraint that can be executed to see if this constraint is met.). This is the underlying object with id, value and extensions. The accessor "getXpath" gives direct access to the value
1540         */
1541        public ElementDefinitionConstraintComponent setXpathElement(StringType value) { 
1542          this.xpath = value;
1543          return this;
1544        }
1545
1546        /**
1547         * @return An XPath expression of constraint that can be executed to see if this constraint is met.
1548         */
1549        public String getXpath() { 
1550          return this.xpath == null ? null : this.xpath.getValue();
1551        }
1552
1553        /**
1554         * @param value An XPath expression of constraint that can be executed to see if this constraint is met.
1555         */
1556        public ElementDefinitionConstraintComponent setXpath(String value) { 
1557            if (this.xpath == null)
1558              this.xpath = new StringType();
1559            this.xpath.setValue(value);
1560          return this;
1561        }
1562
1563        protected void listChildren(List<Property> childrenList) {
1564          super.listChildren(childrenList);
1565          childrenList.add(new Property("key", "id", "Allows identification of which elements have their cardinalities impacted by the constraint.  Will not be referenced for constraints that do not affect cardinality.", 0, java.lang.Integer.MAX_VALUE, key));
1566          childrenList.add(new Property("requirements", "string", "Description of why this constraint is necessary or appropriate.", 0, java.lang.Integer.MAX_VALUE, requirements));
1567          childrenList.add(new Property("severity", "code", "Identifies the impact constraint violation has on the conformance of the instance.", 0, java.lang.Integer.MAX_VALUE, severity));
1568          childrenList.add(new Property("human", "string", "Text that can be used to describe the constraint in messages identifying that the constraint has been violated.", 0, java.lang.Integer.MAX_VALUE, human));
1569          childrenList.add(new Property("xpath", "string", "An XPath expression of constraint that can be executed to see if this constraint is met.", 0, java.lang.Integer.MAX_VALUE, xpath));
1570        }
1571
1572      @Override
1573      public void setProperty(String name, Base value) throws FHIRException {
1574        if (name.equals("key"))
1575          this.key = castToId(value); // IdType
1576        else if (name.equals("requirements"))
1577          this.requirements = castToString(value); // StringType
1578        else if (name.equals("severity"))
1579          this.severity = new ConstraintSeverityEnumFactory().fromType(value); // Enumeration<ConstraintSeverity>
1580        else if (name.equals("human"))
1581          this.human = castToString(value); // StringType
1582        else if (name.equals("xpath"))
1583          this.xpath = castToString(value); // StringType
1584        else
1585          super.setProperty(name, value);
1586      }
1587
1588      @Override
1589      public Base addChild(String name) throws FHIRException {
1590        if (name.equals("key")) {
1591          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.key");
1592        }
1593        else if (name.equals("requirements")) {
1594          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.requirements");
1595        }
1596        else if (name.equals("severity")) {
1597          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.severity");
1598        }
1599        else if (name.equals("human")) {
1600          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.human");
1601        }
1602        else if (name.equals("xpath")) {
1603          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.xpath");
1604        }
1605        else
1606          return super.addChild(name);
1607      }
1608
1609      public ElementDefinitionConstraintComponent copy() {
1610        ElementDefinitionConstraintComponent dst = new ElementDefinitionConstraintComponent();
1611        copyValues(dst);
1612        dst.key = key == null ? null : key.copy();
1613        dst.requirements = requirements == null ? null : requirements.copy();
1614        dst.severity = severity == null ? null : severity.copy();
1615        dst.human = human == null ? null : human.copy();
1616        dst.xpath = xpath == null ? null : xpath.copy();
1617        return dst;
1618      }
1619
1620      @Override
1621      public boolean equalsDeep(Base other) {
1622        if (!super.equalsDeep(other))
1623          return false;
1624        if (!(other instanceof ElementDefinitionConstraintComponent))
1625          return false;
1626        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other;
1627        return compareDeep(key, o.key, true) && compareDeep(requirements, o.requirements, true) && compareDeep(severity, o.severity, true)
1628           && compareDeep(human, o.human, true) && compareDeep(xpath, o.xpath, true);
1629      }
1630
1631      @Override
1632      public boolean equalsShallow(Base other) {
1633        if (!super.equalsShallow(other))
1634          return false;
1635        if (!(other instanceof ElementDefinitionConstraintComponent))
1636          return false;
1637        ElementDefinitionConstraintComponent o = (ElementDefinitionConstraintComponent) other;
1638        return compareValues(key, o.key, true) && compareValues(requirements, o.requirements, true) && compareValues(severity, o.severity, true)
1639           && compareValues(human, o.human, true) && compareValues(xpath, o.xpath, true);
1640      }
1641
1642      public boolean isEmpty() {
1643        return super.isEmpty() && (key == null || key.isEmpty()) && (requirements == null || requirements.isEmpty())
1644           && (severity == null || severity.isEmpty()) && (human == null || human.isEmpty()) && (xpath == null || xpath.isEmpty())
1645          ;
1646      }
1647
1648  public String fhirType() {
1649    return "ElementDefinition.constraint";
1650
1651  }
1652
1653  }
1654
1655    @Block()
1656    public static class ElementDefinitionBindingComponent extends Element implements IBaseDatatypeElement {
1657        /**
1658         * Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.
1659         */
1660        @Child(name = "strength", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1661        @Description(shortDefinition="required | extensible | preferred | example", formalDefinition="Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances." )
1662        protected Enumeration<BindingStrength> strength;
1663
1664        /**
1665         * Describes the intended use of this particular set of codes.
1666         */
1667        @Child(name = "description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1668        @Description(shortDefinition="Human explanation of the value set", formalDefinition="Describes the intended use of this particular set of codes." )
1669        protected StringType description;
1670
1671        /**
1672         * Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.
1673         */
1674        @Child(name = "valueSet", type = {UriType.class, ValueSet.class}, order=3, min=0, max=1, modifier=false, summary=true)
1675        @Description(shortDefinition="Source of value set", formalDefinition="Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used." )
1676        protected Type valueSet;
1677
1678        private static final long serialVersionUID = 1355538460L;
1679
1680    /*
1681     * Constructor
1682     */
1683      public ElementDefinitionBindingComponent() {
1684        super();
1685      }
1686
1687    /*
1688     * Constructor
1689     */
1690      public ElementDefinitionBindingComponent(Enumeration<BindingStrength> strength) {
1691        super();
1692        this.strength = strength;
1693      }
1694
1695        /**
1696         * @return {@link #strength} (Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.). This is the underlying object with id, value and extensions. The accessor "getStrength" gives direct access to the value
1697         */
1698        public Enumeration<BindingStrength> getStrengthElement() { 
1699          if (this.strength == null)
1700            if (Configuration.errorOnAutoCreate())
1701              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.strength");
1702            else if (Configuration.doAutoCreate())
1703              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory()); // bb
1704          return this.strength;
1705        }
1706
1707        public boolean hasStrengthElement() { 
1708          return this.strength != null && !this.strength.isEmpty();
1709        }
1710
1711        public boolean hasStrength() { 
1712          return this.strength != null && !this.strength.isEmpty();
1713        }
1714
1715        /**
1716         * @param value {@link #strength} (Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.). This is the underlying object with id, value and extensions. The accessor "getStrength" gives direct access to the value
1717         */
1718        public ElementDefinitionBindingComponent setStrengthElement(Enumeration<BindingStrength> value) { 
1719          this.strength = value;
1720          return this;
1721        }
1722
1723        /**
1724         * @return Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.
1725         */
1726        public BindingStrength getStrength() { 
1727          return this.strength == null ? null : this.strength.getValue();
1728        }
1729
1730        /**
1731         * @param value Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.
1732         */
1733        public ElementDefinitionBindingComponent setStrength(BindingStrength value) { 
1734            if (this.strength == null)
1735              this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory());
1736            this.strength.setValue(value);
1737          return this;
1738        }
1739
1740        /**
1741         * @return {@link #description} (Describes the intended use of this particular set of codes.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1742         */
1743        public StringType getDescriptionElement() { 
1744          if (this.description == null)
1745            if (Configuration.errorOnAutoCreate())
1746              throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.description");
1747            else if (Configuration.doAutoCreate())
1748              this.description = new StringType(); // bb
1749          return this.description;
1750        }
1751
1752        public boolean hasDescriptionElement() { 
1753          return this.description != null && !this.description.isEmpty();
1754        }
1755
1756        public boolean hasDescription() { 
1757          return this.description != null && !this.description.isEmpty();
1758        }
1759
1760        /**
1761         * @param value {@link #description} (Describes the intended use of this particular set of codes.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1762         */
1763        public ElementDefinitionBindingComponent setDescriptionElement(StringType value) { 
1764          this.description = value;
1765          return this;
1766        }
1767
1768        /**
1769         * @return Describes the intended use of this particular set of codes.
1770         */
1771        public String getDescription() { 
1772          return this.description == null ? null : this.description.getValue();
1773        }
1774
1775        /**
1776         * @param value Describes the intended use of this particular set of codes.
1777         */
1778        public ElementDefinitionBindingComponent setDescription(String value) { 
1779          if (Utilities.noString(value))
1780            this.description = null;
1781          else {
1782            if (this.description == null)
1783              this.description = new StringType();
1784            this.description.setValue(value);
1785          }
1786          return this;
1787        }
1788
1789        /**
1790         * @return {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.)
1791         */
1792        public Type getValueSet() { 
1793          return this.valueSet;
1794        }
1795
1796        /**
1797         * @return {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.)
1798         */
1799        public UriType getValueSetUriType() throws FHIRException { 
1800          if (!(this.valueSet instanceof UriType))
1801            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.valueSet.getClass().getName()+" was encountered");
1802          return (UriType) this.valueSet;
1803        }
1804
1805        public boolean hasValueSetUriType() { 
1806          return this.valueSet instanceof UriType;
1807        }
1808
1809        /**
1810         * @return {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.)
1811         */
1812        public Reference getValueSetReference() throws FHIRException { 
1813          if (!(this.valueSet instanceof Reference))
1814            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.valueSet.getClass().getName()+" was encountered");
1815          return (Reference) this.valueSet;
1816        }
1817
1818        public boolean hasValueSetReference() { 
1819          return this.valueSet instanceof Reference;
1820        }
1821
1822        public boolean hasValueSet() { 
1823          return this.valueSet != null && !this.valueSet.isEmpty();
1824        }
1825
1826        /**
1827         * @param value {@link #valueSet} (Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.)
1828         */
1829        public ElementDefinitionBindingComponent setValueSet(Type value) { 
1830          this.valueSet = value;
1831          return this;
1832        }
1833
1834        protected void listChildren(List<Property> childrenList) {
1835          super.listChildren(childrenList);
1836          childrenList.add(new Property("strength", "code", "Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.", 0, java.lang.Integer.MAX_VALUE, strength));
1837          childrenList.add(new Property("description", "string", "Describes the intended use of this particular set of codes.", 0, java.lang.Integer.MAX_VALUE, description));
1838          childrenList.add(new Property("valueSet[x]", "uri|Reference(ValueSet)", "Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.", 0, java.lang.Integer.MAX_VALUE, valueSet));
1839        }
1840
1841      @Override
1842      public void setProperty(String name, Base value) throws FHIRException {
1843        if (name.equals("strength"))
1844          this.strength = new BindingStrengthEnumFactory().fromType(value); // Enumeration<BindingStrength>
1845        else if (name.equals("description"))
1846          this.description = castToString(value); // StringType
1847        else if (name.equals("valueSet[x]"))
1848          this.valueSet = (Type) value; // Type
1849        else
1850          super.setProperty(name, value);
1851      }
1852
1853      @Override
1854      public Base addChild(String name) throws FHIRException {
1855        if (name.equals("strength")) {
1856          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.strength");
1857        }
1858        else if (name.equals("description")) {
1859          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.description");
1860        }
1861        else if (name.equals("valueSetUri")) {
1862          this.valueSet = new UriType();
1863          return this.valueSet;
1864        }
1865        else if (name.equals("valueSetReference")) {
1866          this.valueSet = new Reference();
1867          return this.valueSet;
1868        }
1869        else
1870          return super.addChild(name);
1871      }
1872
1873      public ElementDefinitionBindingComponent copy() {
1874        ElementDefinitionBindingComponent dst = new ElementDefinitionBindingComponent();
1875        copyValues(dst);
1876        dst.strength = strength == null ? null : strength.copy();
1877        dst.description = description == null ? null : description.copy();
1878        dst.valueSet = valueSet == null ? null : valueSet.copy();
1879        return dst;
1880      }
1881
1882      @Override
1883      public boolean equalsDeep(Base other) {
1884        if (!super.equalsDeep(other))
1885          return false;
1886        if (!(other instanceof ElementDefinitionBindingComponent))
1887          return false;
1888        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other;
1889        return compareDeep(strength, o.strength, true) && compareDeep(description, o.description, true)
1890           && compareDeep(valueSet, o.valueSet, true);
1891      }
1892
1893      @Override
1894      public boolean equalsShallow(Base other) {
1895        if (!super.equalsShallow(other))
1896          return false;
1897        if (!(other instanceof ElementDefinitionBindingComponent))
1898          return false;
1899        ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other;
1900        return compareValues(strength, o.strength, true) && compareValues(description, o.description, true)
1901          ;
1902      }
1903
1904      public boolean isEmpty() {
1905        return super.isEmpty() && (strength == null || strength.isEmpty()) && (description == null || description.isEmpty())
1906           && (valueSet == null || valueSet.isEmpty());
1907      }
1908
1909  public String fhirType() {
1910    return "ElementDefinition.binding";
1911
1912  }
1913
1914  }
1915
1916    @Block()
1917    public static class ElementDefinitionMappingComponent extends Element implements IBaseDatatypeElement {
1918        /**
1919         * An internal reference to the definition of a mapping.
1920         */
1921        @Child(name = "identity", type = {IdType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1922        @Description(shortDefinition="Reference to mapping declaration", formalDefinition="An internal reference to the definition of a mapping." )
1923        protected IdType identity;
1924
1925        /**
1926         * Identifies the computable language in which mapping.map is expressed.
1927         */
1928        @Child(name = "language", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1929        @Description(shortDefinition="Computable language of mapping", formalDefinition="Identifies the computable language in which mapping.map is expressed." )
1930        protected CodeType language;
1931
1932        /**
1933         * Expresses what part of the target specification corresponds to this element.
1934         */
1935        @Child(name = "map", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1936        @Description(shortDefinition="Details of the mapping", formalDefinition="Expresses what part of the target specification corresponds to this element." )
1937        protected StringType map;
1938
1939        private static final long serialVersionUID = -669205371L;
1940
1941    /*
1942     * Constructor
1943     */
1944      public ElementDefinitionMappingComponent() {
1945        super();
1946      }
1947
1948    /*
1949     * Constructor
1950     */
1951      public ElementDefinitionMappingComponent(IdType identity, StringType map) {
1952        super();
1953        this.identity = identity;
1954        this.map = map;
1955      }
1956
1957        /**
1958         * @return {@link #identity} (An internal reference to the definition of a mapping.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
1959         */
1960        public IdType getIdentityElement() { 
1961          if (this.identity == null)
1962            if (Configuration.errorOnAutoCreate())
1963              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.identity");
1964            else if (Configuration.doAutoCreate())
1965              this.identity = new IdType(); // bb
1966          return this.identity;
1967        }
1968
1969        public boolean hasIdentityElement() { 
1970          return this.identity != null && !this.identity.isEmpty();
1971        }
1972
1973        public boolean hasIdentity() { 
1974          return this.identity != null && !this.identity.isEmpty();
1975        }
1976
1977        /**
1978         * @param value {@link #identity} (An internal reference to the definition of a mapping.). This is the underlying object with id, value and extensions. The accessor "getIdentity" gives direct access to the value
1979         */
1980        public ElementDefinitionMappingComponent setIdentityElement(IdType value) { 
1981          this.identity = value;
1982          return this;
1983        }
1984
1985        /**
1986         * @return An internal reference to the definition of a mapping.
1987         */
1988        public String getIdentity() { 
1989          return this.identity == null ? null : this.identity.getValue();
1990        }
1991
1992        /**
1993         * @param value An internal reference to the definition of a mapping.
1994         */
1995        public ElementDefinitionMappingComponent setIdentity(String value) { 
1996            if (this.identity == null)
1997              this.identity = new IdType();
1998            this.identity.setValue(value);
1999          return this;
2000        }
2001
2002        /**
2003         * @return {@link #language} (Identifies the computable language in which mapping.map is expressed.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value
2004         */
2005        public CodeType getLanguageElement() { 
2006          if (this.language == null)
2007            if (Configuration.errorOnAutoCreate())
2008              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.language");
2009            else if (Configuration.doAutoCreate())
2010              this.language = new CodeType(); // bb
2011          return this.language;
2012        }
2013
2014        public boolean hasLanguageElement() { 
2015          return this.language != null && !this.language.isEmpty();
2016        }
2017
2018        public boolean hasLanguage() { 
2019          return this.language != null && !this.language.isEmpty();
2020        }
2021
2022        /**
2023         * @param value {@link #language} (Identifies the computable language in which mapping.map is expressed.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value
2024         */
2025        public ElementDefinitionMappingComponent setLanguageElement(CodeType value) { 
2026          this.language = value;
2027          return this;
2028        }
2029
2030        /**
2031         * @return Identifies the computable language in which mapping.map is expressed.
2032         */
2033        public String getLanguage() { 
2034          return this.language == null ? null : this.language.getValue();
2035        }
2036
2037        /**
2038         * @param value Identifies the computable language in which mapping.map is expressed.
2039         */
2040        public ElementDefinitionMappingComponent setLanguage(String value) { 
2041          if (Utilities.noString(value))
2042            this.language = null;
2043          else {
2044            if (this.language == null)
2045              this.language = new CodeType();
2046            this.language.setValue(value);
2047          }
2048          return this;
2049        }
2050
2051        /**
2052         * @return {@link #map} (Expresses what part of the target specification corresponds to this element.). This is the underlying object with id, value and extensions. The accessor "getMap" gives direct access to the value
2053         */
2054        public StringType getMapElement() { 
2055          if (this.map == null)
2056            if (Configuration.errorOnAutoCreate())
2057              throw new Error("Attempt to auto-create ElementDefinitionMappingComponent.map");
2058            else if (Configuration.doAutoCreate())
2059              this.map = new StringType(); // bb
2060          return this.map;
2061        }
2062
2063        public boolean hasMapElement() { 
2064          return this.map != null && !this.map.isEmpty();
2065        }
2066
2067        public boolean hasMap() { 
2068          return this.map != null && !this.map.isEmpty();
2069        }
2070
2071        /**
2072         * @param value {@link #map} (Expresses what part of the target specification corresponds to this element.). This is the underlying object with id, value and extensions. The accessor "getMap" gives direct access to the value
2073         */
2074        public ElementDefinitionMappingComponent setMapElement(StringType value) { 
2075          this.map = value;
2076          return this;
2077        }
2078
2079        /**
2080         * @return Expresses what part of the target specification corresponds to this element.
2081         */
2082        public String getMap() { 
2083          return this.map == null ? null : this.map.getValue();
2084        }
2085
2086        /**
2087         * @param value Expresses what part of the target specification corresponds to this element.
2088         */
2089        public ElementDefinitionMappingComponent setMap(String value) { 
2090            if (this.map == null)
2091              this.map = new StringType();
2092            this.map.setValue(value);
2093          return this;
2094        }
2095
2096        protected void listChildren(List<Property> childrenList) {
2097          super.listChildren(childrenList);
2098          childrenList.add(new Property("identity", "id", "An internal reference to the definition of a mapping.", 0, java.lang.Integer.MAX_VALUE, identity));
2099          childrenList.add(new Property("language", "code", "Identifies the computable language in which mapping.map is expressed.", 0, java.lang.Integer.MAX_VALUE, language));
2100          childrenList.add(new Property("map", "string", "Expresses what part of the target specification corresponds to this element.", 0, java.lang.Integer.MAX_VALUE, map));
2101        }
2102
2103      @Override
2104      public void setProperty(String name, Base value) throws FHIRException {
2105        if (name.equals("identity"))
2106          this.identity = castToId(value); // IdType
2107        else if (name.equals("language"))
2108          this.language = castToCode(value); // CodeType
2109        else if (name.equals("map"))
2110          this.map = castToString(value); // StringType
2111        else
2112          super.setProperty(name, value);
2113      }
2114
2115      @Override
2116      public Base addChild(String name) throws FHIRException {
2117        if (name.equals("identity")) {
2118          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.identity");
2119        }
2120        else if (name.equals("language")) {
2121          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.language");
2122        }
2123        else if (name.equals("map")) {
2124          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.map");
2125        }
2126        else
2127          return super.addChild(name);
2128      }
2129
2130      public ElementDefinitionMappingComponent copy() {
2131        ElementDefinitionMappingComponent dst = new ElementDefinitionMappingComponent();
2132        copyValues(dst);
2133        dst.identity = identity == null ? null : identity.copy();
2134        dst.language = language == null ? null : language.copy();
2135        dst.map = map == null ? null : map.copy();
2136        return dst;
2137      }
2138
2139      @Override
2140      public boolean equalsDeep(Base other) {
2141        if (!super.equalsDeep(other))
2142          return false;
2143        if (!(other instanceof ElementDefinitionMappingComponent))
2144          return false;
2145        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other;
2146        return compareDeep(identity, o.identity, true) && compareDeep(language, o.language, true) && compareDeep(map, o.map, true)
2147          ;
2148      }
2149
2150      @Override
2151      public boolean equalsShallow(Base other) {
2152        if (!super.equalsShallow(other))
2153          return false;
2154        if (!(other instanceof ElementDefinitionMappingComponent))
2155          return false;
2156        ElementDefinitionMappingComponent o = (ElementDefinitionMappingComponent) other;
2157        return compareValues(identity, o.identity, true) && compareValues(language, o.language, true) && compareValues(map, o.map, true)
2158          ;
2159      }
2160
2161      public boolean isEmpty() {
2162        return super.isEmpty() && (identity == null || identity.isEmpty()) && (language == null || language.isEmpty())
2163           && (map == null || map.isEmpty());
2164      }
2165
2166  public String fhirType() {
2167    return "ElementDefinition.mapping";
2168
2169  }
2170
2171  }
2172
2173    /**
2174     * The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
2175     */
2176    @Child(name = "path", type = {StringType.class}, order=0, min=1, max=1, modifier=false, summary=true)
2177    @Description(shortDefinition="The path of the element (see the Detailed Descriptions)", formalDefinition="The path identifies the element and is expressed as a \".\"-separated list of ancestor elements, beginning with the name of the resource or extension." )
2178    protected StringType path;
2179
2180    /**
2181     * Codes that define how this element is represented in instances, when the deviation varies from the normal case.
2182     */
2183    @Child(name = "representation", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2184    @Description(shortDefinition="How this element is represented in instances", formalDefinition="Codes that define how this element is represented in instances, when the deviation varies from the normal case." )
2185    protected List<Enumeration<PropertyRepresentation>> representation;
2186
2187    /**
2188     * The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.
2189     */
2190    @Child(name = "name", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2191    @Description(shortDefinition="Name for this particular element definition (reference target)", formalDefinition="The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element." )
2192    protected StringType name;
2193
2194    /**
2195     * The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
2196     */
2197    @Child(name = "label", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2198    @Description(shortDefinition="Name for element to display with or prompt for element", formalDefinition="The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form." )
2199    protected StringType label;
2200
2201    /**
2202     * A code that provides the meaning for the element according to a particular terminology.
2203     */
2204    @Child(name = "code", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2205    @Description(shortDefinition="Defining code", formalDefinition="A code that provides the meaning for the element according to a particular terminology." )
2206    protected List<Coding> code;
2207
2208    /**
2209     * Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set).
2210     */
2211    @Child(name = "slicing", type = {}, order=5, min=0, max=1, modifier=false, summary=true)
2212    @Description(shortDefinition="This element is sliced - slices follow", formalDefinition="Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set)." )
2213    protected ElementDefinitionSlicingComponent slicing;
2214
2215    /**
2216     * A concise description of what this element means (e.g. for use in autogenerated summaries).
2217     */
2218    @Child(name = "short", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
2219    @Description(shortDefinition="Concise definition for xml presentation", formalDefinition="A concise description of what this element means (e.g. for use in autogenerated summaries)." )
2220    protected StringType short_;
2221
2222    /**
2223     * Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource.
2224     */
2225    @Child(name = "definition", type = {MarkdownType.class}, order=7, min=0, max=1, modifier=false, summary=true)
2226    @Description(shortDefinition="Full formal definition as narrative text", formalDefinition="Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource." )
2227    protected MarkdownType definition;
2228
2229    /**
2230     * Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.
2231     */
2232    @Child(name = "comments", type = {MarkdownType.class}, order=8, min=0, max=1, modifier=false, summary=true)
2233    @Description(shortDefinition="Comments about the use of this element", formalDefinition="Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc." )
2234    protected MarkdownType comments;
2235
2236    /**
2237     * This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.
2238     */
2239    @Child(name = "requirements", type = {MarkdownType.class}, order=9, min=0, max=1, modifier=false, summary=true)
2240    @Description(shortDefinition="Why is this needed?", formalDefinition="This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element." )
2241    protected MarkdownType requirements;
2242
2243    /**
2244     * Identifies additional names by which this element might also be known.
2245     */
2246    @Child(name = "alias", type = {StringType.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2247    @Description(shortDefinition="Other names", formalDefinition="Identifies additional names by which this element might also be known." )
2248    protected List<StringType> alias;
2249
2250    /**
2251     * The minimum number of times this element SHALL appear in the instance.
2252     */
2253    @Child(name = "min", type = {IntegerType.class}, order=11, min=0, max=1, modifier=false, summary=true)
2254    @Description(shortDefinition="Minimum Cardinality", formalDefinition="The minimum number of times this element SHALL appear in the instance." )
2255    protected IntegerType min;
2256
2257    /**
2258     * The maximum number of times this element is permitted to appear in the instance.
2259     */
2260    @Child(name = "max", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=true)
2261    @Description(shortDefinition="Maximum Cardinality (a number or *)", formalDefinition="The maximum number of times this element is permitted to appear in the instance." )
2262    protected StringType max;
2263
2264    /**
2265     * Information about the base definition of the element, provided to make it unncessary for tools to trace the deviation of the element through the derived and related profiles. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.
2266     */
2267    @Child(name = "base", type = {}, order=13, min=0, max=1, modifier=false, summary=true)
2268    @Description(shortDefinition="Base definition information for tools", formalDefinition="Information about the base definition of the element, provided to make it unncessary for tools to trace the deviation of the element through the derived and related profiles. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition." )
2269    protected ElementDefinitionBaseComponent base;
2270
2271    /**
2272     * The data type or resource that the value of this element is permitted to be.
2273     */
2274    @Child(name = "type", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2275    @Description(shortDefinition="Data type and Profile for this element", formalDefinition="The data type or resource that the value of this element is permitted to be." )
2276    protected List<TypeRefComponent> type;
2277
2278    /**
2279     * Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.
2280     */
2281    @Child(name = "nameReference", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=true)
2282    @Description(shortDefinition="To another element constraint (by element.name)", formalDefinition="Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element." )
2283    protected StringType nameReference;
2284
2285    /**
2286     * The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').
2287     */
2288    @Child(name = "defaultValue", type = {}, order=16, min=0, max=1, modifier=false, summary=true)
2289    @Description(shortDefinition="Specified value it missing from instance", formalDefinition="The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false')." )
2290    protected org.hl7.fhir.dstu2.model.Type defaultValue;
2291
2292    /**
2293     * The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'.
2294     */
2295    @Child(name = "meaningWhenMissing", type = {MarkdownType.class}, order=17, min=0, max=1, modifier=false, summary=true)
2296    @Description(shortDefinition="Implicit meaning when this element is missing", formalDefinition="The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'." )
2297    protected MarkdownType meaningWhenMissing;
2298
2299    /**
2300     * Specifies a value that SHALL be exactly the value  for this element in the instance. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.
2301     */
2302    @Child(name = "fixed", type = {}, order=18, min=0, max=1, modifier=false, summary=true)
2303    @Description(shortDefinition="Value must be exactly this", formalDefinition="Specifies a value that SHALL be exactly the value  for this element in the instance. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing." )
2304    protected org.hl7.fhir.dstu2.model.Type fixed;
2305
2306    /**
2307     * Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).
2308     */
2309    @Child(name = "pattern", type = {}, order=19, min=0, max=1, modifier=false, summary=true)
2310    @Description(shortDefinition="Value must have at least these property values", formalDefinition="Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.)." )
2311    protected org.hl7.fhir.dstu2.model.Type pattern;
2312
2313    /**
2314     * A sample value for this element demonstrating the type of information that would typically be captured.
2315     */
2316    @Child(name = "example", type = {}, order=20, min=0, max=1, modifier=false, summary=true)
2317    @Description(shortDefinition="Example value: [as defined for type]", formalDefinition="A sample value for this element demonstrating the type of information that would typically be captured." )
2318    protected org.hl7.fhir.dstu2.model.Type example;
2319
2320    /**
2321     * The minimum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.
2322     */
2323    @Child(name = "minValue", type = {}, order=21, min=0, max=1, modifier=false, summary=true)
2324    @Description(shortDefinition="Minimum Allowed Value (for some types)", formalDefinition="The minimum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity." )
2325    protected org.hl7.fhir.dstu2.model.Type minValue;
2326
2327    /**
2328     * The maximum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.
2329     */
2330    @Child(name = "maxValue", type = {}, order=22, min=0, max=1, modifier=false, summary=true)
2331    @Description(shortDefinition="Maximum Allowed Value (for some types)", formalDefinition="The maximum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity." )
2332    protected org.hl7.fhir.dstu2.model.Type maxValue;
2333
2334    /**
2335     * Indicates the maximum length in characters that is permitted to be present in conformant instances and which is expected to be supported by conformant consumers that support the element.
2336     */
2337    @Child(name = "maxLength", type = {IntegerType.class}, order=23, min=0, max=1, modifier=false, summary=true)
2338    @Description(shortDefinition="Max length for strings", formalDefinition="Indicates the maximum length in characters that is permitted to be present in conformant instances and which is expected to be supported by conformant consumers that support the element." )
2339    protected IntegerType maxLength;
2340
2341    /**
2342     * A reference to an invariant that may make additional statements about the cardinality or value in the instance.
2343     */
2344    @Child(name = "condition", type = {IdType.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2345    @Description(shortDefinition="Reference to invariant about presence", formalDefinition="A reference to an invariant that may make additional statements about the cardinality or value in the instance." )
2346    protected List<IdType> condition;
2347
2348    /**
2349     * Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.
2350     */
2351    @Child(name = "constraint", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2352    @Description(shortDefinition="Condition that must evaluate to true", formalDefinition="Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance." )
2353    protected List<ElementDefinitionConstraintComponent> constraint;
2354
2355    /**
2356     * If true, implementations that produce or consume resources SHALL provide "support" for the element in some meaningful way.  If false, the element may be ignored and not supported.
2357     */
2358    @Child(name = "mustSupport", type = {BooleanType.class}, order=26, min=0, max=1, modifier=false, summary=true)
2359    @Description(shortDefinition="If the element must supported", formalDefinition="If true, implementations that produce or consume resources SHALL provide \"support\" for the element in some meaningful way.  If false, the element may be ignored and not supported." )
2360    protected BooleanType mustSupport;
2361
2362    /**
2363     * If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system.
2364     */
2365    @Child(name = "isModifier", type = {BooleanType.class}, order=27, min=0, max=1, modifier=false, summary=true)
2366    @Description(shortDefinition="If this modifies the meaning of other elements", formalDefinition="If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system." )
2367    protected BooleanType isModifier;
2368
2369    /**
2370     * Whether the element should be included if a client requests a search with the parameter _summary=true.
2371     */
2372    @Child(name = "isSummary", type = {BooleanType.class}, order=28, min=0, max=1, modifier=false, summary=true)
2373    @Description(shortDefinition="Include when _summary = true?", formalDefinition="Whether the element should be included if a client requests a search with the parameter _summary=true." )
2374    protected BooleanType isSummary;
2375
2376    /**
2377     * Binds to a value set if this element is coded (code, Coding, CodeableConcept).
2378     */
2379    @Child(name = "binding", type = {}, order=29, min=0, max=1, modifier=false, summary=true)
2380    @Description(shortDefinition="ValueSet details if this is coded", formalDefinition="Binds to a value set if this element is coded (code, Coding, CodeableConcept)." )
2381    protected ElementDefinitionBindingComponent binding;
2382
2383    /**
2384     * Identifies a concept from an external specification that roughly corresponds to this element.
2385     */
2386    @Child(name = "mapping", type = {}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2387    @Description(shortDefinition="Map element to another set of definitions", formalDefinition="Identifies a concept from an external specification that roughly corresponds to this element." )
2388    protected List<ElementDefinitionMappingComponent> mapping;
2389
2390    private static final long serialVersionUID = -447087484L;
2391
2392  /*
2393   * Constructor
2394   */
2395    public ElementDefinition() {
2396      super();
2397    }
2398
2399  /*
2400   * Constructor
2401   */
2402    public ElementDefinition(StringType path) {
2403      super();
2404      this.path = path;
2405    }
2406
2407    /**
2408     * @return {@link #path} (The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
2409     */
2410    public StringType getPathElement() { 
2411      if (this.path == null)
2412        if (Configuration.errorOnAutoCreate())
2413          throw new Error("Attempt to auto-create ElementDefinition.path");
2414        else if (Configuration.doAutoCreate())
2415          this.path = new StringType(); // bb
2416      return this.path;
2417    }
2418
2419    public boolean hasPathElement() { 
2420      return this.path != null && !this.path.isEmpty();
2421    }
2422
2423    public boolean hasPath() { 
2424      return this.path != null && !this.path.isEmpty();
2425    }
2426
2427    /**
2428     * @param value {@link #path} (The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
2429     */
2430    public ElementDefinition setPathElement(StringType value) { 
2431      this.path = value;
2432      return this;
2433    }
2434
2435    /**
2436     * @return The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
2437     */
2438    public String getPath() { 
2439      return this.path == null ? null : this.path.getValue();
2440    }
2441
2442    /**
2443     * @param value The path identifies the element and is expressed as a "."-separated list of ancestor elements, beginning with the name of the resource or extension.
2444     */
2445    public ElementDefinition setPath(String value) { 
2446        if (this.path == null)
2447          this.path = new StringType();
2448        this.path.setValue(value);
2449      return this;
2450    }
2451
2452    /**
2453     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
2454     */
2455    public List<Enumeration<PropertyRepresentation>> getRepresentation() { 
2456      if (this.representation == null)
2457        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
2458      return this.representation;
2459    }
2460
2461    public ElementDefinition setRepresentation(List<Enumeration<PropertyRepresentation>> representation) {
2462        this.representation = representation;
2463        return this;
2464    }
2465
2466    public boolean hasRepresentation() {
2467      if (this.representation == null)
2468        return false;
2469      for (Enumeration<PropertyRepresentation> item : this.representation)
2470        if (!item.isEmpty())
2471          return true;
2472      return false;
2473    }
2474
2475    /**
2476     * @return {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
2477     */
2478    // syntactic sugar
2479    public Enumeration<PropertyRepresentation> addRepresentationElement() {//2 
2480      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
2481      if (this.representation == null)
2482        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
2483      this.representation.add(t);
2484      return t;
2485    }
2486
2487    /**
2488     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
2489     */
2490    public ElementDefinition addRepresentation(PropertyRepresentation value) { //1
2491      Enumeration<PropertyRepresentation> t = new Enumeration<PropertyRepresentation>(new PropertyRepresentationEnumFactory());
2492      t.setValue(value);
2493      if (this.representation == null)
2494        this.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
2495      this.representation.add(t);
2496      return this;
2497    }
2498
2499    /**
2500     * @param value {@link #representation} (Codes that define how this element is represented in instances, when the deviation varies from the normal case.)
2501     */
2502    public boolean hasRepresentation(PropertyRepresentation value) { 
2503      if (this.representation == null)
2504        return false;
2505      for (Enumeration<PropertyRepresentation> v : this.representation)
2506        if (v.equals(value)) // code
2507          return true;
2508      return false;
2509    }
2510
2511    /**
2512     * @return {@link #name} (The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2513     */
2514    public StringType getNameElement() { 
2515      if (this.name == null)
2516        if (Configuration.errorOnAutoCreate())
2517          throw new Error("Attempt to auto-create ElementDefinition.name");
2518        else if (Configuration.doAutoCreate())
2519          this.name = new StringType(); // bb
2520      return this.name;
2521    }
2522
2523    public boolean hasNameElement() { 
2524      return this.name != null && !this.name.isEmpty();
2525    }
2526
2527    public boolean hasName() { 
2528      return this.name != null && !this.name.isEmpty();
2529    }
2530
2531    /**
2532     * @param value {@link #name} (The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2533     */
2534    public ElementDefinition setNameElement(StringType value) { 
2535      this.name = value;
2536      return this;
2537    }
2538
2539    /**
2540     * @return The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.
2541     */
2542    public String getName() { 
2543      return this.name == null ? null : this.name.getValue();
2544    }
2545
2546    /**
2547     * @param value The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.
2548     */
2549    public ElementDefinition setName(String value) { 
2550      if (Utilities.noString(value))
2551        this.name = null;
2552      else {
2553        if (this.name == null)
2554          this.name = new StringType();
2555        this.name.setValue(value);
2556      }
2557      return this;
2558    }
2559
2560    /**
2561     * @return {@link #label} (The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
2562     */
2563    public StringType getLabelElement() { 
2564      if (this.label == null)
2565        if (Configuration.errorOnAutoCreate())
2566          throw new Error("Attempt to auto-create ElementDefinition.label");
2567        else if (Configuration.doAutoCreate())
2568          this.label = new StringType(); // bb
2569      return this.label;
2570    }
2571
2572    public boolean hasLabelElement() { 
2573      return this.label != null && !this.label.isEmpty();
2574    }
2575
2576    public boolean hasLabel() { 
2577      return this.label != null && !this.label.isEmpty();
2578    }
2579
2580    /**
2581     * @param value {@link #label} (The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
2582     */
2583    public ElementDefinition setLabelElement(StringType value) { 
2584      this.label = value;
2585      return this;
2586    }
2587
2588    /**
2589     * @return The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
2590     */
2591    public String getLabel() { 
2592      return this.label == null ? null : this.label.getValue();
2593    }
2594
2595    /**
2596     * @param value The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.
2597     */
2598    public ElementDefinition setLabel(String value) { 
2599      if (Utilities.noString(value))
2600        this.label = null;
2601      else {
2602        if (this.label == null)
2603          this.label = new StringType();
2604        this.label.setValue(value);
2605      }
2606      return this;
2607    }
2608
2609    /**
2610     * @return {@link #code} (A code that provides the meaning for the element according to a particular terminology.)
2611     */
2612    public List<Coding> getCode() { 
2613      if (this.code == null)
2614        this.code = new ArrayList<Coding>();
2615      return this.code;
2616    }
2617
2618    public boolean hasCode() { 
2619      if (this.code == null)
2620        return false;
2621      for (Coding item : this.code)
2622        if (!item.isEmpty())
2623          return true;
2624      return false;
2625    }
2626
2627    /**
2628     * @return {@link #code} (A code that provides the meaning for the element according to a particular terminology.)
2629     */
2630    // syntactic sugar
2631    public Coding addCode() { //3
2632      Coding t = new Coding();
2633      if (this.code == null)
2634        this.code = new ArrayList<Coding>();
2635      this.code.add(t);
2636      return t;
2637    }
2638
2639    // syntactic sugar
2640    public ElementDefinition addCode(Coding t) { //3
2641      if (t == null)
2642        return this;
2643      if (this.code == null)
2644        this.code = new ArrayList<Coding>();
2645      this.code.add(t);
2646      return this;
2647    }
2648
2649    /**
2650     * @return {@link #slicing} (Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set).)
2651     */
2652    public ElementDefinitionSlicingComponent getSlicing() { 
2653      if (this.slicing == null)
2654        if (Configuration.errorOnAutoCreate())
2655          throw new Error("Attempt to auto-create ElementDefinition.slicing");
2656        else if (Configuration.doAutoCreate())
2657          this.slicing = new ElementDefinitionSlicingComponent(); // cc
2658      return this.slicing;
2659    }
2660
2661    public boolean hasSlicing() { 
2662      return this.slicing != null && !this.slicing.isEmpty();
2663    }
2664
2665    /**
2666     * @param value {@link #slicing} (Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set).)
2667     */
2668    public ElementDefinition setSlicing(ElementDefinitionSlicingComponent value) { 
2669      this.slicing = value;
2670      return this;
2671    }
2672
2673    /**
2674     * @return {@link #short_} (A concise description of what this element means (e.g. for use in autogenerated summaries).). This is the underlying object with id, value and extensions. The accessor "getShort" gives direct access to the value
2675     */
2676    public StringType getShortElement() { 
2677      if (this.short_ == null)
2678        if (Configuration.errorOnAutoCreate())
2679          throw new Error("Attempt to auto-create ElementDefinition.short_");
2680        else if (Configuration.doAutoCreate())
2681          this.short_ = new StringType(); // bb
2682      return this.short_;
2683    }
2684
2685    public boolean hasShortElement() { 
2686      return this.short_ != null && !this.short_.isEmpty();
2687    }
2688
2689    public boolean hasShort() { 
2690      return this.short_ != null && !this.short_.isEmpty();
2691    }
2692
2693    /**
2694     * @param value {@link #short_} (A concise description of what this element means (e.g. for use in autogenerated summaries).). This is the underlying object with id, value and extensions. The accessor "getShort" gives direct access to the value
2695     */
2696    public ElementDefinition setShortElement(StringType value) { 
2697      this.short_ = value;
2698      return this;
2699    }
2700
2701    /**
2702     * @return A concise description of what this element means (e.g. for use in autogenerated summaries).
2703     */
2704    public String getShort() { 
2705      return this.short_ == null ? null : this.short_.getValue();
2706    }
2707
2708    /**
2709     * @param value A concise description of what this element means (e.g. for use in autogenerated summaries).
2710     */
2711    public ElementDefinition setShort(String value) { 
2712      if (Utilities.noString(value))
2713        this.short_ = null;
2714      else {
2715        if (this.short_ == null)
2716          this.short_ = new StringType();
2717        this.short_.setValue(value);
2718      }
2719      return this;
2720    }
2721
2722    /**
2723     * @return {@link #definition} (Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
2724     */
2725    public MarkdownType getDefinitionElement() { 
2726      if (this.definition == null)
2727        if (Configuration.errorOnAutoCreate())
2728          throw new Error("Attempt to auto-create ElementDefinition.definition");
2729        else if (Configuration.doAutoCreate())
2730          this.definition = new MarkdownType(); // bb
2731      return this.definition;
2732    }
2733
2734    public boolean hasDefinitionElement() { 
2735      return this.definition != null && !this.definition.isEmpty();
2736    }
2737
2738    public boolean hasDefinition() { 
2739      return this.definition != null && !this.definition.isEmpty();
2740    }
2741
2742    /**
2743     * @param value {@link #definition} (Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource.). This is the underlying object with id, value and extensions. The accessor "getDefinition" gives direct access to the value
2744     */
2745    public ElementDefinition setDefinitionElement(MarkdownType value) { 
2746      this.definition = value;
2747      return this;
2748    }
2749
2750    /**
2751     * @return Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource.
2752     */
2753    public String getDefinition() { 
2754      return this.definition == null ? null : this.definition.getValue();
2755    }
2756
2757    /**
2758     * @param value Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource.
2759     */
2760    public ElementDefinition setDefinition(String value) { 
2761      if (value == null)
2762        this.definition = null;
2763      else {
2764        if (this.definition == null)
2765          this.definition = new MarkdownType();
2766        this.definition.setValue(value);
2767      }
2768      return this;
2769    }
2770
2771    /**
2772     * @return {@link #comments} (Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
2773     */
2774    public MarkdownType getCommentsElement() { 
2775      if (this.comments == null)
2776        if (Configuration.errorOnAutoCreate())
2777          throw new Error("Attempt to auto-create ElementDefinition.comments");
2778        else if (Configuration.doAutoCreate())
2779          this.comments = new MarkdownType(); // bb
2780      return this.comments;
2781    }
2782
2783    public boolean hasCommentsElement() { 
2784      return this.comments != null && !this.comments.isEmpty();
2785    }
2786
2787    public boolean hasComments() { 
2788      return this.comments != null && !this.comments.isEmpty();
2789    }
2790
2791    /**
2792     * @param value {@link #comments} (Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.). This is the underlying object with id, value and extensions. The accessor "getComments" gives direct access to the value
2793     */
2794    public ElementDefinition setCommentsElement(MarkdownType value) { 
2795      this.comments = value;
2796      return this;
2797    }
2798
2799    /**
2800     * @return Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.
2801     */
2802    public String getComments() { 
2803      return this.comments == null ? null : this.comments.getValue();
2804    }
2805
2806    /**
2807     * @param value Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.
2808     */
2809    public ElementDefinition setComments(String value) { 
2810      if (value == null)
2811        this.comments = null;
2812      else {
2813        if (this.comments == null)
2814          this.comments = new MarkdownType();
2815        this.comments.setValue(value);
2816      }
2817      return this;
2818    }
2819
2820    /**
2821     * @return {@link #requirements} (This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
2822     */
2823    public MarkdownType getRequirementsElement() { 
2824      if (this.requirements == null)
2825        if (Configuration.errorOnAutoCreate())
2826          throw new Error("Attempt to auto-create ElementDefinition.requirements");
2827        else if (Configuration.doAutoCreate())
2828          this.requirements = new MarkdownType(); // bb
2829      return this.requirements;
2830    }
2831
2832    public boolean hasRequirementsElement() { 
2833      return this.requirements != null && !this.requirements.isEmpty();
2834    }
2835
2836    public boolean hasRequirements() { 
2837      return this.requirements != null && !this.requirements.isEmpty();
2838    }
2839
2840    /**
2841     * @param value {@link #requirements} (This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
2842     */
2843    public ElementDefinition setRequirementsElement(MarkdownType value) { 
2844      this.requirements = value;
2845      return this;
2846    }
2847
2848    /**
2849     * @return This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.
2850     */
2851    public String getRequirements() { 
2852      return this.requirements == null ? null : this.requirements.getValue();
2853    }
2854
2855    /**
2856     * @param value This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.
2857     */
2858    public ElementDefinition setRequirements(String value) { 
2859      if (value == null)
2860        this.requirements = null;
2861      else {
2862        if (this.requirements == null)
2863          this.requirements = new MarkdownType();
2864        this.requirements.setValue(value);
2865      }
2866      return this;
2867    }
2868
2869    /**
2870     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
2871     */
2872    public List<StringType> getAlias() { 
2873      if (this.alias == null)
2874        this.alias = new ArrayList<StringType>();
2875      return this.alias;
2876    }
2877
2878    public boolean hasAlias() { 
2879      if (this.alias == null)
2880        return false;
2881      for (StringType item : this.alias)
2882        if (!item.isEmpty())
2883          return true;
2884      return false;
2885    }
2886
2887    /**
2888     * @return {@link #alias} (Identifies additional names by which this element might also be known.)
2889     */
2890    // syntactic sugar
2891    public StringType addAliasElement() {//2 
2892      StringType t = new StringType();
2893      if (this.alias == null)
2894        this.alias = new ArrayList<StringType>();
2895      this.alias.add(t);
2896      return t;
2897    }
2898
2899    /**
2900     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
2901     */
2902    public ElementDefinition addAlias(String value) { //1
2903      StringType t = new StringType();
2904      t.setValue(value);
2905      if (this.alias == null)
2906        this.alias = new ArrayList<StringType>();
2907      this.alias.add(t);
2908      return this;
2909    }
2910
2911    /**
2912     * @param value {@link #alias} (Identifies additional names by which this element might also be known.)
2913     */
2914    public boolean hasAlias(String value) { 
2915      if (this.alias == null)
2916        return false;
2917      for (StringType v : this.alias)
2918        if (v.equals(value)) // string
2919          return true;
2920      return false;
2921    }
2922
2923    /**
2924     * @return {@link #min} (The minimum number of times this element SHALL appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
2925     */
2926    public IntegerType getMinElement() { 
2927      if (this.min == null)
2928        if (Configuration.errorOnAutoCreate())
2929          throw new Error("Attempt to auto-create ElementDefinition.min");
2930        else if (Configuration.doAutoCreate())
2931          this.min = new IntegerType(); // bb
2932      return this.min;
2933    }
2934
2935    public boolean hasMinElement() { 
2936      return this.min != null && !this.min.isEmpty();
2937    }
2938
2939    public boolean hasMin() { 
2940      return this.min != null && !this.min.isEmpty();
2941    }
2942
2943    /**
2944     * @param value {@link #min} (The minimum number of times this element SHALL appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
2945     */
2946    public ElementDefinition setMinElement(IntegerType value) { 
2947      this.min = value;
2948      return this;
2949    }
2950
2951    /**
2952     * @return The minimum number of times this element SHALL appear in the instance.
2953     */
2954    public int getMin() { 
2955      return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
2956    }
2957
2958    /**
2959     * @param value The minimum number of times this element SHALL appear in the instance.
2960     */
2961    public ElementDefinition setMin(int value) { 
2962        if (this.min == null)
2963          this.min = new IntegerType();
2964        this.min.setValue(value);
2965      return this;
2966    }
2967
2968    /**
2969     * @return {@link #max} (The maximum number of times this element is permitted to appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
2970     */
2971    public StringType getMaxElement() { 
2972      if (this.max == null)
2973        if (Configuration.errorOnAutoCreate())
2974          throw new Error("Attempt to auto-create ElementDefinition.max");
2975        else if (Configuration.doAutoCreate())
2976          this.max = new StringType(); // bb
2977      return this.max;
2978    }
2979
2980    public boolean hasMaxElement() { 
2981      return this.max != null && !this.max.isEmpty();
2982    }
2983
2984    public boolean hasMax() { 
2985      return this.max != null && !this.max.isEmpty();
2986    }
2987
2988    /**
2989     * @param value {@link #max} (The maximum number of times this element is permitted to appear in the instance.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
2990     */
2991    public ElementDefinition setMaxElement(StringType value) { 
2992      this.max = value;
2993      return this;
2994    }
2995
2996    /**
2997     * @return The maximum number of times this element is permitted to appear in the instance.
2998     */
2999    public String getMax() { 
3000      return this.max == null ? null : this.max.getValue();
3001    }
3002
3003    /**
3004     * @param value The maximum number of times this element is permitted to appear in the instance.
3005     */
3006    public ElementDefinition setMax(String value) { 
3007      if (Utilities.noString(value))
3008        this.max = null;
3009      else {
3010        if (this.max == null)
3011          this.max = new StringType();
3012        this.max.setValue(value);
3013      }
3014      return this;
3015    }
3016
3017    /**
3018     * @return {@link #base} (Information about the base definition of the element, provided to make it unncessary for tools to trace the deviation of the element through the derived and related profiles. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.)
3019     */
3020    public ElementDefinitionBaseComponent getBase() { 
3021      if (this.base == null)
3022        if (Configuration.errorOnAutoCreate())
3023          throw new Error("Attempt to auto-create ElementDefinition.base");
3024        else if (Configuration.doAutoCreate())
3025          this.base = new ElementDefinitionBaseComponent(); // cc
3026      return this.base;
3027    }
3028
3029    public boolean hasBase() { 
3030      return this.base != null && !this.base.isEmpty();
3031    }
3032
3033    /**
3034     * @param value {@link #base} (Information about the base definition of the element, provided to make it unncessary for tools to trace the deviation of the element through the derived and related profiles. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.)
3035     */
3036    public ElementDefinition setBase(ElementDefinitionBaseComponent value) { 
3037      this.base = value;
3038      return this;
3039    }
3040
3041    /**
3042     * @return {@link #type} (The data type or resource that the value of this element is permitted to be.)
3043     */
3044    public List<TypeRefComponent> getType() { 
3045      if (this.type == null)
3046        this.type = new ArrayList<TypeRefComponent>();
3047      return this.type;
3048    }
3049
3050    public boolean hasType() { 
3051      if (this.type == null)
3052        return false;
3053      for (TypeRefComponent item : this.type)
3054        if (!item.isEmpty())
3055          return true;
3056      return false;
3057    }
3058
3059    /**
3060     * @return {@link #type} (The data type or resource that the value of this element is permitted to be.)
3061     */
3062    // syntactic sugar
3063    public TypeRefComponent addType() { //3
3064      TypeRefComponent t = new TypeRefComponent();
3065      if (this.type == null)
3066        this.type = new ArrayList<TypeRefComponent>();
3067      this.type.add(t);
3068      return t;
3069    }
3070
3071    // syntactic sugar
3072    public ElementDefinition addType(TypeRefComponent t) { //3
3073      if (t == null)
3074        return this;
3075      if (this.type == null)
3076        this.type = new ArrayList<TypeRefComponent>();
3077      this.type.add(t);
3078      return this;
3079    }
3080
3081    /**
3082     * @return {@link #nameReference} (Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.). This is the underlying object with id, value and extensions. The accessor "getNameReference" gives direct access to the value
3083     */
3084    public StringType getNameReferenceElement() { 
3085      if (this.nameReference == null)
3086        if (Configuration.errorOnAutoCreate())
3087          throw new Error("Attempt to auto-create ElementDefinition.nameReference");
3088        else if (Configuration.doAutoCreate())
3089          this.nameReference = new StringType(); // bb
3090      return this.nameReference;
3091    }
3092
3093    public boolean hasNameReferenceElement() { 
3094      return this.nameReference != null && !this.nameReference.isEmpty();
3095    }
3096
3097    public boolean hasNameReference() { 
3098      return this.nameReference != null && !this.nameReference.isEmpty();
3099    }
3100
3101    /**
3102     * @param value {@link #nameReference} (Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.). This is the underlying object with id, value and extensions. The accessor "getNameReference" gives direct access to the value
3103     */
3104    public ElementDefinition setNameReferenceElement(StringType value) { 
3105      this.nameReference = value;
3106      return this;
3107    }
3108
3109    /**
3110     * @return Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.
3111     */
3112    public String getNameReference() { 
3113      return this.nameReference == null ? null : this.nameReference.getValue();
3114    }
3115
3116    /**
3117     * @param value Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.
3118     */
3119    public ElementDefinition setNameReference(String value) { 
3120      if (Utilities.noString(value))
3121        this.nameReference = null;
3122      else {
3123        if (this.nameReference == null)
3124          this.nameReference = new StringType();
3125        this.nameReference.setValue(value);
3126      }
3127      return this;
3128    }
3129
3130    /**
3131     * @return {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
3132     */
3133    public org.hl7.fhir.dstu2.model.Type getDefaultValue() { 
3134      return this.defaultValue;
3135    }
3136
3137    public boolean hasDefaultValue() { 
3138      return this.defaultValue != null && !this.defaultValue.isEmpty();
3139    }
3140
3141    /**
3142     * @param value {@link #defaultValue} (The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').)
3143     */
3144    public ElementDefinition setDefaultValue(org.hl7.fhir.dstu2.model.Type value) { 
3145      this.defaultValue = value;
3146      return this;
3147    }
3148
3149    /**
3150     * @return {@link #meaningWhenMissing} (The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'.). This is the underlying object with id, value and extensions. The accessor "getMeaningWhenMissing" gives direct access to the value
3151     */
3152    public MarkdownType getMeaningWhenMissingElement() { 
3153      if (this.meaningWhenMissing == null)
3154        if (Configuration.errorOnAutoCreate())
3155          throw new Error("Attempt to auto-create ElementDefinition.meaningWhenMissing");
3156        else if (Configuration.doAutoCreate())
3157          this.meaningWhenMissing = new MarkdownType(); // bb
3158      return this.meaningWhenMissing;
3159    }
3160
3161    public boolean hasMeaningWhenMissingElement() { 
3162      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
3163    }
3164
3165    public boolean hasMeaningWhenMissing() { 
3166      return this.meaningWhenMissing != null && !this.meaningWhenMissing.isEmpty();
3167    }
3168
3169    /**
3170     * @param value {@link #meaningWhenMissing} (The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'.). This is the underlying object with id, value and extensions. The accessor "getMeaningWhenMissing" gives direct access to the value
3171     */
3172    public ElementDefinition setMeaningWhenMissingElement(MarkdownType value) { 
3173      this.meaningWhenMissing = value;
3174      return this;
3175    }
3176
3177    /**
3178     * @return The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'.
3179     */
3180    public String getMeaningWhenMissing() { 
3181      return this.meaningWhenMissing == null ? null : this.meaningWhenMissing.getValue();
3182    }
3183
3184    /**
3185     * @param value The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'.
3186     */
3187    public ElementDefinition setMeaningWhenMissing(String value) { 
3188      if (value == null)
3189        this.meaningWhenMissing = null;
3190      else {
3191        if (this.meaningWhenMissing == null)
3192          this.meaningWhenMissing = new MarkdownType();
3193        this.meaningWhenMissing.setValue(value);
3194      }
3195      return this;
3196    }
3197
3198    /**
3199     * @return {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
3200     */
3201    public org.hl7.fhir.dstu2.model.Type getFixed() { 
3202      return this.fixed;
3203    }
3204
3205    public boolean hasFixed() { 
3206      return this.fixed != null && !this.fixed.isEmpty();
3207    }
3208
3209    /**
3210     * @param value {@link #fixed} (Specifies a value that SHALL be exactly the value  for this element in the instance. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.)
3211     */
3212    public ElementDefinition setFixed(org.hl7.fhir.dstu2.model.Type value) { 
3213      this.fixed = value;
3214      return this;
3215    }
3216
3217    /**
3218     * @return {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).)
3219     */
3220    public org.hl7.fhir.dstu2.model.Type getPattern() { 
3221      return this.pattern;
3222    }
3223
3224    public boolean hasPattern() { 
3225      return this.pattern != null && !this.pattern.isEmpty();
3226    }
3227
3228    /**
3229     * @param value {@link #pattern} (Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).)
3230     */
3231    public ElementDefinition setPattern(org.hl7.fhir.dstu2.model.Type value) { 
3232      this.pattern = value;
3233      return this;
3234    }
3235
3236    /**
3237     * @return {@link #example} (A sample value for this element demonstrating the type of information that would typically be captured.)
3238     */
3239    public org.hl7.fhir.dstu2.model.Type getExample() { 
3240      return this.example;
3241    }
3242
3243    public boolean hasExample() { 
3244      return this.example != null && !this.example.isEmpty();
3245    }
3246
3247    /**
3248     * @param value {@link #example} (A sample value for this element demonstrating the type of information that would typically be captured.)
3249     */
3250    public ElementDefinition setExample(org.hl7.fhir.dstu2.model.Type value) { 
3251      this.example = value;
3252      return this;
3253    }
3254
3255    /**
3256     * @return {@link #minValue} (The minimum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.)
3257     */
3258    public org.hl7.fhir.dstu2.model.Type getMinValue() { 
3259      return this.minValue;
3260    }
3261
3262    public boolean hasMinValue() { 
3263      return this.minValue != null && !this.minValue.isEmpty();
3264    }
3265
3266    /**
3267     * @param value {@link #minValue} (The minimum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.)
3268     */
3269    public ElementDefinition setMinValue(org.hl7.fhir.dstu2.model.Type value) { 
3270      this.minValue = value;
3271      return this;
3272    }
3273
3274    /**
3275     * @return {@link #maxValue} (The maximum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.)
3276     */
3277    public org.hl7.fhir.dstu2.model.Type getMaxValue() { 
3278      return this.maxValue;
3279    }
3280
3281    public boolean hasMaxValue() { 
3282      return this.maxValue != null && !this.maxValue.isEmpty();
3283    }
3284
3285    /**
3286     * @param value {@link #maxValue} (The maximum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.)
3287     */
3288    public ElementDefinition setMaxValue(org.hl7.fhir.dstu2.model.Type value) { 
3289      this.maxValue = value;
3290      return this;
3291    }
3292
3293    /**
3294     * @return {@link #maxLength} (Indicates the maximum length in characters that is permitted to be present in conformant instances and which is expected to be supported by conformant consumers that support the element.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
3295     */
3296    public IntegerType getMaxLengthElement() { 
3297      if (this.maxLength == null)
3298        if (Configuration.errorOnAutoCreate())
3299          throw new Error("Attempt to auto-create ElementDefinition.maxLength");
3300        else if (Configuration.doAutoCreate())
3301          this.maxLength = new IntegerType(); // bb
3302      return this.maxLength;
3303    }
3304
3305    public boolean hasMaxLengthElement() { 
3306      return this.maxLength != null && !this.maxLength.isEmpty();
3307    }
3308
3309    public boolean hasMaxLength() { 
3310      return this.maxLength != null && !this.maxLength.isEmpty();
3311    }
3312
3313    /**
3314     * @param value {@link #maxLength} (Indicates the maximum length in characters that is permitted to be present in conformant instances and which is expected to be supported by conformant consumers that support the element.). This is the underlying object with id, value and extensions. The accessor "getMaxLength" gives direct access to the value
3315     */
3316    public ElementDefinition setMaxLengthElement(IntegerType value) { 
3317      this.maxLength = value;
3318      return this;
3319    }
3320
3321    /**
3322     * @return Indicates the maximum length in characters that is permitted to be present in conformant instances and which is expected to be supported by conformant consumers that support the element.
3323     */
3324    public int getMaxLength() { 
3325      return this.maxLength == null || this.maxLength.isEmpty() ? 0 : this.maxLength.getValue();
3326    }
3327
3328    /**
3329     * @param value Indicates the maximum length in characters that is permitted to be present in conformant instances and which is expected to be supported by conformant consumers that support the element.
3330     */
3331    public ElementDefinition setMaxLength(int value) { 
3332        if (this.maxLength == null)
3333          this.maxLength = new IntegerType();
3334        this.maxLength.setValue(value);
3335      return this;
3336    }
3337
3338    /**
3339     * @return {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3340     */
3341    public List<IdType> getCondition() { 
3342      if (this.condition == null)
3343        this.condition = new ArrayList<IdType>();
3344      return this.condition;
3345    }
3346
3347    public boolean hasCondition() { 
3348      if (this.condition == null)
3349        return false;
3350      for (IdType item : this.condition)
3351        if (!item.isEmpty())
3352          return true;
3353      return false;
3354    }
3355
3356    /**
3357     * @return {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3358     */
3359    // syntactic sugar
3360    public IdType addConditionElement() {//2 
3361      IdType t = new IdType();
3362      if (this.condition == null)
3363        this.condition = new ArrayList<IdType>();
3364      this.condition.add(t);
3365      return t;
3366    }
3367
3368    /**
3369     * @param value {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3370     */
3371    public ElementDefinition addCondition(String value) { //1
3372      IdType t = new IdType();
3373      t.setValue(value);
3374      if (this.condition == null)
3375        this.condition = new ArrayList<IdType>();
3376      this.condition.add(t);
3377      return this;
3378    }
3379
3380    /**
3381     * @param value {@link #condition} (A reference to an invariant that may make additional statements about the cardinality or value in the instance.)
3382     */
3383    public boolean hasCondition(String value) { 
3384      if (this.condition == null)
3385        return false;
3386      for (IdType v : this.condition)
3387        if (v.equals(value)) // id
3388          return true;
3389      return false;
3390    }
3391
3392    /**
3393     * @return {@link #constraint} (Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.)
3394     */
3395    public List<ElementDefinitionConstraintComponent> getConstraint() { 
3396      if (this.constraint == null)
3397        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
3398      return this.constraint;
3399    }
3400
3401    public boolean hasConstraint() { 
3402      if (this.constraint == null)
3403        return false;
3404      for (ElementDefinitionConstraintComponent item : this.constraint)
3405        if (!item.isEmpty())
3406          return true;
3407      return false;
3408    }
3409
3410    /**
3411     * @return {@link #constraint} (Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.)
3412     */
3413    // syntactic sugar
3414    public ElementDefinitionConstraintComponent addConstraint() { //3
3415      ElementDefinitionConstraintComponent t = new ElementDefinitionConstraintComponent();
3416      if (this.constraint == null)
3417        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
3418      this.constraint.add(t);
3419      return t;
3420    }
3421
3422    // syntactic sugar
3423    public ElementDefinition addConstraint(ElementDefinitionConstraintComponent t) { //3
3424      if (t == null)
3425        return this;
3426      if (this.constraint == null)
3427        this.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
3428      this.constraint.add(t);
3429      return this;
3430    }
3431
3432    /**
3433     * @return {@link #mustSupport} (If true, implementations that produce or consume resources SHALL provide "support" for the element in some meaningful way.  If false, the element may be ignored and not supported.). This is the underlying object with id, value and extensions. The accessor "getMustSupport" gives direct access to the value
3434     */
3435    public BooleanType getMustSupportElement() { 
3436      if (this.mustSupport == null)
3437        if (Configuration.errorOnAutoCreate())
3438          throw new Error("Attempt to auto-create ElementDefinition.mustSupport");
3439        else if (Configuration.doAutoCreate())
3440          this.mustSupport = new BooleanType(); // bb
3441      return this.mustSupport;
3442    }
3443
3444    public boolean hasMustSupportElement() { 
3445      return this.mustSupport != null && !this.mustSupport.isEmpty();
3446    }
3447
3448    public boolean hasMustSupport() { 
3449      return this.mustSupport != null && !this.mustSupport.isEmpty();
3450    }
3451
3452    /**
3453     * @param value {@link #mustSupport} (If true, implementations that produce or consume resources SHALL provide "support" for the element in some meaningful way.  If false, the element may be ignored and not supported.). This is the underlying object with id, value and extensions. The accessor "getMustSupport" gives direct access to the value
3454     */
3455    public ElementDefinition setMustSupportElement(BooleanType value) { 
3456      this.mustSupport = value;
3457      return this;
3458    }
3459
3460    /**
3461     * @return If true, implementations that produce or consume resources SHALL provide "support" for the element in some meaningful way.  If false, the element may be ignored and not supported.
3462     */
3463    public boolean getMustSupport() { 
3464      return this.mustSupport == null || this.mustSupport.isEmpty() ? false : this.mustSupport.getValue();
3465    }
3466
3467    /**
3468     * @param value If true, implementations that produce or consume resources SHALL provide "support" for the element in some meaningful way.  If false, the element may be ignored and not supported.
3469     */
3470    public ElementDefinition setMustSupport(boolean value) { 
3471        if (this.mustSupport == null)
3472          this.mustSupport = new BooleanType();
3473        this.mustSupport.setValue(value);
3474      return this;
3475    }
3476
3477    /**
3478     * @return {@link #isModifier} (If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system.). This is the underlying object with id, value and extensions. The accessor "getIsModifier" gives direct access to the value
3479     */
3480    public BooleanType getIsModifierElement() { 
3481      if (this.isModifier == null)
3482        if (Configuration.errorOnAutoCreate())
3483          throw new Error("Attempt to auto-create ElementDefinition.isModifier");
3484        else if (Configuration.doAutoCreate())
3485          this.isModifier = new BooleanType(); // bb
3486      return this.isModifier;
3487    }
3488
3489    public boolean hasIsModifierElement() { 
3490      return this.isModifier != null && !this.isModifier.isEmpty();
3491    }
3492
3493    public boolean hasIsModifier() { 
3494      return this.isModifier != null && !this.isModifier.isEmpty();
3495    }
3496
3497    /**
3498     * @param value {@link #isModifier} (If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system.). This is the underlying object with id, value and extensions. The accessor "getIsModifier" gives direct access to the value
3499     */
3500    public ElementDefinition setIsModifierElement(BooleanType value) { 
3501      this.isModifier = value;
3502      return this;
3503    }
3504
3505    /**
3506     * @return If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system.
3507     */
3508    public boolean getIsModifier() { 
3509      return this.isModifier == null || this.isModifier.isEmpty() ? false : this.isModifier.getValue();
3510    }
3511
3512    /**
3513     * @param value If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system.
3514     */
3515    public ElementDefinition setIsModifier(boolean value) { 
3516        if (this.isModifier == null)
3517          this.isModifier = new BooleanType();
3518        this.isModifier.setValue(value);
3519      return this;
3520    }
3521
3522    /**
3523     * @return {@link #isSummary} (Whether the element should be included if a client requests a search with the parameter _summary=true.). This is the underlying object with id, value and extensions. The accessor "getIsSummary" gives direct access to the value
3524     */
3525    public BooleanType getIsSummaryElement() { 
3526      if (this.isSummary == null)
3527        if (Configuration.errorOnAutoCreate())
3528          throw new Error("Attempt to auto-create ElementDefinition.isSummary");
3529        else if (Configuration.doAutoCreate())
3530          this.isSummary = new BooleanType(); // bb
3531      return this.isSummary;
3532    }
3533
3534    public boolean hasIsSummaryElement() { 
3535      return this.isSummary != null && !this.isSummary.isEmpty();
3536    }
3537
3538    public boolean hasIsSummary() { 
3539      return this.isSummary != null && !this.isSummary.isEmpty();
3540    }
3541
3542    /**
3543     * @param value {@link #isSummary} (Whether the element should be included if a client requests a search with the parameter _summary=true.). This is the underlying object with id, value and extensions. The accessor "getIsSummary" gives direct access to the value
3544     */
3545    public ElementDefinition setIsSummaryElement(BooleanType value) { 
3546      this.isSummary = value;
3547      return this;
3548    }
3549
3550    /**
3551     * @return Whether the element should be included if a client requests a search with the parameter _summary=true.
3552     */
3553    public boolean getIsSummary() { 
3554      return this.isSummary == null || this.isSummary.isEmpty() ? false : this.isSummary.getValue();
3555    }
3556
3557    /**
3558     * @param value Whether the element should be included if a client requests a search with the parameter _summary=true.
3559     */
3560    public ElementDefinition setIsSummary(boolean value) { 
3561        if (this.isSummary == null)
3562          this.isSummary = new BooleanType();
3563        this.isSummary.setValue(value);
3564      return this;
3565    }
3566
3567    /**
3568     * @return {@link #binding} (Binds to a value set if this element is coded (code, Coding, CodeableConcept).)
3569     */
3570    public ElementDefinitionBindingComponent getBinding() { 
3571      if (this.binding == null)
3572        if (Configuration.errorOnAutoCreate())
3573          throw new Error("Attempt to auto-create ElementDefinition.binding");
3574        else if (Configuration.doAutoCreate())
3575          this.binding = new ElementDefinitionBindingComponent(); // cc
3576      return this.binding;
3577    }
3578
3579    public boolean hasBinding() { 
3580      return this.binding != null && !this.binding.isEmpty();
3581    }
3582
3583    /**
3584     * @param value {@link #binding} (Binds to a value set if this element is coded (code, Coding, CodeableConcept).)
3585     */
3586    public ElementDefinition setBinding(ElementDefinitionBindingComponent value) { 
3587      this.binding = value;
3588      return this;
3589    }
3590
3591    /**
3592     * @return {@link #mapping} (Identifies a concept from an external specification that roughly corresponds to this element.)
3593     */
3594    public List<ElementDefinitionMappingComponent> getMapping() { 
3595      if (this.mapping == null)
3596        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
3597      return this.mapping;
3598    }
3599
3600    public boolean hasMapping() { 
3601      if (this.mapping == null)
3602        return false;
3603      for (ElementDefinitionMappingComponent item : this.mapping)
3604        if (!item.isEmpty())
3605          return true;
3606      return false;
3607    }
3608
3609    /**
3610     * @return {@link #mapping} (Identifies a concept from an external specification that roughly corresponds to this element.)
3611     */
3612    // syntactic sugar
3613    public ElementDefinitionMappingComponent addMapping() { //3
3614      ElementDefinitionMappingComponent t = new ElementDefinitionMappingComponent();
3615      if (this.mapping == null)
3616        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
3617      this.mapping.add(t);
3618      return t;
3619    }
3620
3621    // syntactic sugar
3622    public ElementDefinition addMapping(ElementDefinitionMappingComponent t) { //3
3623      if (t == null)
3624        return this;
3625      if (this.mapping == null)
3626        this.mapping = new ArrayList<ElementDefinitionMappingComponent>();
3627      this.mapping.add(t);
3628      return this;
3629    }
3630
3631      protected void listChildren(List<Property> childrenList) {
3632        super.listChildren(childrenList);
3633        childrenList.add(new Property("path", "string", "The path identifies the element and is expressed as a \".\"-separated list of ancestor elements, beginning with the name of the resource or extension.", 0, java.lang.Integer.MAX_VALUE, path));
3634        childrenList.add(new Property("representation", "code", "Codes that define how this element is represented in instances, when the deviation varies from the normal case.", 0, java.lang.Integer.MAX_VALUE, representation));
3635        childrenList.add(new Property("name", "string", "The name of this element definition (to refer to it from other element definitions using ElementDefinition.nameReference). This is a unique name referring to a specific set of constraints applied to this element. One use of this is to provide a name to different slices of the same element.", 0, java.lang.Integer.MAX_VALUE, name));
3636        childrenList.add(new Property("label", "string", "The text to display beside the element indicating its meaning or to use to prompt for the element in a user display or form.", 0, java.lang.Integer.MAX_VALUE, label));
3637        childrenList.add(new Property("code", "Coding", "A code that provides the meaning for the element according to a particular terminology.", 0, java.lang.Integer.MAX_VALUE, code));
3638        childrenList.add(new Property("slicing", "", "Indicates that the element is sliced into a set of alternative definitions (i.e. in a structure definition, there are multiple different constraints on a single element in the base resource). Slicing can be used in any resource that has cardinality ..* on the base resource, or any resource with a choice of types. The set of slices is any elements that come after this in the element sequence that have the same path, until a shorter path occurs (the shorter path terminates the set).", 0, java.lang.Integer.MAX_VALUE, slicing));
3639        childrenList.add(new Property("short", "string", "A concise description of what this element means (e.g. for use in autogenerated summaries).", 0, java.lang.Integer.MAX_VALUE, short_));
3640        childrenList.add(new Property("definition", "markdown", "Provides a complete explanation of the meaning of the data element for human readability.  For the case of elements derived from existing elements (e.g. constraints), the definition SHALL be consistent with the base definition, but convey the meaning of the element in the particular context of use of the resource.", 0, java.lang.Integer.MAX_VALUE, definition));
3641        childrenList.add(new Property("comments", "markdown", "Explanatory notes and implementation guidance about the data element, including notes about how to use the data properly, exceptions to proper use, etc.", 0, java.lang.Integer.MAX_VALUE, comments));
3642        childrenList.add(new Property("requirements", "markdown", "This element is for traceability of why the element was created and why the constraints exist as they do. This may be used to point to source materials or specifications that drove the structure of this element.", 0, java.lang.Integer.MAX_VALUE, requirements));
3643        childrenList.add(new Property("alias", "string", "Identifies additional names by which this element might also be known.", 0, java.lang.Integer.MAX_VALUE, alias));
3644        childrenList.add(new Property("min", "integer", "The minimum number of times this element SHALL appear in the instance.", 0, java.lang.Integer.MAX_VALUE, min));
3645        childrenList.add(new Property("max", "string", "The maximum number of times this element is permitted to appear in the instance.", 0, java.lang.Integer.MAX_VALUE, max));
3646        childrenList.add(new Property("base", "", "Information about the base definition of the element, provided to make it unncessary for tools to trace the deviation of the element through the derived and related profiles. This information is only provided where the element definition represents a constraint on another element definition, and must be present if there is a base element definition.", 0, java.lang.Integer.MAX_VALUE, base));
3647        childrenList.add(new Property("type", "", "The data type or resource that the value of this element is permitted to be.", 0, java.lang.Integer.MAX_VALUE, type));
3648        childrenList.add(new Property("nameReference", "string", "Identifies the name of a slice defined elsewhere in the profile whose constraints should be applied to the current element.", 0, java.lang.Integer.MAX_VALUE, nameReference));
3649        childrenList.add(new Property("defaultValue[x]", "*", "The value that should be used if there is no value stated in the instance (e.g. 'if not otherwise specified, the abstract is false').", 0, java.lang.Integer.MAX_VALUE, defaultValue));
3650        childrenList.add(new Property("meaningWhenMissing", "markdown", "The Implicit meaning that is to be understood when this element is missing (e.g. 'when this element is missing, the period is ongoing'.", 0, java.lang.Integer.MAX_VALUE, meaningWhenMissing));
3651        childrenList.add(new Property("fixed[x]", "*", "Specifies a value that SHALL be exactly the value  for this element in the instance. For purposes of comparison, non-significant whitespace is ignored, and all values must be an exact match (case and accent sensitive). Missing elements/attributes must also be missing.", 0, java.lang.Integer.MAX_VALUE, fixed));
3652        childrenList.add(new Property("pattern[x]", "*", "Specifies a value that the value in the instance SHALL follow - that is, any value in the pattern must be found in the instance. Other additional values may be found too. This is effectively constraint by example.  The values of elements present in the pattern must match exactly (case-sensitive, accent-sensitive, etc.).", 0, java.lang.Integer.MAX_VALUE, pattern));
3653        childrenList.add(new Property("example[x]", "*", "A sample value for this element demonstrating the type of information that would typically be captured.", 0, java.lang.Integer.MAX_VALUE, example));
3654        childrenList.add(new Property("minValue[x]", "*", "The minimum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.", 0, java.lang.Integer.MAX_VALUE, minValue));
3655        childrenList.add(new Property("maxValue[x]", "*", "The maximum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.", 0, java.lang.Integer.MAX_VALUE, maxValue));
3656        childrenList.add(new Property("maxLength", "integer", "Indicates the maximum length in characters that is permitted to be present in conformant instances and which is expected to be supported by conformant consumers that support the element.", 0, java.lang.Integer.MAX_VALUE, maxLength));
3657        childrenList.add(new Property("condition", "id", "A reference to an invariant that may make additional statements about the cardinality or value in the instance.", 0, java.lang.Integer.MAX_VALUE, condition));
3658        childrenList.add(new Property("constraint", "", "Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance.", 0, java.lang.Integer.MAX_VALUE, constraint));
3659        childrenList.add(new Property("mustSupport", "boolean", "If true, implementations that produce or consume resources SHALL provide \"support\" for the element in some meaningful way.  If false, the element may be ignored and not supported.", 0, java.lang.Integer.MAX_VALUE, mustSupport));
3660        childrenList.add(new Property("isModifier", "boolean", "If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system.", 0, java.lang.Integer.MAX_VALUE, isModifier));
3661        childrenList.add(new Property("isSummary", "boolean", "Whether the element should be included if a client requests a search with the parameter _summary=true.", 0, java.lang.Integer.MAX_VALUE, isSummary));
3662        childrenList.add(new Property("binding", "", "Binds to a value set if this element is coded (code, Coding, CodeableConcept).", 0, java.lang.Integer.MAX_VALUE, binding));
3663        childrenList.add(new Property("mapping", "", "Identifies a concept from an external specification that roughly corresponds to this element.", 0, java.lang.Integer.MAX_VALUE, mapping));
3664      }
3665
3666      @Override
3667      public void setProperty(String name, Base value) throws FHIRException {
3668        if (name.equals("path"))
3669          this.path = castToString(value); // StringType
3670        else if (name.equals("representation"))
3671          this.getRepresentation().add(new PropertyRepresentationEnumFactory().fromType(value));
3672        else if (name.equals("name"))
3673          this.name = castToString(value); // StringType
3674        else if (name.equals("label"))
3675          this.label = castToString(value); // StringType
3676        else if (name.equals("code"))
3677          this.getCode().add(castToCoding(value));
3678        else if (name.equals("slicing"))
3679          this.slicing = (ElementDefinitionSlicingComponent) value; // ElementDefinitionSlicingComponent
3680        else if (name.equals("short"))
3681          this.short_ = castToString(value); // StringType
3682        else if (name.equals("definition"))
3683          this.definition = castToMarkdown(value); // MarkdownType
3684        else if (name.equals("comments"))
3685          this.comments = castToMarkdown(value); // MarkdownType
3686        else if (name.equals("requirements"))
3687          this.requirements = castToMarkdown(value); // MarkdownType
3688        else if (name.equals("alias"))
3689          this.getAlias().add(castToString(value));
3690        else if (name.equals("min"))
3691          this.min = castToInteger(value); // IntegerType
3692        else if (name.equals("max"))
3693          this.max = castToString(value); // StringType
3694        else if (name.equals("base"))
3695          this.base = (ElementDefinitionBaseComponent) value; // ElementDefinitionBaseComponent
3696        else if (name.equals("type"))
3697          this.getType().add((TypeRefComponent) value);
3698        else if (name.equals("nameReference"))
3699          this.nameReference = castToString(value); // StringType
3700        else if (name.equals("defaultValue[x]"))
3701          this.defaultValue = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3702        else if (name.equals("meaningWhenMissing"))
3703          this.meaningWhenMissing = castToMarkdown(value); // MarkdownType
3704        else if (name.equals("fixed[x]"))
3705          this.fixed = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3706        else if (name.equals("pattern[x]"))
3707          this.pattern = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3708        else if (name.equals("example[x]"))
3709          this.example = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3710        else if (name.equals("minValue[x]"))
3711          this.minValue = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3712        else if (name.equals("maxValue[x]"))
3713          this.maxValue = (org.hl7.fhir.dstu2.model.Type) value; // org.hl7.fhir.dstu2.model.Type
3714        else if (name.equals("maxLength"))
3715          this.maxLength = castToInteger(value); // IntegerType
3716        else if (name.equals("condition"))
3717          this.getCondition().add(castToId(value));
3718        else if (name.equals("constraint"))
3719          this.getConstraint().add((ElementDefinitionConstraintComponent) value);
3720        else if (name.equals("mustSupport"))
3721          this.mustSupport = castToBoolean(value); // BooleanType
3722        else if (name.equals("isModifier"))
3723          this.isModifier = castToBoolean(value); // BooleanType
3724        else if (name.equals("isSummary"))
3725          this.isSummary = castToBoolean(value); // BooleanType
3726        else if (name.equals("binding"))
3727          this.binding = (ElementDefinitionBindingComponent) value; // ElementDefinitionBindingComponent
3728        else if (name.equals("mapping"))
3729          this.getMapping().add((ElementDefinitionMappingComponent) value);
3730        else
3731          super.setProperty(name, value);
3732      }
3733
3734      @Override
3735      public Base addChild(String name) throws FHIRException {
3736        if (name.equals("path")) {
3737          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.path");
3738        }
3739        else if (name.equals("representation")) {
3740          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.representation");
3741        }
3742        else if (name.equals("name")) {
3743          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.name");
3744        }
3745        else if (name.equals("label")) {
3746          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.label");
3747        }
3748        else if (name.equals("code")) {
3749          return addCode();
3750        }
3751        else if (name.equals("slicing")) {
3752          this.slicing = new ElementDefinitionSlicingComponent();
3753          return this.slicing;
3754        }
3755        else if (name.equals("short")) {
3756          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.short");
3757        }
3758        else if (name.equals("definition")) {
3759          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.definition");
3760        }
3761        else if (name.equals("comments")) {
3762          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.comments");
3763        }
3764        else if (name.equals("requirements")) {
3765          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.requirements");
3766        }
3767        else if (name.equals("alias")) {
3768          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.alias");
3769        }
3770        else if (name.equals("min")) {
3771          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.min");
3772        }
3773        else if (name.equals("max")) {
3774          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.max");
3775        }
3776        else if (name.equals("base")) {
3777          this.base = new ElementDefinitionBaseComponent();
3778          return this.base;
3779        }
3780        else if (name.equals("type")) {
3781          return addType();
3782        }
3783        else if (name.equals("nameReference")) {
3784          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.nameReference");
3785        }
3786        else if (name.equals("defaultValueBoolean")) {
3787          this.defaultValue = new BooleanType();
3788          return this.defaultValue;
3789        }
3790        else if (name.equals("defaultValueInteger")) {
3791          this.defaultValue = new IntegerType();
3792          return this.defaultValue;
3793        }
3794        else if (name.equals("defaultValueDecimal")) {
3795          this.defaultValue = new DecimalType();
3796          return this.defaultValue;
3797        }
3798        else if (name.equals("defaultValueBase64Binary")) {
3799          this.defaultValue = new Base64BinaryType();
3800          return this.defaultValue;
3801        }
3802        else if (name.equals("defaultValueInstant")) {
3803          this.defaultValue = new InstantType();
3804          return this.defaultValue;
3805        }
3806        else if (name.equals("defaultValueString")) {
3807          this.defaultValue = new StringType();
3808          return this.defaultValue;
3809        }
3810        else if (name.equals("defaultValueUri")) {
3811          this.defaultValue = new UriType();
3812          return this.defaultValue;
3813        }
3814        else if (name.equals("defaultValueDate")) {
3815          this.defaultValue = new DateType();
3816          return this.defaultValue;
3817        }
3818        else if (name.equals("defaultValueDateTime")) {
3819          this.defaultValue = new DateTimeType();
3820          return this.defaultValue;
3821        }
3822        else if (name.equals("defaultValueTime")) {
3823          this.defaultValue = new TimeType();
3824          return this.defaultValue;
3825        }
3826        else if (name.equals("defaultValueCode")) {
3827          this.defaultValue = new CodeType();
3828          return this.defaultValue;
3829        }
3830        else if (name.equals("defaultValueOid")) {
3831          this.defaultValue = new OidType();
3832          return this.defaultValue;
3833        }
3834        else if (name.equals("defaultValueId")) {
3835          this.defaultValue = new IdType();
3836          return this.defaultValue;
3837        }
3838        else if (name.equals("defaultValueUnsignedInt")) {
3839          this.defaultValue = new UnsignedIntType();
3840          return this.defaultValue;
3841        }
3842        else if (name.equals("defaultValuePositiveInt")) {
3843          this.defaultValue = new PositiveIntType();
3844          return this.defaultValue;
3845        }
3846        else if (name.equals("defaultValueMarkdown")) {
3847          this.defaultValue = new MarkdownType();
3848          return this.defaultValue;
3849        }
3850        else if (name.equals("defaultValueAnnotation")) {
3851          this.defaultValue = new Annotation();
3852          return this.defaultValue;
3853        }
3854        else if (name.equals("defaultValueAttachment")) {
3855          this.defaultValue = new Attachment();
3856          return this.defaultValue;
3857        }
3858        else if (name.equals("defaultValueIdentifier")) {
3859          this.defaultValue = new Identifier();
3860          return this.defaultValue;
3861        }
3862        else if (name.equals("defaultValueCodeableConcept")) {
3863          this.defaultValue = new CodeableConcept();
3864          return this.defaultValue;
3865        }
3866        else if (name.equals("defaultValueCoding")) {
3867          this.defaultValue = new Coding();
3868          return this.defaultValue;
3869        }
3870        else if (name.equals("defaultValueQuantity")) {
3871          this.defaultValue = new Quantity();
3872          return this.defaultValue;
3873        }
3874        else if (name.equals("defaultValueRange")) {
3875          this.defaultValue = new Range();
3876          return this.defaultValue;
3877        }
3878        else if (name.equals("defaultValuePeriod")) {
3879          this.defaultValue = new Period();
3880          return this.defaultValue;
3881        }
3882        else if (name.equals("defaultValueRatio")) {
3883          this.defaultValue = new Ratio();
3884          return this.defaultValue;
3885        }
3886        else if (name.equals("defaultValueSampledData")) {
3887          this.defaultValue = new SampledData();
3888          return this.defaultValue;
3889        }
3890        else if (name.equals("defaultValueSignature")) {
3891          this.defaultValue = new Signature();
3892          return this.defaultValue;
3893        }
3894        else if (name.equals("defaultValueHumanName")) {
3895          this.defaultValue = new HumanName();
3896          return this.defaultValue;
3897        }
3898        else if (name.equals("defaultValueAddress")) {
3899          this.defaultValue = new Address();
3900          return this.defaultValue;
3901        }
3902        else if (name.equals("defaultValueContactPoint")) {
3903          this.defaultValue = new ContactPoint();
3904          return this.defaultValue;
3905        }
3906        else if (name.equals("defaultValueTiming")) {
3907          this.defaultValue = new Timing();
3908          return this.defaultValue;
3909        }
3910        else if (name.equals("defaultValueReference")) {
3911          this.defaultValue = new Reference();
3912          return this.defaultValue;
3913        }
3914        else if (name.equals("defaultValueMeta")) {
3915          this.defaultValue = new Meta();
3916          return this.defaultValue;
3917        }
3918        else if (name.equals("meaningWhenMissing")) {
3919          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.meaningWhenMissing");
3920        }
3921        else if (name.equals("fixedBoolean")) {
3922          this.fixed = new BooleanType();
3923          return this.fixed;
3924        }
3925        else if (name.equals("fixedInteger")) {
3926          this.fixed = new IntegerType();
3927          return this.fixed;
3928        }
3929        else if (name.equals("fixedDecimal")) {
3930          this.fixed = new DecimalType();
3931          return this.fixed;
3932        }
3933        else if (name.equals("fixedBase64Binary")) {
3934          this.fixed = new Base64BinaryType();
3935          return this.fixed;
3936        }
3937        else if (name.equals("fixedInstant")) {
3938          this.fixed = new InstantType();
3939          return this.fixed;
3940        }
3941        else if (name.equals("fixedString")) {
3942          this.fixed = new StringType();
3943          return this.fixed;
3944        }
3945        else if (name.equals("fixedUri")) {
3946          this.fixed = new UriType();
3947          return this.fixed;
3948        }
3949        else if (name.equals("fixedDate")) {
3950          this.fixed = new DateType();
3951          return this.fixed;
3952        }
3953        else if (name.equals("fixedDateTime")) {
3954          this.fixed = new DateTimeType();
3955          return this.fixed;
3956        }
3957        else if (name.equals("fixedTime")) {
3958          this.fixed = new TimeType();
3959          return this.fixed;
3960        }
3961        else if (name.equals("fixedCode")) {
3962          this.fixed = new CodeType();
3963          return this.fixed;
3964        }
3965        else if (name.equals("fixedOid")) {
3966          this.fixed = new OidType();
3967          return this.fixed;
3968        }
3969        else if (name.equals("fixedId")) {
3970          this.fixed = new IdType();
3971          return this.fixed;
3972        }
3973        else if (name.equals("fixedUnsignedInt")) {
3974          this.fixed = new UnsignedIntType();
3975          return this.fixed;
3976        }
3977        else if (name.equals("fixedPositiveInt")) {
3978          this.fixed = new PositiveIntType();
3979          return this.fixed;
3980        }
3981        else if (name.equals("fixedMarkdown")) {
3982          this.fixed = new MarkdownType();
3983          return this.fixed;
3984        }
3985        else if (name.equals("fixedAnnotation")) {
3986          this.fixed = new Annotation();
3987          return this.fixed;
3988        }
3989        else if (name.equals("fixedAttachment")) {
3990          this.fixed = new Attachment();
3991          return this.fixed;
3992        }
3993        else if (name.equals("fixedIdentifier")) {
3994          this.fixed = new Identifier();
3995          return this.fixed;
3996        }
3997        else if (name.equals("fixedCodeableConcept")) {
3998          this.fixed = new CodeableConcept();
3999          return this.fixed;
4000        }
4001        else if (name.equals("fixedCoding")) {
4002          this.fixed = new Coding();
4003          return this.fixed;
4004        }
4005        else if (name.equals("fixedQuantity")) {
4006          this.fixed = new Quantity();
4007          return this.fixed;
4008        }
4009        else if (name.equals("fixedRange")) {
4010          this.fixed = new Range();
4011          return this.fixed;
4012        }
4013        else if (name.equals("fixedPeriod")) {
4014          this.fixed = new Period();
4015          return this.fixed;
4016        }
4017        else if (name.equals("fixedRatio")) {
4018          this.fixed = new Ratio();
4019          return this.fixed;
4020        }
4021        else if (name.equals("fixedSampledData")) {
4022          this.fixed = new SampledData();
4023          return this.fixed;
4024        }
4025        else if (name.equals("fixedSignature")) {
4026          this.fixed = new Signature();
4027          return this.fixed;
4028        }
4029        else if (name.equals("fixedHumanName")) {
4030          this.fixed = new HumanName();
4031          return this.fixed;
4032        }
4033        else if (name.equals("fixedAddress")) {
4034          this.fixed = new Address();
4035          return this.fixed;
4036        }
4037        else if (name.equals("fixedContactPoint")) {
4038          this.fixed = new ContactPoint();
4039          return this.fixed;
4040        }
4041        else if (name.equals("fixedTiming")) {
4042          this.fixed = new Timing();
4043          return this.fixed;
4044        }
4045        else if (name.equals("fixedReference")) {
4046          this.fixed = new Reference();
4047          return this.fixed;
4048        }
4049        else if (name.equals("fixedMeta")) {
4050          this.fixed = new Meta();
4051          return this.fixed;
4052        }
4053        else if (name.equals("patternBoolean")) {
4054          this.pattern = new BooleanType();
4055          return this.pattern;
4056        }
4057        else if (name.equals("patternInteger")) {
4058          this.pattern = new IntegerType();
4059          return this.pattern;
4060        }
4061        else if (name.equals("patternDecimal")) {
4062          this.pattern = new DecimalType();
4063          return this.pattern;
4064        }
4065        else if (name.equals("patternBase64Binary")) {
4066          this.pattern = new Base64BinaryType();
4067          return this.pattern;
4068        }
4069        else if (name.equals("patternInstant")) {
4070          this.pattern = new InstantType();
4071          return this.pattern;
4072        }
4073        else if (name.equals("patternString")) {
4074          this.pattern = new StringType();
4075          return this.pattern;
4076        }
4077        else if (name.equals("patternUri")) {
4078          this.pattern = new UriType();
4079          return this.pattern;
4080        }
4081        else if (name.equals("patternDate")) {
4082          this.pattern = new DateType();
4083          return this.pattern;
4084        }
4085        else if (name.equals("patternDateTime")) {
4086          this.pattern = new DateTimeType();
4087          return this.pattern;
4088        }
4089        else if (name.equals("patternTime")) {
4090          this.pattern = new TimeType();
4091          return this.pattern;
4092        }
4093        else if (name.equals("patternCode")) {
4094          this.pattern = new CodeType();
4095          return this.pattern;
4096        }
4097        else if (name.equals("patternOid")) {
4098          this.pattern = new OidType();
4099          return this.pattern;
4100        }
4101        else if (name.equals("patternId")) {
4102          this.pattern = new IdType();
4103          return this.pattern;
4104        }
4105        else if (name.equals("patternUnsignedInt")) {
4106          this.pattern = new UnsignedIntType();
4107          return this.pattern;
4108        }
4109        else if (name.equals("patternPositiveInt")) {
4110          this.pattern = new PositiveIntType();
4111          return this.pattern;
4112        }
4113        else if (name.equals("patternMarkdown")) {
4114          this.pattern = new MarkdownType();
4115          return this.pattern;
4116        }
4117        else if (name.equals("patternAnnotation")) {
4118          this.pattern = new Annotation();
4119          return this.pattern;
4120        }
4121        else if (name.equals("patternAttachment")) {
4122          this.pattern = new Attachment();
4123          return this.pattern;
4124        }
4125        else if (name.equals("patternIdentifier")) {
4126          this.pattern = new Identifier();
4127          return this.pattern;
4128        }
4129        else if (name.equals("patternCodeableConcept")) {
4130          this.pattern = new CodeableConcept();
4131          return this.pattern;
4132        }
4133        else if (name.equals("patternCoding")) {
4134          this.pattern = new Coding();
4135          return this.pattern;
4136        }
4137        else if (name.equals("patternQuantity")) {
4138          this.pattern = new Quantity();
4139          return this.pattern;
4140        }
4141        else if (name.equals("patternRange")) {
4142          this.pattern = new Range();
4143          return this.pattern;
4144        }
4145        else if (name.equals("patternPeriod")) {
4146          this.pattern = new Period();
4147          return this.pattern;
4148        }
4149        else if (name.equals("patternRatio")) {
4150          this.pattern = new Ratio();
4151          return this.pattern;
4152        }
4153        else if (name.equals("patternSampledData")) {
4154          this.pattern = new SampledData();
4155          return this.pattern;
4156        }
4157        else if (name.equals("patternSignature")) {
4158          this.pattern = new Signature();
4159          return this.pattern;
4160        }
4161        else if (name.equals("patternHumanName")) {
4162          this.pattern = new HumanName();
4163          return this.pattern;
4164        }
4165        else if (name.equals("patternAddress")) {
4166          this.pattern = new Address();
4167          return this.pattern;
4168        }
4169        else if (name.equals("patternContactPoint")) {
4170          this.pattern = new ContactPoint();
4171          return this.pattern;
4172        }
4173        else if (name.equals("patternTiming")) {
4174          this.pattern = new Timing();
4175          return this.pattern;
4176        }
4177        else if (name.equals("patternReference")) {
4178          this.pattern = new Reference();
4179          return this.pattern;
4180        }
4181        else if (name.equals("patternMeta")) {
4182          this.pattern = new Meta();
4183          return this.pattern;
4184        }
4185        else if (name.equals("exampleBoolean")) {
4186          this.example = new BooleanType();
4187          return this.example;
4188        }
4189        else if (name.equals("exampleInteger")) {
4190          this.example = new IntegerType();
4191          return this.example;
4192        }
4193        else if (name.equals("exampleDecimal")) {
4194          this.example = new DecimalType();
4195          return this.example;
4196        }
4197        else if (name.equals("exampleBase64Binary")) {
4198          this.example = new Base64BinaryType();
4199          return this.example;
4200        }
4201        else if (name.equals("exampleInstant")) {
4202          this.example = new InstantType();
4203          return this.example;
4204        }
4205        else if (name.equals("exampleString")) {
4206          this.example = new StringType();
4207          return this.example;
4208        }
4209        else if (name.equals("exampleUri")) {
4210          this.example = new UriType();
4211          return this.example;
4212        }
4213        else if (name.equals("exampleDate")) {
4214          this.example = new DateType();
4215          return this.example;
4216        }
4217        else if (name.equals("exampleDateTime")) {
4218          this.example = new DateTimeType();
4219          return this.example;
4220        }
4221        else if (name.equals("exampleTime")) {
4222          this.example = new TimeType();
4223          return this.example;
4224        }
4225        else if (name.equals("exampleCode")) {
4226          this.example = new CodeType();
4227          return this.example;
4228        }
4229        else if (name.equals("exampleOid")) {
4230          this.example = new OidType();
4231          return this.example;
4232        }
4233        else if (name.equals("exampleId")) {
4234          this.example = new IdType();
4235          return this.example;
4236        }
4237        else if (name.equals("exampleUnsignedInt")) {
4238          this.example = new UnsignedIntType();
4239          return this.example;
4240        }
4241        else if (name.equals("examplePositiveInt")) {
4242          this.example = new PositiveIntType();
4243          return this.example;
4244        }
4245        else if (name.equals("exampleMarkdown")) {
4246          this.example = new MarkdownType();
4247          return this.example;
4248        }
4249        else if (name.equals("exampleAnnotation")) {
4250          this.example = new Annotation();
4251          return this.example;
4252        }
4253        else if (name.equals("exampleAttachment")) {
4254          this.example = new Attachment();
4255          return this.example;
4256        }
4257        else if (name.equals("exampleIdentifier")) {
4258          this.example = new Identifier();
4259          return this.example;
4260        }
4261        else if (name.equals("exampleCodeableConcept")) {
4262          this.example = new CodeableConcept();
4263          return this.example;
4264        }
4265        else if (name.equals("exampleCoding")) {
4266          this.example = new Coding();
4267          return this.example;
4268        }
4269        else if (name.equals("exampleQuantity")) {
4270          this.example = new Quantity();
4271          return this.example;
4272        }
4273        else if (name.equals("exampleRange")) {
4274          this.example = new Range();
4275          return this.example;
4276        }
4277        else if (name.equals("examplePeriod")) {
4278          this.example = new Period();
4279          return this.example;
4280        }
4281        else if (name.equals("exampleRatio")) {
4282          this.example = new Ratio();
4283          return this.example;
4284        }
4285        else if (name.equals("exampleSampledData")) {
4286          this.example = new SampledData();
4287          return this.example;
4288        }
4289        else if (name.equals("exampleSignature")) {
4290          this.example = new Signature();
4291          return this.example;
4292        }
4293        else if (name.equals("exampleHumanName")) {
4294          this.example = new HumanName();
4295          return this.example;
4296        }
4297        else if (name.equals("exampleAddress")) {
4298          this.example = new Address();
4299          return this.example;
4300        }
4301        else if (name.equals("exampleContactPoint")) {
4302          this.example = new ContactPoint();
4303          return this.example;
4304        }
4305        else if (name.equals("exampleTiming")) {
4306          this.example = new Timing();
4307          return this.example;
4308        }
4309        else if (name.equals("exampleReference")) {
4310          this.example = new Reference();
4311          return this.example;
4312        }
4313        else if (name.equals("exampleMeta")) {
4314          this.example = new Meta();
4315          return this.example;
4316        }
4317        else if (name.equals("minValueBoolean")) {
4318          this.minValue = new BooleanType();
4319          return this.minValue;
4320        }
4321        else if (name.equals("minValueInteger")) {
4322          this.minValue = new IntegerType();
4323          return this.minValue;
4324        }
4325        else if (name.equals("minValueDecimal")) {
4326          this.minValue = new DecimalType();
4327          return this.minValue;
4328        }
4329        else if (name.equals("minValueBase64Binary")) {
4330          this.minValue = new Base64BinaryType();
4331          return this.minValue;
4332        }
4333        else if (name.equals("minValueInstant")) {
4334          this.minValue = new InstantType();
4335          return this.minValue;
4336        }
4337        else if (name.equals("minValueString")) {
4338          this.minValue = new StringType();
4339          return this.minValue;
4340        }
4341        else if (name.equals("minValueUri")) {
4342          this.minValue = new UriType();
4343          return this.minValue;
4344        }
4345        else if (name.equals("minValueDate")) {
4346          this.minValue = new DateType();
4347          return this.minValue;
4348        }
4349        else if (name.equals("minValueDateTime")) {
4350          this.minValue = new DateTimeType();
4351          return this.minValue;
4352        }
4353        else if (name.equals("minValueTime")) {
4354          this.minValue = new TimeType();
4355          return this.minValue;
4356        }
4357        else if (name.equals("minValueCode")) {
4358          this.minValue = new CodeType();
4359          return this.minValue;
4360        }
4361        else if (name.equals("minValueOid")) {
4362          this.minValue = new OidType();
4363          return this.minValue;
4364        }
4365        else if (name.equals("minValueId")) {
4366          this.minValue = new IdType();
4367          return this.minValue;
4368        }
4369        else if (name.equals("minValueUnsignedInt")) {
4370          this.minValue = new UnsignedIntType();
4371          return this.minValue;
4372        }
4373        else if (name.equals("minValuePositiveInt")) {
4374          this.minValue = new PositiveIntType();
4375          return this.minValue;
4376        }
4377        else if (name.equals("minValueMarkdown")) {
4378          this.minValue = new MarkdownType();
4379          return this.minValue;
4380        }
4381        else if (name.equals("minValueAnnotation")) {
4382          this.minValue = new Annotation();
4383          return this.minValue;
4384        }
4385        else if (name.equals("minValueAttachment")) {
4386          this.minValue = new Attachment();
4387          return this.minValue;
4388        }
4389        else if (name.equals("minValueIdentifier")) {
4390          this.minValue = new Identifier();
4391          return this.minValue;
4392        }
4393        else if (name.equals("minValueCodeableConcept")) {
4394          this.minValue = new CodeableConcept();
4395          return this.minValue;
4396        }
4397        else if (name.equals("minValueCoding")) {
4398          this.minValue = new Coding();
4399          return this.minValue;
4400        }
4401        else if (name.equals("minValueQuantity")) {
4402          this.minValue = new Quantity();
4403          return this.minValue;
4404        }
4405        else if (name.equals("minValueRange")) {
4406          this.minValue = new Range();
4407          return this.minValue;
4408        }
4409        else if (name.equals("minValuePeriod")) {
4410          this.minValue = new Period();
4411          return this.minValue;
4412        }
4413        else if (name.equals("minValueRatio")) {
4414          this.minValue = new Ratio();
4415          return this.minValue;
4416        }
4417        else if (name.equals("minValueSampledData")) {
4418          this.minValue = new SampledData();
4419          return this.minValue;
4420        }
4421        else if (name.equals("minValueSignature")) {
4422          this.minValue = new Signature();
4423          return this.minValue;
4424        }
4425        else if (name.equals("minValueHumanName")) {
4426          this.minValue = new HumanName();
4427          return this.minValue;
4428        }
4429        else if (name.equals("minValueAddress")) {
4430          this.minValue = new Address();
4431          return this.minValue;
4432        }
4433        else if (name.equals("minValueContactPoint")) {
4434          this.minValue = new ContactPoint();
4435          return this.minValue;
4436        }
4437        else if (name.equals("minValueTiming")) {
4438          this.minValue = new Timing();
4439          return this.minValue;
4440        }
4441        else if (name.equals("minValueReference")) {
4442          this.minValue = new Reference();
4443          return this.minValue;
4444        }
4445        else if (name.equals("minValueMeta")) {
4446          this.minValue = new Meta();
4447          return this.minValue;
4448        }
4449        else if (name.equals("maxValueBoolean")) {
4450          this.maxValue = new BooleanType();
4451          return this.maxValue;
4452        }
4453        else if (name.equals("maxValueInteger")) {
4454          this.maxValue = new IntegerType();
4455          return this.maxValue;
4456        }
4457        else if (name.equals("maxValueDecimal")) {
4458          this.maxValue = new DecimalType();
4459          return this.maxValue;
4460        }
4461        else if (name.equals("maxValueBase64Binary")) {
4462          this.maxValue = new Base64BinaryType();
4463          return this.maxValue;
4464        }
4465        else if (name.equals("maxValueInstant")) {
4466          this.maxValue = new InstantType();
4467          return this.maxValue;
4468        }
4469        else if (name.equals("maxValueString")) {
4470          this.maxValue = new StringType();
4471          return this.maxValue;
4472        }
4473        else if (name.equals("maxValueUri")) {
4474          this.maxValue = new UriType();
4475          return this.maxValue;
4476        }
4477        else if (name.equals("maxValueDate")) {
4478          this.maxValue = new DateType();
4479          return this.maxValue;
4480        }
4481        else if (name.equals("maxValueDateTime")) {
4482          this.maxValue = new DateTimeType();
4483          return this.maxValue;
4484        }
4485        else if (name.equals("maxValueTime")) {
4486          this.maxValue = new TimeType();
4487          return this.maxValue;
4488        }
4489        else if (name.equals("maxValueCode")) {
4490          this.maxValue = new CodeType();
4491          return this.maxValue;
4492        }
4493        else if (name.equals("maxValueOid")) {
4494          this.maxValue = new OidType();
4495          return this.maxValue;
4496        }
4497        else if (name.equals("maxValueId")) {
4498          this.maxValue = new IdType();
4499          return this.maxValue;
4500        }
4501        else if (name.equals("maxValueUnsignedInt")) {
4502          this.maxValue = new UnsignedIntType();
4503          return this.maxValue;
4504        }
4505        else if (name.equals("maxValuePositiveInt")) {
4506          this.maxValue = new PositiveIntType();
4507          return this.maxValue;
4508        }
4509        else if (name.equals("maxValueMarkdown")) {
4510          this.maxValue = new MarkdownType();
4511          return this.maxValue;
4512        }
4513        else if (name.equals("maxValueAnnotation")) {
4514          this.maxValue = new Annotation();
4515          return this.maxValue;
4516        }
4517        else if (name.equals("maxValueAttachment")) {
4518          this.maxValue = new Attachment();
4519          return this.maxValue;
4520        }
4521        else if (name.equals("maxValueIdentifier")) {
4522          this.maxValue = new Identifier();
4523          return this.maxValue;
4524        }
4525        else if (name.equals("maxValueCodeableConcept")) {
4526          this.maxValue = new CodeableConcept();
4527          return this.maxValue;
4528        }
4529        else if (name.equals("maxValueCoding")) {
4530          this.maxValue = new Coding();
4531          return this.maxValue;
4532        }
4533        else if (name.equals("maxValueQuantity")) {
4534          this.maxValue = new Quantity();
4535          return this.maxValue;
4536        }
4537        else if (name.equals("maxValueRange")) {
4538          this.maxValue = new Range();
4539          return this.maxValue;
4540        }
4541        else if (name.equals("maxValuePeriod")) {
4542          this.maxValue = new Period();
4543          return this.maxValue;
4544        }
4545        else if (name.equals("maxValueRatio")) {
4546          this.maxValue = new Ratio();
4547          return this.maxValue;
4548        }
4549        else if (name.equals("maxValueSampledData")) {
4550          this.maxValue = new SampledData();
4551          return this.maxValue;
4552        }
4553        else if (name.equals("maxValueSignature")) {
4554          this.maxValue = new Signature();
4555          return this.maxValue;
4556        }
4557        else if (name.equals("maxValueHumanName")) {
4558          this.maxValue = new HumanName();
4559          return this.maxValue;
4560        }
4561        else if (name.equals("maxValueAddress")) {
4562          this.maxValue = new Address();
4563          return this.maxValue;
4564        }
4565        else if (name.equals("maxValueContactPoint")) {
4566          this.maxValue = new ContactPoint();
4567          return this.maxValue;
4568        }
4569        else if (name.equals("maxValueTiming")) {
4570          this.maxValue = new Timing();
4571          return this.maxValue;
4572        }
4573        else if (name.equals("maxValueReference")) {
4574          this.maxValue = new Reference();
4575          return this.maxValue;
4576        }
4577        else if (name.equals("maxValueMeta")) {
4578          this.maxValue = new Meta();
4579          return this.maxValue;
4580        }
4581        else if (name.equals("maxLength")) {
4582          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.maxLength");
4583        }
4584        else if (name.equals("condition")) {
4585          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.condition");
4586        }
4587        else if (name.equals("constraint")) {
4588          return addConstraint();
4589        }
4590        else if (name.equals("mustSupport")) {
4591          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.mustSupport");
4592        }
4593        else if (name.equals("isModifier")) {
4594          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.isModifier");
4595        }
4596        else if (name.equals("isSummary")) {
4597          throw new FHIRException("Cannot call addChild on a primitive type ElementDefinition.isSummary");
4598        }
4599        else if (name.equals("binding")) {
4600          this.binding = new ElementDefinitionBindingComponent();
4601          return this.binding;
4602        }
4603        else if (name.equals("mapping")) {
4604          return addMapping();
4605        }
4606        else
4607          return super.addChild(name);
4608      }
4609
4610  public String fhirType() {
4611    return "ElementDefinition";
4612
4613  }
4614
4615      public ElementDefinition copy() {
4616        ElementDefinition dst = new ElementDefinition();
4617        copyValues(dst);
4618        dst.path = path == null ? null : path.copy();
4619        if (representation != null) {
4620          dst.representation = new ArrayList<Enumeration<PropertyRepresentation>>();
4621          for (Enumeration<PropertyRepresentation> i : representation)
4622            dst.representation.add(i.copy());
4623        };
4624        dst.name = name == null ? null : name.copy();
4625        dst.label = label == null ? null : label.copy();
4626        if (code != null) {
4627          dst.code = new ArrayList<Coding>();
4628          for (Coding i : code)
4629            dst.code.add(i.copy());
4630        };
4631        dst.slicing = slicing == null ? null : slicing.copy();
4632        dst.short_ = short_ == null ? null : short_.copy();
4633        dst.definition = definition == null ? null : definition.copy();
4634        dst.comments = comments == null ? null : comments.copy();
4635        dst.requirements = requirements == null ? null : requirements.copy();
4636        if (alias != null) {
4637          dst.alias = new ArrayList<StringType>();
4638          for (StringType i : alias)
4639            dst.alias.add(i.copy());
4640        };
4641        dst.min = min == null ? null : min.copy();
4642        dst.max = max == null ? null : max.copy();
4643        dst.base = base == null ? null : base.copy();
4644        if (type != null) {
4645          dst.type = new ArrayList<TypeRefComponent>();
4646          for (TypeRefComponent i : type)
4647            dst.type.add(i.copy());
4648        };
4649        dst.nameReference = nameReference == null ? null : nameReference.copy();
4650        dst.defaultValue = defaultValue == null ? null : defaultValue.copy();
4651        dst.meaningWhenMissing = meaningWhenMissing == null ? null : meaningWhenMissing.copy();
4652        dst.fixed = fixed == null ? null : fixed.copy();
4653        dst.pattern = pattern == null ? null : pattern.copy();
4654        dst.example = example == null ? null : example.copy();
4655        dst.minValue = minValue == null ? null : minValue.copy();
4656        dst.maxValue = maxValue == null ? null : maxValue.copy();
4657        dst.maxLength = maxLength == null ? null : maxLength.copy();
4658        if (condition != null) {
4659          dst.condition = new ArrayList<IdType>();
4660          for (IdType i : condition)
4661            dst.condition.add(i.copy());
4662        };
4663        if (constraint != null) {
4664          dst.constraint = new ArrayList<ElementDefinitionConstraintComponent>();
4665          for (ElementDefinitionConstraintComponent i : constraint)
4666            dst.constraint.add(i.copy());
4667        };
4668        dst.mustSupport = mustSupport == null ? null : mustSupport.copy();
4669        dst.isModifier = isModifier == null ? null : isModifier.copy();
4670        dst.isSummary = isSummary == null ? null : isSummary.copy();
4671        dst.binding = binding == null ? null : binding.copy();
4672        if (mapping != null) {
4673          dst.mapping = new ArrayList<ElementDefinitionMappingComponent>();
4674          for (ElementDefinitionMappingComponent i : mapping)
4675            dst.mapping.add(i.copy());
4676        };
4677        return dst;
4678      }
4679
4680      protected ElementDefinition typedCopy() {
4681        return copy();
4682      }
4683
4684      @Override
4685      public boolean equalsDeep(Base other) {
4686        if (!super.equalsDeep(other))
4687          return false;
4688        if (!(other instanceof ElementDefinition))
4689          return false;
4690        ElementDefinition o = (ElementDefinition) other;
4691        return compareDeep(path, o.path, true) && compareDeep(representation, o.representation, true) && compareDeep(name, o.name, true)
4692           && compareDeep(label, o.label, true) && compareDeep(code, o.code, true) && compareDeep(slicing, o.slicing, true)
4693           && compareDeep(short_, o.short_, true) && compareDeep(definition, o.definition, true) && compareDeep(comments, o.comments, true)
4694           && compareDeep(requirements, o.requirements, true) && compareDeep(alias, o.alias, true) && compareDeep(min, o.min, true)
4695           && compareDeep(max, o.max, true) && compareDeep(base, o.base, true) && compareDeep(type, o.type, true)
4696           && compareDeep(nameReference, o.nameReference, true) && compareDeep(defaultValue, o.defaultValue, true)
4697           && compareDeep(meaningWhenMissing, o.meaningWhenMissing, true) && compareDeep(fixed, o.fixed, true)
4698           && compareDeep(pattern, o.pattern, true) && compareDeep(example, o.example, true) && compareDeep(minValue, o.minValue, true)
4699           && compareDeep(maxValue, o.maxValue, true) && compareDeep(maxLength, o.maxLength, true) && compareDeep(condition, o.condition, true)
4700           && compareDeep(constraint, o.constraint, true) && compareDeep(mustSupport, o.mustSupport, true)
4701           && compareDeep(isModifier, o.isModifier, true) && compareDeep(isSummary, o.isSummary, true) && compareDeep(binding, o.binding, true)
4702           && compareDeep(mapping, o.mapping, true);
4703      }
4704
4705      @Override
4706      public boolean equalsShallow(Base other) {
4707        if (!super.equalsShallow(other))
4708          return false;
4709        if (!(other instanceof ElementDefinition))
4710          return false;
4711        ElementDefinition o = (ElementDefinition) other;
4712        return compareValues(path, o.path, true) && compareValues(representation, o.representation, true) && compareValues(name, o.name, true)
4713           && compareValues(label, o.label, true) && compareValues(short_, o.short_, true) && compareValues(definition, o.definition, true)
4714           && compareValues(comments, o.comments, true) && compareValues(requirements, o.requirements, true) && compareValues(alias, o.alias, true)
4715           && compareValues(min, o.min, true) && compareValues(max, o.max, true) && compareValues(nameReference, o.nameReference, true)
4716           && compareValues(meaningWhenMissing, o.meaningWhenMissing, true) && compareValues(maxLength, o.maxLength, true)
4717           && compareValues(condition, o.condition, true) && compareValues(mustSupport, o.mustSupport, true) && compareValues(isModifier, o.isModifier, true)
4718           && compareValues(isSummary, o.isSummary, true);
4719      }
4720
4721      public boolean isEmpty() {
4722        return super.isEmpty() && (path == null || path.isEmpty()) && (representation == null || representation.isEmpty())
4723           && (name == null || name.isEmpty()) && (label == null || label.isEmpty()) && (code == null || code.isEmpty())
4724           && (slicing == null || slicing.isEmpty()) && (short_ == null || short_.isEmpty()) && (definition == null || definition.isEmpty())
4725           && (comments == null || comments.isEmpty()) && (requirements == null || requirements.isEmpty())
4726           && (alias == null || alias.isEmpty()) && (min == null || min.isEmpty()) && (max == null || max.isEmpty())
4727           && (base == null || base.isEmpty()) && (type == null || type.isEmpty()) && (nameReference == null || nameReference.isEmpty())
4728           && (defaultValue == null || defaultValue.isEmpty()) && (meaningWhenMissing == null || meaningWhenMissing.isEmpty())
4729           && (fixed == null || fixed.isEmpty()) && (pattern == null || pattern.isEmpty()) && (example == null || example.isEmpty())
4730           && (minValue == null || minValue.isEmpty()) && (maxValue == null || maxValue.isEmpty()) && (maxLength == null || maxLength.isEmpty())
4731           && (condition == null || condition.isEmpty()) && (constraint == null || constraint.isEmpty())
4732           && (mustSupport == null || mustSupport.isEmpty()) && (isModifier == null || isModifier.isEmpty())
4733           && (isSummary == null || isSummary.isEmpty()) && (binding == null || binding.isEmpty()) && (mapping == null || mapping.isEmpty())
4734          ;
4735      }
4736
4737
4738}