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