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.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045
046/**
047 * The MeasureReport resource contains the results of the calculation of a
048 * measure; and optionally a reference to the resources involved in that
049 * calculation.
050 */
051@ResourceDef(name = "MeasureReport", profile = "http://hl7.org/fhir/StructureDefinition/MeasureReport")
052public class MeasureReport extends DomainResource {
053
054  public enum MeasureReportStatus {
055    /**
056     * The report is complete and ready for use.
057     */
058    COMPLETE,
059    /**
060     * The report is currently being generated.
061     */
062    PENDING,
063    /**
064     * An error occurred attempting to generate the report.
065     */
066    ERROR,
067    /**
068     * added to help the parsers with the generic types
069     */
070    NULL;
071
072    public static MeasureReportStatus fromCode(String codeString) throws FHIRException {
073      if (codeString == null || "".equals(codeString))
074        return null;
075      if ("complete".equals(codeString))
076        return COMPLETE;
077      if ("pending".equals(codeString))
078        return PENDING;
079      if ("error".equals(codeString))
080        return ERROR;
081      if (Configuration.isAcceptInvalidEnums())
082        return null;
083      else
084        throw new FHIRException("Unknown MeasureReportStatus code '" + codeString + "'");
085    }
086
087    public String toCode() {
088      switch (this) {
089      case COMPLETE:
090        return "complete";
091      case PENDING:
092        return "pending";
093      case ERROR:
094        return "error";
095      case NULL:
096        return null;
097      default:
098        return "?";
099      }
100    }
101
102    public String getSystem() {
103      switch (this) {
104      case COMPLETE:
105        return "http://hl7.org/fhir/measure-report-status";
106      case PENDING:
107        return "http://hl7.org/fhir/measure-report-status";
108      case ERROR:
109        return "http://hl7.org/fhir/measure-report-status";
110      case NULL:
111        return null;
112      default:
113        return "?";
114      }
115    }
116
117    public String getDefinition() {
118      switch (this) {
119      case COMPLETE:
120        return "The report is complete and ready for use.";
121      case PENDING:
122        return "The report is currently being generated.";
123      case ERROR:
124        return "An error occurred attempting to generate the report.";
125      case NULL:
126        return null;
127      default:
128        return "?";
129      }
130    }
131
132    public String getDisplay() {
133      switch (this) {
134      case COMPLETE:
135        return "Complete";
136      case PENDING:
137        return "Pending";
138      case ERROR:
139        return "Error";
140      case NULL:
141        return null;
142      default:
143        return "?";
144      }
145    }
146  }
147
148  public static class MeasureReportStatusEnumFactory implements EnumFactory<MeasureReportStatus> {
149    public MeasureReportStatus fromCode(String codeString) throws IllegalArgumentException {
150      if (codeString == null || "".equals(codeString))
151        if (codeString == null || "".equals(codeString))
152          return null;
153      if ("complete".equals(codeString))
154        return MeasureReportStatus.COMPLETE;
155      if ("pending".equals(codeString))
156        return MeasureReportStatus.PENDING;
157      if ("error".equals(codeString))
158        return MeasureReportStatus.ERROR;
159      throw new IllegalArgumentException("Unknown MeasureReportStatus code '" + codeString + "'");
160    }
161
162    public Enumeration<MeasureReportStatus> fromType(PrimitiveType<?> code) throws FHIRException {
163      if (code == null)
164        return null;
165      if (code.isEmpty())
166        return new Enumeration<MeasureReportStatus>(this, MeasureReportStatus.NULL, code);
167      String codeString = code.asStringValue();
168      if (codeString == null || "".equals(codeString))
169        return new Enumeration<MeasureReportStatus>(this, MeasureReportStatus.NULL, code);
170      if ("complete".equals(codeString))
171        return new Enumeration<MeasureReportStatus>(this, MeasureReportStatus.COMPLETE, code);
172      if ("pending".equals(codeString))
173        return new Enumeration<MeasureReportStatus>(this, MeasureReportStatus.PENDING, code);
174      if ("error".equals(codeString))
175        return new Enumeration<MeasureReportStatus>(this, MeasureReportStatus.ERROR, code);
176      throw new FHIRException("Unknown MeasureReportStatus code '" + codeString + "'");
177    }
178
179    public String toCode(MeasureReportStatus code) {
180      if (code == MeasureReportStatus.COMPLETE)
181        return "complete";
182      if (code == MeasureReportStatus.PENDING)
183        return "pending";
184      if (code == MeasureReportStatus.ERROR)
185        return "error";
186      return "?";
187    }
188
189    public String toSystem(MeasureReportStatus code) {
190      return code.getSystem();
191    }
192  }
193
194  public enum MeasureReportType {
195    /**
196     * An individual report that provides information on the performance for a given
197     * measure with respect to a single subject.
198     */
199    INDIVIDUAL,
200    /**
201     * A subject list report that includes a listing of subjects that satisfied each
202     * population criteria in the measure.
203     */
204    SUBJECTLIST,
205    /**
206     * A summary report that returns the number of members in each population
207     * criteria for the measure.
208     */
209    SUMMARY,
210    /**
211     * A data collection report that contains data-of-interest for the measure.
212     */
213    DATACOLLECTION,
214    /**
215     * added to help the parsers with the generic types
216     */
217    NULL;
218
219    public static MeasureReportType fromCode(String codeString) throws FHIRException {
220      if (codeString == null || "".equals(codeString))
221        return null;
222      if ("individual".equals(codeString))
223        return INDIVIDUAL;
224      if ("subject-list".equals(codeString))
225        return SUBJECTLIST;
226      if ("summary".equals(codeString))
227        return SUMMARY;
228      if ("data-collection".equals(codeString))
229        return DATACOLLECTION;
230      if (Configuration.isAcceptInvalidEnums())
231        return null;
232      else
233        throw new FHIRException("Unknown MeasureReportType code '" + codeString + "'");
234    }
235
236    public String toCode() {
237      switch (this) {
238      case INDIVIDUAL:
239        return "individual";
240      case SUBJECTLIST:
241        return "subject-list";
242      case SUMMARY:
243        return "summary";
244      case DATACOLLECTION:
245        return "data-collection";
246      case NULL:
247        return null;
248      default:
249        return "?";
250      }
251    }
252
253    public String getSystem() {
254      switch (this) {
255      case INDIVIDUAL:
256        return "http://hl7.org/fhir/measure-report-type";
257      case SUBJECTLIST:
258        return "http://hl7.org/fhir/measure-report-type";
259      case SUMMARY:
260        return "http://hl7.org/fhir/measure-report-type";
261      case DATACOLLECTION:
262        return "http://hl7.org/fhir/measure-report-type";
263      case NULL:
264        return null;
265      default:
266        return "?";
267      }
268    }
269
270    public String getDefinition() {
271      switch (this) {
272      case INDIVIDUAL:
273        return "An individual report that provides information on the performance for a given measure with respect to a single subject.";
274      case SUBJECTLIST:
275        return "A subject list report that includes a listing of subjects that satisfied each population criteria in the measure.";
276      case SUMMARY:
277        return "A summary report that returns the number of members in each population criteria for the measure.";
278      case DATACOLLECTION:
279        return "A data collection report that contains data-of-interest for the measure.";
280      case NULL:
281        return null;
282      default:
283        return "?";
284      }
285    }
286
287    public String getDisplay() {
288      switch (this) {
289      case INDIVIDUAL:
290        return "Individual";
291      case SUBJECTLIST:
292        return "Subject List";
293      case SUMMARY:
294        return "Summary";
295      case DATACOLLECTION:
296        return "Data Collection";
297      case NULL:
298        return null;
299      default:
300        return "?";
301      }
302    }
303  }
304
305  public static class MeasureReportTypeEnumFactory implements EnumFactory<MeasureReportType> {
306    public MeasureReportType fromCode(String codeString) throws IllegalArgumentException {
307      if (codeString == null || "".equals(codeString))
308        if (codeString == null || "".equals(codeString))
309          return null;
310      if ("individual".equals(codeString))
311        return MeasureReportType.INDIVIDUAL;
312      if ("subject-list".equals(codeString))
313        return MeasureReportType.SUBJECTLIST;
314      if ("summary".equals(codeString))
315        return MeasureReportType.SUMMARY;
316      if ("data-collection".equals(codeString))
317        return MeasureReportType.DATACOLLECTION;
318      throw new IllegalArgumentException("Unknown MeasureReportType code '" + codeString + "'");
319    }
320
321    public Enumeration<MeasureReportType> fromType(PrimitiveType<?> code) throws FHIRException {
322      if (code == null)
323        return null;
324      if (code.isEmpty())
325        return new Enumeration<MeasureReportType>(this, MeasureReportType.NULL, code);
326      String codeString = code.asStringValue();
327      if (codeString == null || "".equals(codeString))
328        return new Enumeration<MeasureReportType>(this, MeasureReportType.NULL, code);
329      if ("individual".equals(codeString))
330        return new Enumeration<MeasureReportType>(this, MeasureReportType.INDIVIDUAL, code);
331      if ("subject-list".equals(codeString))
332        return new Enumeration<MeasureReportType>(this, MeasureReportType.SUBJECTLIST, code);
333      if ("summary".equals(codeString))
334        return new Enumeration<MeasureReportType>(this, MeasureReportType.SUMMARY, code);
335      if ("data-collection".equals(codeString))
336        return new Enumeration<MeasureReportType>(this, MeasureReportType.DATACOLLECTION, code);
337      throw new FHIRException("Unknown MeasureReportType code '" + codeString + "'");
338    }
339
340    public String toCode(MeasureReportType code) {
341      if (code == MeasureReportType.INDIVIDUAL)
342        return "individual";
343      if (code == MeasureReportType.SUBJECTLIST)
344        return "subject-list";
345      if (code == MeasureReportType.SUMMARY)
346        return "summary";
347      if (code == MeasureReportType.DATACOLLECTION)
348        return "data-collection";
349      return "?";
350    }
351
352    public String toSystem(MeasureReportType code) {
353      return code.getSystem();
354    }
355  }
356
357  @Block()
358  public static class MeasureReportGroupComponent extends BackboneElement implements IBaseBackboneElement {
359    /**
360     * The meaning of the population group as defined in the measure definition.
361     */
362    @Child(name = "code", type = {
363        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
364    @Description(shortDefinition = "Meaning of the group", formalDefinition = "The meaning of the population group as defined in the measure definition.")
365    protected CodeableConcept code;
366
367    /**
368     * The populations that make up the population group, one for each type of
369     * population appropriate for the measure.
370     */
371    @Child(name = "population", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
372    @Description(shortDefinition = "The populations in the group", formalDefinition = "The populations that make up the population group, one for each type of population appropriate for the measure.")
373    protected List<MeasureReportGroupPopulationComponent> population;
374
375    /**
376     * The measure score for this population group, calculated as appropriate for
377     * the measure type and scoring method, and based on the contents of the
378     * populations defined in the group.
379     */
380    @Child(name = "measureScore", type = {
381        Quantity.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
382    @Description(shortDefinition = "What score this group achieved", formalDefinition = "The measure score for this population group, calculated as appropriate for the measure type and scoring method, and based on the contents of the populations defined in the group.")
383    protected Quantity measureScore;
384
385    /**
386     * When a measure includes multiple stratifiers, there will be a stratifier
387     * group for each stratifier defined by the measure.
388     */
389    @Child(name = "stratifier", type = {}, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
390    @Description(shortDefinition = "Stratification results", formalDefinition = "When a measure includes multiple stratifiers, there will be a stratifier group for each stratifier defined by the measure.")
391    protected List<MeasureReportGroupStratifierComponent> stratifier;
392
393    private static final long serialVersionUID = 1744426009L;
394
395    /**
396     * Constructor
397     */
398    public MeasureReportGroupComponent() {
399      super();
400    }
401
402    /**
403     * @return {@link #code} (The meaning of the population group as defined in the
404     *         measure definition.)
405     */
406    public CodeableConcept getCode() {
407      if (this.code == null)
408        if (Configuration.errorOnAutoCreate())
409          throw new Error("Attempt to auto-create MeasureReportGroupComponent.code");
410        else if (Configuration.doAutoCreate())
411          this.code = new CodeableConcept(); // cc
412      return this.code;
413    }
414
415    public boolean hasCode() {
416      return this.code != null && !this.code.isEmpty();
417    }
418
419    /**
420     * @param value {@link #code} (The meaning of the population group as defined in
421     *              the measure definition.)
422     */
423    public MeasureReportGroupComponent setCode(CodeableConcept value) {
424      this.code = value;
425      return this;
426    }
427
428    /**
429     * @return {@link #population} (The populations that make up the population
430     *         group, one for each type of population appropriate for the measure.)
431     */
432    public List<MeasureReportGroupPopulationComponent> getPopulation() {
433      if (this.population == null)
434        this.population = new ArrayList<MeasureReportGroupPopulationComponent>();
435      return this.population;
436    }
437
438    /**
439     * @return Returns a reference to <code>this</code> for easy method chaining
440     */
441    public MeasureReportGroupComponent setPopulation(List<MeasureReportGroupPopulationComponent> thePopulation) {
442      this.population = thePopulation;
443      return this;
444    }
445
446    public boolean hasPopulation() {
447      if (this.population == null)
448        return false;
449      for (MeasureReportGroupPopulationComponent item : this.population)
450        if (!item.isEmpty())
451          return true;
452      return false;
453    }
454
455    public MeasureReportGroupPopulationComponent addPopulation() { // 3
456      MeasureReportGroupPopulationComponent t = new MeasureReportGroupPopulationComponent();
457      if (this.population == null)
458        this.population = new ArrayList<MeasureReportGroupPopulationComponent>();
459      this.population.add(t);
460      return t;
461    }
462
463    public MeasureReportGroupComponent addPopulation(MeasureReportGroupPopulationComponent t) { // 3
464      if (t == null)
465        return this;
466      if (this.population == null)
467        this.population = new ArrayList<MeasureReportGroupPopulationComponent>();
468      this.population.add(t);
469      return this;
470    }
471
472    /**
473     * @return The first repetition of repeating field {@link #population}, creating
474     *         it if it does not already exist
475     */
476    public MeasureReportGroupPopulationComponent getPopulationFirstRep() {
477      if (getPopulation().isEmpty()) {
478        addPopulation();
479      }
480      return getPopulation().get(0);
481    }
482
483    /**
484     * @return {@link #measureScore} (The measure score for this population group,
485     *         calculated as appropriate for the measure type and scoring method,
486     *         and based on the contents of the populations defined in the group.)
487     */
488    public Quantity getMeasureScore() {
489      if (this.measureScore == null)
490        if (Configuration.errorOnAutoCreate())
491          throw new Error("Attempt to auto-create MeasureReportGroupComponent.measureScore");
492        else if (Configuration.doAutoCreate())
493          this.measureScore = new Quantity(); // cc
494      return this.measureScore;
495    }
496
497    public boolean hasMeasureScore() {
498      return this.measureScore != null && !this.measureScore.isEmpty();
499    }
500
501    /**
502     * @param value {@link #measureScore} (The measure score for this population
503     *              group, calculated as appropriate for the measure type and
504     *              scoring method, and based on the contents of the populations
505     *              defined in the group.)
506     */
507    public MeasureReportGroupComponent setMeasureScore(Quantity value) {
508      this.measureScore = value;
509      return this;
510    }
511
512    /**
513     * @return {@link #stratifier} (When a measure includes multiple stratifiers,
514     *         there will be a stratifier group for each stratifier defined by the
515     *         measure.)
516     */
517    public List<MeasureReportGroupStratifierComponent> getStratifier() {
518      if (this.stratifier == null)
519        this.stratifier = new ArrayList<MeasureReportGroupStratifierComponent>();
520      return this.stratifier;
521    }
522
523    /**
524     * @return Returns a reference to <code>this</code> for easy method chaining
525     */
526    public MeasureReportGroupComponent setStratifier(List<MeasureReportGroupStratifierComponent> theStratifier) {
527      this.stratifier = theStratifier;
528      return this;
529    }
530
531    public boolean hasStratifier() {
532      if (this.stratifier == null)
533        return false;
534      for (MeasureReportGroupStratifierComponent item : this.stratifier)
535        if (!item.isEmpty())
536          return true;
537      return false;
538    }
539
540    public MeasureReportGroupStratifierComponent addStratifier() { // 3
541      MeasureReportGroupStratifierComponent t = new MeasureReportGroupStratifierComponent();
542      if (this.stratifier == null)
543        this.stratifier = new ArrayList<MeasureReportGroupStratifierComponent>();
544      this.stratifier.add(t);
545      return t;
546    }
547
548    public MeasureReportGroupComponent addStratifier(MeasureReportGroupStratifierComponent t) { // 3
549      if (t == null)
550        return this;
551      if (this.stratifier == null)
552        this.stratifier = new ArrayList<MeasureReportGroupStratifierComponent>();
553      this.stratifier.add(t);
554      return this;
555    }
556
557    /**
558     * @return The first repetition of repeating field {@link #stratifier}, creating
559     *         it if it does not already exist
560     */
561    public MeasureReportGroupStratifierComponent getStratifierFirstRep() {
562      if (getStratifier().isEmpty()) {
563        addStratifier();
564      }
565      return getStratifier().get(0);
566    }
567
568    protected void listChildren(List<Property> children) {
569      super.listChildren(children);
570      children.add(new Property("code", "CodeableConcept",
571          "The meaning of the population group as defined in the measure definition.", 0, 1, code));
572      children.add(new Property("population", "",
573          "The populations that make up the population group, one for each type of population appropriate for the measure.",
574          0, java.lang.Integer.MAX_VALUE, population));
575      children.add(new Property("measureScore", "Quantity",
576          "The measure score for this population group, calculated as appropriate for the measure type and scoring method, and based on the contents of the populations defined in the group.",
577          0, 1, measureScore));
578      children.add(new Property("stratifier", "",
579          "When a measure includes multiple stratifiers, there will be a stratifier group for each stratifier defined by the measure.",
580          0, java.lang.Integer.MAX_VALUE, stratifier));
581    }
582
583    @Override
584    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
585      switch (_hash) {
586      case 3059181:
587        /* code */ return new Property("code", "CodeableConcept",
588            "The meaning of the population group as defined in the measure definition.", 0, 1, code);
589      case -2023558323:
590        /* population */ return new Property("population", "",
591            "The populations that make up the population group, one for each type of population appropriate for the measure.",
592            0, java.lang.Integer.MAX_VALUE, population);
593      case -386313260:
594        /* measureScore */ return new Property("measureScore", "Quantity",
595            "The measure score for this population group, calculated as appropriate for the measure type and scoring method, and based on the contents of the populations defined in the group.",
596            0, 1, measureScore);
597      case 90983669:
598        /* stratifier */ return new Property("stratifier", "",
599            "When a measure includes multiple stratifiers, there will be a stratifier group for each stratifier defined by the measure.",
600            0, java.lang.Integer.MAX_VALUE, stratifier);
601      default:
602        return super.getNamedProperty(_hash, _name, _checkValid);
603      }
604
605    }
606
607    @Override
608    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
609      switch (hash) {
610      case 3059181:
611        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
612      case -2023558323:
613        /* population */ return this.population == null ? new Base[0]
614            : this.population.toArray(new Base[this.population.size()]); // MeasureReportGroupPopulationComponent
615      case -386313260:
616        /* measureScore */ return this.measureScore == null ? new Base[0] : new Base[] { this.measureScore }; // Quantity
617      case 90983669:
618        /* stratifier */ return this.stratifier == null ? new Base[0]
619            : this.stratifier.toArray(new Base[this.stratifier.size()]); // MeasureReportGroupStratifierComponent
620      default:
621        return super.getProperty(hash, name, checkValid);
622      }
623
624    }
625
626    @Override
627    public Base setProperty(int hash, String name, Base value) throws FHIRException {
628      switch (hash) {
629      case 3059181: // code
630        this.code = castToCodeableConcept(value); // CodeableConcept
631        return value;
632      case -2023558323: // population
633        this.getPopulation().add((MeasureReportGroupPopulationComponent) value); // MeasureReportGroupPopulationComponent
634        return value;
635      case -386313260: // measureScore
636        this.measureScore = castToQuantity(value); // Quantity
637        return value;
638      case 90983669: // stratifier
639        this.getStratifier().add((MeasureReportGroupStratifierComponent) value); // MeasureReportGroupStratifierComponent
640        return value;
641      default:
642        return super.setProperty(hash, name, value);
643      }
644
645    }
646
647    @Override
648    public Base setProperty(String name, Base value) throws FHIRException {
649      if (name.equals("code")) {
650        this.code = castToCodeableConcept(value); // CodeableConcept
651      } else if (name.equals("population")) {
652        this.getPopulation().add((MeasureReportGroupPopulationComponent) value);
653      } else if (name.equals("measureScore")) {
654        this.measureScore = castToQuantity(value); // Quantity
655      } else if (name.equals("stratifier")) {
656        this.getStratifier().add((MeasureReportGroupStratifierComponent) value);
657      } else
658        return super.setProperty(name, value);
659      return value;
660    }
661
662    @Override
663    public Base makeProperty(int hash, String name) throws FHIRException {
664      switch (hash) {
665      case 3059181:
666        return getCode();
667      case -2023558323:
668        return addPopulation();
669      case -386313260:
670        return getMeasureScore();
671      case 90983669:
672        return addStratifier();
673      default:
674        return super.makeProperty(hash, name);
675      }
676
677    }
678
679    @Override
680    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
681      switch (hash) {
682      case 3059181:
683        /* code */ return new String[] { "CodeableConcept" };
684      case -2023558323:
685        /* population */ return new String[] {};
686      case -386313260:
687        /* measureScore */ return new String[] { "Quantity" };
688      case 90983669:
689        /* stratifier */ return new String[] {};
690      default:
691        return super.getTypesForProperty(hash, name);
692      }
693
694    }
695
696    @Override
697    public Base addChild(String name) throws FHIRException {
698      if (name.equals("code")) {
699        this.code = new CodeableConcept();
700        return this.code;
701      } else if (name.equals("population")) {
702        return addPopulation();
703      } else if (name.equals("measureScore")) {
704        this.measureScore = new Quantity();
705        return this.measureScore;
706      } else if (name.equals("stratifier")) {
707        return addStratifier();
708      } else
709        return super.addChild(name);
710    }
711
712    public MeasureReportGroupComponent copy() {
713      MeasureReportGroupComponent dst = new MeasureReportGroupComponent();
714      copyValues(dst);
715      return dst;
716    }
717
718    public void copyValues(MeasureReportGroupComponent dst) {
719      super.copyValues(dst);
720      dst.code = code == null ? null : code.copy();
721      if (population != null) {
722        dst.population = new ArrayList<MeasureReportGroupPopulationComponent>();
723        for (MeasureReportGroupPopulationComponent i : population)
724          dst.population.add(i.copy());
725      }
726      ;
727      dst.measureScore = measureScore == null ? null : measureScore.copy();
728      if (stratifier != null) {
729        dst.stratifier = new ArrayList<MeasureReportGroupStratifierComponent>();
730        for (MeasureReportGroupStratifierComponent i : stratifier)
731          dst.stratifier.add(i.copy());
732      }
733      ;
734    }
735
736    @Override
737    public boolean equalsDeep(Base other_) {
738      if (!super.equalsDeep(other_))
739        return false;
740      if (!(other_ instanceof MeasureReportGroupComponent))
741        return false;
742      MeasureReportGroupComponent o = (MeasureReportGroupComponent) other_;
743      return compareDeep(code, o.code, true) && compareDeep(population, o.population, true)
744          && compareDeep(measureScore, o.measureScore, true) && compareDeep(stratifier, o.stratifier, true);
745    }
746
747    @Override
748    public boolean equalsShallow(Base other_) {
749      if (!super.equalsShallow(other_))
750        return false;
751      if (!(other_ instanceof MeasureReportGroupComponent))
752        return false;
753      MeasureReportGroupComponent o = (MeasureReportGroupComponent) other_;
754      return true;
755    }
756
757    public boolean isEmpty() {
758      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, population, measureScore, stratifier);
759    }
760
761    public String fhirType() {
762      return "MeasureReport.group";
763
764    }
765
766  }
767
768  @Block()
769  public static class MeasureReportGroupPopulationComponent extends BackboneElement implements IBaseBackboneElement {
770    /**
771     * The type of the population.
772     */
773    @Child(name = "code", type = {
774        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
775    @Description(shortDefinition = "initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-observation", formalDefinition = "The type of the population.")
776    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/measure-population")
777    protected CodeableConcept code;
778
779    /**
780     * The number of members of the population.
781     */
782    @Child(name = "count", type = { IntegerType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
783    @Description(shortDefinition = "Size of the population", formalDefinition = "The number of members of the population.")
784    protected IntegerType count;
785
786    /**
787     * This element refers to a List of subject level MeasureReport resources, one
788     * for each subject in this population.
789     */
790    @Child(name = "subjectResults", type = {
791        ListResource.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
792    @Description(shortDefinition = "For subject-list reports, the subject results in this population", formalDefinition = "This element refers to a List of subject level MeasureReport resources, one for each subject in this population.")
793    protected Reference subjectResults;
794
795    /**
796     * The actual object that is the target of the reference (This element refers to
797     * a List of subject level MeasureReport resources, one for each subject in this
798     * population.)
799     */
800    protected ListResource subjectResultsTarget;
801
802    private static final long serialVersionUID = 210461445L;
803
804    /**
805     * Constructor
806     */
807    public MeasureReportGroupPopulationComponent() {
808      super();
809    }
810
811    /**
812     * @return {@link #code} (The type of the population.)
813     */
814    public CodeableConcept getCode() {
815      if (this.code == null)
816        if (Configuration.errorOnAutoCreate())
817          throw new Error("Attempt to auto-create MeasureReportGroupPopulationComponent.code");
818        else if (Configuration.doAutoCreate())
819          this.code = new CodeableConcept(); // cc
820      return this.code;
821    }
822
823    public boolean hasCode() {
824      return this.code != null && !this.code.isEmpty();
825    }
826
827    /**
828     * @param value {@link #code} (The type of the population.)
829     */
830    public MeasureReportGroupPopulationComponent setCode(CodeableConcept value) {
831      this.code = value;
832      return this;
833    }
834
835    /**
836     * @return {@link #count} (The number of members of the population.). This is
837     *         the underlying object with id, value and extensions. The accessor
838     *         "getCount" gives direct access to the value
839     */
840    public IntegerType getCountElement() {
841      if (this.count == null)
842        if (Configuration.errorOnAutoCreate())
843          throw new Error("Attempt to auto-create MeasureReportGroupPopulationComponent.count");
844        else if (Configuration.doAutoCreate())
845          this.count = new IntegerType(); // bb
846      return this.count;
847    }
848
849    public boolean hasCountElement() {
850      return this.count != null && !this.count.isEmpty();
851    }
852
853    public boolean hasCount() {
854      return this.count != null && !this.count.isEmpty();
855    }
856
857    /**
858     * @param value {@link #count} (The number of members of the population.). This
859     *              is the underlying object with id, value and extensions. The
860     *              accessor "getCount" gives direct access to the value
861     */
862    public MeasureReportGroupPopulationComponent setCountElement(IntegerType value) {
863      this.count = value;
864      return this;
865    }
866
867    /**
868     * @return The number of members of the population.
869     */
870    public int getCount() {
871      return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue();
872    }
873
874    /**
875     * @param value The number of members of the population.
876     */
877    public MeasureReportGroupPopulationComponent setCount(int value) {
878      if (this.count == null)
879        this.count = new IntegerType();
880      this.count.setValue(value);
881      return this;
882    }
883
884    /**
885     * @return {@link #subjectResults} (This element refers to a List of subject
886     *         level MeasureReport resources, one for each subject in this
887     *         population.)
888     */
889    public Reference getSubjectResults() {
890      if (this.subjectResults == null)
891        if (Configuration.errorOnAutoCreate())
892          throw new Error("Attempt to auto-create MeasureReportGroupPopulationComponent.subjectResults");
893        else if (Configuration.doAutoCreate())
894          this.subjectResults = new Reference(); // cc
895      return this.subjectResults;
896    }
897
898    public boolean hasSubjectResults() {
899      return this.subjectResults != null && !this.subjectResults.isEmpty();
900    }
901
902    /**
903     * @param value {@link #subjectResults} (This element refers to a List of
904     *              subject level MeasureReport resources, one for each subject in
905     *              this population.)
906     */
907    public MeasureReportGroupPopulationComponent setSubjectResults(Reference value) {
908      this.subjectResults = value;
909      return this;
910    }
911
912    /**
913     * @return {@link #subjectResults} The actual object that is the target of the
914     *         reference. The reference library doesn't populate this, but you can
915     *         use it to hold the resource if you resolve it. (This element refers
916     *         to a List of subject level MeasureReport resources, one for each
917     *         subject in this population.)
918     */
919    public ListResource getSubjectResultsTarget() {
920      if (this.subjectResultsTarget == null)
921        if (Configuration.errorOnAutoCreate())
922          throw new Error("Attempt to auto-create MeasureReportGroupPopulationComponent.subjectResults");
923        else if (Configuration.doAutoCreate())
924          this.subjectResultsTarget = new ListResource(); // aa
925      return this.subjectResultsTarget;
926    }
927
928    /**
929     * @param value {@link #subjectResults} The actual object that is the target of
930     *              the reference. The reference library doesn't use these, but you
931     *              can use it to hold the resource if you resolve it. (This element
932     *              refers to a List of subject level MeasureReport resources, one
933     *              for each subject in this population.)
934     */
935    public MeasureReportGroupPopulationComponent setSubjectResultsTarget(ListResource value) {
936      this.subjectResultsTarget = value;
937      return this;
938    }
939
940    protected void listChildren(List<Property> children) {
941      super.listChildren(children);
942      children.add(new Property("code", "CodeableConcept", "The type of the population.", 0, 1, code));
943      children.add(new Property("count", "integer", "The number of members of the population.", 0, 1, count));
944      children.add(new Property("subjectResults", "Reference(List)",
945          "This element refers to a List of subject level MeasureReport resources, one for each subject in this population.",
946          0, 1, subjectResults));
947    }
948
949    @Override
950    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
951      switch (_hash) {
952      case 3059181:
953        /* code */ return new Property("code", "CodeableConcept", "The type of the population.", 0, 1, code);
954      case 94851343:
955        /* count */ return new Property("count", "integer", "The number of members of the population.", 0, 1, count);
956      case 2136184106:
957        /* subjectResults */ return new Property("subjectResults", "Reference(List)",
958            "This element refers to a List of subject level MeasureReport resources, one for each subject in this population.",
959            0, 1, subjectResults);
960      default:
961        return super.getNamedProperty(_hash, _name, _checkValid);
962      }
963
964    }
965
966    @Override
967    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
968      switch (hash) {
969      case 3059181:
970        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
971      case 94851343:
972        /* count */ return this.count == null ? new Base[0] : new Base[] { this.count }; // IntegerType
973      case 2136184106:
974        /* subjectResults */ return this.subjectResults == null ? new Base[0] : new Base[] { this.subjectResults }; // Reference
975      default:
976        return super.getProperty(hash, name, checkValid);
977      }
978
979    }
980
981    @Override
982    public Base setProperty(int hash, String name, Base value) throws FHIRException {
983      switch (hash) {
984      case 3059181: // code
985        this.code = castToCodeableConcept(value); // CodeableConcept
986        return value;
987      case 94851343: // count
988        this.count = castToInteger(value); // IntegerType
989        return value;
990      case 2136184106: // subjectResults
991        this.subjectResults = castToReference(value); // Reference
992        return value;
993      default:
994        return super.setProperty(hash, name, value);
995      }
996
997    }
998
999    @Override
1000    public Base setProperty(String name, Base value) throws FHIRException {
1001      if (name.equals("code")) {
1002        this.code = castToCodeableConcept(value); // CodeableConcept
1003      } else if (name.equals("count")) {
1004        this.count = castToInteger(value); // IntegerType
1005      } else if (name.equals("subjectResults")) {
1006        this.subjectResults = castToReference(value); // Reference
1007      } else
1008        return super.setProperty(name, value);
1009      return value;
1010    }
1011
1012    @Override
1013    public Base makeProperty(int hash, String name) throws FHIRException {
1014      switch (hash) {
1015      case 3059181:
1016        return getCode();
1017      case 94851343:
1018        return getCountElement();
1019      case 2136184106:
1020        return getSubjectResults();
1021      default:
1022        return super.makeProperty(hash, name);
1023      }
1024
1025    }
1026
1027    @Override
1028    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1029      switch (hash) {
1030      case 3059181:
1031        /* code */ return new String[] { "CodeableConcept" };
1032      case 94851343:
1033        /* count */ return new String[] { "integer" };
1034      case 2136184106:
1035        /* subjectResults */ return new String[] { "Reference" };
1036      default:
1037        return super.getTypesForProperty(hash, name);
1038      }
1039
1040    }
1041
1042    @Override
1043    public Base addChild(String name) throws FHIRException {
1044      if (name.equals("code")) {
1045        this.code = new CodeableConcept();
1046        return this.code;
1047      } else if (name.equals("count")) {
1048        throw new FHIRException("Cannot call addChild on a singleton property MeasureReport.count");
1049      } else if (name.equals("subjectResults")) {
1050        this.subjectResults = new Reference();
1051        return this.subjectResults;
1052      } else
1053        return super.addChild(name);
1054    }
1055
1056    public MeasureReportGroupPopulationComponent copy() {
1057      MeasureReportGroupPopulationComponent dst = new MeasureReportGroupPopulationComponent();
1058      copyValues(dst);
1059      return dst;
1060    }
1061
1062    public void copyValues(MeasureReportGroupPopulationComponent dst) {
1063      super.copyValues(dst);
1064      dst.code = code == null ? null : code.copy();
1065      dst.count = count == null ? null : count.copy();
1066      dst.subjectResults = subjectResults == null ? null : subjectResults.copy();
1067    }
1068
1069    @Override
1070    public boolean equalsDeep(Base other_) {
1071      if (!super.equalsDeep(other_))
1072        return false;
1073      if (!(other_ instanceof MeasureReportGroupPopulationComponent))
1074        return false;
1075      MeasureReportGroupPopulationComponent o = (MeasureReportGroupPopulationComponent) other_;
1076      return compareDeep(code, o.code, true) && compareDeep(count, o.count, true)
1077          && compareDeep(subjectResults, o.subjectResults, true);
1078    }
1079
1080    @Override
1081    public boolean equalsShallow(Base other_) {
1082      if (!super.equalsShallow(other_))
1083        return false;
1084      if (!(other_ instanceof MeasureReportGroupPopulationComponent))
1085        return false;
1086      MeasureReportGroupPopulationComponent o = (MeasureReportGroupPopulationComponent) other_;
1087      return compareValues(count, o.count, true);
1088    }
1089
1090    public boolean isEmpty() {
1091      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, count, subjectResults);
1092    }
1093
1094    public String fhirType() {
1095      return "MeasureReport.group.population";
1096
1097    }
1098
1099  }
1100
1101  @Block()
1102  public static class MeasureReportGroupStratifierComponent extends BackboneElement implements IBaseBackboneElement {
1103    /**
1104     * The meaning of this stratifier, as defined in the measure definition.
1105     */
1106    @Child(name = "code", type = {
1107        CodeableConcept.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1108    @Description(shortDefinition = "What stratifier of the group", formalDefinition = "The meaning of this stratifier, as defined in the measure definition.")
1109    protected List<CodeableConcept> code;
1110
1111    /**
1112     * This element contains the results for a single stratum within the stratifier.
1113     * For example, when stratifying on administrative gender, there will be four
1114     * strata, one for each possible gender value.
1115     */
1116    @Child(name = "stratum", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1117    @Description(shortDefinition = "Stratum results, one for each unique value, or set of values, in the stratifier, or stratifier components", formalDefinition = "This element contains the results for a single stratum within the stratifier. For example, when stratifying on administrative gender, there will be four strata, one for each possible gender value.")
1118    protected List<StratifierGroupComponent> stratum;
1119
1120    private static final long serialVersionUID = 259550185L;
1121
1122    /**
1123     * Constructor
1124     */
1125    public MeasureReportGroupStratifierComponent() {
1126      super();
1127    }
1128
1129    /**
1130     * @return {@link #code} (The meaning of this stratifier, as defined in the
1131     *         measure definition.)
1132     */
1133    public List<CodeableConcept> getCode() {
1134      if (this.code == null)
1135        this.code = new ArrayList<CodeableConcept>();
1136      return this.code;
1137    }
1138
1139    /**
1140     * @return Returns a reference to <code>this</code> for easy method chaining
1141     */
1142    public MeasureReportGroupStratifierComponent setCode(List<CodeableConcept> theCode) {
1143      this.code = theCode;
1144      return this;
1145    }
1146
1147    public boolean hasCode() {
1148      if (this.code == null)
1149        return false;
1150      for (CodeableConcept item : this.code)
1151        if (!item.isEmpty())
1152          return true;
1153      return false;
1154    }
1155
1156    public CodeableConcept addCode() { // 3
1157      CodeableConcept t = new CodeableConcept();
1158      if (this.code == null)
1159        this.code = new ArrayList<CodeableConcept>();
1160      this.code.add(t);
1161      return t;
1162    }
1163
1164    public MeasureReportGroupStratifierComponent addCode(CodeableConcept t) { // 3
1165      if (t == null)
1166        return this;
1167      if (this.code == null)
1168        this.code = new ArrayList<CodeableConcept>();
1169      this.code.add(t);
1170      return this;
1171    }
1172
1173    /**
1174     * @return The first repetition of repeating field {@link #code}, creating it if
1175     *         it does not already exist
1176     */
1177    public CodeableConcept getCodeFirstRep() {
1178      if (getCode().isEmpty()) {
1179        addCode();
1180      }
1181      return getCode().get(0);
1182    }
1183
1184    /**
1185     * @return {@link #stratum} (This element contains the results for a single
1186     *         stratum within the stratifier. For example, when stratifying on
1187     *         administrative gender, there will be four strata, one for each
1188     *         possible gender value.)
1189     */
1190    public List<StratifierGroupComponent> getStratum() {
1191      if (this.stratum == null)
1192        this.stratum = new ArrayList<StratifierGroupComponent>();
1193      return this.stratum;
1194    }
1195
1196    /**
1197     * @return Returns a reference to <code>this</code> for easy method chaining
1198     */
1199    public MeasureReportGroupStratifierComponent setStratum(List<StratifierGroupComponent> theStratum) {
1200      this.stratum = theStratum;
1201      return this;
1202    }
1203
1204    public boolean hasStratum() {
1205      if (this.stratum == null)
1206        return false;
1207      for (StratifierGroupComponent item : this.stratum)
1208        if (!item.isEmpty())
1209          return true;
1210      return false;
1211    }
1212
1213    public StratifierGroupComponent addStratum() { // 3
1214      StratifierGroupComponent t = new StratifierGroupComponent();
1215      if (this.stratum == null)
1216        this.stratum = new ArrayList<StratifierGroupComponent>();
1217      this.stratum.add(t);
1218      return t;
1219    }
1220
1221    public MeasureReportGroupStratifierComponent addStratum(StratifierGroupComponent t) { // 3
1222      if (t == null)
1223        return this;
1224      if (this.stratum == null)
1225        this.stratum = new ArrayList<StratifierGroupComponent>();
1226      this.stratum.add(t);
1227      return this;
1228    }
1229
1230    /**
1231     * @return The first repetition of repeating field {@link #stratum}, creating it
1232     *         if it does not already exist
1233     */
1234    public StratifierGroupComponent getStratumFirstRep() {
1235      if (getStratum().isEmpty()) {
1236        addStratum();
1237      }
1238      return getStratum().get(0);
1239    }
1240
1241    protected void listChildren(List<Property> children) {
1242      super.listChildren(children);
1243      children.add(new Property("code", "CodeableConcept",
1244          "The meaning of this stratifier, as defined in the measure definition.", 0, java.lang.Integer.MAX_VALUE,
1245          code));
1246      children.add(new Property("stratum", "",
1247          "This element contains the results for a single stratum within the stratifier. For example, when stratifying on administrative gender, there will be four strata, one for each possible gender value.",
1248          0, java.lang.Integer.MAX_VALUE, stratum));
1249    }
1250
1251    @Override
1252    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1253      switch (_hash) {
1254      case 3059181:
1255        /* code */ return new Property("code", "CodeableConcept",
1256            "The meaning of this stratifier, as defined in the measure definition.", 0, java.lang.Integer.MAX_VALUE,
1257            code);
1258      case -1881991236:
1259        /* stratum */ return new Property("stratum", "",
1260            "This element contains the results for a single stratum within the stratifier. For example, when stratifying on administrative gender, there will be four strata, one for each possible gender value.",
1261            0, java.lang.Integer.MAX_VALUE, stratum);
1262      default:
1263        return super.getNamedProperty(_hash, _name, _checkValid);
1264      }
1265
1266    }
1267
1268    @Override
1269    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1270      switch (hash) {
1271      case 3059181:
1272        /* code */ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // CodeableConcept
1273      case -1881991236:
1274        /* stratum */ return this.stratum == null ? new Base[0] : this.stratum.toArray(new Base[this.stratum.size()]); // StratifierGroupComponent
1275      default:
1276        return super.getProperty(hash, name, checkValid);
1277      }
1278
1279    }
1280
1281    @Override
1282    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1283      switch (hash) {
1284      case 3059181: // code
1285        this.getCode().add(castToCodeableConcept(value)); // CodeableConcept
1286        return value;
1287      case -1881991236: // stratum
1288        this.getStratum().add((StratifierGroupComponent) value); // StratifierGroupComponent
1289        return value;
1290      default:
1291        return super.setProperty(hash, name, value);
1292      }
1293
1294    }
1295
1296    @Override
1297    public Base setProperty(String name, Base value) throws FHIRException {
1298      if (name.equals("code")) {
1299        this.getCode().add(castToCodeableConcept(value));
1300      } else if (name.equals("stratum")) {
1301        this.getStratum().add((StratifierGroupComponent) value);
1302      } else
1303        return super.setProperty(name, value);
1304      return value;
1305    }
1306
1307    @Override
1308    public Base makeProperty(int hash, String name) throws FHIRException {
1309      switch (hash) {
1310      case 3059181:
1311        return addCode();
1312      case -1881991236:
1313        return addStratum();
1314      default:
1315        return super.makeProperty(hash, name);
1316      }
1317
1318    }
1319
1320    @Override
1321    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1322      switch (hash) {
1323      case 3059181:
1324        /* code */ return new String[] { "CodeableConcept" };
1325      case -1881991236:
1326        /* stratum */ return new String[] {};
1327      default:
1328        return super.getTypesForProperty(hash, name);
1329      }
1330
1331    }
1332
1333    @Override
1334    public Base addChild(String name) throws FHIRException {
1335      if (name.equals("code")) {
1336        return addCode();
1337      } else if (name.equals("stratum")) {
1338        return addStratum();
1339      } else
1340        return super.addChild(name);
1341    }
1342
1343    public MeasureReportGroupStratifierComponent copy() {
1344      MeasureReportGroupStratifierComponent dst = new MeasureReportGroupStratifierComponent();
1345      copyValues(dst);
1346      return dst;
1347    }
1348
1349    public void copyValues(MeasureReportGroupStratifierComponent dst) {
1350      super.copyValues(dst);
1351      if (code != null) {
1352        dst.code = new ArrayList<CodeableConcept>();
1353        for (CodeableConcept i : code)
1354          dst.code.add(i.copy());
1355      }
1356      ;
1357      if (stratum != null) {
1358        dst.stratum = new ArrayList<StratifierGroupComponent>();
1359        for (StratifierGroupComponent i : stratum)
1360          dst.stratum.add(i.copy());
1361      }
1362      ;
1363    }
1364
1365    @Override
1366    public boolean equalsDeep(Base other_) {
1367      if (!super.equalsDeep(other_))
1368        return false;
1369      if (!(other_ instanceof MeasureReportGroupStratifierComponent))
1370        return false;
1371      MeasureReportGroupStratifierComponent o = (MeasureReportGroupStratifierComponent) other_;
1372      return compareDeep(code, o.code, true) && compareDeep(stratum, o.stratum, true);
1373    }
1374
1375    @Override
1376    public boolean equalsShallow(Base other_) {
1377      if (!super.equalsShallow(other_))
1378        return false;
1379      if (!(other_ instanceof MeasureReportGroupStratifierComponent))
1380        return false;
1381      MeasureReportGroupStratifierComponent o = (MeasureReportGroupStratifierComponent) other_;
1382      return true;
1383    }
1384
1385    public boolean isEmpty() {
1386      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, stratum);
1387    }
1388
1389    public String fhirType() {
1390      return "MeasureReport.group.stratifier";
1391
1392    }
1393
1394  }
1395
1396  @Block()
1397  public static class StratifierGroupComponent extends BackboneElement implements IBaseBackboneElement {
1398    /**
1399     * The value for this stratum, expressed as a CodeableConcept. When defining
1400     * stratifiers on complex values, the value must be rendered such that the value
1401     * for each stratum within the stratifier is unique.
1402     */
1403    @Child(name = "value", type = {
1404        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
1405    @Description(shortDefinition = "The stratum value, e.g. male", formalDefinition = "The value for this stratum, expressed as a CodeableConcept. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.")
1406    protected CodeableConcept value;
1407
1408    /**
1409     * A stratifier component value.
1410     */
1411    @Child(name = "component", type = {}, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1412    @Description(shortDefinition = "Stratifier component values", formalDefinition = "A stratifier component value.")
1413    protected List<StratifierGroupComponentComponent> component;
1414
1415    /**
1416     * The populations that make up the stratum, one for each type of population
1417     * appropriate to the measure.
1418     */
1419    @Child(name = "population", type = {}, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1420    @Description(shortDefinition = "Population results in this stratum", formalDefinition = "The populations that make up the stratum, one for each type of population appropriate to the measure.")
1421    protected List<StratifierGroupPopulationComponent> population;
1422
1423    /**
1424     * The measure score for this stratum, calculated as appropriate for the measure
1425     * type and scoring method, and based on only the members of this stratum.
1426     */
1427    @Child(name = "measureScore", type = {
1428        Quantity.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1429    @Description(shortDefinition = "What score this stratum achieved", formalDefinition = "The measure score for this stratum, calculated as appropriate for the measure type and scoring method, and based on only the members of this stratum.")
1430    protected Quantity measureScore;
1431
1432    private static final long serialVersionUID = 892251179L;
1433
1434    /**
1435     * Constructor
1436     */
1437    public StratifierGroupComponent() {
1438      super();
1439    }
1440
1441    /**
1442     * @return {@link #value} (The value for this stratum, expressed as a
1443     *         CodeableConcept. When defining stratifiers on complex values, the
1444     *         value must be rendered such that the value for each stratum within
1445     *         the stratifier is unique.)
1446     */
1447    public CodeableConcept getValue() {
1448      if (this.value == null)
1449        if (Configuration.errorOnAutoCreate())
1450          throw new Error("Attempt to auto-create StratifierGroupComponent.value");
1451        else if (Configuration.doAutoCreate())
1452          this.value = new CodeableConcept(); // cc
1453      return this.value;
1454    }
1455
1456    public boolean hasValue() {
1457      return this.value != null && !this.value.isEmpty();
1458    }
1459
1460    /**
1461     * @param value {@link #value} (The value for this stratum, expressed as a
1462     *              CodeableConcept. When defining stratifiers on complex values,
1463     *              the value must be rendered such that the value for each stratum
1464     *              within the stratifier is unique.)
1465     */
1466    public StratifierGroupComponent setValue(CodeableConcept value) {
1467      this.value = value;
1468      return this;
1469    }
1470
1471    /**
1472     * @return {@link #component} (A stratifier component value.)
1473     */
1474    public List<StratifierGroupComponentComponent> getComponent() {
1475      if (this.component == null)
1476        this.component = new ArrayList<StratifierGroupComponentComponent>();
1477      return this.component;
1478    }
1479
1480    /**
1481     * @return Returns a reference to <code>this</code> for easy method chaining
1482     */
1483    public StratifierGroupComponent setComponent(List<StratifierGroupComponentComponent> theComponent) {
1484      this.component = theComponent;
1485      return this;
1486    }
1487
1488    public boolean hasComponent() {
1489      if (this.component == null)
1490        return false;
1491      for (StratifierGroupComponentComponent item : this.component)
1492        if (!item.isEmpty())
1493          return true;
1494      return false;
1495    }
1496
1497    public StratifierGroupComponentComponent addComponent() { // 3
1498      StratifierGroupComponentComponent t = new StratifierGroupComponentComponent();
1499      if (this.component == null)
1500        this.component = new ArrayList<StratifierGroupComponentComponent>();
1501      this.component.add(t);
1502      return t;
1503    }
1504
1505    public StratifierGroupComponent addComponent(StratifierGroupComponentComponent t) { // 3
1506      if (t == null)
1507        return this;
1508      if (this.component == null)
1509        this.component = new ArrayList<StratifierGroupComponentComponent>();
1510      this.component.add(t);
1511      return this;
1512    }
1513
1514    /**
1515     * @return The first repetition of repeating field {@link #component}, creating
1516     *         it if it does not already exist
1517     */
1518    public StratifierGroupComponentComponent getComponentFirstRep() {
1519      if (getComponent().isEmpty()) {
1520        addComponent();
1521      }
1522      return getComponent().get(0);
1523    }
1524
1525    /**
1526     * @return {@link #population} (The populations that make up the stratum, one
1527     *         for each type of population appropriate to the measure.)
1528     */
1529    public List<StratifierGroupPopulationComponent> getPopulation() {
1530      if (this.population == null)
1531        this.population = new ArrayList<StratifierGroupPopulationComponent>();
1532      return this.population;
1533    }
1534
1535    /**
1536     * @return Returns a reference to <code>this</code> for easy method chaining
1537     */
1538    public StratifierGroupComponent setPopulation(List<StratifierGroupPopulationComponent> thePopulation) {
1539      this.population = thePopulation;
1540      return this;
1541    }
1542
1543    public boolean hasPopulation() {
1544      if (this.population == null)
1545        return false;
1546      for (StratifierGroupPopulationComponent item : this.population)
1547        if (!item.isEmpty())
1548          return true;
1549      return false;
1550    }
1551
1552    public StratifierGroupPopulationComponent addPopulation() { // 3
1553      StratifierGroupPopulationComponent t = new StratifierGroupPopulationComponent();
1554      if (this.population == null)
1555        this.population = new ArrayList<StratifierGroupPopulationComponent>();
1556      this.population.add(t);
1557      return t;
1558    }
1559
1560    public StratifierGroupComponent addPopulation(StratifierGroupPopulationComponent t) { // 3
1561      if (t == null)
1562        return this;
1563      if (this.population == null)
1564        this.population = new ArrayList<StratifierGroupPopulationComponent>();
1565      this.population.add(t);
1566      return this;
1567    }
1568
1569    /**
1570     * @return The first repetition of repeating field {@link #population}, creating
1571     *         it if it does not already exist
1572     */
1573    public StratifierGroupPopulationComponent getPopulationFirstRep() {
1574      if (getPopulation().isEmpty()) {
1575        addPopulation();
1576      }
1577      return getPopulation().get(0);
1578    }
1579
1580    /**
1581     * @return {@link #measureScore} (The measure score for this stratum, calculated
1582     *         as appropriate for the measure type and scoring method, and based on
1583     *         only the members of this stratum.)
1584     */
1585    public Quantity getMeasureScore() {
1586      if (this.measureScore == null)
1587        if (Configuration.errorOnAutoCreate())
1588          throw new Error("Attempt to auto-create StratifierGroupComponent.measureScore");
1589        else if (Configuration.doAutoCreate())
1590          this.measureScore = new Quantity(); // cc
1591      return this.measureScore;
1592    }
1593
1594    public boolean hasMeasureScore() {
1595      return this.measureScore != null && !this.measureScore.isEmpty();
1596    }
1597
1598    /**
1599     * @param value {@link #measureScore} (The measure score for this stratum,
1600     *              calculated as appropriate for the measure type and scoring
1601     *              method, and based on only the members of this stratum.)
1602     */
1603    public StratifierGroupComponent setMeasureScore(Quantity value) {
1604      this.measureScore = value;
1605      return this;
1606    }
1607
1608    protected void listChildren(List<Property> children) {
1609      super.listChildren(children);
1610      children.add(new Property("value", "CodeableConcept",
1611          "The value for this stratum, expressed as a CodeableConcept. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.",
1612          0, 1, value));
1613      children.add(
1614          new Property("component", "", "A stratifier component value.", 0, java.lang.Integer.MAX_VALUE, component));
1615      children.add(new Property("population", "",
1616          "The populations that make up the stratum, one for each type of population appropriate to the measure.", 0,
1617          java.lang.Integer.MAX_VALUE, population));
1618      children.add(new Property("measureScore", "Quantity",
1619          "The measure score for this stratum, calculated as appropriate for the measure type and scoring method, and based on only the members of this stratum.",
1620          0, 1, measureScore));
1621    }
1622
1623    @Override
1624    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1625      switch (_hash) {
1626      case 111972721:
1627        /* value */ return new Property("value", "CodeableConcept",
1628            "The value for this stratum, expressed as a CodeableConcept. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.",
1629            0, 1, value);
1630      case -1399907075:
1631        /* component */ return new Property("component", "", "A stratifier component value.", 0,
1632            java.lang.Integer.MAX_VALUE, component);
1633      case -2023558323:
1634        /* population */ return new Property("population", "",
1635            "The populations that make up the stratum, one for each type of population appropriate to the measure.", 0,
1636            java.lang.Integer.MAX_VALUE, population);
1637      case -386313260:
1638        /* measureScore */ return new Property("measureScore", "Quantity",
1639            "The measure score for this stratum, calculated as appropriate for the measure type and scoring method, and based on only the members of this stratum.",
1640            0, 1, measureScore);
1641      default:
1642        return super.getNamedProperty(_hash, _name, _checkValid);
1643      }
1644
1645    }
1646
1647    @Override
1648    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1649      switch (hash) {
1650      case 111972721:
1651        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // CodeableConcept
1652      case -1399907075:
1653        /* component */ return this.component == null ? new Base[0]
1654            : this.component.toArray(new Base[this.component.size()]); // StratifierGroupComponentComponent
1655      case -2023558323:
1656        /* population */ return this.population == null ? new Base[0]
1657            : this.population.toArray(new Base[this.population.size()]); // StratifierGroupPopulationComponent
1658      case -386313260:
1659        /* measureScore */ return this.measureScore == null ? new Base[0] : new Base[] { this.measureScore }; // Quantity
1660      default:
1661        return super.getProperty(hash, name, checkValid);
1662      }
1663
1664    }
1665
1666    @Override
1667    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1668      switch (hash) {
1669      case 111972721: // value
1670        this.value = castToCodeableConcept(value); // CodeableConcept
1671        return value;
1672      case -1399907075: // component
1673        this.getComponent().add((StratifierGroupComponentComponent) value); // StratifierGroupComponentComponent
1674        return value;
1675      case -2023558323: // population
1676        this.getPopulation().add((StratifierGroupPopulationComponent) value); // StratifierGroupPopulationComponent
1677        return value;
1678      case -386313260: // measureScore
1679        this.measureScore = castToQuantity(value); // Quantity
1680        return value;
1681      default:
1682        return super.setProperty(hash, name, value);
1683      }
1684
1685    }
1686
1687    @Override
1688    public Base setProperty(String name, Base value) throws FHIRException {
1689      if (name.equals("value")) {
1690        this.value = castToCodeableConcept(value); // CodeableConcept
1691      } else if (name.equals("component")) {
1692        this.getComponent().add((StratifierGroupComponentComponent) value);
1693      } else if (name.equals("population")) {
1694        this.getPopulation().add((StratifierGroupPopulationComponent) value);
1695      } else if (name.equals("measureScore")) {
1696        this.measureScore = castToQuantity(value); // Quantity
1697      } else
1698        return super.setProperty(name, value);
1699      return value;
1700    }
1701
1702    @Override
1703    public Base makeProperty(int hash, String name) throws FHIRException {
1704      switch (hash) {
1705      case 111972721:
1706        return getValue();
1707      case -1399907075:
1708        return addComponent();
1709      case -2023558323:
1710        return addPopulation();
1711      case -386313260:
1712        return getMeasureScore();
1713      default:
1714        return super.makeProperty(hash, name);
1715      }
1716
1717    }
1718
1719    @Override
1720    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1721      switch (hash) {
1722      case 111972721:
1723        /* value */ return new String[] { "CodeableConcept" };
1724      case -1399907075:
1725        /* component */ return new String[] {};
1726      case -2023558323:
1727        /* population */ return new String[] {};
1728      case -386313260:
1729        /* measureScore */ return new String[] { "Quantity" };
1730      default:
1731        return super.getTypesForProperty(hash, name);
1732      }
1733
1734    }
1735
1736    @Override
1737    public Base addChild(String name) throws FHIRException {
1738      if (name.equals("value")) {
1739        this.value = new CodeableConcept();
1740        return this.value;
1741      } else if (name.equals("component")) {
1742        return addComponent();
1743      } else if (name.equals("population")) {
1744        return addPopulation();
1745      } else if (name.equals("measureScore")) {
1746        this.measureScore = new Quantity();
1747        return this.measureScore;
1748      } else
1749        return super.addChild(name);
1750    }
1751
1752    public StratifierGroupComponent copy() {
1753      StratifierGroupComponent dst = new StratifierGroupComponent();
1754      copyValues(dst);
1755      return dst;
1756    }
1757
1758    public void copyValues(StratifierGroupComponent dst) {
1759      super.copyValues(dst);
1760      dst.value = value == null ? null : value.copy();
1761      if (component != null) {
1762        dst.component = new ArrayList<StratifierGroupComponentComponent>();
1763        for (StratifierGroupComponentComponent i : component)
1764          dst.component.add(i.copy());
1765      }
1766      ;
1767      if (population != null) {
1768        dst.population = new ArrayList<StratifierGroupPopulationComponent>();
1769        for (StratifierGroupPopulationComponent i : population)
1770          dst.population.add(i.copy());
1771      }
1772      ;
1773      dst.measureScore = measureScore == null ? null : measureScore.copy();
1774    }
1775
1776    @Override
1777    public boolean equalsDeep(Base other_) {
1778      if (!super.equalsDeep(other_))
1779        return false;
1780      if (!(other_ instanceof StratifierGroupComponent))
1781        return false;
1782      StratifierGroupComponent o = (StratifierGroupComponent) other_;
1783      return compareDeep(value, o.value, true) && compareDeep(component, o.component, true)
1784          && compareDeep(population, o.population, true) && compareDeep(measureScore, o.measureScore, true);
1785    }
1786
1787    @Override
1788    public boolean equalsShallow(Base other_) {
1789      if (!super.equalsShallow(other_))
1790        return false;
1791      if (!(other_ instanceof StratifierGroupComponent))
1792        return false;
1793      StratifierGroupComponent o = (StratifierGroupComponent) other_;
1794      return true;
1795    }
1796
1797    public boolean isEmpty() {
1798      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, component, population, measureScore);
1799    }
1800
1801    public String fhirType() {
1802      return "MeasureReport.group.stratifier.stratum";
1803
1804    }
1805
1806  }
1807
1808  @Block()
1809  public static class StratifierGroupComponentComponent extends BackboneElement implements IBaseBackboneElement {
1810    /**
1811     * The code for the stratum component value.
1812     */
1813    @Child(name = "code", type = {
1814        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1815    @Description(shortDefinition = "What stratifier component of the group", formalDefinition = "The code for the stratum component value.")
1816    protected CodeableConcept code;
1817
1818    /**
1819     * The stratum component value.
1820     */
1821    @Child(name = "value", type = {
1822        CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1823    @Description(shortDefinition = "The stratum component value, e.g. male", formalDefinition = "The stratum component value.")
1824    protected CodeableConcept value;
1825
1826    private static final long serialVersionUID = 1750253426L;
1827
1828    /**
1829     * Constructor
1830     */
1831    public StratifierGroupComponentComponent() {
1832      super();
1833    }
1834
1835    /**
1836     * Constructor
1837     */
1838    public StratifierGroupComponentComponent(CodeableConcept code, CodeableConcept value) {
1839      super();
1840      this.code = code;
1841      this.value = value;
1842    }
1843
1844    /**
1845     * @return {@link #code} (The code for the stratum component value.)
1846     */
1847    public CodeableConcept getCode() {
1848      if (this.code == null)
1849        if (Configuration.errorOnAutoCreate())
1850          throw new Error("Attempt to auto-create StratifierGroupComponentComponent.code");
1851        else if (Configuration.doAutoCreate())
1852          this.code = new CodeableConcept(); // cc
1853      return this.code;
1854    }
1855
1856    public boolean hasCode() {
1857      return this.code != null && !this.code.isEmpty();
1858    }
1859
1860    /**
1861     * @param value {@link #code} (The code for the stratum component value.)
1862     */
1863    public StratifierGroupComponentComponent setCode(CodeableConcept value) {
1864      this.code = value;
1865      return this;
1866    }
1867
1868    /**
1869     * @return {@link #value} (The stratum component value.)
1870     */
1871    public CodeableConcept getValue() {
1872      if (this.value == null)
1873        if (Configuration.errorOnAutoCreate())
1874          throw new Error("Attempt to auto-create StratifierGroupComponentComponent.value");
1875        else if (Configuration.doAutoCreate())
1876          this.value = new CodeableConcept(); // cc
1877      return this.value;
1878    }
1879
1880    public boolean hasValue() {
1881      return this.value != null && !this.value.isEmpty();
1882    }
1883
1884    /**
1885     * @param value {@link #value} (The stratum component value.)
1886     */
1887    public StratifierGroupComponentComponent setValue(CodeableConcept value) {
1888      this.value = value;
1889      return this;
1890    }
1891
1892    protected void listChildren(List<Property> children) {
1893      super.listChildren(children);
1894      children.add(new Property("code", "CodeableConcept", "The code for the stratum component value.", 0, 1, code));
1895      children.add(new Property("value", "CodeableConcept", "The stratum component value.", 0, 1, value));
1896    }
1897
1898    @Override
1899    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1900      switch (_hash) {
1901      case 3059181:
1902        /* code */ return new Property("code", "CodeableConcept", "The code for the stratum component value.", 0, 1,
1903            code);
1904      case 111972721:
1905        /* value */ return new Property("value", "CodeableConcept", "The stratum component value.", 0, 1, value);
1906      default:
1907        return super.getNamedProperty(_hash, _name, _checkValid);
1908      }
1909
1910    }
1911
1912    @Override
1913    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1914      switch (hash) {
1915      case 3059181:
1916        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
1917      case 111972721:
1918        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // CodeableConcept
1919      default:
1920        return super.getProperty(hash, name, checkValid);
1921      }
1922
1923    }
1924
1925    @Override
1926    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1927      switch (hash) {
1928      case 3059181: // code
1929        this.code = castToCodeableConcept(value); // CodeableConcept
1930        return value;
1931      case 111972721: // value
1932        this.value = castToCodeableConcept(value); // CodeableConcept
1933        return value;
1934      default:
1935        return super.setProperty(hash, name, value);
1936      }
1937
1938    }
1939
1940    @Override
1941    public Base setProperty(String name, Base value) throws FHIRException {
1942      if (name.equals("code")) {
1943        this.code = castToCodeableConcept(value); // CodeableConcept
1944      } else if (name.equals("value")) {
1945        this.value = castToCodeableConcept(value); // CodeableConcept
1946      } else
1947        return super.setProperty(name, value);
1948      return value;
1949    }
1950
1951    @Override
1952    public Base makeProperty(int hash, String name) throws FHIRException {
1953      switch (hash) {
1954      case 3059181:
1955        return getCode();
1956      case 111972721:
1957        return getValue();
1958      default:
1959        return super.makeProperty(hash, name);
1960      }
1961
1962    }
1963
1964    @Override
1965    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1966      switch (hash) {
1967      case 3059181:
1968        /* code */ return new String[] { "CodeableConcept" };
1969      case 111972721:
1970        /* value */ return new String[] { "CodeableConcept" };
1971      default:
1972        return super.getTypesForProperty(hash, name);
1973      }
1974
1975    }
1976
1977    @Override
1978    public Base addChild(String name) throws FHIRException {
1979      if (name.equals("code")) {
1980        this.code = new CodeableConcept();
1981        return this.code;
1982      } else if (name.equals("value")) {
1983        this.value = new CodeableConcept();
1984        return this.value;
1985      } else
1986        return super.addChild(name);
1987    }
1988
1989    public StratifierGroupComponentComponent copy() {
1990      StratifierGroupComponentComponent dst = new StratifierGroupComponentComponent();
1991      copyValues(dst);
1992      return dst;
1993    }
1994
1995    public void copyValues(StratifierGroupComponentComponent dst) {
1996      super.copyValues(dst);
1997      dst.code = code == null ? null : code.copy();
1998      dst.value = value == null ? null : value.copy();
1999    }
2000
2001    @Override
2002    public boolean equalsDeep(Base other_) {
2003      if (!super.equalsDeep(other_))
2004        return false;
2005      if (!(other_ instanceof StratifierGroupComponentComponent))
2006        return false;
2007      StratifierGroupComponentComponent o = (StratifierGroupComponentComponent) other_;
2008      return compareDeep(code, o.code, true) && compareDeep(value, o.value, true);
2009    }
2010
2011    @Override
2012    public boolean equalsShallow(Base other_) {
2013      if (!super.equalsShallow(other_))
2014        return false;
2015      if (!(other_ instanceof StratifierGroupComponentComponent))
2016        return false;
2017      StratifierGroupComponentComponent o = (StratifierGroupComponentComponent) other_;
2018      return true;
2019    }
2020
2021    public boolean isEmpty() {
2022      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, value);
2023    }
2024
2025    public String fhirType() {
2026      return "MeasureReport.group.stratifier.stratum.component";
2027
2028    }
2029
2030  }
2031
2032  @Block()
2033  public static class StratifierGroupPopulationComponent extends BackboneElement implements IBaseBackboneElement {
2034    /**
2035     * The type of the population.
2036     */
2037    @Child(name = "code", type = {
2038        CodeableConcept.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
2039    @Description(shortDefinition = "initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-observation", formalDefinition = "The type of the population.")
2040    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/measure-population")
2041    protected CodeableConcept code;
2042
2043    /**
2044     * The number of members of the population in this stratum.
2045     */
2046    @Child(name = "count", type = { IntegerType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
2047    @Description(shortDefinition = "Size of the population", formalDefinition = "The number of members of the population in this stratum.")
2048    protected IntegerType count;
2049
2050    /**
2051     * This element refers to a List of subject level MeasureReport resources, one
2052     * for each subject in this population in this stratum.
2053     */
2054    @Child(name = "subjectResults", type = {
2055        ListResource.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
2056    @Description(shortDefinition = "For subject-list reports, the subject results in this population", formalDefinition = "This element refers to a List of subject level MeasureReport resources, one for each subject in this population in this stratum.")
2057    protected Reference subjectResults;
2058
2059    /**
2060     * The actual object that is the target of the reference (This element refers to
2061     * a List of subject level MeasureReport resources, one for each subject in this
2062     * population in this stratum.)
2063     */
2064    protected ListResource subjectResultsTarget;
2065
2066    private static final long serialVersionUID = 210461445L;
2067
2068    /**
2069     * Constructor
2070     */
2071    public StratifierGroupPopulationComponent() {
2072      super();
2073    }
2074
2075    /**
2076     * @return {@link #code} (The type of the population.)
2077     */
2078    public CodeableConcept getCode() {
2079      if (this.code == null)
2080        if (Configuration.errorOnAutoCreate())
2081          throw new Error("Attempt to auto-create StratifierGroupPopulationComponent.code");
2082        else if (Configuration.doAutoCreate())
2083          this.code = new CodeableConcept(); // cc
2084      return this.code;
2085    }
2086
2087    public boolean hasCode() {
2088      return this.code != null && !this.code.isEmpty();
2089    }
2090
2091    /**
2092     * @param value {@link #code} (The type of the population.)
2093     */
2094    public StratifierGroupPopulationComponent setCode(CodeableConcept value) {
2095      this.code = value;
2096      return this;
2097    }
2098
2099    /**
2100     * @return {@link #count} (The number of members of the population in this
2101     *         stratum.). This is the underlying object with id, value and
2102     *         extensions. The accessor "getCount" gives direct access to the value
2103     */
2104    public IntegerType getCountElement() {
2105      if (this.count == null)
2106        if (Configuration.errorOnAutoCreate())
2107          throw new Error("Attempt to auto-create StratifierGroupPopulationComponent.count");
2108        else if (Configuration.doAutoCreate())
2109          this.count = new IntegerType(); // bb
2110      return this.count;
2111    }
2112
2113    public boolean hasCountElement() {
2114      return this.count != null && !this.count.isEmpty();
2115    }
2116
2117    public boolean hasCount() {
2118      return this.count != null && !this.count.isEmpty();
2119    }
2120
2121    /**
2122     * @param value {@link #count} (The number of members of the population in this
2123     *              stratum.). This is the underlying object with id, value and
2124     *              extensions. The accessor "getCount" gives direct access to the
2125     *              value
2126     */
2127    public StratifierGroupPopulationComponent setCountElement(IntegerType value) {
2128      this.count = value;
2129      return this;
2130    }
2131
2132    /**
2133     * @return The number of members of the population in this stratum.
2134     */
2135    public int getCount() {
2136      return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue();
2137    }
2138
2139    /**
2140     * @param value The number of members of the population in this stratum.
2141     */
2142    public StratifierGroupPopulationComponent setCount(int value) {
2143      if (this.count == null)
2144        this.count = new IntegerType();
2145      this.count.setValue(value);
2146      return this;
2147    }
2148
2149    /**
2150     * @return {@link #subjectResults} (This element refers to a List of subject
2151     *         level MeasureReport resources, one for each subject in this
2152     *         population in this stratum.)
2153     */
2154    public Reference getSubjectResults() {
2155      if (this.subjectResults == null)
2156        if (Configuration.errorOnAutoCreate())
2157          throw new Error("Attempt to auto-create StratifierGroupPopulationComponent.subjectResults");
2158        else if (Configuration.doAutoCreate())
2159          this.subjectResults = new Reference(); // cc
2160      return this.subjectResults;
2161    }
2162
2163    public boolean hasSubjectResults() {
2164      return this.subjectResults != null && !this.subjectResults.isEmpty();
2165    }
2166
2167    /**
2168     * @param value {@link #subjectResults} (This element refers to a List of
2169     *              subject level MeasureReport resources, one for each subject in
2170     *              this population in this stratum.)
2171     */
2172    public StratifierGroupPopulationComponent setSubjectResults(Reference value) {
2173      this.subjectResults = value;
2174      return this;
2175    }
2176
2177    /**
2178     * @return {@link #subjectResults} The actual object that is the target of the
2179     *         reference. The reference library doesn't populate this, but you can
2180     *         use it to hold the resource if you resolve it. (This element refers
2181     *         to a List of subject level MeasureReport resources, one for each
2182     *         subject in this population in this stratum.)
2183     */
2184    public ListResource getSubjectResultsTarget() {
2185      if (this.subjectResultsTarget == null)
2186        if (Configuration.errorOnAutoCreate())
2187          throw new Error("Attempt to auto-create StratifierGroupPopulationComponent.subjectResults");
2188        else if (Configuration.doAutoCreate())
2189          this.subjectResultsTarget = new ListResource(); // aa
2190      return this.subjectResultsTarget;
2191    }
2192
2193    /**
2194     * @param value {@link #subjectResults} The actual object that is the target of
2195     *              the reference. The reference library doesn't use these, but you
2196     *              can use it to hold the resource if you resolve it. (This element
2197     *              refers to a List of subject level MeasureReport resources, one
2198     *              for each subject in this population in this stratum.)
2199     */
2200    public StratifierGroupPopulationComponent setSubjectResultsTarget(ListResource value) {
2201      this.subjectResultsTarget = value;
2202      return this;
2203    }
2204
2205    protected void listChildren(List<Property> children) {
2206      super.listChildren(children);
2207      children.add(new Property("code", "CodeableConcept", "The type of the population.", 0, 1, code));
2208      children.add(
2209          new Property("count", "integer", "The number of members of the population in this stratum.", 0, 1, count));
2210      children.add(new Property("subjectResults", "Reference(List)",
2211          "This element refers to a List of subject level MeasureReport resources, one for each subject in this population in this stratum.",
2212          0, 1, subjectResults));
2213    }
2214
2215    @Override
2216    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2217      switch (_hash) {
2218      case 3059181:
2219        /* code */ return new Property("code", "CodeableConcept", "The type of the population.", 0, 1, code);
2220      case 94851343:
2221        /* count */ return new Property("count", "integer", "The number of members of the population in this stratum.",
2222            0, 1, count);
2223      case 2136184106:
2224        /* subjectResults */ return new Property("subjectResults", "Reference(List)",
2225            "This element refers to a List of subject level MeasureReport resources, one for each subject in this population in this stratum.",
2226            0, 1, subjectResults);
2227      default:
2228        return super.getNamedProperty(_hash, _name, _checkValid);
2229      }
2230
2231    }
2232
2233    @Override
2234    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2235      switch (hash) {
2236      case 3059181:
2237        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
2238      case 94851343:
2239        /* count */ return this.count == null ? new Base[0] : new Base[] { this.count }; // IntegerType
2240      case 2136184106:
2241        /* subjectResults */ return this.subjectResults == null ? new Base[0] : new Base[] { this.subjectResults }; // Reference
2242      default:
2243        return super.getProperty(hash, name, checkValid);
2244      }
2245
2246    }
2247
2248    @Override
2249    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2250      switch (hash) {
2251      case 3059181: // code
2252        this.code = castToCodeableConcept(value); // CodeableConcept
2253        return value;
2254      case 94851343: // count
2255        this.count = castToInteger(value); // IntegerType
2256        return value;
2257      case 2136184106: // subjectResults
2258        this.subjectResults = castToReference(value); // Reference
2259        return value;
2260      default:
2261        return super.setProperty(hash, name, value);
2262      }
2263
2264    }
2265
2266    @Override
2267    public Base setProperty(String name, Base value) throws FHIRException {
2268      if (name.equals("code")) {
2269        this.code = castToCodeableConcept(value); // CodeableConcept
2270      } else if (name.equals("count")) {
2271        this.count = castToInteger(value); // IntegerType
2272      } else if (name.equals("subjectResults")) {
2273        this.subjectResults = castToReference(value); // Reference
2274      } else
2275        return super.setProperty(name, value);
2276      return value;
2277    }
2278
2279    @Override
2280    public Base makeProperty(int hash, String name) throws FHIRException {
2281      switch (hash) {
2282      case 3059181:
2283        return getCode();
2284      case 94851343:
2285        return getCountElement();
2286      case 2136184106:
2287        return getSubjectResults();
2288      default:
2289        return super.makeProperty(hash, name);
2290      }
2291
2292    }
2293
2294    @Override
2295    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2296      switch (hash) {
2297      case 3059181:
2298        /* code */ return new String[] { "CodeableConcept" };
2299      case 94851343:
2300        /* count */ return new String[] { "integer" };
2301      case 2136184106:
2302        /* subjectResults */ return new String[] { "Reference" };
2303      default:
2304        return super.getTypesForProperty(hash, name);
2305      }
2306
2307    }
2308
2309    @Override
2310    public Base addChild(String name) throws FHIRException {
2311      if (name.equals("code")) {
2312        this.code = new CodeableConcept();
2313        return this.code;
2314      } else if (name.equals("count")) {
2315        throw new FHIRException("Cannot call addChild on a singleton property MeasureReport.count");
2316      } else if (name.equals("subjectResults")) {
2317        this.subjectResults = new Reference();
2318        return this.subjectResults;
2319      } else
2320        return super.addChild(name);
2321    }
2322
2323    public StratifierGroupPopulationComponent copy() {
2324      StratifierGroupPopulationComponent dst = new StratifierGroupPopulationComponent();
2325      copyValues(dst);
2326      return dst;
2327    }
2328
2329    public void copyValues(StratifierGroupPopulationComponent dst) {
2330      super.copyValues(dst);
2331      dst.code = code == null ? null : code.copy();
2332      dst.count = count == null ? null : count.copy();
2333      dst.subjectResults = subjectResults == null ? null : subjectResults.copy();
2334    }
2335
2336    @Override
2337    public boolean equalsDeep(Base other_) {
2338      if (!super.equalsDeep(other_))
2339        return false;
2340      if (!(other_ instanceof StratifierGroupPopulationComponent))
2341        return false;
2342      StratifierGroupPopulationComponent o = (StratifierGroupPopulationComponent) other_;
2343      return compareDeep(code, o.code, true) && compareDeep(count, o.count, true)
2344          && compareDeep(subjectResults, o.subjectResults, true);
2345    }
2346
2347    @Override
2348    public boolean equalsShallow(Base other_) {
2349      if (!super.equalsShallow(other_))
2350        return false;
2351      if (!(other_ instanceof StratifierGroupPopulationComponent))
2352        return false;
2353      StratifierGroupPopulationComponent o = (StratifierGroupPopulationComponent) other_;
2354      return compareValues(count, o.count, true);
2355    }
2356
2357    public boolean isEmpty() {
2358      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, count, subjectResults);
2359    }
2360
2361    public String fhirType() {
2362      return "MeasureReport.group.stratifier.stratum.population";
2363
2364    }
2365
2366  }
2367
2368  /**
2369   * A formal identifier that is used to identify this MeasureReport when it is
2370   * represented in other formats or referenced in a specification, model, design
2371   * or an instance.
2372   */
2373  @Child(name = "identifier", type = {
2374      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
2375  @Description(shortDefinition = "Additional identifier for the MeasureReport", formalDefinition = "A formal identifier that is used to identify this MeasureReport when it is represented in other formats or referenced in a specification, model, design or an instance.")
2376  protected List<Identifier> identifier;
2377
2378  /**
2379   * The MeasureReport status. No data will be available until the MeasureReport
2380   * status is complete.
2381   */
2382  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
2383  @Description(shortDefinition = "complete | pending | error", formalDefinition = "The MeasureReport status. No data will be available until the MeasureReport status is complete.")
2384  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/measure-report-status")
2385  protected Enumeration<MeasureReportStatus> status;
2386
2387  /**
2388   * The type of measure report. This may be an individual report, which provides
2389   * the score for the measure for an individual member of the population; a
2390   * subject-listing, which returns the list of members that meet the various
2391   * criteria in the measure; a summary report, which returns a population count
2392   * for each of the criteria in the measure; or a data-collection, which enables
2393   * the MeasureReport to be used to exchange the data-of-interest for a quality
2394   * measure.
2395   */
2396  @Child(name = "type", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
2397  @Description(shortDefinition = "individual | subject-list | summary | data-collection", formalDefinition = "The type of measure report. This may be an individual report, which provides the score for the measure for an individual member of the population; a subject-listing, which returns the list of members that meet the various criteria in the measure; a summary report, which returns a population count for each of the criteria in the measure; or a data-collection, which enables the MeasureReport to be used to exchange the data-of-interest for a quality measure.")
2398  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/measure-report-type")
2399  protected Enumeration<MeasureReportType> type;
2400
2401  /**
2402   * A reference to the Measure that was calculated to produce this report.
2403   */
2404  @Child(name = "measure", type = {
2405      CanonicalType.class }, order = 3, min = 1, max = 1, modifier = false, summary = true)
2406  @Description(shortDefinition = "What measure was calculated", formalDefinition = "A reference to the Measure that was calculated to produce this report.")
2407  protected CanonicalType measure;
2408
2409  /**
2410   * Optional subject identifying the individual or individuals the report is for.
2411   */
2412  @Child(name = "subject", type = { Patient.class, Practitioner.class, PractitionerRole.class, Location.class,
2413      Device.class, RelatedPerson.class, Group.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
2414  @Description(shortDefinition = "What individual(s) the report is for", formalDefinition = "Optional subject identifying the individual or individuals the report is for.")
2415  protected Reference subject;
2416
2417  /**
2418   * The actual object that is the target of the reference (Optional subject
2419   * identifying the individual or individuals the report is for.)
2420   */
2421  protected Resource subjectTarget;
2422
2423  /**
2424   * The date this measure report was generated.
2425   */
2426  @Child(name = "date", type = { DateTimeType.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
2427  @Description(shortDefinition = "When the report was generated", formalDefinition = "The date this measure report was generated.")
2428  protected DateTimeType date;
2429
2430  /**
2431   * The individual, location, or organization that is reporting the data.
2432   */
2433  @Child(name = "reporter", type = { Practitioner.class, PractitionerRole.class, Location.class,
2434      Organization.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
2435  @Description(shortDefinition = "Who is reporting the data", formalDefinition = "The individual, location, or organization that is reporting the data.")
2436  protected Reference reporter;
2437
2438  /**
2439   * The actual object that is the target of the reference (The individual,
2440   * location, or organization that is reporting the data.)
2441   */
2442  protected Resource reporterTarget;
2443
2444  /**
2445   * The reporting period for which the report was calculated.
2446   */
2447  @Child(name = "period", type = { Period.class }, order = 7, min = 1, max = 1, modifier = false, summary = true)
2448  @Description(shortDefinition = "What period the report covers", formalDefinition = "The reporting period for which the report was calculated.")
2449  protected Period period;
2450
2451  /**
2452   * Whether improvement in the measure is noted by an increase or decrease in the
2453   * measure score.
2454   */
2455  @Child(name = "improvementNotation", type = {
2456      CodeableConcept.class }, order = 8, min = 0, max = 1, modifier = true, summary = true)
2457  @Description(shortDefinition = "increase | decrease", formalDefinition = "Whether improvement in the measure is noted by an increase or decrease in the measure score.")
2458  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/measure-improvement-notation")
2459  protected CodeableConcept improvementNotation;
2460
2461  /**
2462   * The results of the calculation, one for each population group in the measure.
2463   */
2464  @Child(name = "group", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2465  @Description(shortDefinition = "Measure results for each group", formalDefinition = "The results of the calculation, one for each population group in the measure.")
2466  protected List<MeasureReportGroupComponent> group;
2467
2468  /**
2469   * A reference to a Bundle containing the Resources that were used in the
2470   * calculation of this measure.
2471   */
2472  @Child(name = "evaluatedResource", type = {
2473      Reference.class }, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2474  @Description(shortDefinition = "What data was used to calculate the measure score", formalDefinition = "A reference to a Bundle containing the Resources that were used in the calculation of this measure.")
2475  protected List<Reference> evaluatedResource;
2476  /**
2477   * The actual objects that are the target of the reference (A reference to a
2478   * Bundle containing the Resources that were used in the calculation of this
2479   * measure.)
2480   */
2481  protected List<Resource> evaluatedResourceTarget;
2482
2483  private static final long serialVersionUID = 355307999L;
2484
2485  /**
2486   * Constructor
2487   */
2488  public MeasureReport() {
2489    super();
2490  }
2491
2492  /**
2493   * Constructor
2494   */
2495  public MeasureReport(Enumeration<MeasureReportStatus> status, Enumeration<MeasureReportType> type,
2496      CanonicalType measure, Period period) {
2497    super();
2498    this.status = status;
2499    this.type = type;
2500    this.measure = measure;
2501    this.period = period;
2502  }
2503
2504  /**
2505   * @return {@link #identifier} (A formal identifier that is used to identify
2506   *         this MeasureReport when it is represented in other formats or
2507   *         referenced in a specification, model, design or an instance.)
2508   */
2509  public List<Identifier> getIdentifier() {
2510    if (this.identifier == null)
2511      this.identifier = new ArrayList<Identifier>();
2512    return this.identifier;
2513  }
2514
2515  /**
2516   * @return Returns a reference to <code>this</code> for easy method chaining
2517   */
2518  public MeasureReport setIdentifier(List<Identifier> theIdentifier) {
2519    this.identifier = theIdentifier;
2520    return this;
2521  }
2522
2523  public boolean hasIdentifier() {
2524    if (this.identifier == null)
2525      return false;
2526    for (Identifier item : this.identifier)
2527      if (!item.isEmpty())
2528        return true;
2529    return false;
2530  }
2531
2532  public Identifier addIdentifier() { // 3
2533    Identifier t = new Identifier();
2534    if (this.identifier == null)
2535      this.identifier = new ArrayList<Identifier>();
2536    this.identifier.add(t);
2537    return t;
2538  }
2539
2540  public MeasureReport addIdentifier(Identifier t) { // 3
2541    if (t == null)
2542      return this;
2543    if (this.identifier == null)
2544      this.identifier = new ArrayList<Identifier>();
2545    this.identifier.add(t);
2546    return this;
2547  }
2548
2549  /**
2550   * @return The first repetition of repeating field {@link #identifier}, creating
2551   *         it if it does not already exist
2552   */
2553  public Identifier getIdentifierFirstRep() {
2554    if (getIdentifier().isEmpty()) {
2555      addIdentifier();
2556    }
2557    return getIdentifier().get(0);
2558  }
2559
2560  /**
2561   * @return {@link #status} (The MeasureReport status. No data will be available
2562   *         until the MeasureReport status is complete.). This is the underlying
2563   *         object with id, value and extensions. The accessor "getStatus" gives
2564   *         direct access to the value
2565   */
2566  public Enumeration<MeasureReportStatus> getStatusElement() {
2567    if (this.status == null)
2568      if (Configuration.errorOnAutoCreate())
2569        throw new Error("Attempt to auto-create MeasureReport.status");
2570      else if (Configuration.doAutoCreate())
2571        this.status = new Enumeration<MeasureReportStatus>(new MeasureReportStatusEnumFactory()); // bb
2572    return this.status;
2573  }
2574
2575  public boolean hasStatusElement() {
2576    return this.status != null && !this.status.isEmpty();
2577  }
2578
2579  public boolean hasStatus() {
2580    return this.status != null && !this.status.isEmpty();
2581  }
2582
2583  /**
2584   * @param value {@link #status} (The MeasureReport status. No data will be
2585   *              available until the MeasureReport status is complete.). This is
2586   *              the underlying object with id, value and extensions. The
2587   *              accessor "getStatus" gives direct access to the value
2588   */
2589  public MeasureReport setStatusElement(Enumeration<MeasureReportStatus> value) {
2590    this.status = value;
2591    return this;
2592  }
2593
2594  /**
2595   * @return The MeasureReport status. No data will be available until the
2596   *         MeasureReport status is complete.
2597   */
2598  public MeasureReportStatus getStatus() {
2599    return this.status == null ? null : this.status.getValue();
2600  }
2601
2602  /**
2603   * @param value The MeasureReport status. No data will be available until the
2604   *              MeasureReport status is complete.
2605   */
2606  public MeasureReport setStatus(MeasureReportStatus value) {
2607    if (this.status == null)
2608      this.status = new Enumeration<MeasureReportStatus>(new MeasureReportStatusEnumFactory());
2609    this.status.setValue(value);
2610    return this;
2611  }
2612
2613  /**
2614   * @return {@link #type} (The type of measure report. This may be an individual
2615   *         report, which provides the score for the measure for an individual
2616   *         member of the population; a subject-listing, which returns the list
2617   *         of members that meet the various criteria in the measure; a summary
2618   *         report, which returns a population count for each of the criteria in
2619   *         the measure; or a data-collection, which enables the MeasureReport to
2620   *         be used to exchange the data-of-interest for a quality measure.).
2621   *         This is the underlying object with id, value and extensions. The
2622   *         accessor "getType" gives direct access to the value
2623   */
2624  public Enumeration<MeasureReportType> getTypeElement() {
2625    if (this.type == null)
2626      if (Configuration.errorOnAutoCreate())
2627        throw new Error("Attempt to auto-create MeasureReport.type");
2628      else if (Configuration.doAutoCreate())
2629        this.type = new Enumeration<MeasureReportType>(new MeasureReportTypeEnumFactory()); // bb
2630    return this.type;
2631  }
2632
2633  public boolean hasTypeElement() {
2634    return this.type != null && !this.type.isEmpty();
2635  }
2636
2637  public boolean hasType() {
2638    return this.type != null && !this.type.isEmpty();
2639  }
2640
2641  /**
2642   * @param value {@link #type} (The type of measure report. This may be an
2643   *              individual report, which provides the score for the measure for
2644   *              an individual member of the population; a subject-listing, which
2645   *              returns the list of members that meet the various criteria in
2646   *              the measure; a summary report, which returns a population count
2647   *              for each of the criteria in the measure; or a data-collection,
2648   *              which enables the MeasureReport to be used to exchange the
2649   *              data-of-interest for a quality measure.). This is the underlying
2650   *              object with id, value and extensions. The accessor "getType"
2651   *              gives direct access to the value
2652   */
2653  public MeasureReport setTypeElement(Enumeration<MeasureReportType> value) {
2654    this.type = value;
2655    return this;
2656  }
2657
2658  /**
2659   * @return The type of measure report. This may be an individual report, which
2660   *         provides the score for the measure for an individual member of the
2661   *         population; a subject-listing, which returns the list of members that
2662   *         meet the various criteria in the measure; a summary report, which
2663   *         returns a population count for each of the criteria in the measure;
2664   *         or a data-collection, which enables the MeasureReport to be used to
2665   *         exchange the data-of-interest for a quality measure.
2666   */
2667  public MeasureReportType getType() {
2668    return this.type == null ? null : this.type.getValue();
2669  }
2670
2671  /**
2672   * @param value The type of measure report. This may be an individual report,
2673   *              which provides the score for the measure for an individual
2674   *              member of the population; a subject-listing, which returns the
2675   *              list of members that meet the various criteria in the measure; a
2676   *              summary report, which returns a population count for each of the
2677   *              criteria in the measure; or a data-collection, which enables the
2678   *              MeasureReport to be used to exchange the data-of-interest for a
2679   *              quality measure.
2680   */
2681  public MeasureReport setType(MeasureReportType value) {
2682    if (this.type == null)
2683      this.type = new Enumeration<MeasureReportType>(new MeasureReportTypeEnumFactory());
2684    this.type.setValue(value);
2685    return this;
2686  }
2687
2688  /**
2689   * @return {@link #measure} (A reference to the Measure that was calculated to
2690   *         produce this report.). This is the underlying object with id, value
2691   *         and extensions. The accessor "getMeasure" gives direct access to the
2692   *         value
2693   */
2694  public CanonicalType getMeasureElement() {
2695    if (this.measure == null)
2696      if (Configuration.errorOnAutoCreate())
2697        throw new Error("Attempt to auto-create MeasureReport.measure");
2698      else if (Configuration.doAutoCreate())
2699        this.measure = new CanonicalType(); // bb
2700    return this.measure;
2701  }
2702
2703  public boolean hasMeasureElement() {
2704    return this.measure != null && !this.measure.isEmpty();
2705  }
2706
2707  public boolean hasMeasure() {
2708    return this.measure != null && !this.measure.isEmpty();
2709  }
2710
2711  /**
2712   * @param value {@link #measure} (A reference to the Measure that was calculated
2713   *              to produce this report.). This is the underlying object with id,
2714   *              value and extensions. The accessor "getMeasure" gives direct
2715   *              access to the value
2716   */
2717  public MeasureReport setMeasureElement(CanonicalType value) {
2718    this.measure = value;
2719    return this;
2720  }
2721
2722  /**
2723   * @return A reference to the Measure that was calculated to produce this
2724   *         report.
2725   */
2726  public String getMeasure() {
2727    return this.measure == null ? null : this.measure.getValue();
2728  }
2729
2730  /**
2731   * @param value A reference to the Measure that was calculated to produce this
2732   *              report.
2733   */
2734  public MeasureReport setMeasure(String value) {
2735    if (this.measure == null)
2736      this.measure = new CanonicalType();
2737    this.measure.setValue(value);
2738    return this;
2739  }
2740
2741  /**
2742   * @return {@link #subject} (Optional subject identifying the individual or
2743   *         individuals the report is for.)
2744   */
2745  public Reference getSubject() {
2746    if (this.subject == null)
2747      if (Configuration.errorOnAutoCreate())
2748        throw new Error("Attempt to auto-create MeasureReport.subject");
2749      else if (Configuration.doAutoCreate())
2750        this.subject = new Reference(); // cc
2751    return this.subject;
2752  }
2753
2754  public boolean hasSubject() {
2755    return this.subject != null && !this.subject.isEmpty();
2756  }
2757
2758  /**
2759   * @param value {@link #subject} (Optional subject identifying the individual or
2760   *              individuals the report is for.)
2761   */
2762  public MeasureReport setSubject(Reference value) {
2763    this.subject = value;
2764    return this;
2765  }
2766
2767  /**
2768   * @return {@link #subject} The actual object that is the target of the
2769   *         reference. The reference library doesn't populate this, but you can
2770   *         use it to hold the resource if you resolve it. (Optional subject
2771   *         identifying the individual or individuals the report is for.)
2772   */
2773  public Resource getSubjectTarget() {
2774    return this.subjectTarget;
2775  }
2776
2777  /**
2778   * @param value {@link #subject} The actual object that is the target of the
2779   *              reference. The reference library doesn't use these, but you can
2780   *              use it to hold the resource if you resolve it. (Optional subject
2781   *              identifying the individual or individuals the report is for.)
2782   */
2783  public MeasureReport setSubjectTarget(Resource value) {
2784    this.subjectTarget = value;
2785    return this;
2786  }
2787
2788  /**
2789   * @return {@link #date} (The date this measure report was generated.). This is
2790   *         the underlying object with id, value and extensions. The accessor
2791   *         "getDate" gives direct access to the value
2792   */
2793  public DateTimeType getDateElement() {
2794    if (this.date == null)
2795      if (Configuration.errorOnAutoCreate())
2796        throw new Error("Attempt to auto-create MeasureReport.date");
2797      else if (Configuration.doAutoCreate())
2798        this.date = new DateTimeType(); // bb
2799    return this.date;
2800  }
2801
2802  public boolean hasDateElement() {
2803    return this.date != null && !this.date.isEmpty();
2804  }
2805
2806  public boolean hasDate() {
2807    return this.date != null && !this.date.isEmpty();
2808  }
2809
2810  /**
2811   * @param value {@link #date} (The date this measure report was generated.).
2812   *              This is the underlying object with id, value and extensions. The
2813   *              accessor "getDate" gives direct access to the value
2814   */
2815  public MeasureReport setDateElement(DateTimeType value) {
2816    this.date = value;
2817    return this;
2818  }
2819
2820  /**
2821   * @return The date this measure report was generated.
2822   */
2823  public Date getDate() {
2824    return this.date == null ? null : this.date.getValue();
2825  }
2826
2827  /**
2828   * @param value The date this measure report was generated.
2829   */
2830  public MeasureReport setDate(Date value) {
2831    if (value == null)
2832      this.date = null;
2833    else {
2834      if (this.date == null)
2835        this.date = new DateTimeType();
2836      this.date.setValue(value);
2837    }
2838    return this;
2839  }
2840
2841  /**
2842   * @return {@link #reporter} (The individual, location, or organization that is
2843   *         reporting the data.)
2844   */
2845  public Reference getReporter() {
2846    if (this.reporter == null)
2847      if (Configuration.errorOnAutoCreate())
2848        throw new Error("Attempt to auto-create MeasureReport.reporter");
2849      else if (Configuration.doAutoCreate())
2850        this.reporter = new Reference(); // cc
2851    return this.reporter;
2852  }
2853
2854  public boolean hasReporter() {
2855    return this.reporter != null && !this.reporter.isEmpty();
2856  }
2857
2858  /**
2859   * @param value {@link #reporter} (The individual, location, or organization
2860   *              that is reporting the data.)
2861   */
2862  public MeasureReport setReporter(Reference value) {
2863    this.reporter = value;
2864    return this;
2865  }
2866
2867  /**
2868   * @return {@link #reporter} The actual object that is the target of the
2869   *         reference. The reference library doesn't populate this, but you can
2870   *         use it to hold the resource if you resolve it. (The individual,
2871   *         location, or organization that is reporting the data.)
2872   */
2873  public Resource getReporterTarget() {
2874    return this.reporterTarget;
2875  }
2876
2877  /**
2878   * @param value {@link #reporter} The actual object that is the target of the
2879   *              reference. The reference library doesn't use these, but you can
2880   *              use it to hold the resource if you resolve it. (The individual,
2881   *              location, or organization that is reporting the data.)
2882   */
2883  public MeasureReport setReporterTarget(Resource value) {
2884    this.reporterTarget = value;
2885    return this;
2886  }
2887
2888  /**
2889   * @return {@link #period} (The reporting period for which the report was
2890   *         calculated.)
2891   */
2892  public Period getPeriod() {
2893    if (this.period == null)
2894      if (Configuration.errorOnAutoCreate())
2895        throw new Error("Attempt to auto-create MeasureReport.period");
2896      else if (Configuration.doAutoCreate())
2897        this.period = new Period(); // cc
2898    return this.period;
2899  }
2900
2901  public boolean hasPeriod() {
2902    return this.period != null && !this.period.isEmpty();
2903  }
2904
2905  /**
2906   * @param value {@link #period} (The reporting period for which the report was
2907   *              calculated.)
2908   */
2909  public MeasureReport setPeriod(Period value) {
2910    this.period = value;
2911    return this;
2912  }
2913
2914  /**
2915   * @return {@link #improvementNotation} (Whether improvement in the measure is
2916   *         noted by an increase or decrease in the measure score.)
2917   */
2918  public CodeableConcept getImprovementNotation() {
2919    if (this.improvementNotation == null)
2920      if (Configuration.errorOnAutoCreate())
2921        throw new Error("Attempt to auto-create MeasureReport.improvementNotation");
2922      else if (Configuration.doAutoCreate())
2923        this.improvementNotation = new CodeableConcept(); // cc
2924    return this.improvementNotation;
2925  }
2926
2927  public boolean hasImprovementNotation() {
2928    return this.improvementNotation != null && !this.improvementNotation.isEmpty();
2929  }
2930
2931  /**
2932   * @param value {@link #improvementNotation} (Whether improvement in the measure
2933   *              is noted by an increase or decrease in the measure score.)
2934   */
2935  public MeasureReport setImprovementNotation(CodeableConcept value) {
2936    this.improvementNotation = value;
2937    return this;
2938  }
2939
2940  /**
2941   * @return {@link #group} (The results of the calculation, one for each
2942   *         population group in the measure.)
2943   */
2944  public List<MeasureReportGroupComponent> getGroup() {
2945    if (this.group == null)
2946      this.group = new ArrayList<MeasureReportGroupComponent>();
2947    return this.group;
2948  }
2949
2950  /**
2951   * @return Returns a reference to <code>this</code> for easy method chaining
2952   */
2953  public MeasureReport setGroup(List<MeasureReportGroupComponent> theGroup) {
2954    this.group = theGroup;
2955    return this;
2956  }
2957
2958  public boolean hasGroup() {
2959    if (this.group == null)
2960      return false;
2961    for (MeasureReportGroupComponent item : this.group)
2962      if (!item.isEmpty())
2963        return true;
2964    return false;
2965  }
2966
2967  public MeasureReportGroupComponent addGroup() { // 3
2968    MeasureReportGroupComponent t = new MeasureReportGroupComponent();
2969    if (this.group == null)
2970      this.group = new ArrayList<MeasureReportGroupComponent>();
2971    this.group.add(t);
2972    return t;
2973  }
2974
2975  public MeasureReport addGroup(MeasureReportGroupComponent t) { // 3
2976    if (t == null)
2977      return this;
2978    if (this.group == null)
2979      this.group = new ArrayList<MeasureReportGroupComponent>();
2980    this.group.add(t);
2981    return this;
2982  }
2983
2984  /**
2985   * @return The first repetition of repeating field {@link #group}, creating it
2986   *         if it does not already exist
2987   */
2988  public MeasureReportGroupComponent getGroupFirstRep() {
2989    if (getGroup().isEmpty()) {
2990      addGroup();
2991    }
2992    return getGroup().get(0);
2993  }
2994
2995  /**
2996   * @return {@link #evaluatedResource} (A reference to a Bundle containing the
2997   *         Resources that were used in the calculation of this measure.)
2998   */
2999  public List<Reference> getEvaluatedResource() {
3000    if (this.evaluatedResource == null)
3001      this.evaluatedResource = new ArrayList<Reference>();
3002    return this.evaluatedResource;
3003  }
3004
3005  /**
3006   * @return Returns a reference to <code>this</code> for easy method chaining
3007   */
3008  public MeasureReport setEvaluatedResource(List<Reference> theEvaluatedResource) {
3009    this.evaluatedResource = theEvaluatedResource;
3010    return this;
3011  }
3012
3013  public boolean hasEvaluatedResource() {
3014    if (this.evaluatedResource == null)
3015      return false;
3016    for (Reference item : this.evaluatedResource)
3017      if (!item.isEmpty())
3018        return true;
3019    return false;
3020  }
3021
3022  public Reference addEvaluatedResource() { // 3
3023    Reference t = new Reference();
3024    if (this.evaluatedResource == null)
3025      this.evaluatedResource = new ArrayList<Reference>();
3026    this.evaluatedResource.add(t);
3027    return t;
3028  }
3029
3030  public MeasureReport addEvaluatedResource(Reference t) { // 3
3031    if (t == null)
3032      return this;
3033    if (this.evaluatedResource == null)
3034      this.evaluatedResource = new ArrayList<Reference>();
3035    this.evaluatedResource.add(t);
3036    return this;
3037  }
3038
3039  /**
3040   * @return The first repetition of repeating field {@link #evaluatedResource},
3041   *         creating it if it does not already exist
3042   */
3043  public Reference getEvaluatedResourceFirstRep() {
3044    if (getEvaluatedResource().isEmpty()) {
3045      addEvaluatedResource();
3046    }
3047    return getEvaluatedResource().get(0);
3048  }
3049
3050  /**
3051   * @deprecated Use Reference#setResource(IBaseResource) instead
3052   */
3053  @Deprecated
3054  public List<Resource> getEvaluatedResourceTarget() {
3055    if (this.evaluatedResourceTarget == null)
3056      this.evaluatedResourceTarget = new ArrayList<Resource>();
3057    return this.evaluatedResourceTarget;
3058  }
3059
3060  protected void listChildren(List<Property> children) {
3061    super.listChildren(children);
3062    children.add(new Property("identifier", "Identifier",
3063        "A formal identifier that is used to identify this MeasureReport when it is represented in other formats or referenced in a specification, model, design or an instance.",
3064        0, java.lang.Integer.MAX_VALUE, identifier));
3065    children.add(new Property("status", "code",
3066        "The MeasureReport status. No data will be available until the MeasureReport status is complete.", 0, 1,
3067        status));
3068    children.add(new Property("type", "code",
3069        "The type of measure report. This may be an individual report, which provides the score for the measure for an individual member of the population; a subject-listing, which returns the list of members that meet the various criteria in the measure; a summary report, which returns a population count for each of the criteria in the measure; or a data-collection, which enables the MeasureReport to be used to exchange the data-of-interest for a quality measure.",
3070        0, 1, type));
3071    children.add(new Property("measure", "canonical(Measure)",
3072        "A reference to the Measure that was calculated to produce this report.", 0, 1, measure));
3073    children.add(
3074        new Property("subject", "Reference(Patient|Practitioner|PractitionerRole|Location|Device|RelatedPerson|Group)",
3075            "Optional subject identifying the individual or individuals the report is for.", 0, 1, subject));
3076    children.add(new Property("date", "dateTime", "The date this measure report was generated.", 0, 1, date));
3077    children.add(new Property("reporter", "Reference(Practitioner|PractitionerRole|Location|Organization)",
3078        "The individual, location, or organization that is reporting the data.", 0, 1, reporter));
3079    children.add(
3080        new Property("period", "Period", "The reporting period for which the report was calculated.", 0, 1, period));
3081    children.add(new Property("improvementNotation", "CodeableConcept",
3082        "Whether improvement in the measure is noted by an increase or decrease in the measure score.", 0, 1,
3083        improvementNotation));
3084    children
3085        .add(new Property("group", "", "The results of the calculation, one for each population group in the measure.",
3086            0, java.lang.Integer.MAX_VALUE, group));
3087    children.add(new Property("evaluatedResource", "Reference(Any)",
3088        "A reference to a Bundle containing the Resources that were used in the calculation of this measure.", 0,
3089        java.lang.Integer.MAX_VALUE, evaluatedResource));
3090  }
3091
3092  @Override
3093  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3094    switch (_hash) {
3095    case -1618432855:
3096      /* identifier */ return new Property("identifier", "Identifier",
3097          "A formal identifier that is used to identify this MeasureReport when it is represented in other formats or referenced in a specification, model, design or an instance.",
3098          0, java.lang.Integer.MAX_VALUE, identifier);
3099    case -892481550:
3100      /* status */ return new Property("status", "code",
3101          "The MeasureReport status. No data will be available until the MeasureReport status is complete.", 0, 1,
3102          status);
3103    case 3575610:
3104      /* type */ return new Property("type", "code",
3105          "The type of measure report. This may be an individual report, which provides the score for the measure for an individual member of the population; a subject-listing, which returns the list of members that meet the various criteria in the measure; a summary report, which returns a population count for each of the criteria in the measure; or a data-collection, which enables the MeasureReport to be used to exchange the data-of-interest for a quality measure.",
3106          0, 1, type);
3107    case 938321246:
3108      /* measure */ return new Property("measure", "canonical(Measure)",
3109          "A reference to the Measure that was calculated to produce this report.", 0, 1, measure);
3110    case -1867885268:
3111      /* subject */ return new Property("subject",
3112          "Reference(Patient|Practitioner|PractitionerRole|Location|Device|RelatedPerson|Group)",
3113          "Optional subject identifying the individual or individuals the report is for.", 0, 1, subject);
3114    case 3076014:
3115      /* date */ return new Property("date", "dateTime", "The date this measure report was generated.", 0, 1, date);
3116    case -427039519:
3117      /* reporter */ return new Property("reporter", "Reference(Practitioner|PractitionerRole|Location|Organization)",
3118          "The individual, location, or organization that is reporting the data.", 0, 1, reporter);
3119    case -991726143:
3120      /* period */ return new Property("period", "Period", "The reporting period for which the report was calculated.",
3121          0, 1, period);
3122    case -2085456136:
3123      /* improvementNotation */ return new Property("improvementNotation", "CodeableConcept",
3124          "Whether improvement in the measure is noted by an increase or decrease in the measure score.", 0, 1,
3125          improvementNotation);
3126    case 98629247:
3127      /* group */ return new Property("group", "",
3128          "The results of the calculation, one for each population group in the measure.", 0,
3129          java.lang.Integer.MAX_VALUE, group);
3130    case -1056771047:
3131      /* evaluatedResource */ return new Property("evaluatedResource", "Reference(Any)",
3132          "A reference to a Bundle containing the Resources that were used in the calculation of this measure.", 0,
3133          java.lang.Integer.MAX_VALUE, evaluatedResource);
3134    default:
3135      return super.getNamedProperty(_hash, _name, _checkValid);
3136    }
3137
3138  }
3139
3140  @Override
3141  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3142    switch (hash) {
3143    case -1618432855:
3144      /* identifier */ return this.identifier == null ? new Base[0]
3145          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
3146    case -892481550:
3147      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<MeasureReportStatus>
3148    case 3575610:
3149      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Enumeration<MeasureReportType>
3150    case 938321246:
3151      /* measure */ return this.measure == null ? new Base[0] : new Base[] { this.measure }; // CanonicalType
3152    case -1867885268:
3153      /* subject */ return this.subject == null ? new Base[0] : new Base[] { this.subject }; // Reference
3154    case 3076014:
3155      /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateTimeType
3156    case -427039519:
3157      /* reporter */ return this.reporter == null ? new Base[0] : new Base[] { this.reporter }; // Reference
3158    case -991726143:
3159      /* period */ return this.period == null ? new Base[0] : new Base[] { this.period }; // Period
3160    case -2085456136:
3161      /* improvementNotation */ return this.improvementNotation == null ? new Base[0]
3162          : new Base[] { this.improvementNotation }; // CodeableConcept
3163    case 98629247:
3164      /* group */ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // MeasureReportGroupComponent
3165    case -1056771047:
3166      /* evaluatedResource */ return this.evaluatedResource == null ? new Base[0]
3167          : this.evaluatedResource.toArray(new Base[this.evaluatedResource.size()]); // Reference
3168    default:
3169      return super.getProperty(hash, name, checkValid);
3170    }
3171
3172  }
3173
3174  @Override
3175  public Base setProperty(int hash, String name, Base value) throws FHIRException {
3176    switch (hash) {
3177    case -1618432855: // identifier
3178      this.getIdentifier().add(castToIdentifier(value)); // Identifier
3179      return value;
3180    case -892481550: // status
3181      value = new MeasureReportStatusEnumFactory().fromType(castToCode(value));
3182      this.status = (Enumeration) value; // Enumeration<MeasureReportStatus>
3183      return value;
3184    case 3575610: // type
3185      value = new MeasureReportTypeEnumFactory().fromType(castToCode(value));
3186      this.type = (Enumeration) value; // Enumeration<MeasureReportType>
3187      return value;
3188    case 938321246: // measure
3189      this.measure = castToCanonical(value); // CanonicalType
3190      return value;
3191    case -1867885268: // subject
3192      this.subject = castToReference(value); // Reference
3193      return value;
3194    case 3076014: // date
3195      this.date = castToDateTime(value); // DateTimeType
3196      return value;
3197    case -427039519: // reporter
3198      this.reporter = castToReference(value); // Reference
3199      return value;
3200    case -991726143: // period
3201      this.period = castToPeriod(value); // Period
3202      return value;
3203    case -2085456136: // improvementNotation
3204      this.improvementNotation = castToCodeableConcept(value); // CodeableConcept
3205      return value;
3206    case 98629247: // group
3207      this.getGroup().add((MeasureReportGroupComponent) value); // MeasureReportGroupComponent
3208      return value;
3209    case -1056771047: // evaluatedResource
3210      this.getEvaluatedResource().add(castToReference(value)); // Reference
3211      return value;
3212    default:
3213      return super.setProperty(hash, name, value);
3214    }
3215
3216  }
3217
3218  @Override
3219  public Base setProperty(String name, Base value) throws FHIRException {
3220    if (name.equals("identifier")) {
3221      this.getIdentifier().add(castToIdentifier(value));
3222    } else if (name.equals("status")) {
3223      value = new MeasureReportStatusEnumFactory().fromType(castToCode(value));
3224      this.status = (Enumeration) value; // Enumeration<MeasureReportStatus>
3225    } else if (name.equals("type")) {
3226      value = new MeasureReportTypeEnumFactory().fromType(castToCode(value));
3227      this.type = (Enumeration) value; // Enumeration<MeasureReportType>
3228    } else if (name.equals("measure")) {
3229      this.measure = castToCanonical(value); // CanonicalType
3230    } else if (name.equals("subject")) {
3231      this.subject = castToReference(value); // Reference
3232    } else if (name.equals("date")) {
3233      this.date = castToDateTime(value); // DateTimeType
3234    } else if (name.equals("reporter")) {
3235      this.reporter = castToReference(value); // Reference
3236    } else if (name.equals("period")) {
3237      this.period = castToPeriod(value); // Period
3238    } else if (name.equals("improvementNotation")) {
3239      this.improvementNotation = castToCodeableConcept(value); // CodeableConcept
3240    } else if (name.equals("group")) {
3241      this.getGroup().add((MeasureReportGroupComponent) value);
3242    } else if (name.equals("evaluatedResource")) {
3243      this.getEvaluatedResource().add(castToReference(value));
3244    } else
3245      return super.setProperty(name, value);
3246    return value;
3247  }
3248
3249  @Override
3250  public Base makeProperty(int hash, String name) throws FHIRException {
3251    switch (hash) {
3252    case -1618432855:
3253      return addIdentifier();
3254    case -892481550:
3255      return getStatusElement();
3256    case 3575610:
3257      return getTypeElement();
3258    case 938321246:
3259      return getMeasureElement();
3260    case -1867885268:
3261      return getSubject();
3262    case 3076014:
3263      return getDateElement();
3264    case -427039519:
3265      return getReporter();
3266    case -991726143:
3267      return getPeriod();
3268    case -2085456136:
3269      return getImprovementNotation();
3270    case 98629247:
3271      return addGroup();
3272    case -1056771047:
3273      return addEvaluatedResource();
3274    default:
3275      return super.makeProperty(hash, name);
3276    }
3277
3278  }
3279
3280  @Override
3281  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3282    switch (hash) {
3283    case -1618432855:
3284      /* identifier */ return new String[] { "Identifier" };
3285    case -892481550:
3286      /* status */ return new String[] { "code" };
3287    case 3575610:
3288      /* type */ return new String[] { "code" };
3289    case 938321246:
3290      /* measure */ return new String[] { "canonical" };
3291    case -1867885268:
3292      /* subject */ return new String[] { "Reference" };
3293    case 3076014:
3294      /* date */ return new String[] { "dateTime" };
3295    case -427039519:
3296      /* reporter */ return new String[] { "Reference" };
3297    case -991726143:
3298      /* period */ return new String[] { "Period" };
3299    case -2085456136:
3300      /* improvementNotation */ return new String[] { "CodeableConcept" };
3301    case 98629247:
3302      /* group */ return new String[] {};
3303    case -1056771047:
3304      /* evaluatedResource */ return new String[] { "Reference" };
3305    default:
3306      return super.getTypesForProperty(hash, name);
3307    }
3308
3309  }
3310
3311  @Override
3312  public Base addChild(String name) throws FHIRException {
3313    if (name.equals("identifier")) {
3314      return addIdentifier();
3315    } else if (name.equals("status")) {
3316      throw new FHIRException("Cannot call addChild on a singleton property MeasureReport.status");
3317    } else if (name.equals("type")) {
3318      throw new FHIRException("Cannot call addChild on a singleton property MeasureReport.type");
3319    } else if (name.equals("measure")) {
3320      throw new FHIRException("Cannot call addChild on a singleton property MeasureReport.measure");
3321    } else if (name.equals("subject")) {
3322      this.subject = new Reference();
3323      return this.subject;
3324    } else if (name.equals("date")) {
3325      throw new FHIRException("Cannot call addChild on a singleton property MeasureReport.date");
3326    } else if (name.equals("reporter")) {
3327      this.reporter = new Reference();
3328      return this.reporter;
3329    } else if (name.equals("period")) {
3330      this.period = new Period();
3331      return this.period;
3332    } else if (name.equals("improvementNotation")) {
3333      this.improvementNotation = new CodeableConcept();
3334      return this.improvementNotation;
3335    } else if (name.equals("group")) {
3336      return addGroup();
3337    } else if (name.equals("evaluatedResource")) {
3338      return addEvaluatedResource();
3339    } else
3340      return super.addChild(name);
3341  }
3342
3343  public String fhirType() {
3344    return "MeasureReport";
3345
3346  }
3347
3348  public MeasureReport copy() {
3349    MeasureReport dst = new MeasureReport();
3350    copyValues(dst);
3351    return dst;
3352  }
3353
3354  public void copyValues(MeasureReport dst) {
3355    super.copyValues(dst);
3356    if (identifier != null) {
3357      dst.identifier = new ArrayList<Identifier>();
3358      for (Identifier i : identifier)
3359        dst.identifier.add(i.copy());
3360    }
3361    ;
3362    dst.status = status == null ? null : status.copy();
3363    dst.type = type == null ? null : type.copy();
3364    dst.measure = measure == null ? null : measure.copy();
3365    dst.subject = subject == null ? null : subject.copy();
3366    dst.date = date == null ? null : date.copy();
3367    dst.reporter = reporter == null ? null : reporter.copy();
3368    dst.period = period == null ? null : period.copy();
3369    dst.improvementNotation = improvementNotation == null ? null : improvementNotation.copy();
3370    if (group != null) {
3371      dst.group = new ArrayList<MeasureReportGroupComponent>();
3372      for (MeasureReportGroupComponent i : group)
3373        dst.group.add(i.copy());
3374    }
3375    ;
3376    if (evaluatedResource != null) {
3377      dst.evaluatedResource = new ArrayList<Reference>();
3378      for (Reference i : evaluatedResource)
3379        dst.evaluatedResource.add(i.copy());
3380    }
3381    ;
3382  }
3383
3384  protected MeasureReport typedCopy() {
3385    return copy();
3386  }
3387
3388  @Override
3389  public boolean equalsDeep(Base other_) {
3390    if (!super.equalsDeep(other_))
3391      return false;
3392    if (!(other_ instanceof MeasureReport))
3393      return false;
3394    MeasureReport o = (MeasureReport) other_;
3395    return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true)
3396        && compareDeep(type, o.type, true) && compareDeep(measure, o.measure, true)
3397        && compareDeep(subject, o.subject, true) && compareDeep(date, o.date, true)
3398        && compareDeep(reporter, o.reporter, true) && compareDeep(period, o.period, true)
3399        && compareDeep(improvementNotation, o.improvementNotation, true) && compareDeep(group, o.group, true)
3400        && compareDeep(evaluatedResource, o.evaluatedResource, true);
3401  }
3402
3403  @Override
3404  public boolean equalsShallow(Base other_) {
3405    if (!super.equalsShallow(other_))
3406      return false;
3407    if (!(other_ instanceof MeasureReport))
3408      return false;
3409    MeasureReport o = (MeasureReport) other_;
3410    return compareValues(status, o.status, true) && compareValues(type, o.type, true)
3411        && compareValues(date, o.date, true);
3412  }
3413
3414  public boolean isEmpty() {
3415    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type, measure, subject, date,
3416        reporter, period, improvementNotation, group, evaluatedResource);
3417  }
3418
3419  @Override
3420  public ResourceType getResourceType() {
3421    return ResourceType.MeasureReport;
3422  }
3423
3424  /**
3425   * Search parameter: <b>date</b>
3426   * <p>
3427   * Description: <b>The date of the measure report</b><br>
3428   * Type: <b>date</b><br>
3429   * Path: <b>MeasureReport.date</b><br>
3430   * </p>
3431   */
3432  @SearchParamDefinition(name = "date", path = "MeasureReport.date", description = "The date of the measure report", type = "date")
3433  public static final String SP_DATE = "date";
3434  /**
3435   * <b>Fluent Client</b> search parameter constant for <b>date</b>
3436   * <p>
3437   * Description: <b>The date of the measure report</b><br>
3438   * Type: <b>date</b><br>
3439   * Path: <b>MeasureReport.date</b><br>
3440   * </p>
3441   */
3442  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(
3443      SP_DATE);
3444
3445  /**
3446   * Search parameter: <b>identifier</b>
3447   * <p>
3448   * Description: <b>External identifier of the measure report to be
3449   * returned</b><br>
3450   * Type: <b>token</b><br>
3451   * Path: <b>MeasureReport.identifier</b><br>
3452   * </p>
3453   */
3454  @SearchParamDefinition(name = "identifier", path = "MeasureReport.identifier", description = "External identifier of the measure report to be returned", type = "token")
3455  public static final String SP_IDENTIFIER = "identifier";
3456  /**
3457   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
3458   * <p>
3459   * Description: <b>External identifier of the measure report to be
3460   * returned</b><br>
3461   * Type: <b>token</b><br>
3462   * Path: <b>MeasureReport.identifier</b><br>
3463   * </p>
3464   */
3465  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3466      SP_IDENTIFIER);
3467
3468  /**
3469   * Search parameter: <b>period</b>
3470   * <p>
3471   * Description: <b>The period of the measure report</b><br>
3472   * Type: <b>date</b><br>
3473   * Path: <b>MeasureReport.period</b><br>
3474   * </p>
3475   */
3476  @SearchParamDefinition(name = "period", path = "MeasureReport.period", description = "The period of the measure report", type = "date")
3477  public static final String SP_PERIOD = "period";
3478  /**
3479   * <b>Fluent Client</b> search parameter constant for <b>period</b>
3480   * <p>
3481   * Description: <b>The period of the measure report</b><br>
3482   * Type: <b>date</b><br>
3483   * Path: <b>MeasureReport.period</b><br>
3484   * </p>
3485   */
3486  public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(
3487      SP_PERIOD);
3488
3489  /**
3490   * Search parameter: <b>measure</b>
3491   * <p>
3492   * Description: <b>The measure to return measure report results for</b><br>
3493   * Type: <b>reference</b><br>
3494   * Path: <b>MeasureReport.measure</b><br>
3495   * </p>
3496   */
3497  @SearchParamDefinition(name = "measure", path = "MeasureReport.measure", description = "The measure to return measure report results for", type = "reference", target = {
3498      Measure.class })
3499  public static final String SP_MEASURE = "measure";
3500  /**
3501   * <b>Fluent Client</b> search parameter constant for <b>measure</b>
3502   * <p>
3503   * Description: <b>The measure to return measure report results for</b><br>
3504   * Type: <b>reference</b><br>
3505   * Path: <b>MeasureReport.measure</b><br>
3506   * </p>
3507   */
3508  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEASURE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3509      SP_MEASURE);
3510
3511  /**
3512   * Constant for fluent queries to be used to add include statements. Specifies
3513   * the path value of "<b>MeasureReport:measure</b>".
3514   */
3515  public static final ca.uhn.fhir.model.api.Include INCLUDE_MEASURE = new ca.uhn.fhir.model.api.Include(
3516      "MeasureReport:measure").toLocked();
3517
3518  /**
3519   * Search parameter: <b>patient</b>
3520   * <p>
3521   * Description: <b>The identity of a patient to search for individual measure
3522   * report results for</b><br>
3523   * Type: <b>reference</b><br>
3524   * Path: <b>MeasureReport.subject</b><br>
3525   * </p>
3526   */
3527  @SearchParamDefinition(name = "patient", path = "MeasureReport.subject.where(resolve() is Patient)", description = "The identity of a patient to search for individual measure report results for", type = "reference", providesMembershipIn = {
3528      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient") }, target = { Patient.class })
3529  public static final String SP_PATIENT = "patient";
3530  /**
3531   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
3532   * <p>
3533   * Description: <b>The identity of a patient to search for individual measure
3534   * report results for</b><br>
3535   * Type: <b>reference</b><br>
3536   * Path: <b>MeasureReport.subject</b><br>
3537   * </p>
3538   */
3539  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3540      SP_PATIENT);
3541
3542  /**
3543   * Constant for fluent queries to be used to add include statements. Specifies
3544   * the path value of "<b>MeasureReport:patient</b>".
3545   */
3546  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include(
3547      "MeasureReport:patient").toLocked();
3548
3549  /**
3550   * Search parameter: <b>subject</b>
3551   * <p>
3552   * Description: <b>The identity of a subject to search for individual measure
3553   * report results for</b><br>
3554   * Type: <b>reference</b><br>
3555   * Path: <b>MeasureReport.subject</b><br>
3556   * </p>
3557   */
3558  @SearchParamDefinition(name = "subject", path = "MeasureReport.subject", description = "The identity of a subject to search for individual measure report results for", type = "reference", target = {
3559      Device.class, Group.class, Location.class, Patient.class, Practitioner.class, PractitionerRole.class,
3560      RelatedPerson.class })
3561  public static final String SP_SUBJECT = "subject";
3562  /**
3563   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
3564   * <p>
3565   * Description: <b>The identity of a subject to search for individual measure
3566   * report results for</b><br>
3567   * Type: <b>reference</b><br>
3568   * Path: <b>MeasureReport.subject</b><br>
3569   * </p>
3570   */
3571  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3572      SP_SUBJECT);
3573
3574  /**
3575   * Constant for fluent queries to be used to add include statements. Specifies
3576   * the path value of "<b>MeasureReport:subject</b>".
3577   */
3578  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include(
3579      "MeasureReport:subject").toLocked();
3580
3581  /**
3582   * Search parameter: <b>reporter</b>
3583   * <p>
3584   * Description: <b>The reporter to return measure report results for</b><br>
3585   * Type: <b>reference</b><br>
3586   * Path: <b>MeasureReport.reporter</b><br>
3587   * </p>
3588   */
3589  @SearchParamDefinition(name = "reporter", path = "MeasureReport.reporter", description = "The reporter to return measure report results for", type = "reference", target = {
3590      Location.class, Organization.class, Practitioner.class, PractitionerRole.class })
3591  public static final String SP_REPORTER = "reporter";
3592  /**
3593   * <b>Fluent Client</b> search parameter constant for <b>reporter</b>
3594   * <p>
3595   * Description: <b>The reporter to return measure report results for</b><br>
3596   * Type: <b>reference</b><br>
3597   * Path: <b>MeasureReport.reporter</b><br>
3598   * </p>
3599   */
3600  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REPORTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3601      SP_REPORTER);
3602
3603  /**
3604   * Constant for fluent queries to be used to add include statements. Specifies
3605   * the path value of "<b>MeasureReport:reporter</b>".
3606   */
3607  public static final ca.uhn.fhir.model.api.Include INCLUDE_REPORTER = new ca.uhn.fhir.model.api.Include(
3608      "MeasureReport:reporter").toLocked();
3609
3610  /**
3611   * Search parameter: <b>status</b>
3612   * <p>
3613   * Description: <b>The status of the measure report</b><br>
3614   * Type: <b>token</b><br>
3615   * Path: <b>MeasureReport.status</b><br>
3616   * </p>
3617   */
3618  @SearchParamDefinition(name = "status", path = "MeasureReport.status", description = "The status of the measure report", type = "token")
3619  public static final String SP_STATUS = "status";
3620  /**
3621   * <b>Fluent Client</b> search parameter constant for <b>status</b>
3622   * <p>
3623   * Description: <b>The status of the measure report</b><br>
3624   * Type: <b>token</b><br>
3625   * Path: <b>MeasureReport.status</b><br>
3626   * </p>
3627   */
3628  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3629      SP_STATUS);
3630
3631  /**
3632   * Search parameter: <b>evaluated-resource</b>
3633   * <p>
3634   * Description: <b>An evaluated resource referenced by the measure
3635   * report</b><br>
3636   * Type: <b>reference</b><br>
3637   * Path: <b>MeasureReport.evaluatedResource</b><br>
3638   * </p>
3639   */
3640  @SearchParamDefinition(name = "evaluated-resource", path = "MeasureReport.evaluatedResource", description = "An evaluated resource referenced by the measure report", type = "reference")
3641  public static final String SP_EVALUATED_RESOURCE = "evaluated-resource";
3642  /**
3643   * <b>Fluent Client</b> search parameter constant for <b>evaluated-resource</b>
3644   * <p>
3645   * Description: <b>An evaluated resource referenced by the measure
3646   * report</b><br>
3647   * Type: <b>reference</b><br>
3648   * Path: <b>MeasureReport.evaluatedResource</b><br>
3649   * </p>
3650   */
3651  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam EVALUATED_RESOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
3652      SP_EVALUATED_RESOURCE);
3653
3654  /**
3655   * Constant for fluent queries to be used to add include statements. Specifies
3656   * the path value of "<b>MeasureReport:evaluated-resource</b>".
3657   */
3658  public static final ca.uhn.fhir.model.api.Include INCLUDE_EVALUATED_RESOURCE = new ca.uhn.fhir.model.api.Include(
3659      "MeasureReport:evaluated-resource").toLocked();
3660
3661}