001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.dstu3.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046/**
047 * A value set specifies a set of codes drawn from one or more code systems.
048 */
049@ResourceDef(name="ValueSet", profile="http://hl7.org/fhir/Profile/ValueSet")
050@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "immutable", "purpose", "copyright", "extensible", "compose", "expansion"})
051public class ValueSet extends MetadataResource {
052
053    public enum FilterOperator {
054        /**
055         * The specified property of the code equals the provided value.
056         */
057        EQUAL, 
058        /**
059         * Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, including the provided concept itself (i.e. include child codes)
060         */
061        ISA, 
062        /**
063         * Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, excluding the provided concept itself (i.e. include child codes)
064         */
065        DESCENDENTOF, 
066        /**
067         * The specified property of the code does not have an is-a relationship with the provided value.
068         */
069        ISNOTA, 
070        /**
071         * The specified property of the code  matches the regex specified in the provided value.
072         */
073        REGEX, 
074        /**
075         * The specified property of the code is in the set of codes or concepts specified in the provided value (comma separated list).
076         */
077        IN, 
078        /**
079         * The specified property of the code is not in the set of codes or concepts specified in the provided value (comma separated list).
080         */
081        NOTIN, 
082        /**
083         * Includes all concept ids that have a transitive is-a relationship from the concept Id provided as the value, including the provided concept itself (e.g. include parent codes)
084         */
085        GENERALIZES, 
086        /**
087         * The specified property of the code has at least one value (if the specified value is true; if the specified value is false, then matches when the specified property of the code has no values)
088         */
089        EXISTS, 
090        /**
091         * added to help the parsers with the generic types
092         */
093        NULL;
094        public static FilterOperator fromCode(String codeString) throws FHIRException {
095            if (codeString == null || "".equals(codeString))
096                return null;
097        if ("=".equals(codeString))
098          return EQUAL;
099        if ("is-a".equals(codeString))
100          return ISA;
101        if ("descendent-of".equals(codeString))
102          return DESCENDENTOF;
103        if ("is-not-a".equals(codeString))
104          return ISNOTA;
105        if ("regex".equals(codeString))
106          return REGEX;
107        if ("in".equals(codeString))
108          return IN;
109        if ("not-in".equals(codeString))
110          return NOTIN;
111        if ("generalizes".equals(codeString))
112          return GENERALIZES;
113        if ("exists".equals(codeString))
114          return EXISTS;
115        if (Configuration.isAcceptInvalidEnums())
116          return null;
117        else
118          throw new FHIRException("Unknown FilterOperator code '"+codeString+"'");
119        }
120        public String toCode() {
121          switch (this) {
122            case EQUAL: return "=";
123            case ISA: return "is-a";
124            case DESCENDENTOF: return "descendent-of";
125            case ISNOTA: return "is-not-a";
126            case REGEX: return "regex";
127            case IN: return "in";
128            case NOTIN: return "not-in";
129            case GENERALIZES: return "generalizes";
130            case EXISTS: return "exists";
131            default: return "?";
132          }
133        }
134        public String getSystem() {
135          switch (this) {
136            case EQUAL: return "http://hl7.org/fhir/filter-operator";
137            case ISA: return "http://hl7.org/fhir/filter-operator";
138            case DESCENDENTOF: return "http://hl7.org/fhir/filter-operator";
139            case ISNOTA: return "http://hl7.org/fhir/filter-operator";
140            case REGEX: return "http://hl7.org/fhir/filter-operator";
141            case IN: return "http://hl7.org/fhir/filter-operator";
142            case NOTIN: return "http://hl7.org/fhir/filter-operator";
143            case GENERALIZES: return "http://hl7.org/fhir/filter-operator";
144            case EXISTS: return "http://hl7.org/fhir/filter-operator";
145            default: return "?";
146          }
147        }
148        public String getDefinition() {
149          switch (this) {
150            case EQUAL: return "The specified property of the code equals the provided value.";
151            case ISA: return "Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, including the provided concept itself (i.e. include child codes)";
152            case DESCENDENTOF: return "Includes all concept ids that have a transitive is-a relationship with the concept Id provided as the value, excluding the provided concept itself (i.e. include child codes)";
153            case ISNOTA: return "The specified property of the code does not have an is-a relationship with the provided value.";
154            case REGEX: return "The specified property of the code  matches the regex specified in the provided value.";
155            case IN: return "The specified property of the code is in the set of codes or concepts specified in the provided value (comma separated list).";
156            case NOTIN: return "The specified property of the code is not in the set of codes or concepts specified in the provided value (comma separated list).";
157            case GENERALIZES: return "Includes all concept ids that have a transitive is-a relationship from the concept Id provided as the value, including the provided concept itself (e.g. include parent codes)";
158            case EXISTS: return "The specified property of the code has at least one value (if the specified value is true; if the specified value is false, then matches when the specified property of the code has no values)";
159            default: return "?";
160          }
161        }
162        public String getDisplay() {
163          switch (this) {
164            case EQUAL: return "Equals";
165            case ISA: return "Is A (by subsumption)";
166            case DESCENDENTOF: return "Descendent Of (by subsumption)";
167            case ISNOTA: return "Not (Is A) (by subsumption)";
168            case REGEX: return "Regular Expression";
169            case IN: return "In Set";
170            case NOTIN: return "Not in Set";
171            case GENERALIZES: return "Generalizes (by Subsumption)";
172            case EXISTS: return "Exists";
173            default: return "?";
174          }
175        }
176    }
177
178  public static class FilterOperatorEnumFactory implements EnumFactory<FilterOperator> {
179    public FilterOperator fromCode(String codeString) throws IllegalArgumentException {
180      if (codeString == null || "".equals(codeString))
181            if (codeString == null || "".equals(codeString))
182                return null;
183        if ("=".equals(codeString))
184          return FilterOperator.EQUAL;
185        if ("is-a".equals(codeString))
186          return FilterOperator.ISA;
187        if ("descendent-of".equals(codeString))
188          return FilterOperator.DESCENDENTOF;
189        if ("is-not-a".equals(codeString))
190          return FilterOperator.ISNOTA;
191        if ("regex".equals(codeString))
192          return FilterOperator.REGEX;
193        if ("in".equals(codeString))
194          return FilterOperator.IN;
195        if ("not-in".equals(codeString))
196          return FilterOperator.NOTIN;
197        if ("generalizes".equals(codeString))
198          return FilterOperator.GENERALIZES;
199        if ("exists".equals(codeString))
200          return FilterOperator.EXISTS;
201        throw new IllegalArgumentException("Unknown FilterOperator code '"+codeString+"'");
202        }
203        public Enumeration<FilterOperator> fromType(Base code) throws FHIRException {
204          if (code == null)
205            return null;
206          if (code.isEmpty())
207            return new Enumeration<FilterOperator>(this);
208          String codeString = ((PrimitiveType) code).asStringValue();
209          if (codeString == null || "".equals(codeString))
210            return null;
211        if ("=".equals(codeString))
212          return new Enumeration<FilterOperator>(this, FilterOperator.EQUAL);
213        if ("is-a".equals(codeString))
214          return new Enumeration<FilterOperator>(this, FilterOperator.ISA);
215        if ("descendent-of".equals(codeString))
216          return new Enumeration<FilterOperator>(this, FilterOperator.DESCENDENTOF);
217        if ("is-not-a".equals(codeString))
218          return new Enumeration<FilterOperator>(this, FilterOperator.ISNOTA);
219        if ("regex".equals(codeString))
220          return new Enumeration<FilterOperator>(this, FilterOperator.REGEX);
221        if ("in".equals(codeString))
222          return new Enumeration<FilterOperator>(this, FilterOperator.IN);
223        if ("not-in".equals(codeString))
224          return new Enumeration<FilterOperator>(this, FilterOperator.NOTIN);
225        if ("generalizes".equals(codeString))
226          return new Enumeration<FilterOperator>(this, FilterOperator.GENERALIZES);
227        if ("exists".equals(codeString))
228          return new Enumeration<FilterOperator>(this, FilterOperator.EXISTS);
229        throw new FHIRException("Unknown FilterOperator code '"+codeString+"'");
230        }
231    public String toCode(FilterOperator code) {
232      if (code == FilterOperator.EQUAL)
233        return "=";
234      if (code == FilterOperator.ISA)
235        return "is-a";
236      if (code == FilterOperator.DESCENDENTOF)
237        return "descendent-of";
238      if (code == FilterOperator.ISNOTA)
239        return "is-not-a";
240      if (code == FilterOperator.REGEX)
241        return "regex";
242      if (code == FilterOperator.IN)
243        return "in";
244      if (code == FilterOperator.NOTIN)
245        return "not-in";
246      if (code == FilterOperator.GENERALIZES)
247        return "generalizes";
248      if (code == FilterOperator.EXISTS)
249        return "exists";
250      return "?";
251      }
252    public String toSystem(FilterOperator code) {
253      return code.getSystem();
254      }
255    }
256
257    @Block()
258    public static class ValueSetComposeComponent extends BackboneElement implements IBaseBackboneElement {
259        /**
260         * If a locked date is defined, then the Content Logical Definition must be evaluated using the current version as of the locked date for referenced code system(s) and value set instances where ValueSet.compose.include.version is not defined.
261         */
262        @Child(name = "lockedDate", type = {DateType.class}, order=1, min=0, max=1, modifier=false, summary=true)
263        @Description(shortDefinition="Fixed date for version-less references (transitive)", formalDefinition="If a locked date is defined, then the Content Logical Definition must be evaluated using the current version as of the locked date for referenced code system(s) and value set instances where ValueSet.compose.include.version is not defined." )
264        protected DateType lockedDate;
265
266        /**
267         * Whether inactive codes - codes that are not approved for current use - are in the value set. If inactive = true, inactive codes are to be included in the expansion, if inactive = false, the inactive codes will not be included in the expansion. If absent, the behavior is determined by the implementation, or by the applicable ExpansionProfile (but generally, inactive codes would be expected to be included).
268         */
269        @Child(name = "inactive", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=true)
270        @Description(shortDefinition="Whether inactive codes are in the value set", formalDefinition="Whether inactive codes - codes that are not approved for current use - are in the value set. If inactive = true, inactive codes are to be included in the expansion, if inactive = false, the inactive codes will not be included in the expansion. If absent, the behavior is determined by the implementation, or by the applicable ExpansionProfile (but generally, inactive codes would be expected to be included)." )
271        protected BooleanType inactive;
272
273        /**
274         * Include one or more codes from a code system or other value set(s).
275         */
276        @Child(name = "include", type = {}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
277        @Description(shortDefinition="Include one or more codes from a code system or other value set(s)", formalDefinition="Include one or more codes from a code system or other value set(s)." )
278        protected List<ConceptSetComponent> include;
279
280        /**
281         * Exclude one or more codes from the value set based on code system filters and/or other value sets.
282         */
283        @Child(name = "exclude", type = {ConceptSetComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
284        @Description(shortDefinition="Explicitly exclude codes from a code system or other value sets", formalDefinition="Exclude one or more codes from the value set based on code system filters and/or other value sets." )
285        protected List<ConceptSetComponent> exclude;
286
287        private static final long serialVersionUID = -765941757L;
288
289    /**
290     * Constructor
291     */
292      public ValueSetComposeComponent() {
293        super();
294      }
295
296        /**
297         * @return {@link #lockedDate} (If a locked date is defined, then the Content Logical Definition must be evaluated using the current version as of the locked date for referenced code system(s) and value set instances where ValueSet.compose.include.version is not defined.). This is the underlying object with id, value and extensions. The accessor "getLockedDate" gives direct access to the value
298         */
299        public DateType getLockedDateElement() { 
300          if (this.lockedDate == null)
301            if (Configuration.errorOnAutoCreate())
302              throw new Error("Attempt to auto-create ValueSetComposeComponent.lockedDate");
303            else if (Configuration.doAutoCreate())
304              this.lockedDate = new DateType(); // bb
305          return this.lockedDate;
306        }
307
308        public boolean hasLockedDateElement() { 
309          return this.lockedDate != null && !this.lockedDate.isEmpty();
310        }
311
312        public boolean hasLockedDate() { 
313          return this.lockedDate != null && !this.lockedDate.isEmpty();
314        }
315
316        /**
317         * @param value {@link #lockedDate} (If a locked date is defined, then the Content Logical Definition must be evaluated using the current version as of the locked date for referenced code system(s) and value set instances where ValueSet.compose.include.version is not defined.). This is the underlying object with id, value and extensions. The accessor "getLockedDate" gives direct access to the value
318         */
319        public ValueSetComposeComponent setLockedDateElement(DateType value) { 
320          this.lockedDate = value;
321          return this;
322        }
323
324        /**
325         * @return If a locked date is defined, then the Content Logical Definition must be evaluated using the current version as of the locked date for referenced code system(s) and value set instances where ValueSet.compose.include.version is not defined.
326         */
327        public Date getLockedDate() { 
328          return this.lockedDate == null ? null : this.lockedDate.getValue();
329        }
330
331        /**
332         * @param value If a locked date is defined, then the Content Logical Definition must be evaluated using the current version as of the locked date for referenced code system(s) and value set instances where ValueSet.compose.include.version is not defined.
333         */
334        public ValueSetComposeComponent setLockedDate(Date value) { 
335          if (value == null)
336            this.lockedDate = null;
337          else {
338            if (this.lockedDate == null)
339              this.lockedDate = new DateType();
340            this.lockedDate.setValue(value);
341          }
342          return this;
343        }
344
345        /**
346         * @return {@link #inactive} (Whether inactive codes - codes that are not approved for current use - are in the value set. If inactive = true, inactive codes are to be included in the expansion, if inactive = false, the inactive codes will not be included in the expansion. If absent, the behavior is determined by the implementation, or by the applicable ExpansionProfile (but generally, inactive codes would be expected to be included).). This is the underlying object with id, value and extensions. The accessor "getInactive" gives direct access to the value
347         */
348        public BooleanType getInactiveElement() { 
349          if (this.inactive == null)
350            if (Configuration.errorOnAutoCreate())
351              throw new Error("Attempt to auto-create ValueSetComposeComponent.inactive");
352            else if (Configuration.doAutoCreate())
353              this.inactive = new BooleanType(); // bb
354          return this.inactive;
355        }
356
357        public boolean hasInactiveElement() { 
358          return this.inactive != null && !this.inactive.isEmpty();
359        }
360
361        public boolean hasInactive() { 
362          return this.inactive != null && !this.inactive.isEmpty();
363        }
364
365        /**
366         * @param value {@link #inactive} (Whether inactive codes - codes that are not approved for current use - are in the value set. If inactive = true, inactive codes are to be included in the expansion, if inactive = false, the inactive codes will not be included in the expansion. If absent, the behavior is determined by the implementation, or by the applicable ExpansionProfile (but generally, inactive codes would be expected to be included).). This is the underlying object with id, value and extensions. The accessor "getInactive" gives direct access to the value
367         */
368        public ValueSetComposeComponent setInactiveElement(BooleanType value) { 
369          this.inactive = value;
370          return this;
371        }
372
373        /**
374         * @return Whether inactive codes - codes that are not approved for current use - are in the value set. If inactive = true, inactive codes are to be included in the expansion, if inactive = false, the inactive codes will not be included in the expansion. If absent, the behavior is determined by the implementation, or by the applicable ExpansionProfile (but generally, inactive codes would be expected to be included).
375         */
376        public boolean getInactive() { 
377          return this.inactive == null || this.inactive.isEmpty() ? false : this.inactive.getValue();
378        }
379
380        /**
381         * @param value Whether inactive codes - codes that are not approved for current use - are in the value set. If inactive = true, inactive codes are to be included in the expansion, if inactive = false, the inactive codes will not be included in the expansion. If absent, the behavior is determined by the implementation, or by the applicable ExpansionProfile (but generally, inactive codes would be expected to be included).
382         */
383        public ValueSetComposeComponent setInactive(boolean value) { 
384            if (this.inactive == null)
385              this.inactive = new BooleanType();
386            this.inactive.setValue(value);
387          return this;
388        }
389
390        /**
391         * @return {@link #include} (Include one or more codes from a code system or other value set(s).)
392         */
393        public List<ConceptSetComponent> getInclude() { 
394          if (this.include == null)
395            this.include = new ArrayList<ConceptSetComponent>();
396          return this.include;
397        }
398
399        /**
400         * @return Returns a reference to <code>this</code> for easy method chaining
401         */
402        public ValueSetComposeComponent setInclude(List<ConceptSetComponent> theInclude) { 
403          this.include = theInclude;
404          return this;
405        }
406
407        public boolean hasInclude() { 
408          if (this.include == null)
409            return false;
410          for (ConceptSetComponent item : this.include)
411            if (!item.isEmpty())
412              return true;
413          return false;
414        }
415
416        public ConceptSetComponent addInclude() { //3
417          ConceptSetComponent t = new ConceptSetComponent();
418          if (this.include == null)
419            this.include = new ArrayList<ConceptSetComponent>();
420          this.include.add(t);
421          return t;
422        }
423
424        public ValueSetComposeComponent addInclude(ConceptSetComponent t) { //3
425          if (t == null)
426            return this;
427          if (this.include == null)
428            this.include = new ArrayList<ConceptSetComponent>();
429          this.include.add(t);
430          return this;
431        }
432
433        /**
434         * @return The first repetition of repeating field {@link #include}, creating it if it does not already exist
435         */
436        public ConceptSetComponent getIncludeFirstRep() { 
437          if (getInclude().isEmpty()) {
438            addInclude();
439          }
440          return getInclude().get(0);
441        }
442
443        /**
444         * @return {@link #exclude} (Exclude one or more codes from the value set based on code system filters and/or other value sets.)
445         */
446        public List<ConceptSetComponent> getExclude() { 
447          if (this.exclude == null)
448            this.exclude = new ArrayList<ConceptSetComponent>();
449          return this.exclude;
450        }
451
452        /**
453         * @return Returns a reference to <code>this</code> for easy method chaining
454         */
455        public ValueSetComposeComponent setExclude(List<ConceptSetComponent> theExclude) { 
456          this.exclude = theExclude;
457          return this;
458        }
459
460        public boolean hasExclude() { 
461          if (this.exclude == null)
462            return false;
463          for (ConceptSetComponent item : this.exclude)
464            if (!item.isEmpty())
465              return true;
466          return false;
467        }
468
469        public ConceptSetComponent addExclude() { //3
470          ConceptSetComponent t = new ConceptSetComponent();
471          if (this.exclude == null)
472            this.exclude = new ArrayList<ConceptSetComponent>();
473          this.exclude.add(t);
474          return t;
475        }
476
477        public ValueSetComposeComponent addExclude(ConceptSetComponent t) { //3
478          if (t == null)
479            return this;
480          if (this.exclude == null)
481            this.exclude = new ArrayList<ConceptSetComponent>();
482          this.exclude.add(t);
483          return this;
484        }
485
486        /**
487         * @return The first repetition of repeating field {@link #exclude}, creating it if it does not already exist
488         */
489        public ConceptSetComponent getExcludeFirstRep() { 
490          if (getExclude().isEmpty()) {
491            addExclude();
492          }
493          return getExclude().get(0);
494        }
495
496        protected void listChildren(List<Property> childrenList) {
497          super.listChildren(childrenList);
498          childrenList.add(new Property("lockedDate", "date", "If a locked date is defined, then the Content Logical Definition must be evaluated using the current version as of the locked date for referenced code system(s) and value set instances where ValueSet.compose.include.version is not defined.", 0, java.lang.Integer.MAX_VALUE, lockedDate));
499          childrenList.add(new Property("inactive", "boolean", "Whether inactive codes - codes that are not approved for current use - are in the value set. If inactive = true, inactive codes are to be included in the expansion, if inactive = false, the inactive codes will not be included in the expansion. If absent, the behavior is determined by the implementation, or by the applicable ExpansionProfile (but generally, inactive codes would be expected to be included).", 0, java.lang.Integer.MAX_VALUE, inactive));
500          childrenList.add(new Property("include", "", "Include one or more codes from a code system or other value set(s).", 0, java.lang.Integer.MAX_VALUE, include));
501          childrenList.add(new Property("exclude", "@ValueSet.compose.include", "Exclude one or more codes from the value set based on code system filters and/or other value sets.", 0, java.lang.Integer.MAX_VALUE, exclude));
502        }
503
504      @Override
505      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
506        switch (hash) {
507        case 1391591896: /*lockedDate*/ return this.lockedDate == null ? new Base[0] : new Base[] {this.lockedDate}; // DateType
508        case 24665195: /*inactive*/ return this.inactive == null ? new Base[0] : new Base[] {this.inactive}; // BooleanType
509        case 1942574248: /*include*/ return this.include == null ? new Base[0] : this.include.toArray(new Base[this.include.size()]); // ConceptSetComponent
510        case -1321148966: /*exclude*/ return this.exclude == null ? new Base[0] : this.exclude.toArray(new Base[this.exclude.size()]); // ConceptSetComponent
511        default: return super.getProperty(hash, name, checkValid);
512        }
513
514      }
515
516      @Override
517      public Base setProperty(int hash, String name, Base value) throws FHIRException {
518        switch (hash) {
519        case 1391591896: // lockedDate
520          this.lockedDate = castToDate(value); // DateType
521          return value;
522        case 24665195: // inactive
523          this.inactive = castToBoolean(value); // BooleanType
524          return value;
525        case 1942574248: // include
526          this.getInclude().add((ConceptSetComponent) value); // ConceptSetComponent
527          return value;
528        case -1321148966: // exclude
529          this.getExclude().add((ConceptSetComponent) value); // ConceptSetComponent
530          return value;
531        default: return super.setProperty(hash, name, value);
532        }
533
534      }
535
536      @Override
537      public Base setProperty(String name, Base value) throws FHIRException {
538        if (name.equals("lockedDate")) {
539          this.lockedDate = castToDate(value); // DateType
540        } else if (name.equals("inactive")) {
541          this.inactive = castToBoolean(value); // BooleanType
542        } else if (name.equals("include")) {
543          this.getInclude().add((ConceptSetComponent) value);
544        } else if (name.equals("exclude")) {
545          this.getExclude().add((ConceptSetComponent) value);
546        } else
547          return super.setProperty(name, value);
548        return value;
549      }
550
551      @Override
552      public Base makeProperty(int hash, String name) throws FHIRException {
553        switch (hash) {
554        case 1391591896:  return getLockedDateElement();
555        case 24665195:  return getInactiveElement();
556        case 1942574248:  return addInclude(); 
557        case -1321148966:  return addExclude(); 
558        default: return super.makeProperty(hash, name);
559        }
560
561      }
562
563      @Override
564      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
565        switch (hash) {
566        case 1391591896: /*lockedDate*/ return new String[] {"date"};
567        case 24665195: /*inactive*/ return new String[] {"boolean"};
568        case 1942574248: /*include*/ return new String[] {};
569        case -1321148966: /*exclude*/ return new String[] {"@ValueSet.compose.include"};
570        default: return super.getTypesForProperty(hash, name);
571        }
572
573      }
574
575      @Override
576      public Base addChild(String name) throws FHIRException {
577        if (name.equals("lockedDate")) {
578          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.lockedDate");
579        }
580        else if (name.equals("inactive")) {
581          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.inactive");
582        }
583        else if (name.equals("include")) {
584          return addInclude();
585        }
586        else if (name.equals("exclude")) {
587          return addExclude();
588        }
589        else
590          return super.addChild(name);
591      }
592
593      public ValueSetComposeComponent copy() {
594        ValueSetComposeComponent dst = new ValueSetComposeComponent();
595        copyValues(dst);
596        dst.lockedDate = lockedDate == null ? null : lockedDate.copy();
597        dst.inactive = inactive == null ? null : inactive.copy();
598        if (include != null) {
599          dst.include = new ArrayList<ConceptSetComponent>();
600          for (ConceptSetComponent i : include)
601            dst.include.add(i.copy());
602        };
603        if (exclude != null) {
604          dst.exclude = new ArrayList<ConceptSetComponent>();
605          for (ConceptSetComponent i : exclude)
606            dst.exclude.add(i.copy());
607        };
608        return dst;
609      }
610
611      @Override
612      public boolean equalsDeep(Base other) {
613        if (!super.equalsDeep(other))
614          return false;
615        if (!(other instanceof ValueSetComposeComponent))
616          return false;
617        ValueSetComposeComponent o = (ValueSetComposeComponent) other;
618        return compareDeep(lockedDate, o.lockedDate, true) && compareDeep(inactive, o.inactive, true) && compareDeep(include, o.include, true)
619           && compareDeep(exclude, o.exclude, true);
620      }
621
622      @Override
623      public boolean equalsShallow(Base other) {
624        if (!super.equalsShallow(other))
625          return false;
626        if (!(other instanceof ValueSetComposeComponent))
627          return false;
628        ValueSetComposeComponent o = (ValueSetComposeComponent) other;
629        return compareValues(lockedDate, o.lockedDate, true) && compareValues(inactive, o.inactive, true);
630      }
631
632      public boolean isEmpty() {
633        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(lockedDate, inactive, include
634          , exclude);
635      }
636
637  public String fhirType() {
638    return "ValueSet.compose";
639
640  }
641
642  }
643
644    @Block()
645    public static class ConceptSetComponent extends BackboneElement implements IBaseBackboneElement {
646        /**
647         * An absolute URI which is the code system from which the selected codes come from.
648         */
649        @Child(name = "system", type = {UriType.class}, order=1, min=0, max=1, modifier=false, summary=true)
650        @Description(shortDefinition="The system the codes come from", formalDefinition="An absolute URI which is the code system from which the selected codes come from." )
651        protected UriType system;
652
653        /**
654         * The version of the code system that the codes are selected from.
655         */
656        @Child(name = "version", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
657        @Description(shortDefinition="Specific version of the code system referred to", formalDefinition="The version of the code system that the codes are selected from." )
658        protected StringType version;
659
660        /**
661         * Specifies a concept to be included or excluded.
662         */
663        @Child(name = "concept", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
664        @Description(shortDefinition="A concept defined in the system", formalDefinition="Specifies a concept to be included or excluded." )
665        protected List<ConceptReferenceComponent> concept;
666
667        /**
668         * Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true.
669         */
670        @Child(name = "filter", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=true)
671        @Description(shortDefinition="Select codes/concepts by their properties (including relationships)", formalDefinition="Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true." )
672        protected List<ConceptSetFilterComponent> filter;
673
674        /**
675         * Selects concepts found in this value set. This is an absolute URI that is a reference to ValueSet.url.
676         */
677        @Child(name = "valueSet", type = {UriType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
678        @Description(shortDefinition="Select only contents included in this value set", formalDefinition="Selects concepts found in this value set. This is an absolute URI that is a reference to ValueSet.url." )
679        protected List<UriType> valueSet;
680
681        private static final long serialVersionUID = -1322183438L;
682
683    /**
684     * Constructor
685     */
686      public ConceptSetComponent() {
687        super();
688      }
689
690        /**
691         * @return {@link #system} (An absolute URI which is the code system from which the selected codes come from.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
692         */
693        public UriType getSystemElement() { 
694          if (this.system == null)
695            if (Configuration.errorOnAutoCreate())
696              throw new Error("Attempt to auto-create ConceptSetComponent.system");
697            else if (Configuration.doAutoCreate())
698              this.system = new UriType(); // bb
699          return this.system;
700        }
701
702        public boolean hasSystemElement() { 
703          return this.system != null && !this.system.isEmpty();
704        }
705
706        public boolean hasSystem() { 
707          return this.system != null && !this.system.isEmpty();
708        }
709
710        /**
711         * @param value {@link #system} (An absolute URI which is the code system from which the selected codes come from.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
712         */
713        public ConceptSetComponent setSystemElement(UriType value) { 
714          this.system = value;
715          return this;
716        }
717
718        /**
719         * @return An absolute URI which is the code system from which the selected codes come from.
720         */
721        public String getSystem() { 
722          return this.system == null ? null : this.system.getValue();
723        }
724
725        /**
726         * @param value An absolute URI which is the code system from which the selected codes come from.
727         */
728        public ConceptSetComponent setSystem(String value) { 
729          if (Utilities.noString(value))
730            this.system = null;
731          else {
732            if (this.system == null)
733              this.system = new UriType();
734            this.system.setValue(value);
735          }
736          return this;
737        }
738
739        /**
740         * @return {@link #version} (The version of the code system that the codes are selected from.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
741         */
742        public StringType getVersionElement() { 
743          if (this.version == null)
744            if (Configuration.errorOnAutoCreate())
745              throw new Error("Attempt to auto-create ConceptSetComponent.version");
746            else if (Configuration.doAutoCreate())
747              this.version = new StringType(); // bb
748          return this.version;
749        }
750
751        public boolean hasVersionElement() { 
752          return this.version != null && !this.version.isEmpty();
753        }
754
755        public boolean hasVersion() { 
756          return this.version != null && !this.version.isEmpty();
757        }
758
759        /**
760         * @param value {@link #version} (The version of the code system that the codes are selected from.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
761         */
762        public ConceptSetComponent setVersionElement(StringType value) { 
763          this.version = value;
764          return this;
765        }
766
767        /**
768         * @return The version of the code system that the codes are selected from.
769         */
770        public String getVersion() { 
771          return this.version == null ? null : this.version.getValue();
772        }
773
774        /**
775         * @param value The version of the code system that the codes are selected from.
776         */
777        public ConceptSetComponent setVersion(String value) { 
778          if (Utilities.noString(value))
779            this.version = null;
780          else {
781            if (this.version == null)
782              this.version = new StringType();
783            this.version.setValue(value);
784          }
785          return this;
786        }
787
788        /**
789         * @return {@link #concept} (Specifies a concept to be included or excluded.)
790         */
791        public List<ConceptReferenceComponent> getConcept() { 
792          if (this.concept == null)
793            this.concept = new ArrayList<ConceptReferenceComponent>();
794          return this.concept;
795        }
796
797        /**
798         * @return Returns a reference to <code>this</code> for easy method chaining
799         */
800        public ConceptSetComponent setConcept(List<ConceptReferenceComponent> theConcept) { 
801          this.concept = theConcept;
802          return this;
803        }
804
805        public boolean hasConcept() { 
806          if (this.concept == null)
807            return false;
808          for (ConceptReferenceComponent item : this.concept)
809            if (!item.isEmpty())
810              return true;
811          return false;
812        }
813
814        public ConceptReferenceComponent addConcept() { //3
815          ConceptReferenceComponent t = new ConceptReferenceComponent();
816          if (this.concept == null)
817            this.concept = new ArrayList<ConceptReferenceComponent>();
818          this.concept.add(t);
819          return t;
820        }
821
822        public ConceptSetComponent addConcept(ConceptReferenceComponent t) { //3
823          if (t == null)
824            return this;
825          if (this.concept == null)
826            this.concept = new ArrayList<ConceptReferenceComponent>();
827          this.concept.add(t);
828          return this;
829        }
830
831        /**
832         * @return The first repetition of repeating field {@link #concept}, creating it if it does not already exist
833         */
834        public ConceptReferenceComponent getConceptFirstRep() { 
835          if (getConcept().isEmpty()) {
836            addConcept();
837          }
838          return getConcept().get(0);
839        }
840
841        /**
842         * @return {@link #filter} (Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true.)
843         */
844        public List<ConceptSetFilterComponent> getFilter() { 
845          if (this.filter == null)
846            this.filter = new ArrayList<ConceptSetFilterComponent>();
847          return this.filter;
848        }
849
850        /**
851         * @return Returns a reference to <code>this</code> for easy method chaining
852         */
853        public ConceptSetComponent setFilter(List<ConceptSetFilterComponent> theFilter) { 
854          this.filter = theFilter;
855          return this;
856        }
857
858        public boolean hasFilter() { 
859          if (this.filter == null)
860            return false;
861          for (ConceptSetFilterComponent item : this.filter)
862            if (!item.isEmpty())
863              return true;
864          return false;
865        }
866
867        public ConceptSetFilterComponent addFilter() { //3
868          ConceptSetFilterComponent t = new ConceptSetFilterComponent();
869          if (this.filter == null)
870            this.filter = new ArrayList<ConceptSetFilterComponent>();
871          this.filter.add(t);
872          return t;
873        }
874
875        public ConceptSetComponent addFilter(ConceptSetFilterComponent t) { //3
876          if (t == null)
877            return this;
878          if (this.filter == null)
879            this.filter = new ArrayList<ConceptSetFilterComponent>();
880          this.filter.add(t);
881          return this;
882        }
883
884        /**
885         * @return The first repetition of repeating field {@link #filter}, creating it if it does not already exist
886         */
887        public ConceptSetFilterComponent getFilterFirstRep() { 
888          if (getFilter().isEmpty()) {
889            addFilter();
890          }
891          return getFilter().get(0);
892        }
893
894        /**
895         * @return {@link #valueSet} (Selects concepts found in this value set. This is an absolute URI that is a reference to ValueSet.url.)
896         */
897        public List<UriType> getValueSet() { 
898          if (this.valueSet == null)
899            this.valueSet = new ArrayList<UriType>();
900          return this.valueSet;
901        }
902
903        /**
904         * @return Returns a reference to <code>this</code> for easy method chaining
905         */
906        public ConceptSetComponent setValueSet(List<UriType> theValueSet) { 
907          this.valueSet = theValueSet;
908          return this;
909        }
910
911        public boolean hasValueSet() { 
912          if (this.valueSet == null)
913            return false;
914          for (UriType item : this.valueSet)
915            if (!item.isEmpty())
916              return true;
917          return false;
918        }
919
920        /**
921         * @return {@link #valueSet} (Selects concepts found in this value set. This is an absolute URI that is a reference to ValueSet.url.)
922         */
923        public UriType addValueSetElement() {//2 
924          UriType t = new UriType();
925          if (this.valueSet == null)
926            this.valueSet = new ArrayList<UriType>();
927          this.valueSet.add(t);
928          return t;
929        }
930
931        /**
932         * @param value {@link #valueSet} (Selects concepts found in this value set. This is an absolute URI that is a reference to ValueSet.url.)
933         */
934        public ConceptSetComponent addValueSet(String value) { //1
935          UriType t = new UriType();
936          t.setValue(value);
937          if (this.valueSet == null)
938            this.valueSet = new ArrayList<UriType>();
939          this.valueSet.add(t);
940          return this;
941        }
942
943        /**
944         * @param value {@link #valueSet} (Selects concepts found in this value set. This is an absolute URI that is a reference to ValueSet.url.)
945         */
946        public boolean hasValueSet(String value) { 
947          if (this.valueSet == null)
948            return false;
949          for (UriType v : this.valueSet)
950            if (v.equals(value)) // uri
951              return true;
952          return false;
953        }
954
955        protected void listChildren(List<Property> childrenList) {
956          super.listChildren(childrenList);
957          childrenList.add(new Property("system", "uri", "An absolute URI which is the code system from which the selected codes come from.", 0, java.lang.Integer.MAX_VALUE, system));
958          childrenList.add(new Property("version", "string", "The version of the code system that the codes are selected from.", 0, java.lang.Integer.MAX_VALUE, version));
959          childrenList.add(new Property("concept", "", "Specifies a concept to be included or excluded.", 0, java.lang.Integer.MAX_VALUE, concept));
960          childrenList.add(new Property("filter", "", "Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true.", 0, java.lang.Integer.MAX_VALUE, filter));
961          childrenList.add(new Property("valueSet", "uri", "Selects concepts found in this value set. This is an absolute URI that is a reference to ValueSet.url.", 0, java.lang.Integer.MAX_VALUE, valueSet));
962        }
963
964      @Override
965      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
966        switch (hash) {
967        case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // UriType
968        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
969        case 951024232: /*concept*/ return this.concept == null ? new Base[0] : this.concept.toArray(new Base[this.concept.size()]); // ConceptReferenceComponent
970        case -1274492040: /*filter*/ return this.filter == null ? new Base[0] : this.filter.toArray(new Base[this.filter.size()]); // ConceptSetFilterComponent
971        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : this.valueSet.toArray(new Base[this.valueSet.size()]); // UriType
972        default: return super.getProperty(hash, name, checkValid);
973        }
974
975      }
976
977      @Override
978      public Base setProperty(int hash, String name, Base value) throws FHIRException {
979        switch (hash) {
980        case -887328209: // system
981          this.system = castToUri(value); // UriType
982          return value;
983        case 351608024: // version
984          this.version = castToString(value); // StringType
985          return value;
986        case 951024232: // concept
987          this.getConcept().add((ConceptReferenceComponent) value); // ConceptReferenceComponent
988          return value;
989        case -1274492040: // filter
990          this.getFilter().add((ConceptSetFilterComponent) value); // ConceptSetFilterComponent
991          return value;
992        case -1410174671: // valueSet
993          this.getValueSet().add(castToUri(value)); // UriType
994          return value;
995        default: return super.setProperty(hash, name, value);
996        }
997
998      }
999
1000      @Override
1001      public Base setProperty(String name, Base value) throws FHIRException {
1002        if (name.equals("system")) {
1003          this.system = castToUri(value); // UriType
1004        } else if (name.equals("version")) {
1005          this.version = castToString(value); // StringType
1006        } else if (name.equals("concept")) {
1007          this.getConcept().add((ConceptReferenceComponent) value);
1008        } else if (name.equals("filter")) {
1009          this.getFilter().add((ConceptSetFilterComponent) value);
1010        } else if (name.equals("valueSet")) {
1011          this.getValueSet().add(castToUri(value));
1012        } else
1013          return super.setProperty(name, value);
1014        return value;
1015      }
1016
1017      @Override
1018      public Base makeProperty(int hash, String name) throws FHIRException {
1019        switch (hash) {
1020        case -887328209:  return getSystemElement();
1021        case 351608024:  return getVersionElement();
1022        case 951024232:  return addConcept(); 
1023        case -1274492040:  return addFilter(); 
1024        case -1410174671:  return addValueSetElement();
1025        default: return super.makeProperty(hash, name);
1026        }
1027
1028      }
1029
1030      @Override
1031      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1032        switch (hash) {
1033        case -887328209: /*system*/ return new String[] {"uri"};
1034        case 351608024: /*version*/ return new String[] {"string"};
1035        case 951024232: /*concept*/ return new String[] {};
1036        case -1274492040: /*filter*/ return new String[] {};
1037        case -1410174671: /*valueSet*/ return new String[] {"uri"};
1038        default: return super.getTypesForProperty(hash, name);
1039        }
1040
1041      }
1042
1043      @Override
1044      public Base addChild(String name) throws FHIRException {
1045        if (name.equals("system")) {
1046          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.system");
1047        }
1048        else if (name.equals("version")) {
1049          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.version");
1050        }
1051        else if (name.equals("concept")) {
1052          return addConcept();
1053        }
1054        else if (name.equals("filter")) {
1055          return addFilter();
1056        }
1057        else if (name.equals("valueSet")) {
1058          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.valueSet");
1059        }
1060        else
1061          return super.addChild(name);
1062      }
1063
1064      public ConceptSetComponent copy() {
1065        ConceptSetComponent dst = new ConceptSetComponent();
1066        copyValues(dst);
1067        dst.system = system == null ? null : system.copy();
1068        dst.version = version == null ? null : version.copy();
1069        if (concept != null) {
1070          dst.concept = new ArrayList<ConceptReferenceComponent>();
1071          for (ConceptReferenceComponent i : concept)
1072            dst.concept.add(i.copy());
1073        };
1074        if (filter != null) {
1075          dst.filter = new ArrayList<ConceptSetFilterComponent>();
1076          for (ConceptSetFilterComponent i : filter)
1077            dst.filter.add(i.copy());
1078        };
1079        if (valueSet != null) {
1080          dst.valueSet = new ArrayList<UriType>();
1081          for (UriType i : valueSet)
1082            dst.valueSet.add(i.copy());
1083        };
1084        return dst;
1085      }
1086
1087      @Override
1088      public boolean equalsDeep(Base other) {
1089        if (!super.equalsDeep(other))
1090          return false;
1091        if (!(other instanceof ConceptSetComponent))
1092          return false;
1093        ConceptSetComponent o = (ConceptSetComponent) other;
1094        return compareDeep(system, o.system, true) && compareDeep(version, o.version, true) && compareDeep(concept, o.concept, true)
1095           && compareDeep(filter, o.filter, true) && compareDeep(valueSet, o.valueSet, true);
1096      }
1097
1098      @Override
1099      public boolean equalsShallow(Base other) {
1100        if (!super.equalsShallow(other))
1101          return false;
1102        if (!(other instanceof ConceptSetComponent))
1103          return false;
1104        ConceptSetComponent o = (ConceptSetComponent) other;
1105        return compareValues(system, o.system, true) && compareValues(version, o.version, true) && compareValues(valueSet, o.valueSet, true)
1106          ;
1107      }
1108
1109      public boolean isEmpty() {
1110        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(system, version, concept
1111          , filter, valueSet);
1112      }
1113
1114  public String fhirType() {
1115    return "ValueSet.compose.include";
1116
1117  }
1118
1119  }
1120
1121    @Block()
1122    public static class ConceptReferenceComponent extends BackboneElement implements IBaseBackboneElement {
1123        /**
1124         * Specifies a code for the concept to be included or excluded.
1125         */
1126        @Child(name = "code", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1127        @Description(shortDefinition="Code or expression from system", formalDefinition="Specifies a code for the concept to be included or excluded." )
1128        protected CodeType code;
1129
1130        /**
1131         * The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system.
1132         */
1133        @Child(name = "display", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
1134        @Description(shortDefinition="Text to display for this code for this value set in this valueset", formalDefinition="The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system." )
1135        protected StringType display;
1136
1137        /**
1138         * Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc.
1139         */
1140        @Child(name = "designation", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1141        @Description(shortDefinition="Additional representations for this concept", formalDefinition="Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc." )
1142        protected List<ConceptReferenceDesignationComponent> designation;
1143
1144        private static final long serialVersionUID = 260579971L;
1145
1146    /**
1147     * Constructor
1148     */
1149      public ConceptReferenceComponent() {
1150        super();
1151      }
1152
1153    /**
1154     * Constructor
1155     */
1156      public ConceptReferenceComponent(CodeType code) {
1157        super();
1158        this.code = code;
1159      }
1160
1161        /**
1162         * @return {@link #code} (Specifies a code for the concept to be included or excluded.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1163         */
1164        public CodeType getCodeElement() { 
1165          if (this.code == null)
1166            if (Configuration.errorOnAutoCreate())
1167              throw new Error("Attempt to auto-create ConceptReferenceComponent.code");
1168            else if (Configuration.doAutoCreate())
1169              this.code = new CodeType(); // bb
1170          return this.code;
1171        }
1172
1173        public boolean hasCodeElement() { 
1174          return this.code != null && !this.code.isEmpty();
1175        }
1176
1177        public boolean hasCode() { 
1178          return this.code != null && !this.code.isEmpty();
1179        }
1180
1181        /**
1182         * @param value {@link #code} (Specifies a code for the concept to be included or excluded.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
1183         */
1184        public ConceptReferenceComponent setCodeElement(CodeType value) { 
1185          this.code = value;
1186          return this;
1187        }
1188
1189        /**
1190         * @return Specifies a code for the concept to be included or excluded.
1191         */
1192        public String getCode() { 
1193          return this.code == null ? null : this.code.getValue();
1194        }
1195
1196        /**
1197         * @param value Specifies a code for the concept to be included or excluded.
1198         */
1199        public ConceptReferenceComponent setCode(String value) { 
1200            if (this.code == null)
1201              this.code = new CodeType();
1202            this.code.setValue(value);
1203          return this;
1204        }
1205
1206        /**
1207         * @return {@link #display} (The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
1208         */
1209        public StringType getDisplayElement() { 
1210          if (this.display == null)
1211            if (Configuration.errorOnAutoCreate())
1212              throw new Error("Attempt to auto-create ConceptReferenceComponent.display");
1213            else if (Configuration.doAutoCreate())
1214              this.display = new StringType(); // bb
1215          return this.display;
1216        }
1217
1218        public boolean hasDisplayElement() { 
1219          return this.display != null && !this.display.isEmpty();
1220        }
1221
1222        public boolean hasDisplay() { 
1223          return this.display != null && !this.display.isEmpty();
1224        }
1225
1226        /**
1227         * @param value {@link #display} (The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
1228         */
1229        public ConceptReferenceComponent setDisplayElement(StringType value) { 
1230          this.display = value;
1231          return this;
1232        }
1233
1234        /**
1235         * @return The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system.
1236         */
1237        public String getDisplay() { 
1238          return this.display == null ? null : this.display.getValue();
1239        }
1240
1241        /**
1242         * @param value The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system.
1243         */
1244        public ConceptReferenceComponent setDisplay(String value) { 
1245          if (Utilities.noString(value))
1246            this.display = null;
1247          else {
1248            if (this.display == null)
1249              this.display = new StringType();
1250            this.display.setValue(value);
1251          }
1252          return this;
1253        }
1254
1255        /**
1256         * @return {@link #designation} (Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc.)
1257         */
1258        public List<ConceptReferenceDesignationComponent> getDesignation() { 
1259          if (this.designation == null)
1260            this.designation = new ArrayList<ConceptReferenceDesignationComponent>();
1261          return this.designation;
1262        }
1263
1264        /**
1265         * @return Returns a reference to <code>this</code> for easy method chaining
1266         */
1267        public ConceptReferenceComponent setDesignation(List<ConceptReferenceDesignationComponent> theDesignation) { 
1268          this.designation = theDesignation;
1269          return this;
1270        }
1271
1272        public boolean hasDesignation() { 
1273          if (this.designation == null)
1274            return false;
1275          for (ConceptReferenceDesignationComponent item : this.designation)
1276            if (!item.isEmpty())
1277              return true;
1278          return false;
1279        }
1280
1281        public ConceptReferenceDesignationComponent addDesignation() { //3
1282          ConceptReferenceDesignationComponent t = new ConceptReferenceDesignationComponent();
1283          if (this.designation == null)
1284            this.designation = new ArrayList<ConceptReferenceDesignationComponent>();
1285          this.designation.add(t);
1286          return t;
1287        }
1288
1289        public ConceptReferenceComponent addDesignation(ConceptReferenceDesignationComponent t) { //3
1290          if (t == null)
1291            return this;
1292          if (this.designation == null)
1293            this.designation = new ArrayList<ConceptReferenceDesignationComponent>();
1294          this.designation.add(t);
1295          return this;
1296        }
1297
1298        /**
1299         * @return The first repetition of repeating field {@link #designation}, creating it if it does not already exist
1300         */
1301        public ConceptReferenceDesignationComponent getDesignationFirstRep() { 
1302          if (getDesignation().isEmpty()) {
1303            addDesignation();
1304          }
1305          return getDesignation().get(0);
1306        }
1307
1308        protected void listChildren(List<Property> childrenList) {
1309          super.listChildren(childrenList);
1310          childrenList.add(new Property("code", "code", "Specifies a code for the concept to be included or excluded.", 0, java.lang.Integer.MAX_VALUE, code));
1311          childrenList.add(new Property("display", "string", "The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system.", 0, java.lang.Integer.MAX_VALUE, display));
1312          childrenList.add(new Property("designation", "", "Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc.", 0, java.lang.Integer.MAX_VALUE, designation));
1313        }
1314
1315      @Override
1316      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1317        switch (hash) {
1318        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeType
1319        case 1671764162: /*display*/ return this.display == null ? new Base[0] : new Base[] {this.display}; // StringType
1320        case -900931593: /*designation*/ return this.designation == null ? new Base[0] : this.designation.toArray(new Base[this.designation.size()]); // ConceptReferenceDesignationComponent
1321        default: return super.getProperty(hash, name, checkValid);
1322        }
1323
1324      }
1325
1326      @Override
1327      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1328        switch (hash) {
1329        case 3059181: // code
1330          this.code = castToCode(value); // CodeType
1331          return value;
1332        case 1671764162: // display
1333          this.display = castToString(value); // StringType
1334          return value;
1335        case -900931593: // designation
1336          this.getDesignation().add((ConceptReferenceDesignationComponent) value); // ConceptReferenceDesignationComponent
1337          return value;
1338        default: return super.setProperty(hash, name, value);
1339        }
1340
1341      }
1342
1343      @Override
1344      public Base setProperty(String name, Base value) throws FHIRException {
1345        if (name.equals("code")) {
1346          this.code = castToCode(value); // CodeType
1347        } else if (name.equals("display")) {
1348          this.display = castToString(value); // StringType
1349        } else if (name.equals("designation")) {
1350          this.getDesignation().add((ConceptReferenceDesignationComponent) value);
1351        } else
1352          return super.setProperty(name, value);
1353        return value;
1354      }
1355
1356      @Override
1357      public Base makeProperty(int hash, String name) throws FHIRException {
1358        switch (hash) {
1359        case 3059181:  return getCodeElement();
1360        case 1671764162:  return getDisplayElement();
1361        case -900931593:  return addDesignation(); 
1362        default: return super.makeProperty(hash, name);
1363        }
1364
1365      }
1366
1367      @Override
1368      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1369        switch (hash) {
1370        case 3059181: /*code*/ return new String[] {"code"};
1371        case 1671764162: /*display*/ return new String[] {"string"};
1372        case -900931593: /*designation*/ return new String[] {};
1373        default: return super.getTypesForProperty(hash, name);
1374        }
1375
1376      }
1377
1378      @Override
1379      public Base addChild(String name) throws FHIRException {
1380        if (name.equals("code")) {
1381          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.code");
1382        }
1383        else if (name.equals("display")) {
1384          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.display");
1385        }
1386        else if (name.equals("designation")) {
1387          return addDesignation();
1388        }
1389        else
1390          return super.addChild(name);
1391      }
1392
1393      public ConceptReferenceComponent copy() {
1394        ConceptReferenceComponent dst = new ConceptReferenceComponent();
1395        copyValues(dst);
1396        dst.code = code == null ? null : code.copy();
1397        dst.display = display == null ? null : display.copy();
1398        if (designation != null) {
1399          dst.designation = new ArrayList<ConceptReferenceDesignationComponent>();
1400          for (ConceptReferenceDesignationComponent i : designation)
1401            dst.designation.add(i.copy());
1402        };
1403        return dst;
1404      }
1405
1406      @Override
1407      public boolean equalsDeep(Base other) {
1408        if (!super.equalsDeep(other))
1409          return false;
1410        if (!(other instanceof ConceptReferenceComponent))
1411          return false;
1412        ConceptReferenceComponent o = (ConceptReferenceComponent) other;
1413        return compareDeep(code, o.code, true) && compareDeep(display, o.display, true) && compareDeep(designation, o.designation, true)
1414          ;
1415      }
1416
1417      @Override
1418      public boolean equalsShallow(Base other) {
1419        if (!super.equalsShallow(other))
1420          return false;
1421        if (!(other instanceof ConceptReferenceComponent))
1422          return false;
1423        ConceptReferenceComponent o = (ConceptReferenceComponent) other;
1424        return compareValues(code, o.code, true) && compareValues(display, o.display, true);
1425      }
1426
1427      public boolean isEmpty() {
1428        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, display, designation
1429          );
1430      }
1431
1432  public String fhirType() {
1433    return "ValueSet.compose.include.concept";
1434
1435  }
1436
1437  }
1438
1439    @Block()
1440    public static class ConceptReferenceDesignationComponent extends BackboneElement implements IBaseBackboneElement {
1441        /**
1442         * The language this designation is defined for.
1443         */
1444        @Child(name = "language", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
1445        @Description(shortDefinition="Human language of the designation", formalDefinition="The language this designation is defined for." )
1446        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
1447        protected CodeType language;
1448
1449        /**
1450         * A code that details how this designation would be used.
1451         */
1452        @Child(name = "use", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=false)
1453        @Description(shortDefinition="Details how this designation would be used", formalDefinition="A code that details how this designation would be used." )
1454        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/designation-use")
1455        protected Coding use;
1456
1457        /**
1458         * The text value for this designation.
1459         */
1460        @Child(name = "value", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=false)
1461        @Description(shortDefinition="The text value for this designation", formalDefinition="The text value for this designation." )
1462        protected StringType value;
1463
1464        private static final long serialVersionUID = 1515662414L;
1465
1466    /**
1467     * Constructor
1468     */
1469      public ConceptReferenceDesignationComponent() {
1470        super();
1471      }
1472
1473    /**
1474     * Constructor
1475     */
1476      public ConceptReferenceDesignationComponent(StringType value) {
1477        super();
1478        this.value = value;
1479      }
1480
1481        /**
1482         * @return {@link #language} (The language this designation is defined for.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value
1483         */
1484        public CodeType getLanguageElement() { 
1485          if (this.language == null)
1486            if (Configuration.errorOnAutoCreate())
1487              throw new Error("Attempt to auto-create ConceptReferenceDesignationComponent.language");
1488            else if (Configuration.doAutoCreate())
1489              this.language = new CodeType(); // bb
1490          return this.language;
1491        }
1492
1493        public boolean hasLanguageElement() { 
1494          return this.language != null && !this.language.isEmpty();
1495        }
1496
1497        public boolean hasLanguage() { 
1498          return this.language != null && !this.language.isEmpty();
1499        }
1500
1501        /**
1502         * @param value {@link #language} (The language this designation is defined for.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value
1503         */
1504        public ConceptReferenceDesignationComponent setLanguageElement(CodeType value) { 
1505          this.language = value;
1506          return this;
1507        }
1508
1509        /**
1510         * @return The language this designation is defined for.
1511         */
1512        public String getLanguage() { 
1513          return this.language == null ? null : this.language.getValue();
1514        }
1515
1516        /**
1517         * @param value The language this designation is defined for.
1518         */
1519        public ConceptReferenceDesignationComponent setLanguage(String value) { 
1520          if (Utilities.noString(value))
1521            this.language = null;
1522          else {
1523            if (this.language == null)
1524              this.language = new CodeType();
1525            this.language.setValue(value);
1526          }
1527          return this;
1528        }
1529
1530        /**
1531         * @return {@link #use} (A code that details how this designation would be used.)
1532         */
1533        public Coding getUse() { 
1534          if (this.use == null)
1535            if (Configuration.errorOnAutoCreate())
1536              throw new Error("Attempt to auto-create ConceptReferenceDesignationComponent.use");
1537            else if (Configuration.doAutoCreate())
1538              this.use = new Coding(); // cc
1539          return this.use;
1540        }
1541
1542        public boolean hasUse() { 
1543          return this.use != null && !this.use.isEmpty();
1544        }
1545
1546        /**
1547         * @param value {@link #use} (A code that details how this designation would be used.)
1548         */
1549        public ConceptReferenceDesignationComponent setUse(Coding value) { 
1550          this.use = value;
1551          return this;
1552        }
1553
1554        /**
1555         * @return {@link #value} (The text value for this designation.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1556         */
1557        public StringType getValueElement() { 
1558          if (this.value == null)
1559            if (Configuration.errorOnAutoCreate())
1560              throw new Error("Attempt to auto-create ConceptReferenceDesignationComponent.value");
1561            else if (Configuration.doAutoCreate())
1562              this.value = new StringType(); // bb
1563          return this.value;
1564        }
1565
1566        public boolean hasValueElement() { 
1567          return this.value != null && !this.value.isEmpty();
1568        }
1569
1570        public boolean hasValue() { 
1571          return this.value != null && !this.value.isEmpty();
1572        }
1573
1574        /**
1575         * @param value {@link #value} (The text value for this designation.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1576         */
1577        public ConceptReferenceDesignationComponent setValueElement(StringType value) { 
1578          this.value = value;
1579          return this;
1580        }
1581
1582        /**
1583         * @return The text value for this designation.
1584         */
1585        public String getValue() { 
1586          return this.value == null ? null : this.value.getValue();
1587        }
1588
1589        /**
1590         * @param value The text value for this designation.
1591         */
1592        public ConceptReferenceDesignationComponent setValue(String value) { 
1593            if (this.value == null)
1594              this.value = new StringType();
1595            this.value.setValue(value);
1596          return this;
1597        }
1598
1599        protected void listChildren(List<Property> childrenList) {
1600          super.listChildren(childrenList);
1601          childrenList.add(new Property("language", "code", "The language this designation is defined for.", 0, java.lang.Integer.MAX_VALUE, language));
1602          childrenList.add(new Property("use", "Coding", "A code that details how this designation would be used.", 0, java.lang.Integer.MAX_VALUE, use));
1603          childrenList.add(new Property("value", "string", "The text value for this designation.", 0, java.lang.Integer.MAX_VALUE, value));
1604        }
1605
1606      @Override
1607      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1608        switch (hash) {
1609        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeType
1610        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Coding
1611        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
1612        default: return super.getProperty(hash, name, checkValid);
1613        }
1614
1615      }
1616
1617      @Override
1618      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1619        switch (hash) {
1620        case -1613589672: // language
1621          this.language = castToCode(value); // CodeType
1622          return value;
1623        case 116103: // use
1624          this.use = castToCoding(value); // Coding
1625          return value;
1626        case 111972721: // value
1627          this.value = castToString(value); // StringType
1628          return value;
1629        default: return super.setProperty(hash, name, value);
1630        }
1631
1632      }
1633
1634      @Override
1635      public Base setProperty(String name, Base value) throws FHIRException {
1636        if (name.equals("language")) {
1637          this.language = castToCode(value); // CodeType
1638        } else if (name.equals("use")) {
1639          this.use = castToCoding(value); // Coding
1640        } else if (name.equals("value")) {
1641          this.value = castToString(value); // StringType
1642        } else
1643          return super.setProperty(name, value);
1644        return value;
1645      }
1646
1647      @Override
1648      public Base makeProperty(int hash, String name) throws FHIRException {
1649        switch (hash) {
1650        case -1613589672:  return getLanguageElement();
1651        case 116103:  return getUse(); 
1652        case 111972721:  return getValueElement();
1653        default: return super.makeProperty(hash, name);
1654        }
1655
1656      }
1657
1658      @Override
1659      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1660        switch (hash) {
1661        case -1613589672: /*language*/ return new String[] {"code"};
1662        case 116103: /*use*/ return new String[] {"Coding"};
1663        case 111972721: /*value*/ return new String[] {"string"};
1664        default: return super.getTypesForProperty(hash, name);
1665        }
1666
1667      }
1668
1669      @Override
1670      public Base addChild(String name) throws FHIRException {
1671        if (name.equals("language")) {
1672          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.language");
1673        }
1674        else if (name.equals("use")) {
1675          this.use = new Coding();
1676          return this.use;
1677        }
1678        else if (name.equals("value")) {
1679          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.value");
1680        }
1681        else
1682          return super.addChild(name);
1683      }
1684
1685      public ConceptReferenceDesignationComponent copy() {
1686        ConceptReferenceDesignationComponent dst = new ConceptReferenceDesignationComponent();
1687        copyValues(dst);
1688        dst.language = language == null ? null : language.copy();
1689        dst.use = use == null ? null : use.copy();
1690        dst.value = value == null ? null : value.copy();
1691        return dst;
1692      }
1693
1694      @Override
1695      public boolean equalsDeep(Base other) {
1696        if (!super.equalsDeep(other))
1697          return false;
1698        if (!(other instanceof ConceptReferenceDesignationComponent))
1699          return false;
1700        ConceptReferenceDesignationComponent o = (ConceptReferenceDesignationComponent) other;
1701        return compareDeep(language, o.language, true) && compareDeep(use, o.use, true) && compareDeep(value, o.value, true)
1702          ;
1703      }
1704
1705      @Override
1706      public boolean equalsShallow(Base other) {
1707        if (!super.equalsShallow(other))
1708          return false;
1709        if (!(other instanceof ConceptReferenceDesignationComponent))
1710          return false;
1711        ConceptReferenceDesignationComponent o = (ConceptReferenceDesignationComponent) other;
1712        return compareValues(language, o.language, true) && compareValues(value, o.value, true);
1713      }
1714
1715      public boolean isEmpty() {
1716        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(language, use, value);
1717      }
1718
1719  public String fhirType() {
1720    return "ValueSet.compose.include.concept.designation";
1721
1722  }
1723
1724  }
1725
1726    @Block()
1727    public static class ConceptSetFilterComponent extends BackboneElement implements IBaseBackboneElement {
1728        /**
1729         * A code that identifies a property defined in the code system.
1730         */
1731        @Child(name = "property", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1732        @Description(shortDefinition="A property defined by the code system", formalDefinition="A code that identifies a property defined in the code system." )
1733        protected CodeType property;
1734
1735        /**
1736         * The kind of operation to perform as a part of the filter criteria.
1737         */
1738        @Child(name = "op", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1739        @Description(shortDefinition="= | is-a | descendent-of | is-not-a | regex | in | not-in | generalizes | exists", formalDefinition="The kind of operation to perform as a part of the filter criteria." )
1740        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/filter-operator")
1741        protected Enumeration<FilterOperator> op;
1742
1743        /**
1744         * The match value may be either a code defined by the system, or a string value, which is a regex match on the literal string of the property value when the operation is 'regex', or one of the values (true and false), when the operation is 'exists'.
1745         */
1746        @Child(name = "value", type = {CodeType.class}, order=3, min=1, max=1, modifier=false, summary=true)
1747        @Description(shortDefinition="Code from the system, or regex criteria, or boolean value for exists", formalDefinition="The match value may be either a code defined by the system, or a string value, which is a regex match on the literal string of the property value when the operation is 'regex', or one of the values (true and false), when the operation is 'exists'." )
1748        protected CodeType value;
1749
1750        private static final long serialVersionUID = 1985515000L;
1751
1752    /**
1753     * Constructor
1754     */
1755      public ConceptSetFilterComponent() {
1756        super();
1757      }
1758
1759    /**
1760     * Constructor
1761     */
1762      public ConceptSetFilterComponent(CodeType property, Enumeration<FilterOperator> op, CodeType value) {
1763        super();
1764        this.property = property;
1765        this.op = op;
1766        this.value = value;
1767      }
1768
1769        /**
1770         * @return {@link #property} (A code that identifies a property defined in the code system.). This is the underlying object with id, value and extensions. The accessor "getProperty" gives direct access to the value
1771         */
1772        public CodeType getPropertyElement() { 
1773          if (this.property == null)
1774            if (Configuration.errorOnAutoCreate())
1775              throw new Error("Attempt to auto-create ConceptSetFilterComponent.property");
1776            else if (Configuration.doAutoCreate())
1777              this.property = new CodeType(); // bb
1778          return this.property;
1779        }
1780
1781        public boolean hasPropertyElement() { 
1782          return this.property != null && !this.property.isEmpty();
1783        }
1784
1785        public boolean hasProperty() { 
1786          return this.property != null && !this.property.isEmpty();
1787        }
1788
1789        /**
1790         * @param value {@link #property} (A code that identifies a property defined in the code system.). This is the underlying object with id, value and extensions. The accessor "getProperty" gives direct access to the value
1791         */
1792        public ConceptSetFilterComponent setPropertyElement(CodeType value) { 
1793          this.property = value;
1794          return this;
1795        }
1796
1797        /**
1798         * @return A code that identifies a property defined in the code system.
1799         */
1800        public String getProperty() { 
1801          return this.property == null ? null : this.property.getValue();
1802        }
1803
1804        /**
1805         * @param value A code that identifies a property defined in the code system.
1806         */
1807        public ConceptSetFilterComponent setProperty(String value) { 
1808            if (this.property == null)
1809              this.property = new CodeType();
1810            this.property.setValue(value);
1811          return this;
1812        }
1813
1814        /**
1815         * @return {@link #op} (The kind of operation to perform as a part of the filter criteria.). This is the underlying object with id, value and extensions. The accessor "getOp" gives direct access to the value
1816         */
1817        public Enumeration<FilterOperator> getOpElement() { 
1818          if (this.op == null)
1819            if (Configuration.errorOnAutoCreate())
1820              throw new Error("Attempt to auto-create ConceptSetFilterComponent.op");
1821            else if (Configuration.doAutoCreate())
1822              this.op = new Enumeration<FilterOperator>(new FilterOperatorEnumFactory()); // bb
1823          return this.op;
1824        }
1825
1826        public boolean hasOpElement() { 
1827          return this.op != null && !this.op.isEmpty();
1828        }
1829
1830        public boolean hasOp() { 
1831          return this.op != null && !this.op.isEmpty();
1832        }
1833
1834        /**
1835         * @param value {@link #op} (The kind of operation to perform as a part of the filter criteria.). This is the underlying object with id, value and extensions. The accessor "getOp" gives direct access to the value
1836         */
1837        public ConceptSetFilterComponent setOpElement(Enumeration<FilterOperator> value) { 
1838          this.op = value;
1839          return this;
1840        }
1841
1842        /**
1843         * @return The kind of operation to perform as a part of the filter criteria.
1844         */
1845        public FilterOperator getOp() { 
1846          return this.op == null ? null : this.op.getValue();
1847        }
1848
1849        /**
1850         * @param value The kind of operation to perform as a part of the filter criteria.
1851         */
1852        public ConceptSetFilterComponent setOp(FilterOperator value) { 
1853            if (this.op == null)
1854              this.op = new Enumeration<FilterOperator>(new FilterOperatorEnumFactory());
1855            this.op.setValue(value);
1856          return this;
1857        }
1858
1859        /**
1860         * @return {@link #value} (The match value may be either a code defined by the system, or a string value, which is a regex match on the literal string of the property value when the operation is 'regex', or one of the values (true and false), when the operation is 'exists'.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1861         */
1862        public CodeType getValueElement() { 
1863          if (this.value == null)
1864            if (Configuration.errorOnAutoCreate())
1865              throw new Error("Attempt to auto-create ConceptSetFilterComponent.value");
1866            else if (Configuration.doAutoCreate())
1867              this.value = new CodeType(); // bb
1868          return this.value;
1869        }
1870
1871        public boolean hasValueElement() { 
1872          return this.value != null && !this.value.isEmpty();
1873        }
1874
1875        public boolean hasValue() { 
1876          return this.value != null && !this.value.isEmpty();
1877        }
1878
1879        /**
1880         * @param value {@link #value} (The match value may be either a code defined by the system, or a string value, which is a regex match on the literal string of the property value when the operation is 'regex', or one of the values (true and false), when the operation is 'exists'.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1881         */
1882        public ConceptSetFilterComponent setValueElement(CodeType value) { 
1883          this.value = value;
1884          return this;
1885        }
1886
1887        /**
1888         * @return The match value may be either a code defined by the system, or a string value, which is a regex match on the literal string of the property value when the operation is 'regex', or one of the values (true and false), when the operation is 'exists'.
1889         */
1890        public String getValue() { 
1891          return this.value == null ? null : this.value.getValue();
1892        }
1893
1894        /**
1895         * @param value The match value may be either a code defined by the system, or a string value, which is a regex match on the literal string of the property value when the operation is 'regex', or one of the values (true and false), when the operation is 'exists'.
1896         */
1897        public ConceptSetFilterComponent setValue(String value) { 
1898            if (this.value == null)
1899              this.value = new CodeType();
1900            this.value.setValue(value);
1901          return this;
1902        }
1903
1904        protected void listChildren(List<Property> childrenList) {
1905          super.listChildren(childrenList);
1906          childrenList.add(new Property("property", "code", "A code that identifies a property defined in the code system.", 0, java.lang.Integer.MAX_VALUE, property));
1907          childrenList.add(new Property("op", "code", "The kind of operation to perform as a part of the filter criteria.", 0, java.lang.Integer.MAX_VALUE, op));
1908          childrenList.add(new Property("value", "code", "The match value may be either a code defined by the system, or a string value, which is a regex match on the literal string of the property value when the operation is 'regex', or one of the values (true and false), when the operation is 'exists'.", 0, java.lang.Integer.MAX_VALUE, value));
1909        }
1910
1911      @Override
1912      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1913        switch (hash) {
1914        case -993141291: /*property*/ return this.property == null ? new Base[0] : new Base[] {this.property}; // CodeType
1915        case 3553: /*op*/ return this.op == null ? new Base[0] : new Base[] {this.op}; // Enumeration<FilterOperator>
1916        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // CodeType
1917        default: return super.getProperty(hash, name, checkValid);
1918        }
1919
1920      }
1921
1922      @Override
1923      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1924        switch (hash) {
1925        case -993141291: // property
1926          this.property = castToCode(value); // CodeType
1927          return value;
1928        case 3553: // op
1929          value = new FilterOperatorEnumFactory().fromType(castToCode(value));
1930          this.op = (Enumeration) value; // Enumeration<FilterOperator>
1931          return value;
1932        case 111972721: // value
1933          this.value = castToCode(value); // CodeType
1934          return value;
1935        default: return super.setProperty(hash, name, value);
1936        }
1937
1938      }
1939
1940      @Override
1941      public Base setProperty(String name, Base value) throws FHIRException {
1942        if (name.equals("property")) {
1943          this.property = castToCode(value); // CodeType
1944        } else if (name.equals("op")) {
1945          value = new FilterOperatorEnumFactory().fromType(castToCode(value));
1946          this.op = (Enumeration) value; // Enumeration<FilterOperator>
1947        } else if (name.equals("value")) {
1948          this.value = castToCode(value); // CodeType
1949        } else
1950          return super.setProperty(name, value);
1951        return value;
1952      }
1953
1954      @Override
1955      public Base makeProperty(int hash, String name) throws FHIRException {
1956        switch (hash) {
1957        case -993141291:  return getPropertyElement();
1958        case 3553:  return getOpElement();
1959        case 111972721:  return getValueElement();
1960        default: return super.makeProperty(hash, name);
1961        }
1962
1963      }
1964
1965      @Override
1966      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1967        switch (hash) {
1968        case -993141291: /*property*/ return new String[] {"code"};
1969        case 3553: /*op*/ return new String[] {"code"};
1970        case 111972721: /*value*/ return new String[] {"code"};
1971        default: return super.getTypesForProperty(hash, name);
1972        }
1973
1974      }
1975
1976      @Override
1977      public Base addChild(String name) throws FHIRException {
1978        if (name.equals("property")) {
1979          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.property");
1980        }
1981        else if (name.equals("op")) {
1982          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.op");
1983        }
1984        else if (name.equals("value")) {
1985          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.value");
1986        }
1987        else
1988          return super.addChild(name);
1989      }
1990
1991      public ConceptSetFilterComponent copy() {
1992        ConceptSetFilterComponent dst = new ConceptSetFilterComponent();
1993        copyValues(dst);
1994        dst.property = property == null ? null : property.copy();
1995        dst.op = op == null ? null : op.copy();
1996        dst.value = value == null ? null : value.copy();
1997        return dst;
1998      }
1999
2000      @Override
2001      public boolean equalsDeep(Base other) {
2002        if (!super.equalsDeep(other))
2003          return false;
2004        if (!(other instanceof ConceptSetFilterComponent))
2005          return false;
2006        ConceptSetFilterComponent o = (ConceptSetFilterComponent) other;
2007        return compareDeep(property, o.property, true) && compareDeep(op, o.op, true) && compareDeep(value, o.value, true)
2008          ;
2009      }
2010
2011      @Override
2012      public boolean equalsShallow(Base other) {
2013        if (!super.equalsShallow(other))
2014          return false;
2015        if (!(other instanceof ConceptSetFilterComponent))
2016          return false;
2017        ConceptSetFilterComponent o = (ConceptSetFilterComponent) other;
2018        return compareValues(property, o.property, true) && compareValues(op, o.op, true) && compareValues(value, o.value, true)
2019          ;
2020      }
2021
2022      public boolean isEmpty() {
2023        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(property, op, value);
2024      }
2025
2026  public String fhirType() {
2027    return "ValueSet.compose.include.filter";
2028
2029  }
2030
2031  }
2032
2033    @Block()
2034    public static class ValueSetExpansionComponent extends BackboneElement implements IBaseBackboneElement {
2035        /**
2036         * An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so.
2037         */
2038        @Child(name = "identifier", type = {UriType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2039        @Description(shortDefinition="Uniquely identifies this expansion", formalDefinition="An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so." )
2040        protected UriType identifier;
2041
2042        /**
2043         * The time at which the expansion was produced by the expanding system.
2044         */
2045        @Child(name = "timestamp", type = {DateTimeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
2046        @Description(shortDefinition="Time ValueSet expansion happened", formalDefinition="The time at which the expansion was produced by the expanding system." )
2047        protected DateTimeType timestamp;
2048
2049        /**
2050         * The total number of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter.
2051         */
2052        @Child(name = "total", type = {IntegerType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2053        @Description(shortDefinition="Total number of codes in the expansion", formalDefinition="The total number of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter." )
2054        protected IntegerType total;
2055
2056        /**
2057         * If paging is being used, the offset at which this resource starts.  I.e. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present.
2058         */
2059        @Child(name = "offset", type = {IntegerType.class}, order=4, min=0, max=1, modifier=false, summary=false)
2060        @Description(shortDefinition="Offset at which this resource starts", formalDefinition="If paging is being used, the offset at which this resource starts.  I.e. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present." )
2061        protected IntegerType offset;
2062
2063        /**
2064         * A parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion.
2065         */
2066        @Child(name = "parameter", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2067        @Description(shortDefinition="Parameter that controlled the expansion process", formalDefinition="A parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion." )
2068        protected List<ValueSetExpansionParameterComponent> parameter;
2069
2070        /**
2071         * The codes that are contained in the value set expansion.
2072         */
2073        @Child(name = "contains", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2074        @Description(shortDefinition="Codes in the value set", formalDefinition="The codes that are contained in the value set expansion." )
2075        protected List<ValueSetExpansionContainsComponent> contains;
2076
2077        private static final long serialVersionUID = -43471993L;
2078
2079    /**
2080     * Constructor
2081     */
2082      public ValueSetExpansionComponent() {
2083        super();
2084      }
2085
2086    /**
2087     * Constructor
2088     */
2089      public ValueSetExpansionComponent(UriType identifier, DateTimeType timestamp) {
2090        super();
2091        this.identifier = identifier;
2092        this.timestamp = timestamp;
2093      }
2094
2095        /**
2096         * @return {@link #identifier} (An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
2097         */
2098        public UriType getIdentifierElement() { 
2099          if (this.identifier == null)
2100            if (Configuration.errorOnAutoCreate())
2101              throw new Error("Attempt to auto-create ValueSetExpansionComponent.identifier");
2102            else if (Configuration.doAutoCreate())
2103              this.identifier = new UriType(); // bb
2104          return this.identifier;
2105        }
2106
2107        public boolean hasIdentifierElement() { 
2108          return this.identifier != null && !this.identifier.isEmpty();
2109        }
2110
2111        public boolean hasIdentifier() { 
2112          return this.identifier != null && !this.identifier.isEmpty();
2113        }
2114
2115        /**
2116         * @param value {@link #identifier} (An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
2117         */
2118        public ValueSetExpansionComponent setIdentifierElement(UriType value) { 
2119          this.identifier = value;
2120          return this;
2121        }
2122
2123        /**
2124         * @return An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so.
2125         */
2126        public String getIdentifier() { 
2127          return this.identifier == null ? null : this.identifier.getValue();
2128        }
2129
2130        /**
2131         * @param value An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so.
2132         */
2133        public ValueSetExpansionComponent setIdentifier(String value) { 
2134            if (this.identifier == null)
2135              this.identifier = new UriType();
2136            this.identifier.setValue(value);
2137          return this;
2138        }
2139
2140        /**
2141         * @return {@link #timestamp} (The time at which the expansion was produced by the expanding system.). This is the underlying object with id, value and extensions. The accessor "getTimestamp" gives direct access to the value
2142         */
2143        public DateTimeType getTimestampElement() { 
2144          if (this.timestamp == null)
2145            if (Configuration.errorOnAutoCreate())
2146              throw new Error("Attempt to auto-create ValueSetExpansionComponent.timestamp");
2147            else if (Configuration.doAutoCreate())
2148              this.timestamp = new DateTimeType(); // bb
2149          return this.timestamp;
2150        }
2151
2152        public boolean hasTimestampElement() { 
2153          return this.timestamp != null && !this.timestamp.isEmpty();
2154        }
2155
2156        public boolean hasTimestamp() { 
2157          return this.timestamp != null && !this.timestamp.isEmpty();
2158        }
2159
2160        /**
2161         * @param value {@link #timestamp} (The time at which the expansion was produced by the expanding system.). This is the underlying object with id, value and extensions. The accessor "getTimestamp" gives direct access to the value
2162         */
2163        public ValueSetExpansionComponent setTimestampElement(DateTimeType value) { 
2164          this.timestamp = value;
2165          return this;
2166        }
2167
2168        /**
2169         * @return The time at which the expansion was produced by the expanding system.
2170         */
2171        public Date getTimestamp() { 
2172          return this.timestamp == null ? null : this.timestamp.getValue();
2173        }
2174
2175        /**
2176         * @param value The time at which the expansion was produced by the expanding system.
2177         */
2178        public ValueSetExpansionComponent setTimestamp(Date value) { 
2179            if (this.timestamp == null)
2180              this.timestamp = new DateTimeType();
2181            this.timestamp.setValue(value);
2182          return this;
2183        }
2184
2185        /**
2186         * @return {@link #total} (The total number of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter.). This is the underlying object with id, value and extensions. The accessor "getTotal" gives direct access to the value
2187         */
2188        public IntegerType getTotalElement() { 
2189          if (this.total == null)
2190            if (Configuration.errorOnAutoCreate())
2191              throw new Error("Attempt to auto-create ValueSetExpansionComponent.total");
2192            else if (Configuration.doAutoCreate())
2193              this.total = new IntegerType(); // bb
2194          return this.total;
2195        }
2196
2197        public boolean hasTotalElement() { 
2198          return this.total != null && !this.total.isEmpty();
2199        }
2200
2201        public boolean hasTotal() { 
2202          return this.total != null && !this.total.isEmpty();
2203        }
2204
2205        /**
2206         * @param value {@link #total} (The total number of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter.). This is the underlying object with id, value and extensions. The accessor "getTotal" gives direct access to the value
2207         */
2208        public ValueSetExpansionComponent setTotalElement(IntegerType value) { 
2209          this.total = value;
2210          return this;
2211        }
2212
2213        /**
2214         * @return The total number of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter.
2215         */
2216        public int getTotal() { 
2217          return this.total == null || this.total.isEmpty() ? 0 : this.total.getValue();
2218        }
2219
2220        /**
2221         * @param value The total number of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter.
2222         */
2223        public ValueSetExpansionComponent setTotal(int value) { 
2224            if (this.total == null)
2225              this.total = new IntegerType();
2226            this.total.setValue(value);
2227          return this;
2228        }
2229
2230        /**
2231         * @return {@link #offset} (If paging is being used, the offset at which this resource starts.  I.e. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present.). This is the underlying object with id, value and extensions. The accessor "getOffset" gives direct access to the value
2232         */
2233        public IntegerType getOffsetElement() { 
2234          if (this.offset == null)
2235            if (Configuration.errorOnAutoCreate())
2236              throw new Error("Attempt to auto-create ValueSetExpansionComponent.offset");
2237            else if (Configuration.doAutoCreate())
2238              this.offset = new IntegerType(); // bb
2239          return this.offset;
2240        }
2241
2242        public boolean hasOffsetElement() { 
2243          return this.offset != null && !this.offset.isEmpty();
2244        }
2245
2246        public boolean hasOffset() { 
2247          return this.offset != null && !this.offset.isEmpty();
2248        }
2249
2250        /**
2251         * @param value {@link #offset} (If paging is being used, the offset at which this resource starts.  I.e. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present.). This is the underlying object with id, value and extensions. The accessor "getOffset" gives direct access to the value
2252         */
2253        public ValueSetExpansionComponent setOffsetElement(IntegerType value) { 
2254          this.offset = value;
2255          return this;
2256        }
2257
2258        /**
2259         * @return If paging is being used, the offset at which this resource starts.  I.e. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present.
2260         */
2261        public int getOffset() { 
2262          return this.offset == null || this.offset.isEmpty() ? 0 : this.offset.getValue();
2263        }
2264
2265        /**
2266         * @param value If paging is being used, the offset at which this resource starts.  I.e. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present.
2267         */
2268        public ValueSetExpansionComponent setOffset(int value) { 
2269            if (this.offset == null)
2270              this.offset = new IntegerType();
2271            this.offset.setValue(value);
2272          return this;
2273        }
2274
2275        /**
2276         * @return {@link #parameter} (A parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion.)
2277         */
2278        public List<ValueSetExpansionParameterComponent> getParameter() { 
2279          if (this.parameter == null)
2280            this.parameter = new ArrayList<ValueSetExpansionParameterComponent>();
2281          return this.parameter;
2282        }
2283
2284        /**
2285         * @return Returns a reference to <code>this</code> for easy method chaining
2286         */
2287        public ValueSetExpansionComponent setParameter(List<ValueSetExpansionParameterComponent> theParameter) { 
2288          this.parameter = theParameter;
2289          return this;
2290        }
2291
2292        public boolean hasParameter() { 
2293          if (this.parameter == null)
2294            return false;
2295          for (ValueSetExpansionParameterComponent item : this.parameter)
2296            if (!item.isEmpty())
2297              return true;
2298          return false;
2299        }
2300
2301        public ValueSetExpansionParameterComponent addParameter() { //3
2302          ValueSetExpansionParameterComponent t = new ValueSetExpansionParameterComponent();
2303          if (this.parameter == null)
2304            this.parameter = new ArrayList<ValueSetExpansionParameterComponent>();
2305          this.parameter.add(t);
2306          return t;
2307        }
2308
2309        public ValueSetExpansionComponent addParameter(ValueSetExpansionParameterComponent t) { //3
2310          if (t == null)
2311            return this;
2312          if (this.parameter == null)
2313            this.parameter = new ArrayList<ValueSetExpansionParameterComponent>();
2314          this.parameter.add(t);
2315          return this;
2316        }
2317
2318        /**
2319         * @return The first repetition of repeating field {@link #parameter}, creating it if it does not already exist
2320         */
2321        public ValueSetExpansionParameterComponent getParameterFirstRep() { 
2322          if (getParameter().isEmpty()) {
2323            addParameter();
2324          }
2325          return getParameter().get(0);
2326        }
2327
2328        /**
2329         * @return {@link #contains} (The codes that are contained in the value set expansion.)
2330         */
2331        public List<ValueSetExpansionContainsComponent> getContains() { 
2332          if (this.contains == null)
2333            this.contains = new ArrayList<ValueSetExpansionContainsComponent>();
2334          return this.contains;
2335        }
2336
2337        /**
2338         * @return Returns a reference to <code>this</code> for easy method chaining
2339         */
2340        public ValueSetExpansionComponent setContains(List<ValueSetExpansionContainsComponent> theContains) { 
2341          this.contains = theContains;
2342          return this;
2343        }
2344
2345        public boolean hasContains() { 
2346          if (this.contains == null)
2347            return false;
2348          for (ValueSetExpansionContainsComponent item : this.contains)
2349            if (!item.isEmpty())
2350              return true;
2351          return false;
2352        }
2353
2354        public ValueSetExpansionContainsComponent addContains() { //3
2355          ValueSetExpansionContainsComponent t = new ValueSetExpansionContainsComponent();
2356          if (this.contains == null)
2357            this.contains = new ArrayList<ValueSetExpansionContainsComponent>();
2358          this.contains.add(t);
2359          return t;
2360        }
2361
2362        public ValueSetExpansionComponent addContains(ValueSetExpansionContainsComponent t) { //3
2363          if (t == null)
2364            return this;
2365          if (this.contains == null)
2366            this.contains = new ArrayList<ValueSetExpansionContainsComponent>();
2367          this.contains.add(t);
2368          return this;
2369        }
2370
2371        /**
2372         * @return The first repetition of repeating field {@link #contains}, creating it if it does not already exist
2373         */
2374        public ValueSetExpansionContainsComponent getContainsFirstRep() { 
2375          if (getContains().isEmpty()) {
2376            addContains();
2377          }
2378          return getContains().get(0);
2379        }
2380
2381        protected void listChildren(List<Property> childrenList) {
2382          super.listChildren(childrenList);
2383          childrenList.add(new Property("identifier", "uri", "An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so.", 0, java.lang.Integer.MAX_VALUE, identifier));
2384          childrenList.add(new Property("timestamp", "dateTime", "The time at which the expansion was produced by the expanding system.", 0, java.lang.Integer.MAX_VALUE, timestamp));
2385          childrenList.add(new Property("total", "integer", "The total number of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter.", 0, java.lang.Integer.MAX_VALUE, total));
2386          childrenList.add(new Property("offset", "integer", "If paging is being used, the offset at which this resource starts.  I.e. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present.", 0, java.lang.Integer.MAX_VALUE, offset));
2387          childrenList.add(new Property("parameter", "", "A parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion.", 0, java.lang.Integer.MAX_VALUE, parameter));
2388          childrenList.add(new Property("contains", "", "The codes that are contained in the value set expansion.", 0, java.lang.Integer.MAX_VALUE, contains));
2389        }
2390
2391      @Override
2392      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2393        switch (hash) {
2394        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // UriType
2395        case 55126294: /*timestamp*/ return this.timestamp == null ? new Base[0] : new Base[] {this.timestamp}; // DateTimeType
2396        case 110549828: /*total*/ return this.total == null ? new Base[0] : new Base[] {this.total}; // IntegerType
2397        case -1019779949: /*offset*/ return this.offset == null ? new Base[0] : new Base[] {this.offset}; // IntegerType
2398        case 1954460585: /*parameter*/ return this.parameter == null ? new Base[0] : this.parameter.toArray(new Base[this.parameter.size()]); // ValueSetExpansionParameterComponent
2399        case -567445985: /*contains*/ return this.contains == null ? new Base[0] : this.contains.toArray(new Base[this.contains.size()]); // ValueSetExpansionContainsComponent
2400        default: return super.getProperty(hash, name, checkValid);
2401        }
2402
2403      }
2404
2405      @Override
2406      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2407        switch (hash) {
2408        case -1618432855: // identifier
2409          this.identifier = castToUri(value); // UriType
2410          return value;
2411        case 55126294: // timestamp
2412          this.timestamp = castToDateTime(value); // DateTimeType
2413          return value;
2414        case 110549828: // total
2415          this.total = castToInteger(value); // IntegerType
2416          return value;
2417        case -1019779949: // offset
2418          this.offset = castToInteger(value); // IntegerType
2419          return value;
2420        case 1954460585: // parameter
2421          this.getParameter().add((ValueSetExpansionParameterComponent) value); // ValueSetExpansionParameterComponent
2422          return value;
2423        case -567445985: // contains
2424          this.getContains().add((ValueSetExpansionContainsComponent) value); // ValueSetExpansionContainsComponent
2425          return value;
2426        default: return super.setProperty(hash, name, value);
2427        }
2428
2429      }
2430
2431      @Override
2432      public Base setProperty(String name, Base value) throws FHIRException {
2433        if (name.equals("identifier")) {
2434          this.identifier = castToUri(value); // UriType
2435        } else if (name.equals("timestamp")) {
2436          this.timestamp = castToDateTime(value); // DateTimeType
2437        } else if (name.equals("total")) {
2438          this.total = castToInteger(value); // IntegerType
2439        } else if (name.equals("offset")) {
2440          this.offset = castToInteger(value); // IntegerType
2441        } else if (name.equals("parameter")) {
2442          this.getParameter().add((ValueSetExpansionParameterComponent) value);
2443        } else if (name.equals("contains")) {
2444          this.getContains().add((ValueSetExpansionContainsComponent) value);
2445        } else
2446          return super.setProperty(name, value);
2447        return value;
2448      }
2449
2450      @Override
2451      public Base makeProperty(int hash, String name) throws FHIRException {
2452        switch (hash) {
2453        case -1618432855:  return getIdentifierElement();
2454        case 55126294:  return getTimestampElement();
2455        case 110549828:  return getTotalElement();
2456        case -1019779949:  return getOffsetElement();
2457        case 1954460585:  return addParameter(); 
2458        case -567445985:  return addContains(); 
2459        default: return super.makeProperty(hash, name);
2460        }
2461
2462      }
2463
2464      @Override
2465      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2466        switch (hash) {
2467        case -1618432855: /*identifier*/ return new String[] {"uri"};
2468        case 55126294: /*timestamp*/ return new String[] {"dateTime"};
2469        case 110549828: /*total*/ return new String[] {"integer"};
2470        case -1019779949: /*offset*/ return new String[] {"integer"};
2471        case 1954460585: /*parameter*/ return new String[] {};
2472        case -567445985: /*contains*/ return new String[] {};
2473        default: return super.getTypesForProperty(hash, name);
2474        }
2475
2476      }
2477
2478      @Override
2479      public Base addChild(String name) throws FHIRException {
2480        if (name.equals("identifier")) {
2481          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.identifier");
2482        }
2483        else if (name.equals("timestamp")) {
2484          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.timestamp");
2485        }
2486        else if (name.equals("total")) {
2487          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.total");
2488        }
2489        else if (name.equals("offset")) {
2490          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.offset");
2491        }
2492        else if (name.equals("parameter")) {
2493          return addParameter();
2494        }
2495        else if (name.equals("contains")) {
2496          return addContains();
2497        }
2498        else
2499          return super.addChild(name);
2500      }
2501
2502      public ValueSetExpansionComponent copy() {
2503        ValueSetExpansionComponent dst = new ValueSetExpansionComponent();
2504        copyValues(dst);
2505        dst.identifier = identifier == null ? null : identifier.copy();
2506        dst.timestamp = timestamp == null ? null : timestamp.copy();
2507        dst.total = total == null ? null : total.copy();
2508        dst.offset = offset == null ? null : offset.copy();
2509        if (parameter != null) {
2510          dst.parameter = new ArrayList<ValueSetExpansionParameterComponent>();
2511          for (ValueSetExpansionParameterComponent i : parameter)
2512            dst.parameter.add(i.copy());
2513        };
2514        if (contains != null) {
2515          dst.contains = new ArrayList<ValueSetExpansionContainsComponent>();
2516          for (ValueSetExpansionContainsComponent i : contains)
2517            dst.contains.add(i.copy());
2518        };
2519        return dst;
2520      }
2521
2522      @Override
2523      public boolean equalsDeep(Base other) {
2524        if (!super.equalsDeep(other))
2525          return false;
2526        if (!(other instanceof ValueSetExpansionComponent))
2527          return false;
2528        ValueSetExpansionComponent o = (ValueSetExpansionComponent) other;
2529        return compareDeep(identifier, o.identifier, true) && compareDeep(timestamp, o.timestamp, true)
2530           && compareDeep(total, o.total, true) && compareDeep(offset, o.offset, true) && compareDeep(parameter, o.parameter, true)
2531           && compareDeep(contains, o.contains, true);
2532      }
2533
2534      @Override
2535      public boolean equalsShallow(Base other) {
2536        if (!super.equalsShallow(other))
2537          return false;
2538        if (!(other instanceof ValueSetExpansionComponent))
2539          return false;
2540        ValueSetExpansionComponent o = (ValueSetExpansionComponent) other;
2541        return compareValues(identifier, o.identifier, true) && compareValues(timestamp, o.timestamp, true)
2542           && compareValues(total, o.total, true) && compareValues(offset, o.offset, true);
2543      }
2544
2545      public boolean isEmpty() {
2546        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, timestamp, total
2547          , offset, parameter, contains);
2548      }
2549
2550  public String fhirType() {
2551    return "ValueSet.expansion";
2552
2553  }
2554
2555  }
2556
2557    @Block()
2558    public static class ValueSetExpansionParameterComponent extends BackboneElement implements IBaseBackboneElement {
2559        /**
2560         * The name of the parameter.
2561         */
2562        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2563        @Description(shortDefinition="Name as assigned by the server", formalDefinition="The name of the parameter." )
2564        protected StringType name;
2565
2566        /**
2567         * The value of the parameter.
2568         */
2569        @Child(name = "value", type = {StringType.class, BooleanType.class, IntegerType.class, DecimalType.class, UriType.class, CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2570        @Description(shortDefinition="Value of the named parameter", formalDefinition="The value of the parameter." )
2571        protected Type value;
2572
2573        private static final long serialVersionUID = 1172641169L;
2574
2575    /**
2576     * Constructor
2577     */
2578      public ValueSetExpansionParameterComponent() {
2579        super();
2580      }
2581
2582    /**
2583     * Constructor
2584     */
2585      public ValueSetExpansionParameterComponent(StringType name) {
2586        super();
2587        this.name = name;
2588      }
2589
2590        /**
2591         * @return {@link #name} (The name of the parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2592         */
2593        public StringType getNameElement() { 
2594          if (this.name == null)
2595            if (Configuration.errorOnAutoCreate())
2596              throw new Error("Attempt to auto-create ValueSetExpansionParameterComponent.name");
2597            else if (Configuration.doAutoCreate())
2598              this.name = new StringType(); // bb
2599          return this.name;
2600        }
2601
2602        public boolean hasNameElement() { 
2603          return this.name != null && !this.name.isEmpty();
2604        }
2605
2606        public boolean hasName() { 
2607          return this.name != null && !this.name.isEmpty();
2608        }
2609
2610        /**
2611         * @param value {@link #name} (The name of the parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2612         */
2613        public ValueSetExpansionParameterComponent setNameElement(StringType value) { 
2614          this.name = value;
2615          return this;
2616        }
2617
2618        /**
2619         * @return The name of the parameter.
2620         */
2621        public String getName() { 
2622          return this.name == null ? null : this.name.getValue();
2623        }
2624
2625        /**
2626         * @param value The name of the parameter.
2627         */
2628        public ValueSetExpansionParameterComponent setName(String value) { 
2629            if (this.name == null)
2630              this.name = new StringType();
2631            this.name.setValue(value);
2632          return this;
2633        }
2634
2635        /**
2636         * @return {@link #value} (The value of the parameter.)
2637         */
2638        public Type getValue() { 
2639          return this.value;
2640        }
2641
2642        /**
2643         * @return {@link #value} (The value of the parameter.)
2644         */
2645        public StringType getValueStringType() throws FHIRException { 
2646          if (!(this.value instanceof StringType))
2647            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
2648          return (StringType) this.value;
2649        }
2650
2651        public boolean hasValueStringType() { 
2652          return this.value instanceof StringType;
2653        }
2654
2655        /**
2656         * @return {@link #value} (The value of the parameter.)
2657         */
2658        public BooleanType getValueBooleanType() throws FHIRException { 
2659          if (!(this.value instanceof BooleanType))
2660            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
2661          return (BooleanType) this.value;
2662        }
2663
2664        public boolean hasValueBooleanType() { 
2665          return this.value instanceof BooleanType;
2666        }
2667
2668        /**
2669         * @return {@link #value} (The value of the parameter.)
2670         */
2671        public IntegerType getValueIntegerType() throws FHIRException { 
2672          if (!(this.value instanceof IntegerType))
2673            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
2674          return (IntegerType) this.value;
2675        }
2676
2677        public boolean hasValueIntegerType() { 
2678          return this.value instanceof IntegerType;
2679        }
2680
2681        /**
2682         * @return {@link #value} (The value of the parameter.)
2683         */
2684        public DecimalType getValueDecimalType() throws FHIRException { 
2685          if (!(this.value instanceof DecimalType))
2686            throw new FHIRException("Type mismatch: the type DecimalType was expected, but "+this.value.getClass().getName()+" was encountered");
2687          return (DecimalType) this.value;
2688        }
2689
2690        public boolean hasValueDecimalType() { 
2691          return this.value instanceof DecimalType;
2692        }
2693
2694        /**
2695         * @return {@link #value} (The value of the parameter.)
2696         */
2697        public UriType getValueUriType() throws FHIRException { 
2698          if (!(this.value instanceof UriType))
2699            throw new FHIRException("Type mismatch: the type UriType was expected, but "+this.value.getClass().getName()+" was encountered");
2700          return (UriType) this.value;
2701        }
2702
2703        public boolean hasValueUriType() { 
2704          return this.value instanceof UriType;
2705        }
2706
2707        /**
2708         * @return {@link #value} (The value of the parameter.)
2709         */
2710        public CodeType getValueCodeType() throws FHIRException { 
2711          if (!(this.value instanceof CodeType))
2712            throw new FHIRException("Type mismatch: the type CodeType was expected, but "+this.value.getClass().getName()+" was encountered");
2713          return (CodeType) this.value;
2714        }
2715
2716        public boolean hasValueCodeType() { 
2717          return this.value instanceof CodeType;
2718        }
2719
2720        public boolean hasValue() { 
2721          return this.value != null && !this.value.isEmpty();
2722        }
2723
2724        /**
2725         * @param value {@link #value} (The value of the parameter.)
2726         */
2727        public ValueSetExpansionParameterComponent setValue(Type value) { 
2728          this.value = value;
2729          return this;
2730        }
2731
2732        protected void listChildren(List<Property> childrenList) {
2733          super.listChildren(childrenList);
2734          childrenList.add(new Property("name", "string", "The name of the parameter.", 0, java.lang.Integer.MAX_VALUE, name));
2735          childrenList.add(new Property("value[x]", "string|boolean|integer|decimal|uri|code", "The value of the parameter.", 0, java.lang.Integer.MAX_VALUE, value));
2736        }
2737
2738      @Override
2739      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2740        switch (hash) {
2741        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2742        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
2743        default: return super.getProperty(hash, name, checkValid);
2744        }
2745
2746      }
2747
2748      @Override
2749      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2750        switch (hash) {
2751        case 3373707: // name
2752          this.name = castToString(value); // StringType
2753          return value;
2754        case 111972721: // value
2755          this.value = castToType(value); // Type
2756          return value;
2757        default: return super.setProperty(hash, name, value);
2758        }
2759
2760      }
2761
2762      @Override
2763      public Base setProperty(String name, Base value) throws FHIRException {
2764        if (name.equals("name")) {
2765          this.name = castToString(value); // StringType
2766        } else if (name.equals("value[x]")) {
2767          this.value = castToType(value); // Type
2768        } else
2769          return super.setProperty(name, value);
2770        return value;
2771      }
2772
2773      @Override
2774      public Base makeProperty(int hash, String name) throws FHIRException {
2775        switch (hash) {
2776        case 3373707:  return getNameElement();
2777        case -1410166417:  return getValue(); 
2778        case 111972721:  return getValue(); 
2779        default: return super.makeProperty(hash, name);
2780        }
2781
2782      }
2783
2784      @Override
2785      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2786        switch (hash) {
2787        case 3373707: /*name*/ return new String[] {"string"};
2788        case 111972721: /*value*/ return new String[] {"string", "boolean", "integer", "decimal", "uri", "code"};
2789        default: return super.getTypesForProperty(hash, name);
2790        }
2791
2792      }
2793
2794      @Override
2795      public Base addChild(String name) throws FHIRException {
2796        if (name.equals("name")) {
2797          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.name");
2798        }
2799        else if (name.equals("valueString")) {
2800          this.value = new StringType();
2801          return this.value;
2802        }
2803        else if (name.equals("valueBoolean")) {
2804          this.value = new BooleanType();
2805          return this.value;
2806        }
2807        else if (name.equals("valueInteger")) {
2808          this.value = new IntegerType();
2809          return this.value;
2810        }
2811        else if (name.equals("valueDecimal")) {
2812          this.value = new DecimalType();
2813          return this.value;
2814        }
2815        else if (name.equals("valueUri")) {
2816          this.value = new UriType();
2817          return this.value;
2818        }
2819        else if (name.equals("valueCode")) {
2820          this.value = new CodeType();
2821          return this.value;
2822        }
2823        else
2824          return super.addChild(name);
2825      }
2826
2827      public ValueSetExpansionParameterComponent copy() {
2828        ValueSetExpansionParameterComponent dst = new ValueSetExpansionParameterComponent();
2829        copyValues(dst);
2830        dst.name = name == null ? null : name.copy();
2831        dst.value = value == null ? null : value.copy();
2832        return dst;
2833      }
2834
2835      @Override
2836      public boolean equalsDeep(Base other) {
2837        if (!super.equalsDeep(other))
2838          return false;
2839        if (!(other instanceof ValueSetExpansionParameterComponent))
2840          return false;
2841        ValueSetExpansionParameterComponent o = (ValueSetExpansionParameterComponent) other;
2842        return compareDeep(name, o.name, true) && compareDeep(value, o.value, true);
2843      }
2844
2845      @Override
2846      public boolean equalsShallow(Base other) {
2847        if (!super.equalsShallow(other))
2848          return false;
2849        if (!(other instanceof ValueSetExpansionParameterComponent))
2850          return false;
2851        ValueSetExpansionParameterComponent o = (ValueSetExpansionParameterComponent) other;
2852        return compareValues(name, o.name, true);
2853      }
2854
2855      public boolean isEmpty() {
2856        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, value);
2857      }
2858
2859  public String fhirType() {
2860    return "ValueSet.expansion.parameter";
2861
2862  }
2863
2864  }
2865
2866    @Block()
2867    public static class ValueSetExpansionContainsComponent extends BackboneElement implements IBaseBackboneElement {
2868        /**
2869         * An absolute URI which is the code system in which the code for this item in the expansion is defined.
2870         */
2871        @Child(name = "system", type = {UriType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2872        @Description(shortDefinition="System value for the code", formalDefinition="An absolute URI which is the code system in which the code for this item in the expansion is defined." )
2873        protected UriType system;
2874
2875        /**
2876         * If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value.
2877         */
2878        @Child(name = "abstract", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2879        @Description(shortDefinition="If user cannot select this entry", formalDefinition="If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value." )
2880        protected BooleanType abstract_;
2881
2882        /**
2883         * If the concept is inactive in the code system that defines it. Inactive codes are those that are no longer to be used, but are maintained by the code system for understanding legacy data.
2884         */
2885        @Child(name = "inactive", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2886        @Description(shortDefinition="If concept is inactive in the code system", formalDefinition="If the concept is inactive in the code system that defines it. Inactive codes are those that are no longer to be used, but are maintained by the code system for understanding legacy data." )
2887        protected BooleanType inactive;
2888
2889        /**
2890         * The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence.
2891         */
2892        @Child(name = "version", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
2893        @Description(shortDefinition="Version in which this code/display is defined", formalDefinition="The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence." )
2894        protected StringType version;
2895
2896        /**
2897         * The code for this item in the expansion hierarchy. If this code is missing the entry in the hierarchy is a place holder (abstract) and does not represent a valid code in the value set.
2898         */
2899        @Child(name = "code", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=false)
2900        @Description(shortDefinition="Code - if blank, this is not a selectable code", formalDefinition="The code for this item in the expansion hierarchy. If this code is missing the entry in the hierarchy is a place holder (abstract) and does not represent a valid code in the value set." )
2901        protected CodeType code;
2902
2903        /**
2904         * The recommended display for this item in the expansion.
2905         */
2906        @Child(name = "display", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
2907        @Description(shortDefinition="User display for the concept", formalDefinition="The recommended display for this item in the expansion." )
2908        protected StringType display;
2909
2910        /**
2911         * Additional representations for this item - other languages, aliases, specialized purposes, used for particular purposes, etc. These are relevant when the conditions of the expansion do not fix to a single correct representation.
2912         */
2913        @Child(name = "designation", type = {ConceptReferenceDesignationComponent.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2914        @Description(shortDefinition="Additional representations for this item", formalDefinition="Additional representations for this item - other languages, aliases, specialized purposes, used for particular purposes, etc. These are relevant when the conditions of the expansion do not fix to a single correct representation." )
2915        protected List<ConceptReferenceDesignationComponent> designation;
2916
2917        /**
2918         * Other codes and entries contained under this entry in the hierarchy.
2919         */
2920        @Child(name = "contains", type = {ValueSetExpansionContainsComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2921        @Description(shortDefinition="Codes contained under this entry", formalDefinition="Other codes and entries contained under this entry in the hierarchy." )
2922        protected List<ValueSetExpansionContainsComponent> contains;
2923
2924        private static final long serialVersionUID = 719458860L;
2925
2926    /**
2927     * Constructor
2928     */
2929      public ValueSetExpansionContainsComponent() {
2930        super();
2931      }
2932
2933        /**
2934         * @return {@link #system} (An absolute URI which is the code system in which the code for this item in the expansion is defined.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
2935         */
2936        public UriType getSystemElement() { 
2937          if (this.system == null)
2938            if (Configuration.errorOnAutoCreate())
2939              throw new Error("Attempt to auto-create ValueSetExpansionContainsComponent.system");
2940            else if (Configuration.doAutoCreate())
2941              this.system = new UriType(); // bb
2942          return this.system;
2943        }
2944
2945        public boolean hasSystemElement() { 
2946          return this.system != null && !this.system.isEmpty();
2947        }
2948
2949        public boolean hasSystem() { 
2950          return this.system != null && !this.system.isEmpty();
2951        }
2952
2953        /**
2954         * @param value {@link #system} (An absolute URI which is the code system in which the code for this item in the expansion is defined.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
2955         */
2956        public ValueSetExpansionContainsComponent setSystemElement(UriType value) { 
2957          this.system = value;
2958          return this;
2959        }
2960
2961        /**
2962         * @return An absolute URI which is the code system in which the code for this item in the expansion is defined.
2963         */
2964        public String getSystem() { 
2965          return this.system == null ? null : this.system.getValue();
2966        }
2967
2968        /**
2969         * @param value An absolute URI which is the code system in which the code for this item in the expansion is defined.
2970         */
2971        public ValueSetExpansionContainsComponent setSystem(String value) { 
2972          if (Utilities.noString(value))
2973            this.system = null;
2974          else {
2975            if (this.system == null)
2976              this.system = new UriType();
2977            this.system.setValue(value);
2978          }
2979          return this;
2980        }
2981
2982        /**
2983         * @return {@link #abstract_} (If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value.). This is the underlying object with id, value and extensions. The accessor "getAbstract" gives direct access to the value
2984         */
2985        public BooleanType getAbstractElement() { 
2986          if (this.abstract_ == null)
2987            if (Configuration.errorOnAutoCreate())
2988              throw new Error("Attempt to auto-create ValueSetExpansionContainsComponent.abstract_");
2989            else if (Configuration.doAutoCreate())
2990              this.abstract_ = new BooleanType(); // bb
2991          return this.abstract_;
2992        }
2993
2994        public boolean hasAbstractElement() { 
2995          return this.abstract_ != null && !this.abstract_.isEmpty();
2996        }
2997
2998        public boolean hasAbstract() { 
2999          return this.abstract_ != null && !this.abstract_.isEmpty();
3000        }
3001
3002        /**
3003         * @param value {@link #abstract_} (If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value.). This is the underlying object with id, value and extensions. The accessor "getAbstract" gives direct access to the value
3004         */
3005        public ValueSetExpansionContainsComponent setAbstractElement(BooleanType value) { 
3006          this.abstract_ = value;
3007          return this;
3008        }
3009
3010        /**
3011         * @return If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value.
3012         */
3013        public boolean getAbstract() { 
3014          return this.abstract_ == null || this.abstract_.isEmpty() ? false : this.abstract_.getValue();
3015        }
3016
3017        /**
3018         * @param value If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value.
3019         */
3020        public ValueSetExpansionContainsComponent setAbstract(boolean value) { 
3021            if (this.abstract_ == null)
3022              this.abstract_ = new BooleanType();
3023            this.abstract_.setValue(value);
3024          return this;
3025        }
3026
3027        /**
3028         * @return {@link #inactive} (If the concept is inactive in the code system that defines it. Inactive codes are those that are no longer to be used, but are maintained by the code system for understanding legacy data.). This is the underlying object with id, value and extensions. The accessor "getInactive" gives direct access to the value
3029         */
3030        public BooleanType getInactiveElement() { 
3031          if (this.inactive == null)
3032            if (Configuration.errorOnAutoCreate())
3033              throw new Error("Attempt to auto-create ValueSetExpansionContainsComponent.inactive");
3034            else if (Configuration.doAutoCreate())
3035              this.inactive = new BooleanType(); // bb
3036          return this.inactive;
3037        }
3038
3039        public boolean hasInactiveElement() { 
3040          return this.inactive != null && !this.inactive.isEmpty();
3041        }
3042
3043        public boolean hasInactive() { 
3044          return this.inactive != null && !this.inactive.isEmpty();
3045        }
3046
3047        /**
3048         * @param value {@link #inactive} (If the concept is inactive in the code system that defines it. Inactive codes are those that are no longer to be used, but are maintained by the code system for understanding legacy data.). This is the underlying object with id, value and extensions. The accessor "getInactive" gives direct access to the value
3049         */
3050        public ValueSetExpansionContainsComponent setInactiveElement(BooleanType value) { 
3051          this.inactive = value;
3052          return this;
3053        }
3054
3055        /**
3056         * @return If the concept is inactive in the code system that defines it. Inactive codes are those that are no longer to be used, but are maintained by the code system for understanding legacy data.
3057         */
3058        public boolean getInactive() { 
3059          return this.inactive == null || this.inactive.isEmpty() ? false : this.inactive.getValue();
3060        }
3061
3062        /**
3063         * @param value If the concept is inactive in the code system that defines it. Inactive codes are those that are no longer to be used, but are maintained by the code system for understanding legacy data.
3064         */
3065        public ValueSetExpansionContainsComponent setInactive(boolean value) { 
3066            if (this.inactive == null)
3067              this.inactive = new BooleanType();
3068            this.inactive.setValue(value);
3069          return this;
3070        }
3071
3072        /**
3073         * @return {@link #version} (The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
3074         */
3075        public StringType getVersionElement() { 
3076          if (this.version == null)
3077            if (Configuration.errorOnAutoCreate())
3078              throw new Error("Attempt to auto-create ValueSetExpansionContainsComponent.version");
3079            else if (Configuration.doAutoCreate())
3080              this.version = new StringType(); // bb
3081          return this.version;
3082        }
3083
3084        public boolean hasVersionElement() { 
3085          return this.version != null && !this.version.isEmpty();
3086        }
3087
3088        public boolean hasVersion() { 
3089          return this.version != null && !this.version.isEmpty();
3090        }
3091
3092        /**
3093         * @param value {@link #version} (The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
3094         */
3095        public ValueSetExpansionContainsComponent setVersionElement(StringType value) { 
3096          this.version = value;
3097          return this;
3098        }
3099
3100        /**
3101         * @return The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence.
3102         */
3103        public String getVersion() { 
3104          return this.version == null ? null : this.version.getValue();
3105        }
3106
3107        /**
3108         * @param value The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence.
3109         */
3110        public ValueSetExpansionContainsComponent setVersion(String value) { 
3111          if (Utilities.noString(value))
3112            this.version = null;
3113          else {
3114            if (this.version == null)
3115              this.version = new StringType();
3116            this.version.setValue(value);
3117          }
3118          return this;
3119        }
3120
3121        /**
3122         * @return {@link #code} (The code for this item in the expansion hierarchy. If this code is missing the entry in the hierarchy is a place holder (abstract) and does not represent a valid code in the value set.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
3123         */
3124        public CodeType getCodeElement() { 
3125          if (this.code == null)
3126            if (Configuration.errorOnAutoCreate())
3127              throw new Error("Attempt to auto-create ValueSetExpansionContainsComponent.code");
3128            else if (Configuration.doAutoCreate())
3129              this.code = new CodeType(); // bb
3130          return this.code;
3131        }
3132
3133        public boolean hasCodeElement() { 
3134          return this.code != null && !this.code.isEmpty();
3135        }
3136
3137        public boolean hasCode() { 
3138          return this.code != null && !this.code.isEmpty();
3139        }
3140
3141        /**
3142         * @param value {@link #code} (The code for this item in the expansion hierarchy. If this code is missing the entry in the hierarchy is a place holder (abstract) and does not represent a valid code in the value set.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
3143         */
3144        public ValueSetExpansionContainsComponent setCodeElement(CodeType value) { 
3145          this.code = value;
3146          return this;
3147        }
3148
3149        /**
3150         * @return The code for this item in the expansion hierarchy. If this code is missing the entry in the hierarchy is a place holder (abstract) and does not represent a valid code in the value set.
3151         */
3152        public String getCode() { 
3153          return this.code == null ? null : this.code.getValue();
3154        }
3155
3156        /**
3157         * @param value The code for this item in the expansion hierarchy. If this code is missing the entry in the hierarchy is a place holder (abstract) and does not represent a valid code in the value set.
3158         */
3159        public ValueSetExpansionContainsComponent setCode(String value) { 
3160          if (Utilities.noString(value))
3161            this.code = null;
3162          else {
3163            if (this.code == null)
3164              this.code = new CodeType();
3165            this.code.setValue(value);
3166          }
3167          return this;
3168        }
3169
3170        /**
3171         * @return {@link #display} (The recommended display for this item in the expansion.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
3172         */
3173        public StringType getDisplayElement() { 
3174          if (this.display == null)
3175            if (Configuration.errorOnAutoCreate())
3176              throw new Error("Attempt to auto-create ValueSetExpansionContainsComponent.display");
3177            else if (Configuration.doAutoCreate())
3178              this.display = new StringType(); // bb
3179          return this.display;
3180        }
3181
3182        public boolean hasDisplayElement() { 
3183          return this.display != null && !this.display.isEmpty();
3184        }
3185
3186        public boolean hasDisplay() { 
3187          return this.display != null && !this.display.isEmpty();
3188        }
3189
3190        /**
3191         * @param value {@link #display} (The recommended display for this item in the expansion.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
3192         */
3193        public ValueSetExpansionContainsComponent setDisplayElement(StringType value) { 
3194          this.display = value;
3195          return this;
3196        }
3197
3198        /**
3199         * @return The recommended display for this item in the expansion.
3200         */
3201        public String getDisplay() { 
3202          return this.display == null ? null : this.display.getValue();
3203        }
3204
3205        /**
3206         * @param value The recommended display for this item in the expansion.
3207         */
3208        public ValueSetExpansionContainsComponent setDisplay(String value) { 
3209          if (Utilities.noString(value))
3210            this.display = null;
3211          else {
3212            if (this.display == null)
3213              this.display = new StringType();
3214            this.display.setValue(value);
3215          }
3216          return this;
3217        }
3218
3219        /**
3220         * @return {@link #designation} (Additional representations for this item - other languages, aliases, specialized purposes, used for particular purposes, etc. These are relevant when the conditions of the expansion do not fix to a single correct representation.)
3221         */
3222        public List<ConceptReferenceDesignationComponent> getDesignation() { 
3223          if (this.designation == null)
3224            this.designation = new ArrayList<ConceptReferenceDesignationComponent>();
3225          return this.designation;
3226        }
3227
3228        /**
3229         * @return Returns a reference to <code>this</code> for easy method chaining
3230         */
3231        public ValueSetExpansionContainsComponent setDesignation(List<ConceptReferenceDesignationComponent> theDesignation) { 
3232          this.designation = theDesignation;
3233          return this;
3234        }
3235
3236        public boolean hasDesignation() { 
3237          if (this.designation == null)
3238            return false;
3239          for (ConceptReferenceDesignationComponent item : this.designation)
3240            if (!item.isEmpty())
3241              return true;
3242          return false;
3243        }
3244
3245        public ConceptReferenceDesignationComponent addDesignation() { //3
3246          ConceptReferenceDesignationComponent t = new ConceptReferenceDesignationComponent();
3247          if (this.designation == null)
3248            this.designation = new ArrayList<ConceptReferenceDesignationComponent>();
3249          this.designation.add(t);
3250          return t;
3251        }
3252
3253        public ValueSetExpansionContainsComponent addDesignation(ConceptReferenceDesignationComponent t) { //3
3254          if (t == null)
3255            return this;
3256          if (this.designation == null)
3257            this.designation = new ArrayList<ConceptReferenceDesignationComponent>();
3258          this.designation.add(t);
3259          return this;
3260        }
3261
3262        /**
3263         * @return The first repetition of repeating field {@link #designation}, creating it if it does not already exist
3264         */
3265        public ConceptReferenceDesignationComponent getDesignationFirstRep() { 
3266          if (getDesignation().isEmpty()) {
3267            addDesignation();
3268          }
3269          return getDesignation().get(0);
3270        }
3271
3272        /**
3273         * @return {@link #contains} (Other codes and entries contained under this entry in the hierarchy.)
3274         */
3275        public List<ValueSetExpansionContainsComponent> getContains() { 
3276          if (this.contains == null)
3277            this.contains = new ArrayList<ValueSetExpansionContainsComponent>();
3278          return this.contains;
3279        }
3280
3281        /**
3282         * @return Returns a reference to <code>this</code> for easy method chaining
3283         */
3284        public ValueSetExpansionContainsComponent setContains(List<ValueSetExpansionContainsComponent> theContains) { 
3285          this.contains = theContains;
3286          return this;
3287        }
3288
3289        public boolean hasContains() { 
3290          if (this.contains == null)
3291            return false;
3292          for (ValueSetExpansionContainsComponent item : this.contains)
3293            if (!item.isEmpty())
3294              return true;
3295          return false;
3296        }
3297
3298        public ValueSetExpansionContainsComponent addContains() { //3
3299          ValueSetExpansionContainsComponent t = new ValueSetExpansionContainsComponent();
3300          if (this.contains == null)
3301            this.contains = new ArrayList<ValueSetExpansionContainsComponent>();
3302          this.contains.add(t);
3303          return t;
3304        }
3305
3306        public ValueSetExpansionContainsComponent addContains(ValueSetExpansionContainsComponent t) { //3
3307          if (t == null)
3308            return this;
3309          if (this.contains == null)
3310            this.contains = new ArrayList<ValueSetExpansionContainsComponent>();
3311          this.contains.add(t);
3312          return this;
3313        }
3314
3315        /**
3316         * @return The first repetition of repeating field {@link #contains}, creating it if it does not already exist
3317         */
3318        public ValueSetExpansionContainsComponent getContainsFirstRep() { 
3319          if (getContains().isEmpty()) {
3320            addContains();
3321          }
3322          return getContains().get(0);
3323        }
3324
3325        protected void listChildren(List<Property> childrenList) {
3326          super.listChildren(childrenList);
3327          childrenList.add(new Property("system", "uri", "An absolute URI which is the code system in which the code for this item in the expansion is defined.", 0, java.lang.Integer.MAX_VALUE, system));
3328          childrenList.add(new Property("abstract", "boolean", "If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value.", 0, java.lang.Integer.MAX_VALUE, abstract_));
3329          childrenList.add(new Property("inactive", "boolean", "If the concept is inactive in the code system that defines it. Inactive codes are those that are no longer to be used, but are maintained by the code system for understanding legacy data.", 0, java.lang.Integer.MAX_VALUE, inactive));
3330          childrenList.add(new Property("version", "string", "The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence.", 0, java.lang.Integer.MAX_VALUE, version));
3331          childrenList.add(new Property("code", "code", "The code for this item in the expansion hierarchy. If this code is missing the entry in the hierarchy is a place holder (abstract) and does not represent a valid code in the value set.", 0, java.lang.Integer.MAX_VALUE, code));
3332          childrenList.add(new Property("display", "string", "The recommended display for this item in the expansion.", 0, java.lang.Integer.MAX_VALUE, display));
3333          childrenList.add(new Property("designation", "@ValueSet.compose.include.concept.designation", "Additional representations for this item - other languages, aliases, specialized purposes, used for particular purposes, etc. These are relevant when the conditions of the expansion do not fix to a single correct representation.", 0, java.lang.Integer.MAX_VALUE, designation));
3334          childrenList.add(new Property("contains", "@ValueSet.expansion.contains", "Other codes and entries contained under this entry in the hierarchy.", 0, java.lang.Integer.MAX_VALUE, contains));
3335        }
3336
3337      @Override
3338      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3339        switch (hash) {
3340        case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // UriType
3341        case 1732898850: /*abstract*/ return this.abstract_ == null ? new Base[0] : new Base[] {this.abstract_}; // BooleanType
3342        case 24665195: /*inactive*/ return this.inactive == null ? new Base[0] : new Base[] {this.inactive}; // BooleanType
3343        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
3344        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeType
3345        case 1671764162: /*display*/ return this.display == null ? new Base[0] : new Base[] {this.display}; // StringType
3346        case -900931593: /*designation*/ return this.designation == null ? new Base[0] : this.designation.toArray(new Base[this.designation.size()]); // ConceptReferenceDesignationComponent
3347        case -567445985: /*contains*/ return this.contains == null ? new Base[0] : this.contains.toArray(new Base[this.contains.size()]); // ValueSetExpansionContainsComponent
3348        default: return super.getProperty(hash, name, checkValid);
3349        }
3350
3351      }
3352
3353      @Override
3354      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3355        switch (hash) {
3356        case -887328209: // system
3357          this.system = castToUri(value); // UriType
3358          return value;
3359        case 1732898850: // abstract
3360          this.abstract_ = castToBoolean(value); // BooleanType
3361          return value;
3362        case 24665195: // inactive
3363          this.inactive = castToBoolean(value); // BooleanType
3364          return value;
3365        case 351608024: // version
3366          this.version = castToString(value); // StringType
3367          return value;
3368        case 3059181: // code
3369          this.code = castToCode(value); // CodeType
3370          return value;
3371        case 1671764162: // display
3372          this.display = castToString(value); // StringType
3373          return value;
3374        case -900931593: // designation
3375          this.getDesignation().add((ConceptReferenceDesignationComponent) value); // ConceptReferenceDesignationComponent
3376          return value;
3377        case -567445985: // contains
3378          this.getContains().add((ValueSetExpansionContainsComponent) value); // ValueSetExpansionContainsComponent
3379          return value;
3380        default: return super.setProperty(hash, name, value);
3381        }
3382
3383      }
3384
3385      @Override
3386      public Base setProperty(String name, Base value) throws FHIRException {
3387        if (name.equals("system")) {
3388          this.system = castToUri(value); // UriType
3389        } else if (name.equals("abstract")) {
3390          this.abstract_ = castToBoolean(value); // BooleanType
3391        } else if (name.equals("inactive")) {
3392          this.inactive = castToBoolean(value); // BooleanType
3393        } else if (name.equals("version")) {
3394          this.version = castToString(value); // StringType
3395        } else if (name.equals("code")) {
3396          this.code = castToCode(value); // CodeType
3397        } else if (name.equals("display")) {
3398          this.display = castToString(value); // StringType
3399        } else if (name.equals("designation")) {
3400          this.getDesignation().add((ConceptReferenceDesignationComponent) value);
3401        } else if (name.equals("contains")) {
3402          this.getContains().add((ValueSetExpansionContainsComponent) value);
3403        } else
3404          return super.setProperty(name, value);
3405        return value;
3406      }
3407
3408      @Override
3409      public Base makeProperty(int hash, String name) throws FHIRException {
3410        switch (hash) {
3411        case -887328209:  return getSystemElement();
3412        case 1732898850:  return getAbstractElement();
3413        case 24665195:  return getInactiveElement();
3414        case 351608024:  return getVersionElement();
3415        case 3059181:  return getCodeElement();
3416        case 1671764162:  return getDisplayElement();
3417        case -900931593:  return addDesignation(); 
3418        case -567445985:  return addContains(); 
3419        default: return super.makeProperty(hash, name);
3420        }
3421
3422      }
3423
3424      @Override
3425      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3426        switch (hash) {
3427        case -887328209: /*system*/ return new String[] {"uri"};
3428        case 1732898850: /*abstract*/ return new String[] {"boolean"};
3429        case 24665195: /*inactive*/ return new String[] {"boolean"};
3430        case 351608024: /*version*/ return new String[] {"string"};
3431        case 3059181: /*code*/ return new String[] {"code"};
3432        case 1671764162: /*display*/ return new String[] {"string"};
3433        case -900931593: /*designation*/ return new String[] {"@ValueSet.compose.include.concept.designation"};
3434        case -567445985: /*contains*/ return new String[] {"@ValueSet.expansion.contains"};
3435        default: return super.getTypesForProperty(hash, name);
3436        }
3437
3438      }
3439
3440      @Override
3441      public Base addChild(String name) throws FHIRException {
3442        if (name.equals("system")) {
3443          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.system");
3444        }
3445        else if (name.equals("abstract")) {
3446          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.abstract");
3447        }
3448        else if (name.equals("inactive")) {
3449          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.inactive");
3450        }
3451        else if (name.equals("version")) {
3452          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.version");
3453        }
3454        else if (name.equals("code")) {
3455          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.code");
3456        }
3457        else if (name.equals("display")) {
3458          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.display");
3459        }
3460        else if (name.equals("designation")) {
3461          return addDesignation();
3462        }
3463        else if (name.equals("contains")) {
3464          return addContains();
3465        }
3466        else
3467          return super.addChild(name);
3468      }
3469
3470      public ValueSetExpansionContainsComponent copy() {
3471        ValueSetExpansionContainsComponent dst = new ValueSetExpansionContainsComponent();
3472        copyValues(dst);
3473        dst.system = system == null ? null : system.copy();
3474        dst.abstract_ = abstract_ == null ? null : abstract_.copy();
3475        dst.inactive = inactive == null ? null : inactive.copy();
3476        dst.version = version == null ? null : version.copy();
3477        dst.code = code == null ? null : code.copy();
3478        dst.display = display == null ? null : display.copy();
3479        if (designation != null) {
3480          dst.designation = new ArrayList<ConceptReferenceDesignationComponent>();
3481          for (ConceptReferenceDesignationComponent i : designation)
3482            dst.designation.add(i.copy());
3483        };
3484        if (contains != null) {
3485          dst.contains = new ArrayList<ValueSetExpansionContainsComponent>();
3486          for (ValueSetExpansionContainsComponent i : contains)
3487            dst.contains.add(i.copy());
3488        };
3489        return dst;
3490      }
3491
3492      @Override
3493      public boolean equalsDeep(Base other) {
3494        if (!super.equalsDeep(other))
3495          return false;
3496        if (!(other instanceof ValueSetExpansionContainsComponent))
3497          return false;
3498        ValueSetExpansionContainsComponent o = (ValueSetExpansionContainsComponent) other;
3499        return compareDeep(system, o.system, true) && compareDeep(abstract_, o.abstract_, true) && compareDeep(inactive, o.inactive, true)
3500           && compareDeep(version, o.version, true) && compareDeep(code, o.code, true) && compareDeep(display, o.display, true)
3501           && compareDeep(designation, o.designation, true) && compareDeep(contains, o.contains, true);
3502      }
3503
3504      @Override
3505      public boolean equalsShallow(Base other) {
3506        if (!super.equalsShallow(other))
3507          return false;
3508        if (!(other instanceof ValueSetExpansionContainsComponent))
3509          return false;
3510        ValueSetExpansionContainsComponent o = (ValueSetExpansionContainsComponent) other;
3511        return compareValues(system, o.system, true) && compareValues(abstract_, o.abstract_, true) && compareValues(inactive, o.inactive, true)
3512           && compareValues(version, o.version, true) && compareValues(code, o.code, true) && compareValues(display, o.display, true)
3513          ;
3514      }
3515
3516      public boolean isEmpty() {
3517        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(system, abstract_, inactive
3518          , version, code, display, designation, contains);
3519      }
3520
3521  public String fhirType() {
3522    return "ValueSet.expansion.contains";
3523
3524  }
3525
3526  }
3527
3528    /**
3529     * A formal identifier that is used to identify this value set when it is represented in other formats, or referenced in a specification, model, design or an instance.
3530     */
3531    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3532    @Description(shortDefinition="Additional identifier for the value set", formalDefinition="A formal identifier that is used to identify this value set when it is represented in other formats, or referenced in a specification, model, design or an instance." )
3533    protected List<Identifier> identifier;
3534
3535    /**
3536     * If this is set to 'true', then no new versions of the content logical definition can be created.  Note: Other metadata might still change.
3537     */
3538    @Child(name = "immutable", type = {BooleanType.class}, order=1, min=0, max=1, modifier=false, summary=true)
3539    @Description(shortDefinition="Indicates whether or not any change to the content logical definition may occur", formalDefinition="If this is set to 'true', then no new versions of the content logical definition can be created.  Note: Other metadata might still change." )
3540    protected BooleanType immutable;
3541
3542    /**
3543     * Explaination of why this value set is needed and why it has been designed as it has.
3544     */
3545    @Child(name = "purpose", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=false)
3546    @Description(shortDefinition="Why this value set is defined", formalDefinition="Explaination of why this value set is needed and why it has been designed as it has." )
3547    protected MarkdownType purpose;
3548
3549    /**
3550     * A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set.
3551     */
3552    @Child(name = "copyright", type = {MarkdownType.class}, order=3, min=0, max=1, modifier=false, summary=false)
3553    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set." )
3554    protected MarkdownType copyright;
3555
3556    /**
3557     * Whether this is intended to be used with an extensible binding or not.
3558     */
3559    @Child(name = "extensible", type = {BooleanType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3560    @Description(shortDefinition="Whether this is intended to be used with an extensible binding", formalDefinition="Whether this is intended to be used with an extensible binding or not." )
3561    protected BooleanType extensible;
3562
3563    /**
3564     * A set of criteria that define the content logical definition of the value set by including or excluding codes from outside this value set. This I also known as the "Content Logical Definition" (CLD).
3565     */
3566    @Child(name = "compose", type = {}, order=5, min=0, max=1, modifier=false, summary=false)
3567    @Description(shortDefinition="Definition of the content of the value set (CLD)", formalDefinition="A set of criteria that define the content logical definition of the value set by including or excluding codes from outside this value set. This I also known as the \"Content Logical Definition\" (CLD)." )
3568    protected ValueSetComposeComponent compose;
3569
3570    /**
3571     * A value set can also be "expanded", where the value set is turned into a simple collection of enumerated codes. This element holds the expansion, if it has been performed.
3572     */
3573    @Child(name = "expansion", type = {}, order=6, min=0, max=1, modifier=false, summary=false)
3574    @Description(shortDefinition="Used when the value set is \"expanded\"", formalDefinition="A value set can also be \"expanded\", where the value set is turned into a simple collection of enumerated codes. This element holds the expansion, if it has been performed." )
3575    protected ValueSetExpansionComponent expansion;
3576
3577    private static final long serialVersionUID = -173192200L;
3578
3579  /**
3580   * Constructor
3581   */
3582    public ValueSet() {
3583      super();
3584    }
3585
3586  /**
3587   * Constructor
3588   */
3589    public ValueSet(Enumeration<PublicationStatus> status) {
3590      super();
3591      this.status = status;
3592    }
3593
3594    /**
3595     * @return {@link #url} (An absolute URI that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published. The URL SHOULD include the major version of the value set. For more information see [Technical and Business Versions](resource.html#versions).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3596     */
3597    public UriType getUrlElement() { 
3598      if (this.url == null)
3599        if (Configuration.errorOnAutoCreate())
3600          throw new Error("Attempt to auto-create ValueSet.url");
3601        else if (Configuration.doAutoCreate())
3602          this.url = new UriType(); // bb
3603      return this.url;
3604    }
3605
3606    public boolean hasUrlElement() { 
3607      return this.url != null && !this.url.isEmpty();
3608    }
3609
3610    public boolean hasUrl() { 
3611      return this.url != null && !this.url.isEmpty();
3612    }
3613
3614    /**
3615     * @param value {@link #url} (An absolute URI that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published. The URL SHOULD include the major version of the value set. For more information see [Technical and Business Versions](resource.html#versions).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
3616     */
3617    public ValueSet setUrlElement(UriType value) { 
3618      this.url = value;
3619      return this;
3620    }
3621
3622    /**
3623     * @return An absolute URI that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published. The URL SHOULD include the major version of the value set. For more information see [Technical and Business Versions](resource.html#versions).
3624     */
3625    public String getUrl() { 
3626      return this.url == null ? null : this.url.getValue();
3627    }
3628
3629    /**
3630     * @param value An absolute URI that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published. The URL SHOULD include the major version of the value set. For more information see [Technical and Business Versions](resource.html#versions).
3631     */
3632    public ValueSet setUrl(String value) { 
3633      if (Utilities.noString(value))
3634        this.url = null;
3635      else {
3636        if (this.url == null)
3637          this.url = new UriType();
3638        this.url.setValue(value);
3639      }
3640      return this;
3641    }
3642
3643    /**
3644     * @return {@link #identifier} (A formal identifier that is used to identify this value set when it is represented in other formats, or referenced in a specification, model, design or an instance.)
3645     */
3646    public List<Identifier> getIdentifier() { 
3647      if (this.identifier == null)
3648        this.identifier = new ArrayList<Identifier>();
3649      return this.identifier;
3650    }
3651
3652    /**
3653     * @return Returns a reference to <code>this</code> for easy method chaining
3654     */
3655    public ValueSet setIdentifier(List<Identifier> theIdentifier) { 
3656      this.identifier = theIdentifier;
3657      return this;
3658    }
3659
3660    public boolean hasIdentifier() { 
3661      if (this.identifier == null)
3662        return false;
3663      for (Identifier item : this.identifier)
3664        if (!item.isEmpty())
3665          return true;
3666      return false;
3667    }
3668
3669    public Identifier addIdentifier() { //3
3670      Identifier t = new Identifier();
3671      if (this.identifier == null)
3672        this.identifier = new ArrayList<Identifier>();
3673      this.identifier.add(t);
3674      return t;
3675    }
3676
3677    public ValueSet addIdentifier(Identifier t) { //3
3678      if (t == null)
3679        return this;
3680      if (this.identifier == null)
3681        this.identifier = new ArrayList<Identifier>();
3682      this.identifier.add(t);
3683      return this;
3684    }
3685
3686    /**
3687     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
3688     */
3689    public Identifier getIdentifierFirstRep() { 
3690      if (getIdentifier().isEmpty()) {
3691        addIdentifier();
3692      }
3693      return getIdentifier().get(0);
3694    }
3695
3696    /**
3697     * @return {@link #version} (The identifier that is used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the value set author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
3698     */
3699    public StringType getVersionElement() { 
3700      if (this.version == null)
3701        if (Configuration.errorOnAutoCreate())
3702          throw new Error("Attempt to auto-create ValueSet.version");
3703        else if (Configuration.doAutoCreate())
3704          this.version = new StringType(); // bb
3705      return this.version;
3706    }
3707
3708    public boolean hasVersionElement() { 
3709      return this.version != null && !this.version.isEmpty();
3710    }
3711
3712    public boolean hasVersion() { 
3713      return this.version != null && !this.version.isEmpty();
3714    }
3715
3716    /**
3717     * @param value {@link #version} (The identifier that is used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the value set author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
3718     */
3719    public ValueSet setVersionElement(StringType value) { 
3720      this.version = value;
3721      return this;
3722    }
3723
3724    /**
3725     * @return The identifier that is used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the value set author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
3726     */
3727    public String getVersion() { 
3728      return this.version == null ? null : this.version.getValue();
3729    }
3730
3731    /**
3732     * @param value The identifier that is used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the value set author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
3733     */
3734    public ValueSet setVersion(String value) { 
3735      if (Utilities.noString(value))
3736        this.version = null;
3737      else {
3738        if (this.version == null)
3739          this.version = new StringType();
3740        this.version.setValue(value);
3741      }
3742      return this;
3743    }
3744
3745    /**
3746     * @return {@link #name} (A natural language name identifying the value set. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
3747     */
3748    public StringType getNameElement() { 
3749      if (this.name == null)
3750        if (Configuration.errorOnAutoCreate())
3751          throw new Error("Attempt to auto-create ValueSet.name");
3752        else if (Configuration.doAutoCreate())
3753          this.name = new StringType(); // bb
3754      return this.name;
3755    }
3756
3757    public boolean hasNameElement() { 
3758      return this.name != null && !this.name.isEmpty();
3759    }
3760
3761    public boolean hasName() { 
3762      return this.name != null && !this.name.isEmpty();
3763    }
3764
3765    /**
3766     * @param value {@link #name} (A natural language name identifying the value set. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
3767     */
3768    public ValueSet setNameElement(StringType value) { 
3769      this.name = value;
3770      return this;
3771    }
3772
3773    /**
3774     * @return A natural language name identifying the value set. This name should be usable as an identifier for the module by machine processing applications such as code generation.
3775     */
3776    public String getName() { 
3777      return this.name == null ? null : this.name.getValue();
3778    }
3779
3780    /**
3781     * @param value A natural language name identifying the value set. This name should be usable as an identifier for the module by machine processing applications such as code generation.
3782     */
3783    public ValueSet setName(String value) { 
3784      if (Utilities.noString(value))
3785        this.name = null;
3786      else {
3787        if (this.name == null)
3788          this.name = new StringType();
3789        this.name.setValue(value);
3790      }
3791      return this;
3792    }
3793
3794    /**
3795     * @return {@link #title} (A short, descriptive, user-friendly title for the value set.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3796     */
3797    public StringType getTitleElement() { 
3798      if (this.title == null)
3799        if (Configuration.errorOnAutoCreate())
3800          throw new Error("Attempt to auto-create ValueSet.title");
3801        else if (Configuration.doAutoCreate())
3802          this.title = new StringType(); // bb
3803      return this.title;
3804    }
3805
3806    public boolean hasTitleElement() { 
3807      return this.title != null && !this.title.isEmpty();
3808    }
3809
3810    public boolean hasTitle() { 
3811      return this.title != null && !this.title.isEmpty();
3812    }
3813
3814    /**
3815     * @param value {@link #title} (A short, descriptive, user-friendly title for the value set.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
3816     */
3817    public ValueSet setTitleElement(StringType value) { 
3818      this.title = value;
3819      return this;
3820    }
3821
3822    /**
3823     * @return A short, descriptive, user-friendly title for the value set.
3824     */
3825    public String getTitle() { 
3826      return this.title == null ? null : this.title.getValue();
3827    }
3828
3829    /**
3830     * @param value A short, descriptive, user-friendly title for the value set.
3831     */
3832    public ValueSet setTitle(String value) { 
3833      if (Utilities.noString(value))
3834        this.title = null;
3835      else {
3836        if (this.title == null)
3837          this.title = new StringType();
3838        this.title.setValue(value);
3839      }
3840      return this;
3841    }
3842
3843    /**
3844     * @return {@link #status} (The status of this value set. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
3845     */
3846    public Enumeration<PublicationStatus> getStatusElement() { 
3847      if (this.status == null)
3848        if (Configuration.errorOnAutoCreate())
3849          throw new Error("Attempt to auto-create ValueSet.status");
3850        else if (Configuration.doAutoCreate())
3851          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
3852      return this.status;
3853    }
3854
3855    public boolean hasStatusElement() { 
3856      return this.status != null && !this.status.isEmpty();
3857    }
3858
3859    public boolean hasStatus() { 
3860      return this.status != null && !this.status.isEmpty();
3861    }
3862
3863    /**
3864     * @param value {@link #status} (The status of this value set. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
3865     */
3866    public ValueSet setStatusElement(Enumeration<PublicationStatus> value) { 
3867      this.status = value;
3868      return this;
3869    }
3870
3871    /**
3872     * @return The status of this value set. Enables tracking the life-cycle of the content.
3873     */
3874    public PublicationStatus getStatus() { 
3875      return this.status == null ? null : this.status.getValue();
3876    }
3877
3878    /**
3879     * @param value The status of this value set. Enables tracking the life-cycle of the content.
3880     */
3881    public ValueSet setStatus(PublicationStatus value) { 
3882        if (this.status == null)
3883          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
3884        this.status.setValue(value);
3885      return this;
3886    }
3887
3888    /**
3889     * @return {@link #experimental} (A boolean value to indicate that this value set is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
3890     */
3891    public BooleanType getExperimentalElement() { 
3892      if (this.experimental == null)
3893        if (Configuration.errorOnAutoCreate())
3894          throw new Error("Attempt to auto-create ValueSet.experimental");
3895        else if (Configuration.doAutoCreate())
3896          this.experimental = new BooleanType(); // bb
3897      return this.experimental;
3898    }
3899
3900    public boolean hasExperimentalElement() { 
3901      return this.experimental != null && !this.experimental.isEmpty();
3902    }
3903
3904    public boolean hasExperimental() { 
3905      return this.experimental != null && !this.experimental.isEmpty();
3906    }
3907
3908    /**
3909     * @param value {@link #experimental} (A boolean value to indicate that this value set is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
3910     */
3911    public ValueSet setExperimentalElement(BooleanType value) { 
3912      this.experimental = value;
3913      return this;
3914    }
3915
3916    /**
3917     * @return A boolean value to indicate that this value set is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
3918     */
3919    public boolean getExperimental() { 
3920      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
3921    }
3922
3923    /**
3924     * @param value A boolean value to indicate that this value set is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
3925     */
3926    public ValueSet setExperimental(boolean value) { 
3927        if (this.experimental == null)
3928          this.experimental = new BooleanType();
3929        this.experimental.setValue(value);
3930      return this;
3931    }
3932
3933    /**
3934     * @return {@link #date} (The date  (and optionally time) when the value set was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the value set changes. (e.g. the 'content logical definition').). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3935     */
3936    public DateTimeType getDateElement() { 
3937      if (this.date == null)
3938        if (Configuration.errorOnAutoCreate())
3939          throw new Error("Attempt to auto-create ValueSet.date");
3940        else if (Configuration.doAutoCreate())
3941          this.date = new DateTimeType(); // bb
3942      return this.date;
3943    }
3944
3945    public boolean hasDateElement() { 
3946      return this.date != null && !this.date.isEmpty();
3947    }
3948
3949    public boolean hasDate() { 
3950      return this.date != null && !this.date.isEmpty();
3951    }
3952
3953    /**
3954     * @param value {@link #date} (The date  (and optionally time) when the value set was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the value set changes. (e.g. the 'content logical definition').). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3955     */
3956    public ValueSet setDateElement(DateTimeType value) { 
3957      this.date = value;
3958      return this;
3959    }
3960
3961    /**
3962     * @return The date  (and optionally time) when the value set was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the value set changes. (e.g. the 'content logical definition').
3963     */
3964    public Date getDate() { 
3965      return this.date == null ? null : this.date.getValue();
3966    }
3967
3968    /**
3969     * @param value The date  (and optionally time) when the value set was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the value set changes. (e.g. the 'content logical definition').
3970     */
3971    public ValueSet setDate(Date value) { 
3972      if (value == null)
3973        this.date = null;
3974      else {
3975        if (this.date == null)
3976          this.date = new DateTimeType();
3977        this.date.setValue(value);
3978      }
3979      return this;
3980    }
3981
3982    /**
3983     * @return {@link #publisher} (The name of the individual or organization that published the value set.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
3984     */
3985    public StringType getPublisherElement() { 
3986      if (this.publisher == null)
3987        if (Configuration.errorOnAutoCreate())
3988          throw new Error("Attempt to auto-create ValueSet.publisher");
3989        else if (Configuration.doAutoCreate())
3990          this.publisher = new StringType(); // bb
3991      return this.publisher;
3992    }
3993
3994    public boolean hasPublisherElement() { 
3995      return this.publisher != null && !this.publisher.isEmpty();
3996    }
3997
3998    public boolean hasPublisher() { 
3999      return this.publisher != null && !this.publisher.isEmpty();
4000    }
4001
4002    /**
4003     * @param value {@link #publisher} (The name of the individual or organization that published the value set.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
4004     */
4005    public ValueSet setPublisherElement(StringType value) { 
4006      this.publisher = value;
4007      return this;
4008    }
4009
4010    /**
4011     * @return The name of the individual or organization that published the value set.
4012     */
4013    public String getPublisher() { 
4014      return this.publisher == null ? null : this.publisher.getValue();
4015    }
4016
4017    /**
4018     * @param value The name of the individual or organization that published the value set.
4019     */
4020    public ValueSet setPublisher(String value) { 
4021      if (Utilities.noString(value))
4022        this.publisher = null;
4023      else {
4024        if (this.publisher == null)
4025          this.publisher = new StringType();
4026        this.publisher.setValue(value);
4027      }
4028      return this;
4029    }
4030
4031    /**
4032     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
4033     */
4034    public List<ContactDetail> getContact() { 
4035      if (this.contact == null)
4036        this.contact = new ArrayList<ContactDetail>();
4037      return this.contact;
4038    }
4039
4040    /**
4041     * @return Returns a reference to <code>this</code> for easy method chaining
4042     */
4043    public ValueSet setContact(List<ContactDetail> theContact) { 
4044      this.contact = theContact;
4045      return this;
4046    }
4047
4048    public boolean hasContact() { 
4049      if (this.contact == null)
4050        return false;
4051      for (ContactDetail item : this.contact)
4052        if (!item.isEmpty())
4053          return true;
4054      return false;
4055    }
4056
4057    public ContactDetail addContact() { //3
4058      ContactDetail t = new ContactDetail();
4059      if (this.contact == null)
4060        this.contact = new ArrayList<ContactDetail>();
4061      this.contact.add(t);
4062      return t;
4063    }
4064
4065    public ValueSet addContact(ContactDetail t) { //3
4066      if (t == null)
4067        return this;
4068      if (this.contact == null)
4069        this.contact = new ArrayList<ContactDetail>();
4070      this.contact.add(t);
4071      return this;
4072    }
4073
4074    /**
4075     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
4076     */
4077    public ContactDetail getContactFirstRep() { 
4078      if (getContact().isEmpty()) {
4079        addContact();
4080      }
4081      return getContact().get(0);
4082    }
4083
4084    /**
4085     * @return {@link #description} (A free text natural language description of the value set from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
4086     */
4087    public MarkdownType getDescriptionElement() { 
4088      if (this.description == null)
4089        if (Configuration.errorOnAutoCreate())
4090          throw new Error("Attempt to auto-create ValueSet.description");
4091        else if (Configuration.doAutoCreate())
4092          this.description = new MarkdownType(); // bb
4093      return this.description;
4094    }
4095
4096    public boolean hasDescriptionElement() { 
4097      return this.description != null && !this.description.isEmpty();
4098    }
4099
4100    public boolean hasDescription() { 
4101      return this.description != null && !this.description.isEmpty();
4102    }
4103
4104    /**
4105     * @param value {@link #description} (A free text natural language description of the value set from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
4106     */
4107    public ValueSet setDescriptionElement(MarkdownType value) { 
4108      this.description = value;
4109      return this;
4110    }
4111
4112    /**
4113     * @return A free text natural language description of the value set from a consumer's perspective.
4114     */
4115    public String getDescription() { 
4116      return this.description == null ? null : this.description.getValue();
4117    }
4118
4119    /**
4120     * @param value A free text natural language description of the value set from a consumer's perspective.
4121     */
4122    public ValueSet setDescription(String value) { 
4123      if (value == null)
4124        this.description = null;
4125      else {
4126        if (this.description == null)
4127          this.description = new MarkdownType();
4128        this.description.setValue(value);
4129      }
4130      return this;
4131    }
4132
4133    /**
4134     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate value set instances.)
4135     */
4136    public List<UsageContext> getUseContext() { 
4137      if (this.useContext == null)
4138        this.useContext = new ArrayList<UsageContext>();
4139      return this.useContext;
4140    }
4141
4142    /**
4143     * @return Returns a reference to <code>this</code> for easy method chaining
4144     */
4145    public ValueSet setUseContext(List<UsageContext> theUseContext) { 
4146      this.useContext = theUseContext;
4147      return this;
4148    }
4149
4150    public boolean hasUseContext() { 
4151      if (this.useContext == null)
4152        return false;
4153      for (UsageContext item : this.useContext)
4154        if (!item.isEmpty())
4155          return true;
4156      return false;
4157    }
4158
4159    public UsageContext addUseContext() { //3
4160      UsageContext t = new UsageContext();
4161      if (this.useContext == null)
4162        this.useContext = new ArrayList<UsageContext>();
4163      this.useContext.add(t);
4164      return t;
4165    }
4166
4167    public ValueSet addUseContext(UsageContext t) { //3
4168      if (t == null)
4169        return this;
4170      if (this.useContext == null)
4171        this.useContext = new ArrayList<UsageContext>();
4172      this.useContext.add(t);
4173      return this;
4174    }
4175
4176    /**
4177     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
4178     */
4179    public UsageContext getUseContextFirstRep() { 
4180      if (getUseContext().isEmpty()) {
4181        addUseContext();
4182      }
4183      return getUseContext().get(0);
4184    }
4185
4186    /**
4187     * @return {@link #jurisdiction} (A legal or geographic region in which the value set is intended to be used.)
4188     */
4189    public List<CodeableConcept> getJurisdiction() { 
4190      if (this.jurisdiction == null)
4191        this.jurisdiction = new ArrayList<CodeableConcept>();
4192      return this.jurisdiction;
4193    }
4194
4195    /**
4196     * @return Returns a reference to <code>this</code> for easy method chaining
4197     */
4198    public ValueSet setJurisdiction(List<CodeableConcept> theJurisdiction) { 
4199      this.jurisdiction = theJurisdiction;
4200      return this;
4201    }
4202
4203    public boolean hasJurisdiction() { 
4204      if (this.jurisdiction == null)
4205        return false;
4206      for (CodeableConcept item : this.jurisdiction)
4207        if (!item.isEmpty())
4208          return true;
4209      return false;
4210    }
4211
4212    public CodeableConcept addJurisdiction() { //3
4213      CodeableConcept t = new CodeableConcept();
4214      if (this.jurisdiction == null)
4215        this.jurisdiction = new ArrayList<CodeableConcept>();
4216      this.jurisdiction.add(t);
4217      return t;
4218    }
4219
4220    public ValueSet addJurisdiction(CodeableConcept t) { //3
4221      if (t == null)
4222        return this;
4223      if (this.jurisdiction == null)
4224        this.jurisdiction = new ArrayList<CodeableConcept>();
4225      this.jurisdiction.add(t);
4226      return this;
4227    }
4228
4229    /**
4230     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
4231     */
4232    public CodeableConcept getJurisdictionFirstRep() { 
4233      if (getJurisdiction().isEmpty()) {
4234        addJurisdiction();
4235      }
4236      return getJurisdiction().get(0);
4237    }
4238
4239    /**
4240     * @return {@link #immutable} (If this is set to 'true', then no new versions of the content logical definition can be created.  Note: Other metadata might still change.). This is the underlying object with id, value and extensions. The accessor "getImmutable" gives direct access to the value
4241     */
4242    public BooleanType getImmutableElement() { 
4243      if (this.immutable == null)
4244        if (Configuration.errorOnAutoCreate())
4245          throw new Error("Attempt to auto-create ValueSet.immutable");
4246        else if (Configuration.doAutoCreate())
4247          this.immutable = new BooleanType(); // bb
4248      return this.immutable;
4249    }
4250
4251    public boolean hasImmutableElement() { 
4252      return this.immutable != null && !this.immutable.isEmpty();
4253    }
4254
4255    public boolean hasImmutable() { 
4256      return this.immutable != null && !this.immutable.isEmpty();
4257    }
4258
4259    /**
4260     * @param value {@link #immutable} (If this is set to 'true', then no new versions of the content logical definition can be created.  Note: Other metadata might still change.). This is the underlying object with id, value and extensions. The accessor "getImmutable" gives direct access to the value
4261     */
4262    public ValueSet setImmutableElement(BooleanType value) { 
4263      this.immutable = value;
4264      return this;
4265    }
4266
4267    /**
4268     * @return If this is set to 'true', then no new versions of the content logical definition can be created.  Note: Other metadata might still change.
4269     */
4270    public boolean getImmutable() { 
4271      return this.immutable == null || this.immutable.isEmpty() ? false : this.immutable.getValue();
4272    }
4273
4274    /**
4275     * @param value If this is set to 'true', then no new versions of the content logical definition can be created.  Note: Other metadata might still change.
4276     */
4277    public ValueSet setImmutable(boolean value) { 
4278        if (this.immutable == null)
4279          this.immutable = new BooleanType();
4280        this.immutable.setValue(value);
4281      return this;
4282    }
4283
4284    /**
4285     * @return {@link #purpose} (Explaination of why this value set is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
4286     */
4287    public MarkdownType getPurposeElement() { 
4288      if (this.purpose == null)
4289        if (Configuration.errorOnAutoCreate())
4290          throw new Error("Attempt to auto-create ValueSet.purpose");
4291        else if (Configuration.doAutoCreate())
4292          this.purpose = new MarkdownType(); // bb
4293      return this.purpose;
4294    }
4295
4296    public boolean hasPurposeElement() { 
4297      return this.purpose != null && !this.purpose.isEmpty();
4298    }
4299
4300    public boolean hasPurpose() { 
4301      return this.purpose != null && !this.purpose.isEmpty();
4302    }
4303
4304    /**
4305     * @param value {@link #purpose} (Explaination of why this value set is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
4306     */
4307    public ValueSet setPurposeElement(MarkdownType value) { 
4308      this.purpose = value;
4309      return this;
4310    }
4311
4312    /**
4313     * @return Explaination of why this value set is needed and why it has been designed as it has.
4314     */
4315    public String getPurpose() { 
4316      return this.purpose == null ? null : this.purpose.getValue();
4317    }
4318
4319    /**
4320     * @param value Explaination of why this value set is needed and why it has been designed as it has.
4321     */
4322    public ValueSet setPurpose(String value) { 
4323      if (value == null)
4324        this.purpose = null;
4325      else {
4326        if (this.purpose == null)
4327          this.purpose = new MarkdownType();
4328        this.purpose.setValue(value);
4329      }
4330      return this;
4331    }
4332
4333    /**
4334     * @return {@link #copyright} (A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
4335     */
4336    public MarkdownType getCopyrightElement() { 
4337      if (this.copyright == null)
4338        if (Configuration.errorOnAutoCreate())
4339          throw new Error("Attempt to auto-create ValueSet.copyright");
4340        else if (Configuration.doAutoCreate())
4341          this.copyright = new MarkdownType(); // bb
4342      return this.copyright;
4343    }
4344
4345    public boolean hasCopyrightElement() { 
4346      return this.copyright != null && !this.copyright.isEmpty();
4347    }
4348
4349    public boolean hasCopyright() { 
4350      return this.copyright != null && !this.copyright.isEmpty();
4351    }
4352
4353    /**
4354     * @param value {@link #copyright} (A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
4355     */
4356    public ValueSet setCopyrightElement(MarkdownType value) { 
4357      this.copyright = value;
4358      return this;
4359    }
4360
4361    /**
4362     * @return A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set.
4363     */
4364    public String getCopyright() { 
4365      return this.copyright == null ? null : this.copyright.getValue();
4366    }
4367
4368    /**
4369     * @param value A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set.
4370     */
4371    public ValueSet setCopyright(String value) { 
4372      if (value == null)
4373        this.copyright = null;
4374      else {
4375        if (this.copyright == null)
4376          this.copyright = new MarkdownType();
4377        this.copyright.setValue(value);
4378      }
4379      return this;
4380    }
4381
4382    /**
4383     * @return {@link #extensible} (Whether this is intended to be used with an extensible binding or not.). This is the underlying object with id, value and extensions. The accessor "getExtensible" gives direct access to the value
4384     */
4385    public BooleanType getExtensibleElement() { 
4386      if (this.extensible == null)
4387        if (Configuration.errorOnAutoCreate())
4388          throw new Error("Attempt to auto-create ValueSet.extensible");
4389        else if (Configuration.doAutoCreate())
4390          this.extensible = new BooleanType(); // bb
4391      return this.extensible;
4392    }
4393
4394    public boolean hasExtensibleElement() { 
4395      return this.extensible != null && !this.extensible.isEmpty();
4396    }
4397
4398    public boolean hasExtensible() { 
4399      return this.extensible != null && !this.extensible.isEmpty();
4400    }
4401
4402    /**
4403     * @param value {@link #extensible} (Whether this is intended to be used with an extensible binding or not.). This is the underlying object with id, value and extensions. The accessor "getExtensible" gives direct access to the value
4404     */
4405    public ValueSet setExtensibleElement(BooleanType value) { 
4406      this.extensible = value;
4407      return this;
4408    }
4409
4410    /**
4411     * @return Whether this is intended to be used with an extensible binding or not.
4412     */
4413    public boolean getExtensible() { 
4414      return this.extensible == null || this.extensible.isEmpty() ? false : this.extensible.getValue();
4415    }
4416
4417    /**
4418     * @param value Whether this is intended to be used with an extensible binding or not.
4419     */
4420    public ValueSet setExtensible(boolean value) { 
4421        if (this.extensible == null)
4422          this.extensible = new BooleanType();
4423        this.extensible.setValue(value);
4424      return this;
4425    }
4426
4427    /**
4428     * @return {@link #compose} (A set of criteria that define the content logical definition of the value set by including or excluding codes from outside this value set. This I also known as the "Content Logical Definition" (CLD).)
4429     */
4430    public ValueSetComposeComponent getCompose() { 
4431      if (this.compose == null)
4432        if (Configuration.errorOnAutoCreate())
4433          throw new Error("Attempt to auto-create ValueSet.compose");
4434        else if (Configuration.doAutoCreate())
4435          this.compose = new ValueSetComposeComponent(); // cc
4436      return this.compose;
4437    }
4438
4439    public boolean hasCompose() { 
4440      return this.compose != null && !this.compose.isEmpty();
4441    }
4442
4443    /**
4444     * @param value {@link #compose} (A set of criteria that define the content logical definition of the value set by including or excluding codes from outside this value set. This I also known as the "Content Logical Definition" (CLD).)
4445     */
4446    public ValueSet setCompose(ValueSetComposeComponent value) { 
4447      this.compose = value;
4448      return this;
4449    }
4450
4451    /**
4452     * @return {@link #expansion} (A value set can also be "expanded", where the value set is turned into a simple collection of enumerated codes. This element holds the expansion, if it has been performed.)
4453     */
4454    public ValueSetExpansionComponent getExpansion() { 
4455      if (this.expansion == null)
4456        if (Configuration.errorOnAutoCreate())
4457          throw new Error("Attempt to auto-create ValueSet.expansion");
4458        else if (Configuration.doAutoCreate())
4459          this.expansion = new ValueSetExpansionComponent(); // cc
4460      return this.expansion;
4461    }
4462
4463    public boolean hasExpansion() { 
4464      return this.expansion != null && !this.expansion.isEmpty();
4465    }
4466
4467    /**
4468     * @param value {@link #expansion} (A value set can also be "expanded", where the value set is turned into a simple collection of enumerated codes. This element holds the expansion, if it has been performed.)
4469     */
4470    public ValueSet setExpansion(ValueSetExpansionComponent value) { 
4471      this.expansion = value;
4472      return this;
4473    }
4474
4475      protected void listChildren(List<Property> childrenList) {
4476        super.listChildren(childrenList);
4477        childrenList.add(new Property("url", "uri", "An absolute URI that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published. The URL SHOULD include the major version of the value set. For more information see [Technical and Business Versions](resource.html#versions).", 0, java.lang.Integer.MAX_VALUE, url));
4478        childrenList.add(new Property("identifier", "Identifier", "A formal identifier that is used to identify this value set when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
4479        childrenList.add(new Property("version", "string", "The identifier that is used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the value set author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.", 0, java.lang.Integer.MAX_VALUE, version));
4480        childrenList.add(new Property("name", "string", "A natural language name identifying the value set. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, java.lang.Integer.MAX_VALUE, name));
4481        childrenList.add(new Property("title", "string", "A short, descriptive, user-friendly title for the value set.", 0, java.lang.Integer.MAX_VALUE, title));
4482        childrenList.add(new Property("status", "code", "The status of this value set. Enables tracking the life-cycle of the content.", 0, java.lang.Integer.MAX_VALUE, status));
4483        childrenList.add(new Property("experimental", "boolean", "A boolean value to indicate that this value set is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, java.lang.Integer.MAX_VALUE, experimental));
4484        childrenList.add(new Property("date", "dateTime", "The date  (and optionally time) when the value set was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the value set changes. (e.g. the 'content logical definition').", 0, java.lang.Integer.MAX_VALUE, date));
4485        childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the value set.", 0, java.lang.Integer.MAX_VALUE, publisher));
4486        childrenList.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
4487        childrenList.add(new Property("description", "markdown", "A free text natural language description of the value set from a consumer's perspective.", 0, java.lang.Integer.MAX_VALUE, description));
4488        childrenList.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate value set instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
4489        childrenList.add(new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the value set is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
4490        childrenList.add(new Property("immutable", "boolean", "If this is set to 'true', then no new versions of the content logical definition can be created.  Note: Other metadata might still change.", 0, java.lang.Integer.MAX_VALUE, immutable));
4491        childrenList.add(new Property("purpose", "markdown", "Explaination of why this value set is needed and why it has been designed as it has.", 0, java.lang.Integer.MAX_VALUE, purpose));
4492        childrenList.add(new Property("copyright", "markdown", "A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set.", 0, java.lang.Integer.MAX_VALUE, copyright));
4493        childrenList.add(new Property("extensible", "boolean", "Whether this is intended to be used with an extensible binding or not.", 0, java.lang.Integer.MAX_VALUE, extensible));
4494        childrenList.add(new Property("compose", "", "A set of criteria that define the content logical definition of the value set by including or excluding codes from outside this value set. This I also known as the \"Content Logical Definition\" (CLD).", 0, java.lang.Integer.MAX_VALUE, compose));
4495        childrenList.add(new Property("expansion", "", "A value set can also be \"expanded\", where the value set is turned into a simple collection of enumerated codes. This element holds the expansion, if it has been performed.", 0, java.lang.Integer.MAX_VALUE, expansion));
4496      }
4497
4498      @Override
4499      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4500        switch (hash) {
4501        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
4502        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
4503        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
4504        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
4505        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
4506        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
4507        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
4508        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
4509        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
4510        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
4511        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
4512        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
4513        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
4514        case 1596987778: /*immutable*/ return this.immutable == null ? new Base[0] : new Base[] {this.immutable}; // BooleanType
4515        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
4516        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
4517        case -1809433861: /*extensible*/ return this.extensible == null ? new Base[0] : new Base[] {this.extensible}; // BooleanType
4518        case 950497682: /*compose*/ return this.compose == null ? new Base[0] : new Base[] {this.compose}; // ValueSetComposeComponent
4519        case 17878207: /*expansion*/ return this.expansion == null ? new Base[0] : new Base[] {this.expansion}; // ValueSetExpansionComponent
4520        default: return super.getProperty(hash, name, checkValid);
4521        }
4522
4523      }
4524
4525      @Override
4526      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4527        switch (hash) {
4528        case 116079: // url
4529          this.url = castToUri(value); // UriType
4530          return value;
4531        case -1618432855: // identifier
4532          this.getIdentifier().add(castToIdentifier(value)); // Identifier
4533          return value;
4534        case 351608024: // version
4535          this.version = castToString(value); // StringType
4536          return value;
4537        case 3373707: // name
4538          this.name = castToString(value); // StringType
4539          return value;
4540        case 110371416: // title
4541          this.title = castToString(value); // StringType
4542          return value;
4543        case -892481550: // status
4544          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
4545          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4546          return value;
4547        case -404562712: // experimental
4548          this.experimental = castToBoolean(value); // BooleanType
4549          return value;
4550        case 3076014: // date
4551          this.date = castToDateTime(value); // DateTimeType
4552          return value;
4553        case 1447404028: // publisher
4554          this.publisher = castToString(value); // StringType
4555          return value;
4556        case 951526432: // contact
4557          this.getContact().add(castToContactDetail(value)); // ContactDetail
4558          return value;
4559        case -1724546052: // description
4560          this.description = castToMarkdown(value); // MarkdownType
4561          return value;
4562        case -669707736: // useContext
4563          this.getUseContext().add(castToUsageContext(value)); // UsageContext
4564          return value;
4565        case -507075711: // jurisdiction
4566          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
4567          return value;
4568        case 1596987778: // immutable
4569          this.immutable = castToBoolean(value); // BooleanType
4570          return value;
4571        case -220463842: // purpose
4572          this.purpose = castToMarkdown(value); // MarkdownType
4573          return value;
4574        case 1522889671: // copyright
4575          this.copyright = castToMarkdown(value); // MarkdownType
4576          return value;
4577        case -1809433861: // extensible
4578          this.extensible = castToBoolean(value); // BooleanType
4579          return value;
4580        case 950497682: // compose
4581          this.compose = (ValueSetComposeComponent) value; // ValueSetComposeComponent
4582          return value;
4583        case 17878207: // expansion
4584          this.expansion = (ValueSetExpansionComponent) value; // ValueSetExpansionComponent
4585          return value;
4586        default: return super.setProperty(hash, name, value);
4587        }
4588
4589      }
4590
4591      @Override
4592      public Base setProperty(String name, Base value) throws FHIRException {
4593        if (name.equals("url")) {
4594          this.url = castToUri(value); // UriType
4595        } else if (name.equals("identifier")) {
4596          this.getIdentifier().add(castToIdentifier(value));
4597        } else if (name.equals("version")) {
4598          this.version = castToString(value); // StringType
4599        } else if (name.equals("name")) {
4600          this.name = castToString(value); // StringType
4601        } else if (name.equals("title")) {
4602          this.title = castToString(value); // StringType
4603        } else if (name.equals("status")) {
4604          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
4605          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
4606        } else if (name.equals("experimental")) {
4607          this.experimental = castToBoolean(value); // BooleanType
4608        } else if (name.equals("date")) {
4609          this.date = castToDateTime(value); // DateTimeType
4610        } else if (name.equals("publisher")) {
4611          this.publisher = castToString(value); // StringType
4612        } else if (name.equals("contact")) {
4613          this.getContact().add(castToContactDetail(value));
4614        } else if (name.equals("description")) {
4615          this.description = castToMarkdown(value); // MarkdownType
4616        } else if (name.equals("useContext")) {
4617          this.getUseContext().add(castToUsageContext(value));
4618        } else if (name.equals("jurisdiction")) {
4619          this.getJurisdiction().add(castToCodeableConcept(value));
4620        } else if (name.equals("immutable")) {
4621          this.immutable = castToBoolean(value); // BooleanType
4622        } else if (name.equals("purpose")) {
4623          this.purpose = castToMarkdown(value); // MarkdownType
4624        } else if (name.equals("copyright")) {
4625          this.copyright = castToMarkdown(value); // MarkdownType
4626        } else if (name.equals("extensible")) {
4627          this.extensible = castToBoolean(value); // BooleanType
4628        } else if (name.equals("compose")) {
4629          this.compose = (ValueSetComposeComponent) value; // ValueSetComposeComponent
4630        } else if (name.equals("expansion")) {
4631          this.expansion = (ValueSetExpansionComponent) value; // ValueSetExpansionComponent
4632        } else
4633          return super.setProperty(name, value);
4634        return value;
4635      }
4636
4637      @Override
4638      public Base makeProperty(int hash, String name) throws FHIRException {
4639        switch (hash) {
4640        case 116079:  return getUrlElement();
4641        case -1618432855:  return addIdentifier(); 
4642        case 351608024:  return getVersionElement();
4643        case 3373707:  return getNameElement();
4644        case 110371416:  return getTitleElement();
4645        case -892481550:  return getStatusElement();
4646        case -404562712:  return getExperimentalElement();
4647        case 3076014:  return getDateElement();
4648        case 1447404028:  return getPublisherElement();
4649        case 951526432:  return addContact(); 
4650        case -1724546052:  return getDescriptionElement();
4651        case -669707736:  return addUseContext(); 
4652        case -507075711:  return addJurisdiction(); 
4653        case 1596987778:  return getImmutableElement();
4654        case -220463842:  return getPurposeElement();
4655        case 1522889671:  return getCopyrightElement();
4656        case -1809433861:  return getExtensibleElement();
4657        case 950497682:  return getCompose(); 
4658        case 17878207:  return getExpansion(); 
4659        default: return super.makeProperty(hash, name);
4660        }
4661
4662      }
4663
4664      @Override
4665      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4666        switch (hash) {
4667        case 116079: /*url*/ return new String[] {"uri"};
4668        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
4669        case 351608024: /*version*/ return new String[] {"string"};
4670        case 3373707: /*name*/ return new String[] {"string"};
4671        case 110371416: /*title*/ return new String[] {"string"};
4672        case -892481550: /*status*/ return new String[] {"code"};
4673        case -404562712: /*experimental*/ return new String[] {"boolean"};
4674        case 3076014: /*date*/ return new String[] {"dateTime"};
4675        case 1447404028: /*publisher*/ return new String[] {"string"};
4676        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
4677        case -1724546052: /*description*/ return new String[] {"markdown"};
4678        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
4679        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
4680        case 1596987778: /*immutable*/ return new String[] {"boolean"};
4681        case -220463842: /*purpose*/ return new String[] {"markdown"};
4682        case 1522889671: /*copyright*/ return new String[] {"markdown"};
4683        case -1809433861: /*extensible*/ return new String[] {"boolean"};
4684        case 950497682: /*compose*/ return new String[] {};
4685        case 17878207: /*expansion*/ return new String[] {};
4686        default: return super.getTypesForProperty(hash, name);
4687        }
4688
4689      }
4690
4691      @Override
4692      public Base addChild(String name) throws FHIRException {
4693        if (name.equals("url")) {
4694          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.url");
4695        }
4696        else if (name.equals("identifier")) {
4697          return addIdentifier();
4698        }
4699        else if (name.equals("version")) {
4700          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.version");
4701        }
4702        else if (name.equals("name")) {
4703          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.name");
4704        }
4705        else if (name.equals("title")) {
4706          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.title");
4707        }
4708        else if (name.equals("status")) {
4709          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.status");
4710        }
4711        else if (name.equals("experimental")) {
4712          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.experimental");
4713        }
4714        else if (name.equals("date")) {
4715          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.date");
4716        }
4717        else if (name.equals("publisher")) {
4718          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.publisher");
4719        }
4720        else if (name.equals("contact")) {
4721          return addContact();
4722        }
4723        else if (name.equals("description")) {
4724          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.description");
4725        }
4726        else if (name.equals("useContext")) {
4727          return addUseContext();
4728        }
4729        else if (name.equals("jurisdiction")) {
4730          return addJurisdiction();
4731        }
4732        else if (name.equals("immutable")) {
4733          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.immutable");
4734        }
4735        else if (name.equals("purpose")) {
4736          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.purpose");
4737        }
4738        else if (name.equals("copyright")) {
4739          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.copyright");
4740        }
4741        else if (name.equals("extensible")) {
4742          throw new FHIRException("Cannot call addChild on a primitive type ValueSet.extensible");
4743        }
4744        else if (name.equals("compose")) {
4745          this.compose = new ValueSetComposeComponent();
4746          return this.compose;
4747        }
4748        else if (name.equals("expansion")) {
4749          this.expansion = new ValueSetExpansionComponent();
4750          return this.expansion;
4751        }
4752        else
4753          return super.addChild(name);
4754      }
4755
4756  public String fhirType() {
4757    return "ValueSet";
4758
4759  }
4760
4761      public ValueSet copy() {
4762        ValueSet dst = new ValueSet();
4763        copyValues(dst);
4764        dst.url = url == null ? null : url.copy();
4765        if (identifier != null) {
4766          dst.identifier = new ArrayList<Identifier>();
4767          for (Identifier i : identifier)
4768            dst.identifier.add(i.copy());
4769        };
4770        dst.version = version == null ? null : version.copy();
4771        dst.name = name == null ? null : name.copy();
4772        dst.title = title == null ? null : title.copy();
4773        dst.status = status == null ? null : status.copy();
4774        dst.experimental = experimental == null ? null : experimental.copy();
4775        dst.date = date == null ? null : date.copy();
4776        dst.publisher = publisher == null ? null : publisher.copy();
4777        if (contact != null) {
4778          dst.contact = new ArrayList<ContactDetail>();
4779          for (ContactDetail i : contact)
4780            dst.contact.add(i.copy());
4781        };
4782        dst.description = description == null ? null : description.copy();
4783        if (useContext != null) {
4784          dst.useContext = new ArrayList<UsageContext>();
4785          for (UsageContext i : useContext)
4786            dst.useContext.add(i.copy());
4787        };
4788        if (jurisdiction != null) {
4789          dst.jurisdiction = new ArrayList<CodeableConcept>();
4790          for (CodeableConcept i : jurisdiction)
4791            dst.jurisdiction.add(i.copy());
4792        };
4793        dst.immutable = immutable == null ? null : immutable.copy();
4794        dst.purpose = purpose == null ? null : purpose.copy();
4795        dst.copyright = copyright == null ? null : copyright.copy();
4796        dst.extensible = extensible == null ? null : extensible.copy();
4797        dst.compose = compose == null ? null : compose.copy();
4798        dst.expansion = expansion == null ? null : expansion.copy();
4799        return dst;
4800      }
4801
4802      protected ValueSet typedCopy() {
4803        return copy();
4804      }
4805
4806      @Override
4807      public boolean equalsDeep(Base other) {
4808        if (!super.equalsDeep(other))
4809          return false;
4810        if (!(other instanceof ValueSet))
4811          return false;
4812        ValueSet o = (ValueSet) other;
4813        return compareDeep(identifier, o.identifier, true) && compareDeep(immutable, o.immutable, true)
4814           && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true) && compareDeep(extensible, o.extensible, true)
4815           && compareDeep(compose, o.compose, true) && compareDeep(expansion, o.expansion, true);
4816      }
4817
4818      @Override
4819      public boolean equalsShallow(Base other) {
4820        if (!super.equalsShallow(other))
4821          return false;
4822        if (!(other instanceof ValueSet))
4823          return false;
4824        ValueSet o = (ValueSet) other;
4825        return compareValues(immutable, o.immutable, true) && compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true)
4826           && compareValues(extensible, o.extensible, true);
4827      }
4828
4829      public boolean isEmpty() {
4830        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, immutable, purpose
4831          , copyright, extensible, compose, expansion);
4832      }
4833
4834  @Override
4835  public ResourceType getResourceType() {
4836    return ResourceType.ValueSet;
4837   }
4838
4839 /**
4840   * Search parameter: <b>date</b>
4841   * <p>
4842   * Description: <b>The value set publication date</b><br>
4843   * Type: <b>date</b><br>
4844   * Path: <b>ValueSet.date</b><br>
4845   * </p>
4846   */
4847  @SearchParamDefinition(name="date", path="ValueSet.date", description="The value set publication date", type="date" )
4848  public static final String SP_DATE = "date";
4849 /**
4850   * <b>Fluent Client</b> search parameter constant for <b>date</b>
4851   * <p>
4852   * Description: <b>The value set publication date</b><br>
4853   * Type: <b>date</b><br>
4854   * Path: <b>ValueSet.date</b><br>
4855   * </p>
4856   */
4857  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
4858
4859 /**
4860   * Search parameter: <b>reference</b>
4861   * <p>
4862   * Description: <b>A code system included or excluded in the value set or an imported value set</b><br>
4863   * Type: <b>uri</b><br>
4864   * Path: <b>ValueSet.compose.include.system</b><br>
4865   * </p>
4866   */
4867  @SearchParamDefinition(name="reference", path="ValueSet.compose.include.system", description="A code system included or excluded in the value set or an imported value set", type="uri" )
4868  public static final String SP_REFERENCE = "reference";
4869 /**
4870   * <b>Fluent Client</b> search parameter constant for <b>reference</b>
4871   * <p>
4872   * Description: <b>A code system included or excluded in the value set or an imported value set</b><br>
4873   * Type: <b>uri</b><br>
4874   * Path: <b>ValueSet.compose.include.system</b><br>
4875   * </p>
4876   */
4877  public static final ca.uhn.fhir.rest.gclient.UriClientParam REFERENCE = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_REFERENCE);
4878
4879 /**
4880   * Search parameter: <b>identifier</b>
4881   * <p>
4882   * Description: <b>External identifier for the value set</b><br>
4883   * Type: <b>token</b><br>
4884   * Path: <b>ValueSet.identifier</b><br>
4885   * </p>
4886   */
4887  @SearchParamDefinition(name="identifier", path="ValueSet.identifier", description="External identifier for the value set", type="token" )
4888  public static final String SP_IDENTIFIER = "identifier";
4889 /**
4890   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
4891   * <p>
4892   * Description: <b>External identifier for the value set</b><br>
4893   * Type: <b>token</b><br>
4894   * Path: <b>ValueSet.identifier</b><br>
4895   * </p>
4896   */
4897  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
4898
4899 /**
4900   * Search parameter: <b>jurisdiction</b>
4901   * <p>
4902   * Description: <b>Intended jurisdiction for the value set</b><br>
4903   * Type: <b>token</b><br>
4904   * Path: <b>ValueSet.jurisdiction</b><br>
4905   * </p>
4906   */
4907  @SearchParamDefinition(name="jurisdiction", path="ValueSet.jurisdiction", description="Intended jurisdiction for the value set", type="token" )
4908  public static final String SP_JURISDICTION = "jurisdiction";
4909 /**
4910   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
4911   * <p>
4912   * Description: <b>Intended jurisdiction for the value set</b><br>
4913   * Type: <b>token</b><br>
4914   * Path: <b>ValueSet.jurisdiction</b><br>
4915   * </p>
4916   */
4917  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
4918
4919 /**
4920   * Search parameter: <b>name</b>
4921   * <p>
4922   * Description: <b>Computationally friendly name of the value set</b><br>
4923   * Type: <b>string</b><br>
4924   * Path: <b>ValueSet.name</b><br>
4925   * </p>
4926   */
4927  @SearchParamDefinition(name="name", path="ValueSet.name", description="Computationally friendly name of the value set", type="string" )
4928  public static final String SP_NAME = "name";
4929 /**
4930   * <b>Fluent Client</b> search parameter constant for <b>name</b>
4931   * <p>
4932   * Description: <b>Computationally friendly name of the value set</b><br>
4933   * Type: <b>string</b><br>
4934   * Path: <b>ValueSet.name</b><br>
4935   * </p>
4936   */
4937  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
4938
4939 /**
4940   * Search parameter: <b>description</b>
4941   * <p>
4942   * Description: <b>The description of the value set</b><br>
4943   * Type: <b>string</b><br>
4944   * Path: <b>ValueSet.description</b><br>
4945   * </p>
4946   */
4947  @SearchParamDefinition(name="description", path="ValueSet.description", description="The description of the value set", type="string" )
4948  public static final String SP_DESCRIPTION = "description";
4949 /**
4950   * <b>Fluent Client</b> search parameter constant for <b>description</b>
4951   * <p>
4952   * Description: <b>The description of the value set</b><br>
4953   * Type: <b>string</b><br>
4954   * Path: <b>ValueSet.description</b><br>
4955   * </p>
4956   */
4957  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
4958
4959 /**
4960   * Search parameter: <b>publisher</b>
4961   * <p>
4962   * Description: <b>Name of the publisher of the value set</b><br>
4963   * Type: <b>string</b><br>
4964   * Path: <b>ValueSet.publisher</b><br>
4965   * </p>
4966   */
4967  @SearchParamDefinition(name="publisher", path="ValueSet.publisher", description="Name of the publisher of the value set", type="string" )
4968  public static final String SP_PUBLISHER = "publisher";
4969 /**
4970   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
4971   * <p>
4972   * Description: <b>Name of the publisher of the value set</b><br>
4973   * Type: <b>string</b><br>
4974   * Path: <b>ValueSet.publisher</b><br>
4975   * </p>
4976   */
4977  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
4978
4979 /**
4980   * Search parameter: <b>title</b>
4981   * <p>
4982   * Description: <b>The human-friendly name of the value set</b><br>
4983   * Type: <b>string</b><br>
4984   * Path: <b>ValueSet.title</b><br>
4985   * </p>
4986   */
4987  @SearchParamDefinition(name="title", path="ValueSet.title", description="The human-friendly name of the value set", type="string" )
4988  public static final String SP_TITLE = "title";
4989 /**
4990   * <b>Fluent Client</b> search parameter constant for <b>title</b>
4991   * <p>
4992   * Description: <b>The human-friendly name of the value set</b><br>
4993   * Type: <b>string</b><br>
4994   * Path: <b>ValueSet.title</b><br>
4995   * </p>
4996   */
4997  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
4998
4999 /**
5000   * Search parameter: <b>version</b>
5001   * <p>
5002   * Description: <b>The business version of the value set</b><br>
5003   * Type: <b>token</b><br>
5004   * Path: <b>ValueSet.version</b><br>
5005   * </p>
5006   */
5007  @SearchParamDefinition(name="version", path="ValueSet.version", description="The business version of the value set", type="token" )
5008  public static final String SP_VERSION = "version";
5009 /**
5010   * <b>Fluent Client</b> search parameter constant for <b>version</b>
5011   * <p>
5012   * Description: <b>The business version of the value set</b><br>
5013   * Type: <b>token</b><br>
5014   * Path: <b>ValueSet.version</b><br>
5015   * </p>
5016   */
5017  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
5018
5019 /**
5020   * Search parameter: <b>url</b>
5021   * <p>
5022   * Description: <b>The uri that identifies the value set</b><br>
5023   * Type: <b>uri</b><br>
5024   * Path: <b>ValueSet.url</b><br>
5025   * </p>
5026   */
5027  @SearchParamDefinition(name="url", path="ValueSet.url", description="The uri that identifies the value set", type="uri" )
5028  public static final String SP_URL = "url";
5029 /**
5030   * <b>Fluent Client</b> search parameter constant for <b>url</b>
5031   * <p>
5032   * Description: <b>The uri that identifies the value set</b><br>
5033   * Type: <b>uri</b><br>
5034   * Path: <b>ValueSet.url</b><br>
5035   * </p>
5036   */
5037  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
5038
5039 /**
5040   * Search parameter: <b>status</b>
5041   * <p>
5042   * Description: <b>The current status of the value set</b><br>
5043   * Type: <b>token</b><br>
5044   * Path: <b>ValueSet.status</b><br>
5045   * </p>
5046   */
5047  @SearchParamDefinition(name="status", path="ValueSet.status", description="The current status of the value set", type="token" )
5048  public static final String SP_STATUS = "status";
5049 /**
5050   * <b>Fluent Client</b> search parameter constant for <b>status</b>
5051   * <p>
5052   * Description: <b>The current status of the value set</b><br>
5053   * Type: <b>token</b><br>
5054   * Path: <b>ValueSet.status</b><br>
5055   * </p>
5056   */
5057  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
5058
5059 /**
5060   * Search parameter: <b>expansion</b>
5061   * <p>
5062   * Description: <b>Uniquely identifies this expansion</b><br>
5063   * Type: <b>uri</b><br>
5064   * Path: <b>ValueSet.expansion.identifier</b><br>
5065   * </p>
5066   */
5067  @SearchParamDefinition(name="expansion", path="ValueSet.expansion.identifier", description="Uniquely identifies this expansion", type="uri" )
5068  public static final String SP_EXPANSION = "expansion";
5069 /**
5070   * <b>Fluent Client</b> search parameter constant for <b>expansion</b>
5071   * <p>
5072   * Description: <b>Uniquely identifies this expansion</b><br>
5073   * Type: <b>uri</b><br>
5074   * Path: <b>ValueSet.expansion.identifier</b><br>
5075   * </p>
5076   */
5077  public static final ca.uhn.fhir.rest.gclient.UriClientParam EXPANSION = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_EXPANSION);
5078
5079
5080}
5081