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