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