001package org.hl7.fhir.r5.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r5
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.Date;
055import java.util.List;
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.ICompositeType;
058
059import java.math.*;
060import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
061import org.hl7.fhir.utilities.Utilities;
062import ca.uhn.fhir.model.api.annotation.Child;
063import ca.uhn.fhir.model.api.annotation.ChildOrder;
064import ca.uhn.fhir.model.api.annotation.DatatypeDef;
065import ca.uhn.fhir.model.api.annotation.Description;
066import ca.uhn.fhir.model.api.annotation.Block;
067/**
068 * A fact or piece of data from a  study of a large quantity of numerical data.  A mathematical or quantified characteristic of a group of observations.
069 */
070@DatatypeDef(name="Statistic")
071public class Statistic extends BackboneType implements ICompositeType {
072
073    @Block()
074    public static class StatisticSampleSizeComponent extends Element implements IBaseDatatypeElement {
075        /**
076         * Human-readable summary of population sample size.
077         */
078        @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
079        @Description(shortDefinition="Textual description of sample size for statistic", formalDefinition="Human-readable summary of population sample size." )
080        protected StringType description;
081
082        /**
083         * Footnote or explanatory note about the sample size.
084         */
085        @Child(name = "note", type = {Annotation.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
086        @Description(shortDefinition="Footnote or explanatory note about the sample size", formalDefinition="Footnote or explanatory note about the sample size." )
087        protected List<Annotation> note;
088
089        /**
090         * Number of participants in the population.
091         */
092        @Child(name = "numberOfStudies", type = {IntegerType.class}, order=3, min=0, max=1, modifier=false, summary=true)
093        @Description(shortDefinition="Number of contributing studies", formalDefinition="Number of participants in the population." )
094        protected IntegerType numberOfStudies;
095
096        /**
097         * A human-readable string to clarify or explain concepts about the sample size.
098         */
099        @Child(name = "numberOfParticipants", type = {IntegerType.class}, order=4, min=0, max=1, modifier=false, summary=true)
100        @Description(shortDefinition="Cumulative number of participants", formalDefinition="A human-readable string to clarify or explain concepts about the sample size." )
101        protected IntegerType numberOfParticipants;
102
103        /**
104         * Number of participants with known results for measured variables.
105         */
106        @Child(name = "knownDataCount", type = {IntegerType.class}, order=5, min=0, max=1, modifier=false, summary=true)
107        @Description(shortDefinition="Number of participants with known results for measured variables", formalDefinition="Number of participants with known results for measured variables." )
108        protected IntegerType knownDataCount;
109
110        /**
111         * Number of participants with “positive” results, only used to report actual numerator count for a proportion.
112         */
113        @Child(name = "numeratorCount", type = {IntegerType.class}, order=6, min=0, max=1, modifier=false, summary=true)
114        @Description(shortDefinition="Number of participants with “positive” results, only used to report actual numerator count for a proportion", formalDefinition="Number of participants with “positive” results, only used to report actual numerator count for a proportion." )
115        protected IntegerType numeratorCount;
116
117        private static final long serialVersionUID = 1908820199L;
118
119    /**
120     * Constructor
121     */
122      public StatisticSampleSizeComponent() {
123        super();
124      }
125
126        /**
127         * @return {@link #description} (Human-readable summary of population sample size.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
128         */
129        public StringType getDescriptionElement() { 
130          if (this.description == null)
131            if (Configuration.errorOnAutoCreate())
132              throw new Error("Attempt to auto-create StatisticSampleSizeComponent.description");
133            else if (Configuration.doAutoCreate())
134              this.description = new StringType(); // bb
135          return this.description;
136        }
137
138        public boolean hasDescriptionElement() { 
139          return this.description != null && !this.description.isEmpty();
140        }
141
142        public boolean hasDescription() { 
143          return this.description != null && !this.description.isEmpty();
144        }
145
146        /**
147         * @param value {@link #description} (Human-readable summary of population sample size.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
148         */
149        public StatisticSampleSizeComponent setDescriptionElement(StringType value) { 
150          this.description = value;
151          return this;
152        }
153
154        /**
155         * @return Human-readable summary of population sample size.
156         */
157        public String getDescription() { 
158          return this.description == null ? null : this.description.getValue();
159        }
160
161        /**
162         * @param value Human-readable summary of population sample size.
163         */
164        public StatisticSampleSizeComponent setDescription(String value) { 
165          if (Utilities.noString(value))
166            this.description = null;
167          else {
168            if (this.description == null)
169              this.description = new StringType();
170            this.description.setValue(value);
171          }
172          return this;
173        }
174
175        /**
176         * @return {@link #note} (Footnote or explanatory note about the sample size.)
177         */
178        public List<Annotation> getNote() { 
179          if (this.note == null)
180            this.note = new ArrayList<Annotation>();
181          return this.note;
182        }
183
184        /**
185         * @return Returns a reference to <code>this</code> for easy method chaining
186         */
187        public StatisticSampleSizeComponent setNote(List<Annotation> theNote) { 
188          this.note = theNote;
189          return this;
190        }
191
192        public boolean hasNote() { 
193          if (this.note == null)
194            return false;
195          for (Annotation item : this.note)
196            if (!item.isEmpty())
197              return true;
198          return false;
199        }
200
201        public Annotation addNote() { //3
202          Annotation t = new Annotation();
203          if (this.note == null)
204            this.note = new ArrayList<Annotation>();
205          this.note.add(t);
206          return t;
207        }
208
209        public StatisticSampleSizeComponent addNote(Annotation t) { //3
210          if (t == null)
211            return this;
212          if (this.note == null)
213            this.note = new ArrayList<Annotation>();
214          this.note.add(t);
215          return this;
216        }
217
218        /**
219         * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
220         */
221        public Annotation getNoteFirstRep() { 
222          if (getNote().isEmpty()) {
223            addNote();
224          }
225          return getNote().get(0);
226        }
227
228        /**
229         * @return {@link #numberOfStudies} (Number of participants in the population.). This is the underlying object with id, value and extensions. The accessor "getNumberOfStudies" gives direct access to the value
230         */
231        public IntegerType getNumberOfStudiesElement() { 
232          if (this.numberOfStudies == null)
233            if (Configuration.errorOnAutoCreate())
234              throw new Error("Attempt to auto-create StatisticSampleSizeComponent.numberOfStudies");
235            else if (Configuration.doAutoCreate())
236              this.numberOfStudies = new IntegerType(); // bb
237          return this.numberOfStudies;
238        }
239
240        public boolean hasNumberOfStudiesElement() { 
241          return this.numberOfStudies != null && !this.numberOfStudies.isEmpty();
242        }
243
244        public boolean hasNumberOfStudies() { 
245          return this.numberOfStudies != null && !this.numberOfStudies.isEmpty();
246        }
247
248        /**
249         * @param value {@link #numberOfStudies} (Number of participants in the population.). This is the underlying object with id, value and extensions. The accessor "getNumberOfStudies" gives direct access to the value
250         */
251        public StatisticSampleSizeComponent setNumberOfStudiesElement(IntegerType value) { 
252          this.numberOfStudies = value;
253          return this;
254        }
255
256        /**
257         * @return Number of participants in the population.
258         */
259        public int getNumberOfStudies() { 
260          return this.numberOfStudies == null || this.numberOfStudies.isEmpty() ? 0 : this.numberOfStudies.getValue();
261        }
262
263        /**
264         * @param value Number of participants in the population.
265         */
266        public StatisticSampleSizeComponent setNumberOfStudies(int value) { 
267            if (this.numberOfStudies == null)
268              this.numberOfStudies = new IntegerType();
269            this.numberOfStudies.setValue(value);
270          return this;
271        }
272
273        /**
274         * @return {@link #numberOfParticipants} (A human-readable string to clarify or explain concepts about the sample size.). This is the underlying object with id, value and extensions. The accessor "getNumberOfParticipants" gives direct access to the value
275         */
276        public IntegerType getNumberOfParticipantsElement() { 
277          if (this.numberOfParticipants == null)
278            if (Configuration.errorOnAutoCreate())
279              throw new Error("Attempt to auto-create StatisticSampleSizeComponent.numberOfParticipants");
280            else if (Configuration.doAutoCreate())
281              this.numberOfParticipants = new IntegerType(); // bb
282          return this.numberOfParticipants;
283        }
284
285        public boolean hasNumberOfParticipantsElement() { 
286          return this.numberOfParticipants != null && !this.numberOfParticipants.isEmpty();
287        }
288
289        public boolean hasNumberOfParticipants() { 
290          return this.numberOfParticipants != null && !this.numberOfParticipants.isEmpty();
291        }
292
293        /**
294         * @param value {@link #numberOfParticipants} (A human-readable string to clarify or explain concepts about the sample size.). This is the underlying object with id, value and extensions. The accessor "getNumberOfParticipants" gives direct access to the value
295         */
296        public StatisticSampleSizeComponent setNumberOfParticipantsElement(IntegerType value) { 
297          this.numberOfParticipants = value;
298          return this;
299        }
300
301        /**
302         * @return A human-readable string to clarify or explain concepts about the sample size.
303         */
304        public int getNumberOfParticipants() { 
305          return this.numberOfParticipants == null || this.numberOfParticipants.isEmpty() ? 0 : this.numberOfParticipants.getValue();
306        }
307
308        /**
309         * @param value A human-readable string to clarify or explain concepts about the sample size.
310         */
311        public StatisticSampleSizeComponent setNumberOfParticipants(int value) { 
312            if (this.numberOfParticipants == null)
313              this.numberOfParticipants = new IntegerType();
314            this.numberOfParticipants.setValue(value);
315          return this;
316        }
317
318        /**
319         * @return {@link #knownDataCount} (Number of participants with known results for measured variables.). This is the underlying object with id, value and extensions. The accessor "getKnownDataCount" gives direct access to the value
320         */
321        public IntegerType getKnownDataCountElement() { 
322          if (this.knownDataCount == null)
323            if (Configuration.errorOnAutoCreate())
324              throw new Error("Attempt to auto-create StatisticSampleSizeComponent.knownDataCount");
325            else if (Configuration.doAutoCreate())
326              this.knownDataCount = new IntegerType(); // bb
327          return this.knownDataCount;
328        }
329
330        public boolean hasKnownDataCountElement() { 
331          return this.knownDataCount != null && !this.knownDataCount.isEmpty();
332        }
333
334        public boolean hasKnownDataCount() { 
335          return this.knownDataCount != null && !this.knownDataCount.isEmpty();
336        }
337
338        /**
339         * @param value {@link #knownDataCount} (Number of participants with known results for measured variables.). This is the underlying object with id, value and extensions. The accessor "getKnownDataCount" gives direct access to the value
340         */
341        public StatisticSampleSizeComponent setKnownDataCountElement(IntegerType value) { 
342          this.knownDataCount = value;
343          return this;
344        }
345
346        /**
347         * @return Number of participants with known results for measured variables.
348         */
349        public int getKnownDataCount() { 
350          return this.knownDataCount == null || this.knownDataCount.isEmpty() ? 0 : this.knownDataCount.getValue();
351        }
352
353        /**
354         * @param value Number of participants with known results for measured variables.
355         */
356        public StatisticSampleSizeComponent setKnownDataCount(int value) { 
357            if (this.knownDataCount == null)
358              this.knownDataCount = new IntegerType();
359            this.knownDataCount.setValue(value);
360          return this;
361        }
362
363        /**
364         * @return {@link #numeratorCount} (Number of participants with “positive” results, only used to report actual numerator count for a proportion.). This is the underlying object with id, value and extensions. The accessor "getNumeratorCount" gives direct access to the value
365         */
366        public IntegerType getNumeratorCountElement() { 
367          if (this.numeratorCount == null)
368            if (Configuration.errorOnAutoCreate())
369              throw new Error("Attempt to auto-create StatisticSampleSizeComponent.numeratorCount");
370            else if (Configuration.doAutoCreate())
371              this.numeratorCount = new IntegerType(); // bb
372          return this.numeratorCount;
373        }
374
375        public boolean hasNumeratorCountElement() { 
376          return this.numeratorCount != null && !this.numeratorCount.isEmpty();
377        }
378
379        public boolean hasNumeratorCount() { 
380          return this.numeratorCount != null && !this.numeratorCount.isEmpty();
381        }
382
383        /**
384         * @param value {@link #numeratorCount} (Number of participants with “positive” results, only used to report actual numerator count for a proportion.). This is the underlying object with id, value and extensions. The accessor "getNumeratorCount" gives direct access to the value
385         */
386        public StatisticSampleSizeComponent setNumeratorCountElement(IntegerType value) { 
387          this.numeratorCount = value;
388          return this;
389        }
390
391        /**
392         * @return Number of participants with “positive” results, only used to report actual numerator count for a proportion.
393         */
394        public int getNumeratorCount() { 
395          return this.numeratorCount == null || this.numeratorCount.isEmpty() ? 0 : this.numeratorCount.getValue();
396        }
397
398        /**
399         * @param value Number of participants with “positive” results, only used to report actual numerator count for a proportion.
400         */
401        public StatisticSampleSizeComponent setNumeratorCount(int value) { 
402            if (this.numeratorCount == null)
403              this.numeratorCount = new IntegerType();
404            this.numeratorCount.setValue(value);
405          return this;
406        }
407
408        protected void listChildren(List<Property> children) {
409          super.listChildren(children);
410          children.add(new Property("description", "string", "Human-readable summary of population sample size.", 0, 1, description));
411          children.add(new Property("note", "Annotation", "Footnote or explanatory note about the sample size.", 0, java.lang.Integer.MAX_VALUE, note));
412          children.add(new Property("numberOfStudies", "integer", "Number of participants in the population.", 0, 1, numberOfStudies));
413          children.add(new Property("numberOfParticipants", "integer", "A human-readable string to clarify or explain concepts about the sample size.", 0, 1, numberOfParticipants));
414          children.add(new Property("knownDataCount", "integer", "Number of participants with known results for measured variables.", 0, 1, knownDataCount));
415          children.add(new Property("numeratorCount", "integer", "Number of participants with “positive” results, only used to report actual numerator count for a proportion.", 0, 1, numeratorCount));
416        }
417
418        @Override
419        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
420          switch (_hash) {
421          case -1724546052: /*description*/  return new Property("description", "string", "Human-readable summary of population sample size.", 0, 1, description);
422          case 3387378: /*note*/  return new Property("note", "Annotation", "Footnote or explanatory note about the sample size.", 0, java.lang.Integer.MAX_VALUE, note);
423          case -177467129: /*numberOfStudies*/  return new Property("numberOfStudies", "integer", "Number of participants in the population.", 0, 1, numberOfStudies);
424          case 1799357120: /*numberOfParticipants*/  return new Property("numberOfParticipants", "integer", "A human-readable string to clarify or explain concepts about the sample size.", 0, 1, numberOfParticipants);
425          case -937344126: /*knownDataCount*/  return new Property("knownDataCount", "integer", "Number of participants with known results for measured variables.", 0, 1, knownDataCount);
426          case -755509242: /*numeratorCount*/  return new Property("numeratorCount", "integer", "Number of participants with “positive” results, only used to report actual numerator count for a proportion.", 0, 1, numeratorCount);
427          default: return super.getNamedProperty(_hash, _name, _checkValid);
428          }
429
430        }
431
432      @Override
433      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
434        switch (hash) {
435        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
436        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
437        case -177467129: /*numberOfStudies*/ return this.numberOfStudies == null ? new Base[0] : new Base[] {this.numberOfStudies}; // IntegerType
438        case 1799357120: /*numberOfParticipants*/ return this.numberOfParticipants == null ? new Base[0] : new Base[] {this.numberOfParticipants}; // IntegerType
439        case -937344126: /*knownDataCount*/ return this.knownDataCount == null ? new Base[0] : new Base[] {this.knownDataCount}; // IntegerType
440        case -755509242: /*numeratorCount*/ return this.numeratorCount == null ? new Base[0] : new Base[] {this.numeratorCount}; // IntegerType
441        default: return super.getProperty(hash, name, checkValid);
442        }
443
444      }
445
446      @Override
447      public Base setProperty(int hash, String name, Base value) throws FHIRException {
448        switch (hash) {
449        case -1724546052: // description
450          this.description = castToString(value); // StringType
451          return value;
452        case 3387378: // note
453          this.getNote().add(castToAnnotation(value)); // Annotation
454          return value;
455        case -177467129: // numberOfStudies
456          this.numberOfStudies = castToInteger(value); // IntegerType
457          return value;
458        case 1799357120: // numberOfParticipants
459          this.numberOfParticipants = castToInteger(value); // IntegerType
460          return value;
461        case -937344126: // knownDataCount
462          this.knownDataCount = castToInteger(value); // IntegerType
463          return value;
464        case -755509242: // numeratorCount
465          this.numeratorCount = castToInteger(value); // IntegerType
466          return value;
467        default: return super.setProperty(hash, name, value);
468        }
469
470      }
471
472      @Override
473      public Base setProperty(String name, Base value) throws FHIRException {
474        if (name.equals("description")) {
475          this.description = castToString(value); // StringType
476        } else if (name.equals("note")) {
477          this.getNote().add(castToAnnotation(value));
478        } else if (name.equals("numberOfStudies")) {
479          this.numberOfStudies = castToInteger(value); // IntegerType
480        } else if (name.equals("numberOfParticipants")) {
481          this.numberOfParticipants = castToInteger(value); // IntegerType
482        } else if (name.equals("knownDataCount")) {
483          this.knownDataCount = castToInteger(value); // IntegerType
484        } else if (name.equals("numeratorCount")) {
485          this.numeratorCount = castToInteger(value); // IntegerType
486        } else
487          return super.setProperty(name, value);
488        return value;
489      }
490
491      @Override
492      public Base makeProperty(int hash, String name) throws FHIRException {
493        switch (hash) {
494        case -1724546052:  return getDescriptionElement();
495        case 3387378:  return addNote(); 
496        case -177467129:  return getNumberOfStudiesElement();
497        case 1799357120:  return getNumberOfParticipantsElement();
498        case -937344126:  return getKnownDataCountElement();
499        case -755509242:  return getNumeratorCountElement();
500        default: return super.makeProperty(hash, name);
501        }
502
503      }
504
505      @Override
506      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
507        switch (hash) {
508        case -1724546052: /*description*/ return new String[] {"string"};
509        case 3387378: /*note*/ return new String[] {"Annotation"};
510        case -177467129: /*numberOfStudies*/ return new String[] {"integer"};
511        case 1799357120: /*numberOfParticipants*/ return new String[] {"integer"};
512        case -937344126: /*knownDataCount*/ return new String[] {"integer"};
513        case -755509242: /*numeratorCount*/ return new String[] {"integer"};
514        default: return super.getTypesForProperty(hash, name);
515        }
516
517      }
518
519      @Override
520      public Base addChild(String name) throws FHIRException {
521        if (name.equals("description")) {
522          throw new FHIRException("Cannot call addChild on a primitive type Statistic.description");
523        }
524        else if (name.equals("note")) {
525          return addNote();
526        }
527        else if (name.equals("numberOfStudies")) {
528          throw new FHIRException("Cannot call addChild on a primitive type Statistic.numberOfStudies");
529        }
530        else if (name.equals("numberOfParticipants")) {
531          throw new FHIRException("Cannot call addChild on a primitive type Statistic.numberOfParticipants");
532        }
533        else if (name.equals("knownDataCount")) {
534          throw new FHIRException("Cannot call addChild on a primitive type Statistic.knownDataCount");
535        }
536        else if (name.equals("numeratorCount")) {
537          throw new FHIRException("Cannot call addChild on a primitive type Statistic.numeratorCount");
538        }
539        else
540          return super.addChild(name);
541      }
542
543      public StatisticSampleSizeComponent copy() {
544        StatisticSampleSizeComponent dst = new StatisticSampleSizeComponent();
545        copyValues(dst);
546        return dst;
547      }
548
549      public void copyValues(StatisticSampleSizeComponent dst) {
550        super.copyValues(dst);
551        dst.description = description == null ? null : description.copy();
552        if (note != null) {
553          dst.note = new ArrayList<Annotation>();
554          for (Annotation i : note)
555            dst.note.add(i.copy());
556        };
557        dst.numberOfStudies = numberOfStudies == null ? null : numberOfStudies.copy();
558        dst.numberOfParticipants = numberOfParticipants == null ? null : numberOfParticipants.copy();
559        dst.knownDataCount = knownDataCount == null ? null : knownDataCount.copy();
560        dst.numeratorCount = numeratorCount == null ? null : numeratorCount.copy();
561      }
562
563      @Override
564      public boolean equalsDeep(Base other_) {
565        if (!super.equalsDeep(other_))
566          return false;
567        if (!(other_ instanceof StatisticSampleSizeComponent))
568          return false;
569        StatisticSampleSizeComponent o = (StatisticSampleSizeComponent) other_;
570        return compareDeep(description, o.description, true) && compareDeep(note, o.note, true) && compareDeep(numberOfStudies, o.numberOfStudies, true)
571           && compareDeep(numberOfParticipants, o.numberOfParticipants, true) && compareDeep(knownDataCount, o.knownDataCount, true)
572           && compareDeep(numeratorCount, o.numeratorCount, true);
573      }
574
575      @Override
576      public boolean equalsShallow(Base other_) {
577        if (!super.equalsShallow(other_))
578          return false;
579        if (!(other_ instanceof StatisticSampleSizeComponent))
580          return false;
581        StatisticSampleSizeComponent o = (StatisticSampleSizeComponent) other_;
582        return compareValues(description, o.description, true) && compareValues(numberOfStudies, o.numberOfStudies, true)
583           && compareValues(numberOfParticipants, o.numberOfParticipants, true) && compareValues(knownDataCount, o.knownDataCount, true)
584           && compareValues(numeratorCount, o.numeratorCount, true);
585      }
586
587      public boolean isEmpty() {
588        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, note, numberOfStudies
589          , numberOfParticipants, knownDataCount, numeratorCount);
590      }
591
592  public String fhirType() {
593    return "Statistic.sampleSize";
594
595  }
596
597  }
598
599    @Block()
600    public static class StatisticAttributeEstimateComponent extends Element implements IBaseDatatypeElement {
601        /**
602         * Human-readable summary of the estimate.
603         */
604        @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
605        @Description(shortDefinition="Textual description of the precision estimate", formalDefinition="Human-readable summary of the estimate." )
606        protected StringType description;
607
608        /**
609         * Footnote or explanatory note about the estimate.
610         */
611        @Child(name = "note", type = {Annotation.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
612        @Description(shortDefinition="Footnote or explanatory note about the estimate", formalDefinition="Footnote or explanatory note about the estimate." )
613        protected List<Annotation> note;
614
615        /**
616         * The estimateType of precision estimate, eg confidence interval or p value type.
617         */
618        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
619        @Description(shortDefinition="The estimateType of precision estimate, eg confidence interval or p value type", formalDefinition="The estimateType of precision estimate, eg confidence interval or p value type." )
620        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/attribute-estimate-type")
621        protected CodeableConcept type;
622
623        /**
624         * The singular quantity of the precision estimate, for precision estimates represented as single values; also used to report unit of measure.
625         */
626        @Child(name = "quantity", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=true)
627        @Description(shortDefinition="The singular quantity of the precision estimate, for precision estimates represented as single values; also used to report unit of measure", formalDefinition="The singular quantity of the precision estimate, for precision estimates represented as single values; also used to report unit of measure." )
628        protected Quantity quantity;
629
630        /**
631         * Use 95 for a 95% confidence interval.
632         */
633        @Child(name = "level", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=true)
634        @Description(shortDefinition="Level of confidence interval, eg 0.95 for 95% confidence interval", formalDefinition="Use 95 for a 95% confidence interval." )
635        protected DecimalType level;
636
637        /**
638         * Lower bound of confidence interval.
639         */
640        @Child(name = "range", type = {Range.class}, order=6, min=0, max=1, modifier=false, summary=true)
641        @Description(shortDefinition="Lower and upper bound values of the precision estimate", formalDefinition="Lower bound of confidence interval." )
642        protected Range range;
643
644        /**
645         * An estimate of the precision of the estimate.
646         */
647        @Child(name = "estimateQualifier", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
648        @Description(shortDefinition="An estimate of the precision of the estimate", formalDefinition="An estimate of the precision of the estimate." )
649        protected List<StatisticAttributeEstimateEstimateQualifierComponent> estimateQualifier;
650
651        private static final long serialVersionUID = -682237703L;
652
653    /**
654     * Constructor
655     */
656      public StatisticAttributeEstimateComponent() {
657        super();
658      }
659
660        /**
661         * @return {@link #description} (Human-readable summary of the estimate.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
662         */
663        public StringType getDescriptionElement() { 
664          if (this.description == null)
665            if (Configuration.errorOnAutoCreate())
666              throw new Error("Attempt to auto-create StatisticAttributeEstimateComponent.description");
667            else if (Configuration.doAutoCreate())
668              this.description = new StringType(); // bb
669          return this.description;
670        }
671
672        public boolean hasDescriptionElement() { 
673          return this.description != null && !this.description.isEmpty();
674        }
675
676        public boolean hasDescription() { 
677          return this.description != null && !this.description.isEmpty();
678        }
679
680        /**
681         * @param value {@link #description} (Human-readable summary of the estimate.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
682         */
683        public StatisticAttributeEstimateComponent setDescriptionElement(StringType value) { 
684          this.description = value;
685          return this;
686        }
687
688        /**
689         * @return Human-readable summary of the estimate.
690         */
691        public String getDescription() { 
692          return this.description == null ? null : this.description.getValue();
693        }
694
695        /**
696         * @param value Human-readable summary of the estimate.
697         */
698        public StatisticAttributeEstimateComponent setDescription(String value) { 
699          if (Utilities.noString(value))
700            this.description = null;
701          else {
702            if (this.description == null)
703              this.description = new StringType();
704            this.description.setValue(value);
705          }
706          return this;
707        }
708
709        /**
710         * @return {@link #note} (Footnote or explanatory note about the estimate.)
711         */
712        public List<Annotation> getNote() { 
713          if (this.note == null)
714            this.note = new ArrayList<Annotation>();
715          return this.note;
716        }
717
718        /**
719         * @return Returns a reference to <code>this</code> for easy method chaining
720         */
721        public StatisticAttributeEstimateComponent setNote(List<Annotation> theNote) { 
722          this.note = theNote;
723          return this;
724        }
725
726        public boolean hasNote() { 
727          if (this.note == null)
728            return false;
729          for (Annotation item : this.note)
730            if (!item.isEmpty())
731              return true;
732          return false;
733        }
734
735        public Annotation addNote() { //3
736          Annotation t = new Annotation();
737          if (this.note == null)
738            this.note = new ArrayList<Annotation>();
739          this.note.add(t);
740          return t;
741        }
742
743        public StatisticAttributeEstimateComponent addNote(Annotation t) { //3
744          if (t == null)
745            return this;
746          if (this.note == null)
747            this.note = new ArrayList<Annotation>();
748          this.note.add(t);
749          return this;
750        }
751
752        /**
753         * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
754         */
755        public Annotation getNoteFirstRep() { 
756          if (getNote().isEmpty()) {
757            addNote();
758          }
759          return getNote().get(0);
760        }
761
762        /**
763         * @return {@link #type} (The estimateType of precision estimate, eg confidence interval or p value type.)
764         */
765        public CodeableConcept getType() { 
766          if (this.type == null)
767            if (Configuration.errorOnAutoCreate())
768              throw new Error("Attempt to auto-create StatisticAttributeEstimateComponent.type");
769            else if (Configuration.doAutoCreate())
770              this.type = new CodeableConcept(); // cc
771          return this.type;
772        }
773
774        public boolean hasType() { 
775          return this.type != null && !this.type.isEmpty();
776        }
777
778        /**
779         * @param value {@link #type} (The estimateType of precision estimate, eg confidence interval or p value type.)
780         */
781        public StatisticAttributeEstimateComponent setType(CodeableConcept value) { 
782          this.type = value;
783          return this;
784        }
785
786        /**
787         * @return {@link #quantity} (The singular quantity of the precision estimate, for precision estimates represented as single values; also used to report unit of measure.)
788         */
789        public Quantity getQuantity() { 
790          if (this.quantity == null)
791            if (Configuration.errorOnAutoCreate())
792              throw new Error("Attempt to auto-create StatisticAttributeEstimateComponent.quantity");
793            else if (Configuration.doAutoCreate())
794              this.quantity = new Quantity(); // cc
795          return this.quantity;
796        }
797
798        public boolean hasQuantity() { 
799          return this.quantity != null && !this.quantity.isEmpty();
800        }
801
802        /**
803         * @param value {@link #quantity} (The singular quantity of the precision estimate, for precision estimates represented as single values; also used to report unit of measure.)
804         */
805        public StatisticAttributeEstimateComponent setQuantity(Quantity value) { 
806          this.quantity = value;
807          return this;
808        }
809
810        /**
811         * @return {@link #level} (Use 95 for a 95% confidence interval.). This is the underlying object with id, value and extensions. The accessor "getLevel" gives direct access to the value
812         */
813        public DecimalType getLevelElement() { 
814          if (this.level == null)
815            if (Configuration.errorOnAutoCreate())
816              throw new Error("Attempt to auto-create StatisticAttributeEstimateComponent.level");
817            else if (Configuration.doAutoCreate())
818              this.level = new DecimalType(); // bb
819          return this.level;
820        }
821
822        public boolean hasLevelElement() { 
823          return this.level != null && !this.level.isEmpty();
824        }
825
826        public boolean hasLevel() { 
827          return this.level != null && !this.level.isEmpty();
828        }
829
830        /**
831         * @param value {@link #level} (Use 95 for a 95% confidence interval.). This is the underlying object with id, value and extensions. The accessor "getLevel" gives direct access to the value
832         */
833        public StatisticAttributeEstimateComponent setLevelElement(DecimalType value) { 
834          this.level = value;
835          return this;
836        }
837
838        /**
839         * @return Use 95 for a 95% confidence interval.
840         */
841        public BigDecimal getLevel() { 
842          return this.level == null ? null : this.level.getValue();
843        }
844
845        /**
846         * @param value Use 95 for a 95% confidence interval.
847         */
848        public StatisticAttributeEstimateComponent setLevel(BigDecimal value) { 
849          if (value == null)
850            this.level = null;
851          else {
852            if (this.level == null)
853              this.level = new DecimalType();
854            this.level.setValue(value);
855          }
856          return this;
857        }
858
859        /**
860         * @param value Use 95 for a 95% confidence interval.
861         */
862        public StatisticAttributeEstimateComponent setLevel(long value) { 
863              this.level = new DecimalType();
864            this.level.setValue(value);
865          return this;
866        }
867
868        /**
869         * @param value Use 95 for a 95% confidence interval.
870         */
871        public StatisticAttributeEstimateComponent setLevel(double value) { 
872              this.level = new DecimalType();
873            this.level.setValue(value);
874          return this;
875        }
876
877        /**
878         * @return {@link #range} (Lower bound of confidence interval.)
879         */
880        public Range getRange() { 
881          if (this.range == null)
882            if (Configuration.errorOnAutoCreate())
883              throw new Error("Attempt to auto-create StatisticAttributeEstimateComponent.range");
884            else if (Configuration.doAutoCreate())
885              this.range = new Range(); // cc
886          return this.range;
887        }
888
889        public boolean hasRange() { 
890          return this.range != null && !this.range.isEmpty();
891        }
892
893        /**
894         * @param value {@link #range} (Lower bound of confidence interval.)
895         */
896        public StatisticAttributeEstimateComponent setRange(Range value) { 
897          this.range = value;
898          return this;
899        }
900
901        /**
902         * @return {@link #estimateQualifier} (An estimate of the precision of the estimate.)
903         */
904        public List<StatisticAttributeEstimateEstimateQualifierComponent> getEstimateQualifier() { 
905          if (this.estimateQualifier == null)
906            this.estimateQualifier = new ArrayList<StatisticAttributeEstimateEstimateQualifierComponent>();
907          return this.estimateQualifier;
908        }
909
910        /**
911         * @return Returns a reference to <code>this</code> for easy method chaining
912         */
913        public StatisticAttributeEstimateComponent setEstimateQualifier(List<StatisticAttributeEstimateEstimateQualifierComponent> theEstimateQualifier) { 
914          this.estimateQualifier = theEstimateQualifier;
915          return this;
916        }
917
918        public boolean hasEstimateQualifier() { 
919          if (this.estimateQualifier == null)
920            return false;
921          for (StatisticAttributeEstimateEstimateQualifierComponent item : this.estimateQualifier)
922            if (!item.isEmpty())
923              return true;
924          return false;
925        }
926
927        public StatisticAttributeEstimateEstimateQualifierComponent addEstimateQualifier() { //3
928          StatisticAttributeEstimateEstimateQualifierComponent t = new StatisticAttributeEstimateEstimateQualifierComponent();
929          if (this.estimateQualifier == null)
930            this.estimateQualifier = new ArrayList<StatisticAttributeEstimateEstimateQualifierComponent>();
931          this.estimateQualifier.add(t);
932          return t;
933        }
934
935        public StatisticAttributeEstimateComponent addEstimateQualifier(StatisticAttributeEstimateEstimateQualifierComponent t) { //3
936          if (t == null)
937            return this;
938          if (this.estimateQualifier == null)
939            this.estimateQualifier = new ArrayList<StatisticAttributeEstimateEstimateQualifierComponent>();
940          this.estimateQualifier.add(t);
941          return this;
942        }
943
944        /**
945         * @return The first repetition of repeating field {@link #estimateQualifier}, creating it if it does not already exist
946         */
947        public StatisticAttributeEstimateEstimateQualifierComponent getEstimateQualifierFirstRep() { 
948          if (getEstimateQualifier().isEmpty()) {
949            addEstimateQualifier();
950          }
951          return getEstimateQualifier().get(0);
952        }
953
954        protected void listChildren(List<Property> children) {
955          super.listChildren(children);
956          children.add(new Property("description", "string", "Human-readable summary of the estimate.", 0, 1, description));
957          children.add(new Property("note", "Annotation", "Footnote or explanatory note about the estimate.", 0, java.lang.Integer.MAX_VALUE, note));
958          children.add(new Property("type", "CodeableConcept", "The estimateType of precision estimate, eg confidence interval or p value type.", 0, 1, type));
959          children.add(new Property("quantity", "Quantity", "The singular quantity of the precision estimate, for precision estimates represented as single values; also used to report unit of measure.", 0, 1, quantity));
960          children.add(new Property("level", "decimal", "Use 95 for a 95% confidence interval.", 0, 1, level));
961          children.add(new Property("range", "Range", "Lower bound of confidence interval.", 0, 1, range));
962          children.add(new Property("estimateQualifier", "", "An estimate of the precision of the estimate.", 0, java.lang.Integer.MAX_VALUE, estimateQualifier));
963        }
964
965        @Override
966        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
967          switch (_hash) {
968          case -1724546052: /*description*/  return new Property("description", "string", "Human-readable summary of the estimate.", 0, 1, description);
969          case 3387378: /*note*/  return new Property("note", "Annotation", "Footnote or explanatory note about the estimate.", 0, java.lang.Integer.MAX_VALUE, note);
970          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The estimateType of precision estimate, eg confidence interval or p value type.", 0, 1, type);
971          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The singular quantity of the precision estimate, for precision estimates represented as single values; also used to report unit of measure.", 0, 1, quantity);
972          case 102865796: /*level*/  return new Property("level", "decimal", "Use 95 for a 95% confidence interval.", 0, 1, level);
973          case 108280125: /*range*/  return new Property("range", "Range", "Lower bound of confidence interval.", 0, 1, range);
974          case 11745378: /*estimateQualifier*/  return new Property("estimateQualifier", "", "An estimate of the precision of the estimate.", 0, java.lang.Integer.MAX_VALUE, estimateQualifier);
975          default: return super.getNamedProperty(_hash, _name, _checkValid);
976          }
977
978        }
979
980      @Override
981      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
982        switch (hash) {
983        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
984        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
985        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
986        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
987        case 102865796: /*level*/ return this.level == null ? new Base[0] : new Base[] {this.level}; // DecimalType
988        case 108280125: /*range*/ return this.range == null ? new Base[0] : new Base[] {this.range}; // Range
989        case 11745378: /*estimateQualifier*/ return this.estimateQualifier == null ? new Base[0] : this.estimateQualifier.toArray(new Base[this.estimateQualifier.size()]); // StatisticAttributeEstimateEstimateQualifierComponent
990        default: return super.getProperty(hash, name, checkValid);
991        }
992
993      }
994
995      @Override
996      public Base setProperty(int hash, String name, Base value) throws FHIRException {
997        switch (hash) {
998        case -1724546052: // description
999          this.description = castToString(value); // StringType
1000          return value;
1001        case 3387378: // note
1002          this.getNote().add(castToAnnotation(value)); // Annotation
1003          return value;
1004        case 3575610: // type
1005          this.type = castToCodeableConcept(value); // CodeableConcept
1006          return value;
1007        case -1285004149: // quantity
1008          this.quantity = castToQuantity(value); // Quantity
1009          return value;
1010        case 102865796: // level
1011          this.level = castToDecimal(value); // DecimalType
1012          return value;
1013        case 108280125: // range
1014          this.range = castToRange(value); // Range
1015          return value;
1016        case 11745378: // estimateQualifier
1017          this.getEstimateQualifier().add((StatisticAttributeEstimateEstimateQualifierComponent) value); // StatisticAttributeEstimateEstimateQualifierComponent
1018          return value;
1019        default: return super.setProperty(hash, name, value);
1020        }
1021
1022      }
1023
1024      @Override
1025      public Base setProperty(String name, Base value) throws FHIRException {
1026        if (name.equals("description")) {
1027          this.description = castToString(value); // StringType
1028        } else if (name.equals("note")) {
1029          this.getNote().add(castToAnnotation(value));
1030        } else if (name.equals("type")) {
1031          this.type = castToCodeableConcept(value); // CodeableConcept
1032        } else if (name.equals("quantity")) {
1033          this.quantity = castToQuantity(value); // Quantity
1034        } else if (name.equals("level")) {
1035          this.level = castToDecimal(value); // DecimalType
1036        } else if (name.equals("range")) {
1037          this.range = castToRange(value); // Range
1038        } else if (name.equals("estimateQualifier")) {
1039          this.getEstimateQualifier().add((StatisticAttributeEstimateEstimateQualifierComponent) value);
1040        } else
1041          return super.setProperty(name, value);
1042        return value;
1043      }
1044
1045      @Override
1046      public Base makeProperty(int hash, String name) throws FHIRException {
1047        switch (hash) {
1048        case -1724546052:  return getDescriptionElement();
1049        case 3387378:  return addNote(); 
1050        case 3575610:  return getType();
1051        case -1285004149:  return getQuantity();
1052        case 102865796:  return getLevelElement();
1053        case 108280125:  return getRange();
1054        case 11745378:  return addEstimateQualifier(); 
1055        default: return super.makeProperty(hash, name);
1056        }
1057
1058      }
1059
1060      @Override
1061      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1062        switch (hash) {
1063        case -1724546052: /*description*/ return new String[] {"string"};
1064        case 3387378: /*note*/ return new String[] {"Annotation"};
1065        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1066        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
1067        case 102865796: /*level*/ return new String[] {"decimal"};
1068        case 108280125: /*range*/ return new String[] {"Range"};
1069        case 11745378: /*estimateQualifier*/ return new String[] {};
1070        default: return super.getTypesForProperty(hash, name);
1071        }
1072
1073      }
1074
1075      @Override
1076      public Base addChild(String name) throws FHIRException {
1077        if (name.equals("description")) {
1078          throw new FHIRException("Cannot call addChild on a primitive type Statistic.description");
1079        }
1080        else if (name.equals("note")) {
1081          return addNote();
1082        }
1083        else if (name.equals("type")) {
1084          this.type = new CodeableConcept();
1085          return this.type;
1086        }
1087        else if (name.equals("quantity")) {
1088          this.quantity = new Quantity();
1089          return this.quantity;
1090        }
1091        else if (name.equals("level")) {
1092          throw new FHIRException("Cannot call addChild on a primitive type Statistic.level");
1093        }
1094        else if (name.equals("range")) {
1095          this.range = new Range();
1096          return this.range;
1097        }
1098        else if (name.equals("estimateQualifier")) {
1099          return addEstimateQualifier();
1100        }
1101        else
1102          return super.addChild(name);
1103      }
1104
1105      public StatisticAttributeEstimateComponent copy() {
1106        StatisticAttributeEstimateComponent dst = new StatisticAttributeEstimateComponent();
1107        copyValues(dst);
1108        return dst;
1109      }
1110
1111      public void copyValues(StatisticAttributeEstimateComponent dst) {
1112        super.copyValues(dst);
1113        dst.description = description == null ? null : description.copy();
1114        if (note != null) {
1115          dst.note = new ArrayList<Annotation>();
1116          for (Annotation i : note)
1117            dst.note.add(i.copy());
1118        };
1119        dst.type = type == null ? null : type.copy();
1120        dst.quantity = quantity == null ? null : quantity.copy();
1121        dst.level = level == null ? null : level.copy();
1122        dst.range = range == null ? null : range.copy();
1123        if (estimateQualifier != null) {
1124          dst.estimateQualifier = new ArrayList<StatisticAttributeEstimateEstimateQualifierComponent>();
1125          for (StatisticAttributeEstimateEstimateQualifierComponent i : estimateQualifier)
1126            dst.estimateQualifier.add(i.copy());
1127        };
1128      }
1129
1130      @Override
1131      public boolean equalsDeep(Base other_) {
1132        if (!super.equalsDeep(other_))
1133          return false;
1134        if (!(other_ instanceof StatisticAttributeEstimateComponent))
1135          return false;
1136        StatisticAttributeEstimateComponent o = (StatisticAttributeEstimateComponent) other_;
1137        return compareDeep(description, o.description, true) && compareDeep(note, o.note, true) && compareDeep(type, o.type, true)
1138           && compareDeep(quantity, o.quantity, true) && compareDeep(level, o.level, true) && compareDeep(range, o.range, true)
1139           && compareDeep(estimateQualifier, o.estimateQualifier, true);
1140      }
1141
1142      @Override
1143      public boolean equalsShallow(Base other_) {
1144        if (!super.equalsShallow(other_))
1145          return false;
1146        if (!(other_ instanceof StatisticAttributeEstimateComponent))
1147          return false;
1148        StatisticAttributeEstimateComponent o = (StatisticAttributeEstimateComponent) other_;
1149        return compareValues(description, o.description, true) && compareValues(level, o.level, true);
1150      }
1151
1152      public boolean isEmpty() {
1153        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, note, type
1154          , quantity, level, range, estimateQualifier);
1155      }
1156
1157  public String fhirType() {
1158    return "Statistic.attributeEstimate";
1159
1160  }
1161
1162  }
1163
1164    @Block()
1165    public static class StatisticAttributeEstimateEstimateQualifierComponent extends Element implements IBaseDatatypeElement {
1166        /**
1167         * Human-readable summary of the estimate.
1168         */
1169        @Child(name = "description", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1170        @Description(shortDefinition="Textual description of the precision estimate", formalDefinition="Human-readable summary of the estimate." )
1171        protected StringType description;
1172
1173        /**
1174         * Footnote or explanatory note about the estimate.
1175         */
1176        @Child(name = "note", type = {Annotation.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1177        @Description(shortDefinition="Footnote or explanatory note about the estimate", formalDefinition="Footnote or explanatory note about the estimate." )
1178        protected List<Annotation> note;
1179
1180        /**
1181         * The estimateType of attribute estimate, eg confidence interval or p value type.
1182         */
1183        @Child(name = "type", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1184        @Description(shortDefinition="The estimateType of attribute estimate, eg confidence interval or p value type", formalDefinition="The estimateType of attribute estimate, eg confidence interval or p value type." )
1185        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/attribute-estimate-type")
1186        protected CodeableConcept type;
1187
1188        /**
1189         * The singular quantity of the attribute estimate, for attribute estimates represented as single values; also used to report unit of measure.
1190         */
1191        @Child(name = "quantity", type = {Quantity.class}, order=4, min=0, max=1, modifier=false, summary=true)
1192        @Description(shortDefinition="The singular quantity of the attribute estimate, for attribute estimates represented as single values; also used to report unit of measure", formalDefinition="The singular quantity of the attribute estimate, for attribute estimates represented as single values; also used to report unit of measure." )
1193        protected Quantity quantity;
1194
1195        /**
1196         * Use 95 for a 95% confidence interval.
1197         */
1198        @Child(name = "level", type = {DecimalType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1199        @Description(shortDefinition="Level of confidence interval, eg 0.95 for 95% confidence interval", formalDefinition="Use 95 for a 95% confidence interval." )
1200        protected DecimalType level;
1201
1202        /**
1203         * Lower bound of confidence interval.
1204         */
1205        @Child(name = "range", type = {Range.class}, order=6, min=0, max=1, modifier=false, summary=true)
1206        @Description(shortDefinition="Lower and upper bound values of the precision estimate", formalDefinition="Lower bound of confidence interval." )
1207        protected Range range;
1208
1209        private static final long serialVersionUID = 1873606362L;
1210
1211    /**
1212     * Constructor
1213     */
1214      public StatisticAttributeEstimateEstimateQualifierComponent() {
1215        super();
1216      }
1217
1218        /**
1219         * @return {@link #description} (Human-readable summary of the estimate.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1220         */
1221        public StringType getDescriptionElement() { 
1222          if (this.description == null)
1223            if (Configuration.errorOnAutoCreate())
1224              throw new Error("Attempt to auto-create StatisticAttributeEstimateEstimateQualifierComponent.description");
1225            else if (Configuration.doAutoCreate())
1226              this.description = new StringType(); // bb
1227          return this.description;
1228        }
1229
1230        public boolean hasDescriptionElement() { 
1231          return this.description != null && !this.description.isEmpty();
1232        }
1233
1234        public boolean hasDescription() { 
1235          return this.description != null && !this.description.isEmpty();
1236        }
1237
1238        /**
1239         * @param value {@link #description} (Human-readable summary of the estimate.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1240         */
1241        public StatisticAttributeEstimateEstimateQualifierComponent setDescriptionElement(StringType value) { 
1242          this.description = value;
1243          return this;
1244        }
1245
1246        /**
1247         * @return Human-readable summary of the estimate.
1248         */
1249        public String getDescription() { 
1250          return this.description == null ? null : this.description.getValue();
1251        }
1252
1253        /**
1254         * @param value Human-readable summary of the estimate.
1255         */
1256        public StatisticAttributeEstimateEstimateQualifierComponent setDescription(String value) { 
1257          if (Utilities.noString(value))
1258            this.description = null;
1259          else {
1260            if (this.description == null)
1261              this.description = new StringType();
1262            this.description.setValue(value);
1263          }
1264          return this;
1265        }
1266
1267        /**
1268         * @return {@link #note} (Footnote or explanatory note about the estimate.)
1269         */
1270        public List<Annotation> getNote() { 
1271          if (this.note == null)
1272            this.note = new ArrayList<Annotation>();
1273          return this.note;
1274        }
1275
1276        /**
1277         * @return Returns a reference to <code>this</code> for easy method chaining
1278         */
1279        public StatisticAttributeEstimateEstimateQualifierComponent setNote(List<Annotation> theNote) { 
1280          this.note = theNote;
1281          return this;
1282        }
1283
1284        public boolean hasNote() { 
1285          if (this.note == null)
1286            return false;
1287          for (Annotation item : this.note)
1288            if (!item.isEmpty())
1289              return true;
1290          return false;
1291        }
1292
1293        public Annotation addNote() { //3
1294          Annotation t = new Annotation();
1295          if (this.note == null)
1296            this.note = new ArrayList<Annotation>();
1297          this.note.add(t);
1298          return t;
1299        }
1300
1301        public StatisticAttributeEstimateEstimateQualifierComponent addNote(Annotation t) { //3
1302          if (t == null)
1303            return this;
1304          if (this.note == null)
1305            this.note = new ArrayList<Annotation>();
1306          this.note.add(t);
1307          return this;
1308        }
1309
1310        /**
1311         * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
1312         */
1313        public Annotation getNoteFirstRep() { 
1314          if (getNote().isEmpty()) {
1315            addNote();
1316          }
1317          return getNote().get(0);
1318        }
1319
1320        /**
1321         * @return {@link #type} (The estimateType of attribute estimate, eg confidence interval or p value type.)
1322         */
1323        public CodeableConcept getType() { 
1324          if (this.type == null)
1325            if (Configuration.errorOnAutoCreate())
1326              throw new Error("Attempt to auto-create StatisticAttributeEstimateEstimateQualifierComponent.type");
1327            else if (Configuration.doAutoCreate())
1328              this.type = new CodeableConcept(); // cc
1329          return this.type;
1330        }
1331
1332        public boolean hasType() { 
1333          return this.type != null && !this.type.isEmpty();
1334        }
1335
1336        /**
1337         * @param value {@link #type} (The estimateType of attribute estimate, eg confidence interval or p value type.)
1338         */
1339        public StatisticAttributeEstimateEstimateQualifierComponent setType(CodeableConcept value) { 
1340          this.type = value;
1341          return this;
1342        }
1343
1344        /**
1345         * @return {@link #quantity} (The singular quantity of the attribute estimate, for attribute estimates represented as single values; also used to report unit of measure.)
1346         */
1347        public Quantity getQuantity() { 
1348          if (this.quantity == null)
1349            if (Configuration.errorOnAutoCreate())
1350              throw new Error("Attempt to auto-create StatisticAttributeEstimateEstimateQualifierComponent.quantity");
1351            else if (Configuration.doAutoCreate())
1352              this.quantity = new Quantity(); // cc
1353          return this.quantity;
1354        }
1355
1356        public boolean hasQuantity() { 
1357          return this.quantity != null && !this.quantity.isEmpty();
1358        }
1359
1360        /**
1361         * @param value {@link #quantity} (The singular quantity of the attribute estimate, for attribute estimates represented as single values; also used to report unit of measure.)
1362         */
1363        public StatisticAttributeEstimateEstimateQualifierComponent setQuantity(Quantity value) { 
1364          this.quantity = value;
1365          return this;
1366        }
1367
1368        /**
1369         * @return {@link #level} (Use 95 for a 95% confidence interval.). This is the underlying object with id, value and extensions. The accessor "getLevel" gives direct access to the value
1370         */
1371        public DecimalType getLevelElement() { 
1372          if (this.level == null)
1373            if (Configuration.errorOnAutoCreate())
1374              throw new Error("Attempt to auto-create StatisticAttributeEstimateEstimateQualifierComponent.level");
1375            else if (Configuration.doAutoCreate())
1376              this.level = new DecimalType(); // bb
1377          return this.level;
1378        }
1379
1380        public boolean hasLevelElement() { 
1381          return this.level != null && !this.level.isEmpty();
1382        }
1383
1384        public boolean hasLevel() { 
1385          return this.level != null && !this.level.isEmpty();
1386        }
1387
1388        /**
1389         * @param value {@link #level} (Use 95 for a 95% confidence interval.). This is the underlying object with id, value and extensions. The accessor "getLevel" gives direct access to the value
1390         */
1391        public StatisticAttributeEstimateEstimateQualifierComponent setLevelElement(DecimalType value) { 
1392          this.level = value;
1393          return this;
1394        }
1395
1396        /**
1397         * @return Use 95 for a 95% confidence interval.
1398         */
1399        public BigDecimal getLevel() { 
1400          return this.level == null ? null : this.level.getValue();
1401        }
1402
1403        /**
1404         * @param value Use 95 for a 95% confidence interval.
1405         */
1406        public StatisticAttributeEstimateEstimateQualifierComponent setLevel(BigDecimal value) { 
1407          if (value == null)
1408            this.level = null;
1409          else {
1410            if (this.level == null)
1411              this.level = new DecimalType();
1412            this.level.setValue(value);
1413          }
1414          return this;
1415        }
1416
1417        /**
1418         * @param value Use 95 for a 95% confidence interval.
1419         */
1420        public StatisticAttributeEstimateEstimateQualifierComponent setLevel(long value) { 
1421              this.level = new DecimalType();
1422            this.level.setValue(value);
1423          return this;
1424        }
1425
1426        /**
1427         * @param value Use 95 for a 95% confidence interval.
1428         */
1429        public StatisticAttributeEstimateEstimateQualifierComponent setLevel(double value) { 
1430              this.level = new DecimalType();
1431            this.level.setValue(value);
1432          return this;
1433        }
1434
1435        /**
1436         * @return {@link #range} (Lower bound of confidence interval.)
1437         */
1438        public Range getRange() { 
1439          if (this.range == null)
1440            if (Configuration.errorOnAutoCreate())
1441              throw new Error("Attempt to auto-create StatisticAttributeEstimateEstimateQualifierComponent.range");
1442            else if (Configuration.doAutoCreate())
1443              this.range = new Range(); // cc
1444          return this.range;
1445        }
1446
1447        public boolean hasRange() { 
1448          return this.range != null && !this.range.isEmpty();
1449        }
1450
1451        /**
1452         * @param value {@link #range} (Lower bound of confidence interval.)
1453         */
1454        public StatisticAttributeEstimateEstimateQualifierComponent setRange(Range value) { 
1455          this.range = value;
1456          return this;
1457        }
1458
1459        protected void listChildren(List<Property> children) {
1460          super.listChildren(children);
1461          children.add(new Property("description", "string", "Human-readable summary of the estimate.", 0, 1, description));
1462          children.add(new Property("note", "Annotation", "Footnote or explanatory note about the estimate.", 0, java.lang.Integer.MAX_VALUE, note));
1463          children.add(new Property("type", "CodeableConcept", "The estimateType of attribute estimate, eg confidence interval or p value type.", 0, 1, type));
1464          children.add(new Property("quantity", "Quantity", "The singular quantity of the attribute estimate, for attribute estimates represented as single values; also used to report unit of measure.", 0, 1, quantity));
1465          children.add(new Property("level", "decimal", "Use 95 for a 95% confidence interval.", 0, 1, level));
1466          children.add(new Property("range", "Range", "Lower bound of confidence interval.", 0, 1, range));
1467        }
1468
1469        @Override
1470        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1471          switch (_hash) {
1472          case -1724546052: /*description*/  return new Property("description", "string", "Human-readable summary of the estimate.", 0, 1, description);
1473          case 3387378: /*note*/  return new Property("note", "Annotation", "Footnote or explanatory note about the estimate.", 0, java.lang.Integer.MAX_VALUE, note);
1474          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The estimateType of attribute estimate, eg confidence interval or p value type.", 0, 1, type);
1475          case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "The singular quantity of the attribute estimate, for attribute estimates represented as single values; also used to report unit of measure.", 0, 1, quantity);
1476          case 102865796: /*level*/  return new Property("level", "decimal", "Use 95 for a 95% confidence interval.", 0, 1, level);
1477          case 108280125: /*range*/  return new Property("range", "Range", "Lower bound of confidence interval.", 0, 1, range);
1478          default: return super.getNamedProperty(_hash, _name, _checkValid);
1479          }
1480
1481        }
1482
1483      @Override
1484      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1485        switch (hash) {
1486        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1487        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1488        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1489        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
1490        case 102865796: /*level*/ return this.level == null ? new Base[0] : new Base[] {this.level}; // DecimalType
1491        case 108280125: /*range*/ return this.range == null ? new Base[0] : new Base[] {this.range}; // Range
1492        default: return super.getProperty(hash, name, checkValid);
1493        }
1494
1495      }
1496
1497      @Override
1498      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1499        switch (hash) {
1500        case -1724546052: // description
1501          this.description = castToString(value); // StringType
1502          return value;
1503        case 3387378: // note
1504          this.getNote().add(castToAnnotation(value)); // Annotation
1505          return value;
1506        case 3575610: // type
1507          this.type = castToCodeableConcept(value); // CodeableConcept
1508          return value;
1509        case -1285004149: // quantity
1510          this.quantity = castToQuantity(value); // Quantity
1511          return value;
1512        case 102865796: // level
1513          this.level = castToDecimal(value); // DecimalType
1514          return value;
1515        case 108280125: // range
1516          this.range = castToRange(value); // Range
1517          return value;
1518        default: return super.setProperty(hash, name, value);
1519        }
1520
1521      }
1522
1523      @Override
1524      public Base setProperty(String name, Base value) throws FHIRException {
1525        if (name.equals("description")) {
1526          this.description = castToString(value); // StringType
1527        } else if (name.equals("note")) {
1528          this.getNote().add(castToAnnotation(value));
1529        } else if (name.equals("type")) {
1530          this.type = castToCodeableConcept(value); // CodeableConcept
1531        } else if (name.equals("quantity")) {
1532          this.quantity = castToQuantity(value); // Quantity
1533        } else if (name.equals("level")) {
1534          this.level = castToDecimal(value); // DecimalType
1535        } else if (name.equals("range")) {
1536          this.range = castToRange(value); // Range
1537        } else
1538          return super.setProperty(name, value);
1539        return value;
1540      }
1541
1542      @Override
1543      public Base makeProperty(int hash, String name) throws FHIRException {
1544        switch (hash) {
1545        case -1724546052:  return getDescriptionElement();
1546        case 3387378:  return addNote(); 
1547        case 3575610:  return getType();
1548        case -1285004149:  return getQuantity();
1549        case 102865796:  return getLevelElement();
1550        case 108280125:  return getRange();
1551        default: return super.makeProperty(hash, name);
1552        }
1553
1554      }
1555
1556      @Override
1557      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1558        switch (hash) {
1559        case -1724546052: /*description*/ return new String[] {"string"};
1560        case 3387378: /*note*/ return new String[] {"Annotation"};
1561        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1562        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
1563        case 102865796: /*level*/ return new String[] {"decimal"};
1564        case 108280125: /*range*/ return new String[] {"Range"};
1565        default: return super.getTypesForProperty(hash, name);
1566        }
1567
1568      }
1569
1570      @Override
1571      public Base addChild(String name) throws FHIRException {
1572        if (name.equals("description")) {
1573          throw new FHIRException("Cannot call addChild on a primitive type Statistic.description");
1574        }
1575        else if (name.equals("note")) {
1576          return addNote();
1577        }
1578        else if (name.equals("type")) {
1579          this.type = new CodeableConcept();
1580          return this.type;
1581        }
1582        else if (name.equals("quantity")) {
1583          this.quantity = new Quantity();
1584          return this.quantity;
1585        }
1586        else if (name.equals("level")) {
1587          throw new FHIRException("Cannot call addChild on a primitive type Statistic.level");
1588        }
1589        else if (name.equals("range")) {
1590          this.range = new Range();
1591          return this.range;
1592        }
1593        else
1594          return super.addChild(name);
1595      }
1596
1597      public StatisticAttributeEstimateEstimateQualifierComponent copy() {
1598        StatisticAttributeEstimateEstimateQualifierComponent dst = new StatisticAttributeEstimateEstimateQualifierComponent();
1599        copyValues(dst);
1600        return dst;
1601      }
1602
1603      public void copyValues(StatisticAttributeEstimateEstimateQualifierComponent dst) {
1604        super.copyValues(dst);
1605        dst.description = description == null ? null : description.copy();
1606        if (note != null) {
1607          dst.note = new ArrayList<Annotation>();
1608          for (Annotation i : note)
1609            dst.note.add(i.copy());
1610        };
1611        dst.type = type == null ? null : type.copy();
1612        dst.quantity = quantity == null ? null : quantity.copy();
1613        dst.level = level == null ? null : level.copy();
1614        dst.range = range == null ? null : range.copy();
1615      }
1616
1617      @Override
1618      public boolean equalsDeep(Base other_) {
1619        if (!super.equalsDeep(other_))
1620          return false;
1621        if (!(other_ instanceof StatisticAttributeEstimateEstimateQualifierComponent))
1622          return false;
1623        StatisticAttributeEstimateEstimateQualifierComponent o = (StatisticAttributeEstimateEstimateQualifierComponent) other_;
1624        return compareDeep(description, o.description, true) && compareDeep(note, o.note, true) && compareDeep(type, o.type, true)
1625           && compareDeep(quantity, o.quantity, true) && compareDeep(level, o.level, true) && compareDeep(range, o.range, true)
1626          ;
1627      }
1628
1629      @Override
1630      public boolean equalsShallow(Base other_) {
1631        if (!super.equalsShallow(other_))
1632          return false;
1633        if (!(other_ instanceof StatisticAttributeEstimateEstimateQualifierComponent))
1634          return false;
1635        StatisticAttributeEstimateEstimateQualifierComponent o = (StatisticAttributeEstimateEstimateQualifierComponent) other_;
1636        return compareValues(description, o.description, true) && compareValues(level, o.level, true);
1637      }
1638
1639      public boolean isEmpty() {
1640        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, note, type
1641          , quantity, level, range);
1642      }
1643
1644  public String fhirType() {
1645    return "Statistic.attributeEstimate.estimateQualifier";
1646
1647  }
1648
1649  }
1650
1651    /**
1652     * A description of the content value of the statistic.
1653     */
1654    @Child(name = "description", type = {StringType.class}, order=0, min=0, max=1, modifier=false, summary=true)
1655    @Description(shortDefinition="Description of content", formalDefinition="A description of the content value of the statistic." )
1656    protected StringType description;
1657
1658    /**
1659     * Footnotes and/or explanatory notes.
1660     */
1661    @Child(name = "note", type = {Annotation.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1662    @Description(shortDefinition="Footnotes and/or explanatory notes", formalDefinition="Footnotes and/or explanatory notes." )
1663    protected List<Annotation> note;
1664
1665    /**
1666     * Type of statistic, eg relative risk.
1667     */
1668    @Child(name = "statisticType", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1669    @Description(shortDefinition="Type of statistic, eg relative risk", formalDefinition="Type of statistic, eg relative risk." )
1670    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/statistic-type")
1671    protected CodeableConcept statisticType;
1672
1673    /**
1674     * Statistic value.
1675     */
1676    @Child(name = "quantity", type = {Quantity.class}, order=3, min=0, max=1, modifier=false, summary=true)
1677    @Description(shortDefinition="Statistic value", formalDefinition="Statistic value." )
1678    protected Quantity quantity;
1679
1680    /**
1681     * Number of samples in the statistic.
1682     */
1683    @Child(name = "sampleSize", type = {}, order=4, min=0, max=1, modifier=false, summary=true)
1684    @Description(shortDefinition="Number of samples in the statistic", formalDefinition="Number of samples in the statistic." )
1685    protected StatisticSampleSizeComponent sampleSize;
1686
1687    /**
1688     * An estimate of the precision of the statistic.
1689     */
1690    @Child(name = "attributeEstimate", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1691    @Description(shortDefinition="An estimate of the precision of the statistic", formalDefinition="An estimate of the precision of the statistic." )
1692    protected List<StatisticAttributeEstimateComponent> attributeEstimate;
1693
1694    private static final long serialVersionUID = 1999038309L;
1695
1696  /**
1697   * Constructor
1698   */
1699    public Statistic() {
1700      super();
1701    }
1702
1703    /**
1704     * @return {@link #description} (A description of the content value of the statistic.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1705     */
1706    public StringType getDescriptionElement() { 
1707      if (this.description == null)
1708        if (Configuration.errorOnAutoCreate())
1709          throw new Error("Attempt to auto-create Statistic.description");
1710        else if (Configuration.doAutoCreate())
1711          this.description = new StringType(); // bb
1712      return this.description;
1713    }
1714
1715    public boolean hasDescriptionElement() { 
1716      return this.description != null && !this.description.isEmpty();
1717    }
1718
1719    public boolean hasDescription() { 
1720      return this.description != null && !this.description.isEmpty();
1721    }
1722
1723    /**
1724     * @param value {@link #description} (A description of the content value of the statistic.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1725     */
1726    public Statistic setDescriptionElement(StringType value) { 
1727      this.description = value;
1728      return this;
1729    }
1730
1731    /**
1732     * @return A description of the content value of the statistic.
1733     */
1734    public String getDescription() { 
1735      return this.description == null ? null : this.description.getValue();
1736    }
1737
1738    /**
1739     * @param value A description of the content value of the statistic.
1740     */
1741    public Statistic setDescription(String value) { 
1742      if (Utilities.noString(value))
1743        this.description = null;
1744      else {
1745        if (this.description == null)
1746          this.description = new StringType();
1747        this.description.setValue(value);
1748      }
1749      return this;
1750    }
1751
1752    /**
1753     * @return {@link #note} (Footnotes and/or explanatory notes.)
1754     */
1755    public List<Annotation> getNote() { 
1756      if (this.note == null)
1757        this.note = new ArrayList<Annotation>();
1758      return this.note;
1759    }
1760
1761    /**
1762     * @return Returns a reference to <code>this</code> for easy method chaining
1763     */
1764    public Statistic setNote(List<Annotation> theNote) { 
1765      this.note = theNote;
1766      return this;
1767    }
1768
1769    public boolean hasNote() { 
1770      if (this.note == null)
1771        return false;
1772      for (Annotation item : this.note)
1773        if (!item.isEmpty())
1774          return true;
1775      return false;
1776    }
1777
1778    public Annotation addNote() { //3
1779      Annotation t = new Annotation();
1780      if (this.note == null)
1781        this.note = new ArrayList<Annotation>();
1782      this.note.add(t);
1783      return t;
1784    }
1785
1786    public Statistic addNote(Annotation t) { //3
1787      if (t == null)
1788        return this;
1789      if (this.note == null)
1790        this.note = new ArrayList<Annotation>();
1791      this.note.add(t);
1792      return this;
1793    }
1794
1795    /**
1796     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist
1797     */
1798    public Annotation getNoteFirstRep() { 
1799      if (getNote().isEmpty()) {
1800        addNote();
1801      }
1802      return getNote().get(0);
1803    }
1804
1805    /**
1806     * @return {@link #statisticType} (Type of statistic, eg relative risk.)
1807     */
1808    public CodeableConcept getStatisticType() { 
1809      if (this.statisticType == null)
1810        if (Configuration.errorOnAutoCreate())
1811          throw new Error("Attempt to auto-create Statistic.statisticType");
1812        else if (Configuration.doAutoCreate())
1813          this.statisticType = new CodeableConcept(); // cc
1814      return this.statisticType;
1815    }
1816
1817    public boolean hasStatisticType() { 
1818      return this.statisticType != null && !this.statisticType.isEmpty();
1819    }
1820
1821    /**
1822     * @param value {@link #statisticType} (Type of statistic, eg relative risk.)
1823     */
1824    public Statistic setStatisticType(CodeableConcept value) { 
1825      this.statisticType = value;
1826      return this;
1827    }
1828
1829    /**
1830     * @return {@link #quantity} (Statistic value.)
1831     */
1832    public Quantity getQuantity() { 
1833      if (this.quantity == null)
1834        if (Configuration.errorOnAutoCreate())
1835          throw new Error("Attempt to auto-create Statistic.quantity");
1836        else if (Configuration.doAutoCreate())
1837          this.quantity = new Quantity(); // cc
1838      return this.quantity;
1839    }
1840
1841    public boolean hasQuantity() { 
1842      return this.quantity != null && !this.quantity.isEmpty();
1843    }
1844
1845    /**
1846     * @param value {@link #quantity} (Statistic value.)
1847     */
1848    public Statistic setQuantity(Quantity value) { 
1849      this.quantity = value;
1850      return this;
1851    }
1852
1853    /**
1854     * @return {@link #sampleSize} (Number of samples in the statistic.)
1855     */
1856    public StatisticSampleSizeComponent getSampleSize() { 
1857      if (this.sampleSize == null)
1858        if (Configuration.errorOnAutoCreate())
1859          throw new Error("Attempt to auto-create Statistic.sampleSize");
1860        else if (Configuration.doAutoCreate())
1861          this.sampleSize = new StatisticSampleSizeComponent(); // cc
1862      return this.sampleSize;
1863    }
1864
1865    public boolean hasSampleSize() { 
1866      return this.sampleSize != null && !this.sampleSize.isEmpty();
1867    }
1868
1869    /**
1870     * @param value {@link #sampleSize} (Number of samples in the statistic.)
1871     */
1872    public Statistic setSampleSize(StatisticSampleSizeComponent value) { 
1873      this.sampleSize = value;
1874      return this;
1875    }
1876
1877    /**
1878     * @return {@link #attributeEstimate} (An estimate of the precision of the statistic.)
1879     */
1880    public List<StatisticAttributeEstimateComponent> getAttributeEstimate() { 
1881      if (this.attributeEstimate == null)
1882        this.attributeEstimate = new ArrayList<StatisticAttributeEstimateComponent>();
1883      return this.attributeEstimate;
1884    }
1885
1886    /**
1887     * @return Returns a reference to <code>this</code> for easy method chaining
1888     */
1889    public Statistic setAttributeEstimate(List<StatisticAttributeEstimateComponent> theAttributeEstimate) { 
1890      this.attributeEstimate = theAttributeEstimate;
1891      return this;
1892    }
1893
1894    public boolean hasAttributeEstimate() { 
1895      if (this.attributeEstimate == null)
1896        return false;
1897      for (StatisticAttributeEstimateComponent item : this.attributeEstimate)
1898        if (!item.isEmpty())
1899          return true;
1900      return false;
1901    }
1902
1903    public StatisticAttributeEstimateComponent addAttributeEstimate() { //3
1904      StatisticAttributeEstimateComponent t = new StatisticAttributeEstimateComponent();
1905      if (this.attributeEstimate == null)
1906        this.attributeEstimate = new ArrayList<StatisticAttributeEstimateComponent>();
1907      this.attributeEstimate.add(t);
1908      return t;
1909    }
1910
1911    public Statistic addAttributeEstimate(StatisticAttributeEstimateComponent t) { //3
1912      if (t == null)
1913        return this;
1914      if (this.attributeEstimate == null)
1915        this.attributeEstimate = new ArrayList<StatisticAttributeEstimateComponent>();
1916      this.attributeEstimate.add(t);
1917      return this;
1918    }
1919
1920    /**
1921     * @return The first repetition of repeating field {@link #attributeEstimate}, creating it if it does not already exist
1922     */
1923    public StatisticAttributeEstimateComponent getAttributeEstimateFirstRep() { 
1924      if (getAttributeEstimate().isEmpty()) {
1925        addAttributeEstimate();
1926      }
1927      return getAttributeEstimate().get(0);
1928    }
1929
1930      protected void listChildren(List<Property> children) {
1931        super.listChildren(children);
1932        children.add(new Property("description", "string", "A description of the content value of the statistic.", 0, 1, description));
1933        children.add(new Property("note", "Annotation", "Footnotes and/or explanatory notes.", 0, java.lang.Integer.MAX_VALUE, note));
1934        children.add(new Property("statisticType", "CodeableConcept", "Type of statistic, eg relative risk.", 0, 1, statisticType));
1935        children.add(new Property("quantity", "Quantity", "Statistic value.", 0, 1, quantity));
1936        children.add(new Property("sampleSize", "", "Number of samples in the statistic.", 0, 1, sampleSize));
1937        children.add(new Property("attributeEstimate", "", "An estimate of the precision of the statistic.", 0, java.lang.Integer.MAX_VALUE, attributeEstimate));
1938      }
1939
1940      @Override
1941      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1942        switch (_hash) {
1943        case -1724546052: /*description*/  return new Property("description", "string", "A description of the content value of the statistic.", 0, 1, description);
1944        case 3387378: /*note*/  return new Property("note", "Annotation", "Footnotes and/or explanatory notes.", 0, java.lang.Integer.MAX_VALUE, note);
1945        case -392342358: /*statisticType*/  return new Property("statisticType", "CodeableConcept", "Type of statistic, eg relative risk.", 0, 1, statisticType);
1946        case -1285004149: /*quantity*/  return new Property("quantity", "Quantity", "Statistic value.", 0, 1, quantity);
1947        case 143123659: /*sampleSize*/  return new Property("sampleSize", "", "Number of samples in the statistic.", 0, 1, sampleSize);
1948        case -1539581980: /*attributeEstimate*/  return new Property("attributeEstimate", "", "An estimate of the precision of the statistic.", 0, java.lang.Integer.MAX_VALUE, attributeEstimate);
1949        default: return super.getNamedProperty(_hash, _name, _checkValid);
1950        }
1951
1952      }
1953
1954      @Override
1955      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1956        switch (hash) {
1957        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1958        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
1959        case -392342358: /*statisticType*/ return this.statisticType == null ? new Base[0] : new Base[] {this.statisticType}; // CodeableConcept
1960        case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity
1961        case 143123659: /*sampleSize*/ return this.sampleSize == null ? new Base[0] : new Base[] {this.sampleSize}; // StatisticSampleSizeComponent
1962        case -1539581980: /*attributeEstimate*/ return this.attributeEstimate == null ? new Base[0] : this.attributeEstimate.toArray(new Base[this.attributeEstimate.size()]); // StatisticAttributeEstimateComponent
1963        default: return super.getProperty(hash, name, checkValid);
1964        }
1965
1966      }
1967
1968      @Override
1969      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1970        switch (hash) {
1971        case -1724546052: // description
1972          this.description = castToString(value); // StringType
1973          return value;
1974        case 3387378: // note
1975          this.getNote().add(castToAnnotation(value)); // Annotation
1976          return value;
1977        case -392342358: // statisticType
1978          this.statisticType = castToCodeableConcept(value); // CodeableConcept
1979          return value;
1980        case -1285004149: // quantity
1981          this.quantity = castToQuantity(value); // Quantity
1982          return value;
1983        case 143123659: // sampleSize
1984          this.sampleSize = (StatisticSampleSizeComponent) value; // StatisticSampleSizeComponent
1985          return value;
1986        case -1539581980: // attributeEstimate
1987          this.getAttributeEstimate().add((StatisticAttributeEstimateComponent) value); // StatisticAttributeEstimateComponent
1988          return value;
1989        default: return super.setProperty(hash, name, value);
1990        }
1991
1992      }
1993
1994      @Override
1995      public Base setProperty(String name, Base value) throws FHIRException {
1996        if (name.equals("description")) {
1997          this.description = castToString(value); // StringType
1998        } else if (name.equals("note")) {
1999          this.getNote().add(castToAnnotation(value));
2000        } else if (name.equals("statisticType")) {
2001          this.statisticType = castToCodeableConcept(value); // CodeableConcept
2002        } else if (name.equals("quantity")) {
2003          this.quantity = castToQuantity(value); // Quantity
2004        } else if (name.equals("sampleSize")) {
2005          this.sampleSize = (StatisticSampleSizeComponent) value; // StatisticSampleSizeComponent
2006        } else if (name.equals("attributeEstimate")) {
2007          this.getAttributeEstimate().add((StatisticAttributeEstimateComponent) value);
2008        } else
2009          return super.setProperty(name, value);
2010        return value;
2011      }
2012
2013      @Override
2014      public Base makeProperty(int hash, String name) throws FHIRException {
2015        switch (hash) {
2016        case -1724546052:  return getDescriptionElement();
2017        case 3387378:  return addNote(); 
2018        case -392342358:  return getStatisticType();
2019        case -1285004149:  return getQuantity();
2020        case 143123659:  return getSampleSize();
2021        case -1539581980:  return addAttributeEstimate(); 
2022        default: return super.makeProperty(hash, name);
2023        }
2024
2025      }
2026
2027      @Override
2028      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2029        switch (hash) {
2030        case -1724546052: /*description*/ return new String[] {"string"};
2031        case 3387378: /*note*/ return new String[] {"Annotation"};
2032        case -392342358: /*statisticType*/ return new String[] {"CodeableConcept"};
2033        case -1285004149: /*quantity*/ return new String[] {"Quantity"};
2034        case 143123659: /*sampleSize*/ return new String[] {};
2035        case -1539581980: /*attributeEstimate*/ return new String[] {};
2036        default: return super.getTypesForProperty(hash, name);
2037        }
2038
2039      }
2040
2041      @Override
2042      public Base addChild(String name) throws FHIRException {
2043        if (name.equals("description")) {
2044          throw new FHIRException("Cannot call addChild on a primitive type Statistic.description");
2045        }
2046        else if (name.equals("note")) {
2047          return addNote();
2048        }
2049        else if (name.equals("statisticType")) {
2050          this.statisticType = new CodeableConcept();
2051          return this.statisticType;
2052        }
2053        else if (name.equals("quantity")) {
2054          this.quantity = new Quantity();
2055          return this.quantity;
2056        }
2057        else if (name.equals("sampleSize")) {
2058          this.sampleSize = new StatisticSampleSizeComponent();
2059          return this.sampleSize;
2060        }
2061        else if (name.equals("attributeEstimate")) {
2062          return addAttributeEstimate();
2063        }
2064        else
2065          return super.addChild(name);
2066      }
2067
2068  public String fhirType() {
2069    return "Statistic";
2070
2071  }
2072
2073      public Statistic copy() {
2074        Statistic dst = new Statistic();
2075        copyValues(dst);
2076        return dst;
2077      }
2078
2079      public void copyValues(Statistic dst) {
2080        super.copyValues(dst);
2081        dst.description = description == null ? null : description.copy();
2082        if (note != null) {
2083          dst.note = new ArrayList<Annotation>();
2084          for (Annotation i : note)
2085            dst.note.add(i.copy());
2086        };
2087        dst.statisticType = statisticType == null ? null : statisticType.copy();
2088        dst.quantity = quantity == null ? null : quantity.copy();
2089        dst.sampleSize = sampleSize == null ? null : sampleSize.copy();
2090        if (attributeEstimate != null) {
2091          dst.attributeEstimate = new ArrayList<StatisticAttributeEstimateComponent>();
2092          for (StatisticAttributeEstimateComponent i : attributeEstimate)
2093            dst.attributeEstimate.add(i.copy());
2094        };
2095      }
2096
2097      protected Statistic typedCopy() {
2098        return copy();
2099      }
2100
2101      @Override
2102      public boolean equalsDeep(Base other_) {
2103        if (!super.equalsDeep(other_))
2104          return false;
2105        if (!(other_ instanceof Statistic))
2106          return false;
2107        Statistic o = (Statistic) other_;
2108        return compareDeep(description, o.description, true) && compareDeep(note, o.note, true) && compareDeep(statisticType, o.statisticType, true)
2109           && compareDeep(quantity, o.quantity, true) && compareDeep(sampleSize, o.sampleSize, true) && compareDeep(attributeEstimate, o.attributeEstimate, true)
2110          ;
2111      }
2112
2113      @Override
2114      public boolean equalsShallow(Base other_) {
2115        if (!super.equalsShallow(other_))
2116          return false;
2117        if (!(other_ instanceof Statistic))
2118          return false;
2119        Statistic o = (Statistic) other_;
2120        return compareValues(description, o.description, true);
2121      }
2122
2123      public boolean isEmpty() {
2124        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, note, statisticType
2125          , quantity, sampleSize, attributeEstimate);
2126      }
2127
2128
2129}
2130