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