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