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