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