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