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.List;
035
036import org.hl7.fhir.exceptions.FHIRException;
037import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
038import org.hl7.fhir.utilities.Utilities;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044/**
045 * The ModuleDefinition resource defines the data requirements for a quality artifact.
046 */
047@ResourceDef(name="ModuleDefinition", profile="http://hl7.org/fhir/Profile/ModuleDefinition")
048public class ModuleDefinition extends DomainResource {
049
050    @Block()
051    public static class ModuleDefinitionModelComponent extends BackboneElement implements IBaseBackboneElement {
052        /**
053         * The name of the model.
054         */
055        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
056        @Description(shortDefinition="", formalDefinition="The name of the model." )
057        protected StringType name;
058
059        /**
060         * The identifier of the model.
061         */
062        @Child(name = "identifier", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=false)
063        @Description(shortDefinition="", formalDefinition="The identifier of the model." )
064        protected StringType identifier;
065
066        /**
067         * The version of the model.
068         */
069        @Child(name = "version", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
070        @Description(shortDefinition="", formalDefinition="The version of the model." )
071        protected StringType version;
072
073        private static final long serialVersionUID = -862601139L;
074
075    /**
076     * Constructor
077     */
078      public ModuleDefinitionModelComponent() {
079        super();
080      }
081
082    /**
083     * Constructor
084     */
085      public ModuleDefinitionModelComponent(StringType identifier) {
086        super();
087        this.identifier = identifier;
088      }
089
090        /**
091         * @return {@link #name} (The name of the model.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
092         */
093        public StringType getNameElement() { 
094          if (this.name == null)
095            if (Configuration.errorOnAutoCreate())
096              throw new Error("Attempt to auto-create ModuleDefinitionModelComponent.name");
097            else if (Configuration.doAutoCreate())
098              this.name = new StringType(); // bb
099          return this.name;
100        }
101
102        public boolean hasNameElement() { 
103          return this.name != null && !this.name.isEmpty();
104        }
105
106        public boolean hasName() { 
107          return this.name != null && !this.name.isEmpty();
108        }
109
110        /**
111         * @param value {@link #name} (The name of the model.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
112         */
113        public ModuleDefinitionModelComponent setNameElement(StringType value) { 
114          this.name = value;
115          return this;
116        }
117
118        /**
119         * @return The name of the model.
120         */
121        public String getName() { 
122          return this.name == null ? null : this.name.getValue();
123        }
124
125        /**
126         * @param value The name of the model.
127         */
128        public ModuleDefinitionModelComponent setName(String value) { 
129          if (Utilities.noString(value))
130            this.name = null;
131          else {
132            if (this.name == null)
133              this.name = new StringType();
134            this.name.setValue(value);
135          }
136          return this;
137        }
138
139        /**
140         * @return {@link #identifier} (The identifier of the model.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
141         */
142        public StringType getIdentifierElement() { 
143          if (this.identifier == null)
144            if (Configuration.errorOnAutoCreate())
145              throw new Error("Attempt to auto-create ModuleDefinitionModelComponent.identifier");
146            else if (Configuration.doAutoCreate())
147              this.identifier = new StringType(); // bb
148          return this.identifier;
149        }
150
151        public boolean hasIdentifierElement() { 
152          return this.identifier != null && !this.identifier.isEmpty();
153        }
154
155        public boolean hasIdentifier() { 
156          return this.identifier != null && !this.identifier.isEmpty();
157        }
158
159        /**
160         * @param value {@link #identifier} (The identifier of the model.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
161         */
162        public ModuleDefinitionModelComponent setIdentifierElement(StringType value) { 
163          this.identifier = value;
164          return this;
165        }
166
167        /**
168         * @return The identifier of the model.
169         */
170        public String getIdentifier() { 
171          return this.identifier == null ? null : this.identifier.getValue();
172        }
173
174        /**
175         * @param value The identifier of the model.
176         */
177        public ModuleDefinitionModelComponent setIdentifier(String value) { 
178            if (this.identifier == null)
179              this.identifier = new StringType();
180            this.identifier.setValue(value);
181          return this;
182        }
183
184        /**
185         * @return {@link #version} (The version of the model.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
186         */
187        public StringType getVersionElement() { 
188          if (this.version == null)
189            if (Configuration.errorOnAutoCreate())
190              throw new Error("Attempt to auto-create ModuleDefinitionModelComponent.version");
191            else if (Configuration.doAutoCreate())
192              this.version = new StringType(); // bb
193          return this.version;
194        }
195
196        public boolean hasVersionElement() { 
197          return this.version != null && !this.version.isEmpty();
198        }
199
200        public boolean hasVersion() { 
201          return this.version != null && !this.version.isEmpty();
202        }
203
204        /**
205         * @param value {@link #version} (The version of the model.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
206         */
207        public ModuleDefinitionModelComponent setVersionElement(StringType value) { 
208          this.version = value;
209          return this;
210        }
211
212        /**
213         * @return The version of the model.
214         */
215        public String getVersion() { 
216          return this.version == null ? null : this.version.getValue();
217        }
218
219        /**
220         * @param value The version of the model.
221         */
222        public ModuleDefinitionModelComponent setVersion(String value) { 
223          if (Utilities.noString(value))
224            this.version = null;
225          else {
226            if (this.version == null)
227              this.version = new StringType();
228            this.version.setValue(value);
229          }
230          return this;
231        }
232
233        protected void listChildren(List<Property> childrenList) {
234          super.listChildren(childrenList);
235          childrenList.add(new Property("name", "string", "The name of the model.", 0, java.lang.Integer.MAX_VALUE, name));
236          childrenList.add(new Property("identifier", "string", "The identifier of the model.", 0, java.lang.Integer.MAX_VALUE, identifier));
237          childrenList.add(new Property("version", "string", "The version of the model.", 0, java.lang.Integer.MAX_VALUE, version));
238        }
239
240      @Override
241      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
242        switch (hash) {
243        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
244        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // StringType
245        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
246        default: return super.getProperty(hash, name, checkValid);
247        }
248
249      }
250
251      @Override
252      public void setProperty(int hash, String name, Base value) throws FHIRException {
253        switch (hash) {
254        case 3373707: // name
255          this.name = castToString(value); // StringType
256          break;
257        case -1618432855: // identifier
258          this.identifier = castToString(value); // StringType
259          break;
260        case 351608024: // version
261          this.version = castToString(value); // StringType
262          break;
263        default: super.setProperty(hash, name, value);
264        }
265
266      }
267
268      @Override
269      public void setProperty(String name, Base value) throws FHIRException {
270        if (name.equals("name"))
271          this.name = castToString(value); // StringType
272        else if (name.equals("identifier"))
273          this.identifier = castToString(value); // StringType
274        else if (name.equals("version"))
275          this.version = castToString(value); // StringType
276        else
277          super.setProperty(name, value);
278      }
279
280      @Override
281      public Base makeProperty(int hash, String name) throws FHIRException {
282        switch (hash) {
283        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
284        case -1618432855: throw new FHIRException("Cannot make property identifier as it is not a complex type"); // StringType
285        case 351608024: throw new FHIRException("Cannot make property version as it is not a complex type"); // StringType
286        default: return super.makeProperty(hash, name);
287        }
288
289      }
290
291      @Override
292      public Base addChild(String name) throws FHIRException {
293        if (name.equals("name")) {
294          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.name");
295        }
296        else if (name.equals("identifier")) {
297          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.identifier");
298        }
299        else if (name.equals("version")) {
300          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.version");
301        }
302        else
303          return super.addChild(name);
304      }
305
306      public ModuleDefinitionModelComponent copy() {
307        ModuleDefinitionModelComponent dst = new ModuleDefinitionModelComponent();
308        copyValues(dst);
309        dst.name = name == null ? null : name.copy();
310        dst.identifier = identifier == null ? null : identifier.copy();
311        dst.version = version == null ? null : version.copy();
312        return dst;
313      }
314
315      @Override
316      public boolean equalsDeep(Base other) {
317        if (!super.equalsDeep(other))
318          return false;
319        if (!(other instanceof ModuleDefinitionModelComponent))
320          return false;
321        ModuleDefinitionModelComponent o = (ModuleDefinitionModelComponent) other;
322        return compareDeep(name, o.name, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
323          ;
324      }
325
326      @Override
327      public boolean equalsShallow(Base other) {
328        if (!super.equalsShallow(other))
329          return false;
330        if (!(other instanceof ModuleDefinitionModelComponent))
331          return false;
332        ModuleDefinitionModelComponent o = (ModuleDefinitionModelComponent) other;
333        return compareValues(name, o.name, true) && compareValues(identifier, o.identifier, true) && compareValues(version, o.version, true)
334          ;
335      }
336
337      public boolean isEmpty() {
338        return super.isEmpty() && (name == null || name.isEmpty()) && (identifier == null || identifier.isEmpty())
339           && (version == null || version.isEmpty());
340      }
341
342  public String fhirType() {
343    return "ModuleDefinition.model";
344
345  }
346
347  }
348
349    @Block()
350    public static class ModuleDefinitionLibraryComponent extends BackboneElement implements IBaseBackboneElement {
351        /**
352         * The local name for the library reference. If no local name is provided, the name of the referenced library is assumed.
353         */
354        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
355        @Description(shortDefinition="The local name for the library", formalDefinition="The local name for the library reference. If no local name is provided, the name of the referenced library is assumed." )
356        protected StringType name;
357
358        /**
359         * The identifier of the library.
360         */
361        @Child(name = "identifier", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
362        @Description(shortDefinition="", formalDefinition="The identifier of the library." )
363        protected StringType identifier;
364
365        /**
366         * The version of the library.
367         */
368        @Child(name = "version", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
369        @Description(shortDefinition="", formalDefinition="The version of the library." )
370        protected StringType version;
371
372        /**
373         * A reference to the library.
374         */
375        @Child(name = "document", type = {Attachment.class, ModuleDefinition.class}, order=4, min=0, max=1, modifier=false, summary=false)
376        @Description(shortDefinition="", formalDefinition="A reference to the library." )
377        protected Type document;
378
379        private static final long serialVersionUID = 1633488790L;
380
381    /**
382     * Constructor
383     */
384      public ModuleDefinitionLibraryComponent() {
385        super();
386      }
387
388        /**
389         * @return {@link #name} (The local name for the library reference. If no local name is provided, the name of the referenced library is assumed.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
390         */
391        public StringType getNameElement() { 
392          if (this.name == null)
393            if (Configuration.errorOnAutoCreate())
394              throw new Error("Attempt to auto-create ModuleDefinitionLibraryComponent.name");
395            else if (Configuration.doAutoCreate())
396              this.name = new StringType(); // bb
397          return this.name;
398        }
399
400        public boolean hasNameElement() { 
401          return this.name != null && !this.name.isEmpty();
402        }
403
404        public boolean hasName() { 
405          return this.name != null && !this.name.isEmpty();
406        }
407
408        /**
409         * @param value {@link #name} (The local name for the library reference. If no local name is provided, the name of the referenced library is assumed.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
410         */
411        public ModuleDefinitionLibraryComponent setNameElement(StringType value) { 
412          this.name = value;
413          return this;
414        }
415
416        /**
417         * @return The local name for the library reference. If no local name is provided, the name of the referenced library is assumed.
418         */
419        public String getName() { 
420          return this.name == null ? null : this.name.getValue();
421        }
422
423        /**
424         * @param value The local name for the library reference. If no local name is provided, the name of the referenced library is assumed.
425         */
426        public ModuleDefinitionLibraryComponent setName(String value) { 
427          if (Utilities.noString(value))
428            this.name = null;
429          else {
430            if (this.name == null)
431              this.name = new StringType();
432            this.name.setValue(value);
433          }
434          return this;
435        }
436
437        /**
438         * @return {@link #identifier} (The identifier of the library.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
439         */
440        public StringType getIdentifierElement() { 
441          if (this.identifier == null)
442            if (Configuration.errorOnAutoCreate())
443              throw new Error("Attempt to auto-create ModuleDefinitionLibraryComponent.identifier");
444            else if (Configuration.doAutoCreate())
445              this.identifier = new StringType(); // bb
446          return this.identifier;
447        }
448
449        public boolean hasIdentifierElement() { 
450          return this.identifier != null && !this.identifier.isEmpty();
451        }
452
453        public boolean hasIdentifier() { 
454          return this.identifier != null && !this.identifier.isEmpty();
455        }
456
457        /**
458         * @param value {@link #identifier} (The identifier of the library.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
459         */
460        public ModuleDefinitionLibraryComponent setIdentifierElement(StringType value) { 
461          this.identifier = value;
462          return this;
463        }
464
465        /**
466         * @return The identifier of the library.
467         */
468        public String getIdentifier() { 
469          return this.identifier == null ? null : this.identifier.getValue();
470        }
471
472        /**
473         * @param value The identifier of the library.
474         */
475        public ModuleDefinitionLibraryComponent setIdentifier(String value) { 
476          if (Utilities.noString(value))
477            this.identifier = null;
478          else {
479            if (this.identifier == null)
480              this.identifier = new StringType();
481            this.identifier.setValue(value);
482          }
483          return this;
484        }
485
486        /**
487         * @return {@link #version} (The version of the library.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
488         */
489        public StringType getVersionElement() { 
490          if (this.version == null)
491            if (Configuration.errorOnAutoCreate())
492              throw new Error("Attempt to auto-create ModuleDefinitionLibraryComponent.version");
493            else if (Configuration.doAutoCreate())
494              this.version = new StringType(); // bb
495          return this.version;
496        }
497
498        public boolean hasVersionElement() { 
499          return this.version != null && !this.version.isEmpty();
500        }
501
502        public boolean hasVersion() { 
503          return this.version != null && !this.version.isEmpty();
504        }
505
506        /**
507         * @param value {@link #version} (The version of the library.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
508         */
509        public ModuleDefinitionLibraryComponent setVersionElement(StringType value) { 
510          this.version = value;
511          return this;
512        }
513
514        /**
515         * @return The version of the library.
516         */
517        public String getVersion() { 
518          return this.version == null ? null : this.version.getValue();
519        }
520
521        /**
522         * @param value The version of the library.
523         */
524        public ModuleDefinitionLibraryComponent setVersion(String value) { 
525          if (Utilities.noString(value))
526            this.version = null;
527          else {
528            if (this.version == null)
529              this.version = new StringType();
530            this.version.setValue(value);
531          }
532          return this;
533        }
534
535        /**
536         * @return {@link #document} (A reference to the library.)
537         */
538        public Type getDocument() { 
539          return this.document;
540        }
541
542        /**
543         * @return {@link #document} (A reference to the library.)
544         */
545        public Attachment getDocumentAttachment() throws FHIRException { 
546          if (!(this.document instanceof Attachment))
547            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.document.getClass().getName()+" was encountered");
548          return (Attachment) this.document;
549        }
550
551        public boolean hasDocumentAttachment() { 
552          return this.document instanceof Attachment;
553        }
554
555        /**
556         * @return {@link #document} (A reference to the library.)
557         */
558        public Reference getDocumentReference() throws FHIRException { 
559          if (!(this.document instanceof Reference))
560            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.document.getClass().getName()+" was encountered");
561          return (Reference) this.document;
562        }
563
564        public boolean hasDocumentReference() { 
565          return this.document instanceof Reference;
566        }
567
568        public boolean hasDocument() { 
569          return this.document != null && !this.document.isEmpty();
570        }
571
572        /**
573         * @param value {@link #document} (A reference to the library.)
574         */
575        public ModuleDefinitionLibraryComponent setDocument(Type value) { 
576          this.document = value;
577          return this;
578        }
579
580        protected void listChildren(List<Property> childrenList) {
581          super.listChildren(childrenList);
582          childrenList.add(new Property("name", "string", "The local name for the library reference. If no local name is provided, the name of the referenced library is assumed.", 0, java.lang.Integer.MAX_VALUE, name));
583          childrenList.add(new Property("identifier", "string", "The identifier of the library.", 0, java.lang.Integer.MAX_VALUE, identifier));
584          childrenList.add(new Property("version", "string", "The version of the library.", 0, java.lang.Integer.MAX_VALUE, version));
585          childrenList.add(new Property("document[x]", "Attachment|Reference(ModuleDefinition)", "A reference to the library.", 0, java.lang.Integer.MAX_VALUE, document));
586        }
587
588      @Override
589      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
590        switch (hash) {
591        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
592        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // StringType
593        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
594        case 861720859: /*document*/ return this.document == null ? new Base[0] : new Base[] {this.document}; // Type
595        default: return super.getProperty(hash, name, checkValid);
596        }
597
598      }
599
600      @Override
601      public void setProperty(int hash, String name, Base value) throws FHIRException {
602        switch (hash) {
603        case 3373707: // name
604          this.name = castToString(value); // StringType
605          break;
606        case -1618432855: // identifier
607          this.identifier = castToString(value); // StringType
608          break;
609        case 351608024: // version
610          this.version = castToString(value); // StringType
611          break;
612        case 861720859: // document
613          this.document = (Type) value; // Type
614          break;
615        default: super.setProperty(hash, name, value);
616        }
617
618      }
619
620      @Override
621      public void setProperty(String name, Base value) throws FHIRException {
622        if (name.equals("name"))
623          this.name = castToString(value); // StringType
624        else if (name.equals("identifier"))
625          this.identifier = castToString(value); // StringType
626        else if (name.equals("version"))
627          this.version = castToString(value); // StringType
628        else if (name.equals("document[x]"))
629          this.document = (Type) value; // Type
630        else
631          super.setProperty(name, value);
632      }
633
634      @Override
635      public Base makeProperty(int hash, String name) throws FHIRException {
636        switch (hash) {
637        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
638        case -1618432855: throw new FHIRException("Cannot make property identifier as it is not a complex type"); // StringType
639        case 351608024: throw new FHIRException("Cannot make property version as it is not a complex type"); // StringType
640        case 506673541:  return getDocument(); // Type
641        default: return super.makeProperty(hash, name);
642        }
643
644      }
645
646      @Override
647      public Base addChild(String name) throws FHIRException {
648        if (name.equals("name")) {
649          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.name");
650        }
651        else if (name.equals("identifier")) {
652          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.identifier");
653        }
654        else if (name.equals("version")) {
655          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.version");
656        }
657        else if (name.equals("documentAttachment")) {
658          this.document = new Attachment();
659          return this.document;
660        }
661        else if (name.equals("documentReference")) {
662          this.document = new Reference();
663          return this.document;
664        }
665        else
666          return super.addChild(name);
667      }
668
669      public ModuleDefinitionLibraryComponent copy() {
670        ModuleDefinitionLibraryComponent dst = new ModuleDefinitionLibraryComponent();
671        copyValues(dst);
672        dst.name = name == null ? null : name.copy();
673        dst.identifier = identifier == null ? null : identifier.copy();
674        dst.version = version == null ? null : version.copy();
675        dst.document = document == null ? null : document.copy();
676        return dst;
677      }
678
679      @Override
680      public boolean equalsDeep(Base other) {
681        if (!super.equalsDeep(other))
682          return false;
683        if (!(other instanceof ModuleDefinitionLibraryComponent))
684          return false;
685        ModuleDefinitionLibraryComponent o = (ModuleDefinitionLibraryComponent) other;
686        return compareDeep(name, o.name, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
687           && compareDeep(document, o.document, true);
688      }
689
690      @Override
691      public boolean equalsShallow(Base other) {
692        if (!super.equalsShallow(other))
693          return false;
694        if (!(other instanceof ModuleDefinitionLibraryComponent))
695          return false;
696        ModuleDefinitionLibraryComponent o = (ModuleDefinitionLibraryComponent) other;
697        return compareValues(name, o.name, true) && compareValues(identifier, o.identifier, true) && compareValues(version, o.version, true)
698          ;
699      }
700
701      public boolean isEmpty() {
702        return super.isEmpty() && (name == null || name.isEmpty()) && (identifier == null || identifier.isEmpty())
703           && (version == null || version.isEmpty()) && (document == null || document.isEmpty());
704      }
705
706  public String fhirType() {
707    return "ModuleDefinition.library";
708
709  }
710
711  }
712
713    @Block()
714    public static class ModuleDefinitionCodeSystemComponent extends BackboneElement implements IBaseBackboneElement {
715        /**
716         * The local name for the code system.
717         */
718        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
719        @Description(shortDefinition="", formalDefinition="The local name for the code system." )
720        protected StringType name;
721
722        /**
723         * The code system uri.
724         */
725        @Child(name = "identifier", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=false)
726        @Description(shortDefinition="", formalDefinition="The code system uri." )
727        protected StringType identifier;
728
729        /**
730         * The code system version, if any.
731         */
732        @Child(name = "version", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
733        @Description(shortDefinition="", formalDefinition="The code system version, if any." )
734        protected StringType version;
735
736        private static final long serialVersionUID = -862601139L;
737
738    /**
739     * Constructor
740     */
741      public ModuleDefinitionCodeSystemComponent() {
742        super();
743      }
744
745    /**
746     * Constructor
747     */
748      public ModuleDefinitionCodeSystemComponent(StringType name, StringType identifier) {
749        super();
750        this.name = name;
751        this.identifier = identifier;
752      }
753
754        /**
755         * @return {@link #name} (The local name for the code system.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
756         */
757        public StringType getNameElement() { 
758          if (this.name == null)
759            if (Configuration.errorOnAutoCreate())
760              throw new Error("Attempt to auto-create ModuleDefinitionCodeSystemComponent.name");
761            else if (Configuration.doAutoCreate())
762              this.name = new StringType(); // bb
763          return this.name;
764        }
765
766        public boolean hasNameElement() { 
767          return this.name != null && !this.name.isEmpty();
768        }
769
770        public boolean hasName() { 
771          return this.name != null && !this.name.isEmpty();
772        }
773
774        /**
775         * @param value {@link #name} (The local name for the code system.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
776         */
777        public ModuleDefinitionCodeSystemComponent setNameElement(StringType value) { 
778          this.name = value;
779          return this;
780        }
781
782        /**
783         * @return The local name for the code system.
784         */
785        public String getName() { 
786          return this.name == null ? null : this.name.getValue();
787        }
788
789        /**
790         * @param value The local name for the code system.
791         */
792        public ModuleDefinitionCodeSystemComponent setName(String value) { 
793            if (this.name == null)
794              this.name = new StringType();
795            this.name.setValue(value);
796          return this;
797        }
798
799        /**
800         * @return {@link #identifier} (The code system uri.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
801         */
802        public StringType getIdentifierElement() { 
803          if (this.identifier == null)
804            if (Configuration.errorOnAutoCreate())
805              throw new Error("Attempt to auto-create ModuleDefinitionCodeSystemComponent.identifier");
806            else if (Configuration.doAutoCreate())
807              this.identifier = new StringType(); // bb
808          return this.identifier;
809        }
810
811        public boolean hasIdentifierElement() { 
812          return this.identifier != null && !this.identifier.isEmpty();
813        }
814
815        public boolean hasIdentifier() { 
816          return this.identifier != null && !this.identifier.isEmpty();
817        }
818
819        /**
820         * @param value {@link #identifier} (The code system uri.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
821         */
822        public ModuleDefinitionCodeSystemComponent setIdentifierElement(StringType value) { 
823          this.identifier = value;
824          return this;
825        }
826
827        /**
828         * @return The code system uri.
829         */
830        public String getIdentifier() { 
831          return this.identifier == null ? null : this.identifier.getValue();
832        }
833
834        /**
835         * @param value The code system uri.
836         */
837        public ModuleDefinitionCodeSystemComponent setIdentifier(String value) { 
838            if (this.identifier == null)
839              this.identifier = new StringType();
840            this.identifier.setValue(value);
841          return this;
842        }
843
844        /**
845         * @return {@link #version} (The code system version, if any.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
846         */
847        public StringType getVersionElement() { 
848          if (this.version == null)
849            if (Configuration.errorOnAutoCreate())
850              throw new Error("Attempt to auto-create ModuleDefinitionCodeSystemComponent.version");
851            else if (Configuration.doAutoCreate())
852              this.version = new StringType(); // bb
853          return this.version;
854        }
855
856        public boolean hasVersionElement() { 
857          return this.version != null && !this.version.isEmpty();
858        }
859
860        public boolean hasVersion() { 
861          return this.version != null && !this.version.isEmpty();
862        }
863
864        /**
865         * @param value {@link #version} (The code system version, if any.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
866         */
867        public ModuleDefinitionCodeSystemComponent setVersionElement(StringType value) { 
868          this.version = value;
869          return this;
870        }
871
872        /**
873         * @return The code system version, if any.
874         */
875        public String getVersion() { 
876          return this.version == null ? null : this.version.getValue();
877        }
878
879        /**
880         * @param value The code system version, if any.
881         */
882        public ModuleDefinitionCodeSystemComponent setVersion(String value) { 
883          if (Utilities.noString(value))
884            this.version = null;
885          else {
886            if (this.version == null)
887              this.version = new StringType();
888            this.version.setValue(value);
889          }
890          return this;
891        }
892
893        protected void listChildren(List<Property> childrenList) {
894          super.listChildren(childrenList);
895          childrenList.add(new Property("name", "string", "The local name for the code system.", 0, java.lang.Integer.MAX_VALUE, name));
896          childrenList.add(new Property("identifier", "string", "The code system uri.", 0, java.lang.Integer.MAX_VALUE, identifier));
897          childrenList.add(new Property("version", "string", "The code system version, if any.", 0, java.lang.Integer.MAX_VALUE, version));
898        }
899
900      @Override
901      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
902        switch (hash) {
903        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
904        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // StringType
905        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
906        default: return super.getProperty(hash, name, checkValid);
907        }
908
909      }
910
911      @Override
912      public void setProperty(int hash, String name, Base value) throws FHIRException {
913        switch (hash) {
914        case 3373707: // name
915          this.name = castToString(value); // StringType
916          break;
917        case -1618432855: // identifier
918          this.identifier = castToString(value); // StringType
919          break;
920        case 351608024: // version
921          this.version = castToString(value); // StringType
922          break;
923        default: super.setProperty(hash, name, value);
924        }
925
926      }
927
928      @Override
929      public void setProperty(String name, Base value) throws FHIRException {
930        if (name.equals("name"))
931          this.name = castToString(value); // StringType
932        else if (name.equals("identifier"))
933          this.identifier = castToString(value); // StringType
934        else if (name.equals("version"))
935          this.version = castToString(value); // StringType
936        else
937          super.setProperty(name, value);
938      }
939
940      @Override
941      public Base makeProperty(int hash, String name) throws FHIRException {
942        switch (hash) {
943        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
944        case -1618432855: throw new FHIRException("Cannot make property identifier as it is not a complex type"); // StringType
945        case 351608024: throw new FHIRException("Cannot make property version as it is not a complex type"); // StringType
946        default: return super.makeProperty(hash, name);
947        }
948
949      }
950
951      @Override
952      public Base addChild(String name) throws FHIRException {
953        if (name.equals("name")) {
954          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.name");
955        }
956        else if (name.equals("identifier")) {
957          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.identifier");
958        }
959        else if (name.equals("version")) {
960          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.version");
961        }
962        else
963          return super.addChild(name);
964      }
965
966      public ModuleDefinitionCodeSystemComponent copy() {
967        ModuleDefinitionCodeSystemComponent dst = new ModuleDefinitionCodeSystemComponent();
968        copyValues(dst);
969        dst.name = name == null ? null : name.copy();
970        dst.identifier = identifier == null ? null : identifier.copy();
971        dst.version = version == null ? null : version.copy();
972        return dst;
973      }
974
975      @Override
976      public boolean equalsDeep(Base other) {
977        if (!super.equalsDeep(other))
978          return false;
979        if (!(other instanceof ModuleDefinitionCodeSystemComponent))
980          return false;
981        ModuleDefinitionCodeSystemComponent o = (ModuleDefinitionCodeSystemComponent) other;
982        return compareDeep(name, o.name, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
983          ;
984      }
985
986      @Override
987      public boolean equalsShallow(Base other) {
988        if (!super.equalsShallow(other))
989          return false;
990        if (!(other instanceof ModuleDefinitionCodeSystemComponent))
991          return false;
992        ModuleDefinitionCodeSystemComponent o = (ModuleDefinitionCodeSystemComponent) other;
993        return compareValues(name, o.name, true) && compareValues(identifier, o.identifier, true) && compareValues(version, o.version, true)
994          ;
995      }
996
997      public boolean isEmpty() {
998        return super.isEmpty() && (name == null || name.isEmpty()) && (identifier == null || identifier.isEmpty())
999           && (version == null || version.isEmpty());
1000      }
1001
1002  public String fhirType() {
1003    return "ModuleDefinition.codeSystem";
1004
1005  }
1006
1007  }
1008
1009    @Block()
1010    public static class ModuleDefinitionValueSetComponent extends BackboneElement implements IBaseBackboneElement {
1011        /**
1012         * The local name for the value set.
1013         */
1014        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1015        @Description(shortDefinition="", formalDefinition="The local name for the value set." )
1016        protected StringType name;
1017
1018        /**
1019         * The value set uri.
1020         */
1021        @Child(name = "identifier", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1022        @Description(shortDefinition="", formalDefinition="The value set uri." )
1023        protected StringType identifier;
1024
1025        /**
1026         * The version of the value set, if any.
1027         */
1028        @Child(name = "version", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1029        @Description(shortDefinition="", formalDefinition="The version of the value set, if any." )
1030        protected StringType version;
1031
1032        /**
1033         * The code systems in use within the value set. These must refer to previously defined code systems within this knowledge module or a referenced library.
1034         */
1035        @Child(name = "codeSystem", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1036        @Description(shortDefinition="", formalDefinition="The code systems in use within the value set. These must refer to previously defined code systems within this knowledge module or a referenced library." )
1037        protected List<StringType> codeSystem;
1038
1039        private static final long serialVersionUID = 338950096L;
1040
1041    /**
1042     * Constructor
1043     */
1044      public ModuleDefinitionValueSetComponent() {
1045        super();
1046      }
1047
1048    /**
1049     * Constructor
1050     */
1051      public ModuleDefinitionValueSetComponent(StringType name, StringType identifier) {
1052        super();
1053        this.name = name;
1054        this.identifier = identifier;
1055      }
1056
1057        /**
1058         * @return {@link #name} (The local name for the value set.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1059         */
1060        public StringType getNameElement() { 
1061          if (this.name == null)
1062            if (Configuration.errorOnAutoCreate())
1063              throw new Error("Attempt to auto-create ModuleDefinitionValueSetComponent.name");
1064            else if (Configuration.doAutoCreate())
1065              this.name = new StringType(); // bb
1066          return this.name;
1067        }
1068
1069        public boolean hasNameElement() { 
1070          return this.name != null && !this.name.isEmpty();
1071        }
1072
1073        public boolean hasName() { 
1074          return this.name != null && !this.name.isEmpty();
1075        }
1076
1077        /**
1078         * @param value {@link #name} (The local name for the value set.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1079         */
1080        public ModuleDefinitionValueSetComponent setNameElement(StringType value) { 
1081          this.name = value;
1082          return this;
1083        }
1084
1085        /**
1086         * @return The local name for the value set.
1087         */
1088        public String getName() { 
1089          return this.name == null ? null : this.name.getValue();
1090        }
1091
1092        /**
1093         * @param value The local name for the value set.
1094         */
1095        public ModuleDefinitionValueSetComponent setName(String value) { 
1096            if (this.name == null)
1097              this.name = new StringType();
1098            this.name.setValue(value);
1099          return this;
1100        }
1101
1102        /**
1103         * @return {@link #identifier} (The value set uri.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
1104         */
1105        public StringType getIdentifierElement() { 
1106          if (this.identifier == null)
1107            if (Configuration.errorOnAutoCreate())
1108              throw new Error("Attempt to auto-create ModuleDefinitionValueSetComponent.identifier");
1109            else if (Configuration.doAutoCreate())
1110              this.identifier = new StringType(); // bb
1111          return this.identifier;
1112        }
1113
1114        public boolean hasIdentifierElement() { 
1115          return this.identifier != null && !this.identifier.isEmpty();
1116        }
1117
1118        public boolean hasIdentifier() { 
1119          return this.identifier != null && !this.identifier.isEmpty();
1120        }
1121
1122        /**
1123         * @param value {@link #identifier} (The value set uri.). This is the underlying object with id, value and extensions. The accessor "getIdentifier" gives direct access to the value
1124         */
1125        public ModuleDefinitionValueSetComponent setIdentifierElement(StringType value) { 
1126          this.identifier = value;
1127          return this;
1128        }
1129
1130        /**
1131         * @return The value set uri.
1132         */
1133        public String getIdentifier() { 
1134          return this.identifier == null ? null : this.identifier.getValue();
1135        }
1136
1137        /**
1138         * @param value The value set uri.
1139         */
1140        public ModuleDefinitionValueSetComponent setIdentifier(String value) { 
1141            if (this.identifier == null)
1142              this.identifier = new StringType();
1143            this.identifier.setValue(value);
1144          return this;
1145        }
1146
1147        /**
1148         * @return {@link #version} (The version of the value set, if any.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1149         */
1150        public StringType getVersionElement() { 
1151          if (this.version == null)
1152            if (Configuration.errorOnAutoCreate())
1153              throw new Error("Attempt to auto-create ModuleDefinitionValueSetComponent.version");
1154            else if (Configuration.doAutoCreate())
1155              this.version = new StringType(); // bb
1156          return this.version;
1157        }
1158
1159        public boolean hasVersionElement() { 
1160          return this.version != null && !this.version.isEmpty();
1161        }
1162
1163        public boolean hasVersion() { 
1164          return this.version != null && !this.version.isEmpty();
1165        }
1166
1167        /**
1168         * @param value {@link #version} (The version of the value set, if any.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
1169         */
1170        public ModuleDefinitionValueSetComponent setVersionElement(StringType value) { 
1171          this.version = value;
1172          return this;
1173        }
1174
1175        /**
1176         * @return The version of the value set, if any.
1177         */
1178        public String getVersion() { 
1179          return this.version == null ? null : this.version.getValue();
1180        }
1181
1182        /**
1183         * @param value The version of the value set, if any.
1184         */
1185        public ModuleDefinitionValueSetComponent setVersion(String value) { 
1186          if (Utilities.noString(value))
1187            this.version = null;
1188          else {
1189            if (this.version == null)
1190              this.version = new StringType();
1191            this.version.setValue(value);
1192          }
1193          return this;
1194        }
1195
1196        /**
1197         * @return {@link #codeSystem} (The code systems in use within the value set. These must refer to previously defined code systems within this knowledge module or a referenced library.)
1198         */
1199        public List<StringType> getCodeSystem() { 
1200          if (this.codeSystem == null)
1201            this.codeSystem = new ArrayList<StringType>();
1202          return this.codeSystem;
1203        }
1204
1205        public boolean hasCodeSystem() { 
1206          if (this.codeSystem == null)
1207            return false;
1208          for (StringType item : this.codeSystem)
1209            if (!item.isEmpty())
1210              return true;
1211          return false;
1212        }
1213
1214        /**
1215         * @return {@link #codeSystem} (The code systems in use within the value set. These must refer to previously defined code systems within this knowledge module or a referenced library.)
1216         */
1217    // syntactic sugar
1218        public StringType addCodeSystemElement() {//2 
1219          StringType t = new StringType();
1220          if (this.codeSystem == null)
1221            this.codeSystem = new ArrayList<StringType>();
1222          this.codeSystem.add(t);
1223          return t;
1224        }
1225
1226        /**
1227         * @param value {@link #codeSystem} (The code systems in use within the value set. These must refer to previously defined code systems within this knowledge module or a referenced library.)
1228         */
1229        public ModuleDefinitionValueSetComponent addCodeSystem(String value) { //1
1230          StringType t = new StringType();
1231          t.setValue(value);
1232          if (this.codeSystem == null)
1233            this.codeSystem = new ArrayList<StringType>();
1234          this.codeSystem.add(t);
1235          return this;
1236        }
1237
1238        /**
1239         * @param value {@link #codeSystem} (The code systems in use within the value set. These must refer to previously defined code systems within this knowledge module or a referenced library.)
1240         */
1241        public boolean hasCodeSystem(String value) { 
1242          if (this.codeSystem == null)
1243            return false;
1244          for (StringType v : this.codeSystem)
1245            if (v.equals(value)) // string
1246              return true;
1247          return false;
1248        }
1249
1250        protected void listChildren(List<Property> childrenList) {
1251          super.listChildren(childrenList);
1252          childrenList.add(new Property("name", "string", "The local name for the value set.", 0, java.lang.Integer.MAX_VALUE, name));
1253          childrenList.add(new Property("identifier", "string", "The value set uri.", 0, java.lang.Integer.MAX_VALUE, identifier));
1254          childrenList.add(new Property("version", "string", "The version of the value set, if any.", 0, java.lang.Integer.MAX_VALUE, version));
1255          childrenList.add(new Property("codeSystem", "string", "The code systems in use within the value set. These must refer to previously defined code systems within this knowledge module or a referenced library.", 0, java.lang.Integer.MAX_VALUE, codeSystem));
1256        }
1257
1258      @Override
1259      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1260        switch (hash) {
1261        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1262        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // StringType
1263        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
1264        case -916511108: /*codeSystem*/ return this.codeSystem == null ? new Base[0] : this.codeSystem.toArray(new Base[this.codeSystem.size()]); // StringType
1265        default: return super.getProperty(hash, name, checkValid);
1266        }
1267
1268      }
1269
1270      @Override
1271      public void setProperty(int hash, String name, Base value) throws FHIRException {
1272        switch (hash) {
1273        case 3373707: // name
1274          this.name = castToString(value); // StringType
1275          break;
1276        case -1618432855: // identifier
1277          this.identifier = castToString(value); // StringType
1278          break;
1279        case 351608024: // version
1280          this.version = castToString(value); // StringType
1281          break;
1282        case -916511108: // codeSystem
1283          this.getCodeSystem().add(castToString(value)); // StringType
1284          break;
1285        default: super.setProperty(hash, name, value);
1286        }
1287
1288      }
1289
1290      @Override
1291      public void setProperty(String name, Base value) throws FHIRException {
1292        if (name.equals("name"))
1293          this.name = castToString(value); // StringType
1294        else if (name.equals("identifier"))
1295          this.identifier = castToString(value); // StringType
1296        else if (name.equals("version"))
1297          this.version = castToString(value); // StringType
1298        else if (name.equals("codeSystem"))
1299          this.getCodeSystem().add(castToString(value));
1300        else
1301          super.setProperty(name, value);
1302      }
1303
1304      @Override
1305      public Base makeProperty(int hash, String name) throws FHIRException {
1306        switch (hash) {
1307        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
1308        case -1618432855: throw new FHIRException("Cannot make property identifier as it is not a complex type"); // StringType
1309        case 351608024: throw new FHIRException("Cannot make property version as it is not a complex type"); // StringType
1310        case -916511108: throw new FHIRException("Cannot make property codeSystem as it is not a complex type"); // StringType
1311        default: return super.makeProperty(hash, name);
1312        }
1313
1314      }
1315
1316      @Override
1317      public Base addChild(String name) throws FHIRException {
1318        if (name.equals("name")) {
1319          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.name");
1320        }
1321        else if (name.equals("identifier")) {
1322          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.identifier");
1323        }
1324        else if (name.equals("version")) {
1325          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.version");
1326        }
1327        else if (name.equals("codeSystem")) {
1328          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.codeSystem");
1329        }
1330        else
1331          return super.addChild(name);
1332      }
1333
1334      public ModuleDefinitionValueSetComponent copy() {
1335        ModuleDefinitionValueSetComponent dst = new ModuleDefinitionValueSetComponent();
1336        copyValues(dst);
1337        dst.name = name == null ? null : name.copy();
1338        dst.identifier = identifier == null ? null : identifier.copy();
1339        dst.version = version == null ? null : version.copy();
1340        if (codeSystem != null) {
1341          dst.codeSystem = new ArrayList<StringType>();
1342          for (StringType i : codeSystem)
1343            dst.codeSystem.add(i.copy());
1344        };
1345        return dst;
1346      }
1347
1348      @Override
1349      public boolean equalsDeep(Base other) {
1350        if (!super.equalsDeep(other))
1351          return false;
1352        if (!(other instanceof ModuleDefinitionValueSetComponent))
1353          return false;
1354        ModuleDefinitionValueSetComponent o = (ModuleDefinitionValueSetComponent) other;
1355        return compareDeep(name, o.name, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
1356           && compareDeep(codeSystem, o.codeSystem, true);
1357      }
1358
1359      @Override
1360      public boolean equalsShallow(Base other) {
1361        if (!super.equalsShallow(other))
1362          return false;
1363        if (!(other instanceof ModuleDefinitionValueSetComponent))
1364          return false;
1365        ModuleDefinitionValueSetComponent o = (ModuleDefinitionValueSetComponent) other;
1366        return compareValues(name, o.name, true) && compareValues(identifier, o.identifier, true) && compareValues(version, o.version, true)
1367           && compareValues(codeSystem, o.codeSystem, true);
1368      }
1369
1370      public boolean isEmpty() {
1371        return super.isEmpty() && (name == null || name.isEmpty()) && (identifier == null || identifier.isEmpty())
1372           && (version == null || version.isEmpty()) && (codeSystem == null || codeSystem.isEmpty())
1373          ;
1374      }
1375
1376  public String fhirType() {
1377    return "ModuleDefinition.valueSet";
1378
1379  }
1380
1381  }
1382
1383    @Block()
1384    public static class ModuleDefinitionParameterComponent extends BackboneElement implements IBaseBackboneElement {
1385        /**
1386         * The name of the parameter.
1387         */
1388        @Child(name = "name", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1389        @Description(shortDefinition="", formalDefinition="The name of the parameter." )
1390        protected CodeType name;
1391
1392        /**
1393         * Whether the parameter is input or output for the module.
1394         */
1395        @Child(name = "use", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1396        @Description(shortDefinition="", formalDefinition="Whether the parameter is input or output for the module." )
1397        protected CodeType use;
1398
1399        /**
1400         * A brief description of the parameter.
1401         */
1402        @Child(name = "documentation", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1403        @Description(shortDefinition="", formalDefinition="A brief description of the parameter." )
1404        protected StringType documentation;
1405
1406        /**
1407         * The type of the parameter.
1408         */
1409        @Child(name = "type", type = {CodeType.class}, order=4, min=1, max=1, modifier=false, summary=false)
1410        @Description(shortDefinition="", formalDefinition="The type of the parameter." )
1411        protected CodeType type;
1412
1413        /**
1414         * The profile of the parameter, if any.
1415         */
1416        @Child(name = "profile", type = {StructureDefinition.class}, order=5, min=0, max=1, modifier=false, summary=false)
1417        @Description(shortDefinition="", formalDefinition="The profile of the parameter, if any." )
1418        protected Reference profile;
1419
1420        /**
1421         * The actual object that is the target of the reference (The profile of the parameter, if any.)
1422         */
1423        protected StructureDefinition profileTarget;
1424
1425        private static final long serialVersionUID = 1572548838L;
1426
1427    /**
1428     * Constructor
1429     */
1430      public ModuleDefinitionParameterComponent() {
1431        super();
1432      }
1433
1434    /**
1435     * Constructor
1436     */
1437      public ModuleDefinitionParameterComponent(CodeType name, CodeType use, CodeType type) {
1438        super();
1439        this.name = name;
1440        this.use = use;
1441        this.type = type;
1442      }
1443
1444        /**
1445         * @return {@link #name} (The name of the parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1446         */
1447        public CodeType getNameElement() { 
1448          if (this.name == null)
1449            if (Configuration.errorOnAutoCreate())
1450              throw new Error("Attempt to auto-create ModuleDefinitionParameterComponent.name");
1451            else if (Configuration.doAutoCreate())
1452              this.name = new CodeType(); // bb
1453          return this.name;
1454        }
1455
1456        public boolean hasNameElement() { 
1457          return this.name != null && !this.name.isEmpty();
1458        }
1459
1460        public boolean hasName() { 
1461          return this.name != null && !this.name.isEmpty();
1462        }
1463
1464        /**
1465         * @param value {@link #name} (The name of the parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1466         */
1467        public ModuleDefinitionParameterComponent setNameElement(CodeType value) { 
1468          this.name = value;
1469          return this;
1470        }
1471
1472        /**
1473         * @return The name of the parameter.
1474         */
1475        public String getName() { 
1476          return this.name == null ? null : this.name.getValue();
1477        }
1478
1479        /**
1480         * @param value The name of the parameter.
1481         */
1482        public ModuleDefinitionParameterComponent setName(String value) { 
1483            if (this.name == null)
1484              this.name = new CodeType();
1485            this.name.setValue(value);
1486          return this;
1487        }
1488
1489        /**
1490         * @return {@link #use} (Whether the parameter is input or output for the module.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
1491         */
1492        public CodeType getUseElement() { 
1493          if (this.use == null)
1494            if (Configuration.errorOnAutoCreate())
1495              throw new Error("Attempt to auto-create ModuleDefinitionParameterComponent.use");
1496            else if (Configuration.doAutoCreate())
1497              this.use = new CodeType(); // bb
1498          return this.use;
1499        }
1500
1501        public boolean hasUseElement() { 
1502          return this.use != null && !this.use.isEmpty();
1503        }
1504
1505        public boolean hasUse() { 
1506          return this.use != null && !this.use.isEmpty();
1507        }
1508
1509        /**
1510         * @param value {@link #use} (Whether the parameter is input or output for the module.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
1511         */
1512        public ModuleDefinitionParameterComponent setUseElement(CodeType value) { 
1513          this.use = value;
1514          return this;
1515        }
1516
1517        /**
1518         * @return Whether the parameter is input or output for the module.
1519         */
1520        public String getUse() { 
1521          return this.use == null ? null : this.use.getValue();
1522        }
1523
1524        /**
1525         * @param value Whether the parameter is input or output for the module.
1526         */
1527        public ModuleDefinitionParameterComponent setUse(String value) { 
1528            if (this.use == null)
1529              this.use = new CodeType();
1530            this.use.setValue(value);
1531          return this;
1532        }
1533
1534        /**
1535         * @return {@link #documentation} (A brief description of the parameter.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
1536         */
1537        public StringType getDocumentationElement() { 
1538          if (this.documentation == null)
1539            if (Configuration.errorOnAutoCreate())
1540              throw new Error("Attempt to auto-create ModuleDefinitionParameterComponent.documentation");
1541            else if (Configuration.doAutoCreate())
1542              this.documentation = new StringType(); // bb
1543          return this.documentation;
1544        }
1545
1546        public boolean hasDocumentationElement() { 
1547          return this.documentation != null && !this.documentation.isEmpty();
1548        }
1549
1550        public boolean hasDocumentation() { 
1551          return this.documentation != null && !this.documentation.isEmpty();
1552        }
1553
1554        /**
1555         * @param value {@link #documentation} (A brief description of the parameter.). This is the underlying object with id, value and extensions. The accessor "getDocumentation" gives direct access to the value
1556         */
1557        public ModuleDefinitionParameterComponent setDocumentationElement(StringType value) { 
1558          this.documentation = value;
1559          return this;
1560        }
1561
1562        /**
1563         * @return A brief description of the parameter.
1564         */
1565        public String getDocumentation() { 
1566          return this.documentation == null ? null : this.documentation.getValue();
1567        }
1568
1569        /**
1570         * @param value A brief description of the parameter.
1571         */
1572        public ModuleDefinitionParameterComponent setDocumentation(String value) { 
1573          if (Utilities.noString(value))
1574            this.documentation = null;
1575          else {
1576            if (this.documentation == null)
1577              this.documentation = new StringType();
1578            this.documentation.setValue(value);
1579          }
1580          return this;
1581        }
1582
1583        /**
1584         * @return {@link #type} (The type of the parameter.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1585         */
1586        public CodeType getTypeElement() { 
1587          if (this.type == null)
1588            if (Configuration.errorOnAutoCreate())
1589              throw new Error("Attempt to auto-create ModuleDefinitionParameterComponent.type");
1590            else if (Configuration.doAutoCreate())
1591              this.type = new CodeType(); // bb
1592          return this.type;
1593        }
1594
1595        public boolean hasTypeElement() { 
1596          return this.type != null && !this.type.isEmpty();
1597        }
1598
1599        public boolean hasType() { 
1600          return this.type != null && !this.type.isEmpty();
1601        }
1602
1603        /**
1604         * @param value {@link #type} (The type of the parameter.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1605         */
1606        public ModuleDefinitionParameterComponent setTypeElement(CodeType value) { 
1607          this.type = value;
1608          return this;
1609        }
1610
1611        /**
1612         * @return The type of the parameter.
1613         */
1614        public String getType() { 
1615          return this.type == null ? null : this.type.getValue();
1616        }
1617
1618        /**
1619         * @param value The type of the parameter.
1620         */
1621        public ModuleDefinitionParameterComponent setType(String value) { 
1622            if (this.type == null)
1623              this.type = new CodeType();
1624            this.type.setValue(value);
1625          return this;
1626        }
1627
1628        /**
1629         * @return {@link #profile} (The profile of the parameter, if any.)
1630         */
1631        public Reference getProfile() { 
1632          if (this.profile == null)
1633            if (Configuration.errorOnAutoCreate())
1634              throw new Error("Attempt to auto-create ModuleDefinitionParameterComponent.profile");
1635            else if (Configuration.doAutoCreate())
1636              this.profile = new Reference(); // cc
1637          return this.profile;
1638        }
1639
1640        public boolean hasProfile() { 
1641          return this.profile != null && !this.profile.isEmpty();
1642        }
1643
1644        /**
1645         * @param value {@link #profile} (The profile of the parameter, if any.)
1646         */
1647        public ModuleDefinitionParameterComponent setProfile(Reference value) { 
1648          this.profile = value;
1649          return this;
1650        }
1651
1652        /**
1653         * @return {@link #profile} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The profile of the parameter, if any.)
1654         */
1655        public StructureDefinition getProfileTarget() { 
1656          if (this.profileTarget == null)
1657            if (Configuration.errorOnAutoCreate())
1658              throw new Error("Attempt to auto-create ModuleDefinitionParameterComponent.profile");
1659            else if (Configuration.doAutoCreate())
1660              this.profileTarget = new StructureDefinition(); // aa
1661          return this.profileTarget;
1662        }
1663
1664        /**
1665         * @param value {@link #profile} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The profile of the parameter, if any.)
1666         */
1667        public ModuleDefinitionParameterComponent setProfileTarget(StructureDefinition value) { 
1668          this.profileTarget = value;
1669          return this;
1670        }
1671
1672        protected void listChildren(List<Property> childrenList) {
1673          super.listChildren(childrenList);
1674          childrenList.add(new Property("name", "code", "The name of the parameter.", 0, java.lang.Integer.MAX_VALUE, name));
1675          childrenList.add(new Property("use", "code", "Whether the parameter is input or output for the module.", 0, java.lang.Integer.MAX_VALUE, use));
1676          childrenList.add(new Property("documentation", "string", "A brief description of the parameter.", 0, java.lang.Integer.MAX_VALUE, documentation));
1677          childrenList.add(new Property("type", "code", "The type of the parameter.", 0, java.lang.Integer.MAX_VALUE, type));
1678          childrenList.add(new Property("profile", "Reference(StructureDefinition)", "The profile of the parameter, if any.", 0, java.lang.Integer.MAX_VALUE, profile));
1679        }
1680
1681      @Override
1682      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1683        switch (hash) {
1684        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // CodeType
1685        case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // CodeType
1686        case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : new Base[] {this.documentation}; // StringType
1687        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeType
1688        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : new Base[] {this.profile}; // Reference
1689        default: return super.getProperty(hash, name, checkValid);
1690        }
1691
1692      }
1693
1694      @Override
1695      public void setProperty(int hash, String name, Base value) throws FHIRException {
1696        switch (hash) {
1697        case 3373707: // name
1698          this.name = castToCode(value); // CodeType
1699          break;
1700        case 116103: // use
1701          this.use = castToCode(value); // CodeType
1702          break;
1703        case 1587405498: // documentation
1704          this.documentation = castToString(value); // StringType
1705          break;
1706        case 3575610: // type
1707          this.type = castToCode(value); // CodeType
1708          break;
1709        case -309425751: // profile
1710          this.profile = castToReference(value); // Reference
1711          break;
1712        default: super.setProperty(hash, name, value);
1713        }
1714
1715      }
1716
1717      @Override
1718      public void setProperty(String name, Base value) throws FHIRException {
1719        if (name.equals("name"))
1720          this.name = castToCode(value); // CodeType
1721        else if (name.equals("use"))
1722          this.use = castToCode(value); // CodeType
1723        else if (name.equals("documentation"))
1724          this.documentation = castToString(value); // StringType
1725        else if (name.equals("type"))
1726          this.type = castToCode(value); // CodeType
1727        else if (name.equals("profile"))
1728          this.profile = castToReference(value); // Reference
1729        else
1730          super.setProperty(name, value);
1731      }
1732
1733      @Override
1734      public Base makeProperty(int hash, String name) throws FHIRException {
1735        switch (hash) {
1736        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // CodeType
1737        case 116103: throw new FHIRException("Cannot make property use as it is not a complex type"); // CodeType
1738        case 1587405498: throw new FHIRException("Cannot make property documentation as it is not a complex type"); // StringType
1739        case 3575610: throw new FHIRException("Cannot make property type as it is not a complex type"); // CodeType
1740        case -309425751:  return getProfile(); // Reference
1741        default: return super.makeProperty(hash, name);
1742        }
1743
1744      }
1745
1746      @Override
1747      public Base addChild(String name) throws FHIRException {
1748        if (name.equals("name")) {
1749          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.name");
1750        }
1751        else if (name.equals("use")) {
1752          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.use");
1753        }
1754        else if (name.equals("documentation")) {
1755          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.documentation");
1756        }
1757        else if (name.equals("type")) {
1758          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.type");
1759        }
1760        else if (name.equals("profile")) {
1761          this.profile = new Reference();
1762          return this.profile;
1763        }
1764        else
1765          return super.addChild(name);
1766      }
1767
1768      public ModuleDefinitionParameterComponent copy() {
1769        ModuleDefinitionParameterComponent dst = new ModuleDefinitionParameterComponent();
1770        copyValues(dst);
1771        dst.name = name == null ? null : name.copy();
1772        dst.use = use == null ? null : use.copy();
1773        dst.documentation = documentation == null ? null : documentation.copy();
1774        dst.type = type == null ? null : type.copy();
1775        dst.profile = profile == null ? null : profile.copy();
1776        return dst;
1777      }
1778
1779      @Override
1780      public boolean equalsDeep(Base other) {
1781        if (!super.equalsDeep(other))
1782          return false;
1783        if (!(other instanceof ModuleDefinitionParameterComponent))
1784          return false;
1785        ModuleDefinitionParameterComponent o = (ModuleDefinitionParameterComponent) other;
1786        return compareDeep(name, o.name, true) && compareDeep(use, o.use, true) && compareDeep(documentation, o.documentation, true)
1787           && compareDeep(type, o.type, true) && compareDeep(profile, o.profile, true);
1788      }
1789
1790      @Override
1791      public boolean equalsShallow(Base other) {
1792        if (!super.equalsShallow(other))
1793          return false;
1794        if (!(other instanceof ModuleDefinitionParameterComponent))
1795          return false;
1796        ModuleDefinitionParameterComponent o = (ModuleDefinitionParameterComponent) other;
1797        return compareValues(name, o.name, true) && compareValues(use, o.use, true) && compareValues(documentation, o.documentation, true)
1798           && compareValues(type, o.type, true);
1799      }
1800
1801      public boolean isEmpty() {
1802        return super.isEmpty() && (name == null || name.isEmpty()) && (use == null || use.isEmpty())
1803           && (documentation == null || documentation.isEmpty()) && (type == null || type.isEmpty())
1804           && (profile == null || profile.isEmpty());
1805      }
1806
1807  public String fhirType() {
1808    return "ModuleDefinition.parameter";
1809
1810  }
1811
1812  }
1813
1814    @Block()
1815    public static class ModuleDefinitionDataComponent extends BackboneElement implements IBaseBackboneElement {
1816        /**
1817         * The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.
1818         */
1819        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1820        @Description(shortDefinition="The type of the required data", formalDefinition="The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile." )
1821        protected CodeType type;
1822
1823        /**
1824         * The profile of the required data, specified as the uri of the profile definition.
1825         */
1826        @Child(name = "profile", type = {StructureDefinition.class}, order=2, min=0, max=1, modifier=false, summary=false)
1827        @Description(shortDefinition="The profile of the required data", formalDefinition="The profile of the required data, specified as the uri of the profile definition." )
1828        protected Reference profile;
1829
1830        /**
1831         * The actual object that is the target of the reference (The profile of the required data, specified as the uri of the profile definition.)
1832         */
1833        protected StructureDefinition profileTarget;
1834
1835        /**
1836         * Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available.
1837         */
1838        @Child(name = "mustSupport", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1839        @Description(shortDefinition="Indicates that specific structure elements are referenced by the knowledge module", formalDefinition="Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available." )
1840        protected List<StringType> mustSupport;
1841
1842        /**
1843         * Code filters for the required data, if any.
1844         */
1845        @Child(name = "codeFilter", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1846        @Description(shortDefinition="", formalDefinition="Code filters for the required data, if any." )
1847        protected List<ModuleDefinitionDataCodeFilterComponent> codeFilter;
1848
1849        /**
1850         * Date filters for the required data, if any.
1851         */
1852        @Child(name = "dateFilter", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1853        @Description(shortDefinition="", formalDefinition="Date filters for the required data, if any." )
1854        protected List<ModuleDefinitionDataDateFilterComponent> dateFilter;
1855
1856        private static final long serialVersionUID = -777236908L;
1857
1858    /**
1859     * Constructor
1860     */
1861      public ModuleDefinitionDataComponent() {
1862        super();
1863      }
1864
1865    /**
1866     * Constructor
1867     */
1868      public ModuleDefinitionDataComponent(CodeType type) {
1869        super();
1870        this.type = type;
1871      }
1872
1873        /**
1874         * @return {@link #type} (The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1875         */
1876        public CodeType getTypeElement() { 
1877          if (this.type == null)
1878            if (Configuration.errorOnAutoCreate())
1879              throw new Error("Attempt to auto-create ModuleDefinitionDataComponent.type");
1880            else if (Configuration.doAutoCreate())
1881              this.type = new CodeType(); // bb
1882          return this.type;
1883        }
1884
1885        public boolean hasTypeElement() { 
1886          return this.type != null && !this.type.isEmpty();
1887        }
1888
1889        public boolean hasType() { 
1890          return this.type != null && !this.type.isEmpty();
1891        }
1892
1893        /**
1894         * @param value {@link #type} (The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1895         */
1896        public ModuleDefinitionDataComponent setTypeElement(CodeType value) { 
1897          this.type = value;
1898          return this;
1899        }
1900
1901        /**
1902         * @return The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.
1903         */
1904        public String getType() { 
1905          return this.type == null ? null : this.type.getValue();
1906        }
1907
1908        /**
1909         * @param value The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.
1910         */
1911        public ModuleDefinitionDataComponent setType(String value) { 
1912            if (this.type == null)
1913              this.type = new CodeType();
1914            this.type.setValue(value);
1915          return this;
1916        }
1917
1918        /**
1919         * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1920         */
1921        public Reference getProfile() { 
1922          if (this.profile == null)
1923            if (Configuration.errorOnAutoCreate())
1924              throw new Error("Attempt to auto-create ModuleDefinitionDataComponent.profile");
1925            else if (Configuration.doAutoCreate())
1926              this.profile = new Reference(); // cc
1927          return this.profile;
1928        }
1929
1930        public boolean hasProfile() { 
1931          return this.profile != null && !this.profile.isEmpty();
1932        }
1933
1934        /**
1935         * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1936         */
1937        public ModuleDefinitionDataComponent setProfile(Reference value) { 
1938          this.profile = value;
1939          return this;
1940        }
1941
1942        /**
1943         * @return {@link #profile} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The profile of the required data, specified as the uri of the profile definition.)
1944         */
1945        public StructureDefinition getProfileTarget() { 
1946          if (this.profileTarget == null)
1947            if (Configuration.errorOnAutoCreate())
1948              throw new Error("Attempt to auto-create ModuleDefinitionDataComponent.profile");
1949            else if (Configuration.doAutoCreate())
1950              this.profileTarget = new StructureDefinition(); // aa
1951          return this.profileTarget;
1952        }
1953
1954        /**
1955         * @param value {@link #profile} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The profile of the required data, specified as the uri of the profile definition.)
1956         */
1957        public ModuleDefinitionDataComponent setProfileTarget(StructureDefinition value) { 
1958          this.profileTarget = value;
1959          return this;
1960        }
1961
1962        /**
1963         * @return {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available.)
1964         */
1965        public List<StringType> getMustSupport() { 
1966          if (this.mustSupport == null)
1967            this.mustSupport = new ArrayList<StringType>();
1968          return this.mustSupport;
1969        }
1970
1971        public boolean hasMustSupport() { 
1972          if (this.mustSupport == null)
1973            return false;
1974          for (StringType item : this.mustSupport)
1975            if (!item.isEmpty())
1976              return true;
1977          return false;
1978        }
1979
1980        /**
1981         * @return {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available.)
1982         */
1983    // syntactic sugar
1984        public StringType addMustSupportElement() {//2 
1985          StringType t = new StringType();
1986          if (this.mustSupport == null)
1987            this.mustSupport = new ArrayList<StringType>();
1988          this.mustSupport.add(t);
1989          return t;
1990        }
1991
1992        /**
1993         * @param value {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available.)
1994         */
1995        public ModuleDefinitionDataComponent addMustSupport(String value) { //1
1996          StringType t = new StringType();
1997          t.setValue(value);
1998          if (this.mustSupport == null)
1999            this.mustSupport = new ArrayList<StringType>();
2000          this.mustSupport.add(t);
2001          return this;
2002        }
2003
2004        /**
2005         * @param value {@link #mustSupport} (Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available.)
2006         */
2007        public boolean hasMustSupport(String value) { 
2008          if (this.mustSupport == null)
2009            return false;
2010          for (StringType v : this.mustSupport)
2011            if (v.equals(value)) // string
2012              return true;
2013          return false;
2014        }
2015
2016        /**
2017         * @return {@link #codeFilter} (Code filters for the required data, if any.)
2018         */
2019        public List<ModuleDefinitionDataCodeFilterComponent> getCodeFilter() { 
2020          if (this.codeFilter == null)
2021            this.codeFilter = new ArrayList<ModuleDefinitionDataCodeFilterComponent>();
2022          return this.codeFilter;
2023        }
2024
2025        public boolean hasCodeFilter() { 
2026          if (this.codeFilter == null)
2027            return false;
2028          for (ModuleDefinitionDataCodeFilterComponent item : this.codeFilter)
2029            if (!item.isEmpty())
2030              return true;
2031          return false;
2032        }
2033
2034        /**
2035         * @return {@link #codeFilter} (Code filters for the required data, if any.)
2036         */
2037    // syntactic sugar
2038        public ModuleDefinitionDataCodeFilterComponent addCodeFilter() { //3
2039          ModuleDefinitionDataCodeFilterComponent t = new ModuleDefinitionDataCodeFilterComponent();
2040          if (this.codeFilter == null)
2041            this.codeFilter = new ArrayList<ModuleDefinitionDataCodeFilterComponent>();
2042          this.codeFilter.add(t);
2043          return t;
2044        }
2045
2046    // syntactic sugar
2047        public ModuleDefinitionDataComponent addCodeFilter(ModuleDefinitionDataCodeFilterComponent t) { //3
2048          if (t == null)
2049            return this;
2050          if (this.codeFilter == null)
2051            this.codeFilter = new ArrayList<ModuleDefinitionDataCodeFilterComponent>();
2052          this.codeFilter.add(t);
2053          return this;
2054        }
2055
2056        /**
2057         * @return {@link #dateFilter} (Date filters for the required data, if any.)
2058         */
2059        public List<ModuleDefinitionDataDateFilterComponent> getDateFilter() { 
2060          if (this.dateFilter == null)
2061            this.dateFilter = new ArrayList<ModuleDefinitionDataDateFilterComponent>();
2062          return this.dateFilter;
2063        }
2064
2065        public boolean hasDateFilter() { 
2066          if (this.dateFilter == null)
2067            return false;
2068          for (ModuleDefinitionDataDateFilterComponent item : this.dateFilter)
2069            if (!item.isEmpty())
2070              return true;
2071          return false;
2072        }
2073
2074        /**
2075         * @return {@link #dateFilter} (Date filters for the required data, if any.)
2076         */
2077    // syntactic sugar
2078        public ModuleDefinitionDataDateFilterComponent addDateFilter() { //3
2079          ModuleDefinitionDataDateFilterComponent t = new ModuleDefinitionDataDateFilterComponent();
2080          if (this.dateFilter == null)
2081            this.dateFilter = new ArrayList<ModuleDefinitionDataDateFilterComponent>();
2082          this.dateFilter.add(t);
2083          return t;
2084        }
2085
2086    // syntactic sugar
2087        public ModuleDefinitionDataComponent addDateFilter(ModuleDefinitionDataDateFilterComponent t) { //3
2088          if (t == null)
2089            return this;
2090          if (this.dateFilter == null)
2091            this.dateFilter = new ArrayList<ModuleDefinitionDataDateFilterComponent>();
2092          this.dateFilter.add(t);
2093          return this;
2094        }
2095
2096        protected void listChildren(List<Property> childrenList) {
2097          super.listChildren(childrenList);
2098          childrenList.add(new Property("type", "code", "The type of the required data, specified as the type name of a resource. For profiles, this value is set to the type of the base resource of the profile.", 0, java.lang.Integer.MAX_VALUE, type));
2099          childrenList.add(new Property("profile", "Reference(StructureDefinition)", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile));
2100          childrenList.add(new Property("mustSupport", "string", "Indicates that specific elements of the type are referenced by the knowledge module and must be supported by the consumer in order to obtain an effective evaluation. This does not mean that a value is required for this element, only that the consuming system must understand the element and be able to provide values for it if they are available.", 0, java.lang.Integer.MAX_VALUE, mustSupport));
2101          childrenList.add(new Property("codeFilter", "", "Code filters for the required data, if any.", 0, java.lang.Integer.MAX_VALUE, codeFilter));
2102          childrenList.add(new Property("dateFilter", "", "Date filters for the required data, if any.", 0, java.lang.Integer.MAX_VALUE, dateFilter));
2103        }
2104
2105      @Override
2106      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2107        switch (hash) {
2108        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeType
2109        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : new Base[] {this.profile}; // Reference
2110        case -1402857082: /*mustSupport*/ return this.mustSupport == null ? new Base[0] : this.mustSupport.toArray(new Base[this.mustSupport.size()]); // StringType
2111        case -1303674939: /*codeFilter*/ return this.codeFilter == null ? new Base[0] : this.codeFilter.toArray(new Base[this.codeFilter.size()]); // ModuleDefinitionDataCodeFilterComponent
2112        case 149531846: /*dateFilter*/ return this.dateFilter == null ? new Base[0] : this.dateFilter.toArray(new Base[this.dateFilter.size()]); // ModuleDefinitionDataDateFilterComponent
2113        default: return super.getProperty(hash, name, checkValid);
2114        }
2115
2116      }
2117
2118      @Override
2119      public void setProperty(int hash, String name, Base value) throws FHIRException {
2120        switch (hash) {
2121        case 3575610: // type
2122          this.type = castToCode(value); // CodeType
2123          break;
2124        case -309425751: // profile
2125          this.profile = castToReference(value); // Reference
2126          break;
2127        case -1402857082: // mustSupport
2128          this.getMustSupport().add(castToString(value)); // StringType
2129          break;
2130        case -1303674939: // codeFilter
2131          this.getCodeFilter().add((ModuleDefinitionDataCodeFilterComponent) value); // ModuleDefinitionDataCodeFilterComponent
2132          break;
2133        case 149531846: // dateFilter
2134          this.getDateFilter().add((ModuleDefinitionDataDateFilterComponent) value); // ModuleDefinitionDataDateFilterComponent
2135          break;
2136        default: super.setProperty(hash, name, value);
2137        }
2138
2139      }
2140
2141      @Override
2142      public void setProperty(String name, Base value) throws FHIRException {
2143        if (name.equals("type"))
2144          this.type = castToCode(value); // CodeType
2145        else if (name.equals("profile"))
2146          this.profile = castToReference(value); // Reference
2147        else if (name.equals("mustSupport"))
2148          this.getMustSupport().add(castToString(value));
2149        else if (name.equals("codeFilter"))
2150          this.getCodeFilter().add((ModuleDefinitionDataCodeFilterComponent) value);
2151        else if (name.equals("dateFilter"))
2152          this.getDateFilter().add((ModuleDefinitionDataDateFilterComponent) value);
2153        else
2154          super.setProperty(name, value);
2155      }
2156
2157      @Override
2158      public Base makeProperty(int hash, String name) throws FHIRException {
2159        switch (hash) {
2160        case 3575610: throw new FHIRException("Cannot make property type as it is not a complex type"); // CodeType
2161        case -309425751:  return getProfile(); // Reference
2162        case -1402857082: throw new FHIRException("Cannot make property mustSupport as it is not a complex type"); // StringType
2163        case -1303674939:  return addCodeFilter(); // ModuleDefinitionDataCodeFilterComponent
2164        case 149531846:  return addDateFilter(); // ModuleDefinitionDataDateFilterComponent
2165        default: return super.makeProperty(hash, name);
2166        }
2167
2168      }
2169
2170      @Override
2171      public Base addChild(String name) throws FHIRException {
2172        if (name.equals("type")) {
2173          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.type");
2174        }
2175        else if (name.equals("profile")) {
2176          this.profile = new Reference();
2177          return this.profile;
2178        }
2179        else if (name.equals("mustSupport")) {
2180          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.mustSupport");
2181        }
2182        else if (name.equals("codeFilter")) {
2183          return addCodeFilter();
2184        }
2185        else if (name.equals("dateFilter")) {
2186          return addDateFilter();
2187        }
2188        else
2189          return super.addChild(name);
2190      }
2191
2192      public ModuleDefinitionDataComponent copy() {
2193        ModuleDefinitionDataComponent dst = new ModuleDefinitionDataComponent();
2194        copyValues(dst);
2195        dst.type = type == null ? null : type.copy();
2196        dst.profile = profile == null ? null : profile.copy();
2197        if (mustSupport != null) {
2198          dst.mustSupport = new ArrayList<StringType>();
2199          for (StringType i : mustSupport)
2200            dst.mustSupport.add(i.copy());
2201        };
2202        if (codeFilter != null) {
2203          dst.codeFilter = new ArrayList<ModuleDefinitionDataCodeFilterComponent>();
2204          for (ModuleDefinitionDataCodeFilterComponent i : codeFilter)
2205            dst.codeFilter.add(i.copy());
2206        };
2207        if (dateFilter != null) {
2208          dst.dateFilter = new ArrayList<ModuleDefinitionDataDateFilterComponent>();
2209          for (ModuleDefinitionDataDateFilterComponent i : dateFilter)
2210            dst.dateFilter.add(i.copy());
2211        };
2212        return dst;
2213      }
2214
2215      @Override
2216      public boolean equalsDeep(Base other) {
2217        if (!super.equalsDeep(other))
2218          return false;
2219        if (!(other instanceof ModuleDefinitionDataComponent))
2220          return false;
2221        ModuleDefinitionDataComponent o = (ModuleDefinitionDataComponent) other;
2222        return compareDeep(type, o.type, true) && compareDeep(profile, o.profile, true) && compareDeep(mustSupport, o.mustSupport, true)
2223           && compareDeep(codeFilter, o.codeFilter, true) && compareDeep(dateFilter, o.dateFilter, true);
2224      }
2225
2226      @Override
2227      public boolean equalsShallow(Base other) {
2228        if (!super.equalsShallow(other))
2229          return false;
2230        if (!(other instanceof ModuleDefinitionDataComponent))
2231          return false;
2232        ModuleDefinitionDataComponent o = (ModuleDefinitionDataComponent) other;
2233        return compareValues(type, o.type, true) && compareValues(mustSupport, o.mustSupport, true);
2234      }
2235
2236      public boolean isEmpty() {
2237        return super.isEmpty() && (type == null || type.isEmpty()) && (profile == null || profile.isEmpty())
2238           && (mustSupport == null || mustSupport.isEmpty()) && (codeFilter == null || codeFilter.isEmpty())
2239           && (dateFilter == null || dateFilter.isEmpty());
2240      }
2241
2242  public String fhirType() {
2243    return "ModuleDefinition.data";
2244
2245  }
2246
2247  }
2248
2249    @Block()
2250    public static class ModuleDefinitionDataCodeFilterComponent extends BackboneElement implements IBaseBackboneElement {
2251        /**
2252         * The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
2253         */
2254        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2255        @Description(shortDefinition="The code-valued attribute of the filter", formalDefinition="The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept." )
2256        protected StringType path;
2257
2258        /**
2259         * The valueset for the code filter. The valueSet or codeableConcept elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.
2260         */
2261        @Child(name = "valueSet", type = {StringType.class, ValueSet.class}, order=2, min=0, max=1, modifier=false, summary=false)
2262        @Description(shortDefinition="The valueset for the code filter", formalDefinition="The valueset for the code filter. The valueSet or codeableConcept elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset." )
2263        protected Type valueSet;
2264
2265        /**
2266         * The codeable concept for the code filter. Only one of valueSet or codeableConcept may be specified. If codeableConcepts are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codeable concepts.
2267         */
2268        @Child(name = "codeableConcept", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2269        @Description(shortDefinition="The codeableConcepts for the filter", formalDefinition="The codeable concept for the code filter. Only one of valueSet or codeableConcept may be specified. If codeableConcepts are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codeable concepts." )
2270        protected List<CodeableConcept> codeableConcept;
2271
2272        private static final long serialVersionUID = -666343535L;
2273
2274    /**
2275     * Constructor
2276     */
2277      public ModuleDefinitionDataCodeFilterComponent() {
2278        super();
2279      }
2280
2281    /**
2282     * Constructor
2283     */
2284      public ModuleDefinitionDataCodeFilterComponent(StringType path) {
2285        super();
2286        this.path = path;
2287      }
2288
2289        /**
2290         * @return {@link #path} (The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
2291         */
2292        public StringType getPathElement() { 
2293          if (this.path == null)
2294            if (Configuration.errorOnAutoCreate())
2295              throw new Error("Attempt to auto-create ModuleDefinitionDataCodeFilterComponent.path");
2296            else if (Configuration.doAutoCreate())
2297              this.path = new StringType(); // bb
2298          return this.path;
2299        }
2300
2301        public boolean hasPathElement() { 
2302          return this.path != null && !this.path.isEmpty();
2303        }
2304
2305        public boolean hasPath() { 
2306          return this.path != null && !this.path.isEmpty();
2307        }
2308
2309        /**
2310         * @param value {@link #path} (The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
2311         */
2312        public ModuleDefinitionDataCodeFilterComponent setPathElement(StringType value) { 
2313          this.path = value;
2314          return this;
2315        }
2316
2317        /**
2318         * @return The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
2319         */
2320        public String getPath() { 
2321          return this.path == null ? null : this.path.getValue();
2322        }
2323
2324        /**
2325         * @param value The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
2326         */
2327        public ModuleDefinitionDataCodeFilterComponent setPath(String value) { 
2328            if (this.path == null)
2329              this.path = new StringType();
2330            this.path.setValue(value);
2331          return this;
2332        }
2333
2334        /**
2335         * @return {@link #valueSet} (The valueset for the code filter. The valueSet or codeableConcept elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.)
2336         */
2337        public Type getValueSet() { 
2338          return this.valueSet;
2339        }
2340
2341        /**
2342         * @return {@link #valueSet} (The valueset for the code filter. The valueSet or codeableConcept elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.)
2343         */
2344        public StringType getValueSetStringType() throws FHIRException { 
2345          if (!(this.valueSet instanceof StringType))
2346            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.valueSet.getClass().getName()+" was encountered");
2347          return (StringType) this.valueSet;
2348        }
2349
2350        public boolean hasValueSetStringType() { 
2351          return this.valueSet instanceof StringType;
2352        }
2353
2354        /**
2355         * @return {@link #valueSet} (The valueset for the code filter. The valueSet or codeableConcept elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.)
2356         */
2357        public Reference getValueSetReference() throws FHIRException { 
2358          if (!(this.valueSet instanceof Reference))
2359            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.valueSet.getClass().getName()+" was encountered");
2360          return (Reference) this.valueSet;
2361        }
2362
2363        public boolean hasValueSetReference() { 
2364          return this.valueSet instanceof Reference;
2365        }
2366
2367        public boolean hasValueSet() { 
2368          return this.valueSet != null && !this.valueSet.isEmpty();
2369        }
2370
2371        /**
2372         * @param value {@link #valueSet} (The valueset for the code filter. The valueSet or codeableConcept elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.)
2373         */
2374        public ModuleDefinitionDataCodeFilterComponent setValueSet(Type value) { 
2375          this.valueSet = value;
2376          return this;
2377        }
2378
2379        /**
2380         * @return {@link #codeableConcept} (The codeable concept for the code filter. Only one of valueSet or codeableConcept may be specified. If codeableConcepts are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codeable concepts.)
2381         */
2382        public List<CodeableConcept> getCodeableConcept() { 
2383          if (this.codeableConcept == null)
2384            this.codeableConcept = new ArrayList<CodeableConcept>();
2385          return this.codeableConcept;
2386        }
2387
2388        public boolean hasCodeableConcept() { 
2389          if (this.codeableConcept == null)
2390            return false;
2391          for (CodeableConcept item : this.codeableConcept)
2392            if (!item.isEmpty())
2393              return true;
2394          return false;
2395        }
2396
2397        /**
2398         * @return {@link #codeableConcept} (The codeable concept for the code filter. Only one of valueSet or codeableConcept may be specified. If codeableConcepts are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codeable concepts.)
2399         */
2400    // syntactic sugar
2401        public CodeableConcept addCodeableConcept() { //3
2402          CodeableConcept t = new CodeableConcept();
2403          if (this.codeableConcept == null)
2404            this.codeableConcept = new ArrayList<CodeableConcept>();
2405          this.codeableConcept.add(t);
2406          return t;
2407        }
2408
2409    // syntactic sugar
2410        public ModuleDefinitionDataCodeFilterComponent addCodeableConcept(CodeableConcept t) { //3
2411          if (t == null)
2412            return this;
2413          if (this.codeableConcept == null)
2414            this.codeableConcept = new ArrayList<CodeableConcept>();
2415          this.codeableConcept.add(t);
2416          return this;
2417        }
2418
2419        protected void listChildren(List<Property> childrenList) {
2420          super.listChildren(childrenList);
2421          childrenList.add(new Property("path", "string", "The code-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.", 0, java.lang.Integer.MAX_VALUE, path));
2422          childrenList.add(new Property("valueSet[x]", "string|Reference(ValueSet)", "The valueset for the code filter. The valueSet or codeableConcept elements are exclusive. If valueSet is specified, the filter will return only those data items for which the value of the code-valued element specified in the path is a member of the specified valueset.", 0, java.lang.Integer.MAX_VALUE, valueSet));
2423          childrenList.add(new Property("codeableConcept", "CodeableConcept", "The codeable concept for the code filter. Only one of valueSet or codeableConcept may be specified. If codeableConcepts are given, the filter will return only those data items for which the code-valued attribute specified by the path has a value that is one of the specified codeable concepts.", 0, java.lang.Integer.MAX_VALUE, codeableConcept));
2424        }
2425
2426      @Override
2427      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2428        switch (hash) {
2429        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
2430        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // Type
2431        case -156504159: /*codeableConcept*/ return this.codeableConcept == null ? new Base[0] : this.codeableConcept.toArray(new Base[this.codeableConcept.size()]); // CodeableConcept
2432        default: return super.getProperty(hash, name, checkValid);
2433        }
2434
2435      }
2436
2437      @Override
2438      public void setProperty(int hash, String name, Base value) throws FHIRException {
2439        switch (hash) {
2440        case 3433509: // path
2441          this.path = castToString(value); // StringType
2442          break;
2443        case -1410174671: // valueSet
2444          this.valueSet = (Type) value; // Type
2445          break;
2446        case -156504159: // codeableConcept
2447          this.getCodeableConcept().add(castToCodeableConcept(value)); // CodeableConcept
2448          break;
2449        default: super.setProperty(hash, name, value);
2450        }
2451
2452      }
2453
2454      @Override
2455      public void setProperty(String name, Base value) throws FHIRException {
2456        if (name.equals("path"))
2457          this.path = castToString(value); // StringType
2458        else if (name.equals("valueSet[x]"))
2459          this.valueSet = (Type) value; // Type
2460        else if (name.equals("codeableConcept"))
2461          this.getCodeableConcept().add(castToCodeableConcept(value));
2462        else
2463          super.setProperty(name, value);
2464      }
2465
2466      @Override
2467      public Base makeProperty(int hash, String name) throws FHIRException {
2468        switch (hash) {
2469        case 3433509: throw new FHIRException("Cannot make property path as it is not a complex type"); // StringType
2470        case -1438410321:  return getValueSet(); // Type
2471        case -156504159:  return addCodeableConcept(); // CodeableConcept
2472        default: return super.makeProperty(hash, name);
2473        }
2474
2475      }
2476
2477      @Override
2478      public Base addChild(String name) throws FHIRException {
2479        if (name.equals("path")) {
2480          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.path");
2481        }
2482        else if (name.equals("valueSetString")) {
2483          this.valueSet = new StringType();
2484          return this.valueSet;
2485        }
2486        else if (name.equals("valueSetReference")) {
2487          this.valueSet = new Reference();
2488          return this.valueSet;
2489        }
2490        else if (name.equals("codeableConcept")) {
2491          return addCodeableConcept();
2492        }
2493        else
2494          return super.addChild(name);
2495      }
2496
2497      public ModuleDefinitionDataCodeFilterComponent copy() {
2498        ModuleDefinitionDataCodeFilterComponent dst = new ModuleDefinitionDataCodeFilterComponent();
2499        copyValues(dst);
2500        dst.path = path == null ? null : path.copy();
2501        dst.valueSet = valueSet == null ? null : valueSet.copy();
2502        if (codeableConcept != null) {
2503          dst.codeableConcept = new ArrayList<CodeableConcept>();
2504          for (CodeableConcept i : codeableConcept)
2505            dst.codeableConcept.add(i.copy());
2506        };
2507        return dst;
2508      }
2509
2510      @Override
2511      public boolean equalsDeep(Base other) {
2512        if (!super.equalsDeep(other))
2513          return false;
2514        if (!(other instanceof ModuleDefinitionDataCodeFilterComponent))
2515          return false;
2516        ModuleDefinitionDataCodeFilterComponent o = (ModuleDefinitionDataCodeFilterComponent) other;
2517        return compareDeep(path, o.path, true) && compareDeep(valueSet, o.valueSet, true) && compareDeep(codeableConcept, o.codeableConcept, true)
2518          ;
2519      }
2520
2521      @Override
2522      public boolean equalsShallow(Base other) {
2523        if (!super.equalsShallow(other))
2524          return false;
2525        if (!(other instanceof ModuleDefinitionDataCodeFilterComponent))
2526          return false;
2527        ModuleDefinitionDataCodeFilterComponent o = (ModuleDefinitionDataCodeFilterComponent) other;
2528        return compareValues(path, o.path, true);
2529      }
2530
2531      public boolean isEmpty() {
2532        return super.isEmpty() && (path == null || path.isEmpty()) && (valueSet == null || valueSet.isEmpty())
2533           && (codeableConcept == null || codeableConcept.isEmpty());
2534      }
2535
2536  public String fhirType() {
2537    return "ModuleDefinition.data.codeFilter";
2538
2539  }
2540
2541  }
2542
2543    @Block()
2544    public static class ModuleDefinitionDataDateFilterComponent extends BackboneElement implements IBaseBackboneElement {
2545        /**
2546         * The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.
2547         */
2548        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
2549        @Description(shortDefinition="The date-valued attribute of the filter", formalDefinition="The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing." )
2550        protected StringType path;
2551
2552        /**
2553         * The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime.
2554         */
2555        @Child(name = "value", type = {DateTimeType.class, Period.class}, order=2, min=0, max=1, modifier=false, summary=false)
2556        @Description(shortDefinition="The value of the filter, as a Period or dateTime value", formalDefinition="The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime." )
2557        protected Type value;
2558
2559        private static final long serialVersionUID = 1791957163L;
2560
2561    /**
2562     * Constructor
2563     */
2564      public ModuleDefinitionDataDateFilterComponent() {
2565        super();
2566      }
2567
2568    /**
2569     * Constructor
2570     */
2571      public ModuleDefinitionDataDateFilterComponent(StringType path) {
2572        super();
2573        this.path = path;
2574      }
2575
2576        /**
2577         * @return {@link #path} (The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
2578         */
2579        public StringType getPathElement() { 
2580          if (this.path == null)
2581            if (Configuration.errorOnAutoCreate())
2582              throw new Error("Attempt to auto-create ModuleDefinitionDataDateFilterComponent.path");
2583            else if (Configuration.doAutoCreate())
2584              this.path = new StringType(); // bb
2585          return this.path;
2586        }
2587
2588        public boolean hasPathElement() { 
2589          return this.path != null && !this.path.isEmpty();
2590        }
2591
2592        public boolean hasPath() { 
2593          return this.path != null && !this.path.isEmpty();
2594        }
2595
2596        /**
2597         * @param value {@link #path} (The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
2598         */
2599        public ModuleDefinitionDataDateFilterComponent setPathElement(StringType value) { 
2600          this.path = value;
2601          return this;
2602        }
2603
2604        /**
2605         * @return The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.
2606         */
2607        public String getPath() { 
2608          return this.path == null ? null : this.path.getValue();
2609        }
2610
2611        /**
2612         * @param value The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.
2613         */
2614        public ModuleDefinitionDataDateFilterComponent setPath(String value) { 
2615            if (this.path == null)
2616              this.path = new StringType();
2617            this.path.setValue(value);
2618          return this;
2619        }
2620
2621        /**
2622         * @return {@link #value} (The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime.)
2623         */
2624        public Type getValue() { 
2625          return this.value;
2626        }
2627
2628        /**
2629         * @return {@link #value} (The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime.)
2630         */
2631        public DateTimeType getValueDateTimeType() throws FHIRException { 
2632          if (!(this.value instanceof DateTimeType))
2633            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
2634          return (DateTimeType) this.value;
2635        }
2636
2637        public boolean hasValueDateTimeType() { 
2638          return this.value instanceof DateTimeType;
2639        }
2640
2641        /**
2642         * @return {@link #value} (The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime.)
2643         */
2644        public Period getValuePeriod() throws FHIRException { 
2645          if (!(this.value instanceof Period))
2646            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
2647          return (Period) this.value;
2648        }
2649
2650        public boolean hasValuePeriod() { 
2651          return this.value instanceof Period;
2652        }
2653
2654        public boolean hasValue() { 
2655          return this.value != null && !this.value.isEmpty();
2656        }
2657
2658        /**
2659         * @param value {@link #value} (The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime.)
2660         */
2661        public ModuleDefinitionDataDateFilterComponent setValue(Type value) { 
2662          this.value = value;
2663          return this;
2664        }
2665
2666        protected void listChildren(List<Property> childrenList) {
2667          super.listChildren(childrenList);
2668          childrenList.add(new Property("path", "string", "The date-valued attribute of the filter. The specified path must be resolvable from the type of the required data. The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements. Note that the index must be an integer constant. The path must resolve to an element of type dateTime, Period, Schedule, or Timing.", 0, java.lang.Integer.MAX_VALUE, path));
2669          childrenList.add(new Property("value[x]", "dateTime|Period", "The value of the filter. If period is specified, the filter will return only those data items that fall within the bounds determined by the Period, inclusive of the period boundaries. If dateTime is specified, the filter will return only those data items that are equal to the specified dateTime.", 0, java.lang.Integer.MAX_VALUE, value));
2670        }
2671
2672      @Override
2673      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2674        switch (hash) {
2675        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
2676        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
2677        default: return super.getProperty(hash, name, checkValid);
2678        }
2679
2680      }
2681
2682      @Override
2683      public void setProperty(int hash, String name, Base value) throws FHIRException {
2684        switch (hash) {
2685        case 3433509: // path
2686          this.path = castToString(value); // StringType
2687          break;
2688        case 111972721: // value
2689          this.value = (Type) value; // Type
2690          break;
2691        default: super.setProperty(hash, name, value);
2692        }
2693
2694      }
2695
2696      @Override
2697      public void setProperty(String name, Base value) throws FHIRException {
2698        if (name.equals("path"))
2699          this.path = castToString(value); // StringType
2700        else if (name.equals("value[x]"))
2701          this.value = (Type) value; // Type
2702        else
2703          super.setProperty(name, value);
2704      }
2705
2706      @Override
2707      public Base makeProperty(int hash, String name) throws FHIRException {
2708        switch (hash) {
2709        case 3433509: throw new FHIRException("Cannot make property path as it is not a complex type"); // StringType
2710        case -1410166417:  return getValue(); // Type
2711        default: return super.makeProperty(hash, name);
2712        }
2713
2714      }
2715
2716      @Override
2717      public Base addChild(String name) throws FHIRException {
2718        if (name.equals("path")) {
2719          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.path");
2720        }
2721        else if (name.equals("valueDateTime")) {
2722          this.value = new DateTimeType();
2723          return this.value;
2724        }
2725        else if (name.equals("valuePeriod")) {
2726          this.value = new Period();
2727          return this.value;
2728        }
2729        else
2730          return super.addChild(name);
2731      }
2732
2733      public ModuleDefinitionDataDateFilterComponent copy() {
2734        ModuleDefinitionDataDateFilterComponent dst = new ModuleDefinitionDataDateFilterComponent();
2735        copyValues(dst);
2736        dst.path = path == null ? null : path.copy();
2737        dst.value = value == null ? null : value.copy();
2738        return dst;
2739      }
2740
2741      @Override
2742      public boolean equalsDeep(Base other) {
2743        if (!super.equalsDeep(other))
2744          return false;
2745        if (!(other instanceof ModuleDefinitionDataDateFilterComponent))
2746          return false;
2747        ModuleDefinitionDataDateFilterComponent o = (ModuleDefinitionDataDateFilterComponent) other;
2748        return compareDeep(path, o.path, true) && compareDeep(value, o.value, true);
2749      }
2750
2751      @Override
2752      public boolean equalsShallow(Base other) {
2753        if (!super.equalsShallow(other))
2754          return false;
2755        if (!(other instanceof ModuleDefinitionDataDateFilterComponent))
2756          return false;
2757        ModuleDefinitionDataDateFilterComponent o = (ModuleDefinitionDataDateFilterComponent) other;
2758        return compareValues(path, o.path, true);
2759      }
2760
2761      public boolean isEmpty() {
2762        return super.isEmpty() && (path == null || path.isEmpty()) && (value == null || value.isEmpty())
2763          ;
2764      }
2765
2766  public String fhirType() {
2767    return "ModuleDefinition.data.dateFilter";
2768
2769  }
2770
2771  }
2772
2773    /**
2774     * A logical identifier for the module such as the CMS or NQF identifiers for a measure artifact.
2775     */
2776    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2777    @Description(shortDefinition="Logical identifier", formalDefinition="A logical identifier for the module such as the CMS or NQF identifiers for a measure artifact." )
2778    protected List<Identifier> identifier;
2779
2780    /**
2781     * The version of the module, if any. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge modules, refer to the Decision Support Service specification.
2782     */
2783    @Child(name = "version", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
2784    @Description(shortDefinition="The version of the module, if any", formalDefinition="The version of the module, if any. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge modules, refer to the Decision Support Service specification." )
2785    protected StringType version;
2786
2787    /**
2788     * A model reference used by the content.
2789     */
2790    @Child(name = "model", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2791    @Description(shortDefinition="", formalDefinition="A model reference used by the content." )
2792    protected List<ModuleDefinitionModelComponent> model;
2793
2794    /**
2795     * A library referenced by the module. The reference must consist of either an id, or a document reference.
2796     */
2797    @Child(name = "library", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2798    @Description(shortDefinition="A library referenced by the module", formalDefinition="A library referenced by the module. The reference must consist of either an id, or a document reference." )
2799    protected List<ModuleDefinitionLibraryComponent> library;
2800
2801    /**
2802     * A code system definition used within the knowledge module.
2803     */
2804    @Child(name = "codeSystem", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2805    @Description(shortDefinition="", formalDefinition="A code system definition used within the knowledge module." )
2806    protected List<ModuleDefinitionCodeSystemComponent> codeSystem;
2807
2808    /**
2809     * A value set definition used by the knowledge module.
2810     */
2811    @Child(name = "valueSet", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2812    @Description(shortDefinition="", formalDefinition="A value set definition used by the knowledge module." )
2813    protected List<ModuleDefinitionValueSetComponent> valueSet;
2814
2815    /**
2816     * Parameters to the module.
2817     */
2818    @Child(name = "parameter", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2819    @Description(shortDefinition="", formalDefinition="Parameters to the module." )
2820    protected List<ModuleDefinitionParameterComponent> parameter;
2821
2822    /**
2823     * Describes a required data item for evaluation in terms of the type of data, and optional code- or date-based filters of the data.
2824     */
2825    @Child(name = "data", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2826    @Description(shortDefinition="Describes a required data item", formalDefinition="Describes a required data item for evaluation in terms of the type of data, and optional code- or date-based filters of the data." )
2827    protected List<ModuleDefinitionDataComponent> data;
2828
2829    private static final long serialVersionUID = -1288058693L;
2830
2831  /**
2832   * Constructor
2833   */
2834    public ModuleDefinition() {
2835      super();
2836    }
2837
2838    /**
2839     * @return {@link #identifier} (A logical identifier for the module such as the CMS or NQF identifiers for a measure artifact.)
2840     */
2841    public List<Identifier> getIdentifier() { 
2842      if (this.identifier == null)
2843        this.identifier = new ArrayList<Identifier>();
2844      return this.identifier;
2845    }
2846
2847    public boolean hasIdentifier() { 
2848      if (this.identifier == null)
2849        return false;
2850      for (Identifier item : this.identifier)
2851        if (!item.isEmpty())
2852          return true;
2853      return false;
2854    }
2855
2856    /**
2857     * @return {@link #identifier} (A logical identifier for the module such as the CMS or NQF identifiers for a measure artifact.)
2858     */
2859    // syntactic sugar
2860    public Identifier addIdentifier() { //3
2861      Identifier t = new Identifier();
2862      if (this.identifier == null)
2863        this.identifier = new ArrayList<Identifier>();
2864      this.identifier.add(t);
2865      return t;
2866    }
2867
2868    // syntactic sugar
2869    public ModuleDefinition addIdentifier(Identifier t) { //3
2870      if (t == null)
2871        return this;
2872      if (this.identifier == null)
2873        this.identifier = new ArrayList<Identifier>();
2874      this.identifier.add(t);
2875      return this;
2876    }
2877
2878    /**
2879     * @return {@link #version} (The version of the module, if any. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge modules, refer to the Decision Support Service specification.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
2880     */
2881    public StringType getVersionElement() { 
2882      if (this.version == null)
2883        if (Configuration.errorOnAutoCreate())
2884          throw new Error("Attempt to auto-create ModuleDefinition.version");
2885        else if (Configuration.doAutoCreate())
2886          this.version = new StringType(); // bb
2887      return this.version;
2888    }
2889
2890    public boolean hasVersionElement() { 
2891      return this.version != null && !this.version.isEmpty();
2892    }
2893
2894    public boolean hasVersion() { 
2895      return this.version != null && !this.version.isEmpty();
2896    }
2897
2898    /**
2899     * @param value {@link #version} (The version of the module, if any. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge modules, refer to the Decision Support Service specification.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
2900     */
2901    public ModuleDefinition setVersionElement(StringType value) { 
2902      this.version = value;
2903      return this;
2904    }
2905
2906    /**
2907     * @return The version of the module, if any. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge modules, refer to the Decision Support Service specification.
2908     */
2909    public String getVersion() { 
2910      return this.version == null ? null : this.version.getValue();
2911    }
2912
2913    /**
2914     * @param value The version of the module, if any. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge modules, refer to the Decision Support Service specification.
2915     */
2916    public ModuleDefinition setVersion(String value) { 
2917      if (Utilities.noString(value))
2918        this.version = null;
2919      else {
2920        if (this.version == null)
2921          this.version = new StringType();
2922        this.version.setValue(value);
2923      }
2924      return this;
2925    }
2926
2927    /**
2928     * @return {@link #model} (A model reference used by the content.)
2929     */
2930    public List<ModuleDefinitionModelComponent> getModel() { 
2931      if (this.model == null)
2932        this.model = new ArrayList<ModuleDefinitionModelComponent>();
2933      return this.model;
2934    }
2935
2936    public boolean hasModel() { 
2937      if (this.model == null)
2938        return false;
2939      for (ModuleDefinitionModelComponent item : this.model)
2940        if (!item.isEmpty())
2941          return true;
2942      return false;
2943    }
2944
2945    /**
2946     * @return {@link #model} (A model reference used by the content.)
2947     */
2948    // syntactic sugar
2949    public ModuleDefinitionModelComponent addModel() { //3
2950      ModuleDefinitionModelComponent t = new ModuleDefinitionModelComponent();
2951      if (this.model == null)
2952        this.model = new ArrayList<ModuleDefinitionModelComponent>();
2953      this.model.add(t);
2954      return t;
2955    }
2956
2957    // syntactic sugar
2958    public ModuleDefinition addModel(ModuleDefinitionModelComponent t) { //3
2959      if (t == null)
2960        return this;
2961      if (this.model == null)
2962        this.model = new ArrayList<ModuleDefinitionModelComponent>();
2963      this.model.add(t);
2964      return this;
2965    }
2966
2967    /**
2968     * @return {@link #library} (A library referenced by the module. The reference must consist of either an id, or a document reference.)
2969     */
2970    public List<ModuleDefinitionLibraryComponent> getLibrary() { 
2971      if (this.library == null)
2972        this.library = new ArrayList<ModuleDefinitionLibraryComponent>();
2973      return this.library;
2974    }
2975
2976    public boolean hasLibrary() { 
2977      if (this.library == null)
2978        return false;
2979      for (ModuleDefinitionLibraryComponent item : this.library)
2980        if (!item.isEmpty())
2981          return true;
2982      return false;
2983    }
2984
2985    /**
2986     * @return {@link #library} (A library referenced by the module. The reference must consist of either an id, or a document reference.)
2987     */
2988    // syntactic sugar
2989    public ModuleDefinitionLibraryComponent addLibrary() { //3
2990      ModuleDefinitionLibraryComponent t = new ModuleDefinitionLibraryComponent();
2991      if (this.library == null)
2992        this.library = new ArrayList<ModuleDefinitionLibraryComponent>();
2993      this.library.add(t);
2994      return t;
2995    }
2996
2997    // syntactic sugar
2998    public ModuleDefinition addLibrary(ModuleDefinitionLibraryComponent t) { //3
2999      if (t == null)
3000        return this;
3001      if (this.library == null)
3002        this.library = new ArrayList<ModuleDefinitionLibraryComponent>();
3003      this.library.add(t);
3004      return this;
3005    }
3006
3007    /**
3008     * @return {@link #codeSystem} (A code system definition used within the knowledge module.)
3009     */
3010    public List<ModuleDefinitionCodeSystemComponent> getCodeSystem() { 
3011      if (this.codeSystem == null)
3012        this.codeSystem = new ArrayList<ModuleDefinitionCodeSystemComponent>();
3013      return this.codeSystem;
3014    }
3015
3016    public boolean hasCodeSystem() { 
3017      if (this.codeSystem == null)
3018        return false;
3019      for (ModuleDefinitionCodeSystemComponent item : this.codeSystem)
3020        if (!item.isEmpty())
3021          return true;
3022      return false;
3023    }
3024
3025    /**
3026     * @return {@link #codeSystem} (A code system definition used within the knowledge module.)
3027     */
3028    // syntactic sugar
3029    public ModuleDefinitionCodeSystemComponent addCodeSystem() { //3
3030      ModuleDefinitionCodeSystemComponent t = new ModuleDefinitionCodeSystemComponent();
3031      if (this.codeSystem == null)
3032        this.codeSystem = new ArrayList<ModuleDefinitionCodeSystemComponent>();
3033      this.codeSystem.add(t);
3034      return t;
3035    }
3036
3037    // syntactic sugar
3038    public ModuleDefinition addCodeSystem(ModuleDefinitionCodeSystemComponent t) { //3
3039      if (t == null)
3040        return this;
3041      if (this.codeSystem == null)
3042        this.codeSystem = new ArrayList<ModuleDefinitionCodeSystemComponent>();
3043      this.codeSystem.add(t);
3044      return this;
3045    }
3046
3047    /**
3048     * @return {@link #valueSet} (A value set definition used by the knowledge module.)
3049     */
3050    public List<ModuleDefinitionValueSetComponent> getValueSet() { 
3051      if (this.valueSet == null)
3052        this.valueSet = new ArrayList<ModuleDefinitionValueSetComponent>();
3053      return this.valueSet;
3054    }
3055
3056    public boolean hasValueSet() { 
3057      if (this.valueSet == null)
3058        return false;
3059      for (ModuleDefinitionValueSetComponent item : this.valueSet)
3060        if (!item.isEmpty())
3061          return true;
3062      return false;
3063    }
3064
3065    /**
3066     * @return {@link #valueSet} (A value set definition used by the knowledge module.)
3067     */
3068    // syntactic sugar
3069    public ModuleDefinitionValueSetComponent addValueSet() { //3
3070      ModuleDefinitionValueSetComponent t = new ModuleDefinitionValueSetComponent();
3071      if (this.valueSet == null)
3072        this.valueSet = new ArrayList<ModuleDefinitionValueSetComponent>();
3073      this.valueSet.add(t);
3074      return t;
3075    }
3076
3077    // syntactic sugar
3078    public ModuleDefinition addValueSet(ModuleDefinitionValueSetComponent t) { //3
3079      if (t == null)
3080        return this;
3081      if (this.valueSet == null)
3082        this.valueSet = new ArrayList<ModuleDefinitionValueSetComponent>();
3083      this.valueSet.add(t);
3084      return this;
3085    }
3086
3087    /**
3088     * @return {@link #parameter} (Parameters to the module.)
3089     */
3090    public List<ModuleDefinitionParameterComponent> getParameter() { 
3091      if (this.parameter == null)
3092        this.parameter = new ArrayList<ModuleDefinitionParameterComponent>();
3093      return this.parameter;
3094    }
3095
3096    public boolean hasParameter() { 
3097      if (this.parameter == null)
3098        return false;
3099      for (ModuleDefinitionParameterComponent item : this.parameter)
3100        if (!item.isEmpty())
3101          return true;
3102      return false;
3103    }
3104
3105    /**
3106     * @return {@link #parameter} (Parameters to the module.)
3107     */
3108    // syntactic sugar
3109    public ModuleDefinitionParameterComponent addParameter() { //3
3110      ModuleDefinitionParameterComponent t = new ModuleDefinitionParameterComponent();
3111      if (this.parameter == null)
3112        this.parameter = new ArrayList<ModuleDefinitionParameterComponent>();
3113      this.parameter.add(t);
3114      return t;
3115    }
3116
3117    // syntactic sugar
3118    public ModuleDefinition addParameter(ModuleDefinitionParameterComponent t) { //3
3119      if (t == null)
3120        return this;
3121      if (this.parameter == null)
3122        this.parameter = new ArrayList<ModuleDefinitionParameterComponent>();
3123      this.parameter.add(t);
3124      return this;
3125    }
3126
3127    /**
3128     * @return {@link #data} (Describes a required data item for evaluation in terms of the type of data, and optional code- or date-based filters of the data.)
3129     */
3130    public List<ModuleDefinitionDataComponent> getData() { 
3131      if (this.data == null)
3132        this.data = new ArrayList<ModuleDefinitionDataComponent>();
3133      return this.data;
3134    }
3135
3136    public boolean hasData() { 
3137      if (this.data == null)
3138        return false;
3139      for (ModuleDefinitionDataComponent item : this.data)
3140        if (!item.isEmpty())
3141          return true;
3142      return false;
3143    }
3144
3145    /**
3146     * @return {@link #data} (Describes a required data item for evaluation in terms of the type of data, and optional code- or date-based filters of the data.)
3147     */
3148    // syntactic sugar
3149    public ModuleDefinitionDataComponent addData() { //3
3150      ModuleDefinitionDataComponent t = new ModuleDefinitionDataComponent();
3151      if (this.data == null)
3152        this.data = new ArrayList<ModuleDefinitionDataComponent>();
3153      this.data.add(t);
3154      return t;
3155    }
3156
3157    // syntactic sugar
3158    public ModuleDefinition addData(ModuleDefinitionDataComponent t) { //3
3159      if (t == null)
3160        return this;
3161      if (this.data == null)
3162        this.data = new ArrayList<ModuleDefinitionDataComponent>();
3163      this.data.add(t);
3164      return this;
3165    }
3166
3167      protected void listChildren(List<Property> childrenList) {
3168        super.listChildren(childrenList);
3169        childrenList.add(new Property("identifier", "Identifier", "A logical identifier for the module such as the CMS or NQF identifiers for a measure artifact.", 0, java.lang.Integer.MAX_VALUE, identifier));
3170        childrenList.add(new Property("version", "string", "The version of the module, if any. To provide a version consistent with the Decision Support Service specification, use the format Major.Minor.Revision (e.g. 1.0.0). For more information on versioning knowledge modules, refer to the Decision Support Service specification.", 0, java.lang.Integer.MAX_VALUE, version));
3171        childrenList.add(new Property("model", "", "A model reference used by the content.", 0, java.lang.Integer.MAX_VALUE, model));
3172        childrenList.add(new Property("library", "", "A library referenced by the module. The reference must consist of either an id, or a document reference.", 0, java.lang.Integer.MAX_VALUE, library));
3173        childrenList.add(new Property("codeSystem", "", "A code system definition used within the knowledge module.", 0, java.lang.Integer.MAX_VALUE, codeSystem));
3174        childrenList.add(new Property("valueSet", "", "A value set definition used by the knowledge module.", 0, java.lang.Integer.MAX_VALUE, valueSet));
3175        childrenList.add(new Property("parameter", "", "Parameters to the module.", 0, java.lang.Integer.MAX_VALUE, parameter));
3176        childrenList.add(new Property("data", "", "Describes a required data item for evaluation in terms of the type of data, and optional code- or date-based filters of the data.", 0, java.lang.Integer.MAX_VALUE, data));
3177      }
3178
3179      @Override
3180      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3181        switch (hash) {
3182        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3183        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
3184        case 104069929: /*model*/ return this.model == null ? new Base[0] : this.model.toArray(new Base[this.model.size()]); // ModuleDefinitionModelComponent
3185        case 166208699: /*library*/ return this.library == null ? new Base[0] : this.library.toArray(new Base[this.library.size()]); // ModuleDefinitionLibraryComponent
3186        case -916511108: /*codeSystem*/ return this.codeSystem == null ? new Base[0] : this.codeSystem.toArray(new Base[this.codeSystem.size()]); // ModuleDefinitionCodeSystemComponent
3187        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : this.valueSet.toArray(new Base[this.valueSet.size()]); // ModuleDefinitionValueSetComponent
3188        case 1954460585: /*parameter*/ return this.parameter == null ? new Base[0] : this.parameter.toArray(new Base[this.parameter.size()]); // ModuleDefinitionParameterComponent
3189        case 3076010: /*data*/ return this.data == null ? new Base[0] : this.data.toArray(new Base[this.data.size()]); // ModuleDefinitionDataComponent
3190        default: return super.getProperty(hash, name, checkValid);
3191        }
3192
3193      }
3194
3195      @Override
3196      public void setProperty(int hash, String name, Base value) throws FHIRException {
3197        switch (hash) {
3198        case -1618432855: // identifier
3199          this.getIdentifier().add(castToIdentifier(value)); // Identifier
3200          break;
3201        case 351608024: // version
3202          this.version = castToString(value); // StringType
3203          break;
3204        case 104069929: // model
3205          this.getModel().add((ModuleDefinitionModelComponent) value); // ModuleDefinitionModelComponent
3206          break;
3207        case 166208699: // library
3208          this.getLibrary().add((ModuleDefinitionLibraryComponent) value); // ModuleDefinitionLibraryComponent
3209          break;
3210        case -916511108: // codeSystem
3211          this.getCodeSystem().add((ModuleDefinitionCodeSystemComponent) value); // ModuleDefinitionCodeSystemComponent
3212          break;
3213        case -1410174671: // valueSet
3214          this.getValueSet().add((ModuleDefinitionValueSetComponent) value); // ModuleDefinitionValueSetComponent
3215          break;
3216        case 1954460585: // parameter
3217          this.getParameter().add((ModuleDefinitionParameterComponent) value); // ModuleDefinitionParameterComponent
3218          break;
3219        case 3076010: // data
3220          this.getData().add((ModuleDefinitionDataComponent) value); // ModuleDefinitionDataComponent
3221          break;
3222        default: super.setProperty(hash, name, value);
3223        }
3224
3225      }
3226
3227      @Override
3228      public void setProperty(String name, Base value) throws FHIRException {
3229        if (name.equals("identifier"))
3230          this.getIdentifier().add(castToIdentifier(value));
3231        else if (name.equals("version"))
3232          this.version = castToString(value); // StringType
3233        else if (name.equals("model"))
3234          this.getModel().add((ModuleDefinitionModelComponent) value);
3235        else if (name.equals("library"))
3236          this.getLibrary().add((ModuleDefinitionLibraryComponent) value);
3237        else if (name.equals("codeSystem"))
3238          this.getCodeSystem().add((ModuleDefinitionCodeSystemComponent) value);
3239        else if (name.equals("valueSet"))
3240          this.getValueSet().add((ModuleDefinitionValueSetComponent) value);
3241        else if (name.equals("parameter"))
3242          this.getParameter().add((ModuleDefinitionParameterComponent) value);
3243        else if (name.equals("data"))
3244          this.getData().add((ModuleDefinitionDataComponent) value);
3245        else
3246          super.setProperty(name, value);
3247      }
3248
3249      @Override
3250      public Base makeProperty(int hash, String name) throws FHIRException {
3251        switch (hash) {
3252        case -1618432855:  return addIdentifier(); // Identifier
3253        case 351608024: throw new FHIRException("Cannot make property version as it is not a complex type"); // StringType
3254        case 104069929:  return addModel(); // ModuleDefinitionModelComponent
3255        case 166208699:  return addLibrary(); // ModuleDefinitionLibraryComponent
3256        case -916511108:  return addCodeSystem(); // ModuleDefinitionCodeSystemComponent
3257        case -1410174671:  return addValueSet(); // ModuleDefinitionValueSetComponent
3258        case 1954460585:  return addParameter(); // ModuleDefinitionParameterComponent
3259        case 3076010:  return addData(); // ModuleDefinitionDataComponent
3260        default: return super.makeProperty(hash, name);
3261        }
3262
3263      }
3264
3265      @Override
3266      public Base addChild(String name) throws FHIRException {
3267        if (name.equals("identifier")) {
3268          return addIdentifier();
3269        }
3270        else if (name.equals("version")) {
3271          throw new FHIRException("Cannot call addChild on a primitive type ModuleDefinition.version");
3272        }
3273        else if (name.equals("model")) {
3274          return addModel();
3275        }
3276        else if (name.equals("library")) {
3277          return addLibrary();
3278        }
3279        else if (name.equals("codeSystem")) {
3280          return addCodeSystem();
3281        }
3282        else if (name.equals("valueSet")) {
3283          return addValueSet();
3284        }
3285        else if (name.equals("parameter")) {
3286          return addParameter();
3287        }
3288        else if (name.equals("data")) {
3289          return addData();
3290        }
3291        else
3292          return super.addChild(name);
3293      }
3294
3295  public String fhirType() {
3296    return "ModuleDefinition";
3297
3298  }
3299
3300      public ModuleDefinition copy() {
3301        ModuleDefinition dst = new ModuleDefinition();
3302        copyValues(dst);
3303        if (identifier != null) {
3304          dst.identifier = new ArrayList<Identifier>();
3305          for (Identifier i : identifier)
3306            dst.identifier.add(i.copy());
3307        };
3308        dst.version = version == null ? null : version.copy();
3309        if (model != null) {
3310          dst.model = new ArrayList<ModuleDefinitionModelComponent>();
3311          for (ModuleDefinitionModelComponent i : model)
3312            dst.model.add(i.copy());
3313        };
3314        if (library != null) {
3315          dst.library = new ArrayList<ModuleDefinitionLibraryComponent>();
3316          for (ModuleDefinitionLibraryComponent i : library)
3317            dst.library.add(i.copy());
3318        };
3319        if (codeSystem != null) {
3320          dst.codeSystem = new ArrayList<ModuleDefinitionCodeSystemComponent>();
3321          for (ModuleDefinitionCodeSystemComponent i : codeSystem)
3322            dst.codeSystem.add(i.copy());
3323        };
3324        if (valueSet != null) {
3325          dst.valueSet = new ArrayList<ModuleDefinitionValueSetComponent>();
3326          for (ModuleDefinitionValueSetComponent i : valueSet)
3327            dst.valueSet.add(i.copy());
3328        };
3329        if (parameter != null) {
3330          dst.parameter = new ArrayList<ModuleDefinitionParameterComponent>();
3331          for (ModuleDefinitionParameterComponent i : parameter)
3332            dst.parameter.add(i.copy());
3333        };
3334        if (data != null) {
3335          dst.data = new ArrayList<ModuleDefinitionDataComponent>();
3336          for (ModuleDefinitionDataComponent i : data)
3337            dst.data.add(i.copy());
3338        };
3339        return dst;
3340      }
3341
3342      protected ModuleDefinition typedCopy() {
3343        return copy();
3344      }
3345
3346      @Override
3347      public boolean equalsDeep(Base other) {
3348        if (!super.equalsDeep(other))
3349          return false;
3350        if (!(other instanceof ModuleDefinition))
3351          return false;
3352        ModuleDefinition o = (ModuleDefinition) other;
3353        return compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true) && compareDeep(model, o.model, true)
3354           && compareDeep(library, o.library, true) && compareDeep(codeSystem, o.codeSystem, true) && compareDeep(valueSet, o.valueSet, true)
3355           && compareDeep(parameter, o.parameter, true) && compareDeep(data, o.data, true);
3356      }
3357
3358      @Override
3359      public boolean equalsShallow(Base other) {
3360        if (!super.equalsShallow(other))
3361          return false;
3362        if (!(other instanceof ModuleDefinition))
3363          return false;
3364        ModuleDefinition o = (ModuleDefinition) other;
3365        return compareValues(version, o.version, true);
3366      }
3367
3368      public boolean isEmpty() {
3369        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (version == null || version.isEmpty())
3370           && (model == null || model.isEmpty()) && (library == null || library.isEmpty()) && (codeSystem == null || codeSystem.isEmpty())
3371           && (valueSet == null || valueSet.isEmpty()) && (parameter == null || parameter.isEmpty())
3372           && (data == null || data.isEmpty());
3373      }
3374
3375  @Override
3376  public ResourceType getResourceType() {
3377    return ResourceType.ModuleDefinition;
3378   }
3379
3380
3381}
3382