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