001package org.hl7.fhir.dstu3.model;
002
003
004
005
006import java.math.BigDecimal;
007
008/*
009  Copyright (c) 2011+, HL7, Inc.
010  All rights reserved.
011  
012  Redistribution and use in source and binary forms, with or without modification, 
013  are permitted provided that the following conditions are met:
014  
015   * Redistributions of source code must retain the above copyright notice, this 
016     list of conditions and the following disclaimer.
017   * Redistributions in binary form must reproduce the above copyright notice, 
018     this list of conditions and the following disclaimer in the documentation 
019     and/or other materials provided with the distribution.
020   * Neither the name of HL7 nor the names of its contributors may be used to 
021     endorse or promote products derived from this software without specific 
022     prior written permission.
023  
024  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
025  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
026  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
027  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
028  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
029  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
030  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
031  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
032  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
033  POSSIBILITY OF SUCH DAMAGE.
034  
035*/
036
037// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
038import java.util.ArrayList;
039import java.util.Date;
040import java.util.List;
041
042import org.hl7.fhir.exceptions.FHIRException;
043import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
044
045import ca.uhn.fhir.model.api.annotation.Block;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.ResourceDef;
049import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
050/**
051 * The MeasureReport resource contains the results of evaluating a measure.
052 */
053@ResourceDef(name="MeasureReport", profile="http://hl7.org/fhir/Profile/MeasureReport")
054public class MeasureReport extends DomainResource {
055
056    public enum MeasureReportStatus {
057        /**
058         * The report is complete and ready for use
059         */
060        COMPLETE, 
061        /**
062         * The report is currently being generated
063         */
064        PENDING, 
065        /**
066         * An error occurred attempting to generate the report
067         */
068        ERROR, 
069        /**
070         * added to help the parsers with the generic types
071         */
072        NULL;
073        public static MeasureReportStatus fromCode(String codeString) throws FHIRException {
074            if (codeString == null || "".equals(codeString))
075                return null;
076        if ("complete".equals(codeString))
077          return COMPLETE;
078        if ("pending".equals(codeString))
079          return PENDING;
080        if ("error".equals(codeString))
081          return ERROR;
082        if (Configuration.isAcceptInvalidEnums())
083          return null;
084        else
085          throw new FHIRException("Unknown MeasureReportStatus code '"+codeString+"'");
086        }
087        public String toCode() {
088          switch (this) {
089            case COMPLETE: return "complete";
090            case PENDING: return "pending";
091            case ERROR: return "error";
092            case NULL: return null;
093            default: return "?";
094          }
095        }
096        public String getSystem() {
097          switch (this) {
098            case COMPLETE: return "http://hl7.org/fhir/measure-report-status";
099            case PENDING: return "http://hl7.org/fhir/measure-report-status";
100            case ERROR: return "http://hl7.org/fhir/measure-report-status";
101            case NULL: return null;
102            default: return "?";
103          }
104        }
105        public String getDefinition() {
106          switch (this) {
107            case COMPLETE: return "The report is complete and ready for use";
108            case PENDING: return "The report is currently being generated";
109            case ERROR: return "An error occurred attempting to generate the report";
110            case NULL: return null;
111            default: return "?";
112          }
113        }
114        public String getDisplay() {
115          switch (this) {
116            case COMPLETE: return "Complete";
117            case PENDING: return "Pending";
118            case ERROR: return "Error";
119            case NULL: return null;
120            default: return "?";
121          }
122        }
123    }
124
125  public static class MeasureReportStatusEnumFactory implements EnumFactory<MeasureReportStatus> {
126    public MeasureReportStatus fromCode(String codeString) throws IllegalArgumentException {
127      if (codeString == null || "".equals(codeString))
128            if (codeString == null || "".equals(codeString))
129                return null;
130        if ("complete".equals(codeString))
131          return MeasureReportStatus.COMPLETE;
132        if ("pending".equals(codeString))
133          return MeasureReportStatus.PENDING;
134        if ("error".equals(codeString))
135          return MeasureReportStatus.ERROR;
136        throw new IllegalArgumentException("Unknown MeasureReportStatus code '"+codeString+"'");
137        }
138        public Enumeration<MeasureReportStatus> fromType(Base code) throws FHIRException {
139          if (code == null)
140            return null;
141          if (code.isEmpty())
142            return new Enumeration<MeasureReportStatus>(this);
143          String codeString = ((PrimitiveType) code).asStringValue();
144          if (codeString == null || "".equals(codeString))
145            return null;
146        if ("complete".equals(codeString))
147          return new Enumeration<MeasureReportStatus>(this, MeasureReportStatus.COMPLETE);
148        if ("pending".equals(codeString))
149          return new Enumeration<MeasureReportStatus>(this, MeasureReportStatus.PENDING);
150        if ("error".equals(codeString))
151          return new Enumeration<MeasureReportStatus>(this, MeasureReportStatus.ERROR);
152        throw new FHIRException("Unknown MeasureReportStatus code '"+codeString+"'");
153        }
154    public String toCode(MeasureReportStatus code) {
155      if (code == MeasureReportStatus.COMPLETE)
156        return "complete";
157      if (code == MeasureReportStatus.PENDING)
158        return "pending";
159      if (code == MeasureReportStatus.ERROR)
160        return "error";
161      return "?";
162      }
163    public String toSystem(MeasureReportStatus code) {
164      return code.getSystem();
165      }
166    }
167
168    public enum MeasureReportType {
169        /**
170         * An individual report that provides information on the performance for a given measure with respect to a single patient
171         */
172        INDIVIDUAL, 
173        /**
174         * A patient list report that includes a listing of patients that satisfied each population criteria in the measure
175         */
176        PATIENTLIST, 
177        /**
178         * A summary report that returns the number of patients in each population criteria for the measure
179         */
180        SUMMARY, 
181        /**
182         * added to help the parsers with the generic types
183         */
184        NULL;
185        public static MeasureReportType fromCode(String codeString) throws FHIRException {
186            if (codeString == null || "".equals(codeString))
187                return null;
188        if ("individual".equals(codeString))
189          return INDIVIDUAL;
190        if ("patient-list".equals(codeString))
191          return PATIENTLIST;
192        if ("summary".equals(codeString))
193          return SUMMARY;
194        if (Configuration.isAcceptInvalidEnums())
195          return null;
196        else
197          throw new FHIRException("Unknown MeasureReportType code '"+codeString+"'");
198        }
199        public String toCode() {
200          switch (this) {
201            case INDIVIDUAL: return "individual";
202            case PATIENTLIST: return "patient-list";
203            case SUMMARY: return "summary";
204            case NULL: return null;
205            default: return "?";
206          }
207        }
208        public String getSystem() {
209          switch (this) {
210            case INDIVIDUAL: return "http://hl7.org/fhir/measure-report-type";
211            case PATIENTLIST: return "http://hl7.org/fhir/measure-report-type";
212            case SUMMARY: return "http://hl7.org/fhir/measure-report-type";
213            case NULL: return null;
214            default: return "?";
215          }
216        }
217        public String getDefinition() {
218          switch (this) {
219            case INDIVIDUAL: return "An individual report that provides information on the performance for a given measure with respect to a single patient";
220            case PATIENTLIST: return "A patient list report that includes a listing of patients that satisfied each population criteria in the measure";
221            case SUMMARY: return "A summary report that returns the number of patients in each population criteria for the measure";
222            case NULL: return null;
223            default: return "?";
224          }
225        }
226        public String getDisplay() {
227          switch (this) {
228            case INDIVIDUAL: return "Individual";
229            case PATIENTLIST: return "Patient List";
230            case SUMMARY: return "Summary";
231            case NULL: return null;
232            default: return "?";
233          }
234        }
235    }
236
237  public static class MeasureReportTypeEnumFactory implements EnumFactory<MeasureReportType> {
238    public MeasureReportType fromCode(String codeString) throws IllegalArgumentException {
239      if (codeString == null || "".equals(codeString))
240            if (codeString == null || "".equals(codeString))
241                return null;
242        if ("individual".equals(codeString))
243          return MeasureReportType.INDIVIDUAL;
244        if ("patient-list".equals(codeString))
245          return MeasureReportType.PATIENTLIST;
246        if ("summary".equals(codeString))
247          return MeasureReportType.SUMMARY;
248        throw new IllegalArgumentException("Unknown MeasureReportType code '"+codeString+"'");
249        }
250        public Enumeration<MeasureReportType> fromType(Base code) throws FHIRException {
251          if (code == null)
252            return null;
253          if (code.isEmpty())
254            return new Enumeration<MeasureReportType>(this);
255          String codeString = ((PrimitiveType) code).asStringValue();
256          if (codeString == null || "".equals(codeString))
257            return null;
258        if ("individual".equals(codeString))
259          return new Enumeration<MeasureReportType>(this, MeasureReportType.INDIVIDUAL);
260        if ("patient-list".equals(codeString))
261          return new Enumeration<MeasureReportType>(this, MeasureReportType.PATIENTLIST);
262        if ("summary".equals(codeString))
263          return new Enumeration<MeasureReportType>(this, MeasureReportType.SUMMARY);
264        throw new FHIRException("Unknown MeasureReportType code '"+codeString+"'");
265        }
266    public String toCode(MeasureReportType code) {
267      if (code == MeasureReportType.INDIVIDUAL)
268        return "individual";
269      if (code == MeasureReportType.PATIENTLIST)
270        return "patient-list";
271      if (code == MeasureReportType.SUMMARY)
272        return "summary";
273      return "?";
274      }
275    public String toSystem(MeasureReportType code) {
276      return code.getSystem();
277      }
278    }
279
280    @Block()
281    public static class MeasureReportGroupComponent extends BackboneElement implements IBaseBackboneElement {
282        /**
283         * The identifier of the population group as defined in the measure definition.
284         */
285        @Child(name = "identifier", type = {Identifier.class}, order=1, min=1, max=1, modifier=false, summary=false)
286        @Description(shortDefinition="What group of the measure", formalDefinition="The identifier of the population group as defined in the measure definition." )
287        protected Identifier identifier;
288
289        /**
290         * The populations that make up the population group, one for each type of population appropriate for the measure.
291         */
292        @Child(name = "population", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
293        @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." )
294        protected List<MeasureReportGroupPopulationComponent> population;
295
296        /**
297         * 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.
298         */
299        @Child(name = "measureScore", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
300        @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." )
301        protected DecimalType measureScore;
302
303        /**
304         * When a measure includes multiple stratifiers, there will be a stratifier group for each stratifier defined by the measure.
305         */
306        @Child(name = "stratifier", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
307        @Description(shortDefinition="Stratification results", formalDefinition="When a measure includes multiple stratifiers, there will be a stratifier group for each stratifier defined by the measure." )
308        protected List<MeasureReportGroupStratifierComponent> stratifier;
309
310        private static final long serialVersionUID = 1520236061L;
311
312    /**
313     * Constructor
314     */
315      public MeasureReportGroupComponent() {
316        super();
317      }
318
319    /**
320     * Constructor
321     */
322      public MeasureReportGroupComponent(Identifier identifier) {
323        super();
324        this.identifier = identifier;
325      }
326
327        /**
328         * @return {@link #identifier} (The identifier of the population group as defined in the measure definition.)
329         */
330        public Identifier getIdentifier() { 
331          if (this.identifier == null)
332            if (Configuration.errorOnAutoCreate())
333              throw new Error("Attempt to auto-create MeasureReportGroupComponent.identifier");
334            else if (Configuration.doAutoCreate())
335              this.identifier = new Identifier(); // cc
336          return this.identifier;
337        }
338
339        public boolean hasIdentifier() { 
340          return this.identifier != null && !this.identifier.isEmpty();
341        }
342
343        /**
344         * @param value {@link #identifier} (The identifier of the population group as defined in the measure definition.)
345         */
346        public MeasureReportGroupComponent setIdentifier(Identifier value)  { 
347          this.identifier = value;
348          return this;
349        }
350
351        /**
352         * @return {@link #population} (The populations that make up the population group, one for each type of population appropriate for the measure.)
353         */
354        public List<MeasureReportGroupPopulationComponent> getPopulation() { 
355          if (this.population == null)
356            this.population = new ArrayList<MeasureReportGroupPopulationComponent>();
357          return this.population;
358        }
359
360        /**
361         * @return Returns a reference to <code>this</code> for easy method chaining
362         */
363        public MeasureReportGroupComponent setPopulation(List<MeasureReportGroupPopulationComponent> thePopulation) { 
364          this.population = thePopulation;
365          return this;
366        }
367
368        public boolean hasPopulation() { 
369          if (this.population == null)
370            return false;
371          for (MeasureReportGroupPopulationComponent item : this.population)
372            if (!item.isEmpty())
373              return true;
374          return false;
375        }
376
377        public MeasureReportGroupPopulationComponent addPopulation() { //3
378          MeasureReportGroupPopulationComponent t = new MeasureReportGroupPopulationComponent();
379          if (this.population == null)
380            this.population = new ArrayList<MeasureReportGroupPopulationComponent>();
381          this.population.add(t);
382          return t;
383        }
384
385        public MeasureReportGroupComponent addPopulation(MeasureReportGroupPopulationComponent t) { //3
386          if (t == null)
387            return this;
388          if (this.population == null)
389            this.population = new ArrayList<MeasureReportGroupPopulationComponent>();
390          this.population.add(t);
391          return this;
392        }
393
394        /**
395         * @return The first repetition of repeating field {@link #population}, creating it if it does not already exist
396         */
397        public MeasureReportGroupPopulationComponent getPopulationFirstRep() { 
398          if (getPopulation().isEmpty()) {
399            addPopulation();
400          }
401          return getPopulation().get(0);
402        }
403
404        /**
405         * @return {@link #measureScore} (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.). This is the underlying object with id, value and extensions. The accessor "getMeasureScore" gives direct access to the value
406         */
407        public DecimalType getMeasureScoreElement() { 
408          if (this.measureScore == null)
409            if (Configuration.errorOnAutoCreate())
410              throw new Error("Attempt to auto-create MeasureReportGroupComponent.measureScore");
411            else if (Configuration.doAutoCreate())
412              this.measureScore = new DecimalType(); // bb
413          return this.measureScore;
414        }
415
416        public boolean hasMeasureScoreElement() { 
417          return this.measureScore != null && !this.measureScore.isEmpty();
418        }
419
420        public boolean hasMeasureScore() { 
421          return this.measureScore != null && !this.measureScore.isEmpty();
422        }
423
424        /**
425         * @param value {@link #measureScore} (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.). This is the underlying object with id, value and extensions. The accessor "getMeasureScore" gives direct access to the value
426         */
427        public MeasureReportGroupComponent setMeasureScoreElement(DecimalType value) { 
428          this.measureScore = value;
429          return this;
430        }
431
432        /**
433         * @return 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.
434         */
435        public BigDecimal getMeasureScore() { 
436          return this.measureScore == null ? null : this.measureScore.getValue();
437        }
438
439        /**
440         * @param value 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.
441         */
442        public MeasureReportGroupComponent setMeasureScore(BigDecimal value) { 
443          if (value == null)
444            this.measureScore = null;
445          else {
446            if (this.measureScore == null)
447              this.measureScore = new DecimalType();
448            this.measureScore.setValue(value);
449          }
450          return this;
451        }
452
453        /**
454         * @param value 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.
455         */
456        public MeasureReportGroupComponent setMeasureScore(long value) { 
457              this.measureScore = new DecimalType();
458            this.measureScore.setValue(value);
459          return this;
460        }
461
462        /**
463         * @param value 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.
464         */
465        public MeasureReportGroupComponent setMeasureScore(double value) { 
466              this.measureScore = new DecimalType();
467            this.measureScore.setValue(value);
468          return this;
469        }
470
471        /**
472         * @return {@link #stratifier} (When a measure includes multiple stratifiers, there will be a stratifier group for each stratifier defined by the measure.)
473         */
474        public List<MeasureReportGroupStratifierComponent> getStratifier() { 
475          if (this.stratifier == null)
476            this.stratifier = new ArrayList<MeasureReportGroupStratifierComponent>();
477          return this.stratifier;
478        }
479
480        /**
481         * @return Returns a reference to <code>this</code> for easy method chaining
482         */
483        public MeasureReportGroupComponent setStratifier(List<MeasureReportGroupStratifierComponent> theStratifier) { 
484          this.stratifier = theStratifier;
485          return this;
486        }
487
488        public boolean hasStratifier() { 
489          if (this.stratifier == null)
490            return false;
491          for (MeasureReportGroupStratifierComponent item : this.stratifier)
492            if (!item.isEmpty())
493              return true;
494          return false;
495        }
496
497        public MeasureReportGroupStratifierComponent addStratifier() { //3
498          MeasureReportGroupStratifierComponent t = new MeasureReportGroupStratifierComponent();
499          if (this.stratifier == null)
500            this.stratifier = new ArrayList<MeasureReportGroupStratifierComponent>();
501          this.stratifier.add(t);
502          return t;
503        }
504
505        public MeasureReportGroupComponent addStratifier(MeasureReportGroupStratifierComponent t) { //3
506          if (t == null)
507            return this;
508          if (this.stratifier == null)
509            this.stratifier = new ArrayList<MeasureReportGroupStratifierComponent>();
510          this.stratifier.add(t);
511          return this;
512        }
513
514        /**
515         * @return The first repetition of repeating field {@link #stratifier}, creating it if it does not already exist
516         */
517        public MeasureReportGroupStratifierComponent getStratifierFirstRep() { 
518          if (getStratifier().isEmpty()) {
519            addStratifier();
520          }
521          return getStratifier().get(0);
522        }
523
524        protected void listChildren(List<Property> children) {
525          super.listChildren(children);
526          children.add(new Property("identifier", "Identifier", "The identifier of the population group as defined in the measure definition.", 0, 1, identifier));
527          children.add(new Property("population", "", "The populations that make up the population group, one for each type of population appropriate for the measure.", 0, java.lang.Integer.MAX_VALUE, population));
528          children.add(new Property("measureScore", "decimal", "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.", 0, 1, measureScore));
529          children.add(new Property("stratifier", "", "When a measure includes multiple stratifiers, there will be a stratifier group for each stratifier defined by the measure.", 0, java.lang.Integer.MAX_VALUE, stratifier));
530        }
531
532        @Override
533        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
534          switch (_hash) {
535          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The identifier of the population group as defined in the measure definition.", 0, 1, identifier);
536          case -2023558323: /*population*/  return new Property("population", "", "The populations that make up the population group, one for each type of population appropriate for the measure.", 0, java.lang.Integer.MAX_VALUE, population);
537          case -386313260: /*measureScore*/  return new Property("measureScore", "decimal", "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.", 0, 1, measureScore);
538          case 90983669: /*stratifier*/  return new Property("stratifier", "", "When a measure includes multiple stratifiers, there will be a stratifier group for each stratifier defined by the measure.", 0, java.lang.Integer.MAX_VALUE, stratifier);
539          default: return super.getNamedProperty(_hash, _name, _checkValid);
540          }
541
542        }
543
544      @Override
545      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
546        switch (hash) {
547        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
548        case -2023558323: /*population*/ return this.population == null ? new Base[0] : this.population.toArray(new Base[this.population.size()]); // MeasureReportGroupPopulationComponent
549        case -386313260: /*measureScore*/ return this.measureScore == null ? new Base[0] : new Base[] {this.measureScore}; // DecimalType
550        case 90983669: /*stratifier*/ return this.stratifier == null ? new Base[0] : this.stratifier.toArray(new Base[this.stratifier.size()]); // MeasureReportGroupStratifierComponent
551        default: return super.getProperty(hash, name, checkValid);
552        }
553
554      }
555
556      @Override
557      public Base setProperty(int hash, String name, Base value) throws FHIRException {
558        switch (hash) {
559        case -1618432855: // identifier
560          this.identifier = castToIdentifier(value); // Identifier
561          return value;
562        case -2023558323: // population
563          this.getPopulation().add((MeasureReportGroupPopulationComponent) value); // MeasureReportGroupPopulationComponent
564          return value;
565        case -386313260: // measureScore
566          this.measureScore = castToDecimal(value); // DecimalType
567          return value;
568        case 90983669: // stratifier
569          this.getStratifier().add((MeasureReportGroupStratifierComponent) value); // MeasureReportGroupStratifierComponent
570          return value;
571        default: return super.setProperty(hash, name, value);
572        }
573
574      }
575
576      @Override
577      public Base setProperty(String name, Base value) throws FHIRException {
578        if (name.equals("identifier")) {
579          this.identifier = castToIdentifier(value); // Identifier
580        } else if (name.equals("population")) {
581          this.getPopulation().add((MeasureReportGroupPopulationComponent) value);
582        } else if (name.equals("measureScore")) {
583          this.measureScore = castToDecimal(value); // DecimalType
584        } else if (name.equals("stratifier")) {
585          this.getStratifier().add((MeasureReportGroupStratifierComponent) value);
586        } else
587          return super.setProperty(name, value);
588        return value;
589      }
590
591      @Override
592      public Base makeProperty(int hash, String name) throws FHIRException {
593        switch (hash) {
594        case -1618432855:  return getIdentifier(); 
595        case -2023558323:  return addPopulation(); 
596        case -386313260:  return getMeasureScoreElement();
597        case 90983669:  return addStratifier(); 
598        default: return super.makeProperty(hash, name);
599        }
600
601      }
602
603      @Override
604      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
605        switch (hash) {
606        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
607        case -2023558323: /*population*/ return new String[] {};
608        case -386313260: /*measureScore*/ return new String[] {"decimal"};
609        case 90983669: /*stratifier*/ return new String[] {};
610        default: return super.getTypesForProperty(hash, name);
611        }
612
613      }
614
615      @Override
616      public Base addChild(String name) throws FHIRException {
617        if (name.equals("identifier")) {
618          this.identifier = new Identifier();
619          return this.identifier;
620        }
621        else if (name.equals("population")) {
622          return addPopulation();
623        }
624        else if (name.equals("measureScore")) {
625          throw new FHIRException("Cannot call addChild on a primitive type MeasureReport.measureScore");
626        }
627        else if (name.equals("stratifier")) {
628          return addStratifier();
629        }
630        else
631          return super.addChild(name);
632      }
633
634      public MeasureReportGroupComponent copy() {
635        MeasureReportGroupComponent dst = new MeasureReportGroupComponent();
636        copyValues(dst);
637        dst.identifier = identifier == null ? null : identifier.copy();
638        if (population != null) {
639          dst.population = new ArrayList<MeasureReportGroupPopulationComponent>();
640          for (MeasureReportGroupPopulationComponent i : population)
641            dst.population.add(i.copy());
642        };
643        dst.measureScore = measureScore == null ? null : measureScore.copy();
644        if (stratifier != null) {
645          dst.stratifier = new ArrayList<MeasureReportGroupStratifierComponent>();
646          for (MeasureReportGroupStratifierComponent i : stratifier)
647            dst.stratifier.add(i.copy());
648        };
649        return dst;
650      }
651
652      @Override
653      public boolean equalsDeep(Base other_) {
654        if (!super.equalsDeep(other_))
655          return false;
656        if (!(other_ instanceof MeasureReportGroupComponent))
657          return false;
658        MeasureReportGroupComponent o = (MeasureReportGroupComponent) other_;
659        return compareDeep(identifier, o.identifier, true) && compareDeep(population, o.population, true)
660           && compareDeep(measureScore, o.measureScore, true) && compareDeep(stratifier, o.stratifier, true)
661          ;
662      }
663
664      @Override
665      public boolean equalsShallow(Base other_) {
666        if (!super.equalsShallow(other_))
667          return false;
668        if (!(other_ instanceof MeasureReportGroupComponent))
669          return false;
670        MeasureReportGroupComponent o = (MeasureReportGroupComponent) other_;
671        return compareValues(measureScore, o.measureScore, true);
672      }
673
674      public boolean isEmpty() {
675        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, population, measureScore
676          , stratifier);
677      }
678
679  public String fhirType() {
680    return "MeasureReport.group";
681
682  }
683
684  }
685
686    @Block()
687    public static class MeasureReportGroupPopulationComponent extends BackboneElement implements IBaseBackboneElement {
688        /**
689         * The identifier of the population being reported, as defined by the population element of the measure.
690         */
691        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
692        @Description(shortDefinition="Population identifier as defined in the measure", formalDefinition="The identifier of the population being reported, as defined by the population element of the measure." )
693        protected Identifier identifier;
694
695        /**
696         * The type of the population.
697         */
698        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
699        @Description(shortDefinition="initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-score", formalDefinition="The type of the population." )
700        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/measure-population")
701        protected CodeableConcept code;
702
703        /**
704         * The number of members of the population.
705         */
706        @Child(name = "count", type = {IntegerType.class}, order=3, min=0, max=1, modifier=false, summary=false)
707        @Description(shortDefinition="Size of the population", formalDefinition="The number of members of the population." )
708        protected IntegerType count;
709
710        /**
711         * This element refers to a List of patient level MeasureReport resources, one for each patient in this population.
712         */
713        @Child(name = "patients", type = {ListResource.class}, order=4, min=0, max=1, modifier=false, summary=false)
714        @Description(shortDefinition="For patient-list reports, the patients in this population", formalDefinition="This element refers to a List of patient level MeasureReport resources, one for each patient in this population." )
715        protected Reference patients;
716
717        /**
718         * The actual object that is the target of the reference (This element refers to a List of patient level MeasureReport resources, one for each patient in this population.)
719         */
720        protected ListResource patientsTarget;
721
722        private static final long serialVersionUID = -1122075225L;
723
724    /**
725     * Constructor
726     */
727      public MeasureReportGroupPopulationComponent() {
728        super();
729      }
730
731        /**
732         * @return {@link #identifier} (The identifier of the population being reported, as defined by the population element of the measure.)
733         */
734        public Identifier getIdentifier() { 
735          if (this.identifier == null)
736            if (Configuration.errorOnAutoCreate())
737              throw new Error("Attempt to auto-create MeasureReportGroupPopulationComponent.identifier");
738            else if (Configuration.doAutoCreate())
739              this.identifier = new Identifier(); // cc
740          return this.identifier;
741        }
742
743        public boolean hasIdentifier() { 
744          return this.identifier != null && !this.identifier.isEmpty();
745        }
746
747        /**
748         * @param value {@link #identifier} (The identifier of the population being reported, as defined by the population element of the measure.)
749         */
750        public MeasureReportGroupPopulationComponent setIdentifier(Identifier value)  { 
751          this.identifier = value;
752          return this;
753        }
754
755        /**
756         * @return {@link #code} (The type of the population.)
757         */
758        public CodeableConcept getCode() { 
759          if (this.code == null)
760            if (Configuration.errorOnAutoCreate())
761              throw new Error("Attempt to auto-create MeasureReportGroupPopulationComponent.code");
762            else if (Configuration.doAutoCreate())
763              this.code = new CodeableConcept(); // cc
764          return this.code;
765        }
766
767        public boolean hasCode() { 
768          return this.code != null && !this.code.isEmpty();
769        }
770
771        /**
772         * @param value {@link #code} (The type of the population.)
773         */
774        public MeasureReportGroupPopulationComponent setCode(CodeableConcept value)  { 
775          this.code = value;
776          return this;
777        }
778
779        /**
780         * @return {@link #count} (The number of members of the population.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
781         */
782        public IntegerType getCountElement() { 
783          if (this.count == null)
784            if (Configuration.errorOnAutoCreate())
785              throw new Error("Attempt to auto-create MeasureReportGroupPopulationComponent.count");
786            else if (Configuration.doAutoCreate())
787              this.count = new IntegerType(); // bb
788          return this.count;
789        }
790
791        public boolean hasCountElement() { 
792          return this.count != null && !this.count.isEmpty();
793        }
794
795        public boolean hasCount() { 
796          return this.count != null && !this.count.isEmpty();
797        }
798
799        /**
800         * @param value {@link #count} (The number of members of the population.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
801         */
802        public MeasureReportGroupPopulationComponent setCountElement(IntegerType value) { 
803          this.count = value;
804          return this;
805        }
806
807        /**
808         * @return The number of members of the population.
809         */
810        public int getCount() { 
811          return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue();
812        }
813
814        /**
815         * @param value The number of members of the population.
816         */
817        public MeasureReportGroupPopulationComponent setCount(int value) { 
818            if (this.count == null)
819              this.count = new IntegerType();
820            this.count.setValue(value);
821          return this;
822        }
823
824        /**
825         * @return {@link #patients} (This element refers to a List of patient level MeasureReport resources, one for each patient in this population.)
826         */
827        public Reference getPatients() { 
828          if (this.patients == null)
829            if (Configuration.errorOnAutoCreate())
830              throw new Error("Attempt to auto-create MeasureReportGroupPopulationComponent.patients");
831            else if (Configuration.doAutoCreate())
832              this.patients = new Reference(); // cc
833          return this.patients;
834        }
835
836        public boolean hasPatients() { 
837          return this.patients != null && !this.patients.isEmpty();
838        }
839
840        /**
841         * @param value {@link #patients} (This element refers to a List of patient level MeasureReport resources, one for each patient in this population.)
842         */
843        public MeasureReportGroupPopulationComponent setPatients(Reference value)  { 
844          this.patients = value;
845          return this;
846        }
847
848        /**
849         * @return {@link #patients} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (This element refers to a List of patient level MeasureReport resources, one for each patient in this population.)
850         */
851        public ListResource getPatientsTarget() { 
852          if (this.patientsTarget == null)
853            if (Configuration.errorOnAutoCreate())
854              throw new Error("Attempt to auto-create MeasureReportGroupPopulationComponent.patients");
855            else if (Configuration.doAutoCreate())
856              this.patientsTarget = new ListResource(); // aa
857          return this.patientsTarget;
858        }
859
860        /**
861         * @param value {@link #patients} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (This element refers to a List of patient level MeasureReport resources, one for each patient in this population.)
862         */
863        public MeasureReportGroupPopulationComponent setPatientsTarget(ListResource value) { 
864          this.patientsTarget = value;
865          return this;
866        }
867
868        protected void listChildren(List<Property> children) {
869          super.listChildren(children);
870          children.add(new Property("identifier", "Identifier", "The identifier of the population being reported, as defined by the population element of the measure.", 0, 1, identifier));
871          children.add(new Property("code", "CodeableConcept", "The type of the population.", 0, 1, code));
872          children.add(new Property("count", "integer", "The number of members of the population.", 0, 1, count));
873          children.add(new Property("patients", "Reference(List)", "This element refers to a List of patient level MeasureReport resources, one for each patient in this population.", 0, 1, patients));
874        }
875
876        @Override
877        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
878          switch (_hash) {
879          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The identifier of the population being reported, as defined by the population element of the measure.", 0, 1, identifier);
880          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "The type of the population.", 0, 1, code);
881          case 94851343: /*count*/  return new Property("count", "integer", "The number of members of the population.", 0, 1, count);
882          case 1235842574: /*patients*/  return new Property("patients", "Reference(List)", "This element refers to a List of patient level MeasureReport resources, one for each patient in this population.", 0, 1, patients);
883          default: return super.getNamedProperty(_hash, _name, _checkValid);
884          }
885
886        }
887
888      @Override
889      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
890        switch (hash) {
891        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
892        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
893        case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // IntegerType
894        case 1235842574: /*patients*/ return this.patients == null ? new Base[0] : new Base[] {this.patients}; // Reference
895        default: return super.getProperty(hash, name, checkValid);
896        }
897
898      }
899
900      @Override
901      public Base setProperty(int hash, String name, Base value) throws FHIRException {
902        switch (hash) {
903        case -1618432855: // identifier
904          this.identifier = castToIdentifier(value); // Identifier
905          return value;
906        case 3059181: // code
907          this.code = castToCodeableConcept(value); // CodeableConcept
908          return value;
909        case 94851343: // count
910          this.count = castToInteger(value); // IntegerType
911          return value;
912        case 1235842574: // patients
913          this.patients = castToReference(value); // Reference
914          return value;
915        default: return super.setProperty(hash, name, value);
916        }
917
918      }
919
920      @Override
921      public Base setProperty(String name, Base value) throws FHIRException {
922        if (name.equals("identifier")) {
923          this.identifier = castToIdentifier(value); // Identifier
924        } else if (name.equals("code")) {
925          this.code = castToCodeableConcept(value); // CodeableConcept
926        } else if (name.equals("count")) {
927          this.count = castToInteger(value); // IntegerType
928        } else if (name.equals("patients")) {
929          this.patients = castToReference(value); // Reference
930        } else
931          return super.setProperty(name, value);
932        return value;
933      }
934
935      @Override
936      public Base makeProperty(int hash, String name) throws FHIRException {
937        switch (hash) {
938        case -1618432855:  return getIdentifier(); 
939        case 3059181:  return getCode(); 
940        case 94851343:  return getCountElement();
941        case 1235842574:  return getPatients(); 
942        default: return super.makeProperty(hash, name);
943        }
944
945      }
946
947      @Override
948      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
949        switch (hash) {
950        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
951        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
952        case 94851343: /*count*/ return new String[] {"integer"};
953        case 1235842574: /*patients*/ return new String[] {"Reference"};
954        default: return super.getTypesForProperty(hash, name);
955        }
956
957      }
958
959      @Override
960      public Base addChild(String name) throws FHIRException {
961        if (name.equals("identifier")) {
962          this.identifier = new Identifier();
963          return this.identifier;
964        }
965        else if (name.equals("code")) {
966          this.code = new CodeableConcept();
967          return this.code;
968        }
969        else if (name.equals("count")) {
970          throw new FHIRException("Cannot call addChild on a primitive type MeasureReport.count");
971        }
972        else if (name.equals("patients")) {
973          this.patients = new Reference();
974          return this.patients;
975        }
976        else
977          return super.addChild(name);
978      }
979
980      public MeasureReportGroupPopulationComponent copy() {
981        MeasureReportGroupPopulationComponent dst = new MeasureReportGroupPopulationComponent();
982        copyValues(dst);
983        dst.identifier = identifier == null ? null : identifier.copy();
984        dst.code = code == null ? null : code.copy();
985        dst.count = count == null ? null : count.copy();
986        dst.patients = patients == null ? null : patients.copy();
987        return dst;
988      }
989
990      @Override
991      public boolean equalsDeep(Base other_) {
992        if (!super.equalsDeep(other_))
993          return false;
994        if (!(other_ instanceof MeasureReportGroupPopulationComponent))
995          return false;
996        MeasureReportGroupPopulationComponent o = (MeasureReportGroupPopulationComponent) other_;
997        return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(count, o.count, true)
998           && compareDeep(patients, o.patients, true);
999      }
1000
1001      @Override
1002      public boolean equalsShallow(Base other_) {
1003        if (!super.equalsShallow(other_))
1004          return false;
1005        if (!(other_ instanceof MeasureReportGroupPopulationComponent))
1006          return false;
1007        MeasureReportGroupPopulationComponent o = (MeasureReportGroupPopulationComponent) other_;
1008        return compareValues(count, o.count, true);
1009      }
1010
1011      public boolean isEmpty() {
1012        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, code, count
1013          , patients);
1014      }
1015
1016  public String fhirType() {
1017    return "MeasureReport.group.population";
1018
1019  }
1020
1021  }
1022
1023    @Block()
1024    public static class MeasureReportGroupStratifierComponent extends BackboneElement implements IBaseBackboneElement {
1025        /**
1026         * The identifier of this stratifier, as defined in the measure definition.
1027         */
1028        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=false)
1029        @Description(shortDefinition="What stratifier of the group", formalDefinition="The identifier of this stratifier, as defined in the measure definition." )
1030        protected Identifier identifier;
1031
1032        /**
1033         * 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.
1034         */
1035        @Child(name = "stratum", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1036        @Description(shortDefinition="Stratum results, one for each unique value in the stratifier", 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." )
1037        protected List<StratifierGroupComponent> stratum;
1038
1039        private static final long serialVersionUID = -1013521069L;
1040
1041    /**
1042     * Constructor
1043     */
1044      public MeasureReportGroupStratifierComponent() {
1045        super();
1046      }
1047
1048        /**
1049         * @return {@link #identifier} (The identifier of this stratifier, as defined in the measure definition.)
1050         */
1051        public Identifier getIdentifier() { 
1052          if (this.identifier == null)
1053            if (Configuration.errorOnAutoCreate())
1054              throw new Error("Attempt to auto-create MeasureReportGroupStratifierComponent.identifier");
1055            else if (Configuration.doAutoCreate())
1056              this.identifier = new Identifier(); // cc
1057          return this.identifier;
1058        }
1059
1060        public boolean hasIdentifier() { 
1061          return this.identifier != null && !this.identifier.isEmpty();
1062        }
1063
1064        /**
1065         * @param value {@link #identifier} (The identifier of this stratifier, as defined in the measure definition.)
1066         */
1067        public MeasureReportGroupStratifierComponent setIdentifier(Identifier value)  { 
1068          this.identifier = value;
1069          return this;
1070        }
1071
1072        /**
1073         * @return {@link #stratum} (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.)
1074         */
1075        public List<StratifierGroupComponent> getStratum() { 
1076          if (this.stratum == null)
1077            this.stratum = new ArrayList<StratifierGroupComponent>();
1078          return this.stratum;
1079        }
1080
1081        /**
1082         * @return Returns a reference to <code>this</code> for easy method chaining
1083         */
1084        public MeasureReportGroupStratifierComponent setStratum(List<StratifierGroupComponent> theStratum) { 
1085          this.stratum = theStratum;
1086          return this;
1087        }
1088
1089        public boolean hasStratum() { 
1090          if (this.stratum == null)
1091            return false;
1092          for (StratifierGroupComponent item : this.stratum)
1093            if (!item.isEmpty())
1094              return true;
1095          return false;
1096        }
1097
1098        public StratifierGroupComponent addStratum() { //3
1099          StratifierGroupComponent t = new StratifierGroupComponent();
1100          if (this.stratum == null)
1101            this.stratum = new ArrayList<StratifierGroupComponent>();
1102          this.stratum.add(t);
1103          return t;
1104        }
1105
1106        public MeasureReportGroupStratifierComponent addStratum(StratifierGroupComponent t) { //3
1107          if (t == null)
1108            return this;
1109          if (this.stratum == null)
1110            this.stratum = new ArrayList<StratifierGroupComponent>();
1111          this.stratum.add(t);
1112          return this;
1113        }
1114
1115        /**
1116         * @return The first repetition of repeating field {@link #stratum}, creating it if it does not already exist
1117         */
1118        public StratifierGroupComponent getStratumFirstRep() { 
1119          if (getStratum().isEmpty()) {
1120            addStratum();
1121          }
1122          return getStratum().get(0);
1123        }
1124
1125        protected void listChildren(List<Property> children) {
1126          super.listChildren(children);
1127          children.add(new Property("identifier", "Identifier", "The identifier of this stratifier, as defined in the measure definition.", 0, 1, identifier));
1128          children.add(new Property("stratum", "", "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.", 0, java.lang.Integer.MAX_VALUE, stratum));
1129        }
1130
1131        @Override
1132        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1133          switch (_hash) {
1134          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The identifier of this stratifier, as defined in the measure definition.", 0, 1, identifier);
1135          case -1881991236: /*stratum*/  return new Property("stratum", "", "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.", 0, java.lang.Integer.MAX_VALUE, stratum);
1136          default: return super.getNamedProperty(_hash, _name, _checkValid);
1137          }
1138
1139        }
1140
1141      @Override
1142      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1143        switch (hash) {
1144        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1145        case -1881991236: /*stratum*/ return this.stratum == null ? new Base[0] : this.stratum.toArray(new Base[this.stratum.size()]); // StratifierGroupComponent
1146        default: return super.getProperty(hash, name, checkValid);
1147        }
1148
1149      }
1150
1151      @Override
1152      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1153        switch (hash) {
1154        case -1618432855: // identifier
1155          this.identifier = castToIdentifier(value); // Identifier
1156          return value;
1157        case -1881991236: // stratum
1158          this.getStratum().add((StratifierGroupComponent) value); // StratifierGroupComponent
1159          return value;
1160        default: return super.setProperty(hash, name, value);
1161        }
1162
1163      }
1164
1165      @Override
1166      public Base setProperty(String name, Base value) throws FHIRException {
1167        if (name.equals("identifier")) {
1168          this.identifier = castToIdentifier(value); // Identifier
1169        } else if (name.equals("stratum")) {
1170          this.getStratum().add((StratifierGroupComponent) value);
1171        } else
1172          return super.setProperty(name, value);
1173        return value;
1174      }
1175
1176      @Override
1177      public Base makeProperty(int hash, String name) throws FHIRException {
1178        switch (hash) {
1179        case -1618432855:  return getIdentifier(); 
1180        case -1881991236:  return addStratum(); 
1181        default: return super.makeProperty(hash, name);
1182        }
1183
1184      }
1185
1186      @Override
1187      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1188        switch (hash) {
1189        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1190        case -1881991236: /*stratum*/ return new String[] {};
1191        default: return super.getTypesForProperty(hash, name);
1192        }
1193
1194      }
1195
1196      @Override
1197      public Base addChild(String name) throws FHIRException {
1198        if (name.equals("identifier")) {
1199          this.identifier = new Identifier();
1200          return this.identifier;
1201        }
1202        else if (name.equals("stratum")) {
1203          return addStratum();
1204        }
1205        else
1206          return super.addChild(name);
1207      }
1208
1209      public MeasureReportGroupStratifierComponent copy() {
1210        MeasureReportGroupStratifierComponent dst = new MeasureReportGroupStratifierComponent();
1211        copyValues(dst);
1212        dst.identifier = identifier == null ? null : identifier.copy();
1213        if (stratum != null) {
1214          dst.stratum = new ArrayList<StratifierGroupComponent>();
1215          for (StratifierGroupComponent i : stratum)
1216            dst.stratum.add(i.copy());
1217        };
1218        return dst;
1219      }
1220
1221      @Override
1222      public boolean equalsDeep(Base other_) {
1223        if (!super.equalsDeep(other_))
1224          return false;
1225        if (!(other_ instanceof MeasureReportGroupStratifierComponent))
1226          return false;
1227        MeasureReportGroupStratifierComponent o = (MeasureReportGroupStratifierComponent) other_;
1228        return compareDeep(identifier, o.identifier, true) && compareDeep(stratum, o.stratum, true);
1229      }
1230
1231      @Override
1232      public boolean equalsShallow(Base other_) {
1233        if (!super.equalsShallow(other_))
1234          return false;
1235        if (!(other_ instanceof MeasureReportGroupStratifierComponent))
1236          return false;
1237        MeasureReportGroupStratifierComponent o = (MeasureReportGroupStratifierComponent) other_;
1238        return true;
1239      }
1240
1241      public boolean isEmpty() {
1242        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, stratum);
1243      }
1244
1245  public String fhirType() {
1246    return "MeasureReport.group.stratifier";
1247
1248  }
1249
1250  }
1251
1252    @Block()
1253    public static class StratifierGroupComponent extends BackboneElement implements IBaseBackboneElement {
1254        /**
1255         * The value for this stratum, expressed as a string. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.
1256         */
1257        @Child(name = "value", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1258        @Description(shortDefinition="The stratum value, e.g. male", formalDefinition="The value for this stratum, expressed as a string. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique." )
1259        protected StringType value;
1260
1261        /**
1262         * The populations that make up the stratum, one for each type of population appropriate to the measure.
1263         */
1264        @Child(name = "population", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1265        @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." )
1266        protected List<StratifierGroupPopulationComponent> population;
1267
1268        /**
1269         * 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.
1270         */
1271        @Child(name = "measureScore", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1272        @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." )
1273        protected DecimalType measureScore;
1274
1275        private static final long serialVersionUID = -772356228L;
1276
1277    /**
1278     * Constructor
1279     */
1280      public StratifierGroupComponent() {
1281        super();
1282      }
1283
1284    /**
1285     * Constructor
1286     */
1287      public StratifierGroupComponent(StringType value) {
1288        super();
1289        this.value = value;
1290      }
1291
1292        /**
1293         * @return {@link #value} (The value for this stratum, expressed as a string. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1294         */
1295        public StringType getValueElement() { 
1296          if (this.value == null)
1297            if (Configuration.errorOnAutoCreate())
1298              throw new Error("Attempt to auto-create StratifierGroupComponent.value");
1299            else if (Configuration.doAutoCreate())
1300              this.value = new StringType(); // bb
1301          return this.value;
1302        }
1303
1304        public boolean hasValueElement() { 
1305          return this.value != null && !this.value.isEmpty();
1306        }
1307
1308        public boolean hasValue() { 
1309          return this.value != null && !this.value.isEmpty();
1310        }
1311
1312        /**
1313         * @param value {@link #value} (The value for this stratum, expressed as a string. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1314         */
1315        public StratifierGroupComponent setValueElement(StringType value) { 
1316          this.value = value;
1317          return this;
1318        }
1319
1320        /**
1321         * @return The value for this stratum, expressed as a string. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.
1322         */
1323        public String getValue() { 
1324          return this.value == null ? null : this.value.getValue();
1325        }
1326
1327        /**
1328         * @param value The value for this stratum, expressed as a string. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.
1329         */
1330        public StratifierGroupComponent setValue(String value) { 
1331            if (this.value == null)
1332              this.value = new StringType();
1333            this.value.setValue(value);
1334          return this;
1335        }
1336
1337        /**
1338         * @return {@link #population} (The populations that make up the stratum, one for each type of population appropriate to the measure.)
1339         */
1340        public List<StratifierGroupPopulationComponent> getPopulation() { 
1341          if (this.population == null)
1342            this.population = new ArrayList<StratifierGroupPopulationComponent>();
1343          return this.population;
1344        }
1345
1346        /**
1347         * @return Returns a reference to <code>this</code> for easy method chaining
1348         */
1349        public StratifierGroupComponent setPopulation(List<StratifierGroupPopulationComponent> thePopulation) { 
1350          this.population = thePopulation;
1351          return this;
1352        }
1353
1354        public boolean hasPopulation() { 
1355          if (this.population == null)
1356            return false;
1357          for (StratifierGroupPopulationComponent item : this.population)
1358            if (!item.isEmpty())
1359              return true;
1360          return false;
1361        }
1362
1363        public StratifierGroupPopulationComponent addPopulation() { //3
1364          StratifierGroupPopulationComponent t = new StratifierGroupPopulationComponent();
1365          if (this.population == null)
1366            this.population = new ArrayList<StratifierGroupPopulationComponent>();
1367          this.population.add(t);
1368          return t;
1369        }
1370
1371        public StratifierGroupComponent addPopulation(StratifierGroupPopulationComponent t) { //3
1372          if (t == null)
1373            return this;
1374          if (this.population == null)
1375            this.population = new ArrayList<StratifierGroupPopulationComponent>();
1376          this.population.add(t);
1377          return this;
1378        }
1379
1380        /**
1381         * @return The first repetition of repeating field {@link #population}, creating it if it does not already exist
1382         */
1383        public StratifierGroupPopulationComponent getPopulationFirstRep() { 
1384          if (getPopulation().isEmpty()) {
1385            addPopulation();
1386          }
1387          return getPopulation().get(0);
1388        }
1389
1390        /**
1391         * @return {@link #measureScore} (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.). This is the underlying object with id, value and extensions. The accessor "getMeasureScore" gives direct access to the value
1392         */
1393        public DecimalType getMeasureScoreElement() { 
1394          if (this.measureScore == null)
1395            if (Configuration.errorOnAutoCreate())
1396              throw new Error("Attempt to auto-create StratifierGroupComponent.measureScore");
1397            else if (Configuration.doAutoCreate())
1398              this.measureScore = new DecimalType(); // bb
1399          return this.measureScore;
1400        }
1401
1402        public boolean hasMeasureScoreElement() { 
1403          return this.measureScore != null && !this.measureScore.isEmpty();
1404        }
1405
1406        public boolean hasMeasureScore() { 
1407          return this.measureScore != null && !this.measureScore.isEmpty();
1408        }
1409
1410        /**
1411         * @param value {@link #measureScore} (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.). This is the underlying object with id, value and extensions. The accessor "getMeasureScore" gives direct access to the value
1412         */
1413        public StratifierGroupComponent setMeasureScoreElement(DecimalType value) { 
1414          this.measureScore = value;
1415          return this;
1416        }
1417
1418        /**
1419         * @return 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.
1420         */
1421        public BigDecimal getMeasureScore() { 
1422          return this.measureScore == null ? null : this.measureScore.getValue();
1423        }
1424
1425        /**
1426         * @param value 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.
1427         */
1428        public StratifierGroupComponent setMeasureScore(BigDecimal value) { 
1429          if (value == null)
1430            this.measureScore = null;
1431          else {
1432            if (this.measureScore == null)
1433              this.measureScore = new DecimalType();
1434            this.measureScore.setValue(value);
1435          }
1436          return this;
1437        }
1438
1439        /**
1440         * @param value 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.
1441         */
1442        public StratifierGroupComponent setMeasureScore(long value) { 
1443              this.measureScore = new DecimalType();
1444            this.measureScore.setValue(value);
1445          return this;
1446        }
1447
1448        /**
1449         * @param value 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.
1450         */
1451        public StratifierGroupComponent setMeasureScore(double value) { 
1452              this.measureScore = new DecimalType();
1453            this.measureScore.setValue(value);
1454          return this;
1455        }
1456
1457        protected void listChildren(List<Property> children) {
1458          super.listChildren(children);
1459          children.add(new Property("value", "string", "The value for this stratum, expressed as a string. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.", 0, 1, value));
1460          children.add(new Property("population", "", "The populations that make up the stratum, one for each type of population appropriate to the measure.", 0, java.lang.Integer.MAX_VALUE, population));
1461          children.add(new Property("measureScore", "decimal", "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.", 0, 1, measureScore));
1462        }
1463
1464        @Override
1465        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1466          switch (_hash) {
1467          case 111972721: /*value*/  return new Property("value", "string", "The value for this stratum, expressed as a string. When defining stratifiers on complex values, the value must be rendered such that the value for each stratum within the stratifier is unique.", 0, 1, value);
1468          case -2023558323: /*population*/  return new Property("population", "", "The populations that make up the stratum, one for each type of population appropriate to the measure.", 0, java.lang.Integer.MAX_VALUE, population);
1469          case -386313260: /*measureScore*/  return new Property("measureScore", "decimal", "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.", 0, 1, measureScore);
1470          default: return super.getNamedProperty(_hash, _name, _checkValid);
1471          }
1472
1473        }
1474
1475      @Override
1476      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1477        switch (hash) {
1478        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
1479        case -2023558323: /*population*/ return this.population == null ? new Base[0] : this.population.toArray(new Base[this.population.size()]); // StratifierGroupPopulationComponent
1480        case -386313260: /*measureScore*/ return this.measureScore == null ? new Base[0] : new Base[] {this.measureScore}; // DecimalType
1481        default: return super.getProperty(hash, name, checkValid);
1482        }
1483
1484      }
1485
1486      @Override
1487      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1488        switch (hash) {
1489        case 111972721: // value
1490          this.value = castToString(value); // StringType
1491          return value;
1492        case -2023558323: // population
1493          this.getPopulation().add((StratifierGroupPopulationComponent) value); // StratifierGroupPopulationComponent
1494          return value;
1495        case -386313260: // measureScore
1496          this.measureScore = castToDecimal(value); // DecimalType
1497          return value;
1498        default: return super.setProperty(hash, name, value);
1499        }
1500
1501      }
1502
1503      @Override
1504      public Base setProperty(String name, Base value) throws FHIRException {
1505        if (name.equals("value")) {
1506          this.value = castToString(value); // StringType
1507        } else if (name.equals("population")) {
1508          this.getPopulation().add((StratifierGroupPopulationComponent) value);
1509        } else if (name.equals("measureScore")) {
1510          this.measureScore = castToDecimal(value); // DecimalType
1511        } else
1512          return super.setProperty(name, value);
1513        return value;
1514      }
1515
1516      @Override
1517      public Base makeProperty(int hash, String name) throws FHIRException {
1518        switch (hash) {
1519        case 111972721:  return getValueElement();
1520        case -2023558323:  return addPopulation(); 
1521        case -386313260:  return getMeasureScoreElement();
1522        default: return super.makeProperty(hash, name);
1523        }
1524
1525      }
1526
1527      @Override
1528      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1529        switch (hash) {
1530        case 111972721: /*value*/ return new String[] {"string"};
1531        case -2023558323: /*population*/ return new String[] {};
1532        case -386313260: /*measureScore*/ return new String[] {"decimal"};
1533        default: return super.getTypesForProperty(hash, name);
1534        }
1535
1536      }
1537
1538      @Override
1539      public Base addChild(String name) throws FHIRException {
1540        if (name.equals("value")) {
1541          throw new FHIRException("Cannot call addChild on a primitive type MeasureReport.value");
1542        }
1543        else if (name.equals("population")) {
1544          return addPopulation();
1545        }
1546        else if (name.equals("measureScore")) {
1547          throw new FHIRException("Cannot call addChild on a primitive type MeasureReport.measureScore");
1548        }
1549        else
1550          return super.addChild(name);
1551      }
1552
1553      public StratifierGroupComponent copy() {
1554        StratifierGroupComponent dst = new StratifierGroupComponent();
1555        copyValues(dst);
1556        dst.value = value == null ? null : value.copy();
1557        if (population != null) {
1558          dst.population = new ArrayList<StratifierGroupPopulationComponent>();
1559          for (StratifierGroupPopulationComponent i : population)
1560            dst.population.add(i.copy());
1561        };
1562        dst.measureScore = measureScore == null ? null : measureScore.copy();
1563        return dst;
1564      }
1565
1566      @Override
1567      public boolean equalsDeep(Base other_) {
1568        if (!super.equalsDeep(other_))
1569          return false;
1570        if (!(other_ instanceof StratifierGroupComponent))
1571          return false;
1572        StratifierGroupComponent o = (StratifierGroupComponent) other_;
1573        return compareDeep(value, o.value, true) && compareDeep(population, o.population, true) && compareDeep(measureScore, o.measureScore, true)
1574          ;
1575      }
1576
1577      @Override
1578      public boolean equalsShallow(Base other_) {
1579        if (!super.equalsShallow(other_))
1580          return false;
1581        if (!(other_ instanceof StratifierGroupComponent))
1582          return false;
1583        StratifierGroupComponent o = (StratifierGroupComponent) other_;
1584        return compareValues(value, o.value, true) && compareValues(measureScore, o.measureScore, true);
1585      }
1586
1587      public boolean isEmpty() {
1588        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(value, population, measureScore
1589          );
1590      }
1591
1592  public String fhirType() {
1593    return "MeasureReport.group.stratifier.stratum";
1594
1595  }
1596
1597  }
1598
1599    @Block()
1600    public static class StratifierGroupPopulationComponent extends BackboneElement implements IBaseBackboneElement {
1601        /**
1602         * The identifier of the population being reported, as defined by the population element of the measure.
1603         */
1604        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1605        @Description(shortDefinition="Population identifier as defined in the measure", formalDefinition="The identifier of the population being reported, as defined by the population element of the measure." )
1606        protected Identifier identifier;
1607
1608        /**
1609         * The type of the population.
1610         */
1611        @Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1612        @Description(shortDefinition="initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-score", formalDefinition="The type of the population." )
1613        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/measure-population")
1614        protected CodeableConcept code;
1615
1616        /**
1617         * The number of members of the population in this stratum.
1618         */
1619        @Child(name = "count", type = {IntegerType.class}, order=3, min=0, max=1, modifier=false, summary=false)
1620        @Description(shortDefinition="Size of the population", formalDefinition="The number of members of the population in this stratum." )
1621        protected IntegerType count;
1622
1623        /**
1624         * This element refers to a List of patient level MeasureReport resources, one for each patient in this population in this stratum.
1625         */
1626        @Child(name = "patients", type = {ListResource.class}, order=4, min=0, max=1, modifier=false, summary=false)
1627        @Description(shortDefinition="For patient-list reports, the patients in this population", formalDefinition="This element refers to a List of patient level MeasureReport resources, one for each patient in this population in this stratum." )
1628        protected Reference patients;
1629
1630        /**
1631         * The actual object that is the target of the reference (This element refers to a List of patient level MeasureReport resources, one for each patient in this population in this stratum.)
1632         */
1633        protected ListResource patientsTarget;
1634
1635        private static final long serialVersionUID = -1122075225L;
1636
1637    /**
1638     * Constructor
1639     */
1640      public StratifierGroupPopulationComponent() {
1641        super();
1642      }
1643
1644        /**
1645         * @return {@link #identifier} (The identifier of the population being reported, as defined by the population element of the measure.)
1646         */
1647        public Identifier getIdentifier() { 
1648          if (this.identifier == null)
1649            if (Configuration.errorOnAutoCreate())
1650              throw new Error("Attempt to auto-create StratifierGroupPopulationComponent.identifier");
1651            else if (Configuration.doAutoCreate())
1652              this.identifier = new Identifier(); // cc
1653          return this.identifier;
1654        }
1655
1656        public boolean hasIdentifier() { 
1657          return this.identifier != null && !this.identifier.isEmpty();
1658        }
1659
1660        /**
1661         * @param value {@link #identifier} (The identifier of the population being reported, as defined by the population element of the measure.)
1662         */
1663        public StratifierGroupPopulationComponent setIdentifier(Identifier value)  { 
1664          this.identifier = value;
1665          return this;
1666        }
1667
1668        /**
1669         * @return {@link #code} (The type of the population.)
1670         */
1671        public CodeableConcept getCode() { 
1672          if (this.code == null)
1673            if (Configuration.errorOnAutoCreate())
1674              throw new Error("Attempt to auto-create StratifierGroupPopulationComponent.code");
1675            else if (Configuration.doAutoCreate())
1676              this.code = new CodeableConcept(); // cc
1677          return this.code;
1678        }
1679
1680        public boolean hasCode() { 
1681          return this.code != null && !this.code.isEmpty();
1682        }
1683
1684        /**
1685         * @param value {@link #code} (The type of the population.)
1686         */
1687        public StratifierGroupPopulationComponent setCode(CodeableConcept value)  { 
1688          this.code = value;
1689          return this;
1690        }
1691
1692        /**
1693         * @return {@link #count} (The number of members of the population in this stratum.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
1694         */
1695        public IntegerType getCountElement() { 
1696          if (this.count == null)
1697            if (Configuration.errorOnAutoCreate())
1698              throw new Error("Attempt to auto-create StratifierGroupPopulationComponent.count");
1699            else if (Configuration.doAutoCreate())
1700              this.count = new IntegerType(); // bb
1701          return this.count;
1702        }
1703
1704        public boolean hasCountElement() { 
1705          return this.count != null && !this.count.isEmpty();
1706        }
1707
1708        public boolean hasCount() { 
1709          return this.count != null && !this.count.isEmpty();
1710        }
1711
1712        /**
1713         * @param value {@link #count} (The number of members of the population in this stratum.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
1714         */
1715        public StratifierGroupPopulationComponent setCountElement(IntegerType value) { 
1716          this.count = value;
1717          return this;
1718        }
1719
1720        /**
1721         * @return The number of members of the population in this stratum.
1722         */
1723        public int getCount() { 
1724          return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue();
1725        }
1726
1727        /**
1728         * @param value The number of members of the population in this stratum.
1729         */
1730        public StratifierGroupPopulationComponent setCount(int value) { 
1731            if (this.count == null)
1732              this.count = new IntegerType();
1733            this.count.setValue(value);
1734          return this;
1735        }
1736
1737        /**
1738         * @return {@link #patients} (This element refers to a List of patient level MeasureReport resources, one for each patient in this population in this stratum.)
1739         */
1740        public Reference getPatients() { 
1741          if (this.patients == null)
1742            if (Configuration.errorOnAutoCreate())
1743              throw new Error("Attempt to auto-create StratifierGroupPopulationComponent.patients");
1744            else if (Configuration.doAutoCreate())
1745              this.patients = new Reference(); // cc
1746          return this.patients;
1747        }
1748
1749        public boolean hasPatients() { 
1750          return this.patients != null && !this.patients.isEmpty();
1751        }
1752
1753        /**
1754         * @param value {@link #patients} (This element refers to a List of patient level MeasureReport resources, one for each patient in this population in this stratum.)
1755         */
1756        public StratifierGroupPopulationComponent setPatients(Reference value)  { 
1757          this.patients = value;
1758          return this;
1759        }
1760
1761        /**
1762         * @return {@link #patients} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (This element refers to a List of patient level MeasureReport resources, one for each patient in this population in this stratum.)
1763         */
1764        public ListResource getPatientsTarget() { 
1765          if (this.patientsTarget == null)
1766            if (Configuration.errorOnAutoCreate())
1767              throw new Error("Attempt to auto-create StratifierGroupPopulationComponent.patients");
1768            else if (Configuration.doAutoCreate())
1769              this.patientsTarget = new ListResource(); // aa
1770          return this.patientsTarget;
1771        }
1772
1773        /**
1774         * @param value {@link #patients} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (This element refers to a List of patient level MeasureReport resources, one for each patient in this population in this stratum.)
1775         */
1776        public StratifierGroupPopulationComponent setPatientsTarget(ListResource value) { 
1777          this.patientsTarget = value;
1778          return this;
1779        }
1780
1781        protected void listChildren(List<Property> children) {
1782          super.listChildren(children);
1783          children.add(new Property("identifier", "Identifier", "The identifier of the population being reported, as defined by the population element of the measure.", 0, 1, identifier));
1784          children.add(new Property("code", "CodeableConcept", "The type of the population.", 0, 1, code));
1785          children.add(new Property("count", "integer", "The number of members of the population in this stratum.", 0, 1, count));
1786          children.add(new Property("patients", "Reference(List)", "This element refers to a List of patient level MeasureReport resources, one for each patient in this population in this stratum.", 0, 1, patients));
1787        }
1788
1789        @Override
1790        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1791          switch (_hash) {
1792          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The identifier of the population being reported, as defined by the population element of the measure.", 0, 1, identifier);
1793          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "The type of the population.", 0, 1, code);
1794          case 94851343: /*count*/  return new Property("count", "integer", "The number of members of the population in this stratum.", 0, 1, count);
1795          case 1235842574: /*patients*/  return new Property("patients", "Reference(List)", "This element refers to a List of patient level MeasureReport resources, one for each patient in this population in this stratum.", 0, 1, patients);
1796          default: return super.getNamedProperty(_hash, _name, _checkValid);
1797          }
1798
1799        }
1800
1801      @Override
1802      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1803        switch (hash) {
1804        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
1805        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
1806        case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // IntegerType
1807        case 1235842574: /*patients*/ return this.patients == null ? new Base[0] : new Base[] {this.patients}; // Reference
1808        default: return super.getProperty(hash, name, checkValid);
1809        }
1810
1811      }
1812
1813      @Override
1814      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1815        switch (hash) {
1816        case -1618432855: // identifier
1817          this.identifier = castToIdentifier(value); // Identifier
1818          return value;
1819        case 3059181: // code
1820          this.code = castToCodeableConcept(value); // CodeableConcept
1821          return value;
1822        case 94851343: // count
1823          this.count = castToInteger(value); // IntegerType
1824          return value;
1825        case 1235842574: // patients
1826          this.patients = castToReference(value); // Reference
1827          return value;
1828        default: return super.setProperty(hash, name, value);
1829        }
1830
1831      }
1832
1833      @Override
1834      public Base setProperty(String name, Base value) throws FHIRException {
1835        if (name.equals("identifier")) {
1836          this.identifier = castToIdentifier(value); // Identifier
1837        } else if (name.equals("code")) {
1838          this.code = castToCodeableConcept(value); // CodeableConcept
1839        } else if (name.equals("count")) {
1840          this.count = castToInteger(value); // IntegerType
1841        } else if (name.equals("patients")) {
1842          this.patients = castToReference(value); // Reference
1843        } else
1844          return super.setProperty(name, value);
1845        return value;
1846      }
1847
1848      @Override
1849      public Base makeProperty(int hash, String name) throws FHIRException {
1850        switch (hash) {
1851        case -1618432855:  return getIdentifier(); 
1852        case 3059181:  return getCode(); 
1853        case 94851343:  return getCountElement();
1854        case 1235842574:  return getPatients(); 
1855        default: return super.makeProperty(hash, name);
1856        }
1857
1858      }
1859
1860      @Override
1861      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1862        switch (hash) {
1863        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1864        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
1865        case 94851343: /*count*/ return new String[] {"integer"};
1866        case 1235842574: /*patients*/ return new String[] {"Reference"};
1867        default: return super.getTypesForProperty(hash, name);
1868        }
1869
1870      }
1871
1872      @Override
1873      public Base addChild(String name) throws FHIRException {
1874        if (name.equals("identifier")) {
1875          this.identifier = new Identifier();
1876          return this.identifier;
1877        }
1878        else if (name.equals("code")) {
1879          this.code = new CodeableConcept();
1880          return this.code;
1881        }
1882        else if (name.equals("count")) {
1883          throw new FHIRException("Cannot call addChild on a primitive type MeasureReport.count");
1884        }
1885        else if (name.equals("patients")) {
1886          this.patients = new Reference();
1887          return this.patients;
1888        }
1889        else
1890          return super.addChild(name);
1891      }
1892
1893      public StratifierGroupPopulationComponent copy() {
1894        StratifierGroupPopulationComponent dst = new StratifierGroupPopulationComponent();
1895        copyValues(dst);
1896        dst.identifier = identifier == null ? null : identifier.copy();
1897        dst.code = code == null ? null : code.copy();
1898        dst.count = count == null ? null : count.copy();
1899        dst.patients = patients == null ? null : patients.copy();
1900        return dst;
1901      }
1902
1903      @Override
1904      public boolean equalsDeep(Base other_) {
1905        if (!super.equalsDeep(other_))
1906          return false;
1907        if (!(other_ instanceof StratifierGroupPopulationComponent))
1908          return false;
1909        StratifierGroupPopulationComponent o = (StratifierGroupPopulationComponent) other_;
1910        return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(count, o.count, true)
1911           && compareDeep(patients, o.patients, true);
1912      }
1913
1914      @Override
1915      public boolean equalsShallow(Base other_) {
1916        if (!super.equalsShallow(other_))
1917          return false;
1918        if (!(other_ instanceof StratifierGroupPopulationComponent))
1919          return false;
1920        StratifierGroupPopulationComponent o = (StratifierGroupPopulationComponent) other_;
1921        return compareValues(count, o.count, true);
1922      }
1923
1924      public boolean isEmpty() {
1925        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, code, count
1926          , patients);
1927      }
1928
1929  public String fhirType() {
1930    return "MeasureReport.group.stratifier.stratum.population";
1931
1932  }
1933
1934  }
1935
1936    /**
1937     * A formal identifier that is used to identify this report when it is represented in other formats, or referenced in a specification, model, design or an instance.
1938     */
1939    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
1940    @Description(shortDefinition="Additional identifier for the Report", formalDefinition="A formal identifier that is used to identify this report when it is represented in other formats, or referenced in a specification, model, design or an instance." )
1941    protected Identifier identifier;
1942
1943    /**
1944     * The report status. No data will be available until the report status is complete.
1945     */
1946    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
1947    @Description(shortDefinition="complete | pending | error", formalDefinition="The report status. No data will be available until the report status is complete." )
1948    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/measure-report-status")
1949    protected Enumeration<MeasureReportStatus> status;
1950
1951    /**
1952     * The type of measure report. This may be an individual report, which provides a single patient's score for the measure; a patient listing, which returns the list of patients that meet the various criteria in the measure; or a summary report, which returns a population count for each of the criteria in the measure.
1953     */
1954    @Child(name = "type", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1955    @Description(shortDefinition="individual | patient-list | summary", formalDefinition="The type of measure report. This may be an individual report, which provides a single patient's score for the measure; a patient listing, which returns the list of patients that meet the various criteria in the measure; or a summary report, which returns a population count for each of the criteria in the measure." )
1956    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/measure-report-type")
1957    protected Enumeration<MeasureReportType> type;
1958
1959    /**
1960     * A reference to the Measure that was evaluated to produce this report.
1961     */
1962    @Child(name = "measure", type = {Measure.class}, order=3, min=1, max=1, modifier=false, summary=true)
1963    @Description(shortDefinition="What measure was evaluated", formalDefinition="A reference to the Measure that was evaluated to produce this report." )
1964    protected Reference measure;
1965
1966    /**
1967     * The actual object that is the target of the reference (A reference to the Measure that was evaluated to produce this report.)
1968     */
1969    protected Measure measureTarget;
1970
1971    /**
1972     * Optional Patient if the report was requested for a single patient.
1973     */
1974    @Child(name = "patient", type = {Patient.class}, order=4, min=0, max=1, modifier=false, summary=true)
1975    @Description(shortDefinition="What patient the report is for", formalDefinition="Optional Patient if the report was requested for a single patient." )
1976    protected Reference patient;
1977
1978    /**
1979     * The actual object that is the target of the reference (Optional Patient if the report was requested for a single patient.)
1980     */
1981    protected Patient patientTarget;
1982
1983    /**
1984     * The date this measure report was generated.
1985     */
1986    @Child(name = "date", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1987    @Description(shortDefinition="When the report was generated", formalDefinition="The date this measure report was generated." )
1988    protected DateTimeType date;
1989
1990    /**
1991     * Reporting Organization.
1992     */
1993    @Child(name = "reportingOrganization", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=true)
1994    @Description(shortDefinition="Who is reporting the data", formalDefinition="Reporting Organization." )
1995    protected Reference reportingOrganization;
1996
1997    /**
1998     * The actual object that is the target of the reference (Reporting Organization.)
1999     */
2000    protected Organization reportingOrganizationTarget;
2001
2002    /**
2003     * The reporting period for which the report was calculated.
2004     */
2005    @Child(name = "period", type = {Period.class}, order=7, min=1, max=1, modifier=false, summary=true)
2006    @Description(shortDefinition="What period the report covers", formalDefinition="The reporting period for which the report was calculated." )
2007    protected Period period;
2008
2009    /**
2010     * The results of the calculation, one for each population group in the measure.
2011     */
2012    @Child(name = "group", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2013    @Description(shortDefinition="Measure results for each group", formalDefinition="The results of the calculation, one for each population group in the measure." )
2014    protected List<MeasureReportGroupComponent> group;
2015
2016    /**
2017     * A reference to a Bundle containing the Resources that were used in the evaluation of this report.
2018     */
2019    @Child(name = "evaluatedResources", type = {Bundle.class}, order=9, min=0, max=1, modifier=false, summary=false)
2020    @Description(shortDefinition="What data was evaluated to produce the measure score", formalDefinition="A reference to a Bundle containing the Resources that were used in the evaluation of this report." )
2021    protected Reference evaluatedResources;
2022
2023    /**
2024     * The actual object that is the target of the reference (A reference to a Bundle containing the Resources that were used in the evaluation of this report.)
2025     */
2026    protected Bundle evaluatedResourcesTarget;
2027
2028    private static final long serialVersionUID = -1591529268L;
2029
2030  /**
2031   * Constructor
2032   */
2033    public MeasureReport() {
2034      super();
2035    }
2036
2037  /**
2038   * Constructor
2039   */
2040    public MeasureReport(Enumeration<MeasureReportStatus> status, Enumeration<MeasureReportType> type, Reference measure, Period period) {
2041      super();
2042      this.status = status;
2043      this.type = type;
2044      this.measure = measure;
2045      this.period = period;
2046    }
2047
2048    /**
2049     * @return {@link #identifier} (A formal identifier that is used to identify this report when it is represented in other formats, or referenced in a specification, model, design or an instance.)
2050     */
2051    public Identifier getIdentifier() { 
2052      if (this.identifier == null)
2053        if (Configuration.errorOnAutoCreate())
2054          throw new Error("Attempt to auto-create MeasureReport.identifier");
2055        else if (Configuration.doAutoCreate())
2056          this.identifier = new Identifier(); // cc
2057      return this.identifier;
2058    }
2059
2060    public boolean hasIdentifier() { 
2061      return this.identifier != null && !this.identifier.isEmpty();
2062    }
2063
2064    /**
2065     * @param value {@link #identifier} (A formal identifier that is used to identify this report when it is represented in other formats, or referenced in a specification, model, design or an instance.)
2066     */
2067    public MeasureReport setIdentifier(Identifier value)  { 
2068      this.identifier = value;
2069      return this;
2070    }
2071
2072    /**
2073     * @return {@link #status} (The report status. No data will be available until the report status is complete.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2074     */
2075    public Enumeration<MeasureReportStatus> getStatusElement() { 
2076      if (this.status == null)
2077        if (Configuration.errorOnAutoCreate())
2078          throw new Error("Attempt to auto-create MeasureReport.status");
2079        else if (Configuration.doAutoCreate())
2080          this.status = new Enumeration<MeasureReportStatus>(new MeasureReportStatusEnumFactory()); // bb
2081      return this.status;
2082    }
2083
2084    public boolean hasStatusElement() { 
2085      return this.status != null && !this.status.isEmpty();
2086    }
2087
2088    public boolean hasStatus() { 
2089      return this.status != null && !this.status.isEmpty();
2090    }
2091
2092    /**
2093     * @param value {@link #status} (The report status. No data will be available until the report status is complete.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
2094     */
2095    public MeasureReport setStatusElement(Enumeration<MeasureReportStatus> value) { 
2096      this.status = value;
2097      return this;
2098    }
2099
2100    /**
2101     * @return The report status. No data will be available until the report status is complete.
2102     */
2103    public MeasureReportStatus getStatus() { 
2104      return this.status == null ? null : this.status.getValue();
2105    }
2106
2107    /**
2108     * @param value The report status. No data will be available until the report status is complete.
2109     */
2110    public MeasureReport setStatus(MeasureReportStatus value) { 
2111        if (this.status == null)
2112          this.status = new Enumeration<MeasureReportStatus>(new MeasureReportStatusEnumFactory());
2113        this.status.setValue(value);
2114      return this;
2115    }
2116
2117    /**
2118     * @return {@link #type} (The type of measure report. This may be an individual report, which provides a single patient's score for the measure; a patient listing, which returns the list of patients that meet the various criteria in the measure; or a summary report, which returns a population count for each of the criteria in the measure.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
2119     */
2120    public Enumeration<MeasureReportType> getTypeElement() { 
2121      if (this.type == null)
2122        if (Configuration.errorOnAutoCreate())
2123          throw new Error("Attempt to auto-create MeasureReport.type");
2124        else if (Configuration.doAutoCreate())
2125          this.type = new Enumeration<MeasureReportType>(new MeasureReportTypeEnumFactory()); // bb
2126      return this.type;
2127    }
2128
2129    public boolean hasTypeElement() { 
2130      return this.type != null && !this.type.isEmpty();
2131    }
2132
2133    public boolean hasType() { 
2134      return this.type != null && !this.type.isEmpty();
2135    }
2136
2137    /**
2138     * @param value {@link #type} (The type of measure report. This may be an individual report, which provides a single patient's score for the measure; a patient listing, which returns the list of patients that meet the various criteria in the measure; or a summary report, which returns a population count for each of the criteria in the measure.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
2139     */
2140    public MeasureReport setTypeElement(Enumeration<MeasureReportType> value) { 
2141      this.type = value;
2142      return this;
2143    }
2144
2145    /**
2146     * @return The type of measure report. This may be an individual report, which provides a single patient's score for the measure; a patient listing, which returns the list of patients that meet the various criteria in the measure; or a summary report, which returns a population count for each of the criteria in the measure.
2147     */
2148    public MeasureReportType getType() { 
2149      return this.type == null ? null : this.type.getValue();
2150    }
2151
2152    /**
2153     * @param value The type of measure report. This may be an individual report, which provides a single patient's score for the measure; a patient listing, which returns the list of patients that meet the various criteria in the measure; or a summary report, which returns a population count for each of the criteria in the measure.
2154     */
2155    public MeasureReport setType(MeasureReportType value) { 
2156        if (this.type == null)
2157          this.type = new Enumeration<MeasureReportType>(new MeasureReportTypeEnumFactory());
2158        this.type.setValue(value);
2159      return this;
2160    }
2161
2162    /**
2163     * @return {@link #measure} (A reference to the Measure that was evaluated to produce this report.)
2164     */
2165    public Reference getMeasure() { 
2166      if (this.measure == null)
2167        if (Configuration.errorOnAutoCreate())
2168          throw new Error("Attempt to auto-create MeasureReport.measure");
2169        else if (Configuration.doAutoCreate())
2170          this.measure = new Reference(); // cc
2171      return this.measure;
2172    }
2173
2174    public boolean hasMeasure() { 
2175      return this.measure != null && !this.measure.isEmpty();
2176    }
2177
2178    /**
2179     * @param value {@link #measure} (A reference to the Measure that was evaluated to produce this report.)
2180     */
2181    public MeasureReport setMeasure(Reference value)  { 
2182      this.measure = value;
2183      return this;
2184    }
2185
2186    /**
2187     * @return {@link #measure} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to the Measure that was evaluated to produce this report.)
2188     */
2189    public Measure getMeasureTarget() { 
2190      if (this.measureTarget == null)
2191        if (Configuration.errorOnAutoCreate())
2192          throw new Error("Attempt to auto-create MeasureReport.measure");
2193        else if (Configuration.doAutoCreate())
2194          this.measureTarget = new Measure(); // aa
2195      return this.measureTarget;
2196    }
2197
2198    /**
2199     * @param value {@link #measure} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to the Measure that was evaluated to produce this report.)
2200     */
2201    public MeasureReport setMeasureTarget(Measure value) { 
2202      this.measureTarget = value;
2203      return this;
2204    }
2205
2206    /**
2207     * @return {@link #patient} (Optional Patient if the report was requested for a single patient.)
2208     */
2209    public Reference getPatient() { 
2210      if (this.patient == null)
2211        if (Configuration.errorOnAutoCreate())
2212          throw new Error("Attempt to auto-create MeasureReport.patient");
2213        else if (Configuration.doAutoCreate())
2214          this.patient = new Reference(); // cc
2215      return this.patient;
2216    }
2217
2218    public boolean hasPatient() { 
2219      return this.patient != null && !this.patient.isEmpty();
2220    }
2221
2222    /**
2223     * @param value {@link #patient} (Optional Patient if the report was requested for a single patient.)
2224     */
2225    public MeasureReport setPatient(Reference value)  { 
2226      this.patient = value;
2227      return this;
2228    }
2229
2230    /**
2231     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Optional Patient if the report was requested for a single patient.)
2232     */
2233    public Patient getPatientTarget() { 
2234      if (this.patientTarget == null)
2235        if (Configuration.errorOnAutoCreate())
2236          throw new Error("Attempt to auto-create MeasureReport.patient");
2237        else if (Configuration.doAutoCreate())
2238          this.patientTarget = new Patient(); // aa
2239      return this.patientTarget;
2240    }
2241
2242    /**
2243     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Optional Patient if the report was requested for a single patient.)
2244     */
2245    public MeasureReport setPatientTarget(Patient value) { 
2246      this.patientTarget = value;
2247      return this;
2248    }
2249
2250    /**
2251     * @return {@link #date} (The date this measure report was generated.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2252     */
2253    public DateTimeType getDateElement() { 
2254      if (this.date == null)
2255        if (Configuration.errorOnAutoCreate())
2256          throw new Error("Attempt to auto-create MeasureReport.date");
2257        else if (Configuration.doAutoCreate())
2258          this.date = new DateTimeType(); // bb
2259      return this.date;
2260    }
2261
2262    public boolean hasDateElement() { 
2263      return this.date != null && !this.date.isEmpty();
2264    }
2265
2266    public boolean hasDate() { 
2267      return this.date != null && !this.date.isEmpty();
2268    }
2269
2270    /**
2271     * @param value {@link #date} (The date this measure report was generated.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
2272     */
2273    public MeasureReport setDateElement(DateTimeType value) { 
2274      this.date = value;
2275      return this;
2276    }
2277
2278    /**
2279     * @return The date this measure report was generated.
2280     */
2281    public Date getDate() { 
2282      return this.date == null ? null : this.date.getValue();
2283    }
2284
2285    /**
2286     * @param value The date this measure report was generated.
2287     */
2288    public MeasureReport setDate(Date value) { 
2289      if (value == null)
2290        this.date = null;
2291      else {
2292        if (this.date == null)
2293          this.date = new DateTimeType();
2294        this.date.setValue(value);
2295      }
2296      return this;
2297    }
2298
2299    /**
2300     * @return {@link #reportingOrganization} (Reporting Organization.)
2301     */
2302    public Reference getReportingOrganization() { 
2303      if (this.reportingOrganization == null)
2304        if (Configuration.errorOnAutoCreate())
2305          throw new Error("Attempt to auto-create MeasureReport.reportingOrganization");
2306        else if (Configuration.doAutoCreate())
2307          this.reportingOrganization = new Reference(); // cc
2308      return this.reportingOrganization;
2309    }
2310
2311    public boolean hasReportingOrganization() { 
2312      return this.reportingOrganization != null && !this.reportingOrganization.isEmpty();
2313    }
2314
2315    /**
2316     * @param value {@link #reportingOrganization} (Reporting Organization.)
2317     */
2318    public MeasureReport setReportingOrganization(Reference value)  { 
2319      this.reportingOrganization = value;
2320      return this;
2321    }
2322
2323    /**
2324     * @return {@link #reportingOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reporting Organization.)
2325     */
2326    public Organization getReportingOrganizationTarget() { 
2327      if (this.reportingOrganizationTarget == null)
2328        if (Configuration.errorOnAutoCreate())
2329          throw new Error("Attempt to auto-create MeasureReport.reportingOrganization");
2330        else if (Configuration.doAutoCreate())
2331          this.reportingOrganizationTarget = new Organization(); // aa
2332      return this.reportingOrganizationTarget;
2333    }
2334
2335    /**
2336     * @param value {@link #reportingOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reporting Organization.)
2337     */
2338    public MeasureReport setReportingOrganizationTarget(Organization value) { 
2339      this.reportingOrganizationTarget = value;
2340      return this;
2341    }
2342
2343    /**
2344     * @return {@link #period} (The reporting period for which the report was calculated.)
2345     */
2346    public Period getPeriod() { 
2347      if (this.period == null)
2348        if (Configuration.errorOnAutoCreate())
2349          throw new Error("Attempt to auto-create MeasureReport.period");
2350        else if (Configuration.doAutoCreate())
2351          this.period = new Period(); // cc
2352      return this.period;
2353    }
2354
2355    public boolean hasPeriod() { 
2356      return this.period != null && !this.period.isEmpty();
2357    }
2358
2359    /**
2360     * @param value {@link #period} (The reporting period for which the report was calculated.)
2361     */
2362    public MeasureReport setPeriod(Period value)  { 
2363      this.period = value;
2364      return this;
2365    }
2366
2367    /**
2368     * @return {@link #group} (The results of the calculation, one for each population group in the measure.)
2369     */
2370    public List<MeasureReportGroupComponent> getGroup() { 
2371      if (this.group == null)
2372        this.group = new ArrayList<MeasureReportGroupComponent>();
2373      return this.group;
2374    }
2375
2376    /**
2377     * @return Returns a reference to <code>this</code> for easy method chaining
2378     */
2379    public MeasureReport setGroup(List<MeasureReportGroupComponent> theGroup) { 
2380      this.group = theGroup;
2381      return this;
2382    }
2383
2384    public boolean hasGroup() { 
2385      if (this.group == null)
2386        return false;
2387      for (MeasureReportGroupComponent item : this.group)
2388        if (!item.isEmpty())
2389          return true;
2390      return false;
2391    }
2392
2393    public MeasureReportGroupComponent addGroup() { //3
2394      MeasureReportGroupComponent t = new MeasureReportGroupComponent();
2395      if (this.group == null)
2396        this.group = new ArrayList<MeasureReportGroupComponent>();
2397      this.group.add(t);
2398      return t;
2399    }
2400
2401    public MeasureReport addGroup(MeasureReportGroupComponent t) { //3
2402      if (t == null)
2403        return this;
2404      if (this.group == null)
2405        this.group = new ArrayList<MeasureReportGroupComponent>();
2406      this.group.add(t);
2407      return this;
2408    }
2409
2410    /**
2411     * @return The first repetition of repeating field {@link #group}, creating it if it does not already exist
2412     */
2413    public MeasureReportGroupComponent getGroupFirstRep() { 
2414      if (getGroup().isEmpty()) {
2415        addGroup();
2416      }
2417      return getGroup().get(0);
2418    }
2419
2420    /**
2421     * @return {@link #evaluatedResources} (A reference to a Bundle containing the Resources that were used in the evaluation of this report.)
2422     */
2423    public Reference getEvaluatedResources() { 
2424      if (this.evaluatedResources == null)
2425        if (Configuration.errorOnAutoCreate())
2426          throw new Error("Attempt to auto-create MeasureReport.evaluatedResources");
2427        else if (Configuration.doAutoCreate())
2428          this.evaluatedResources = new Reference(); // cc
2429      return this.evaluatedResources;
2430    }
2431
2432    public boolean hasEvaluatedResources() { 
2433      return this.evaluatedResources != null && !this.evaluatedResources.isEmpty();
2434    }
2435
2436    /**
2437     * @param value {@link #evaluatedResources} (A reference to a Bundle containing the Resources that were used in the evaluation of this report.)
2438     */
2439    public MeasureReport setEvaluatedResources(Reference value)  { 
2440      this.evaluatedResources = value;
2441      return this;
2442    }
2443
2444    /**
2445     * @return {@link #evaluatedResources} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to a Bundle containing the Resources that were used in the evaluation of this report.)
2446     */
2447    public Bundle getEvaluatedResourcesTarget() { 
2448      if (this.evaluatedResourcesTarget == null)
2449        if (Configuration.errorOnAutoCreate())
2450          throw new Error("Attempt to auto-create MeasureReport.evaluatedResources");
2451        else if (Configuration.doAutoCreate())
2452          this.evaluatedResourcesTarget = new Bundle(); // aa
2453      return this.evaluatedResourcesTarget;
2454    }
2455
2456    /**
2457     * @param value {@link #evaluatedResources} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to a Bundle containing the Resources that were used in the evaluation of this report.)
2458     */
2459    public MeasureReport setEvaluatedResourcesTarget(Bundle value) { 
2460      this.evaluatedResourcesTarget = value;
2461      return this;
2462    }
2463
2464      protected void listChildren(List<Property> children) {
2465        super.listChildren(children);
2466        children.add(new Property("identifier", "Identifier", "A formal identifier that is used to identify this report when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, 1, identifier));
2467        children.add(new Property("status", "code", "The report status. No data will be available until the report status is complete.", 0, 1, status));
2468        children.add(new Property("type", "code", "The type of measure report. This may be an individual report, which provides a single patient's score for the measure; a patient listing, which returns the list of patients that meet the various criteria in the measure; or a summary report, which returns a population count for each of the criteria in the measure.", 0, 1, type));
2469        children.add(new Property("measure", "Reference(Measure)", "A reference to the Measure that was evaluated to produce this report.", 0, 1, measure));
2470        children.add(new Property("patient", "Reference(Patient)", "Optional Patient if the report was requested for a single patient.", 0, 1, patient));
2471        children.add(new Property("date", "dateTime", "The date this measure report was generated.", 0, 1, date));
2472        children.add(new Property("reportingOrganization", "Reference(Organization)", "Reporting Organization.", 0, 1, reportingOrganization));
2473        children.add(new Property("period", "Period", "The reporting period for which the report was calculated.", 0, 1, period));
2474        children.add(new Property("group", "", "The results of the calculation, one for each population group in the measure.", 0, java.lang.Integer.MAX_VALUE, group));
2475        children.add(new Property("evaluatedResources", "Reference(Bundle)", "A reference to a Bundle containing the Resources that were used in the evaluation of this report.", 0, 1, evaluatedResources));
2476      }
2477
2478      @Override
2479      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2480        switch (_hash) {
2481        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A formal identifier that is used to identify this report when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, 1, identifier);
2482        case -892481550: /*status*/  return new Property("status", "code", "The report status. No data will be available until the report status is complete.", 0, 1, status);
2483        case 3575610: /*type*/  return new Property("type", "code", "The type of measure report. This may be an individual report, which provides a single patient's score for the measure; a patient listing, which returns the list of patients that meet the various criteria in the measure; or a summary report, which returns a population count for each of the criteria in the measure.", 0, 1, type);
2484        case 938321246: /*measure*/  return new Property("measure", "Reference(Measure)", "A reference to the Measure that was evaluated to produce this report.", 0, 1, measure);
2485        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Optional Patient if the report was requested for a single patient.", 0, 1, patient);
2486        case 3076014: /*date*/  return new Property("date", "dateTime", "The date this measure report was generated.", 0, 1, date);
2487        case -2053950847: /*reportingOrganization*/  return new Property("reportingOrganization", "Reference(Organization)", "Reporting Organization.", 0, 1, reportingOrganization);
2488        case -991726143: /*period*/  return new Property("period", "Period", "The reporting period for which the report was calculated.", 0, 1, period);
2489        case 98629247: /*group*/  return new Property("group", "", "The results of the calculation, one for each population group in the measure.", 0, java.lang.Integer.MAX_VALUE, group);
2490        case 1599836026: /*evaluatedResources*/  return new Property("evaluatedResources", "Reference(Bundle)", "A reference to a Bundle containing the Resources that were used in the evaluation of this report.", 0, 1, evaluatedResources);
2491        default: return super.getNamedProperty(_hash, _name, _checkValid);
2492        }
2493
2494      }
2495
2496      @Override
2497      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2498        switch (hash) {
2499        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
2500        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<MeasureReportStatus>
2501        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<MeasureReportType>
2502        case 938321246: /*measure*/ return this.measure == null ? new Base[0] : new Base[] {this.measure}; // Reference
2503        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
2504        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2505        case -2053950847: /*reportingOrganization*/ return this.reportingOrganization == null ? new Base[0] : new Base[] {this.reportingOrganization}; // Reference
2506        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
2507        case 98629247: /*group*/ return this.group == null ? new Base[0] : this.group.toArray(new Base[this.group.size()]); // MeasureReportGroupComponent
2508        case 1599836026: /*evaluatedResources*/ return this.evaluatedResources == null ? new Base[0] : new Base[] {this.evaluatedResources}; // Reference
2509        default: return super.getProperty(hash, name, checkValid);
2510        }
2511
2512      }
2513
2514      @Override
2515      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2516        switch (hash) {
2517        case -1618432855: // identifier
2518          this.identifier = castToIdentifier(value); // Identifier
2519          return value;
2520        case -892481550: // status
2521          value = new MeasureReportStatusEnumFactory().fromType(castToCode(value));
2522          this.status = (Enumeration) value; // Enumeration<MeasureReportStatus>
2523          return value;
2524        case 3575610: // type
2525          value = new MeasureReportTypeEnumFactory().fromType(castToCode(value));
2526          this.type = (Enumeration) value; // Enumeration<MeasureReportType>
2527          return value;
2528        case 938321246: // measure
2529          this.measure = castToReference(value); // Reference
2530          return value;
2531        case -791418107: // patient
2532          this.patient = castToReference(value); // Reference
2533          return value;
2534        case 3076014: // date
2535          this.date = castToDateTime(value); // DateTimeType
2536          return value;
2537        case -2053950847: // reportingOrganization
2538          this.reportingOrganization = castToReference(value); // Reference
2539          return value;
2540        case -991726143: // period
2541          this.period = castToPeriod(value); // Period
2542          return value;
2543        case 98629247: // group
2544          this.getGroup().add((MeasureReportGroupComponent) value); // MeasureReportGroupComponent
2545          return value;
2546        case 1599836026: // evaluatedResources
2547          this.evaluatedResources = castToReference(value); // Reference
2548          return value;
2549        default: return super.setProperty(hash, name, value);
2550        }
2551
2552      }
2553
2554      @Override
2555      public Base setProperty(String name, Base value) throws FHIRException {
2556        if (name.equals("identifier")) {
2557          this.identifier = castToIdentifier(value); // Identifier
2558        } else if (name.equals("status")) {
2559          value = new MeasureReportStatusEnumFactory().fromType(castToCode(value));
2560          this.status = (Enumeration) value; // Enumeration<MeasureReportStatus>
2561        } else if (name.equals("type")) {
2562          value = new MeasureReportTypeEnumFactory().fromType(castToCode(value));
2563          this.type = (Enumeration) value; // Enumeration<MeasureReportType>
2564        } else if (name.equals("measure")) {
2565          this.measure = castToReference(value); // Reference
2566        } else if (name.equals("patient")) {
2567          this.patient = castToReference(value); // Reference
2568        } else if (name.equals("date")) {
2569          this.date = castToDateTime(value); // DateTimeType
2570        } else if (name.equals("reportingOrganization")) {
2571          this.reportingOrganization = castToReference(value); // Reference
2572        } else if (name.equals("period")) {
2573          this.period = castToPeriod(value); // Period
2574        } else if (name.equals("group")) {
2575          this.getGroup().add((MeasureReportGroupComponent) value);
2576        } else if (name.equals("evaluatedResources")) {
2577          this.evaluatedResources = castToReference(value); // Reference
2578        } else
2579          return super.setProperty(name, value);
2580        return value;
2581      }
2582
2583      @Override
2584      public Base makeProperty(int hash, String name) throws FHIRException {
2585        switch (hash) {
2586        case -1618432855:  return getIdentifier(); 
2587        case -892481550:  return getStatusElement();
2588        case 3575610:  return getTypeElement();
2589        case 938321246:  return getMeasure(); 
2590        case -791418107:  return getPatient(); 
2591        case 3076014:  return getDateElement();
2592        case -2053950847:  return getReportingOrganization(); 
2593        case -991726143:  return getPeriod(); 
2594        case 98629247:  return addGroup(); 
2595        case 1599836026:  return getEvaluatedResources(); 
2596        default: return super.makeProperty(hash, name);
2597        }
2598
2599      }
2600
2601      @Override
2602      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2603        switch (hash) {
2604        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2605        case -892481550: /*status*/ return new String[] {"code"};
2606        case 3575610: /*type*/ return new String[] {"code"};
2607        case 938321246: /*measure*/ return new String[] {"Reference"};
2608        case -791418107: /*patient*/ return new String[] {"Reference"};
2609        case 3076014: /*date*/ return new String[] {"dateTime"};
2610        case -2053950847: /*reportingOrganization*/ return new String[] {"Reference"};
2611        case -991726143: /*period*/ return new String[] {"Period"};
2612        case 98629247: /*group*/ return new String[] {};
2613        case 1599836026: /*evaluatedResources*/ return new String[] {"Reference"};
2614        default: return super.getTypesForProperty(hash, name);
2615        }
2616
2617      }
2618
2619      @Override
2620      public Base addChild(String name) throws FHIRException {
2621        if (name.equals("identifier")) {
2622          this.identifier = new Identifier();
2623          return this.identifier;
2624        }
2625        else if (name.equals("status")) {
2626          throw new FHIRException("Cannot call addChild on a primitive type MeasureReport.status");
2627        }
2628        else if (name.equals("type")) {
2629          throw new FHIRException("Cannot call addChild on a primitive type MeasureReport.type");
2630        }
2631        else if (name.equals("measure")) {
2632          this.measure = new Reference();
2633          return this.measure;
2634        }
2635        else if (name.equals("patient")) {
2636          this.patient = new Reference();
2637          return this.patient;
2638        }
2639        else if (name.equals("date")) {
2640          throw new FHIRException("Cannot call addChild on a primitive type MeasureReport.date");
2641        }
2642        else if (name.equals("reportingOrganization")) {
2643          this.reportingOrganization = new Reference();
2644          return this.reportingOrganization;
2645        }
2646        else if (name.equals("period")) {
2647          this.period = new Period();
2648          return this.period;
2649        }
2650        else if (name.equals("group")) {
2651          return addGroup();
2652        }
2653        else if (name.equals("evaluatedResources")) {
2654          this.evaluatedResources = new Reference();
2655          return this.evaluatedResources;
2656        }
2657        else
2658          return super.addChild(name);
2659      }
2660
2661  public String fhirType() {
2662    return "MeasureReport";
2663
2664  }
2665
2666      public MeasureReport copy() {
2667        MeasureReport dst = new MeasureReport();
2668        copyValues(dst);
2669        dst.identifier = identifier == null ? null : identifier.copy();
2670        dst.status = status == null ? null : status.copy();
2671        dst.type = type == null ? null : type.copy();
2672        dst.measure = measure == null ? null : measure.copy();
2673        dst.patient = patient == null ? null : patient.copy();
2674        dst.date = date == null ? null : date.copy();
2675        dst.reportingOrganization = reportingOrganization == null ? null : reportingOrganization.copy();
2676        dst.period = period == null ? null : period.copy();
2677        if (group != null) {
2678          dst.group = new ArrayList<MeasureReportGroupComponent>();
2679          for (MeasureReportGroupComponent i : group)
2680            dst.group.add(i.copy());
2681        };
2682        dst.evaluatedResources = evaluatedResources == null ? null : evaluatedResources.copy();
2683        return dst;
2684      }
2685
2686      protected MeasureReport typedCopy() {
2687        return copy();
2688      }
2689
2690      @Override
2691      public boolean equalsDeep(Base other_) {
2692        if (!super.equalsDeep(other_))
2693          return false;
2694        if (!(other_ instanceof MeasureReport))
2695          return false;
2696        MeasureReport o = (MeasureReport) other_;
2697        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(type, o.type, true)
2698           && compareDeep(measure, o.measure, true) && compareDeep(patient, o.patient, true) && compareDeep(date, o.date, true)
2699           && compareDeep(reportingOrganization, o.reportingOrganization, true) && compareDeep(period, o.period, true)
2700           && compareDeep(group, o.group, true) && compareDeep(evaluatedResources, o.evaluatedResources, true)
2701          ;
2702      }
2703
2704      @Override
2705      public boolean equalsShallow(Base other_) {
2706        if (!super.equalsShallow(other_))
2707          return false;
2708        if (!(other_ instanceof MeasureReport))
2709          return false;
2710        MeasureReport o = (MeasureReport) other_;
2711        return compareValues(status, o.status, true) && compareValues(type, o.type, true) && compareValues(date, o.date, true)
2712          ;
2713      }
2714
2715      public boolean isEmpty() {
2716        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, type
2717          , measure, patient, date, reportingOrganization, period, group, evaluatedResources
2718          );
2719      }
2720
2721  @Override
2722  public ResourceType getResourceType() {
2723    return ResourceType.MeasureReport;
2724   }
2725
2726 /**
2727   * Search parameter: <b>identifier</b>
2728   * <p>
2729   * Description: <b>External identifier of the measure report to be returned</b><br>
2730   * Type: <b>token</b><br>
2731   * Path: <b>MeasureReport.identifier</b><br>
2732   * </p>
2733   */
2734  @SearchParamDefinition(name="identifier", path="MeasureReport.identifier", description="External identifier of the measure report to be returned", type="token" )
2735  public static final String SP_IDENTIFIER = "identifier";
2736 /**
2737   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2738   * <p>
2739   * Description: <b>External identifier of the measure report to be returned</b><br>
2740   * Type: <b>token</b><br>
2741   * Path: <b>MeasureReport.identifier</b><br>
2742   * </p>
2743   */
2744  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2745
2746 /**
2747   * Search parameter: <b>patient</b>
2748   * <p>
2749   * Description: <b>The identity of a patient to search for individual measure report results for</b><br>
2750   * Type: <b>reference</b><br>
2751   * Path: <b>MeasureReport.patient</b><br>
2752   * </p>
2753   */
2754  @SearchParamDefinition(name="patient", path="MeasureReport.patient", description="The identity of a patient to search for individual measure report results for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
2755  public static final String SP_PATIENT = "patient";
2756 /**
2757   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2758   * <p>
2759   * Description: <b>The identity of a patient to search for individual measure report results for</b><br>
2760   * Type: <b>reference</b><br>
2761   * Path: <b>MeasureReport.patient</b><br>
2762   * </p>
2763   */
2764  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2765
2766/**
2767   * Constant for fluent queries to be used to add include statements. Specifies
2768   * the path value of "<b>MeasureReport:patient</b>".
2769   */
2770  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MeasureReport:patient").toLocked();
2771
2772 /**
2773   * Search parameter: <b>status</b>
2774   * <p>
2775   * Description: <b>The status of the measure report</b><br>
2776   * Type: <b>token</b><br>
2777   * Path: <b>MeasureReport.status</b><br>
2778   * </p>
2779   */
2780  @SearchParamDefinition(name="status", path="MeasureReport.status", description="The status of the measure report", type="token" )
2781  public static final String SP_STATUS = "status";
2782 /**
2783   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2784   * <p>
2785   * Description: <b>The status of the measure report</b><br>
2786   * Type: <b>token</b><br>
2787   * Path: <b>MeasureReport.status</b><br>
2788   * </p>
2789   */
2790  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2791
2792
2793}