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