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 Fri, Jul 15, 2022 11:20+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 SampledData Type: A series of measurements taken by a device, with upper and lower limits. There may be more than one dimension in the data.
051 */
052@DatatypeDef(name="SampledData")
053public class SampledData extends DataType implements ICompositeType {
054
055    /**
056     * The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.
057     */
058    @Child(name = "origin", type = {Quantity.class}, order=0, min=1, max=1, modifier=false, summary=true)
059    @Description(shortDefinition="Zero value and units", formalDefinition="The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series." )
060    protected Quantity origin;
061
062    /**
063     * The length of time between sampling times, measured in milliseconds.
064     */
065    @Child(name = "period", type = {DecimalType.class}, order=1, min=1, max=1, modifier=false, summary=true)
066    @Description(shortDefinition="Number of milliseconds between samples", formalDefinition="The length of time between sampling times, measured in milliseconds." )
067    protected DecimalType period;
068
069    /**
070     * A correction factor that is applied to the sampled data points before they are added to the origin.
071     */
072    @Child(name = "factor", type = {DecimalType.class}, order=2, min=0, max=1, modifier=false, summary=true)
073    @Description(shortDefinition="Multiply data by this before adding to origin", formalDefinition="A correction factor that is applied to the sampled data points before they are added to the origin." )
074    protected DecimalType factor;
075
076    /**
077     * The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit).
078     */
079    @Child(name = "lowerLimit", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
080    @Description(shortDefinition="Lower limit of detection", formalDefinition="The lower limit of detection of the measured points. This is needed if any of the data points have the value \"L\" (lower than detection limit)." )
081    protected DecimalType lowerLimit;
082
083    /**
084     * The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit).
085     */
086    @Child(name = "upperLimit", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
087    @Description(shortDefinition="Upper limit of detection", formalDefinition="The upper limit of detection of the measured points. This is needed if any of the data points have the value \"U\" (higher than detection limit)." )
088    protected DecimalType upperLimit;
089
090    /**
091     * The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once.
092     */
093    @Child(name = "dimensions", type = {PositiveIntType.class}, order=5, min=1, max=1, modifier=false, summary=true)
094    @Description(shortDefinition="Number of sample points at each time point", formalDefinition="The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once." )
095    protected PositiveIntType dimensions;
096
097    /**
098     * A series of data points which are decimal values separated by a single space (character u20). The special values "E" (error), "L" (below detection limit) and "U" (above detection limit) can also be used in place of a decimal value.
099     */
100    @Child(name = "data", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
101    @Description(shortDefinition="Decimal values with spaces, or \"E\" | \"U\" | \"L\"", formalDefinition="A series of data points which are decimal values separated by a single space (character u20). The special values \"E\" (error), \"L\" (below detection limit) and \"U\" (above detection limit) can also be used in place of a decimal value." )
102    protected StringType data;
103
104    private static final long serialVersionUID = -1984181262L;
105
106  /**
107   * Constructor
108   */
109    public SampledData() {
110      super();
111    }
112
113  /**
114   * Constructor
115   */
116    public SampledData(Quantity origin, BigDecimal period, int dimensions) {
117      super();
118      this.setOrigin(origin);
119      this.setPeriod(period);
120      this.setDimensions(dimensions);
121    }
122
123    /**
124     * @return {@link #origin} (The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.)
125     */
126    public Quantity getOrigin() { 
127      if (this.origin == null)
128        if (Configuration.errorOnAutoCreate())
129          throw new Error("Attempt to auto-create SampledData.origin");
130        else if (Configuration.doAutoCreate())
131          this.origin = new Quantity(); // cc
132      return this.origin;
133    }
134
135    public boolean hasOrigin() { 
136      return this.origin != null && !this.origin.isEmpty();
137    }
138
139    /**
140     * @param value {@link #origin} (The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.)
141     */
142    public SampledData setOrigin(Quantity value) { 
143      this.origin = value;
144      return this;
145    }
146
147    /**
148     * @return {@link #period} (The length of time between sampling times, measured in milliseconds.). This is the underlying object with id, value and extensions. The accessor "getPeriod" gives direct access to the value
149     */
150    public DecimalType getPeriodElement() { 
151      if (this.period == null)
152        if (Configuration.errorOnAutoCreate())
153          throw new Error("Attempt to auto-create SampledData.period");
154        else if (Configuration.doAutoCreate())
155          this.period = new DecimalType(); // bb
156      return this.period;
157    }
158
159    public boolean hasPeriodElement() { 
160      return this.period != null && !this.period.isEmpty();
161    }
162
163    public boolean hasPeriod() { 
164      return this.period != null && !this.period.isEmpty();
165    }
166
167    /**
168     * @param value {@link #period} (The length of time between sampling times, measured in milliseconds.). This is the underlying object with id, value and extensions. The accessor "getPeriod" gives direct access to the value
169     */
170    public SampledData setPeriodElement(DecimalType value) { 
171      this.period = value;
172      return this;
173    }
174
175    /**
176     * @return The length of time between sampling times, measured in milliseconds.
177     */
178    public BigDecimal getPeriod() { 
179      return this.period == null ? null : this.period.getValue();
180    }
181
182    /**
183     * @param value The length of time between sampling times, measured in milliseconds.
184     */
185    public SampledData setPeriod(BigDecimal value) { 
186        if (this.period == null)
187          this.period = new DecimalType();
188        this.period.setValue(value);
189      return this;
190    }
191
192    /**
193     * @param value The length of time between sampling times, measured in milliseconds.
194     */
195    public SampledData setPeriod(long value) { 
196          this.period = new DecimalType();
197        this.period.setValue(value);
198      return this;
199    }
200
201    /**
202     * @param value The length of time between sampling times, measured in milliseconds.
203     */
204    public SampledData setPeriod(double value) { 
205          this.period = new DecimalType();
206        this.period.setValue(value);
207      return this;
208    }
209
210    /**
211     * @return {@link #factor} (A correction factor that is applied to the sampled data points before they are added to the origin.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
212     */
213    public DecimalType getFactorElement() { 
214      if (this.factor == null)
215        if (Configuration.errorOnAutoCreate())
216          throw new Error("Attempt to auto-create SampledData.factor");
217        else if (Configuration.doAutoCreate())
218          this.factor = new DecimalType(); // bb
219      return this.factor;
220    }
221
222    public boolean hasFactorElement() { 
223      return this.factor != null && !this.factor.isEmpty();
224    }
225
226    public boolean hasFactor() { 
227      return this.factor != null && !this.factor.isEmpty();
228    }
229
230    /**
231     * @param value {@link #factor} (A correction factor that is applied to the sampled data points before they are added to the origin.). This is the underlying object with id, value and extensions. The accessor "getFactor" gives direct access to the value
232     */
233    public SampledData setFactorElement(DecimalType value) { 
234      this.factor = value;
235      return this;
236    }
237
238    /**
239     * @return A correction factor that is applied to the sampled data points before they are added to the origin.
240     */
241    public BigDecimal getFactor() { 
242      return this.factor == null ? null : this.factor.getValue();
243    }
244
245    /**
246     * @param value A correction factor that is applied to the sampled data points before they are added to the origin.
247     */
248    public SampledData setFactor(BigDecimal value) { 
249      if (value == null)
250        this.factor = null;
251      else {
252        if (this.factor == null)
253          this.factor = new DecimalType();
254        this.factor.setValue(value);
255      }
256      return this;
257    }
258
259    /**
260     * @param value A correction factor that is applied to the sampled data points before they are added to the origin.
261     */
262    public SampledData setFactor(long value) { 
263          this.factor = new DecimalType();
264        this.factor.setValue(value);
265      return this;
266    }
267
268    /**
269     * @param value A correction factor that is applied to the sampled data points before they are added to the origin.
270     */
271    public SampledData setFactor(double value) { 
272          this.factor = new DecimalType();
273        this.factor.setValue(value);
274      return this;
275    }
276
277    /**
278     * @return {@link #lowerLimit} (The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit).). This is the underlying object with id, value and extensions. The accessor "getLowerLimit" gives direct access to the value
279     */
280    public DecimalType getLowerLimitElement() { 
281      if (this.lowerLimit == null)
282        if (Configuration.errorOnAutoCreate())
283          throw new Error("Attempt to auto-create SampledData.lowerLimit");
284        else if (Configuration.doAutoCreate())
285          this.lowerLimit = new DecimalType(); // bb
286      return this.lowerLimit;
287    }
288
289    public boolean hasLowerLimitElement() { 
290      return this.lowerLimit != null && !this.lowerLimit.isEmpty();
291    }
292
293    public boolean hasLowerLimit() { 
294      return this.lowerLimit != null && !this.lowerLimit.isEmpty();
295    }
296
297    /**
298     * @param value {@link #lowerLimit} (The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit).). This is the underlying object with id, value and extensions. The accessor "getLowerLimit" gives direct access to the value
299     */
300    public SampledData setLowerLimitElement(DecimalType value) { 
301      this.lowerLimit = value;
302      return this;
303    }
304
305    /**
306     * @return The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit).
307     */
308    public BigDecimal getLowerLimit() { 
309      return this.lowerLimit == null ? null : this.lowerLimit.getValue();
310    }
311
312    /**
313     * @param value The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit).
314     */
315    public SampledData setLowerLimit(BigDecimal value) { 
316      if (value == null)
317        this.lowerLimit = null;
318      else {
319        if (this.lowerLimit == null)
320          this.lowerLimit = new DecimalType();
321        this.lowerLimit.setValue(value);
322      }
323      return this;
324    }
325
326    /**
327     * @param value The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit).
328     */
329    public SampledData setLowerLimit(long value) { 
330          this.lowerLimit = new DecimalType();
331        this.lowerLimit.setValue(value);
332      return this;
333    }
334
335    /**
336     * @param value The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit).
337     */
338    public SampledData setLowerLimit(double value) { 
339          this.lowerLimit = new DecimalType();
340        this.lowerLimit.setValue(value);
341      return this;
342    }
343
344    /**
345     * @return {@link #upperLimit} (The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit).). This is the underlying object with id, value and extensions. The accessor "getUpperLimit" gives direct access to the value
346     */
347    public DecimalType getUpperLimitElement() { 
348      if (this.upperLimit == null)
349        if (Configuration.errorOnAutoCreate())
350          throw new Error("Attempt to auto-create SampledData.upperLimit");
351        else if (Configuration.doAutoCreate())
352          this.upperLimit = new DecimalType(); // bb
353      return this.upperLimit;
354    }
355
356    public boolean hasUpperLimitElement() { 
357      return this.upperLimit != null && !this.upperLimit.isEmpty();
358    }
359
360    public boolean hasUpperLimit() { 
361      return this.upperLimit != null && !this.upperLimit.isEmpty();
362    }
363
364    /**
365     * @param value {@link #upperLimit} (The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit).). This is the underlying object with id, value and extensions. The accessor "getUpperLimit" gives direct access to the value
366     */
367    public SampledData setUpperLimitElement(DecimalType value) { 
368      this.upperLimit = value;
369      return this;
370    }
371
372    /**
373     * @return The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit).
374     */
375    public BigDecimal getUpperLimit() { 
376      return this.upperLimit == null ? null : this.upperLimit.getValue();
377    }
378
379    /**
380     * @param value The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit).
381     */
382    public SampledData setUpperLimit(BigDecimal value) { 
383      if (value == null)
384        this.upperLimit = null;
385      else {
386        if (this.upperLimit == null)
387          this.upperLimit = new DecimalType();
388        this.upperLimit.setValue(value);
389      }
390      return this;
391    }
392
393    /**
394     * @param value The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit).
395     */
396    public SampledData setUpperLimit(long value) { 
397          this.upperLimit = new DecimalType();
398        this.upperLimit.setValue(value);
399      return this;
400    }
401
402    /**
403     * @param value The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit).
404     */
405    public SampledData setUpperLimit(double value) { 
406          this.upperLimit = new DecimalType();
407        this.upperLimit.setValue(value);
408      return this;
409    }
410
411    /**
412     * @return {@link #dimensions} (The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once.). This is the underlying object with id, value and extensions. The accessor "getDimensions" gives direct access to the value
413     */
414    public PositiveIntType getDimensionsElement() { 
415      if (this.dimensions == null)
416        if (Configuration.errorOnAutoCreate())
417          throw new Error("Attempt to auto-create SampledData.dimensions");
418        else if (Configuration.doAutoCreate())
419          this.dimensions = new PositiveIntType(); // bb
420      return this.dimensions;
421    }
422
423    public boolean hasDimensionsElement() { 
424      return this.dimensions != null && !this.dimensions.isEmpty();
425    }
426
427    public boolean hasDimensions() { 
428      return this.dimensions != null && !this.dimensions.isEmpty();
429    }
430
431    /**
432     * @param value {@link #dimensions} (The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once.). This is the underlying object with id, value and extensions. The accessor "getDimensions" gives direct access to the value
433     */
434    public SampledData setDimensionsElement(PositiveIntType value) { 
435      this.dimensions = value;
436      return this;
437    }
438
439    /**
440     * @return The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once.
441     */
442    public int getDimensions() { 
443      return this.dimensions == null || this.dimensions.isEmpty() ? 0 : this.dimensions.getValue();
444    }
445
446    /**
447     * @param value The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once.
448     */
449    public SampledData setDimensions(int value) { 
450        if (this.dimensions == null)
451          this.dimensions = new PositiveIntType();
452        this.dimensions.setValue(value);
453      return this;
454    }
455
456    /**
457     * @return {@link #data} (A series of data points which are decimal values separated by a single space (character u20). The special values "E" (error), "L" (below detection limit) and "U" (above detection limit) can also be used in place of a decimal value.). This is the underlying object with id, value and extensions. The accessor "getData" gives direct access to the value
458     */
459    public StringType getDataElement() { 
460      if (this.data == null)
461        if (Configuration.errorOnAutoCreate())
462          throw new Error("Attempt to auto-create SampledData.data");
463        else if (Configuration.doAutoCreate())
464          this.data = new StringType(); // bb
465      return this.data;
466    }
467
468    public boolean hasDataElement() { 
469      return this.data != null && !this.data.isEmpty();
470    }
471
472    public boolean hasData() { 
473      return this.data != null && !this.data.isEmpty();
474    }
475
476    /**
477     * @param value {@link #data} (A series of data points which are decimal values separated by a single space (character u20). The special values "E" (error), "L" (below detection limit) and "U" (above detection limit) can also be used in place of a decimal value.). This is the underlying object with id, value and extensions. The accessor "getData" gives direct access to the value
478     */
479    public SampledData setDataElement(StringType value) { 
480      this.data = value;
481      return this;
482    }
483
484    /**
485     * @return A series of data points which are decimal values separated by a single space (character u20). The special values "E" (error), "L" (below detection limit) and "U" (above detection limit) can also be used in place of a decimal value.
486     */
487    public String getData() { 
488      return this.data == null ? null : this.data.getValue();
489    }
490
491    /**
492     * @param value A series of data points which are decimal values separated by a single space (character u20). The special values "E" (error), "L" (below detection limit) and "U" (above detection limit) can also be used in place of a decimal value.
493     */
494    public SampledData setData(String value) { 
495      if (Utilities.noString(value))
496        this.data = null;
497      else {
498        if (this.data == null)
499          this.data = new StringType();
500        this.data.setValue(value);
501      }
502      return this;
503    }
504
505      protected void listChildren(List<Property> children) {
506        super.listChildren(children);
507        children.add(new Property("origin", "Quantity", "The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.", 0, 1, origin));
508        children.add(new Property("period", "decimal", "The length of time between sampling times, measured in milliseconds.", 0, 1, period));
509        children.add(new Property("factor", "decimal", "A correction factor that is applied to the sampled data points before they are added to the origin.", 0, 1, factor));
510        children.add(new Property("lowerLimit", "decimal", "The lower limit of detection of the measured points. This is needed if any of the data points have the value \"L\" (lower than detection limit).", 0, 1, lowerLimit));
511        children.add(new Property("upperLimit", "decimal", "The upper limit of detection of the measured points. This is needed if any of the data points have the value \"U\" (higher than detection limit).", 0, 1, upperLimit));
512        children.add(new Property("dimensions", "positiveInt", "The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once.", 0, 1, dimensions));
513        children.add(new Property("data", "string", "A series of data points which are decimal values separated by a single space (character u20). The special values \"E\" (error), \"L\" (below detection limit) and \"U\" (above detection limit) can also be used in place of a decimal value.", 0, 1, data));
514      }
515
516      @Override
517      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
518        switch (_hash) {
519        case -1008619738: /*origin*/  return new Property("origin", "Quantity", "The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.", 0, 1, origin);
520        case -991726143: /*period*/  return new Property("period", "decimal", "The length of time between sampling times, measured in milliseconds.", 0, 1, period);
521        case -1282148017: /*factor*/  return new Property("factor", "decimal", "A correction factor that is applied to the sampled data points before they are added to the origin.", 0, 1, factor);
522        case 1209133370: /*lowerLimit*/  return new Property("lowerLimit", "decimal", "The lower limit of detection of the measured points. This is needed if any of the data points have the value \"L\" (lower than detection limit).", 0, 1, lowerLimit);
523        case -1681713095: /*upperLimit*/  return new Property("upperLimit", "decimal", "The upper limit of detection of the measured points. This is needed if any of the data points have the value \"U\" (higher than detection limit).", 0, 1, upperLimit);
524        case 414334925: /*dimensions*/  return new Property("dimensions", "positiveInt", "The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once.", 0, 1, dimensions);
525        case 3076010: /*data*/  return new Property("data", "string", "A series of data points which are decimal values separated by a single space (character u20). The special values \"E\" (error), \"L\" (below detection limit) and \"U\" (above detection limit) can also be used in place of a decimal value.", 0, 1, data);
526        default: return super.getNamedProperty(_hash, _name, _checkValid);
527        }
528
529      }
530
531      @Override
532      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
533        switch (hash) {
534        case -1008619738: /*origin*/ return this.origin == null ? new Base[0] : new Base[] {this.origin}; // Quantity
535        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // DecimalType
536        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
537        case 1209133370: /*lowerLimit*/ return this.lowerLimit == null ? new Base[0] : new Base[] {this.lowerLimit}; // DecimalType
538        case -1681713095: /*upperLimit*/ return this.upperLimit == null ? new Base[0] : new Base[] {this.upperLimit}; // DecimalType
539        case 414334925: /*dimensions*/ return this.dimensions == null ? new Base[0] : new Base[] {this.dimensions}; // PositiveIntType
540        case 3076010: /*data*/ return this.data == null ? new Base[0] : new Base[] {this.data}; // StringType
541        default: return super.getProperty(hash, name, checkValid);
542        }
543
544      }
545
546      @Override
547      public Base setProperty(int hash, String name, Base value) throws FHIRException {
548        switch (hash) {
549        case -1008619738: // origin
550          this.origin = TypeConvertor.castToQuantity(value); // Quantity
551          return value;
552        case -991726143: // period
553          this.period = TypeConvertor.castToDecimal(value); // DecimalType
554          return value;
555        case -1282148017: // factor
556          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
557          return value;
558        case 1209133370: // lowerLimit
559          this.lowerLimit = TypeConvertor.castToDecimal(value); // DecimalType
560          return value;
561        case -1681713095: // upperLimit
562          this.upperLimit = TypeConvertor.castToDecimal(value); // DecimalType
563          return value;
564        case 414334925: // dimensions
565          this.dimensions = TypeConvertor.castToPositiveInt(value); // PositiveIntType
566          return value;
567        case 3076010: // data
568          this.data = TypeConvertor.castToString(value); // StringType
569          return value;
570        default: return super.setProperty(hash, name, value);
571        }
572
573      }
574
575      @Override
576      public Base setProperty(String name, Base value) throws FHIRException {
577        if (name.equals("origin")) {
578          this.origin = TypeConvertor.castToQuantity(value); // Quantity
579        } else if (name.equals("period")) {
580          this.period = TypeConvertor.castToDecimal(value); // DecimalType
581        } else if (name.equals("factor")) {
582          this.factor = TypeConvertor.castToDecimal(value); // DecimalType
583        } else if (name.equals("lowerLimit")) {
584          this.lowerLimit = TypeConvertor.castToDecimal(value); // DecimalType
585        } else if (name.equals("upperLimit")) {
586          this.upperLimit = TypeConvertor.castToDecimal(value); // DecimalType
587        } else if (name.equals("dimensions")) {
588          this.dimensions = TypeConvertor.castToPositiveInt(value); // PositiveIntType
589        } else if (name.equals("data")) {
590          this.data = TypeConvertor.castToString(value); // StringType
591        } else
592          return super.setProperty(name, value);
593        return value;
594      }
595
596      @Override
597      public Base makeProperty(int hash, String name) throws FHIRException {
598        switch (hash) {
599        case -1008619738:  return getOrigin();
600        case -991726143:  return getPeriodElement();
601        case -1282148017:  return getFactorElement();
602        case 1209133370:  return getLowerLimitElement();
603        case -1681713095:  return getUpperLimitElement();
604        case 414334925:  return getDimensionsElement();
605        case 3076010:  return getDataElement();
606        default: return super.makeProperty(hash, name);
607        }
608
609      }
610
611      @Override
612      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
613        switch (hash) {
614        case -1008619738: /*origin*/ return new String[] {"Quantity"};
615        case -991726143: /*period*/ return new String[] {"decimal"};
616        case -1282148017: /*factor*/ return new String[] {"decimal"};
617        case 1209133370: /*lowerLimit*/ return new String[] {"decimal"};
618        case -1681713095: /*upperLimit*/ return new String[] {"decimal"};
619        case 414334925: /*dimensions*/ return new String[] {"positiveInt"};
620        case 3076010: /*data*/ return new String[] {"string"};
621        default: return super.getTypesForProperty(hash, name);
622        }
623
624      }
625
626      @Override
627      public Base addChild(String name) throws FHIRException {
628        if (name.equals("origin")) {
629          this.origin = new Quantity();
630          return this.origin;
631        }
632        else if (name.equals("period")) {
633          throw new FHIRException("Cannot call addChild on a primitive type SampledData.period");
634        }
635        else if (name.equals("factor")) {
636          throw new FHIRException("Cannot call addChild on a primitive type SampledData.factor");
637        }
638        else if (name.equals("lowerLimit")) {
639          throw new FHIRException("Cannot call addChild on a primitive type SampledData.lowerLimit");
640        }
641        else if (name.equals("upperLimit")) {
642          throw new FHIRException("Cannot call addChild on a primitive type SampledData.upperLimit");
643        }
644        else if (name.equals("dimensions")) {
645          throw new FHIRException("Cannot call addChild on a primitive type SampledData.dimensions");
646        }
647        else if (name.equals("data")) {
648          throw new FHIRException("Cannot call addChild on a primitive type SampledData.data");
649        }
650        else
651          return super.addChild(name);
652      }
653
654  public String fhirType() {
655    return "SampledData";
656
657  }
658
659      public SampledData copy() {
660        SampledData dst = new SampledData();
661        copyValues(dst);
662        return dst;
663      }
664
665      public void copyValues(SampledData dst) {
666        super.copyValues(dst);
667        dst.origin = origin == null ? null : origin.copy();
668        dst.period = period == null ? null : period.copy();
669        dst.factor = factor == null ? null : factor.copy();
670        dst.lowerLimit = lowerLimit == null ? null : lowerLimit.copy();
671        dst.upperLimit = upperLimit == null ? null : upperLimit.copy();
672        dst.dimensions = dimensions == null ? null : dimensions.copy();
673        dst.data = data == null ? null : data.copy();
674      }
675
676      protected SampledData typedCopy() {
677        return copy();
678      }
679
680      @Override
681      public boolean equalsDeep(Base other_) {
682        if (!super.equalsDeep(other_))
683          return false;
684        if (!(other_ instanceof SampledData))
685          return false;
686        SampledData o = (SampledData) other_;
687        return compareDeep(origin, o.origin, true) && compareDeep(period, o.period, true) && compareDeep(factor, o.factor, true)
688           && compareDeep(lowerLimit, o.lowerLimit, true) && compareDeep(upperLimit, o.upperLimit, true) && compareDeep(dimensions, o.dimensions, true)
689           && compareDeep(data, o.data, true);
690      }
691
692      @Override
693      public boolean equalsShallow(Base other_) {
694        if (!super.equalsShallow(other_))
695          return false;
696        if (!(other_ instanceof SampledData))
697          return false;
698        SampledData o = (SampledData) other_;
699        return compareValues(period, o.period, true) && compareValues(factor, o.factor, true) && compareValues(lowerLimit, o.lowerLimit, true)
700           && compareValues(upperLimit, o.upperLimit, true) && compareValues(dimensions, o.dimensions, true) && compareValues(data, o.data, true)
701          ;
702      }
703
704      public boolean isEmpty() {
705        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(origin, period, factor, lowerLimit
706          , upperLimit, dimensions, data);
707      }
708
709
710}
711