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