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