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 void removeChild(String name, Base value) throws FHIRException {
634        if (name.equals("path")) {
635          this.path = null;
636        } else if (name.equals("searchParam")) {
637          this.searchParam = null;
638        } else if (name.equals("valueSet")) {
639          this.valueSet = null;
640        } else if (name.equals("code")) {
641          this.getCode().remove(value);
642        } else
643          super.removeChild(name, value);
644        
645      }
646
647      @Override
648      public Base makeProperty(int hash, String name) throws FHIRException {
649        switch (hash) {
650        case 3433509:  return getPathElement();
651        case -553645115:  return getSearchParamElement();
652        case -1410174671:  return getValueSetElement();
653        case 3059181:  return addCode(); 
654        default: return super.makeProperty(hash, name);
655        }
656
657      }
658
659      @Override
660      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
661        switch (hash) {
662        case 3433509: /*path*/ return new String[] {"string"};
663        case -553645115: /*searchParam*/ return new String[] {"string"};
664        case -1410174671: /*valueSet*/ return new String[] {"canonical"};
665        case 3059181: /*code*/ return new String[] {"Coding"};
666        default: return super.getTypesForProperty(hash, name);
667        }
668
669      }
670
671      @Override
672      public Base addChild(String name) throws FHIRException {
673        if (name.equals("path")) {
674          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.codeFilter.path");
675        }
676        else if (name.equals("searchParam")) {
677          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.codeFilter.searchParam");
678        }
679        else if (name.equals("valueSet")) {
680          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.codeFilter.valueSet");
681        }
682        else if (name.equals("code")) {
683          return addCode();
684        }
685        else
686          return super.addChild(name);
687      }
688
689      public DataRequirementCodeFilterComponent copy() {
690        DataRequirementCodeFilterComponent dst = new DataRequirementCodeFilterComponent();
691        copyValues(dst);
692        return dst;
693      }
694
695      public void copyValues(DataRequirementCodeFilterComponent dst) {
696        super.copyValues(dst);
697        dst.path = path == null ? null : path.copy();
698        dst.searchParam = searchParam == null ? null : searchParam.copy();
699        dst.valueSet = valueSet == null ? null : valueSet.copy();
700        if (code != null) {
701          dst.code = new ArrayList<Coding>();
702          for (Coding i : code)
703            dst.code.add(i.copy());
704        };
705      }
706
707      @Override
708      public boolean equalsDeep(Base other_) {
709        if (!super.equalsDeep(other_))
710          return false;
711        if (!(other_ instanceof DataRequirementCodeFilterComponent))
712          return false;
713        DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other_;
714        return compareDeep(path, o.path, true) && compareDeep(searchParam, o.searchParam, true) && compareDeep(valueSet, o.valueSet, true)
715           && compareDeep(code, o.code, true);
716      }
717
718      @Override
719      public boolean equalsShallow(Base other_) {
720        if (!super.equalsShallow(other_))
721          return false;
722        if (!(other_ instanceof DataRequirementCodeFilterComponent))
723          return false;
724        DataRequirementCodeFilterComponent o = (DataRequirementCodeFilterComponent) other_;
725        return compareValues(path, o.path, true) && compareValues(searchParam, o.searchParam, true) && compareValues(valueSet, o.valueSet, true)
726          ;
727      }
728
729      public boolean isEmpty() {
730        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, searchParam, valueSet
731          , code);
732      }
733
734  public String fhirType() {
735    return "DataRequirement.codeFilter";
736
737  }
738
739  }
740
741    @Block()
742    public static class DataRequirementDateFilterComponent extends Element implements IBaseDatatypeElement {
743        /**
744         * 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.
745         */
746        @Child(name = "path", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
747        @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." )
748        protected StringType path;
749
750        /**
751         * 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.
752         */
753        @Child(name = "searchParam", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
754        @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." )
755        protected StringType searchParam;
756
757        /**
758         * 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.
759         */
760        @Child(name = "value", type = {DateTimeType.class, Period.class, Duration.class}, order=3, min=0, max=1, modifier=false, summary=true)
761        @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." )
762        protected DataType value;
763
764        private static final long serialVersionUID = 1649787979L;
765
766    /**
767     * Constructor
768     */
769      public DataRequirementDateFilterComponent() {
770        super();
771      }
772
773        /**
774         * @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
775         */
776        public StringType getPathElement() { 
777          if (this.path == null)
778            if (Configuration.errorOnAutoCreate())
779              throw new Error("Attempt to auto-create DataRequirementDateFilterComponent.path");
780            else if (Configuration.doAutoCreate())
781              this.path = new StringType(); // bb
782          return this.path;
783        }
784
785        public boolean hasPathElement() { 
786          return this.path != null && !this.path.isEmpty();
787        }
788
789        public boolean hasPath() { 
790          return this.path != null && !this.path.isEmpty();
791        }
792
793        /**
794         * @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
795         */
796        public DataRequirementDateFilterComponent setPathElement(StringType value) { 
797          this.path = value;
798          return this;
799        }
800
801        /**
802         * @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.
803         */
804        public String getPath() { 
805          return this.path == null ? null : this.path.getValue();
806        }
807
808        /**
809         * @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.
810         */
811        public DataRequirementDateFilterComponent setPath(String value) { 
812          if (Utilities.noString(value))
813            this.path = null;
814          else {
815            if (this.path == null)
816              this.path = new StringType();
817            this.path.setValue(value);
818          }
819          return this;
820        }
821
822        /**
823         * @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
824         */
825        public StringType getSearchParamElement() { 
826          if (this.searchParam == null)
827            if (Configuration.errorOnAutoCreate())
828              throw new Error("Attempt to auto-create DataRequirementDateFilterComponent.searchParam");
829            else if (Configuration.doAutoCreate())
830              this.searchParam = new StringType(); // bb
831          return this.searchParam;
832        }
833
834        public boolean hasSearchParamElement() { 
835          return this.searchParam != null && !this.searchParam.isEmpty();
836        }
837
838        public boolean hasSearchParam() { 
839          return this.searchParam != null && !this.searchParam.isEmpty();
840        }
841
842        /**
843         * @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
844         */
845        public DataRequirementDateFilterComponent setSearchParamElement(StringType value) { 
846          this.searchParam = value;
847          return this;
848        }
849
850        /**
851         * @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.
852         */
853        public String getSearchParam() { 
854          return this.searchParam == null ? null : this.searchParam.getValue();
855        }
856
857        /**
858         * @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.
859         */
860        public DataRequirementDateFilterComponent setSearchParam(String value) { 
861          if (Utilities.noString(value))
862            this.searchParam = null;
863          else {
864            if (this.searchParam == null)
865              this.searchParam = new StringType();
866            this.searchParam.setValue(value);
867          }
868          return this;
869        }
870
871        /**
872         * @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.)
873         */
874        public DataType getValue() { 
875          return this.value;
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 DateTimeType getValueDateTimeType() throws FHIRException { 
882          if (this.value == null)
883            this.value = new DateTimeType();
884          if (!(this.value instanceof DateTimeType))
885            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
886          return (DateTimeType) this.value;
887        }
888
889        public boolean hasValueDateTimeType() { 
890          return this != null && this.value instanceof DateTimeType;
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 Period getValuePeriod() throws FHIRException { 
897          if (this.value == null)
898            this.value = new Period();
899          if (!(this.value instanceof Period))
900            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
901          return (Period) this.value;
902        }
903
904        public boolean hasValuePeriod() { 
905          return this != null && this.value instanceof Period;
906        }
907
908        /**
909         * @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.)
910         */
911        public Duration getValueDuration() throws FHIRException { 
912          if (this.value == null)
913            this.value = new Duration();
914          if (!(this.value instanceof Duration))
915            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
916          return (Duration) this.value;
917        }
918
919        public boolean hasValueDuration() { 
920          return this != null && this.value instanceof Duration;
921        }
922
923        public boolean hasValue() { 
924          return this.value != null && !this.value.isEmpty();
925        }
926
927        /**
928         * @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.)
929         */
930        public DataRequirementDateFilterComponent setValue(DataType value) { 
931          if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Duration))
932            throw new FHIRException("Not the right type for DataRequirement.dateFilter.value[x]: "+value.fhirType());
933          this.value = value;
934          return this;
935        }
936
937        protected void listChildren(List<Property> children) {
938          super.listChildren(children);
939          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));
940          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));
941          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));
942        }
943
944        @Override
945        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
946          switch (_hash) {
947          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);
948          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);
949          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);
950          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);
951          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);
952          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);
953          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);
954          default: return super.getNamedProperty(_hash, _name, _checkValid);
955          }
956
957        }
958
959      @Override
960      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
961        switch (hash) {
962        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
963        case -553645115: /*searchParam*/ return this.searchParam == null ? new Base[0] : new Base[] {this.searchParam}; // StringType
964        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
965        default: return super.getProperty(hash, name, checkValid);
966        }
967
968      }
969
970      @Override
971      public Base setProperty(int hash, String name, Base value) throws FHIRException {
972        switch (hash) {
973        case 3433509: // path
974          this.path = TypeConvertor.castToString(value); // StringType
975          return value;
976        case -553645115: // searchParam
977          this.searchParam = TypeConvertor.castToString(value); // StringType
978          return value;
979        case 111972721: // value
980          this.value = TypeConvertor.castToType(value); // DataType
981          return value;
982        default: return super.setProperty(hash, name, value);
983        }
984
985      }
986
987      @Override
988      public Base setProperty(String name, Base value) throws FHIRException {
989        if (name.equals("path")) {
990          this.path = TypeConvertor.castToString(value); // StringType
991        } else if (name.equals("searchParam")) {
992          this.searchParam = TypeConvertor.castToString(value); // StringType
993        } else if (name.equals("value[x]")) {
994          this.value = TypeConvertor.castToType(value); // DataType
995        } else
996          return super.setProperty(name, value);
997        return value;
998      }
999
1000  @Override
1001  public void removeChild(String name, Base value) throws FHIRException {
1002        if (name.equals("path")) {
1003          this.path = null;
1004        } else if (name.equals("searchParam")) {
1005          this.searchParam = null;
1006        } else if (name.equals("value[x]")) {
1007          this.value = null;
1008        } else
1009          super.removeChild(name, value);
1010        
1011      }
1012
1013      @Override
1014      public Base makeProperty(int hash, String name) throws FHIRException {
1015        switch (hash) {
1016        case 3433509:  return getPathElement();
1017        case -553645115:  return getSearchParamElement();
1018        case -1410166417:  return getValue();
1019        case 111972721:  return getValue();
1020        default: return super.makeProperty(hash, name);
1021        }
1022
1023      }
1024
1025      @Override
1026      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1027        switch (hash) {
1028        case 3433509: /*path*/ return new String[] {"string"};
1029        case -553645115: /*searchParam*/ return new String[] {"string"};
1030        case 111972721: /*value*/ return new String[] {"dateTime", "Period", "Duration"};
1031        default: return super.getTypesForProperty(hash, name);
1032        }
1033
1034      }
1035
1036      @Override
1037      public Base addChild(String name) throws FHIRException {
1038        if (name.equals("path")) {
1039          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.dateFilter.path");
1040        }
1041        else if (name.equals("searchParam")) {
1042          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.dateFilter.searchParam");
1043        }
1044        else if (name.equals("valueDateTime")) {
1045          this.value = new DateTimeType();
1046          return this.value;
1047        }
1048        else if (name.equals("valuePeriod")) {
1049          this.value = new Period();
1050          return this.value;
1051        }
1052        else if (name.equals("valueDuration")) {
1053          this.value = new Duration();
1054          return this.value;
1055        }
1056        else
1057          return super.addChild(name);
1058      }
1059
1060      public DataRequirementDateFilterComponent copy() {
1061        DataRequirementDateFilterComponent dst = new DataRequirementDateFilterComponent();
1062        copyValues(dst);
1063        return dst;
1064      }
1065
1066      public void copyValues(DataRequirementDateFilterComponent dst) {
1067        super.copyValues(dst);
1068        dst.path = path == null ? null : path.copy();
1069        dst.searchParam = searchParam == null ? null : searchParam.copy();
1070        dst.value = value == null ? null : value.copy();
1071      }
1072
1073      @Override
1074      public boolean equalsDeep(Base other_) {
1075        if (!super.equalsDeep(other_))
1076          return false;
1077        if (!(other_ instanceof DataRequirementDateFilterComponent))
1078          return false;
1079        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other_;
1080        return compareDeep(path, o.path, true) && compareDeep(searchParam, o.searchParam, true) && compareDeep(value, o.value, true)
1081          ;
1082      }
1083
1084      @Override
1085      public boolean equalsShallow(Base other_) {
1086        if (!super.equalsShallow(other_))
1087          return false;
1088        if (!(other_ instanceof DataRequirementDateFilterComponent))
1089          return false;
1090        DataRequirementDateFilterComponent o = (DataRequirementDateFilterComponent) other_;
1091        return compareValues(path, o.path, true) && compareValues(searchParam, o.searchParam, true);
1092      }
1093
1094      public boolean isEmpty() {
1095        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, searchParam, value
1096          );
1097      }
1098
1099  public String fhirType() {
1100    return "DataRequirement.dateFilter";
1101
1102  }
1103
1104  }
1105
1106    @Block()
1107    public static class DataRequirementValueFilterComponent extends Element implements IBaseDatatypeElement {
1108        /**
1109         * 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.
1110         */
1111        @Child(name = "path", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1112        @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." )
1113        protected StringType path;
1114
1115        /**
1116         * 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.
1117         */
1118        @Child(name = "searchParam", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1119        @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." )
1120        protected StringType searchParam;
1121
1122        /**
1123         * The comparator to be used to determine whether the value is matching.
1124         */
1125        @Child(name = "comparator", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1126        @Description(shortDefinition="eq | gt | lt | ge | le | sa | eb", formalDefinition="The comparator to be used to determine whether the value is matching." )
1127        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/value-filter-comparator")
1128        protected Enumeration<ValueFilterComparator> comparator;
1129
1130        /**
1131         * The value of the filter.
1132         */
1133        @Child(name = "value", type = {DateTimeType.class, Period.class, Duration.class}, order=4, min=0, max=1, modifier=false, summary=true)
1134        @Description(shortDefinition="The value of the filter, as a Period, DateTime, or Duration value", formalDefinition="The value of the filter." )
1135        protected DataType value;
1136
1137        private static final long serialVersionUID = 2106988483L;
1138
1139    /**
1140     * Constructor
1141     */
1142      public DataRequirementValueFilterComponent() {
1143        super();
1144      }
1145
1146        /**
1147         * @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
1148         */
1149        public StringType getPathElement() { 
1150          if (this.path == null)
1151            if (Configuration.errorOnAutoCreate())
1152              throw new Error("Attempt to auto-create DataRequirementValueFilterComponent.path");
1153            else if (Configuration.doAutoCreate())
1154              this.path = new StringType(); // bb
1155          return this.path;
1156        }
1157
1158        public boolean hasPathElement() { 
1159          return this.path != null && !this.path.isEmpty();
1160        }
1161
1162        public boolean hasPath() { 
1163          return this.path != null && !this.path.isEmpty();
1164        }
1165
1166        /**
1167         * @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
1168         */
1169        public DataRequirementValueFilterComponent setPathElement(StringType value) { 
1170          this.path = value;
1171          return this;
1172        }
1173
1174        /**
1175         * @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.
1176         */
1177        public String getPath() { 
1178          return this.path == null ? null : this.path.getValue();
1179        }
1180
1181        /**
1182         * @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.
1183         */
1184        public DataRequirementValueFilterComponent setPath(String value) { 
1185          if (Utilities.noString(value))
1186            this.path = null;
1187          else {
1188            if (this.path == null)
1189              this.path = new StringType();
1190            this.path.setValue(value);
1191          }
1192          return this;
1193        }
1194
1195        /**
1196         * @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
1197         */
1198        public StringType getSearchParamElement() { 
1199          if (this.searchParam == null)
1200            if (Configuration.errorOnAutoCreate())
1201              throw new Error("Attempt to auto-create DataRequirementValueFilterComponent.searchParam");
1202            else if (Configuration.doAutoCreate())
1203              this.searchParam = new StringType(); // bb
1204          return this.searchParam;
1205        }
1206
1207        public boolean hasSearchParamElement() { 
1208          return this.searchParam != null && !this.searchParam.isEmpty();
1209        }
1210
1211        public boolean hasSearchParam() { 
1212          return this.searchParam != null && !this.searchParam.isEmpty();
1213        }
1214
1215        /**
1216         * @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
1217         */
1218        public DataRequirementValueFilterComponent setSearchParamElement(StringType value) { 
1219          this.searchParam = value;
1220          return this;
1221        }
1222
1223        /**
1224         * @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.
1225         */
1226        public String getSearchParam() { 
1227          return this.searchParam == null ? null : this.searchParam.getValue();
1228        }
1229
1230        /**
1231         * @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.
1232         */
1233        public DataRequirementValueFilterComponent setSearchParam(String value) { 
1234          if (Utilities.noString(value))
1235            this.searchParam = null;
1236          else {
1237            if (this.searchParam == null)
1238              this.searchParam = new StringType();
1239            this.searchParam.setValue(value);
1240          }
1241          return this;
1242        }
1243
1244        /**
1245         * @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
1246         */
1247        public Enumeration<ValueFilterComparator> getComparatorElement() { 
1248          if (this.comparator == null)
1249            if (Configuration.errorOnAutoCreate())
1250              throw new Error("Attempt to auto-create DataRequirementValueFilterComponent.comparator");
1251            else if (Configuration.doAutoCreate())
1252              this.comparator = new Enumeration<ValueFilterComparator>(new ValueFilterComparatorEnumFactory()); // bb
1253          return this.comparator;
1254        }
1255
1256        public boolean hasComparatorElement() { 
1257          return this.comparator != null && !this.comparator.isEmpty();
1258        }
1259
1260        public boolean hasComparator() { 
1261          return this.comparator != null && !this.comparator.isEmpty();
1262        }
1263
1264        /**
1265         * @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
1266         */
1267        public DataRequirementValueFilterComponent setComparatorElement(Enumeration<ValueFilterComparator> value) { 
1268          this.comparator = value;
1269          return this;
1270        }
1271
1272        /**
1273         * @return The comparator to be used to determine whether the value is matching.
1274         */
1275        public ValueFilterComparator getComparator() { 
1276          return this.comparator == null ? null : this.comparator.getValue();
1277        }
1278
1279        /**
1280         * @param value The comparator to be used to determine whether the value is matching.
1281         */
1282        public DataRequirementValueFilterComponent setComparator(ValueFilterComparator value) { 
1283          if (value == null)
1284            this.comparator = null;
1285          else {
1286            if (this.comparator == null)
1287              this.comparator = new Enumeration<ValueFilterComparator>(new ValueFilterComparatorEnumFactory());
1288            this.comparator.setValue(value);
1289          }
1290          return this;
1291        }
1292
1293        /**
1294         * @return {@link #value} (The value of the filter.)
1295         */
1296        public DataType getValue() { 
1297          return this.value;
1298        }
1299
1300        /**
1301         * @return {@link #value} (The value of the filter.)
1302         */
1303        public DateTimeType getValueDateTimeType() throws FHIRException { 
1304          if (this.value == null)
1305            this.value = new DateTimeType();
1306          if (!(this.value instanceof DateTimeType))
1307            throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.value.getClass().getName()+" was encountered");
1308          return (DateTimeType) this.value;
1309        }
1310
1311        public boolean hasValueDateTimeType() { 
1312          return this != null && this.value instanceof DateTimeType;
1313        }
1314
1315        /**
1316         * @return {@link #value} (The value of the filter.)
1317         */
1318        public Period getValuePeriod() throws FHIRException { 
1319          if (this.value == null)
1320            this.value = new Period();
1321          if (!(this.value instanceof Period))
1322            throw new FHIRException("Type mismatch: the type Period was expected, but "+this.value.getClass().getName()+" was encountered");
1323          return (Period) this.value;
1324        }
1325
1326        public boolean hasValuePeriod() { 
1327          return this != null && this.value instanceof Period;
1328        }
1329
1330        /**
1331         * @return {@link #value} (The value of the filter.)
1332         */
1333        public Duration getValueDuration() throws FHIRException { 
1334          if (this.value == null)
1335            this.value = new Duration();
1336          if (!(this.value instanceof Duration))
1337            throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.value.getClass().getName()+" was encountered");
1338          return (Duration) this.value;
1339        }
1340
1341        public boolean hasValueDuration() { 
1342          return this != null && this.value instanceof Duration;
1343        }
1344
1345        public boolean hasValue() { 
1346          return this.value != null && !this.value.isEmpty();
1347        }
1348
1349        /**
1350         * @param value {@link #value} (The value of the filter.)
1351         */
1352        public DataRequirementValueFilterComponent setValue(DataType value) { 
1353          if (value != null && !(value instanceof DateTimeType || value instanceof Period || value instanceof Duration))
1354            throw new FHIRException("Not the right type for DataRequirement.valueFilter.value[x]: "+value.fhirType());
1355          this.value = value;
1356          return this;
1357        }
1358
1359        protected void listChildren(List<Property> children) {
1360          super.listChildren(children);
1361          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));
1362          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));
1363          children.add(new Property("comparator", "code", "The comparator to be used to determine whether the value is matching.", 0, 1, comparator));
1364          children.add(new Property("value[x]", "dateTime|Period|Duration", "The value of the filter.", 0, 1, value));
1365        }
1366
1367        @Override
1368        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1369          switch (_hash) {
1370          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);
1371          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);
1372          case -844673834: /*comparator*/  return new Property("comparator", "code", "The comparator to be used to determine whether the value is matching.", 0, 1, comparator);
1373          case -1410166417: /*value[x]*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter.", 0, 1, value);
1374          case 111972721: /*value*/  return new Property("value[x]", "dateTime|Period|Duration", "The value of the filter.", 0, 1, value);
1375          case 1047929900: /*valueDateTime*/  return new Property("value[x]", "dateTime", "The value of the filter.", 0, 1, value);
1376          case -1524344174: /*valuePeriod*/  return new Property("value[x]", "Period", "The value of the filter.", 0, 1, value);
1377          case 1558135333: /*valueDuration*/  return new Property("value[x]", "Duration", "The value of the filter.", 0, 1, value);
1378          default: return super.getNamedProperty(_hash, _name, _checkValid);
1379          }
1380
1381        }
1382
1383      @Override
1384      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1385        switch (hash) {
1386        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1387        case -553645115: /*searchParam*/ return this.searchParam == null ? new Base[0] : new Base[] {this.searchParam}; // StringType
1388        case -844673834: /*comparator*/ return this.comparator == null ? new Base[0] : new Base[] {this.comparator}; // Enumeration<ValueFilterComparator>
1389        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
1390        default: return super.getProperty(hash, name, checkValid);
1391        }
1392
1393      }
1394
1395      @Override
1396      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1397        switch (hash) {
1398        case 3433509: // path
1399          this.path = TypeConvertor.castToString(value); // StringType
1400          return value;
1401        case -553645115: // searchParam
1402          this.searchParam = TypeConvertor.castToString(value); // StringType
1403          return value;
1404        case -844673834: // comparator
1405          value = new ValueFilterComparatorEnumFactory().fromType(TypeConvertor.castToCode(value));
1406          this.comparator = (Enumeration) value; // Enumeration<ValueFilterComparator>
1407          return value;
1408        case 111972721: // value
1409          this.value = TypeConvertor.castToType(value); // DataType
1410          return value;
1411        default: return super.setProperty(hash, name, value);
1412        }
1413
1414      }
1415
1416      @Override
1417      public Base setProperty(String name, Base value) throws FHIRException {
1418        if (name.equals("path")) {
1419          this.path = TypeConvertor.castToString(value); // StringType
1420        } else if (name.equals("searchParam")) {
1421          this.searchParam = TypeConvertor.castToString(value); // StringType
1422        } else if (name.equals("comparator")) {
1423          value = new ValueFilterComparatorEnumFactory().fromType(TypeConvertor.castToCode(value));
1424          this.comparator = (Enumeration) value; // Enumeration<ValueFilterComparator>
1425        } else if (name.equals("value[x]")) {
1426          this.value = TypeConvertor.castToType(value); // DataType
1427        } else
1428          return super.setProperty(name, value);
1429        return value;
1430      }
1431
1432  @Override
1433  public void removeChild(String name, Base value) throws FHIRException {
1434        if (name.equals("path")) {
1435          this.path = null;
1436        } else if (name.equals("searchParam")) {
1437          this.searchParam = null;
1438        } else if (name.equals("comparator")) {
1439          value = new ValueFilterComparatorEnumFactory().fromType(TypeConvertor.castToCode(value));
1440          this.comparator = (Enumeration) value; // Enumeration<ValueFilterComparator>
1441        } else if (name.equals("value[x]")) {
1442          this.value = null;
1443        } else
1444          super.removeChild(name, value);
1445        
1446      }
1447
1448      @Override
1449      public Base makeProperty(int hash, String name) throws FHIRException {
1450        switch (hash) {
1451        case 3433509:  return getPathElement();
1452        case -553645115:  return getSearchParamElement();
1453        case -844673834:  return getComparatorElement();
1454        case -1410166417:  return getValue();
1455        case 111972721:  return getValue();
1456        default: return super.makeProperty(hash, name);
1457        }
1458
1459      }
1460
1461      @Override
1462      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1463        switch (hash) {
1464        case 3433509: /*path*/ return new String[] {"string"};
1465        case -553645115: /*searchParam*/ return new String[] {"string"};
1466        case -844673834: /*comparator*/ return new String[] {"code"};
1467        case 111972721: /*value*/ return new String[] {"dateTime", "Period", "Duration"};
1468        default: return super.getTypesForProperty(hash, name);
1469        }
1470
1471      }
1472
1473      @Override
1474      public Base addChild(String name) throws FHIRException {
1475        if (name.equals("path")) {
1476          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.valueFilter.path");
1477        }
1478        else if (name.equals("searchParam")) {
1479          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.valueFilter.searchParam");
1480        }
1481        else if (name.equals("comparator")) {
1482          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.valueFilter.comparator");
1483        }
1484        else if (name.equals("valueDateTime")) {
1485          this.value = new DateTimeType();
1486          return this.value;
1487        }
1488        else if (name.equals("valuePeriod")) {
1489          this.value = new Period();
1490          return this.value;
1491        }
1492        else if (name.equals("valueDuration")) {
1493          this.value = new Duration();
1494          return this.value;
1495        }
1496        else
1497          return super.addChild(name);
1498      }
1499
1500      public DataRequirementValueFilterComponent copy() {
1501        DataRequirementValueFilterComponent dst = new DataRequirementValueFilterComponent();
1502        copyValues(dst);
1503        return dst;
1504      }
1505
1506      public void copyValues(DataRequirementValueFilterComponent dst) {
1507        super.copyValues(dst);
1508        dst.path = path == null ? null : path.copy();
1509        dst.searchParam = searchParam == null ? null : searchParam.copy();
1510        dst.comparator = comparator == null ? null : comparator.copy();
1511        dst.value = value == null ? null : value.copy();
1512      }
1513
1514      @Override
1515      public boolean equalsDeep(Base other_) {
1516        if (!super.equalsDeep(other_))
1517          return false;
1518        if (!(other_ instanceof DataRequirementValueFilterComponent))
1519          return false;
1520        DataRequirementValueFilterComponent o = (DataRequirementValueFilterComponent) other_;
1521        return compareDeep(path, o.path, true) && compareDeep(searchParam, o.searchParam, true) && compareDeep(comparator, o.comparator, true)
1522           && compareDeep(value, o.value, true);
1523      }
1524
1525      @Override
1526      public boolean equalsShallow(Base other_) {
1527        if (!super.equalsShallow(other_))
1528          return false;
1529        if (!(other_ instanceof DataRequirementValueFilterComponent))
1530          return false;
1531        DataRequirementValueFilterComponent o = (DataRequirementValueFilterComponent) other_;
1532        return compareValues(path, o.path, true) && compareValues(searchParam, o.searchParam, true) && compareValues(comparator, o.comparator, true)
1533          ;
1534      }
1535
1536      public boolean isEmpty() {
1537        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, searchParam, comparator
1538          , value);
1539      }
1540
1541  public String fhirType() {
1542    return "DataRequirement.valueFilter";
1543
1544  }
1545
1546  }
1547
1548    @Block()
1549    public static class DataRequirementSortComponent extends Element implements IBaseDatatypeElement {
1550        /**
1551         * 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.
1552         */
1553        @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1554        @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." )
1555        protected StringType path;
1556
1557        /**
1558         * The direction of the sort, ascending or descending.
1559         */
1560        @Child(name = "direction", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1561        @Description(shortDefinition="ascending | descending", formalDefinition="The direction of the sort, ascending or descending." )
1562        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/sort-direction")
1563        protected Enumeration<SortDirection> direction;
1564
1565        private static final long serialVersionUID = -694498683L;
1566
1567    /**
1568     * Constructor
1569     */
1570      public DataRequirementSortComponent() {
1571        super();
1572      }
1573
1574    /**
1575     * Constructor
1576     */
1577      public DataRequirementSortComponent(String path, SortDirection direction) {
1578        super();
1579        this.setPath(path);
1580        this.setDirection(direction);
1581      }
1582
1583        /**
1584         * @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
1585         */
1586        public StringType getPathElement() { 
1587          if (this.path == null)
1588            if (Configuration.errorOnAutoCreate())
1589              throw new Error("Attempt to auto-create DataRequirementSortComponent.path");
1590            else if (Configuration.doAutoCreate())
1591              this.path = new StringType(); // bb
1592          return this.path;
1593        }
1594
1595        public boolean hasPathElement() { 
1596          return this.path != null && !this.path.isEmpty();
1597        }
1598
1599        public boolean hasPath() { 
1600          return this.path != null && !this.path.isEmpty();
1601        }
1602
1603        /**
1604         * @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
1605         */
1606        public DataRequirementSortComponent setPathElement(StringType value) { 
1607          this.path = value;
1608          return this;
1609        }
1610
1611        /**
1612         * @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.
1613         */
1614        public String getPath() { 
1615          return this.path == null ? null : this.path.getValue();
1616        }
1617
1618        /**
1619         * @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.
1620         */
1621        public DataRequirementSortComponent setPath(String value) { 
1622            if (this.path == null)
1623              this.path = new StringType();
1624            this.path.setValue(value);
1625          return this;
1626        }
1627
1628        /**
1629         * @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
1630         */
1631        public Enumeration<SortDirection> getDirectionElement() { 
1632          if (this.direction == null)
1633            if (Configuration.errorOnAutoCreate())
1634              throw new Error("Attempt to auto-create DataRequirementSortComponent.direction");
1635            else if (Configuration.doAutoCreate())
1636              this.direction = new Enumeration<SortDirection>(new SortDirectionEnumFactory()); // bb
1637          return this.direction;
1638        }
1639
1640        public boolean hasDirectionElement() { 
1641          return this.direction != null && !this.direction.isEmpty();
1642        }
1643
1644        public boolean hasDirection() { 
1645          return this.direction != null && !this.direction.isEmpty();
1646        }
1647
1648        /**
1649         * @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
1650         */
1651        public DataRequirementSortComponent setDirectionElement(Enumeration<SortDirection> value) { 
1652          this.direction = value;
1653          return this;
1654        }
1655
1656        /**
1657         * @return The direction of the sort, ascending or descending.
1658         */
1659        public SortDirection getDirection() { 
1660          return this.direction == null ? null : this.direction.getValue();
1661        }
1662
1663        /**
1664         * @param value The direction of the sort, ascending or descending.
1665         */
1666        public DataRequirementSortComponent setDirection(SortDirection value) { 
1667            if (this.direction == null)
1668              this.direction = new Enumeration<SortDirection>(new SortDirectionEnumFactory());
1669            this.direction.setValue(value);
1670          return this;
1671        }
1672
1673        protected void listChildren(List<Property> children) {
1674          super.listChildren(children);
1675          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));
1676          children.add(new Property("direction", "code", "The direction of the sort, ascending or descending.", 0, 1, direction));
1677        }
1678
1679        @Override
1680        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1681          switch (_hash) {
1682          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);
1683          case -962590849: /*direction*/  return new Property("direction", "code", "The direction of the sort, ascending or descending.", 0, 1, direction);
1684          default: return super.getNamedProperty(_hash, _name, _checkValid);
1685          }
1686
1687        }
1688
1689      @Override
1690      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1691        switch (hash) {
1692        case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
1693        case -962590849: /*direction*/ return this.direction == null ? new Base[0] : new Base[] {this.direction}; // Enumeration<SortDirection>
1694        default: return super.getProperty(hash, name, checkValid);
1695        }
1696
1697      }
1698
1699      @Override
1700      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1701        switch (hash) {
1702        case 3433509: // path
1703          this.path = TypeConvertor.castToString(value); // StringType
1704          return value;
1705        case -962590849: // direction
1706          value = new SortDirectionEnumFactory().fromType(TypeConvertor.castToCode(value));
1707          this.direction = (Enumeration) value; // Enumeration<SortDirection>
1708          return value;
1709        default: return super.setProperty(hash, name, value);
1710        }
1711
1712      }
1713
1714      @Override
1715      public Base setProperty(String name, Base value) throws FHIRException {
1716        if (name.equals("path")) {
1717          this.path = TypeConvertor.castToString(value); // StringType
1718        } else if (name.equals("direction")) {
1719          value = new SortDirectionEnumFactory().fromType(TypeConvertor.castToCode(value));
1720          this.direction = (Enumeration) value; // Enumeration<SortDirection>
1721        } else
1722          return super.setProperty(name, value);
1723        return value;
1724      }
1725
1726  @Override
1727  public void removeChild(String name, Base value) throws FHIRException {
1728        if (name.equals("path")) {
1729          this.path = null;
1730        } else if (name.equals("direction")) {
1731          value = new SortDirectionEnumFactory().fromType(TypeConvertor.castToCode(value));
1732          this.direction = (Enumeration) value; // Enumeration<SortDirection>
1733        } else
1734          super.removeChild(name, value);
1735        
1736      }
1737
1738      @Override
1739      public Base makeProperty(int hash, String name) throws FHIRException {
1740        switch (hash) {
1741        case 3433509:  return getPathElement();
1742        case -962590849:  return getDirectionElement();
1743        default: return super.makeProperty(hash, name);
1744        }
1745
1746      }
1747
1748      @Override
1749      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1750        switch (hash) {
1751        case 3433509: /*path*/ return new String[] {"string"};
1752        case -962590849: /*direction*/ return new String[] {"code"};
1753        default: return super.getTypesForProperty(hash, name);
1754        }
1755
1756      }
1757
1758      @Override
1759      public Base addChild(String name) throws FHIRException {
1760        if (name.equals("path")) {
1761          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.sort.path");
1762        }
1763        else if (name.equals("direction")) {
1764          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.sort.direction");
1765        }
1766        else
1767          return super.addChild(name);
1768      }
1769
1770      public DataRequirementSortComponent copy() {
1771        DataRequirementSortComponent dst = new DataRequirementSortComponent();
1772        copyValues(dst);
1773        return dst;
1774      }
1775
1776      public void copyValues(DataRequirementSortComponent dst) {
1777        super.copyValues(dst);
1778        dst.path = path == null ? null : path.copy();
1779        dst.direction = direction == null ? null : direction.copy();
1780      }
1781
1782      @Override
1783      public boolean equalsDeep(Base other_) {
1784        if (!super.equalsDeep(other_))
1785          return false;
1786        if (!(other_ instanceof DataRequirementSortComponent))
1787          return false;
1788        DataRequirementSortComponent o = (DataRequirementSortComponent) other_;
1789        return compareDeep(path, o.path, true) && compareDeep(direction, o.direction, true);
1790      }
1791
1792      @Override
1793      public boolean equalsShallow(Base other_) {
1794        if (!super.equalsShallow(other_))
1795          return false;
1796        if (!(other_ instanceof DataRequirementSortComponent))
1797          return false;
1798        DataRequirementSortComponent o = (DataRequirementSortComponent) other_;
1799        return compareValues(path, o.path, true) && compareValues(direction, o.direction, true);
1800      }
1801
1802      public boolean isEmpty() {
1803        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(path, direction);
1804      }
1805
1806  public String fhirType() {
1807    return "DataRequirement.sort";
1808
1809  }
1810
1811  }
1812
1813    /**
1814     * 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.
1815     */
1816    @Child(name = "type", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
1817    @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." )
1818    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fhir-types")
1819    protected Enumeration<FHIRTypes> type;
1820
1821    /**
1822     * The profile of the required data, specified as the uri of the profile definition.
1823     */
1824    @Child(name = "profile", type = {CanonicalType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1825    @Description(shortDefinition="The profile of the required data", formalDefinition="The profile of the required data, specified as the uri of the profile definition." )
1826    protected List<CanonicalType> profile;
1827
1828    /**
1829     * The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.
1830     */
1831    @Child(name = "subject", type = {CodeableConcept.class, Group.class}, order=2, min=0, max=1, modifier=false, summary=true)
1832    @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." )
1833    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/participant-resource-types")
1834    protected DataType subject;
1835
1836    /**
1837     * 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. 
1838
1839The 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).
1840     */
1841    @Child(name = "mustSupport", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1842    @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)." )
1843    protected List<StringType> mustSupport;
1844
1845    /**
1846     * 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.
1847     */
1848    @Child(name = "codeFilter", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1849    @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." )
1850    protected List<DataRequirementCodeFilterComponent> codeFilter;
1851
1852    /**
1853     * 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.
1854     */
1855    @Child(name = "dateFilter", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1856    @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." )
1857    protected List<DataRequirementDateFilterComponent> dateFilter;
1858
1859    /**
1860     * 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).
1861     */
1862    @Child(name = "valueFilter", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1863    @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)." )
1864    protected List<DataRequirementValueFilterComponent> valueFilter;
1865
1866    /**
1867     * Specifies a maximum number of results that are required (uses the _count search parameter).
1868     */
1869    @Child(name = "limit", type = {PositiveIntType.class}, order=7, min=0, max=1, modifier=false, summary=true)
1870    @Description(shortDefinition="Number of results", formalDefinition="Specifies a maximum number of results that are required (uses the _count search parameter)." )
1871    protected PositiveIntType limit;
1872
1873    /**
1874     * Specifies the order of the results to be returned.
1875     */
1876    @Child(name = "sort", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1877    @Description(shortDefinition="Order of the results", formalDefinition="Specifies the order of the results to be returned." )
1878    protected List<DataRequirementSortComponent> sort;
1879
1880    private static final long serialVersionUID = -2078097376L;
1881
1882  /**
1883   * Constructor
1884   */
1885    public DataRequirement() {
1886      super();
1887    }
1888
1889  /**
1890   * Constructor
1891   */
1892    public DataRequirement(FHIRTypes type) {
1893      super();
1894      this.setType(type);
1895    }
1896
1897    /**
1898     * @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
1899     */
1900    public Enumeration<FHIRTypes> getTypeElement() { 
1901      if (this.type == null)
1902        if (Configuration.errorOnAutoCreate())
1903          throw new Error("Attempt to auto-create DataRequirement.type");
1904        else if (Configuration.doAutoCreate())
1905          this.type = new Enumeration<FHIRTypes>(new FHIRTypesEnumFactory()); // bb
1906      return this.type;
1907    }
1908
1909    public boolean hasTypeElement() { 
1910      return this.type != null && !this.type.isEmpty();
1911    }
1912
1913    public boolean hasType() { 
1914      return this.type != null && !this.type.isEmpty();
1915    }
1916
1917    /**
1918     * @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
1919     */
1920    public DataRequirement setTypeElement(Enumeration<FHIRTypes> value) { 
1921      this.type = value;
1922      return this;
1923    }
1924
1925    /**
1926     * @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.
1927     */
1928    public FHIRTypes getType() { 
1929      return this.type == null ? null : this.type.getValue();
1930    }
1931
1932    /**
1933     * @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.
1934     */
1935    public DataRequirement setType(FHIRTypes value) { 
1936        if (this.type == null)
1937          this.type = new Enumeration<FHIRTypes>(new FHIRTypesEnumFactory());
1938        this.type.setValue(value);
1939      return this;
1940    }
1941
1942    /**
1943     * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1944     */
1945    public List<CanonicalType> getProfile() { 
1946      if (this.profile == null)
1947        this.profile = new ArrayList<CanonicalType>();
1948      return this.profile;
1949    }
1950
1951    /**
1952     * @return Returns a reference to <code>this</code> for easy method chaining
1953     */
1954    public DataRequirement setProfile(List<CanonicalType> theProfile) { 
1955      this.profile = theProfile;
1956      return this;
1957    }
1958
1959    public boolean hasProfile() { 
1960      if (this.profile == null)
1961        return false;
1962      for (CanonicalType item : this.profile)
1963        if (!item.isEmpty())
1964          return true;
1965      return false;
1966    }
1967
1968    /**
1969     * @return {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1970     */
1971    public CanonicalType addProfileElement() {//2 
1972      CanonicalType t = new CanonicalType();
1973      if (this.profile == null)
1974        this.profile = new ArrayList<CanonicalType>();
1975      this.profile.add(t);
1976      return t;
1977    }
1978
1979    /**
1980     * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1981     */
1982    public DataRequirement addProfile(String value) { //1
1983      CanonicalType t = new CanonicalType();
1984      t.setValue(value);
1985      if (this.profile == null)
1986        this.profile = new ArrayList<CanonicalType>();
1987      this.profile.add(t);
1988      return this;
1989    }
1990
1991    /**
1992     * @param value {@link #profile} (The profile of the required data, specified as the uri of the profile definition.)
1993     */
1994    public boolean hasProfile(String value) { 
1995      if (this.profile == null)
1996        return false;
1997      for (CanonicalType v : this.profile)
1998        if (v.getValue().equals(value)) // canonical
1999          return true;
2000      return false;
2001    }
2002
2003    /**
2004     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
2005     */
2006    public DataType getSubject() { 
2007      return this.subject;
2008    }
2009
2010    /**
2011     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
2012     */
2013    public CodeableConcept getSubjectCodeableConcept() throws FHIRException { 
2014      if (this.subject == null)
2015        this.subject = new CodeableConcept();
2016      if (!(this.subject instanceof CodeableConcept))
2017        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.subject.getClass().getName()+" was encountered");
2018      return (CodeableConcept) this.subject;
2019    }
2020
2021    public boolean hasSubjectCodeableConcept() { 
2022      return this != null && this.subject instanceof CodeableConcept;
2023    }
2024
2025    /**
2026     * @return {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
2027     */
2028    public Reference getSubjectReference() throws FHIRException { 
2029      if (this.subject == null)
2030        this.subject = new Reference();
2031      if (!(this.subject instanceof Reference))
2032        throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.subject.getClass().getName()+" was encountered");
2033      return (Reference) this.subject;
2034    }
2035
2036    public boolean hasSubjectReference() { 
2037      return this != null && this.subject instanceof Reference;
2038    }
2039
2040    public boolean hasSubject() { 
2041      return this.subject != null && !this.subject.isEmpty();
2042    }
2043
2044    /**
2045     * @param value {@link #subject} (The intended subjects of the data requirement. If this element is not provided, a Patient subject is assumed.)
2046     */
2047    public DataRequirement setSubject(DataType value) { 
2048      if (value != null && !(value instanceof CodeableConcept || value instanceof Reference))
2049        throw new FHIRException("Not the right type for DataRequirement.subject[x]: "+value.fhirType());
2050      this.subject = value;
2051      return this;
2052    }
2053
2054    /**
2055     * @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. 
2056
2057The 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).)
2058     */
2059    public List<StringType> getMustSupport() { 
2060      if (this.mustSupport == null)
2061        this.mustSupport = new ArrayList<StringType>();
2062      return this.mustSupport;
2063    }
2064
2065    /**
2066     * @return Returns a reference to <code>this</code> for easy method chaining
2067     */
2068    public DataRequirement setMustSupport(List<StringType> theMustSupport) { 
2069      this.mustSupport = theMustSupport;
2070      return this;
2071    }
2072
2073    public boolean hasMustSupport() { 
2074      if (this.mustSupport == null)
2075        return false;
2076      for (StringType item : this.mustSupport)
2077        if (!item.isEmpty())
2078          return true;
2079      return false;
2080    }
2081
2082    /**
2083     * @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. 
2084
2085The 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).)
2086     */
2087    public StringType addMustSupportElement() {//2 
2088      StringType t = new StringType();
2089      if (this.mustSupport == null)
2090        this.mustSupport = new ArrayList<StringType>();
2091      this.mustSupport.add(t);
2092      return t;
2093    }
2094
2095    /**
2096     * @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. 
2097
2098The 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).)
2099     */
2100    public DataRequirement addMustSupport(String value) { //1
2101      StringType t = new StringType();
2102      t.setValue(value);
2103      if (this.mustSupport == null)
2104        this.mustSupport = new ArrayList<StringType>();
2105      this.mustSupport.add(t);
2106      return this;
2107    }
2108
2109    /**
2110     * @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. 
2111
2112The 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).)
2113     */
2114    public boolean hasMustSupport(String value) { 
2115      if (this.mustSupport == null)
2116        return false;
2117      for (StringType v : this.mustSupport)
2118        if (v.getValue().equals(value)) // string
2119          return true;
2120      return false;
2121    }
2122
2123    /**
2124     * @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.)
2125     */
2126    public List<DataRequirementCodeFilterComponent> getCodeFilter() { 
2127      if (this.codeFilter == null)
2128        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
2129      return this.codeFilter;
2130    }
2131
2132    /**
2133     * @return Returns a reference to <code>this</code> for easy method chaining
2134     */
2135    public DataRequirement setCodeFilter(List<DataRequirementCodeFilterComponent> theCodeFilter) { 
2136      this.codeFilter = theCodeFilter;
2137      return this;
2138    }
2139
2140    public boolean hasCodeFilter() { 
2141      if (this.codeFilter == null)
2142        return false;
2143      for (DataRequirementCodeFilterComponent item : this.codeFilter)
2144        if (!item.isEmpty())
2145          return true;
2146      return false;
2147    }
2148
2149    public DataRequirementCodeFilterComponent addCodeFilter() { //3
2150      DataRequirementCodeFilterComponent t = new DataRequirementCodeFilterComponent();
2151      if (this.codeFilter == null)
2152        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
2153      this.codeFilter.add(t);
2154      return t;
2155    }
2156
2157    public DataRequirement addCodeFilter(DataRequirementCodeFilterComponent t) { //3
2158      if (t == null)
2159        return this;
2160      if (this.codeFilter == null)
2161        this.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
2162      this.codeFilter.add(t);
2163      return this;
2164    }
2165
2166    /**
2167     * @return The first repetition of repeating field {@link #codeFilter}, creating it if it does not already exist {3}
2168     */
2169    public DataRequirementCodeFilterComponent getCodeFilterFirstRep() { 
2170      if (getCodeFilter().isEmpty()) {
2171        addCodeFilter();
2172      }
2173      return getCodeFilter().get(0);
2174    }
2175
2176    /**
2177     * @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.)
2178     */
2179    public List<DataRequirementDateFilterComponent> getDateFilter() { 
2180      if (this.dateFilter == null)
2181        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
2182      return this.dateFilter;
2183    }
2184
2185    /**
2186     * @return Returns a reference to <code>this</code> for easy method chaining
2187     */
2188    public DataRequirement setDateFilter(List<DataRequirementDateFilterComponent> theDateFilter) { 
2189      this.dateFilter = theDateFilter;
2190      return this;
2191    }
2192
2193    public boolean hasDateFilter() { 
2194      if (this.dateFilter == null)
2195        return false;
2196      for (DataRequirementDateFilterComponent item : this.dateFilter)
2197        if (!item.isEmpty())
2198          return true;
2199      return false;
2200    }
2201
2202    public DataRequirementDateFilterComponent addDateFilter() { //3
2203      DataRequirementDateFilterComponent t = new DataRequirementDateFilterComponent();
2204      if (this.dateFilter == null)
2205        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
2206      this.dateFilter.add(t);
2207      return t;
2208    }
2209
2210    public DataRequirement addDateFilter(DataRequirementDateFilterComponent t) { //3
2211      if (t == null)
2212        return this;
2213      if (this.dateFilter == null)
2214        this.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
2215      this.dateFilter.add(t);
2216      return this;
2217    }
2218
2219    /**
2220     * @return The first repetition of repeating field {@link #dateFilter}, creating it if it does not already exist {3}
2221     */
2222    public DataRequirementDateFilterComponent getDateFilterFirstRep() { 
2223      if (getDateFilter().isEmpty()) {
2224        addDateFilter();
2225      }
2226      return getDateFilter().get(0);
2227    }
2228
2229    /**
2230     * @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).)
2231     */
2232    public List<DataRequirementValueFilterComponent> getValueFilter() { 
2233      if (this.valueFilter == null)
2234        this.valueFilter = new ArrayList<DataRequirementValueFilterComponent>();
2235      return this.valueFilter;
2236    }
2237
2238    /**
2239     * @return Returns a reference to <code>this</code> for easy method chaining
2240     */
2241    public DataRequirement setValueFilter(List<DataRequirementValueFilterComponent> theValueFilter) { 
2242      this.valueFilter = theValueFilter;
2243      return this;
2244    }
2245
2246    public boolean hasValueFilter() { 
2247      if (this.valueFilter == null)
2248        return false;
2249      for (DataRequirementValueFilterComponent item : this.valueFilter)
2250        if (!item.isEmpty())
2251          return true;
2252      return false;
2253    }
2254
2255    public DataRequirementValueFilterComponent addValueFilter() { //3
2256      DataRequirementValueFilterComponent t = new DataRequirementValueFilterComponent();
2257      if (this.valueFilter == null)
2258        this.valueFilter = new ArrayList<DataRequirementValueFilterComponent>();
2259      this.valueFilter.add(t);
2260      return t;
2261    }
2262
2263    public DataRequirement addValueFilter(DataRequirementValueFilterComponent t) { //3
2264      if (t == null)
2265        return this;
2266      if (this.valueFilter == null)
2267        this.valueFilter = new ArrayList<DataRequirementValueFilterComponent>();
2268      this.valueFilter.add(t);
2269      return this;
2270    }
2271
2272    /**
2273     * @return The first repetition of repeating field {@link #valueFilter}, creating it if it does not already exist {3}
2274     */
2275    public DataRequirementValueFilterComponent getValueFilterFirstRep() { 
2276      if (getValueFilter().isEmpty()) {
2277        addValueFilter();
2278      }
2279      return getValueFilter().get(0);
2280    }
2281
2282    /**
2283     * @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
2284     */
2285    public PositiveIntType getLimitElement() { 
2286      if (this.limit == null)
2287        if (Configuration.errorOnAutoCreate())
2288          throw new Error("Attempt to auto-create DataRequirement.limit");
2289        else if (Configuration.doAutoCreate())
2290          this.limit = new PositiveIntType(); // bb
2291      return this.limit;
2292    }
2293
2294    public boolean hasLimitElement() { 
2295      return this.limit != null && !this.limit.isEmpty();
2296    }
2297
2298    public boolean hasLimit() { 
2299      return this.limit != null && !this.limit.isEmpty();
2300    }
2301
2302    /**
2303     * @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
2304     */
2305    public DataRequirement setLimitElement(PositiveIntType value) { 
2306      this.limit = value;
2307      return this;
2308    }
2309
2310    /**
2311     * @return Specifies a maximum number of results that are required (uses the _count search parameter).
2312     */
2313    public int getLimit() { 
2314      return this.limit == null || this.limit.isEmpty() ? 0 : this.limit.getValue();
2315    }
2316
2317    /**
2318     * @param value Specifies a maximum number of results that are required (uses the _count search parameter).
2319     */
2320    public DataRequirement setLimit(int value) { 
2321        if (this.limit == null)
2322          this.limit = new PositiveIntType();
2323        this.limit.setValue(value);
2324      return this;
2325    }
2326
2327    /**
2328     * @return {@link #sort} (Specifies the order of the results to be returned.)
2329     */
2330    public List<DataRequirementSortComponent> getSort() { 
2331      if (this.sort == null)
2332        this.sort = new ArrayList<DataRequirementSortComponent>();
2333      return this.sort;
2334    }
2335
2336    /**
2337     * @return Returns a reference to <code>this</code> for easy method chaining
2338     */
2339    public DataRequirement setSort(List<DataRequirementSortComponent> theSort) { 
2340      this.sort = theSort;
2341      return this;
2342    }
2343
2344    public boolean hasSort() { 
2345      if (this.sort == null)
2346        return false;
2347      for (DataRequirementSortComponent item : this.sort)
2348        if (!item.isEmpty())
2349          return true;
2350      return false;
2351    }
2352
2353    public DataRequirementSortComponent addSort() { //3
2354      DataRequirementSortComponent t = new DataRequirementSortComponent();
2355      if (this.sort == null)
2356        this.sort = new ArrayList<DataRequirementSortComponent>();
2357      this.sort.add(t);
2358      return t;
2359    }
2360
2361    public DataRequirement addSort(DataRequirementSortComponent t) { //3
2362      if (t == null)
2363        return this;
2364      if (this.sort == null)
2365        this.sort = new ArrayList<DataRequirementSortComponent>();
2366      this.sort.add(t);
2367      return this;
2368    }
2369
2370    /**
2371     * @return The first repetition of repeating field {@link #sort}, creating it if it does not already exist {3}
2372     */
2373    public DataRequirementSortComponent getSortFirstRep() { 
2374      if (getSort().isEmpty()) {
2375        addSort();
2376      }
2377      return getSort().get(0);
2378    }
2379
2380      protected void listChildren(List<Property> children) {
2381        super.listChildren(children);
2382        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));
2383        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));
2384        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));
2385        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));
2386        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));
2387        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));
2388        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));
2389        children.add(new Property("limit", "positiveInt", "Specifies a maximum number of results that are required (uses the _count search parameter).", 0, 1, limit));
2390        children.add(new Property("sort", "", "Specifies the order of the results to be returned.", 0, java.lang.Integer.MAX_VALUE, sort));
2391      }
2392
2393      @Override
2394      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2395        switch (_hash) {
2396        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);
2397        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);
2398        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);
2399        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);
2400        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);
2401        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);
2402        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);
2403        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);
2404        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);
2405        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);
2406        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);
2407        case 3536286: /*sort*/  return new Property("sort", "", "Specifies the order of the results to be returned.", 0, java.lang.Integer.MAX_VALUE, sort);
2408        default: return super.getNamedProperty(_hash, _name, _checkValid);
2409        }
2410
2411      }
2412
2413      @Override
2414      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2415        switch (hash) {
2416        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<FHIRTypes>
2417        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // CanonicalType
2418        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // DataType
2419        case -1402857082: /*mustSupport*/ return this.mustSupport == null ? new Base[0] : this.mustSupport.toArray(new Base[this.mustSupport.size()]); // StringType
2420        case -1303674939: /*codeFilter*/ return this.codeFilter == null ? new Base[0] : this.codeFilter.toArray(new Base[this.codeFilter.size()]); // DataRequirementCodeFilterComponent
2421        case 149531846: /*dateFilter*/ return this.dateFilter == null ? new Base[0] : this.dateFilter.toArray(new Base[this.dateFilter.size()]); // DataRequirementDateFilterComponent
2422        case -1807110071: /*valueFilter*/ return this.valueFilter == null ? new Base[0] : this.valueFilter.toArray(new Base[this.valueFilter.size()]); // DataRequirementValueFilterComponent
2423        case 102976443: /*limit*/ return this.limit == null ? new Base[0] : new Base[] {this.limit}; // PositiveIntType
2424        case 3536286: /*sort*/ return this.sort == null ? new Base[0] : this.sort.toArray(new Base[this.sort.size()]); // DataRequirementSortComponent
2425        default: return super.getProperty(hash, name, checkValid);
2426        }
2427
2428      }
2429
2430      @Override
2431      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2432        switch (hash) {
2433        case 3575610: // type
2434          value = new FHIRTypesEnumFactory().fromType(TypeConvertor.castToCode(value));
2435          this.type = (Enumeration) value; // Enumeration<FHIRTypes>
2436          return value;
2437        case -309425751: // profile
2438          this.getProfile().add(TypeConvertor.castToCanonical(value)); // CanonicalType
2439          return value;
2440        case -1867885268: // subject
2441          this.subject = TypeConvertor.castToType(value); // DataType
2442          return value;
2443        case -1402857082: // mustSupport
2444          this.getMustSupport().add(TypeConvertor.castToString(value)); // StringType
2445          return value;
2446        case -1303674939: // codeFilter
2447          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value); // DataRequirementCodeFilterComponent
2448          return value;
2449        case 149531846: // dateFilter
2450          this.getDateFilter().add((DataRequirementDateFilterComponent) value); // DataRequirementDateFilterComponent
2451          return value;
2452        case -1807110071: // valueFilter
2453          this.getValueFilter().add((DataRequirementValueFilterComponent) value); // DataRequirementValueFilterComponent
2454          return value;
2455        case 102976443: // limit
2456          this.limit = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2457          return value;
2458        case 3536286: // sort
2459          this.getSort().add((DataRequirementSortComponent) value); // DataRequirementSortComponent
2460          return value;
2461        default: return super.setProperty(hash, name, value);
2462        }
2463
2464      }
2465
2466      @Override
2467      public Base setProperty(String name, Base value) throws FHIRException {
2468        if (name.equals("type")) {
2469          value = new FHIRTypesEnumFactory().fromType(TypeConvertor.castToCode(value));
2470          this.type = (Enumeration) value; // Enumeration<FHIRTypes>
2471        } else if (name.equals("profile")) {
2472          this.getProfile().add(TypeConvertor.castToCanonical(value));
2473        } else if (name.equals("subject[x]")) {
2474          this.subject = TypeConvertor.castToType(value); // DataType
2475        } else if (name.equals("mustSupport")) {
2476          this.getMustSupport().add(TypeConvertor.castToString(value));
2477        } else if (name.equals("codeFilter")) {
2478          this.getCodeFilter().add((DataRequirementCodeFilterComponent) value);
2479        } else if (name.equals("dateFilter")) {
2480          this.getDateFilter().add((DataRequirementDateFilterComponent) value);
2481        } else if (name.equals("valueFilter")) {
2482          this.getValueFilter().add((DataRequirementValueFilterComponent) value);
2483        } else if (name.equals("limit")) {
2484          this.limit = TypeConvertor.castToPositiveInt(value); // PositiveIntType
2485        } else if (name.equals("sort")) {
2486          this.getSort().add((DataRequirementSortComponent) value);
2487        } else
2488          return super.setProperty(name, value);
2489        return value;
2490      }
2491
2492  @Override
2493  public void removeChild(String name, Base value) throws FHIRException {
2494        if (name.equals("type")) {
2495          value = new FHIRTypesEnumFactory().fromType(TypeConvertor.castToCode(value));
2496          this.type = (Enumeration) value; // Enumeration<FHIRTypes>
2497        } else if (name.equals("profile")) {
2498          this.getProfile().remove(value);
2499        } else if (name.equals("subject[x]")) {
2500          this.subject = null;
2501        } else if (name.equals("mustSupport")) {
2502          this.getMustSupport().remove(value);
2503        } else if (name.equals("codeFilter")) {
2504          this.getCodeFilter().remove((DataRequirementCodeFilterComponent) value);
2505        } else if (name.equals("dateFilter")) {
2506          this.getDateFilter().remove((DataRequirementDateFilterComponent) value);
2507        } else if (name.equals("valueFilter")) {
2508          this.getValueFilter().remove((DataRequirementValueFilterComponent) value);
2509        } else if (name.equals("limit")) {
2510          this.limit = null;
2511        } else if (name.equals("sort")) {
2512          this.getSort().remove((DataRequirementSortComponent) value);
2513        } else
2514          super.removeChild(name, value);
2515        
2516      }
2517
2518      @Override
2519      public Base makeProperty(int hash, String name) throws FHIRException {
2520        switch (hash) {
2521        case 3575610:  return getTypeElement();
2522        case -309425751:  return addProfileElement();
2523        case -573640748:  return getSubject();
2524        case -1867885268:  return getSubject();
2525        case -1402857082:  return addMustSupportElement();
2526        case -1303674939:  return addCodeFilter(); 
2527        case 149531846:  return addDateFilter(); 
2528        case -1807110071:  return addValueFilter(); 
2529        case 102976443:  return getLimitElement();
2530        case 3536286:  return addSort(); 
2531        default: return super.makeProperty(hash, name);
2532        }
2533
2534      }
2535
2536      @Override
2537      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2538        switch (hash) {
2539        case 3575610: /*type*/ return new String[] {"code"};
2540        case -309425751: /*profile*/ return new String[] {"canonical"};
2541        case -1867885268: /*subject*/ return new String[] {"CodeableConcept", "Reference"};
2542        case -1402857082: /*mustSupport*/ return new String[] {"string"};
2543        case -1303674939: /*codeFilter*/ return new String[] {};
2544        case 149531846: /*dateFilter*/ return new String[] {};
2545        case -1807110071: /*valueFilter*/ return new String[] {};
2546        case 102976443: /*limit*/ return new String[] {"positiveInt"};
2547        case 3536286: /*sort*/ return new String[] {};
2548        default: return super.getTypesForProperty(hash, name);
2549        }
2550
2551      }
2552
2553      @Override
2554      public Base addChild(String name) throws FHIRException {
2555        if (name.equals("type")) {
2556          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.type");
2557        }
2558        else if (name.equals("profile")) {
2559          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.profile");
2560        }
2561        else if (name.equals("subjectCodeableConcept")) {
2562          this.subject = new CodeableConcept();
2563          return this.subject;
2564        }
2565        else if (name.equals("subjectReference")) {
2566          this.subject = new Reference();
2567          return this.subject;
2568        }
2569        else if (name.equals("mustSupport")) {
2570          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.mustSupport");
2571        }
2572        else if (name.equals("codeFilter")) {
2573          return addCodeFilter();
2574        }
2575        else if (name.equals("dateFilter")) {
2576          return addDateFilter();
2577        }
2578        else if (name.equals("valueFilter")) {
2579          return addValueFilter();
2580        }
2581        else if (name.equals("limit")) {
2582          throw new FHIRException("Cannot call addChild on a singleton property DataRequirement.limit");
2583        }
2584        else if (name.equals("sort")) {
2585          return addSort();
2586        }
2587        else
2588          return super.addChild(name);
2589      }
2590
2591  public String fhirType() {
2592    return "DataRequirement";
2593
2594  }
2595
2596      public DataRequirement copy() {
2597        DataRequirement dst = new DataRequirement();
2598        copyValues(dst);
2599        return dst;
2600      }
2601
2602      public void copyValues(DataRequirement dst) {
2603        super.copyValues(dst);
2604        dst.type = type == null ? null : type.copy();
2605        if (profile != null) {
2606          dst.profile = new ArrayList<CanonicalType>();
2607          for (CanonicalType i : profile)
2608            dst.profile.add(i.copy());
2609        };
2610        dst.subject = subject == null ? null : subject.copy();
2611        if (mustSupport != null) {
2612          dst.mustSupport = new ArrayList<StringType>();
2613          for (StringType i : mustSupport)
2614            dst.mustSupport.add(i.copy());
2615        };
2616        if (codeFilter != null) {
2617          dst.codeFilter = new ArrayList<DataRequirementCodeFilterComponent>();
2618          for (DataRequirementCodeFilterComponent i : codeFilter)
2619            dst.codeFilter.add(i.copy());
2620        };
2621        if (dateFilter != null) {
2622          dst.dateFilter = new ArrayList<DataRequirementDateFilterComponent>();
2623          for (DataRequirementDateFilterComponent i : dateFilter)
2624            dst.dateFilter.add(i.copy());
2625        };
2626        if (valueFilter != null) {
2627          dst.valueFilter = new ArrayList<DataRequirementValueFilterComponent>();
2628          for (DataRequirementValueFilterComponent i : valueFilter)
2629            dst.valueFilter.add(i.copy());
2630        };
2631        dst.limit = limit == null ? null : limit.copy();
2632        if (sort != null) {
2633          dst.sort = new ArrayList<DataRequirementSortComponent>();
2634          for (DataRequirementSortComponent i : sort)
2635            dst.sort.add(i.copy());
2636        };
2637      }
2638
2639      protected DataRequirement typedCopy() {
2640        return copy();
2641      }
2642
2643      @Override
2644      public boolean equalsDeep(Base other_) {
2645        if (!super.equalsDeep(other_))
2646          return false;
2647        if (!(other_ instanceof DataRequirement))
2648          return false;
2649        DataRequirement o = (DataRequirement) other_;
2650        return compareDeep(type, o.type, true) && compareDeep(profile, o.profile, true) && compareDeep(subject, o.subject, true)
2651           && compareDeep(mustSupport, o.mustSupport, true) && compareDeep(codeFilter, o.codeFilter, true)
2652           && compareDeep(dateFilter, o.dateFilter, true) && compareDeep(valueFilter, o.valueFilter, true)
2653           && compareDeep(limit, o.limit, true) && compareDeep(sort, o.sort, true);
2654      }
2655
2656      @Override
2657      public boolean equalsShallow(Base other_) {
2658        if (!super.equalsShallow(other_))
2659          return false;
2660        if (!(other_ instanceof DataRequirement))
2661          return false;
2662        DataRequirement o = (DataRequirement) other_;
2663        return compareValues(type, o.type, true) && compareValues(profile, o.profile, true) && compareValues(mustSupport, o.mustSupport, true)
2664           && compareValues(limit, o.limit, true);
2665      }
2666
2667      public boolean isEmpty() {
2668        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, profile, subject, mustSupport
2669          , codeFilter, dateFilter, valueFilter, limit, sort);
2670      }
2671
2672
2673}
2674