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.IBaseDatatypeElement;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042
043import ca.uhn.fhir.model.api.annotation.Block;
044import ca.uhn.fhir.model.api.annotation.Child;
045import ca.uhn.fhir.model.api.annotation.DatatypeDef;
046import ca.uhn.fhir.model.api.annotation.Description;
047/**
048 * Describes a required data item for evaluation in terms of the type of data, and optional code- or date-based filters of the data.
049 */
050@DatatypeDef(name="DataRequirement")
051public class DataRequirement extends Type implements ICompositeType {
052
053    @Block()
054    public static class DataRequirementCodeFilterComponent extends Element implements IBaseDatatypeElement {
055        /**
056         * 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.
057         */
058        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
059        @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." )
060        protected StringType path;
061
062        /**
063         * The valueset for the code filter. The valueSet and value 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.
064         */
065        @Child(name = "valueSet", type = {StringType.class, ValueSet.class}, order=2, min=0, max=1, modifier=false, summary=true)
066        @Description(shortDefinition="Valueset for the filter", formalDefinition="The valueset for the code filter. The valueSet and value 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." )
067        protected Type valueSet;
068
069        /**
070         * The codes for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 codes.
071         */
072        @Child(name = "valueCode", type = {CodeType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
073        @Description(shortDefinition="Code value of the filter", formalDefinition="The codes for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 codes." )
074        protected List<CodeType> valueCode;
075
076        /**
077         * The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 Codings.
078         */
079        @Child(name = "valueCoding", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
080        @Description(shortDefinition="Coding value of the filter", formalDefinition="The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 Codings." )
081        protected List<Coding> valueCoding;
082
083        /**
084         * The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 CodeableConcepts.
085         */
086        @Child(name = "valueCodeableConcept", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
087        @Description(shortDefinition="CodeableConcept value of the filter", formalDefinition="The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 CodeableConcepts." )
088        protected List<CodeableConcept> valueCodeableConcept;
089
090        private static final long serialVersionUID = -888422840L;
091
092    /**
093     * Constructor
094     */
095      public DataRequirementCodeFilterComponent() {
096        super();
097      }
098
099    /**
100     * Constructor
101     */
102      public DataRequirementCodeFilterComponent(StringType path) {
103        super();
104        this.path = path;
105      }
106
107        /**
108         * @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
109         */
110        public StringType getPathElement() { 
111          if (this.path == null)
112            if (Configuration.errorOnAutoCreate())
113              throw new Error("Attempt to auto-create DataRequirementCodeFilterComponent.path");
114            else if (Configuration.doAutoCreate())
115              this.path = new StringType(); // bb
116          return this.path;
117        }
118
119        public boolean hasPathElement() { 
120          return this.path != null && !this.path.isEmpty();
121        }
122
123        public boolean hasPath() { 
124          return this.path != null && !this.path.isEmpty();
125        }
126
127        /**
128         * @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
129         */
130        public DataRequirementCodeFilterComponent setPathElement(StringType value) { 
131          this.path = value;
132          return this;
133        }
134
135        /**
136         * @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.
137         */
138        public String getPath() { 
139          return this.path == null ? null : this.path.getValue();
140        }
141
142        /**
143         * @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.
144         */
145        public DataRequirementCodeFilterComponent setPath(String value) { 
146            if (this.path == null)
147              this.path = new StringType();
148            this.path.setValue(value);
149          return this;
150        }
151
152        /**
153         * @return {@link #valueSet} (The valueset for the code filter. The valueSet and value 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.)
154         */
155        public Type getValueSet() { 
156          return this.valueSet;
157        }
158
159        /**
160         * @return {@link #valueSet} (The valueset for the code filter. The valueSet and value 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.)
161         */
162        public StringType getValueSetStringType() throws FHIRException { 
163          if (!(this.valueSet instanceof StringType))
164            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.valueSet.getClass().getName()+" was encountered");
165          return (StringType) this.valueSet;
166        }
167
168        public boolean hasValueSetStringType() { 
169          return this.valueSet instanceof StringType;
170        }
171
172        /**
173         * @return {@link #valueSet} (The valueset for the code filter. The valueSet and value 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.)
174         */
175        public Reference getValueSetReference() throws FHIRException { 
176          if (!(this.valueSet instanceof Reference))
177            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.valueSet.getClass().getName()+" was encountered");
178          return (Reference) this.valueSet;
179        }
180
181        public boolean hasValueSetReference() { 
182          return this.valueSet instanceof Reference;
183        }
184
185        public boolean hasValueSet() { 
186          return this.valueSet != null && !this.valueSet.isEmpty();
187        }
188
189        /**
190         * @param value {@link #valueSet} (The valueset for the code filter. The valueSet and value 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.)
191         */
192        public DataRequirementCodeFilterComponent setValueSet(Type value) { 
193          this.valueSet = value;
194          return this;
195        }
196
197        /**
198         * @return {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 codes.)
199         */
200        public List<CodeType> getValueCode() { 
201          if (this.valueCode == null)
202            this.valueCode = new ArrayList<CodeType>();
203          return this.valueCode;
204        }
205
206        public boolean hasValueCode() { 
207          if (this.valueCode == null)
208            return false;
209          for (CodeType item : this.valueCode)
210            if (!item.isEmpty())
211              return true;
212          return false;
213        }
214
215        /**
216         * @return {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 codes.)
217         */
218    // syntactic sugar
219        public CodeType addValueCodeElement() {//2 
220          CodeType t = new CodeType();
221          if (this.valueCode == null)
222            this.valueCode = new ArrayList<CodeType>();
223          this.valueCode.add(t);
224          return t;
225        }
226
227        /**
228         * @param value {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 codes.)
229         */
230        public DataRequirementCodeFilterComponent addValueCode(String value) { //1
231          CodeType t = new CodeType();
232          t.setValue(value);
233          if (this.valueCode == null)
234            this.valueCode = new ArrayList<CodeType>();
235          this.valueCode.add(t);
236          return this;
237        }
238
239        /**
240         * @param value {@link #valueCode} (The codes for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 codes.)
241         */
242        public boolean hasValueCode(String value) { 
243          if (this.valueCode == null)
244            return false;
245          for (CodeType v : this.valueCode)
246            if (v.equals(value)) // code
247              return true;
248          return false;
249        }
250
251        /**
252         * @return {@link #valueCoding} (The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 Codings.)
253         */
254        public List<Coding> getValueCoding() { 
255          if (this.valueCoding == null)
256            this.valueCoding = new ArrayList<Coding>();
257          return this.valueCoding;
258        }
259
260        public boolean hasValueCoding() { 
261          if (this.valueCoding == null)
262            return false;
263          for (Coding item : this.valueCoding)
264            if (!item.isEmpty())
265              return true;
266          return false;
267        }
268
269        /**
270         * @return {@link #valueCoding} (The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 Codings.)
271         */
272    // syntactic sugar
273        public Coding addValueCoding() { //3
274          Coding t = new Coding();
275          if (this.valueCoding == null)
276            this.valueCoding = new ArrayList<Coding>();
277          this.valueCoding.add(t);
278          return t;
279        }
280
281    // syntactic sugar
282        public DataRequirementCodeFilterComponent addValueCoding(Coding t) { //3
283          if (t == null)
284            return this;
285          if (this.valueCoding == null)
286            this.valueCoding = new ArrayList<Coding>();
287          this.valueCoding.add(t);
288          return this;
289        }
290
291        /**
292         * @return {@link #valueCodeableConcept} (The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 CodeableConcepts.)
293         */
294        public List<CodeableConcept> getValueCodeableConcept() { 
295          if (this.valueCodeableConcept == null)
296            this.valueCodeableConcept = new ArrayList<CodeableConcept>();
297          return this.valueCodeableConcept;
298        }
299
300        public boolean hasValueCodeableConcept() { 
301          if (this.valueCodeableConcept == null)
302            return false;
303          for (CodeableConcept item : this.valueCodeableConcept)
304            if (!item.isEmpty())
305              return true;
306          return false;
307        }
308
309        /**
310         * @return {@link #valueCodeableConcept} (The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 CodeableConcepts.)
311         */
312    // syntactic sugar
313        public CodeableConcept addValueCodeableConcept() { //3
314          CodeableConcept t = new CodeableConcept();
315          if (this.valueCodeableConcept == null)
316            this.valueCodeableConcept = new ArrayList<CodeableConcept>();
317          this.valueCodeableConcept.add(t);
318          return t;
319        }
320
321    // syntactic sugar
322        public DataRequirementCodeFilterComponent addValueCodeableConcept(CodeableConcept t) { //3
323          if (t == null)
324            return this;
325          if (this.valueCodeableConcept == null)
326            this.valueCodeableConcept = new ArrayList<CodeableConcept>();
327          this.valueCodeableConcept.add(t);
328          return this;
329        }
330
331        protected void listChildren(List<Property> childrenList) {
332          super.listChildren(childrenList);
333          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));
334          childrenList.add(new Property("valueSet[x]", "string|Reference(ValueSet)", "The valueset for the code filter. The valueSet and value 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));
335          childrenList.add(new Property("valueCode", "code", "The codes for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 codes.", 0, java.lang.Integer.MAX_VALUE, valueCode));
336          childrenList.add(new Property("valueCoding", "Coding", "The Codings for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 Codings.", 0, java.lang.Integer.MAX_VALUE, valueCoding));
337          childrenList.add(new Property("valueCodeableConcept", "CodeableConcept", "The CodeableConcepts for the code filter. Only one of valueSet, valueCode, valueConding, or valueCodeableConcept may be specified. If values 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 CodeableConcepts.", 0, java.lang.Integer.MAX_VALUE, valueCodeableConcept));
338        }
339
340      @Override
341      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
342        switch (hash) {
343        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
344        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // Type
345        case -766209282: /*valueCode*/ return this.valueCode == null ? new Base[0] : this.valueCode.toArray(new Base[this.valueCode.size()]); // CodeType
346        case -1887705029: /*valueCoding*/ return this.valueCoding == null ? new Base[0] : this.valueCoding.toArray(new Base[this.valueCoding.size()]); // Coding
347        case 924902896: /*valueCodeableConcept*/ return this.valueCodeableConcept == null ? new Base[0] : this.valueCodeableConcept.toArray(new Base[this.valueCodeableConcept.size()]); // CodeableConcept
348        default: return super.getProperty(hash, name, checkValid);
349        }
350
351      }
352
353      @Override
354      public void setProperty(int hash, String name, Base value) throws FHIRException {
355        switch (hash) {
356        case 3433509: // path
357          this.path = castToString(value); // StringType
358          break;
359        case -1410174671: // valueSet
360          this.valueSet = (Type) value; // Type
361          break;
362        case -766209282: // valueCode
363          this.getValueCode().add(castToCode(value)); // CodeType
364          break;
365        case -1887705029: // valueCoding
366          this.getValueCoding().add(castToCoding(value)); // Coding
367          break;
368        case 924902896: // valueCodeableConcept
369          this.getValueCodeableConcept().add(castToCodeableConcept(value)); // CodeableConcept
370          break;
371        default: super.setProperty(hash, name, value);
372        }
373
374      }
375
376      @Override
377      public void setProperty(String name, Base value) throws FHIRException {
378        if (name.equals("path"))
379          this.path = castToString(value); // StringType
380        else if (name.equals("valueSet[x]"))
381          this.valueSet = (Type) value; // Type
382        else if (name.equals("valueCode"))
383          this.getValueCode().add(castToCode(value));
384        else if (name.equals("valueCoding"))
385          this.getValueCoding().add(castToCoding(value));
386        else if (name.equals("valueCodeableConcept"))
387          this.getValueCodeableConcept().add(castToCodeableConcept(value));
388        else
389          super.setProperty(name, value);
390      }
391
392      @Override
393      public Base makeProperty(int hash, String name) throws FHIRException {
394        switch (hash) {
395        case 3433509: throw new FHIRException("Cannot make property path as it is not a complex type"); // StringType
396        case -1438410321:  return getValueSet(); // Type
397        case -766209282: throw new FHIRException("Cannot make property valueCode as it is not a complex type"); // CodeType
398        case -1887705029:  return addValueCoding(); // Coding
399        case 924902896:  return addValueCodeableConcept(); // CodeableConcept
400        default: return super.makeProperty(hash, name);
401        }
402
403      }
404
405      @Override
406      public Base addChild(String name) throws FHIRException {
407        if (name.equals("path")) {
408          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.path");
409        }
410        else if (name.equals("valueSetString")) {
411          this.valueSet = new StringType();
412          return this.valueSet;
413        }
414        else if (name.equals("valueSetReference")) {
415          this.valueSet = new Reference();
416          return this.valueSet;
417        }
418        else if (name.equals("valueCode")) {
419          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.valueCode");
420        }
421        else if (name.equals("valueCoding")) {
422          return addValueCoding();
423        }
424        else if (name.equals("valueCodeableConcept")) {
425          return addValueCodeableConcept();
426        }
427        else
428          return super.addChild(name);
429      }
430
431      public DataRequirementCodeFilterComponent copy() {
432        DataRequirementCodeFilterComponent dst = new DataRequirementCodeFilterComponent();
433        copyValues(dst);
434        dst.path = path == null ? null : path.copy();
435        dst.valueSet = valueSet == null ? null : valueSet.copy();
436        if (valueCode != null) {
437          dst.valueCode = new ArrayList<CodeType>();
438          for (CodeType i : valueCode)
439            dst.valueCode.add(i.copy());
440        };
441        if (valueCoding != null) {
442          dst.valueCoding = new ArrayList<Coding>();
443          for (Coding i : valueCoding)
444            dst.valueCoding.add(i.copy());
445        };
446        if (valueCodeableConcept != null) {
447          dst.valueCodeableConcept = new ArrayList<CodeableConcept>();
448          for (CodeableConcept i : valueCodeableConcept)
449            dst.valueCodeableConcept.add(i.copy());
450        };
451        return dst;
452      }
453
454      @Override
455      public boolean equalsDeep(Base other) {
456        if (!super.equalsDeep(other))
457          return false;
458        if (!(other instanceof DataRequirementCodeFilterComponent))
459          return false;
460        DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other;
461        return compareDeep(path, o.path, true) && compareDeep(valueSet, o.valueSet, true) && compareDeep(valueCode, o.valueCode, true)
462           && compareDeep(valueCoding, o.valueCoding, true) && compareDeep(valueCodeableConcept, o.valueCodeableConcept, true)
463          ;
464      }
465
466      @Override
467      public boolean equalsShallow(Base other) {
468        if (!super.equalsShallow(other))
469          return false;
470        if (!(other instanceof DataRequirementCodeFilterComponent))
471          return false;
472        DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other;
473        return compareValues(path, o.path, true) && compareValues(valueCode, o.valueCode, true);
474      }
475
476      public boolean isEmpty() {
477        return super.isEmpty() && (path == null || path.isEmpty()) && (valueSet == null || valueSet.isEmpty())
478           && (valueCode == null || valueCode.isEmpty()) && (valueCoding == null || valueCoding.isEmpty())
479           && (valueCodeableConcept == null || valueCodeableConcept.isEmpty());
480      }
481
482  public String fhirType() {
483    return "DataRequirement.codeFilter";
484
485  }
486
487  }
488
489    @Block()
490    public static class DataRequirementDateFilterComponent extends Element implements IBaseDatatypeElement {
491        /**
492         * 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.
493         */
494        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
495        @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." )
496        protected StringType path;
497
498        /**
499         * 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.
500         */
501        @Child(name = "value", type = {DateTimeType.class, Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
502        @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." )
503        protected Type value;
504
505        private static final long serialVersionUID = 1791957163L;
506
507    /**
508     * Constructor
509     */
510      public DataRequirementDateFilterComponent() {
511        super();
512      }
513
514    /**
515     * Constructor
516     */
517      public DataRequirementDateFilterComponent(StringType path) {
518        super();
519        this.path = path;
520      }
521
522        /**
523         * @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
524         */
525        public StringType getPathElement() { 
526          if (this.path == null)
527            if (Configuration.errorOnAutoCreate())
528              throw new Error("Attempt to auto-create DataRequirementDateFilterComponent.path");
529            else if (Configuration.doAutoCreate())
530              this.path = new StringType(); // bb
531          return this.path;
532        }
533
534        public boolean hasPathElement() { 
535          return this.path != null && !this.path.isEmpty();
536        }
537
538        public boolean hasPath() { 
539          return this.path != null && !this.path.isEmpty();
540        }
541
542        /**
543         * @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
544         */
545        public DataRequirementDateFilterComponent setPathElement(StringType value) { 
546          this.path = value;
547          return this;
548        }
549
550        /**
551         * @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.
552         */
553        public String getPath() { 
554          return this.path == null ? null : this.path.getValue();
555        }
556
557        /**
558         * @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.
559         */
560        public DataRequirementDateFilterComponent setPath(String value) { 
561            if (this.path == null)
562              this.path = new StringType();
563            this.path.setValue(value);
564          return this;
565        }
566
567        /**
568         * @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.)
569         */
570        public Type getValue() { 
571          return this.value;
572        }
573
574        /**
575         * @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.)
576         */
577        public DateTimeType getValueDateTimeType() throws FHIRException { 
578          if (!(this.value instanceof DateTimeType))
579            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
580          return (DateTimeType) this.value;
581        }
582
583        public boolean hasValueDateTimeType() { 
584          return this.value instanceof DateTimeType;
585        }
586
587        /**
588         * @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.)
589         */
590        public Period getValuePeriod() throws FHIRException { 
591          if (!(this.value instanceof Period))
592            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
593          return (Period) this.value;
594        }
595
596        public boolean hasValuePeriod() { 
597          return this.value instanceof Period;
598        }
599
600        public boolean hasValue() { 
601          return this.value != null && !this.value.isEmpty();
602        }
603
604        /**
605         * @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.)
606         */
607        public DataRequirementDateFilterComponent setValue(Type value) { 
608          this.value = value;
609          return this;
610        }
611
612        protected void listChildren(List<Property> childrenList) {
613          super.listChildren(childrenList);
614          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));
615          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));
616        }
617
618      @Override
619      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
620        switch (hash) {
621        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
622        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Type
623        default: return super.getProperty(hash, name, checkValid);
624        }
625
626      }
627
628      @Override
629      public void setProperty(int hash, String name, Base value) throws FHIRException {
630        switch (hash) {
631        case 3433509: // path
632          this.path = castToString(value); // StringType
633          break;
634        case 111972721: // value
635          this.value = (Type) value; // Type
636          break;
637        default: super.setProperty(hash, name, value);
638        }
639
640      }
641
642      @Override
643      public void setProperty(String name, Base value) throws FHIRException {
644        if (name.equals("path"))
645          this.path = castToString(value); // StringType
646        else if (name.equals("value[x]"))
647          this.value = (Type) value; // Type
648        else
649          super.setProperty(name, value);
650      }
651
652      @Override
653      public Base makeProperty(int hash, String name) throws FHIRException {
654        switch (hash) {
655        case 3433509: throw new FHIRException("Cannot make property path as it is not a complex type"); // StringType
656        case -1410166417:  return getValue(); // Type
657        default: return super.makeProperty(hash, name);
658        }
659
660      }
661
662      @Override
663      public Base addChild(String name) throws FHIRException {
664        if (name.equals("path")) {
665          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.path");
666        }
667        else if (name.equals("valueDateTime")) {
668          this.value = new DateTimeType();
669          return this.value;
670        }
671        else if (name.equals("valuePeriod")) {
672          this.value = new Period();
673          return this.value;
674        }
675        else
676          return super.addChild(name);
677      }
678
679      public DataRequirementDateFilterComponent copy() {
680        DataRequirementDateFilterComponent dst = new DataRequirementDateFilterComponent();
681        copyValues(dst);
682        dst.path = path == null ? null : path.copy();
683        dst.value = value == null ? null : value.copy();
684        return dst;
685      }
686
687      @Override
688      public boolean equalsDeep(Base other) {
689        if (!super.equalsDeep(other))
690          return false;
691        if (!(other instanceof DataRequirementDateFilterComponent))
692          return false;
693        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other;
694        return compareDeep(path, o.path, true) && compareDeep(value, o.value, true);
695      }
696
697      @Override
698      public boolean equalsShallow(Base other) {
699        if (!super.equalsShallow(other))
700          return false;
701        if (!(other instanceof DataRequirementDateFilterComponent))
702          return false;
703        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other;
704        return compareValues(path, o.path, true);
705      }
706
707      public boolean isEmpty() {
708        return super.isEmpty() && (path == null || path.isEmpty()) && (value == null || value.isEmpty())
709          ;
710      }
711
712  public String fhirType() {
713    return "DataRequirement.dateFilter";
714
715  }
716
717  }
718
719    /**
720     * 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.
721     */
722    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
723    @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." )
724    protected CodeType type;
725
726    /**
727     * The profile of the required data, specified as the uri of the profile definition.
728     */
729    @Child(name = "profile", type = {StructureDefinition.class}, order=1, min=0, max=1, modifier=false, summary=true)
730    @Description(shortDefinition="The profile of the required data", formalDefinition="The profile of the required data, specified as the uri of the profile definition." )
731    protected Reference profile;
732
733    /**
734     * The actual object that is the target of the reference (The profile of the required data, specified as the uri of the profile definition.)
735     */
736    protected StructureDefinition profileTarget;
737
738    /**
739     * 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.
740     */
741    @Child(name = "mustSupport", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
742    @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." )
743    protected List<StringType> mustSupport;
744
745    /**
746     * Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data.
747     */
748    @Child(name = "codeFilter", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
749    @Description(shortDefinition="Code filters for the data", formalDefinition="Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data." )
750    protected List<DataRequirementCodeFilterComponent> codeFilter;
751
752    /**
753     * Date filters specify additional constraints on the data in terms of the applicable date range for specific elements.
754     */
755    @Child(name = "dateFilter", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
756    @Description(shortDefinition="Date filters for the data", formalDefinition="Date filters specify additional constraints on the data in terms of the applicable date range for specific elements." )
757    protected List<DataRequirementDateFilterComponent> dateFilter;
758
759    private static final long serialVersionUID = 1768899744L;
760
761  /**
762   * Constructor
763   */
764    public DataRequirement() {
765      super();
766    }
767
768  /**
769   * Constructor
770   */
771    public DataRequirement(CodeType type) {
772      super();
773      this.type = type;
774    }
775
776    /**
777     * @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
778     */
779    public CodeType getTypeElement() { 
780      if (this.type == null)
781        if (Configuration.errorOnAutoCreate())
782          throw new Error("Attempt to auto-create DataRequirement.type");
783        else if (Configuration.doAutoCreate())
784          this.type = new CodeType(); // bb
785      return this.type;
786    }
787
788    public boolean hasTypeElement() { 
789      return this.type != null && !this.type.isEmpty();
790    }
791
792    public boolean hasType() { 
793      return this.type != null && !this.type.isEmpty();
794    }
795
796    /**
797     * @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
798     */
799    public DataRequirement setTypeElement(CodeType value) { 
800      this.type = value;
801      return this;
802    }
803
804    /**
805     * @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.
806     */
807    public String getType() { 
808      return this.type == null ? null : this.type.getValue();
809    }
810
811    /**
812     * @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.
813     */
814    public DataRequirement setType(String value) { 
815        if (this.type == null)
816          this.type = new CodeType();
817        this.type.setValue(value);
818      return this;
819    }
820
821    /**
822     * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
823     */
824    public Reference getProfile() { 
825      if (this.profile == null)
826        if (Configuration.errorOnAutoCreate())
827          throw new Error("Attempt to auto-create DataRequirement.profile");
828        else if (Configuration.doAutoCreate())
829          this.profile = new Reference(); // cc
830      return this.profile;
831    }
832
833    public boolean hasProfile() { 
834      return this.profile != null && !this.profile.isEmpty();
835    }
836
837    /**
838     * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
839     */
840    public DataRequirement setProfile(Reference value) { 
841      this.profile = value;
842      return this;
843    }
844
845    /**
846     * @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.)
847     */
848    public StructureDefinition getProfileTarget() { 
849      if (this.profileTarget == null)
850        if (Configuration.errorOnAutoCreate())
851          throw new Error("Attempt to auto-create DataRequirement.profile");
852        else if (Configuration.doAutoCreate())
853          this.profileTarget = new StructureDefinition(); // aa
854      return this.profileTarget;
855    }
856
857    /**
858     * @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.)
859     */
860    public DataRequirement setProfileTarget(StructureDefinition value) { 
861      this.profileTarget = value;
862      return this;
863    }
864
865    /**
866     * @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.)
867     */
868    public List<StringType> getMustSupport() { 
869      if (this.mustSupport == null)
870        this.mustSupport = new ArrayList<StringType>();
871      return this.mustSupport;
872    }
873
874    public boolean hasMustSupport() { 
875      if (this.mustSupport == null)
876        return false;
877      for (StringType item : this.mustSupport)
878        if (!item.isEmpty())
879          return true;
880      return false;
881    }
882
883    /**
884     * @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.)
885     */
886    // syntactic sugar
887    public StringType addMustSupportElement() {//2 
888      StringType t = new StringType();
889      if (this.mustSupport == null)
890        this.mustSupport = new ArrayList<StringType>();
891      this.mustSupport.add(t);
892      return t;
893    }
894
895    /**
896     * @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.)
897     */
898    public DataRequirement addMustSupport(String value) { //1
899      StringType t = new StringType();
900      t.setValue(value);
901      if (this.mustSupport == null)
902        this.mustSupport = new ArrayList<StringType>();
903      this.mustSupport.add(t);
904      return this;
905    }
906
907    /**
908     * @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.)
909     */
910    public boolean hasMustSupport(String value) { 
911      if (this.mustSupport == null)
912        return false;
913      for (StringType v : this.mustSupport)
914        if (v.equals(value)) // string
915          return true;
916      return false;
917    }
918
919    /**
920     * @return {@link #codeFilter} (Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data.)
921     */
922    public List<DataRequirementCodeFilterComponent> getCodeFilter() { 
923      if (this.codeFilter == null)
924        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
925      return this.codeFilter;
926    }
927
928    public boolean hasCodeFilter() { 
929      if (this.codeFilter == null)
930        return false;
931      for (DataRequirementCodeFilterComponent item : this.codeFilter)
932        if (!item.isEmpty())
933          return true;
934      return false;
935    }
936
937    /**
938     * @return {@link #codeFilter} (Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data.)
939     */
940    // syntactic sugar
941    public DataRequirementCodeFilterComponent addCodeFilter() { //3
942      DataRequirementCodeFilterComponent t = new DataRequirementCodeFilterComponent();
943      if (this.codeFilter == null)
944        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
945      this.codeFilter.add(t);
946      return t;
947    }
948
949    // syntactic sugar
950    public DataRequirement addCodeFilter(DataRequirementCodeFilterComponent t) { //3
951      if (t == null)
952        return this;
953      if (this.codeFilter == null)
954        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
955      this.codeFilter.add(t);
956      return this;
957    }
958
959    /**
960     * @return {@link #dateFilter} (Date filters specify additional constraints on the data in terms of the applicable date range for specific elements.)
961     */
962    public List<DataRequirementDateFilterComponent> getDateFilter() { 
963      if (this.dateFilter == null)
964        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
965      return this.dateFilter;
966    }
967
968    public boolean hasDateFilter() { 
969      if (this.dateFilter == null)
970        return false;
971      for (DataRequirementDateFilterComponent item : this.dateFilter)
972        if (!item.isEmpty())
973          return true;
974      return false;
975    }
976
977    /**
978     * @return {@link #dateFilter} (Date filters specify additional constraints on the data in terms of the applicable date range for specific elements.)
979     */
980    // syntactic sugar
981    public DataRequirementDateFilterComponent addDateFilter() { //3
982      DataRequirementDateFilterComponent t = new DataRequirementDateFilterComponent();
983      if (this.dateFilter == null)
984        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
985      this.dateFilter.add(t);
986      return t;
987    }
988
989    // syntactic sugar
990    public DataRequirement addDateFilter(DataRequirementDateFilterComponent t) { //3
991      if (t == null)
992        return this;
993      if (this.dateFilter == null)
994        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
995      this.dateFilter.add(t);
996      return this;
997    }
998
999      protected void listChildren(List<Property> childrenList) {
1000        super.listChildren(childrenList);
1001        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));
1002        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));
1003        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));
1004        childrenList.add(new Property("codeFilter", "", "Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data.", 0, java.lang.Integer.MAX_VALUE, codeFilter));
1005        childrenList.add(new Property("dateFilter", "", "Date filters specify additional constraints on the data in terms of the applicable date range for specific elements.", 0, java.lang.Integer.MAX_VALUE, dateFilter));
1006      }
1007
1008      @Override
1009      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1010        switch (hash) {
1011        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeType
1012        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : new Base[] {this.profile}; // Reference
1013        case -1402857082: /*mustSupport*/ return this.mustSupport == null ? new Base[0] : this.mustSupport.toArray(new Base[this.mustSupport.size()]); // StringType
1014        case -1303674939: /*codeFilter*/ return this.codeFilter == null ? new Base[0] : this.codeFilter.toArray(new Base[this.codeFilter.size()]); // DataRequirementCodeFilterComponent
1015        case 149531846: /*dateFilter*/ return this.dateFilter == null ? new Base[0] : this.dateFilter.toArray(new Base[this.dateFilter.size()]); // DataRequirementDateFilterComponent
1016        default: return super.getProperty(hash, name, checkValid);
1017        }
1018
1019      }
1020
1021      @Override
1022      public void setProperty(int hash, String name, Base value) throws FHIRException {
1023        switch (hash) {
1024        case 3575610: // type
1025          this.type = castToCode(value); // CodeType
1026          break;
1027        case -309425751: // profile
1028          this.profile = castToReference(value); // Reference
1029          break;
1030        case -1402857082: // mustSupport
1031          this.getMustSupport().add(castToString(value)); // StringType
1032          break;
1033        case -1303674939: // codeFilter
1034          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value); // DataRequirementCodeFilterComponent
1035          break;
1036        case 149531846: // dateFilter
1037          this.getDateFilter().add((DataRequirementDateFilterComponent) value); // DataRequirementDateFilterComponent
1038          break;
1039        default: super.setProperty(hash, name, value);
1040        }
1041
1042      }
1043
1044      @Override
1045      public void setProperty(String name, Base value) throws FHIRException {
1046        if (name.equals("type"))
1047          this.type = castToCode(value); // CodeType
1048        else if (name.equals("profile"))
1049          this.profile = castToReference(value); // Reference
1050        else if (name.equals("mustSupport"))
1051          this.getMustSupport().add(castToString(value));
1052        else if (name.equals("codeFilter"))
1053          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value);
1054        else if (name.equals("dateFilter"))
1055          this.getDateFilter().add((DataRequirementDateFilterComponent) value);
1056        else
1057          super.setProperty(name, value);
1058      }
1059
1060      @Override
1061      public Base makeProperty(int hash, String name) throws FHIRException {
1062        switch (hash) {
1063        case 3575610: throw new FHIRException("Cannot make property type as it is not a complex type"); // CodeType
1064        case -309425751:  return getProfile(); // Reference
1065        case -1402857082: throw new FHIRException("Cannot make property mustSupport as it is not a complex type"); // StringType
1066        case -1303674939:  return addCodeFilter(); // DataRequirementCodeFilterComponent
1067        case 149531846:  return addDateFilter(); // DataRequirementDateFilterComponent
1068        default: return super.makeProperty(hash, name);
1069        }
1070
1071      }
1072
1073      @Override
1074      public Base addChild(String name) throws FHIRException {
1075        if (name.equals("type")) {
1076          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.type");
1077        }
1078        else if (name.equals("profile")) {
1079          this.profile = new Reference();
1080          return this.profile;
1081        }
1082        else if (name.equals("mustSupport")) {
1083          throw new FHIRException("Cannot call addChild on a primitive type DataRequirement.mustSupport");
1084        }
1085        else if (name.equals("codeFilter")) {
1086          return addCodeFilter();
1087        }
1088        else if (name.equals("dateFilter")) {
1089          return addDateFilter();
1090        }
1091        else
1092          return super.addChild(name);
1093      }
1094
1095  public String fhirType() {
1096    return "DataRequirement";
1097
1098  }
1099
1100      public DataRequirement copy() {
1101        DataRequirement dst = new DataRequirement();
1102        copyValues(dst);
1103        dst.type = type == null ? null : type.copy();
1104        dst.profile = profile == null ? null : profile.copy();
1105        if (mustSupport != null) {
1106          dst.mustSupport = new ArrayList<StringType>();
1107          for (StringType i : mustSupport)
1108            dst.mustSupport.add(i.copy());
1109        };
1110        if (codeFilter != null) {
1111          dst.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
1112          for (DataRequirementCodeFilterComponent i : codeFilter)
1113            dst.codeFilter.add(i.copy());
1114        };
1115        if (dateFilter != null) {
1116          dst.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
1117          for (DataRequirementDateFilterComponent i : dateFilter)
1118            dst.dateFilter.add(i.copy());
1119        };
1120        return dst;
1121      }
1122
1123      protected DataRequirement typedCopy() {
1124        return copy();
1125      }
1126
1127      @Override
1128      public boolean equalsDeep(Base other) {
1129        if (!super.equalsDeep(other))
1130          return false;
1131        if (!(other instanceof DataRequirement))
1132          return false;
1133        DataRequirement o = (DataRequirement) other;
1134        return compareDeep(type, o.type, true) && compareDeep(profile, o.profile, true) && compareDeep(mustSupport, o.mustSupport, true)
1135           && compareDeep(codeFilter, o.codeFilter, true) && compareDeep(dateFilter, o.dateFilter, true);
1136      }
1137
1138      @Override
1139      public boolean equalsShallow(Base other) {
1140        if (!super.equalsShallow(other))
1141          return false;
1142        if (!(other instanceof DataRequirement))
1143          return false;
1144        DataRequirement o = (DataRequirement) other;
1145        return compareValues(type, o.type, true) && compareValues(mustSupport, o.mustSupport, true);
1146      }
1147
1148      public boolean isEmpty() {
1149        return super.isEmpty() && (type == null || type.isEmpty()) && (profile == null || profile.isEmpty())
1150           && (mustSupport == null || mustSupport.isEmpty()) && (codeFilter == null || codeFilter.isEmpty())
1151           && (dateFilter == null || dateFilter.isEmpty());
1152      }
1153
1154
1155}