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