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