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