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