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