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