001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import java.math.*;
040import org.hl7.fhir.utilities.Utilities;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * A series of measurements taken by a device, with upper and lower limits. There may be more than one dimension in the data.
050 */
051@DatatypeDef(name="SampledData")
052public class SampledData extends Type implements ICompositeType {
053
054    /**
055     * The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.
056     */
057    @Child(name = "origin", type = {Quantity.class}, order=0, min=1, max=1, modifier=false, summary=true)
058    @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." )
059    protected Quantity origin;
060
061    /**
062     * The length of time between sampling times, measured in milliseconds.
063     */
064    @Child(name = "period", type = {DecimalType.class}, order=1, min=1, max=1, modifier=false, summary=true)
065    @Description(shortDefinition="Number of milliseconds between samples", formalDefinition="The length of time between sampling times, measured in milliseconds." )
066    protected DecimalType period;
067
068    /**
069     * A correction factor that is applied to the sampled data points before they are added to the origin.
070     */
071    @Child(name = "factor", type = {DecimalType.class}, order=2, min=0, max=1, modifier=false, summary=true)
072    @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." )
073    protected DecimalType factor;
074
075    /**
076     * 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).
077     */
078    @Child(name = "lowerLimit", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
079    @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)." )
080    protected DecimalType lowerLimit;
081
082    /**
083     * 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).
084     */
085    @Child(name = "upperLimit", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=true)
086    @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)." )
087    protected DecimalType upperLimit;
088
089    /**
090     * 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.
091     */
092    @Child(name = "dimensions", type = {PositiveIntType.class}, order=5, min=1, max=1, modifier=false, summary=true)
093    @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." )
094    protected PositiveIntType dimensions;
095
096    /**
097     * 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.
098     */
099    @Child(name = "data", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=false)
100    @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." )
101    protected StringType data;
102
103    private static final long serialVersionUID = -1984181262L;
104
105  /**
106   * Constructor
107   */
108    public SampledData() {
109      super();
110    }
111
112  /**
113   * Constructor
114   */
115    public SampledData(Quantity origin, DecimalType period, PositiveIntType dimensions) {
116      super();
117      this.origin = origin;
118      this.period = period;
119      this.dimensions = dimensions;
120    }
121
122    /**
123     * @return {@link #origin} (The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.)
124     */
125    public Quantity getOrigin() { 
126      if (this.origin == null)
127        if (Configuration.errorOnAutoCreate())
128          throw new Error("Attempt to auto-create SampledData.origin");
129        else if (Configuration.doAutoCreate())
130          this.origin = new Quantity(); // cc
131      return this.origin;
132    }
133
134    public boolean hasOrigin() { 
135      return this.origin != null && !this.origin.isEmpty();
136    }
137
138    /**
139     * @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.)
140     */
141    public SampledData setOrigin(Quantity value) { 
142      this.origin = value;
143      return this;
144    }
145
146    /**
147     * @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
148     */
149    public DecimalType getPeriodElement() { 
150      if (this.period == null)
151        if (Configuration.errorOnAutoCreate())
152          throw new Error("Attempt to auto-create SampledData.period");
153        else if (Configuration.doAutoCreate())
154          this.period = new DecimalType(); // bb
155      return this.period;
156    }
157
158    public boolean hasPeriodElement() { 
159      return this.period != null && !this.period.isEmpty();
160    }
161
162    public boolean hasPeriod() { 
163      return this.period != null && !this.period.isEmpty();
164    }
165
166    /**
167     * @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
168     */
169    public SampledData setPeriodElement(DecimalType value) { 
170      this.period = value;
171      return this;
172    }
173
174    /**
175     * @return The length of time between sampling times, measured in milliseconds.
176     */
177    public BigDecimal getPeriod() { 
178      return this.period == null ? null : this.period.getValue();
179    }
180
181    /**
182     * @param value The length of time between sampling times, measured in milliseconds.
183     */
184    public SampledData setPeriod(BigDecimal value) { 
185        if (this.period == null)
186          this.period = new DecimalType();
187        this.period.setValue(value);
188      return this;
189    }
190
191    /**
192     * @param value The length of time between sampling times, measured in milliseconds.
193     */
194    public SampledData setPeriod(long value) { 
195          this.period = new DecimalType();
196        this.period.setValue(value);
197      return this;
198    }
199
200    /**
201     * @param value The length of time between sampling times, measured in milliseconds.
202     */
203    public SampledData setPeriod(double value) { 
204          this.period = new DecimalType();
205        this.period.setValue(value);
206      return this;
207    }
208
209    /**
210     * @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
211     */
212    public DecimalType getFactorElement() { 
213      if (this.factor == null)
214        if (Configuration.errorOnAutoCreate())
215          throw new Error("Attempt to auto-create SampledData.factor");
216        else if (Configuration.doAutoCreate())
217          this.factor = new DecimalType(); // bb
218      return this.factor;
219    }
220
221    public boolean hasFactorElement() { 
222      return this.factor != null && !this.factor.isEmpty();
223    }
224
225    public boolean hasFactor() { 
226      return this.factor != null && !this.factor.isEmpty();
227    }
228
229    /**
230     * @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
231     */
232    public SampledData setFactorElement(DecimalType value) { 
233      this.factor = value;
234      return this;
235    }
236
237    /**
238     * @return A correction factor that is applied to the sampled data points before they are added to the origin.
239     */
240    public BigDecimal getFactor() { 
241      return this.factor == null ? null : this.factor.getValue();
242    }
243
244    /**
245     * @param value A correction factor that is applied to the sampled data points before they are added to the origin.
246     */
247    public SampledData setFactor(BigDecimal value) { 
248      if (value == null)
249        this.factor = null;
250      else {
251        if (this.factor == null)
252          this.factor = new DecimalType();
253        this.factor.setValue(value);
254      }
255      return this;
256    }
257
258    /**
259     * @param value A correction factor that is applied to the sampled data points before they are added to the origin.
260     */
261    public SampledData setFactor(long value) { 
262          this.factor = new DecimalType();
263        this.factor.setValue(value);
264      return this;
265    }
266
267    /**
268     * @param value A correction factor that is applied to the sampled data points before they are added to the origin.
269     */
270    public SampledData setFactor(double value) { 
271          this.factor = new DecimalType();
272        this.factor.setValue(value);
273      return this;
274    }
275
276    /**
277     * @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
278     */
279    public DecimalType getLowerLimitElement() { 
280      if (this.lowerLimit == null)
281        if (Configuration.errorOnAutoCreate())
282          throw new Error("Attempt to auto-create SampledData.lowerLimit");
283        else if (Configuration.doAutoCreate())
284          this.lowerLimit = new DecimalType(); // bb
285      return this.lowerLimit;
286    }
287
288    public boolean hasLowerLimitElement() { 
289      return this.lowerLimit != null && !this.lowerLimit.isEmpty();
290    }
291
292    public boolean hasLowerLimit() { 
293      return this.lowerLimit != null && !this.lowerLimit.isEmpty();
294    }
295
296    /**
297     * @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
298     */
299    public SampledData setLowerLimitElement(DecimalType value) { 
300      this.lowerLimit = value;
301      return this;
302    }
303
304    /**
305     * @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).
306     */
307    public BigDecimal getLowerLimit() { 
308      return this.lowerLimit == null ? null : this.lowerLimit.getValue();
309    }
310
311    /**
312     * @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).
313     */
314    public SampledData setLowerLimit(BigDecimal value) { 
315      if (value == null)
316        this.lowerLimit = null;
317      else {
318        if (this.lowerLimit == null)
319          this.lowerLimit = new DecimalType();
320        this.lowerLimit.setValue(value);
321      }
322      return this;
323    }
324
325    /**
326     * @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).
327     */
328    public SampledData setLowerLimit(long value) { 
329          this.lowerLimit = new DecimalType();
330        this.lowerLimit.setValue(value);
331      return this;
332    }
333
334    /**
335     * @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).
336     */
337    public SampledData setLowerLimit(double value) { 
338          this.lowerLimit = new DecimalType();
339        this.lowerLimit.setValue(value);
340      return this;
341    }
342
343    /**
344     * @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
345     */
346    public DecimalType getUpperLimitElement() { 
347      if (this.upperLimit == null)
348        if (Configuration.errorOnAutoCreate())
349          throw new Error("Attempt to auto-create SampledData.upperLimit");
350        else if (Configuration.doAutoCreate())
351          this.upperLimit = new DecimalType(); // bb
352      return this.upperLimit;
353    }
354
355    public boolean hasUpperLimitElement() { 
356      return this.upperLimit != null && !this.upperLimit.isEmpty();
357    }
358
359    public boolean hasUpperLimit() { 
360      return this.upperLimit != null && !this.upperLimit.isEmpty();
361    }
362
363    /**
364     * @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
365     */
366    public SampledData setUpperLimitElement(DecimalType value) { 
367      this.upperLimit = value;
368      return this;
369    }
370
371    /**
372     * @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).
373     */
374    public BigDecimal getUpperLimit() { 
375      return this.upperLimit == null ? null : this.upperLimit.getValue();
376    }
377
378    /**
379     * @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).
380     */
381    public SampledData setUpperLimit(BigDecimal value) { 
382      if (value == null)
383        this.upperLimit = null;
384      else {
385        if (this.upperLimit == null)
386          this.upperLimit = new DecimalType();
387        this.upperLimit.setValue(value);
388      }
389      return this;
390    }
391
392    /**
393     * @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).
394     */
395    public SampledData setUpperLimit(long value) { 
396          this.upperLimit = new DecimalType();
397        this.upperLimit.setValue(value);
398      return this;
399    }
400
401    /**
402     * @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).
403     */
404    public SampledData setUpperLimit(double value) { 
405          this.upperLimit = new DecimalType();
406        this.upperLimit.setValue(value);
407      return this;
408    }
409
410    /**
411     * @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
412     */
413    public PositiveIntType getDimensionsElement() { 
414      if (this.dimensions == null)
415        if (Configuration.errorOnAutoCreate())
416          throw new Error("Attempt to auto-create SampledData.dimensions");
417        else if (Configuration.doAutoCreate())
418          this.dimensions = new PositiveIntType(); // bb
419      return this.dimensions;
420    }
421
422    public boolean hasDimensionsElement() { 
423      return this.dimensions != null && !this.dimensions.isEmpty();
424    }
425
426    public boolean hasDimensions() { 
427      return this.dimensions != null && !this.dimensions.isEmpty();
428    }
429
430    /**
431     * @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
432     */
433    public SampledData setDimensionsElement(PositiveIntType value) { 
434      this.dimensions = value;
435      return this;
436    }
437
438    /**
439     * @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.
440     */
441    public int getDimensions() { 
442      return this.dimensions == null || this.dimensions.isEmpty() ? 0 : this.dimensions.getValue();
443    }
444
445    /**
446     * @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.
447     */
448    public SampledData setDimensions(int value) { 
449        if (this.dimensions == null)
450          this.dimensions = new PositiveIntType();
451        this.dimensions.setValue(value);
452      return this;
453    }
454
455    /**
456     * @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
457     */
458    public StringType getDataElement() { 
459      if (this.data == null)
460        if (Configuration.errorOnAutoCreate())
461          throw new Error("Attempt to auto-create SampledData.data");
462        else if (Configuration.doAutoCreate())
463          this.data = new StringType(); // bb
464      return this.data;
465    }
466
467    public boolean hasDataElement() { 
468      return this.data != null && !this.data.isEmpty();
469    }
470
471    public boolean hasData() { 
472      return this.data != null && !this.data.isEmpty();
473    }
474
475    /**
476     * @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
477     */
478    public SampledData setDataElement(StringType value) { 
479      this.data = value;
480      return this;
481    }
482
483    /**
484     * @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.
485     */
486    public String getData() { 
487      return this.data == null ? null : this.data.getValue();
488    }
489
490    /**
491     * @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.
492     */
493    public SampledData setData(String value) { 
494      if (Utilities.noString(value))
495        this.data = null;
496      else {
497        if (this.data == null)
498          this.data = new StringType();
499        this.data.setValue(value);
500      }
501      return this;
502    }
503
504      protected void listChildren(List<Property> children) {
505        super.listChildren(children);
506        children.add(new Property("origin", "SimpleQuantity", "The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.", 0, 1, origin));
507        children.add(new Property("period", "decimal", "The length of time between sampling times, measured in milliseconds.", 0, 1, period));
508        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));
509        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));
510        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));
511        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));
512        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));
513      }
514
515      @Override
516      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
517        switch (_hash) {
518        case -1008619738: /*origin*/  return new Property("origin", "SimpleQuantity", "The base quantity that a measured value of zero represents. In addition, this provides the units of the entire measurement series.", 0, 1, origin);
519        case -991726143: /*period*/  return new Property("period", "decimal", "The length of time between sampling times, measured in milliseconds.", 0, 1, period);
520        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);
521        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);
522        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);
523        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);
524        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);
525        default: return super.getNamedProperty(_hash, _name, _checkValid);
526        }
527
528      }
529
530      @Override
531      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
532        switch (hash) {
533        case -1008619738: /*origin*/ return this.origin == null ? new Base[0] : new Base[] {this.origin}; // Quantity
534        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // DecimalType
535        case -1282148017: /*factor*/ return this.factor == null ? new Base[0] : new Base[] {this.factor}; // DecimalType
536        case 1209133370: /*lowerLimit*/ return this.lowerLimit == null ? new Base[0] : new Base[] {this.lowerLimit}; // DecimalType
537        case -1681713095: /*upperLimit*/ return this.upperLimit == null ? new Base[0] : new Base[] {this.upperLimit}; // DecimalType
538        case 414334925: /*dimensions*/ return this.dimensions == null ? new Base[0] : new Base[] {this.dimensions}; // PositiveIntType
539        case 3076010: /*data*/ return this.data == null ? new Base[0] : new Base[] {this.data}; // StringType
540        default: return super.getProperty(hash, name, checkValid);
541        }
542
543      }
544
545      @Override
546      public Base setProperty(int hash, String name, Base value) throws FHIRException {
547        switch (hash) {
548        case -1008619738: // origin
549          this.origin = castToQuantity(value); // Quantity
550          return value;
551        case -991726143: // period
552          this.period = castToDecimal(value); // DecimalType
553          return value;
554        case -1282148017: // factor
555          this.factor = castToDecimal(value); // DecimalType
556          return value;
557        case 1209133370: // lowerLimit
558          this.lowerLimit = castToDecimal(value); // DecimalType
559          return value;
560        case -1681713095: // upperLimit
561          this.upperLimit = castToDecimal(value); // DecimalType
562          return value;
563        case 414334925: // dimensions
564          this.dimensions = castToPositiveInt(value); // PositiveIntType
565          return value;
566        case 3076010: // data
567          this.data = castToString(value); // StringType
568          return value;
569        default: return super.setProperty(hash, name, value);
570        }
571
572      }
573
574      @Override
575      public Base setProperty(String name, Base value) throws FHIRException {
576        if (name.equals("origin")) {
577          this.origin = castToQuantity(value); // Quantity
578        } else if (name.equals("period")) {
579          this.period = castToDecimal(value); // DecimalType
580        } else if (name.equals("factor")) {
581          this.factor = castToDecimal(value); // DecimalType
582        } else if (name.equals("lowerLimit")) {
583          this.lowerLimit = castToDecimal(value); // DecimalType
584        } else if (name.equals("upperLimit")) {
585          this.upperLimit = castToDecimal(value); // DecimalType
586        } else if (name.equals("dimensions")) {
587          this.dimensions = castToPositiveInt(value); // PositiveIntType
588        } else if (name.equals("data")) {
589          this.data = castToString(value); // StringType
590        } else
591          return super.setProperty(name, value);
592        return value;
593      }
594
595      @Override
596      public Base makeProperty(int hash, String name) throws FHIRException {
597        switch (hash) {
598        case -1008619738:  return getOrigin(); 
599        case -991726143:  return getPeriodElement();
600        case -1282148017:  return getFactorElement();
601        case 1209133370:  return getLowerLimitElement();
602        case -1681713095:  return getUpperLimitElement();
603        case 414334925:  return getDimensionsElement();
604        case 3076010:  return getDataElement();
605        default: return super.makeProperty(hash, name);
606        }
607
608      }
609
610      @Override
611      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
612        switch (hash) {
613        case -1008619738: /*origin*/ return new String[] {"SimpleQuantity"};
614        case -991726143: /*period*/ return new String[] {"decimal"};
615        case -1282148017: /*factor*/ return new String[] {"decimal"};
616        case 1209133370: /*lowerLimit*/ return new String[] {"decimal"};
617        case -1681713095: /*upperLimit*/ return new String[] {"decimal"};
618        case 414334925: /*dimensions*/ return new String[] {"positiveInt"};
619        case 3076010: /*data*/ return new String[] {"string"};
620        default: return super.getTypesForProperty(hash, name);
621        }
622
623      }
624
625      @Override
626      public Base addChild(String name) throws FHIRException {
627        if (name.equals("origin")) {
628          this.origin = new Quantity();
629          return this.origin;
630        }
631        else if (name.equals("period")) {
632          throw new FHIRException("Cannot call addChild on a primitive type SampledData.period");
633        }
634        else if (name.equals("factor")) {
635          throw new FHIRException("Cannot call addChild on a primitive type SampledData.factor");
636        }
637        else if (name.equals("lowerLimit")) {
638          throw new FHIRException("Cannot call addChild on a primitive type SampledData.lowerLimit");
639        }
640        else if (name.equals("upperLimit")) {
641          throw new FHIRException("Cannot call addChild on a primitive type SampledData.upperLimit");
642        }
643        else if (name.equals("dimensions")) {
644          throw new FHIRException("Cannot call addChild on a primitive type SampledData.dimensions");
645        }
646        else if (name.equals("data")) {
647          throw new FHIRException("Cannot call addChild on a primitive type SampledData.data");
648        }
649        else
650          return super.addChild(name);
651      }
652
653  public String fhirType() {
654    return "SampledData";
655
656  }
657
658      public SampledData copy() {
659        SampledData dst = new SampledData();
660        copyValues(dst);
661        return dst;
662      }
663
664      public void copyValues(SampledData dst) {
665        super.copyValues(dst);
666        dst.origin = origin == null ? null : origin.copy();
667        dst.period = period == null ? null : period.copy();
668        dst.factor = factor == null ? null : factor.copy();
669        dst.lowerLimit = lowerLimit == null ? null : lowerLimit.copy();
670        dst.upperLimit = upperLimit == null ? null : upperLimit.copy();
671        dst.dimensions = dimensions == null ? null : dimensions.copy();
672        dst.data = data == null ? null : data.copy();
673      }
674
675      protected SampledData typedCopy() {
676        return copy();
677      }
678
679      @Override
680      public boolean equalsDeep(Base other_) {
681        if (!super.equalsDeep(other_))
682          return false;
683        if (!(other_ instanceof SampledData))
684          return false;
685        SampledData o = (SampledData) other_;
686        return compareDeep(origin, o.origin, true) && compareDeep(period, o.period, true) && compareDeep(factor, o.factor, true)
687           && compareDeep(lowerLimit, o.lowerLimit, true) && compareDeep(upperLimit, o.upperLimit, true) && compareDeep(dimensions, o.dimensions, true)
688           && compareDeep(data, o.data, true);
689      }
690
691      @Override
692      public boolean equalsShallow(Base other_) {
693        if (!super.equalsShallow(other_))
694          return false;
695        if (!(other_ instanceof SampledData))
696          return false;
697        SampledData o = (SampledData) other_;
698        return compareValues(period, o.period, true) && compareValues(factor, o.factor, true) && compareValues(lowerLimit, o.lowerLimit, true)
699           && compareValues(upperLimit, o.upperLimit, true) && compareValues(dimensions, o.dimensions, true) && compareValues(data, o.data, true)
700          ;
701      }
702
703      public boolean isEmpty() {
704        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(origin, period, factor, lowerLimit
705          , upperLimit, dimensions, data);
706      }
707
708
709}