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