001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Description;
046import ca.uhn.fhir.model.api.annotation.Block;
047
048/**
049 * DataRequirement Type: Describes a required data item for evaluation in terms of the type of data, and optional code or date-based filters of the data.
050 */
051@DatatypeDef(name="DataRequirement")
052public class DataRequirement extends DataType implements ICompositeType {
053
054    public enum SortDirection {
055        /**
056         * Sort by the value ascending, so that lower values appear first.
057         */
058        ASCENDING, 
059        /**
060         * Sort by the value descending, so that lower values appear last.
061         */
062        DESCENDING, 
063        /**
064         * added to help the parsers with the generic types
065         */
066        NULL;
067        public static SortDirection fromCode(String codeString) throws FHIRException {
068            if (codeString == null || "".equals(codeString))
069                return null;
070        if ("ascending".equals(codeString))
071          return ASCENDING;
072        if ("descending".equals(codeString))
073          return DESCENDING;
074        if (Configuration.isAcceptInvalidEnums())
075          return null;
076        else
077          throw new FHIRException("Unknown SortDirection code '"+codeString+"'");
078        }
079        public String toCode() {
080          switch (this) {
081            case ASCENDING: return "ascending";
082            case DESCENDING: return "descending";
083            case NULL: return null;
084            default: return "?";
085          }
086        }
087        public String getSystem() {
088          switch (this) {
089            case ASCENDING: return "http://hl7.org/fhir/sort-direction";
090            case DESCENDING: return "http://hl7.org/fhir/sort-direction";
091            case NULL: return null;
092            default: return "?";
093          }
094        }
095        public String getDefinition() {
096          switch (this) {
097            case ASCENDING: return "Sort by the value ascending, so that lower values appear first.";
098            case DESCENDING: return "Sort by the value descending, so that lower values appear last.";
099            case NULL: return null;
100            default: return "?";
101          }
102        }
103        public String getDisplay() {
104          switch (this) {
105            case ASCENDING: return "Ascending";
106            case DESCENDING: return "Descending";
107            case NULL: return null;
108            default: return "?";
109          }
110        }
111    }
112
113  public static class SortDirectionEnumFactory implements EnumFactory<SortDirection> {
114    public SortDirection fromCode(String codeString) throws IllegalArgumentException {
115      if (codeString == null || "".equals(codeString))
116            if (codeString == null || "".equals(codeString))
117                return null;
118        if ("ascending".equals(codeString))
119          return SortDirection.ASCENDING;
120        if ("descending".equals(codeString))
121          return SortDirection.DESCENDING;
122        throw new IllegalArgumentException("Unknown SortDirection code '"+codeString+"'");
123        }
124        public Enumeration<SortDirection> fromType(PrimitiveType<?> code) throws FHIRException {
125          if (code == null)
126            return null;
127          if (code.isEmpty())
128            return new Enumeration<SortDirection>(this, SortDirection.NULL, code);
129          String codeString = ((PrimitiveType) code).asStringValue();
130          if (codeString == null || "".equals(codeString))
131            return new Enumeration<SortDirection>(this, SortDirection.NULL, code);
132        if ("ascending".equals(codeString))
133          return new Enumeration<SortDirection>(this, SortDirection.ASCENDING, code);
134        if ("descending".equals(codeString))
135          return new Enumeration<SortDirection>(this, SortDirection.DESCENDING, code);
136        throw new FHIRException("Unknown SortDirection code '"+codeString+"'");
137        }
138    public String toCode(SortDirection code) {
139      if (code == SortDirection.ASCENDING)
140        return "ascending";
141      if (code == SortDirection.DESCENDING)
142        return "descending";
143      return "?";
144      }
145    public String toSystem(SortDirection code) {
146      return code.getSystem();
147      }
148    }
149
150    public enum ValueFilterComparator {
151        /**
152         * the value for the parameter in the resource is equal to the provided value.
153         */
154        EQ, 
155        /**
156         * the value for the parameter in the resource is greater than the provided value.
157         */
158        GT, 
159        /**
160         * the value for the parameter in the resource is less than the provided value.
161         */
162        LT, 
163        /**
164         * the value for the parameter in the resource is greater or equal to the provided value.
165         */
166        GE, 
167        /**
168         * the value for the parameter in the resource is less or equal to the provided value.
169         */
170        LE, 
171        /**
172         * the value for the parameter in the resource starts after the provided value.
173         */
174        SA, 
175        /**
176         * the value for the parameter in the resource ends before the provided value.
177         */
178        EB, 
179        /**
180         * added to help the parsers with the generic types
181         */
182        NULL;
183        public static ValueFilterComparator fromCode(String codeString) throws FHIRException {
184            if (codeString == null || "".equals(codeString))
185                return null;
186        if ("eq".equals(codeString))
187          return EQ;
188        if ("gt".equals(codeString))
189          return GT;
190        if ("lt".equals(codeString))
191          return LT;
192        if ("ge".equals(codeString))
193          return GE;
194        if ("le".equals(codeString))
195          return LE;
196        if ("sa".equals(codeString))
197          return SA;
198        if ("eb".equals(codeString))
199          return EB;
200        if (Configuration.isAcceptInvalidEnums())
201          return null;
202        else
203          throw new FHIRException("Unknown ValueFilterComparator code '"+codeString+"'");
204        }
205        public String toCode() {
206          switch (this) {
207            case EQ: return "eq";
208            case GT: return "gt";
209            case LT: return "lt";
210            case GE: return "ge";
211            case LE: return "le";
212            case SA: return "sa";
213            case EB: return "eb";
214            case NULL: return null;
215            default: return "?";
216          }
217        }
218        public String getSystem() {
219          switch (this) {
220            case EQ: return "http://hl7.org/fhir/search-comparator";
221            case GT: return "http://hl7.org/fhir/search-comparator";
222            case LT: return "http://hl7.org/fhir/search-comparator";
223            case GE: return "http://hl7.org/fhir/search-comparator";
224            case LE: return "http://hl7.org/fhir/search-comparator";
225            case SA: return "http://hl7.org/fhir/search-comparator";
226            case EB: return "http://hl7.org/fhir/search-comparator";
227            case NULL: return null;
228            default: return "?";
229          }
230        }
231        public String getDefinition() {
232          switch (this) {
233            case EQ: return "the value for the parameter in the resource is equal to the provided value.";
234            case GT: return "the value for the parameter in the resource is greater than the provided value.";
235            case LT: return "the value for the parameter in the resource is less than the provided value.";
236            case GE: return "the value for the parameter in the resource is greater or equal to the provided value.";
237            case LE: return "the value for the parameter in the resource is less or equal to the provided value.";
238            case SA: return "the value for the parameter in the resource starts after the provided value.";
239            case EB: return "the value for the parameter in the resource ends before the provided value.";
240            case NULL: return null;
241            default: return "?";
242          }
243        }
244        public String getDisplay() {
245          switch (this) {
246            case EQ: return "Equals";
247            case GT: return "Greater Than";
248            case LT: return "Less Than";
249            case GE: return "Greater or Equals";
250            case LE: return "Less of Equal";
251            case SA: return "Starts After";
252            case EB: return "Ends Before";
253            case NULL: return null;
254            default: return "?";
255          }
256        }
257    }
258
259  public static class ValueFilterComparatorEnumFactory implements EnumFactory<ValueFilterComparator> {
260    public ValueFilterComparator fromCode(String codeString) throws IllegalArgumentException {
261      if (codeString == null || "".equals(codeString))
262            if (codeString == null || "".equals(codeString))
263                return null;
264        if ("eq".equals(codeString))
265          return ValueFilterComparator.EQ;
266        if ("gt".equals(codeString))
267          return ValueFilterComparator.GT;
268        if ("lt".equals(codeString))
269          return ValueFilterComparator.LT;
270        if ("ge".equals(codeString))
271          return ValueFilterComparator.GE;
272        if ("le".equals(codeString))
273          return ValueFilterComparator.LE;
274        if ("sa".equals(codeString))
275          return ValueFilterComparator.SA;
276        if ("eb".equals(codeString))
277          return ValueFilterComparator.EB;
278        throw new IllegalArgumentException("Unknown ValueFilterComparator code '"+codeString+"'");
279        }
280        public Enumeration<ValueFilterComparator> fromType(PrimitiveType<?> code) throws FHIRException {
281          if (code == null)
282            return null;
283          if (code.isEmpty())
284            return new Enumeration<ValueFilterComparator>(this, ValueFilterComparator.NULL, code);
285          String codeString = ((PrimitiveType) code).asStringValue();
286          if (codeString == null || "".equals(codeString))
287            return new Enumeration<ValueFilterComparator>(this, ValueFilterComparator.NULL, code);
288        if ("eq".equals(codeString))
289          return new Enumeration<ValueFilterComparator>(this, ValueFilterComparator.EQ, code);
290        if ("gt".equals(codeString))
291          return new Enumeration<ValueFilterComparator>(this, ValueFilterComparator.GT, code);
292        if ("lt".equals(codeString))
293          return new Enumeration<ValueFilterComparator>(this, ValueFilterComparator.LT, code);
294        if ("ge".equals(codeString))
295          return new Enumeration<ValueFilterComparator>(this, ValueFilterComparator.GE, code);
296        if ("le".equals(codeString))
297          return new Enumeration<ValueFilterComparator>(this, ValueFilterComparator.LE, code);
298        if ("sa".equals(codeString))
299          return new Enumeration<ValueFilterComparator>(this, ValueFilterComparator.SA, code);
300        if ("eb".equals(codeString))
301          return new Enumeration<ValueFilterComparator>(this, ValueFilterComparator.EB, code);
302        throw new FHIRException("Unknown ValueFilterComparator code '"+codeString+"'");
303        }
304    public String toCode(ValueFilterComparator code) {
305      if (code == ValueFilterComparator.EQ)
306        return "eq";
307      if (code == ValueFilterComparator.GT)
308        return "gt";
309      if (code == ValueFilterComparator.LT)
310        return "lt";
311      if (code == ValueFilterComparator.GE)
312        return "ge";
313      if (code == ValueFilterComparator.LE)
314        return "le";
315      if (code == ValueFilterComparator.SA)
316        return "sa";
317      if (code == ValueFilterComparator.EB)
318        return "eb";
319      return "?";
320      }
321    public String toSystem(ValueFilterComparator code) {
322      return code.getSystem();
323      }
324    }
325
326    @Block()
327    public static class DataRequirementCodeFilterComponent extends Element implements IBaseDatatypeElement {
328        /**
329         * The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
330         */
331        @Child(name = "path", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
332        @Description(shortDefinition="A code-valued attribute to filter on", formalDefinition="The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept." )
333        protected StringType path;
334
335        /**
336         * A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.
337         */
338        @Child(name = "searchParam", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
339        @Description(shortDefinition="A coded (token) parameter to search on", formalDefinition="A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept." )
340        protected StringType searchParam;
341
342        /**
343         * The valueset for the code filter. The valueSet and code elements are additive. 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.
344         */
345        @Child(name = "valueSet", type = {CanonicalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
346        @Description(shortDefinition="ValueSet for the filter", formalDefinition="The valueset for the code filter. The valueSet and code elements are additive. 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." )
347        protected CanonicalType valueSet;
348
349        /**
350         * The codes for the code filter. 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. If codes are specified in addition to a value set, the filter returns items matching a code in the value set or one of the specified codes.
351         */
352        @Child(name = "code", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
353        @Description(shortDefinition="What code is expected", formalDefinition="The codes for the code filter. 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. If codes are specified in addition to a value set, the filter returns items matching a code in the value set or one of the specified codes." )
354        protected List<Coding> code;
355
356        private static final long serialVersionUID = -1286212752L;
357
358    /**
359     * Constructor
360     */
361      public DataRequirementCodeFilterComponent() {
362        super();
363      }
364
365        /**
366         * @return {@link #path} (The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). 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
367         */
368        public StringType getPathElement() { 
369          if (this.path == null)
370            if (Configuration.errorOnAutoCreate())
371              throw new Error("Attempt to auto-create DataRequirementCodeFilterComponent.path");
372            else if (Configuration.doAutoCreate())
373              this.path = new StringType(); // bb
374          return this.path;
375        }
376
377        public boolean hasPathElement() { 
378          return this.path != null && !this.path.isEmpty();
379        }
380
381        public boolean hasPath() { 
382          return this.path != null && !this.path.isEmpty();
383        }
384
385        /**
386         * @param value {@link #path} (The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). 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
387         */
388        public DataRequirementCodeFilterComponent setPathElement(StringType value) { 
389          this.path = value;
390          return this;
391        }
392
393        /**
394         * @return The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
395         */
396        public String getPath() { 
397          return this.path == null ? null : this.path.getValue();
398        }
399
400        /**
401         * @param value The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.
402         */
403        public DataRequirementCodeFilterComponent setPath(String value) { 
404          if (Utilities.noString(value))
405            this.path = null;
406          else {
407            if (this.path == null)
408              this.path = new StringType();
409            this.path.setValue(value);
410          }
411          return this;
412        }
413
414        /**
415         * @return {@link #searchParam} (A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.). This is the underlying object with id, value and extensions. The accessor "getSearchParam" gives direct access to the value
416         */
417        public StringType getSearchParamElement() { 
418          if (this.searchParam == null)
419            if (Configuration.errorOnAutoCreate())
420              throw new Error("Attempt to auto-create DataRequirementCodeFilterComponent.searchParam");
421            else if (Configuration.doAutoCreate())
422              this.searchParam = new StringType(); // bb
423          return this.searchParam;
424        }
425
426        public boolean hasSearchParamElement() { 
427          return this.searchParam != null && !this.searchParam.isEmpty();
428        }
429
430        public boolean hasSearchParam() { 
431          return this.searchParam != null && !this.searchParam.isEmpty();
432        }
433
434        /**
435         * @param value {@link #searchParam} (A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.). This is the underlying object with id, value and extensions. The accessor "getSearchParam" gives direct access to the value
436         */
437        public DataRequirementCodeFilterComponent setSearchParamElement(StringType value) { 
438          this.searchParam = value;
439          return this;
440        }
441
442        /**
443         * @return A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.
444         */
445        public String getSearchParam() { 
446          return this.searchParam == null ? null : this.searchParam.getValue();
447        }
448
449        /**
450         * @param value A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.
451         */
452        public DataRequirementCodeFilterComponent setSearchParam(String value) { 
453          if (Utilities.noString(value))
454            this.searchParam = null;
455          else {
456            if (this.searchParam == null)
457              this.searchParam = new StringType();
458            this.searchParam.setValue(value);
459          }
460          return this;
461        }
462
463        /**
464         * @return {@link #valueSet} (The valueset for the code filter. The valueSet and code elements are additive. 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.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
465         */
466        public CanonicalType getValueSetElement() { 
467          if (this.valueSet == null)
468            if (Configuration.errorOnAutoCreate())
469              throw new Error("Attempt to auto-create DataRequirementCodeFilterComponent.valueSet");
470            else if (Configuration.doAutoCreate())
471              this.valueSet = new CanonicalType(); // bb
472          return this.valueSet;
473        }
474
475        public boolean hasValueSetElement() { 
476          return this.valueSet != null && !this.valueSet.isEmpty();
477        }
478
479        public boolean hasValueSet() { 
480          return this.valueSet != null && !this.valueSet.isEmpty();
481        }
482
483        /**
484         * @param value {@link #valueSet} (The valueset for the code filter. The valueSet and code elements are additive. 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.). This is the underlying object with id, value and extensions. The accessor "getValueSet" gives direct access to the value
485         */
486        public DataRequirementCodeFilterComponent setValueSetElement(CanonicalType value) { 
487          this.valueSet = value;
488          return this;
489        }
490
491        /**
492         * @return The valueset for the code filter. The valueSet and code elements are additive. 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.
493         */
494        public String getValueSet() { 
495          return this.valueSet == null ? null : this.valueSet.getValue();
496        }
497
498        /**
499         * @param value The valueset for the code filter. The valueSet and code elements are additive. 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.
500         */
501        public DataRequirementCodeFilterComponent setValueSet(String value) { 
502          if (Utilities.noString(value))
503            this.valueSet = null;
504          else {
505            if (this.valueSet == null)
506              this.valueSet = new CanonicalType();
507            this.valueSet.setValue(value);
508          }
509          return this;
510        }
511
512        /**
513         * @return {@link #code} (The codes for the code filter. 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. If codes are specified in addition to a value set, the filter returns items matching a code in the value set or one of the specified codes.)
514         */
515        public List<Coding> getCode() { 
516          if (this.code == null)
517            this.code = new ArrayList<Coding>();
518          return this.code;
519        }
520
521        /**
522         * @return Returns a reference to <code>this</code> for easy method chaining
523         */
524        public DataRequirementCodeFilterComponent setCode(List<Coding> theCode) { 
525          this.code = theCode;
526          return this;
527        }
528
529        public boolean hasCode() { 
530          if (this.code == null)
531            return false;
532          for (Coding item : this.code)
533            if (!item.isEmpty())
534              return true;
535          return false;
536        }
537
538        public Coding addCode() { //3
539          Coding t = new Coding();
540          if (this.code == null)
541            this.code = new ArrayList<Coding>();
542          this.code.add(t);
543          return t;
544        }
545
546        public DataRequirementCodeFilterComponent addCode(Coding t) { //3
547          if (t == null)
548            return this;
549          if (this.code == null)
550            this.code = new ArrayList<Coding>();
551          this.code.add(t);
552          return this;
553        }
554
555        /**
556         * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
557         */
558        public Coding getCodeFirstRep() { 
559          if (getCode().isEmpty()) {
560            addCode();
561          }
562          return getCode().get(0);
563        }
564
565        protected void listChildren(List<Property> children) {
566          super.listChildren(children);
567          children.add(new Property("path", "string", "The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.", 0, 1, path));
568          children.add(new Property("searchParam", "string", "A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.", 0, 1, searchParam));
569          children.add(new Property("valueSet", "canonical(ValueSet)", "The valueset for the code filter. The valueSet and code elements are additive. 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, 1, valueSet));
570          children.add(new Property("code", "Coding", "The codes for the code filter. 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. If codes are specified in addition to a value set, the filter returns items matching a code in the value set or one of the specified codes.", 0, java.lang.Integer.MAX_VALUE, code));
571        }
572
573        @Override
574        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
575          switch (_hash) {
576          case 3433509: /*path*/  return new Property("path", "string", "The code-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type code, Coding, or CodeableConcept.", 0, 1, path);
577          case -553645115: /*searchParam*/  return new Property("searchParam", "string", "A token parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type code, Coding, or CodeableConcept.", 0, 1, searchParam);
578          case -1410174671: /*valueSet*/  return new Property("valueSet", "canonical(ValueSet)", "The valueset for the code filter. The valueSet and code elements are additive. 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, 1, valueSet);
579          case 3059181: /*code*/  return new Property("code", "Coding", "The codes for the code filter. 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. If codes are specified in addition to a value set, the filter returns items matching a code in the value set or one of the specified codes.", 0, java.lang.Integer.MAX_VALUE, code);
580          default: return super.getNamedProperty(_hash, _name, _checkValid);
581          }
582
583        }
584
585      @Override
586      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
587        switch (hash) {
588        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
589        case -553645115: /*searchParam*/ return this.searchParam == null ? new Base[0] : new Base[] {this.searchParam}; // StringType
590        case -1410174671: /*valueSet*/ return this.valueSet == null ? new Base[0] : new Base[] {this.valueSet}; // CanonicalType
591        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // Coding
592        default: return super.getProperty(hash, name, checkValid);
593        }
594
595      }
596
597      @Override
598      public Base setProperty(int hash, String name, Base value) throws FHIRException {
599        switch (hash) {
600        case 3433509: // path
601          this.path = TypeConvertor.castToString(value); // StringType
602          return value;
603        case -553645115: // searchParam
604          this.searchParam = TypeConvertor.castToString(value); // StringType
605          return value;
606        case -1410174671: // valueSet
607          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
608          return value;
609        case 3059181: // code
610          this.getCode().add(TypeConvertor.castToCoding(value)); // Coding
611          return value;
612        default: return super.setProperty(hash, name, value);
613        }
614
615      }
616
617      @Override
618      public Base setProperty(String name, Base value) throws FHIRException {
619        if (name.equals("path")) {
620          this.path = TypeConvertor.castToString(value); // StringType
621        } else if (name.equals("searchParam")) {
622          this.searchParam = TypeConvertor.castToString(value); // StringType
623        } else if (name.equals("valueSet")) {
624          this.valueSet = TypeConvertor.castToCanonical(value); // CanonicalType
625        } else if (name.equals("code")) {
626          this.getCode().add(TypeConvertor.castToCoding(value));
627        } else
628          return super.setProperty(name, value);
629        return value;
630      }
631
632      @Override
633      public Base makeProperty(int hash, String name) throws FHIRException {
634        switch (hash) {
635        case 3433509:  return getPathElement();
636        case -553645115:  return getSearchParamElement();
637        case -1410174671:  return getValueSetElement();
638        case 3059181:  return addCode(); 
639        default: return super.makeProperty(hash, name);
640        }
641
642      }
643
644      @Override
645      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
646        switch (hash) {
647        case 3433509: /*path*/ return new String[] {"string"};
648        case -553645115: /*searchParam*/ return new String[] {"string"};
649        case -1410174671: /*valueSet*/ return new String[] {"canonical"};
650        case 3059181: /*code*/ return new String[] {"Coding"};
651        default: return super.getTypesForProperty(hash, name);
652        }
653
654      }
655
656      @Override
657      public Base addChild(String name) throws FHIRException {
658        if (name.equals("path")) {
659          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.codeFilter.path");
660        }
661        else if (name.equals("searchParam")) {
662          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.codeFilter.searchParam");
663        }
664        else if (name.equals("valueSet")) {
665          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.codeFilter.valueSet");
666        }
667        else if (name.equals("code")) {
668          return addCode();
669        }
670        else
671          return super.addChild(name);
672      }
673
674      public DataRequirementCodeFilterComponent copy() {
675        DataRequirementCodeFilterComponent dst = new DataRequirementCodeFilterComponent();
676        copyValues(dst);
677        return dst;
678      }
679
680      public void copyValues(DataRequirementCodeFilterComponent dst) {
681        super.copyValues(dst);
682        dst.path = path == null ? null : path.copy();
683        dst.searchParam = searchParam == null ? null : searchParam.copy();
684        dst.valueSet = valueSet == null ? null : valueSet.copy();
685        if (code != null) {
686          dst.code = new ArrayList<Coding>();
687          for (Coding i : code)
688            dst.code.add(i.copy());
689        };
690      }
691
692      @Override
693      public boolean equalsDeep(Base other_) {
694        if (!super.equalsDeep(other_))
695          return false;
696        if (!(other_ instanceof DataRequirementCodeFilterComponent))
697          return false;
698        DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other_;
699        return compareDeep(path, o.path, true) && compareDeep(searchParam, o.searchParam, true) && compareDeep(valueSet, o.valueSet, true)
700           && compareDeep(code, o.code, true);
701      }
702
703      @Override
704      public boolean equalsShallow(Base other_) {
705        if (!super.equalsShallow(other_))
706          return false;
707        if (!(other_ instanceof DataRequirementCodeFilterComponent))
708          return false;
709        DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other_;
710        return compareValues(path, o.path, true) && compareValues(searchParam, o.searchParam, true) && compareValues(valueSet, o.valueSet, true)
711          ;
712      }
713
714      public boolean isEmpty() {
715        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, searchParam, valueSet
716          , code);
717      }
718
719  public String fhirType() {
720    return "DataRequirement.codeFilter";
721
722  }
723
724  }
725
726    @Block()
727    public static class DataRequirementDateFilterComponent extends Element implements IBaseDatatypeElement {
728        /**
729         * The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.
730         */
731        @Child(name = "path", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
732        @Description(shortDefinition="A date-valued attribute to filter on", formalDefinition="The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing." )
733        protected StringType path;
734
735        /**
736         * A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.
737         */
738        @Child(name = "searchParam", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
739        @Description(shortDefinition="A date valued parameter to search on", formalDefinition="A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing." )
740        protected StringType searchParam;
741
742        /**
743         * 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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.
744         */
745        @Child(name = "value", type = {DateTimeType.class, Period.class, Duration.class}, order=3, min=0, max=1, modifier=false, summary=true)
746        @Description(shortDefinition="The value of the filter, as a Period, DateTime, or Duration 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. If a Duration is specified, the filter will return only those data items that fall within Duration before now." )
747        protected DataType value;
748
749        private static final long serialVersionUID = 1649787979L;
750
751    /**
752     * Constructor
753     */
754      public DataRequirementDateFilterComponent() {
755        super();
756      }
757
758        /**
759         * @return {@link #path} (The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
760         */
761        public StringType getPathElement() { 
762          if (this.path == null)
763            if (Configuration.errorOnAutoCreate())
764              throw new Error("Attempt to auto-create DataRequirementDateFilterComponent.path");
765            else if (Configuration.doAutoCreate())
766              this.path = new StringType(); // bb
767          return this.path;
768        }
769
770        public boolean hasPathElement() { 
771          return this.path != null && !this.path.isEmpty();
772        }
773
774        public boolean hasPath() { 
775          return this.path != null && !this.path.isEmpty();
776        }
777
778        /**
779         * @param value {@link #path} (The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
780         */
781        public DataRequirementDateFilterComponent setPathElement(StringType value) { 
782          this.path = value;
783          return this;
784        }
785
786        /**
787         * @return The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.
788         */
789        public String getPath() { 
790          return this.path == null ? null : this.path.getValue();
791        }
792
793        /**
794         * @param value The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.
795         */
796        public DataRequirementDateFilterComponent setPath(String value) { 
797          if (Utilities.noString(value))
798            this.path = null;
799          else {
800            if (this.path == null)
801              this.path = new StringType();
802            this.path.setValue(value);
803          }
804          return this;
805        }
806
807        /**
808         * @return {@link #searchParam} (A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getSearchParam" gives direct access to the value
809         */
810        public StringType getSearchParamElement() { 
811          if (this.searchParam == null)
812            if (Configuration.errorOnAutoCreate())
813              throw new Error("Attempt to auto-create DataRequirementDateFilterComponent.searchParam");
814            else if (Configuration.doAutoCreate())
815              this.searchParam = new StringType(); // bb
816          return this.searchParam;
817        }
818
819        public boolean hasSearchParamElement() { 
820          return this.searchParam != null && !this.searchParam.isEmpty();
821        }
822
823        public boolean hasSearchParam() { 
824          return this.searchParam != null && !this.searchParam.isEmpty();
825        }
826
827        /**
828         * @param value {@link #searchParam} (A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.). This is the underlying object with id, value and extensions. The accessor "getSearchParam" gives direct access to the value
829         */
830        public DataRequirementDateFilterComponent setSearchParamElement(StringType value) { 
831          this.searchParam = value;
832          return this;
833        }
834
835        /**
836         * @return A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.
837         */
838        public String getSearchParam() { 
839          return this.searchParam == null ? null : this.searchParam.getValue();
840        }
841
842        /**
843         * @param value A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.
844         */
845        public DataRequirementDateFilterComponent setSearchParam(String value) { 
846          if (Utilities.noString(value))
847            this.searchParam = null;
848          else {
849            if (this.searchParam == null)
850              this.searchParam = new StringType();
851            this.searchParam.setValue(value);
852          }
853          return this;
854        }
855
856        /**
857         * @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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.)
858         */
859        public DataType getValue() { 
860          return this.value;
861        }
862
863        /**
864         * @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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.)
865         */
866        public DateTimeType getValueDateTimeType() throws FHIRException { 
867          if (this.value == null)
868            this.value = new DateTimeType();
869          if (!(this.value instanceof DateTimeType))
870            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
871          return (DateTimeType) this.value;
872        }
873
874        public boolean hasValueDateTimeType() { 
875          return this != null && this.value instanceof DateTimeType;
876        }
877
878        /**
879         * @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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.)
880         */
881        public Period getValuePeriod() throws FHIRException { 
882          if (this.value == null)
883            this.value = new Period();
884          if (!(this.value instanceof Period))
885            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
886          return (Period) this.value;
887        }
888
889        public boolean hasValuePeriod() { 
890          return this != null && this.value instanceof Period;
891        }
892
893        /**
894         * @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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.)
895         */
896        public Duration getValueDuration() throws FHIRException { 
897          if (this.value == null)
898            this.value = new Duration();
899          if (!(this.value instanceof Duration))
900            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
901          return (Duration) this.value;
902        }
903
904        public boolean hasValueDuration() { 
905          return this != null && this.value instanceof Duration;
906        }
907
908        public boolean hasValue() { 
909          return this.value != null && !this.value.isEmpty();
910        }
911
912        /**
913         * @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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.)
914         */
915        public DataRequirementDateFilterComponent setValue(DataType value) { 
916          if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Duration))
917            throw new FHIRException("Not the right type for DataRequirement.dateFilter.value[x]: "+value.fhirType());
918          this.value = value;
919          return this;
920        }
921
922        protected void listChildren(List<Property> children) {
923          super.listChildren(children);
924          children.add(new Property("path", "string", "The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.", 0, 1, path));
925          children.add(new Property("searchParam", "string", "A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.", 0, 1, searchParam));
926          children.add(new Property("value[x]", "dateTime|Period|Duration", "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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", 0, 1, value));
927        }
928
929        @Override
930        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
931          switch (_hash) {
932          case 3433509: /*path*/  return new Property("path", "string", "The date-valued attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of type date, dateTime, Period, Schedule, or Timing.", 0, 1, path);
933          case -553645115: /*searchParam*/  return new Property("searchParam", "string", "A date parameter that refers to a search parameter defined on the specified type of the DataRequirement, and which searches on elements of type date, dateTime, Period, Schedule, or Timing.", 0, 1, searchParam);
934          case -1410166417: /*value[x]*/  return new Property("value[x]", "dateTime|Period|Duration", "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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", 0, 1, value);
935          case 111972721: /*value*/  return new Property("value[x]", "dateTime|Period|Duration", "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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", 0, 1, value);
936          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime", "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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", 0, 1, value);
937          case -1524344174: /*valuePeriod*/  return new Property("value[x]", "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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", 0, 1, value);
938          case 1558135333: /*valueDuration*/  return new Property("value[x]", "Duration", "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. If a Duration is specified, the filter will return only those data items that fall within Duration before now.", 0, 1, value);
939          default: return super.getNamedProperty(_hash, _name, _checkValid);
940          }
941
942        }
943
944      @Override
945      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
946        switch (hash) {
947        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
948        case -553645115: /*searchParam*/ return this.searchParam == null ? new Base[0] : new Base[] {this.searchParam}; // StringType
949        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
950        default: return super.getProperty(hash, name, checkValid);
951        }
952
953      }
954
955      @Override
956      public Base setProperty(int hash, String name, Base value) throws FHIRException {
957        switch (hash) {
958        case 3433509: // path
959          this.path = TypeConvertor.castToString(value); // StringType
960          return value;
961        case -553645115: // searchParam
962          this.searchParam = TypeConvertor.castToString(value); // StringType
963          return value;
964        case 111972721: // value
965          this.value = TypeConvertor.castToType(value); // DataType
966          return value;
967        default: return super.setProperty(hash, name, value);
968        }
969
970      }
971
972      @Override
973      public Base setProperty(String name, Base value) throws FHIRException {
974        if (name.equals("path")) {
975          this.path = TypeConvertor.castToString(value); // StringType
976        } else if (name.equals("searchParam")) {
977          this.searchParam = TypeConvertor.castToString(value); // StringType
978        } else if (name.equals("value[x]")) {
979          this.value = TypeConvertor.castToType(value); // DataType
980        } else
981          return super.setProperty(name, value);
982        return value;
983      }
984
985      @Override
986      public Base makeProperty(int hash, String name) throws FHIRException {
987        switch (hash) {
988        case 3433509:  return getPathElement();
989        case -553645115:  return getSearchParamElement();
990        case -1410166417:  return getValue();
991        case 111972721:  return getValue();
992        default: return super.makeProperty(hash, name);
993        }
994
995      }
996
997      @Override
998      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
999        switch (hash) {
1000        case 3433509: /*path*/ return new String[] {"string"};
1001        case -553645115: /*searchParam*/ return new String[] {"string"};
1002        case 111972721: /*value*/ return new String[] {"dateTime", "Period", "Duration"};
1003        default: return super.getTypesForProperty(hash, name);
1004        }
1005
1006      }
1007
1008      @Override
1009      public Base addChild(String name) throws FHIRException {
1010        if (name.equals("path")) {
1011          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.dateFilter.path");
1012        }
1013        else if (name.equals("searchParam")) {
1014          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.dateFilter.searchParam");
1015        }
1016        else if (name.equals("valueDateTime")) {
1017          this.value = new DateTimeType();
1018          return this.value;
1019        }
1020        else if (name.equals("valuePeriod")) {
1021          this.value = new Period();
1022          return this.value;
1023        }
1024        else if (name.equals("valueDuration")) {
1025          this.value = new Duration();
1026          return this.value;
1027        }
1028        else
1029          return super.addChild(name);
1030      }
1031
1032      public DataRequirementDateFilterComponent copy() {
1033        DataRequirementDateFilterComponent dst = new DataRequirementDateFilterComponent();
1034        copyValues(dst);
1035        return dst;
1036      }
1037
1038      public void copyValues(DataRequirementDateFilterComponent dst) {
1039        super.copyValues(dst);
1040        dst.path = path == null ? null : path.copy();
1041        dst.searchParam = searchParam == null ? null : searchParam.copy();
1042        dst.value = value == null ? null : value.copy();
1043      }
1044
1045      @Override
1046      public boolean equalsDeep(Base other_) {
1047        if (!super.equalsDeep(other_))
1048          return false;
1049        if (!(other_ instanceof DataRequirementDateFilterComponent))
1050          return false;
1051        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other_;
1052        return compareDeep(path, o.path, true) && compareDeep(searchParam, o.searchParam, true) && compareDeep(value, o.value, true)
1053          ;
1054      }
1055
1056      @Override
1057      public boolean equalsShallow(Base other_) {
1058        if (!super.equalsShallow(other_))
1059          return false;
1060        if (!(other_ instanceof DataRequirementDateFilterComponent))
1061          return false;
1062        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other_;
1063        return compareValues(path, o.path, true) && compareValues(searchParam, o.searchParam, true);
1064      }
1065
1066      public boolean isEmpty() {
1067        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, searchParam, value
1068          );
1069      }
1070
1071  public String fhirType() {
1072    return "DataRequirement.dateFilter";
1073
1074  }
1075
1076  }
1077
1078    @Block()
1079    public static class DataRequirementValueFilterComponent extends Element implements IBaseDatatypeElement {
1080        /**
1081         * The attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of a type that is comparable to the valueFilter.value[x] element for the filter.
1082         */
1083        @Child(name = "path", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1084        @Description(shortDefinition="An attribute to filter on", formalDefinition="The attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of a type that is comparable to the valueFilter.value[x] element for the filter." )
1085        protected StringType path;
1086
1087        /**
1088         * A search parameter defined on the specified type of the DataRequirement, and which searches on elements of a type compatible with the type of the valueFilter.value[x] for the filter.
1089         */
1090        @Child(name = "searchParam", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1091        @Description(shortDefinition="A parameter to search on", formalDefinition="A search parameter defined on the specified type of the DataRequirement, and which searches on elements of a type compatible with the type of the valueFilter.value[x] for the filter." )
1092        protected StringType searchParam;
1093
1094        /**
1095         * The comparator to be used to determine whether the value is matching.
1096         */
1097        @Child(name = "comparator", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1098        @Description(shortDefinition="eq | gt | lt | ge | le | sa | eb", formalDefinition="The comparator to be used to determine whether the value is matching." )
1099        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/value-filter-comparator")
1100        protected Enumeration<ValueFilterComparator> comparator;
1101
1102        /**
1103         * The value of the filter.
1104         */
1105        @Child(name = "value", type = {DateTimeType.class, Period.class, Duration.class}, order=4, min=0, max=1, modifier=false, summary=true)
1106        @Description(shortDefinition="The value of the filter, as a Period, DateTime, or Duration value", formalDefinition="The value of the filter." )
1107        protected DataType value;
1108
1109        private static final long serialVersionUID = 2106988483L;
1110
1111    /**
1112     * Constructor
1113     */
1114      public DataRequirementValueFilterComponent() {
1115        super();
1116      }
1117
1118        /**
1119         * @return {@link #path} (The attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of a type that is comparable to the valueFilter.value[x] element for the filter.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1120         */
1121        public StringType getPathElement() { 
1122          if (this.path == null)
1123            if (Configuration.errorOnAutoCreate())
1124              throw new Error("Attempt to auto-create DataRequirementValueFilterComponent.path");
1125            else if (Configuration.doAutoCreate())
1126              this.path = new StringType(); // bb
1127          return this.path;
1128        }
1129
1130        public boolean hasPathElement() { 
1131          return this.path != null && !this.path.isEmpty();
1132        }
1133
1134        public boolean hasPath() { 
1135          return this.path != null && !this.path.isEmpty();
1136        }
1137
1138        /**
1139         * @param value {@link #path} (The attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of a type that is comparable to the valueFilter.value[x] element for the filter.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1140         */
1141        public DataRequirementValueFilterComponent setPathElement(StringType value) { 
1142          this.path = value;
1143          return this;
1144        }
1145
1146        /**
1147         * @return The attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of a type that is comparable to the valueFilter.value[x] element for the filter.
1148         */
1149        public String getPath() { 
1150          return this.path == null ? null : this.path.getValue();
1151        }
1152
1153        /**
1154         * @param value The attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of a type that is comparable to the valueFilter.value[x] element for the filter.
1155         */
1156        public DataRequirementValueFilterComponent setPath(String value) { 
1157          if (Utilities.noString(value))
1158            this.path = null;
1159          else {
1160            if (this.path == null)
1161              this.path = new StringType();
1162            this.path.setValue(value);
1163          }
1164          return this;
1165        }
1166
1167        /**
1168         * @return {@link #searchParam} (A search parameter defined on the specified type of the DataRequirement, and which searches on elements of a type compatible with the type of the valueFilter.value[x] for the filter.). This is the underlying object with id, value and extensions. The accessor "getSearchParam" gives direct access to the value
1169         */
1170        public StringType getSearchParamElement() { 
1171          if (this.searchParam == null)
1172            if (Configuration.errorOnAutoCreate())
1173              throw new Error("Attempt to auto-create DataRequirementValueFilterComponent.searchParam");
1174            else if (Configuration.doAutoCreate())
1175              this.searchParam = new StringType(); // bb
1176          return this.searchParam;
1177        }
1178
1179        public boolean hasSearchParamElement() { 
1180          return this.searchParam != null && !this.searchParam.isEmpty();
1181        }
1182
1183        public boolean hasSearchParam() { 
1184          return this.searchParam != null && !this.searchParam.isEmpty();
1185        }
1186
1187        /**
1188         * @param value {@link #searchParam} (A search parameter defined on the specified type of the DataRequirement, and which searches on elements of a type compatible with the type of the valueFilter.value[x] for the filter.). This is the underlying object with id, value and extensions. The accessor "getSearchParam" gives direct access to the value
1189         */
1190        public DataRequirementValueFilterComponent setSearchParamElement(StringType value) { 
1191          this.searchParam = value;
1192          return this;
1193        }
1194
1195        /**
1196         * @return A search parameter defined on the specified type of the DataRequirement, and which searches on elements of a type compatible with the type of the valueFilter.value[x] for the filter.
1197         */
1198        public String getSearchParam() { 
1199          return this.searchParam == null ? null : this.searchParam.getValue();
1200        }
1201
1202        /**
1203         * @param value A search parameter defined on the specified type of the DataRequirement, and which searches on elements of a type compatible with the type of the valueFilter.value[x] for the filter.
1204         */
1205        public DataRequirementValueFilterComponent setSearchParam(String value) { 
1206          if (Utilities.noString(value))
1207            this.searchParam = null;
1208          else {
1209            if (this.searchParam == null)
1210              this.searchParam = new StringType();
1211            this.searchParam.setValue(value);
1212          }
1213          return this;
1214        }
1215
1216        /**
1217         * @return {@link #comparator} (The comparator to be used to determine whether the value is matching.). This is the underlying object with id, value and extensions. The accessor "getComparator" gives direct access to the value
1218         */
1219        public Enumeration<ValueFilterComparator> getComparatorElement() { 
1220          if (this.comparator == null)
1221            if (Configuration.errorOnAutoCreate())
1222              throw new Error("Attempt to auto-create DataRequirementValueFilterComponent.comparator");
1223            else if (Configuration.doAutoCreate())
1224              this.comparator = new Enumeration<ValueFilterComparator>(new ValueFilterComparatorEnumFactory()); // bb
1225          return this.comparator;
1226        }
1227
1228        public boolean hasComparatorElement() { 
1229          return this.comparator != null && !this.comparator.isEmpty();
1230        }
1231
1232        public boolean hasComparator() { 
1233          return this.comparator != null && !this.comparator.isEmpty();
1234        }
1235
1236        /**
1237         * @param value {@link #comparator} (The comparator to be used to determine whether the value is matching.). This is the underlying object with id, value and extensions. The accessor "getComparator" gives direct access to the value
1238         */
1239        public DataRequirementValueFilterComponent setComparatorElement(Enumeration<ValueFilterComparator> value) { 
1240          this.comparator = value;
1241          return this;
1242        }
1243
1244        /**
1245         * @return The comparator to be used to determine whether the value is matching.
1246         */
1247        public ValueFilterComparator getComparator() { 
1248          return this.comparator == null ? null : this.comparator.getValue();
1249        }
1250
1251        /**
1252         * @param value The comparator to be used to determine whether the value is matching.
1253         */
1254        public DataRequirementValueFilterComponent setComparator(ValueFilterComparator value) { 
1255          if (value == null)
1256            this.comparator = null;
1257          else {
1258            if (this.comparator == null)
1259              this.comparator = new Enumeration<ValueFilterComparator>(new ValueFilterComparatorEnumFactory());
1260            this.comparator.setValue(value);
1261          }
1262          return this;
1263        }
1264
1265        /**
1266         * @return {@link #value} (The value of the filter.)
1267         */
1268        public DataType getValue() { 
1269          return this.value;
1270        }
1271
1272        /**
1273         * @return {@link #value} (The value of the filter.)
1274         */
1275        public DateTimeType getValueDateTimeType() throws FHIRException { 
1276          if (this.value == null)
1277            this.value = new DateTimeType();
1278          if (!(this.value instanceof DateTimeType))
1279            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
1280          return (DateTimeType) this.value;
1281        }
1282
1283        public boolean hasValueDateTimeType() { 
1284          return this != null && this.value instanceof DateTimeType;
1285        }
1286
1287        /**
1288         * @return {@link #value} (The value of the filter.)
1289         */
1290        public Period getValuePeriod() throws FHIRException { 
1291          if (this.value == null)
1292            this.value = new Period();
1293          if (!(this.value instanceof Period))
1294            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
1295          return (Period) this.value;
1296        }
1297
1298        public boolean hasValuePeriod() { 
1299          return this != null && this.value instanceof Period;
1300        }
1301
1302        /**
1303         * @return {@link #value} (The value of the filter.)
1304         */
1305        public Duration getValueDuration() throws FHIRException { 
1306          if (this.value == null)
1307            this.value = new Duration();
1308          if (!(this.value instanceof Duration))
1309            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
1310          return (Duration) this.value;
1311        }
1312
1313        public boolean hasValueDuration() { 
1314          return this != null && this.value instanceof Duration;
1315        }
1316
1317        public boolean hasValue() { 
1318          return this.value != null && !this.value.isEmpty();
1319        }
1320
1321        /**
1322         * @param value {@link #value} (The value of the filter.)
1323         */
1324        public DataRequirementValueFilterComponent setValue(DataType value) { 
1325          if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Duration))
1326            throw new FHIRException("Not the right type for DataRequirement.valueFilter.value[x]: "+value.fhirType());
1327          this.value = value;
1328          return this;
1329        }
1330
1331        protected void listChildren(List<Property> children) {
1332          super.listChildren(children);
1333          children.add(new Property("path", "string", "The attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of a type that is comparable to the valueFilter.value[x] element for the filter.", 0, 1, path));
1334          children.add(new Property("searchParam", "string", "A search parameter defined on the specified type of the DataRequirement, and which searches on elements of a type compatible with the type of the valueFilter.value[x] for the filter.", 0, 1, searchParam));
1335          children.add(new Property("comparator", "code", "The comparator to be used to determine whether the value is matching.", 0, 1, comparator));
1336          children.add(new Property("value[x]", "dateTime|Period|Duration", "The value of the filter.", 0, 1, value));
1337        }
1338
1339        @Override
1340        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1341          switch (_hash) {
1342          case 3433509: /*path*/  return new Property("path", "string", "The attribute of the filter. The specified path SHALL be a FHIRPath resolvable on the specified type of the DataRequirement, and SHALL consist only of identifiers, constant indexers, and .resolve(). The path is allowed to contain qualifiers (.) to traverse sub-elements, as well as indexers ([x]) to traverse multiple-cardinality sub-elements (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details). Note that the index must be an integer constant. The path must resolve to an element of a type that is comparable to the valueFilter.value[x] element for the filter.", 0, 1, path);
1343          case -553645115: /*searchParam*/  return new Property("searchParam", "string", "A search parameter defined on the specified type of the DataRequirement, and which searches on elements of a type compatible with the type of the valueFilter.value[x] for the filter.", 0, 1, searchParam);
1344          case -844673834: /*comparator*/  return new Property("comparator", "code", "The comparator to be used to determine whether the value is matching.", 0, 1, comparator);
1345          case -1410166417: /*value[x]*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter.", 0, 1, value);
1346          case 111972721: /*value*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter.", 0, 1, value);
1347          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime", "The value of the filter.", 0, 1, value);
1348          case -1524344174: /*valuePeriod*/  return new Property("value[x]", "Period", "The value of the filter.", 0, 1, value);
1349          case 1558135333: /*valueDuration*/  return new Property("value[x]", "Duration", "The value of the filter.", 0, 1, value);
1350          default: return super.getNamedProperty(_hash, _name, _checkValid);
1351          }
1352
1353        }
1354
1355      @Override
1356      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1357        switch (hash) {
1358        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1359        case -553645115: /*searchParam*/ return this.searchParam == null ? new Base[0] : new Base[] {this.searchParam}; // StringType
1360        case -844673834: /*comparator*/ return this.comparator == null ? new Base[0] : new Base[] {this.comparator}; // Enumeration<ValueFilterComparator>
1361        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
1362        default: return super.getProperty(hash, name, checkValid);
1363        }
1364
1365      }
1366
1367      @Override
1368      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1369        switch (hash) {
1370        case 3433509: // path
1371          this.path = TypeConvertor.castToString(value); // StringType
1372          return value;
1373        case -553645115: // searchParam
1374          this.searchParam = TypeConvertor.castToString(value); // StringType
1375          return value;
1376        case -844673834: // comparator
1377          value = new ValueFilterComparatorEnumFactory().fromType(TypeConvertor.castToCode(value));
1378          this.comparator = (Enumeration) value; // Enumeration<ValueFilterComparator>
1379          return value;
1380        case 111972721: // value
1381          this.value = TypeConvertor.castToType(value); // DataType
1382          return value;
1383        default: return super.setProperty(hash, name, value);
1384        }
1385
1386      }
1387
1388      @Override
1389      public Base setProperty(String name, Base value) throws FHIRException {
1390        if (name.equals("path")) {
1391          this.path = TypeConvertor.castToString(value); // StringType
1392        } else if (name.equals("searchParam")) {
1393          this.searchParam = TypeConvertor.castToString(value); // StringType
1394        } else if (name.equals("comparator")) {
1395          value = new ValueFilterComparatorEnumFactory().fromType(TypeConvertor.castToCode(value));
1396          this.comparator = (Enumeration) value; // Enumeration<ValueFilterComparator>
1397        } else if (name.equals("value[x]")) {
1398          this.value = TypeConvertor.castToType(value); // DataType
1399        } else
1400          return super.setProperty(name, value);
1401        return value;
1402      }
1403
1404      @Override
1405      public Base makeProperty(int hash, String name) throws FHIRException {
1406        switch (hash) {
1407        case 3433509:  return getPathElement();
1408        case -553645115:  return getSearchParamElement();
1409        case -844673834:  return getComparatorElement();
1410        case -1410166417:  return getValue();
1411        case 111972721:  return getValue();
1412        default: return super.makeProperty(hash, name);
1413        }
1414
1415      }
1416
1417      @Override
1418      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1419        switch (hash) {
1420        case 3433509: /*path*/ return new String[] {"string"};
1421        case -553645115: /*searchParam*/ return new String[] {"string"};
1422        case -844673834: /*comparator*/ return new String[] {"code"};
1423        case 111972721: /*value*/ return new String[] {"dateTime", "Period", "Duration"};
1424        default: return super.getTypesForProperty(hash, name);
1425        }
1426
1427      }
1428
1429      @Override
1430      public Base addChild(String name) throws FHIRException {
1431        if (name.equals("path")) {
1432          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.valueFilter.path");
1433        }
1434        else if (name.equals("searchParam")) {
1435          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.valueFilter.searchParam");
1436        }
1437        else if (name.equals("comparator")) {
1438          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.valueFilter.comparator");
1439        }
1440        else if (name.equals("valueDateTime")) {
1441          this.value = new DateTimeType();
1442          return this.value;
1443        }
1444        else if (name.equals("valuePeriod")) {
1445          this.value = new Period();
1446          return this.value;
1447        }
1448        else if (name.equals("valueDuration")) {
1449          this.value = new Duration();
1450          return this.value;
1451        }
1452        else
1453          return super.addChild(name);
1454      }
1455
1456      public DataRequirementValueFilterComponent copy() {
1457        DataRequirementValueFilterComponent dst = new DataRequirementValueFilterComponent();
1458        copyValues(dst);
1459        return dst;
1460      }
1461
1462      public void copyValues(DataRequirementValueFilterComponent dst) {
1463        super.copyValues(dst);
1464        dst.path = path == null ? null : path.copy();
1465        dst.searchParam = searchParam == null ? null : searchParam.copy();
1466        dst.comparator = comparator == null ? null : comparator.copy();
1467        dst.value = value == null ? null : value.copy();
1468      }
1469
1470      @Override
1471      public boolean equalsDeep(Base other_) {
1472        if (!super.equalsDeep(other_))
1473          return false;
1474        if (!(other_ instanceof DataRequirementValueFilterComponent))
1475          return false;
1476        DataRequirementValueFilterComponent o = (DataRequirementValueFilterComponent) other_;
1477        return compareDeep(path, o.path, true) && compareDeep(searchParam, o.searchParam, true) && compareDeep(comparator, o.comparator, true)
1478           && compareDeep(value, o.value, true);
1479      }
1480
1481      @Override
1482      public boolean equalsShallow(Base other_) {
1483        if (!super.equalsShallow(other_))
1484          return false;
1485        if (!(other_ instanceof DataRequirementValueFilterComponent))
1486          return false;
1487        DataRequirementValueFilterComponent o = (DataRequirementValueFilterComponent) other_;
1488        return compareValues(path, o.path, true) && compareValues(searchParam, o.searchParam, true) && compareValues(comparator, o.comparator, true)
1489          ;
1490      }
1491
1492      public boolean isEmpty() {
1493        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, searchParam, comparator
1494          , value);
1495      }
1496
1497  public String fhirType() {
1498    return "DataRequirement.valueFilter";
1499
1500  }
1501
1502  }
1503
1504    @Block()
1505    public static class DataRequirementSortComponent extends Element implements IBaseDatatypeElement {
1506        /**
1507         * The attribute of the sort. 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.
1508         */
1509        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1510        @Description(shortDefinition="The name of the attribute to perform the sort", formalDefinition="The attribute of the sort. 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." )
1511        protected StringType path;
1512
1513        /**
1514         * The direction of the sort, ascending or descending.
1515         */
1516        @Child(name = "direction", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1517        @Description(shortDefinition="ascending | descending", formalDefinition="The direction of the sort, ascending or descending." )
1518        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/sort-direction")
1519        protected Enumeration<SortDirection> direction;
1520
1521        private static final long serialVersionUID = -694498683L;
1522
1523    /**
1524     * Constructor
1525     */
1526      public DataRequirementSortComponent() {
1527        super();
1528      }
1529
1530    /**
1531     * Constructor
1532     */
1533      public DataRequirementSortComponent(String path, SortDirection direction) {
1534        super();
1535        this.setPath(path);
1536        this.setDirection(direction);
1537      }
1538
1539        /**
1540         * @return {@link #path} (The attribute of the sort. 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.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1541         */
1542        public StringType getPathElement() { 
1543          if (this.path == null)
1544            if (Configuration.errorOnAutoCreate())
1545              throw new Error("Attempt to auto-create DataRequirementSortComponent.path");
1546            else if (Configuration.doAutoCreate())
1547              this.path = new StringType(); // bb
1548          return this.path;
1549        }
1550
1551        public boolean hasPathElement() { 
1552          return this.path != null && !this.path.isEmpty();
1553        }
1554
1555        public boolean hasPath() { 
1556          return this.path != null && !this.path.isEmpty();
1557        }
1558
1559        /**
1560         * @param value {@link #path} (The attribute of the sort. 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.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
1561         */
1562        public DataRequirementSortComponent setPathElement(StringType value) { 
1563          this.path = value;
1564          return this;
1565        }
1566
1567        /**
1568         * @return The attribute of the sort. 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.
1569         */
1570        public String getPath() { 
1571          return this.path == null ? null : this.path.getValue();
1572        }
1573
1574        /**
1575         * @param value The attribute of the sort. 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.
1576         */
1577        public DataRequirementSortComponent setPath(String value) { 
1578            if (this.path == null)
1579              this.path = new StringType();
1580            this.path.setValue(value);
1581          return this;
1582        }
1583
1584        /**
1585         * @return {@link #direction} (The direction of the sort, ascending or descending.). This is the underlying object with id, value and extensions. The accessor "getDirection" gives direct access to the value
1586         */
1587        public Enumeration<SortDirection> getDirectionElement() { 
1588          if (this.direction == null)
1589            if (Configuration.errorOnAutoCreate())
1590              throw new Error("Attempt to auto-create DataRequirementSortComponent.direction");
1591            else if (Configuration.doAutoCreate())
1592              this.direction = new Enumeration<SortDirection>(new SortDirectionEnumFactory()); // bb
1593          return this.direction;
1594        }
1595
1596        public boolean hasDirectionElement() { 
1597          return this.direction != null && !this.direction.isEmpty();
1598        }
1599
1600        public boolean hasDirection() { 
1601          return this.direction != null && !this.direction.isEmpty();
1602        }
1603
1604        /**
1605         * @param value {@link #direction} (The direction of the sort, ascending or descending.). This is the underlying object with id, value and extensions. The accessor "getDirection" gives direct access to the value
1606         */
1607        public DataRequirementSortComponent setDirectionElement(Enumeration<SortDirection> value) { 
1608          this.direction = value;
1609          return this;
1610        }
1611
1612        /**
1613         * @return The direction of the sort, ascending or descending.
1614         */
1615        public SortDirection getDirection() { 
1616          return this.direction == null ? null : this.direction.getValue();
1617        }
1618
1619        /**
1620         * @param value The direction of the sort, ascending or descending.
1621         */
1622        public DataRequirementSortComponent setDirection(SortDirection value) { 
1623            if (this.direction == null)
1624              this.direction = new Enumeration<SortDirection>(new SortDirectionEnumFactory());
1625            this.direction.setValue(value);
1626          return this;
1627        }
1628
1629        protected void listChildren(List<Property> children) {
1630          super.listChildren(children);
1631          children.add(new Property("path", "string", "The attribute of the sort. 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.", 0, 1, path));
1632          children.add(new Property("direction", "code", "The direction of the sort, ascending or descending.", 0, 1, direction));
1633        }
1634
1635        @Override
1636        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1637          switch (_hash) {
1638          case 3433509: /*path*/  return new Property("path", "string", "The attribute of the sort. 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.", 0, 1, path);
1639          case -962590849: /*direction*/  return new Property("direction", "code", "The direction of the sort, ascending or descending.", 0, 1, direction);
1640          default: return super.getNamedProperty(_hash, _name, _checkValid);
1641          }
1642
1643        }
1644
1645      @Override
1646      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1647        switch (hash) {
1648        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1649        case -962590849: /*direction*/ return this.direction == null ? new Base[0] : new Base[] {this.direction}; // Enumeration<SortDirection>
1650        default: return super.getProperty(hash, name, checkValid);
1651        }
1652
1653      }
1654
1655      @Override
1656      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1657        switch (hash) {
1658        case 3433509: // path
1659          this.path = TypeConvertor.castToString(value); // StringType
1660          return value;
1661        case -962590849: // direction
1662          value = new SortDirectionEnumFactory().fromType(TypeConvertor.castToCode(value));
1663          this.direction = (Enumeration) value; // Enumeration<SortDirection>
1664          return value;
1665        default: return super.setProperty(hash, name, value);
1666        }
1667
1668      }
1669
1670      @Override
1671      public Base setProperty(String name, Base value) throws FHIRException {
1672        if (name.equals("path")) {
1673          this.path = TypeConvertor.castToString(value); // StringType
1674        } else if (name.equals("direction")) {
1675          value = new SortDirectionEnumFactory().fromType(TypeConvertor.castToCode(value));
1676          this.direction = (Enumeration) value; // Enumeration<SortDirection>
1677        } else
1678          return super.setProperty(name, value);
1679        return value;
1680      }
1681
1682      @Override
1683      public Base makeProperty(int hash, String name) throws FHIRException {
1684        switch (hash) {
1685        case 3433509:  return getPathElement();
1686        case -962590849:  return getDirectionElement();
1687        default: return super.makeProperty(hash, name);
1688        }
1689
1690      }
1691
1692      @Override
1693      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1694        switch (hash) {
1695        case 3433509: /*path*/ return new String[] {"string"};
1696        case -962590849: /*direction*/ return new String[] {"code"};
1697        default: return super.getTypesForProperty(hash, name);
1698        }
1699
1700      }
1701
1702      @Override
1703      public Base addChild(String name) throws FHIRException {
1704        if (name.equals("path")) {
1705          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.sort.path");
1706        }
1707        else if (name.equals("direction")) {
1708          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.sort.direction");
1709        }
1710        else
1711          return super.addChild(name);
1712      }
1713
1714      public DataRequirementSortComponent copy() {
1715        DataRequirementSortComponent dst = new DataRequirementSortComponent();
1716        copyValues(dst);
1717        return dst;
1718      }
1719
1720      public void copyValues(DataRequirementSortComponent dst) {
1721        super.copyValues(dst);
1722        dst.path = path == null ? null : path.copy();
1723        dst.direction = direction == null ? null : direction.copy();
1724      }
1725
1726      @Override
1727      public boolean equalsDeep(Base other_) {
1728        if (!super.equalsDeep(other_))
1729          return false;
1730        if (!(other_ instanceof DataRequirementSortComponent))
1731          return false;
1732        DataRequirementSortComponent o = (DataRequirementSortComponent) other_;
1733        return compareDeep(path, o.path, true) && compareDeep(direction, o.direction, true);
1734      }
1735
1736      @Override
1737      public boolean equalsShallow(Base other_) {
1738        if (!super.equalsShallow(other_))
1739          return false;
1740        if (!(other_ instanceof DataRequirementSortComponent))
1741          return false;
1742        DataRequirementSortComponent o = (DataRequirementSortComponent) other_;
1743        return compareValues(path, o.path, true) && compareValues(direction, o.direction, true);
1744      }
1745
1746      public boolean isEmpty() {
1747        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, direction);
1748      }
1749
1750  public String fhirType() {
1751    return "DataRequirement.sort";
1752
1753  }
1754
1755  }
1756
1757    /**
1758     * 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.
1759     */
1760    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
1761    @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." )
1762    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fhir-types")
1763    protected Enumeration<FHIRTypes> type;
1764
1765    /**
1766     * The profile of the required data, specified as the uri of the profile definition.
1767     */
1768    @Child(name = "profile", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1769    @Description(shortDefinition="The profile of the required data", formalDefinition="The profile of the required data, specified as the uri of the profile definition." )
1770    protected List<CanonicalType> profile;
1771
1772    /**
1773     * The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.
1774     */
1775    @Child(name = "subject", type = {CodeableConcept.class, Group.class}, order=2, min=0, max=1, modifier=false, summary=true)
1776    @Description(shortDefinition="E.g. Patient, Practitioner, RelatedPerson, Organization, Location, Device", formalDefinition="The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed." )
1777    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participant-resource-types")
1778    protected DataType subject;
1779
1780    /**
1781     * 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. 
1782
1783The value of mustSupport SHALL be a FHIRPath resolvable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).
1784     */
1785    @Child(name = "mustSupport", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1786    @Description(shortDefinition="Indicates specific structure elements that 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. \n\nThe value of mustSupport SHALL be a FHIRPath resolvable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details)." )
1787    protected List<StringType> mustSupport;
1788
1789    /**
1790     * Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed.
1791     */
1792    @Child(name = "codeFilter", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1793    @Description(shortDefinition="What codes are expected", formalDefinition="Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed." )
1794    protected List<DataRequirementCodeFilterComponent> codeFilter;
1795
1796    /**
1797     * Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed.
1798     */
1799    @Child(name = "dateFilter", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1800    @Description(shortDefinition="What dates/date ranges are expected", formalDefinition="Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed." )
1801    protected List<DataRequirementDateFilterComponent> dateFilter;
1802
1803    /**
1804     * Value filters specify additional constraints on the data for elements other than code-valued or date-valued. Each value filter specifies an additional constraint on the data (i.e. valueFilters are AND'ed, not OR'ed).
1805     */
1806    @Child(name = "valueFilter", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1807    @Description(shortDefinition="What values are expected", formalDefinition="Value filters specify additional constraints on the data for elements other than code-valued or date-valued. Each value filter specifies an additional constraint on the data (i.e. valueFilters are AND'ed, not OR'ed)." )
1808    protected List<DataRequirementValueFilterComponent> valueFilter;
1809
1810    /**
1811     * Specifies a maximum number of results that are required (uses the _count search parameter).
1812     */
1813    @Child(name = "limit", type = {PositiveIntType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1814    @Description(shortDefinition="Number of results", formalDefinition="Specifies a maximum number of results that are required (uses the _count search parameter)." )
1815    protected PositiveIntType limit;
1816
1817    /**
1818     * Specifies the order of the results to be returned.
1819     */
1820    @Child(name = "sort", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1821    @Description(shortDefinition="Order of the results", formalDefinition="Specifies the order of the results to be returned." )
1822    protected List<DataRequirementSortComponent> sort;
1823
1824    private static final long serialVersionUID = -2078097376L;
1825
1826  /**
1827   * Constructor
1828   */
1829    public DataRequirement() {
1830      super();
1831    }
1832
1833  /**
1834   * Constructor
1835   */
1836    public DataRequirement(FHIRTypes type) {
1837      super();
1838      this.setType(type);
1839    }
1840
1841    /**
1842     * @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
1843     */
1844    public Enumeration<FHIRTypes> getTypeElement() { 
1845      if (this.type == null)
1846        if (Configuration.errorOnAutoCreate())
1847          throw new Error("Attempt to auto-create DataRequirement.type");
1848        else if (Configuration.doAutoCreate())
1849          this.type = new Enumeration<FHIRTypes>(new FHIRTypesEnumFactory()); // bb
1850      return this.type;
1851    }
1852
1853    public boolean hasTypeElement() { 
1854      return this.type != null && !this.type.isEmpty();
1855    }
1856
1857    public boolean hasType() { 
1858      return this.type != null && !this.type.isEmpty();
1859    }
1860
1861    /**
1862     * @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
1863     */
1864    public DataRequirement setTypeElement(Enumeration<FHIRTypes> value) { 
1865      this.type = value;
1866      return this;
1867    }
1868
1869    /**
1870     * @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.
1871     */
1872    public FHIRTypes getType() { 
1873      return this.type == null ? null : this.type.getValue();
1874    }
1875
1876    /**
1877     * @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.
1878     */
1879    public DataRequirement setType(FHIRTypes value) { 
1880        if (this.type == null)
1881          this.type = new Enumeration<FHIRTypes>(new FHIRTypesEnumFactory());
1882        this.type.setValue(value);
1883      return this;
1884    }
1885
1886    /**
1887     * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1888     */
1889    public List<CanonicalType> getProfile() { 
1890      if (this.profile == null)
1891        this.profile = new ArrayList<CanonicalType>();
1892      return this.profile;
1893    }
1894
1895    /**
1896     * @return Returns a reference to <code>this</code> for easy method chaining
1897     */
1898    public DataRequirement setProfile(List<CanonicalType> theProfile) { 
1899      this.profile = theProfile;
1900      return this;
1901    }
1902
1903    public boolean hasProfile() { 
1904      if (this.profile == null)
1905        return false;
1906      for (CanonicalType item : this.profile)
1907        if (!item.isEmpty())
1908          return true;
1909      return false;
1910    }
1911
1912    /**
1913     * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1914     */
1915    public CanonicalType addProfileElement() {//2 
1916      CanonicalType t = new CanonicalType();
1917      if (this.profile == null)
1918        this.profile = new ArrayList<CanonicalType>();
1919      this.profile.add(t);
1920      return t;
1921    }
1922
1923    /**
1924     * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1925     */
1926    public DataRequirement addProfile(String value) { //1
1927      CanonicalType t = new CanonicalType();
1928      t.setValue(value);
1929      if (this.profile == null)
1930        this.profile = new ArrayList<CanonicalType>();
1931      this.profile.add(t);
1932      return this;
1933    }
1934
1935    /**
1936     * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1937     */
1938    public boolean hasProfile(String value) { 
1939      if (this.profile == null)
1940        return false;
1941      for (CanonicalType v : this.profile)
1942        if (v.getValue().equals(value)) // canonical
1943          return true;
1944      return false;
1945    }
1946
1947    /**
1948     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1949     */
1950    public DataType getSubject() { 
1951      return this.subject;
1952    }
1953
1954    /**
1955     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1956     */
1957    public CodeableConcept getSubjectCodeableConcept() throws FHIRException { 
1958      if (this.subject == null)
1959        this.subject = new CodeableConcept();
1960      if (!(this.subject instanceof CodeableConcept))
1961        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.subject.getClass().getName()+" was encountered");
1962      return (CodeableConcept) this.subject;
1963    }
1964
1965    public boolean hasSubjectCodeableConcept() { 
1966      return this != null && this.subject instanceof CodeableConcept;
1967    }
1968
1969    /**
1970     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1971     */
1972    public Reference getSubjectReference() throws FHIRException { 
1973      if (this.subject == null)
1974        this.subject = new Reference();
1975      if (!(this.subject instanceof Reference))
1976        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.subject.getClass().getName()+" was encountered");
1977      return (Reference) this.subject;
1978    }
1979
1980    public boolean hasSubjectReference() { 
1981      return this != null && this.subject instanceof Reference;
1982    }
1983
1984    public boolean hasSubject() { 
1985      return this.subject != null && !this.subject.isEmpty();
1986    }
1987
1988    /**
1989     * @param value {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
1990     */
1991    public DataRequirement setSubject(DataType value) { 
1992      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
1993        throw new FHIRException("Not the right type for DataRequirement.subject[x]: "+value.fhirType());
1994      this.subject = value;
1995      return this;
1996    }
1997
1998    /**
1999     * @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. 
2000
2001The value of mustSupport SHALL be a FHIRPath resolvable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).)
2002     */
2003    public List<StringType> getMustSupport() { 
2004      if (this.mustSupport == null)
2005        this.mustSupport = new ArrayList<StringType>();
2006      return this.mustSupport;
2007    }
2008
2009    /**
2010     * @return Returns a reference to <code>this</code> for easy method chaining
2011     */
2012    public DataRequirement setMustSupport(List<StringType> theMustSupport) { 
2013      this.mustSupport = theMustSupport;
2014      return this;
2015    }
2016
2017    public boolean hasMustSupport() { 
2018      if (this.mustSupport == null)
2019        return false;
2020      for (StringType item : this.mustSupport)
2021        if (!item.isEmpty())
2022          return true;
2023      return false;
2024    }
2025
2026    /**
2027     * @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. 
2028
2029The value of mustSupport SHALL be a FHIRPath resolvable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).)
2030     */
2031    public StringType addMustSupportElement() {//2 
2032      StringType t = new StringType();
2033      if (this.mustSupport == null)
2034        this.mustSupport = new ArrayList<StringType>();
2035      this.mustSupport.add(t);
2036      return t;
2037    }
2038
2039    /**
2040     * @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. 
2041
2042The value of mustSupport SHALL be a FHIRPath resolvable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).)
2043     */
2044    public DataRequirement addMustSupport(String value) { //1
2045      StringType t = new StringType();
2046      t.setValue(value);
2047      if (this.mustSupport == null)
2048        this.mustSupport = new ArrayList<StringType>();
2049      this.mustSupport.add(t);
2050      return this;
2051    }
2052
2053    /**
2054     * @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. 
2055
2056The value of mustSupport SHALL be a FHIRPath resolvable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).)
2057     */
2058    public boolean hasMustSupport(String value) { 
2059      if (this.mustSupport == null)
2060        return false;
2061      for (StringType v : this.mustSupport)
2062        if (v.getValue().equals(value)) // string
2063          return true;
2064      return false;
2065    }
2066
2067    /**
2068     * @return {@link #codeFilter} (Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed.)
2069     */
2070    public List<DataRequirementCodeFilterComponent> getCodeFilter() { 
2071      if (this.codeFilter == null)
2072        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
2073      return this.codeFilter;
2074    }
2075
2076    /**
2077     * @return Returns a reference to <code>this</code> for easy method chaining
2078     */
2079    public DataRequirement setCodeFilter(List<DataRequirementCodeFilterComponent> theCodeFilter) { 
2080      this.codeFilter = theCodeFilter;
2081      return this;
2082    }
2083
2084    public boolean hasCodeFilter() { 
2085      if (this.codeFilter == null)
2086        return false;
2087      for (DataRequirementCodeFilterComponent item : this.codeFilter)
2088        if (!item.isEmpty())
2089          return true;
2090      return false;
2091    }
2092
2093    public DataRequirementCodeFilterComponent addCodeFilter() { //3
2094      DataRequirementCodeFilterComponent t = new DataRequirementCodeFilterComponent();
2095      if (this.codeFilter == null)
2096        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
2097      this.codeFilter.add(t);
2098      return t;
2099    }
2100
2101    public DataRequirement addCodeFilter(DataRequirementCodeFilterComponent t) { //3
2102      if (t == null)
2103        return this;
2104      if (this.codeFilter == null)
2105        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
2106      this.codeFilter.add(t);
2107      return this;
2108    }
2109
2110    /**
2111     * @return The first repetition of repeating field {@link #codeFilter}, creating it if it does not already exist {3}
2112     */
2113    public DataRequirementCodeFilterComponent getCodeFilterFirstRep() { 
2114      if (getCodeFilter().isEmpty()) {
2115        addCodeFilter();
2116      }
2117      return getCodeFilter().get(0);
2118    }
2119
2120    /**
2121     * @return {@link #dateFilter} (Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed.)
2122     */
2123    public List<DataRequirementDateFilterComponent> getDateFilter() { 
2124      if (this.dateFilter == null)
2125        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
2126      return this.dateFilter;
2127    }
2128
2129    /**
2130     * @return Returns a reference to <code>this</code> for easy method chaining
2131     */
2132    public DataRequirement setDateFilter(List<DataRequirementDateFilterComponent> theDateFilter) { 
2133      this.dateFilter = theDateFilter;
2134      return this;
2135    }
2136
2137    public boolean hasDateFilter() { 
2138      if (this.dateFilter == null)
2139        return false;
2140      for (DataRequirementDateFilterComponent item : this.dateFilter)
2141        if (!item.isEmpty())
2142          return true;
2143      return false;
2144    }
2145
2146    public DataRequirementDateFilterComponent addDateFilter() { //3
2147      DataRequirementDateFilterComponent t = new DataRequirementDateFilterComponent();
2148      if (this.dateFilter == null)
2149        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
2150      this.dateFilter.add(t);
2151      return t;
2152    }
2153
2154    public DataRequirement addDateFilter(DataRequirementDateFilterComponent t) { //3
2155      if (t == null)
2156        return this;
2157      if (this.dateFilter == null)
2158        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
2159      this.dateFilter.add(t);
2160      return this;
2161    }
2162
2163    /**
2164     * @return The first repetition of repeating field {@link #dateFilter}, creating it if it does not already exist {3}
2165     */
2166    public DataRequirementDateFilterComponent getDateFilterFirstRep() { 
2167      if (getDateFilter().isEmpty()) {
2168        addDateFilter();
2169      }
2170      return getDateFilter().get(0);
2171    }
2172
2173    /**
2174     * @return {@link #valueFilter} (Value filters specify additional constraints on the data for elements other than code-valued or date-valued. Each value filter specifies an additional constraint on the data (i.e. valueFilters are AND'ed, not OR'ed).)
2175     */
2176    public List<DataRequirementValueFilterComponent> getValueFilter() { 
2177      if (this.valueFilter == null)
2178        this.valueFilter = new ArrayList<DataRequirementValueFilterComponent>();
2179      return this.valueFilter;
2180    }
2181
2182    /**
2183     * @return Returns a reference to <code>this</code> for easy method chaining
2184     */
2185    public DataRequirement setValueFilter(List<DataRequirementValueFilterComponent> theValueFilter) { 
2186      this.valueFilter = theValueFilter;
2187      return this;
2188    }
2189
2190    public boolean hasValueFilter() { 
2191      if (this.valueFilter == null)
2192        return false;
2193      for (DataRequirementValueFilterComponent item : this.valueFilter)
2194        if (!item.isEmpty())
2195          return true;
2196      return false;
2197    }
2198
2199    public DataRequirementValueFilterComponent addValueFilter() { //3
2200      DataRequirementValueFilterComponent t = new DataRequirementValueFilterComponent();
2201      if (this.valueFilter == null)
2202        this.valueFilter = new ArrayList<DataRequirementValueFilterComponent>();
2203      this.valueFilter.add(t);
2204      return t;
2205    }
2206
2207    public DataRequirement addValueFilter(DataRequirementValueFilterComponent t) { //3
2208      if (t == null)
2209        return this;
2210      if (this.valueFilter == null)
2211        this.valueFilter = new ArrayList<DataRequirementValueFilterComponent>();
2212      this.valueFilter.add(t);
2213      return this;
2214    }
2215
2216    /**
2217     * @return The first repetition of repeating field {@link #valueFilter}, creating it if it does not already exist {3}
2218     */
2219    public DataRequirementValueFilterComponent getValueFilterFirstRep() { 
2220      if (getValueFilter().isEmpty()) {
2221        addValueFilter();
2222      }
2223      return getValueFilter().get(0);
2224    }
2225
2226    /**
2227     * @return {@link #limit} (Specifies a maximum number of results that are required (uses the _count search parameter).). This is the underlying object with id, value and extensions. The accessor "getLimit" gives direct access to the value
2228     */
2229    public PositiveIntType getLimitElement() { 
2230      if (this.limit == null)
2231        if (Configuration.errorOnAutoCreate())
2232          throw new Error("Attempt to auto-create DataRequirement.limit");
2233        else if (Configuration.doAutoCreate())
2234          this.limit = new PositiveIntType(); // bb
2235      return this.limit;
2236    }
2237
2238    public boolean hasLimitElement() { 
2239      return this.limit != null && !this.limit.isEmpty();
2240    }
2241
2242    public boolean hasLimit() { 
2243      return this.limit != null && !this.limit.isEmpty();
2244    }
2245
2246    /**
2247     * @param value {@link #limit} (Specifies a maximum number of results that are required (uses the _count search parameter).). This is the underlying object with id, value and extensions. The accessor "getLimit" gives direct access to the value
2248     */
2249    public DataRequirement setLimitElement(PositiveIntType value) { 
2250      this.limit = value;
2251      return this;
2252    }
2253
2254    /**
2255     * @return Specifies a maximum number of results that are required (uses the _count search parameter).
2256     */
2257    public int getLimit() { 
2258      return this.limit == null || this.limit.isEmpty() ? 0 : this.limit.getValue();
2259    }
2260
2261    /**
2262     * @param value Specifies a maximum number of results that are required (uses the _count search parameter).
2263     */
2264    public DataRequirement setLimit(int value) { 
2265        if (this.limit == null)
2266          this.limit = new PositiveIntType();
2267        this.limit.setValue(value);
2268      return this;
2269    }
2270
2271    /**
2272     * @return {@link #sort} (Specifies the order of the results to be returned.)
2273     */
2274    public List<DataRequirementSortComponent> getSort() { 
2275      if (this.sort == null)
2276        this.sort = new ArrayList<DataRequirementSortComponent>();
2277      return this.sort;
2278    }
2279
2280    /**
2281     * @return Returns a reference to <code>this</code> for easy method chaining
2282     */
2283    public DataRequirement setSort(List<DataRequirementSortComponent> theSort) { 
2284      this.sort = theSort;
2285      return this;
2286    }
2287
2288    public boolean hasSort() { 
2289      if (this.sort == null)
2290        return false;
2291      for (DataRequirementSortComponent item : this.sort)
2292        if (!item.isEmpty())
2293          return true;
2294      return false;
2295    }
2296
2297    public DataRequirementSortComponent addSort() { //3
2298      DataRequirementSortComponent t = new DataRequirementSortComponent();
2299      if (this.sort == null)
2300        this.sort = new ArrayList<DataRequirementSortComponent>();
2301      this.sort.add(t);
2302      return t;
2303    }
2304
2305    public DataRequirement addSort(DataRequirementSortComponent t) { //3
2306      if (t == null)
2307        return this;
2308      if (this.sort == null)
2309        this.sort = new ArrayList<DataRequirementSortComponent>();
2310      this.sort.add(t);
2311      return this;
2312    }
2313
2314    /**
2315     * @return The first repetition of repeating field {@link #sort}, creating it if it does not already exist {3}
2316     */
2317    public DataRequirementSortComponent getSortFirstRep() { 
2318      if (getSort().isEmpty()) {
2319        addSort();
2320      }
2321      return getSort().get(0);
2322    }
2323
2324      protected void listChildren(List<Property> children) {
2325        super.listChildren(children);
2326        children.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, 1, type));
2327        children.add(new Property("profile", "canonical(StructureDefinition)", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile));
2328        children.add(new Property("subject[x]", "CodeableConcept|Reference(Group)", "The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", 0, 1, subject));
2329        children.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. \n\nThe value of mustSupport SHALL be a FHIRPath resolvable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).", 0, java.lang.Integer.MAX_VALUE, mustSupport));
2330        children.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. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, codeFilter));
2331        children.add(new Property("dateFilter", "", "Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, dateFilter));
2332        children.add(new Property("valueFilter", "", "Value filters specify additional constraints on the data for elements other than code-valued or date-valued. Each value filter specifies an additional constraint on the data (i.e. valueFilters are AND'ed, not OR'ed).", 0, java.lang.Integer.MAX_VALUE, valueFilter));
2333        children.add(new Property("limit", "positiveInt", "Specifies a maximum number of results that are required (uses the _count search parameter).", 0, 1, limit));
2334        children.add(new Property("sort", "", "Specifies the order of the results to be returned.", 0, java.lang.Integer.MAX_VALUE, sort));
2335      }
2336
2337      @Override
2338      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2339        switch (_hash) {
2340        case 3575610: /*type*/  return 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, 1, type);
2341        case -309425751: /*profile*/  return new Property("profile", "canonical(StructureDefinition)", "The profile of the required data, specified as the uri of the profile definition.", 0, java.lang.Integer.MAX_VALUE, profile);
2342        case -573640748: /*subject[x]*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", 0, 1, subject);
2343        case -1867885268: /*subject*/  return new Property("subject[x]", "CodeableConcept|Reference(Group)", "The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", 0, 1, subject);
2344        case -1257122603: /*subjectCodeableConcept*/  return new Property("subject[x]", "CodeableConcept", "The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", 0, 1, subject);
2345        case 772938623: /*subjectReference*/  return new Property("subject[x]", "Reference(Group)", "The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.", 0, 1, subject);
2346        case -1402857082: /*mustSupport*/  return 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. \n\nThe value of mustSupport SHALL be a FHIRPath resolvable on the type of the DataRequirement. The path SHALL consist only of identifiers, constant indexers, and .resolve() (see the [Simple FHIRPath Profile](fhirpath.html#simple) for full details).", 0, java.lang.Integer.MAX_VALUE, mustSupport);
2347        case -1303674939: /*codeFilter*/  return new Property("codeFilter", "", "Code filters specify additional constraints on the data, specifying the value set of interest for a particular element of the data. Each code filter defines an additional constraint on the data, i.e. code filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, codeFilter);
2348        case 149531846: /*dateFilter*/  return new Property("dateFilter", "", "Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. Each date filter specifies an additional constraint on the data, i.e. date filters are AND'ed, not OR'ed.", 0, java.lang.Integer.MAX_VALUE, dateFilter);
2349        case -1807110071: /*valueFilter*/  return new Property("valueFilter", "", "Value filters specify additional constraints on the data for elements other than code-valued or date-valued. Each value filter specifies an additional constraint on the data (i.e. valueFilters are AND'ed, not OR'ed).", 0, java.lang.Integer.MAX_VALUE, valueFilter);
2350        case 102976443: /*limit*/  return new Property("limit", "positiveInt", "Specifies a maximum number of results that are required (uses the _count search parameter).", 0, 1, limit);
2351        case 3536286: /*sort*/  return new Property("sort", "", "Specifies the order of the results to be returned.", 0, java.lang.Integer.MAX_VALUE, sort);
2352        default: return super.getNamedProperty(_hash, _name, _checkValid);
2353        }
2354
2355      }
2356
2357      @Override
2358      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2359        switch (hash) {
2360        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<FHIRTypes>
2361        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // CanonicalType
2362        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // DataType
2363        case -1402857082: /*mustSupport*/ return this.mustSupport == null ? new Base[0] : this.mustSupport.toArray(new Base[this.mustSupport.size()]); // StringType
2364        case -1303674939: /*codeFilter*/ return this.codeFilter == null ? new Base[0] : this.codeFilter.toArray(new Base[this.codeFilter.size()]); // DataRequirementCodeFilterComponent
2365        case 149531846: /*dateFilter*/ return this.dateFilter == null ? new Base[0] : this.dateFilter.toArray(new Base[this.dateFilter.size()]); // DataRequirementDateFilterComponent
2366        case -1807110071: /*valueFilter*/ return this.valueFilter == null ? new Base[0] : this.valueFilter.toArray(new Base[this.valueFilter.size()]); // DataRequirementValueFilterComponent
2367        case 102976443: /*limit*/ return this.limit == null ? new Base[0] : new Base[] {this.limit}; // PositiveIntType
2368        case 3536286: /*sort*/ return this.sort == null ? new Base[0] : this.sort.toArray(new Base[this.sort.size()]); // DataRequirementSortComponent
2369        default: return super.getProperty(hash, name, checkValid);
2370        }
2371
2372      }
2373
2374      @Override
2375      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2376        switch (hash) {
2377        case 3575610: // type
2378          value = new FHIRTypesEnumFactory().fromType(TypeConvertor.castToCode(value));
2379          this.type = (Enumeration) value; // Enumeration<FHIRTypes>
2380          return value;
2381        case -309425751: // profile
2382          this.getProfile().add(TypeConvertor.castToCanonical(value)); // CanonicalType
2383          return value;
2384        case -1867885268: // subject
2385          this.subject = TypeConvertor.castToType(value); // DataType
2386          return value;
2387        case -1402857082: // mustSupport
2388          this.getMustSupport().add(TypeConvertor.castToString(value)); // StringType
2389          return value;
2390        case -1303674939: // codeFilter
2391          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value); // DataRequirementCodeFilterComponent
2392          return value;
2393        case 149531846: // dateFilter
2394          this.getDateFilter().add((DataRequirementDateFilterComponent) value); // DataRequirementDateFilterComponent
2395          return value;
2396        case -1807110071: // valueFilter
2397          this.getValueFilter().add((DataRequirementValueFilterComponent) value); // DataRequirementValueFilterComponent
2398          return value;
2399        case 102976443: // limit
2400          this.limit = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2401          return value;
2402        case 3536286: // sort
2403          this.getSort().add((DataRequirementSortComponent) value); // DataRequirementSortComponent
2404          return value;
2405        default: return super.setProperty(hash, name, value);
2406        }
2407
2408      }
2409
2410      @Override
2411      public Base setProperty(String name, Base value) throws FHIRException {
2412        if (name.equals("type")) {
2413          value = new FHIRTypesEnumFactory().fromType(TypeConvertor.castToCode(value));
2414          this.type = (Enumeration) value; // Enumeration<FHIRTypes>
2415        } else if (name.equals("profile")) {
2416          this.getProfile().add(TypeConvertor.castToCanonical(value));
2417        } else if (name.equals("subject[x]")) {
2418          this.subject = TypeConvertor.castToType(value); // DataType
2419        } else if (name.equals("mustSupport")) {
2420          this.getMustSupport().add(TypeConvertor.castToString(value));
2421        } else if (name.equals("codeFilter")) {
2422          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value);
2423        } else if (name.equals("dateFilter")) {
2424          this.getDateFilter().add((DataRequirementDateFilterComponent) value);
2425        } else if (name.equals("valueFilter")) {
2426          this.getValueFilter().add((DataRequirementValueFilterComponent) value);
2427        } else if (name.equals("limit")) {
2428          this.limit = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2429        } else if (name.equals("sort")) {
2430          this.getSort().add((DataRequirementSortComponent) value);
2431        } else
2432          return super.setProperty(name, value);
2433        return value;
2434      }
2435
2436      @Override
2437      public Base makeProperty(int hash, String name) throws FHIRException {
2438        switch (hash) {
2439        case 3575610:  return getTypeElement();
2440        case -309425751:  return addProfileElement();
2441        case -573640748:  return getSubject();
2442        case -1867885268:  return getSubject();
2443        case -1402857082:  return addMustSupportElement();
2444        case -1303674939:  return addCodeFilter(); 
2445        case 149531846:  return addDateFilter(); 
2446        case -1807110071:  return addValueFilter(); 
2447        case 102976443:  return getLimitElement();
2448        case 3536286:  return addSort(); 
2449        default: return super.makeProperty(hash, name);
2450        }
2451
2452      }
2453
2454      @Override
2455      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2456        switch (hash) {
2457        case 3575610: /*type*/ return new String[] {"code"};
2458        case -309425751: /*profile*/ return new String[] {"canonical"};
2459        case -1867885268: /*subject*/ return new String[] {"CodeableConcept", "Reference"};
2460        case -1402857082: /*mustSupport*/ return new String[] {"string"};
2461        case -1303674939: /*codeFilter*/ return new String[] {};
2462        case 149531846: /*dateFilter*/ return new String[] {};
2463        case -1807110071: /*valueFilter*/ return new String[] {};
2464        case 102976443: /*limit*/ return new String[] {"positiveInt"};
2465        case 3536286: /*sort*/ return new String[] {};
2466        default: return super.getTypesForProperty(hash, name);
2467        }
2468
2469      }
2470
2471      @Override
2472      public Base addChild(String name) throws FHIRException {
2473        if (name.equals("type")) {
2474          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.type");
2475        }
2476        else if (name.equals("profile")) {
2477          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.profile");
2478        }
2479        else if (name.equals("subjectCodeableConcept")) {
2480          this.subject = new CodeableConcept();
2481          return this.subject;
2482        }
2483        else if (name.equals("subjectReference")) {
2484          this.subject = new Reference();
2485          return this.subject;
2486        }
2487        else if (name.equals("mustSupport")) {
2488          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.mustSupport");
2489        }
2490        else if (name.equals("codeFilter")) {
2491          return addCodeFilter();
2492        }
2493        else if (name.equals("dateFilter")) {
2494          return addDateFilter();
2495        }
2496        else if (name.equals("valueFilter")) {
2497          return addValueFilter();
2498        }
2499        else if (name.equals("limit")) {
2500          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.limit");
2501        }
2502        else if (name.equals("sort")) {
2503          return addSort();
2504        }
2505        else
2506          return super.addChild(name);
2507      }
2508
2509  public String fhirType() {
2510    return "DataRequirement";
2511
2512  }
2513
2514      public DataRequirement copy() {
2515        DataRequirement dst = new DataRequirement();
2516        copyValues(dst);
2517        return dst;
2518      }
2519
2520      public void copyValues(DataRequirement dst) {
2521        super.copyValues(dst);
2522        dst.type = type == null ? null : type.copy();
2523        if (profile != null) {
2524          dst.profile = new ArrayList<CanonicalType>();
2525          for (CanonicalType i : profile)
2526            dst.profile.add(i.copy());
2527        };
2528        dst.subject = subject == null ? null : subject.copy();
2529        if (mustSupport != null) {
2530          dst.mustSupport = new ArrayList<StringType>();
2531          for (StringType i : mustSupport)
2532            dst.mustSupport.add(i.copy());
2533        };
2534        if (codeFilter != null) {
2535          dst.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
2536          for (DataRequirementCodeFilterComponent i : codeFilter)
2537            dst.codeFilter.add(i.copy());
2538        };
2539        if (dateFilter != null) {
2540          dst.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
2541          for (DataRequirementDateFilterComponent i : dateFilter)
2542            dst.dateFilter.add(i.copy());
2543        };
2544        if (valueFilter != null) {
2545          dst.valueFilter = new ArrayList<DataRequirementValueFilterComponent>();
2546          for (DataRequirementValueFilterComponent i : valueFilter)
2547            dst.valueFilter.add(i.copy());
2548        };
2549        dst.limit = limit == null ? null : limit.copy();
2550        if (sort != null) {
2551          dst.sort = new ArrayList<DataRequirementSortComponent>();
2552          for (DataRequirementSortComponent i : sort)
2553            dst.sort.add(i.copy());
2554        };
2555      }
2556
2557      protected DataRequirement typedCopy() {
2558        return copy();
2559      }
2560
2561      @Override
2562      public boolean equalsDeep(Base other_) {
2563        if (!super.equalsDeep(other_))
2564          return false;
2565        if (!(other_ instanceof DataRequirement))
2566          return false;
2567        DataRequirement o = (DataRequirement) other_;
2568        return compareDeep(type, o.type, true) && compareDeep(profile, o.profile, true) && compareDeep(subject, o.subject, true)
2569           && compareDeep(mustSupport, o.mustSupport, true) && compareDeep(codeFilter, o.codeFilter, true)
2570           && compareDeep(dateFilter, o.dateFilter, true) && compareDeep(valueFilter, o.valueFilter, true)
2571           && compareDeep(limit, o.limit, true) && compareDeep(sort, o.sort, true);
2572      }
2573
2574      @Override
2575      public boolean equalsShallow(Base other_) {
2576        if (!super.equalsShallow(other_))
2577          return false;
2578        if (!(other_ instanceof DataRequirement))
2579          return false;
2580        DataRequirement o = (DataRequirement) other_;
2581        return compareValues(type, o.type, true) && compareValues(profile, o.profile, true) && compareValues(mustSupport, o.mustSupport, true)
2582           && compareValues(limit, o.limit, true);
2583      }
2584
2585      public boolean isEmpty() {
2586        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, profile, subject, mustSupport
2587          , codeFilter, dateFilter, valueFilter, limit, sort);
2588      }
2589
2590
2591}
2592