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