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