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