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 org.hl7.fhir.utilities.Utilities;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * Describes a measurement, calculation or setting capability of a medical device.
050 */
051@ResourceDef(name="DeviceMetric", profile="http://hl7.org/fhir/StructureDefinition/DeviceMetric")
052public class DeviceMetric extends DomainResource {
053
054    public enum DeviceMetricOperationalStatus {
055        /**
056         * The DeviceMetric is operating and will generate DeviceObservations.
057         */
058        ON, 
059        /**
060         * The DeviceMetric is not operating.
061         */
062        OFF, 
063        /**
064         * The DeviceMetric is operating, but will not generate any DeviceObservations.
065         */
066        STANDBY, 
067        /**
068         * The DeviceMetric was entered in error.
069         */
070        ENTEREDINERROR, 
071        /**
072         * added to help the parsers with the generic types
073         */
074        NULL;
075        public static DeviceMetricOperationalStatus fromCode(String codeString) throws FHIRException {
076            if (codeString == null || "".equals(codeString))
077                return null;
078        if ("on".equals(codeString))
079          return ON;
080        if ("off".equals(codeString))
081          return OFF;
082        if ("standby".equals(codeString))
083          return STANDBY;
084        if ("entered-in-error".equals(codeString))
085          return ENTEREDINERROR;
086        if (Configuration.isAcceptInvalidEnums())
087          return null;
088        else
089          throw new FHIRException("Unknown DeviceMetricOperationalStatus code '"+codeString+"'");
090        }
091        public String toCode() {
092          switch (this) {
093            case ON: return "on";
094            case OFF: return "off";
095            case STANDBY: return "standby";
096            case ENTEREDINERROR: return "entered-in-error";
097            case NULL: return null;
098            default: return "?";
099          }
100        }
101        public String getSystem() {
102          switch (this) {
103            case ON: return "http://hl7.org/fhir/metric-operational-status";
104            case OFF: return "http://hl7.org/fhir/metric-operational-status";
105            case STANDBY: return "http://hl7.org/fhir/metric-operational-status";
106            case ENTEREDINERROR: return "http://hl7.org/fhir/metric-operational-status";
107            case NULL: return null;
108            default: return "?";
109          }
110        }
111        public String getDefinition() {
112          switch (this) {
113            case ON: return "The DeviceMetric is operating and will generate DeviceObservations.";
114            case OFF: return "The DeviceMetric is not operating.";
115            case STANDBY: return "The DeviceMetric is operating, but will not generate any DeviceObservations.";
116            case ENTEREDINERROR: return "The DeviceMetric was entered in error.";
117            case NULL: return null;
118            default: return "?";
119          }
120        }
121        public String getDisplay() {
122          switch (this) {
123            case ON: return "On";
124            case OFF: return "Off";
125            case STANDBY: return "Standby";
126            case ENTEREDINERROR: return "Entered In Error";
127            case NULL: return null;
128            default: return "?";
129          }
130        }
131    }
132
133  public static class DeviceMetricOperationalStatusEnumFactory implements EnumFactory<DeviceMetricOperationalStatus> {
134    public DeviceMetricOperationalStatus fromCode(String codeString) throws IllegalArgumentException {
135      if (codeString == null || "".equals(codeString))
136            if (codeString == null || "".equals(codeString))
137                return null;
138        if ("on".equals(codeString))
139          return DeviceMetricOperationalStatus.ON;
140        if ("off".equals(codeString))
141          return DeviceMetricOperationalStatus.OFF;
142        if ("standby".equals(codeString))
143          return DeviceMetricOperationalStatus.STANDBY;
144        if ("entered-in-error".equals(codeString))
145          return DeviceMetricOperationalStatus.ENTEREDINERROR;
146        throw new IllegalArgumentException("Unknown DeviceMetricOperationalStatus code '"+codeString+"'");
147        }
148        public Enumeration<DeviceMetricOperationalStatus> fromType(Base code) throws FHIRException {
149          if (code == null)
150            return null;
151          if (code.isEmpty())
152            return new Enumeration<DeviceMetricOperationalStatus>(this);
153          String codeString = ((PrimitiveType) code).asStringValue();
154          if (codeString == null || "".equals(codeString))
155            return null;
156        if ("on".equals(codeString))
157          return new Enumeration<DeviceMetricOperationalStatus>(this, DeviceMetricOperationalStatus.ON);
158        if ("off".equals(codeString))
159          return new Enumeration<DeviceMetricOperationalStatus>(this, DeviceMetricOperationalStatus.OFF);
160        if ("standby".equals(codeString))
161          return new Enumeration<DeviceMetricOperationalStatus>(this, DeviceMetricOperationalStatus.STANDBY);
162        if ("entered-in-error".equals(codeString))
163          return new Enumeration<DeviceMetricOperationalStatus>(this, DeviceMetricOperationalStatus.ENTEREDINERROR);
164        throw new FHIRException("Unknown DeviceMetricOperationalStatus code '"+codeString+"'");
165        }
166    public String toCode(DeviceMetricOperationalStatus code) {
167      if (code == DeviceMetricOperationalStatus.ON)
168        return "on";
169      if (code == DeviceMetricOperationalStatus.OFF)
170        return "off";
171      if (code == DeviceMetricOperationalStatus.STANDBY)
172        return "standby";
173      if (code == DeviceMetricOperationalStatus.ENTEREDINERROR)
174        return "entered-in-error";
175      return "?";
176      }
177    public String toSystem(DeviceMetricOperationalStatus code) {
178      return code.getSystem();
179      }
180    }
181
182    public enum DeviceMetricColor {
183        /**
184         * Color for representation - black.
185         */
186        BLACK, 
187        /**
188         * Color for representation - red.
189         */
190        RED, 
191        /**
192         * Color for representation - green.
193         */
194        GREEN, 
195        /**
196         * Color for representation - yellow.
197         */
198        YELLOW, 
199        /**
200         * Color for representation - blue.
201         */
202        BLUE, 
203        /**
204         * Color for representation - magenta.
205         */
206        MAGENTA, 
207        /**
208         * Color for representation - cyan.
209         */
210        CYAN, 
211        /**
212         * Color for representation - white.
213         */
214        WHITE, 
215        /**
216         * added to help the parsers with the generic types
217         */
218        NULL;
219        public static DeviceMetricColor fromCode(String codeString) throws FHIRException {
220            if (codeString == null || "".equals(codeString))
221                return null;
222        if ("black".equals(codeString))
223          return BLACK;
224        if ("red".equals(codeString))
225          return RED;
226        if ("green".equals(codeString))
227          return GREEN;
228        if ("yellow".equals(codeString))
229          return YELLOW;
230        if ("blue".equals(codeString))
231          return BLUE;
232        if ("magenta".equals(codeString))
233          return MAGENTA;
234        if ("cyan".equals(codeString))
235          return CYAN;
236        if ("white".equals(codeString))
237          return WHITE;
238        if (Configuration.isAcceptInvalidEnums())
239          return null;
240        else
241          throw new FHIRException("Unknown DeviceMetricColor code '"+codeString+"'");
242        }
243        public String toCode() {
244          switch (this) {
245            case BLACK: return "black";
246            case RED: return "red";
247            case GREEN: return "green";
248            case YELLOW: return "yellow";
249            case BLUE: return "blue";
250            case MAGENTA: return "magenta";
251            case CYAN: return "cyan";
252            case WHITE: return "white";
253            case NULL: return null;
254            default: return "?";
255          }
256        }
257        public String getSystem() {
258          switch (this) {
259            case BLACK: return "http://hl7.org/fhir/metric-color";
260            case RED: return "http://hl7.org/fhir/metric-color";
261            case GREEN: return "http://hl7.org/fhir/metric-color";
262            case YELLOW: return "http://hl7.org/fhir/metric-color";
263            case BLUE: return "http://hl7.org/fhir/metric-color";
264            case MAGENTA: return "http://hl7.org/fhir/metric-color";
265            case CYAN: return "http://hl7.org/fhir/metric-color";
266            case WHITE: return "http://hl7.org/fhir/metric-color";
267            case NULL: return null;
268            default: return "?";
269          }
270        }
271        public String getDefinition() {
272          switch (this) {
273            case BLACK: return "Color for representation - black.";
274            case RED: return "Color for representation - red.";
275            case GREEN: return "Color for representation - green.";
276            case YELLOW: return "Color for representation - yellow.";
277            case BLUE: return "Color for representation - blue.";
278            case MAGENTA: return "Color for representation - magenta.";
279            case CYAN: return "Color for representation - cyan.";
280            case WHITE: return "Color for representation - white.";
281            case NULL: return null;
282            default: return "?";
283          }
284        }
285        public String getDisplay() {
286          switch (this) {
287            case BLACK: return "Color Black";
288            case RED: return "Color Red";
289            case GREEN: return "Color Green";
290            case YELLOW: return "Color Yellow";
291            case BLUE: return "Color Blue";
292            case MAGENTA: return "Color Magenta";
293            case CYAN: return "Color Cyan";
294            case WHITE: return "Color White";
295            case NULL: return null;
296            default: return "?";
297          }
298        }
299    }
300
301  public static class DeviceMetricColorEnumFactory implements EnumFactory<DeviceMetricColor> {
302    public DeviceMetricColor fromCode(String codeString) throws IllegalArgumentException {
303      if (codeString == null || "".equals(codeString))
304            if (codeString == null || "".equals(codeString))
305                return null;
306        if ("black".equals(codeString))
307          return DeviceMetricColor.BLACK;
308        if ("red".equals(codeString))
309          return DeviceMetricColor.RED;
310        if ("green".equals(codeString))
311          return DeviceMetricColor.GREEN;
312        if ("yellow".equals(codeString))
313          return DeviceMetricColor.YELLOW;
314        if ("blue".equals(codeString))
315          return DeviceMetricColor.BLUE;
316        if ("magenta".equals(codeString))
317          return DeviceMetricColor.MAGENTA;
318        if ("cyan".equals(codeString))
319          return DeviceMetricColor.CYAN;
320        if ("white".equals(codeString))
321          return DeviceMetricColor.WHITE;
322        throw new IllegalArgumentException("Unknown DeviceMetricColor code '"+codeString+"'");
323        }
324        public Enumeration<DeviceMetricColor> fromType(Base code) throws FHIRException {
325          if (code == null)
326            return null;
327          if (code.isEmpty())
328            return new Enumeration<DeviceMetricColor>(this);
329          String codeString = ((PrimitiveType) code).asStringValue();
330          if (codeString == null || "".equals(codeString))
331            return null;
332        if ("black".equals(codeString))
333          return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.BLACK);
334        if ("red".equals(codeString))
335          return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.RED);
336        if ("green".equals(codeString))
337          return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.GREEN);
338        if ("yellow".equals(codeString))
339          return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.YELLOW);
340        if ("blue".equals(codeString))
341          return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.BLUE);
342        if ("magenta".equals(codeString))
343          return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.MAGENTA);
344        if ("cyan".equals(codeString))
345          return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.CYAN);
346        if ("white".equals(codeString))
347          return new Enumeration<DeviceMetricColor>(this, DeviceMetricColor.WHITE);
348        throw new FHIRException("Unknown DeviceMetricColor code '"+codeString+"'");
349        }
350    public String toCode(DeviceMetricColor code) {
351      if (code == DeviceMetricColor.BLACK)
352        return "black";
353      if (code == DeviceMetricColor.RED)
354        return "red";
355      if (code == DeviceMetricColor.GREEN)
356        return "green";
357      if (code == DeviceMetricColor.YELLOW)
358        return "yellow";
359      if (code == DeviceMetricColor.BLUE)
360        return "blue";
361      if (code == DeviceMetricColor.MAGENTA)
362        return "magenta";
363      if (code == DeviceMetricColor.CYAN)
364        return "cyan";
365      if (code == DeviceMetricColor.WHITE)
366        return "white";
367      return "?";
368      }
369    public String toSystem(DeviceMetricColor code) {
370      return code.getSystem();
371      }
372    }
373
374    public enum DeviceMetricCategory {
375        /**
376         * DeviceObservations generated for this DeviceMetric are measured.
377         */
378        MEASUREMENT, 
379        /**
380         * DeviceObservations generated for this DeviceMetric is a setting that will influence the behavior of the Device.
381         */
382        SETTING, 
383        /**
384         * DeviceObservations generated for this DeviceMetric are calculated.
385         */
386        CALCULATION, 
387        /**
388         * The category of this DeviceMetric is unspecified.
389         */
390        UNSPECIFIED, 
391        /**
392         * added to help the parsers with the generic types
393         */
394        NULL;
395        public static DeviceMetricCategory fromCode(String codeString) throws FHIRException {
396            if (codeString == null || "".equals(codeString))
397                return null;
398        if ("measurement".equals(codeString))
399          return MEASUREMENT;
400        if ("setting".equals(codeString))
401          return SETTING;
402        if ("calculation".equals(codeString))
403          return CALCULATION;
404        if ("unspecified".equals(codeString))
405          return UNSPECIFIED;
406        if (Configuration.isAcceptInvalidEnums())
407          return null;
408        else
409          throw new FHIRException("Unknown DeviceMetricCategory code '"+codeString+"'");
410        }
411        public String toCode() {
412          switch (this) {
413            case MEASUREMENT: return "measurement";
414            case SETTING: return "setting";
415            case CALCULATION: return "calculation";
416            case UNSPECIFIED: return "unspecified";
417            case NULL: return null;
418            default: return "?";
419          }
420        }
421        public String getSystem() {
422          switch (this) {
423            case MEASUREMENT: return "http://hl7.org/fhir/metric-category";
424            case SETTING: return "http://hl7.org/fhir/metric-category";
425            case CALCULATION: return "http://hl7.org/fhir/metric-category";
426            case UNSPECIFIED: return "http://hl7.org/fhir/metric-category";
427            case NULL: return null;
428            default: return "?";
429          }
430        }
431        public String getDefinition() {
432          switch (this) {
433            case MEASUREMENT: return "DeviceObservations generated for this DeviceMetric are measured.";
434            case SETTING: return "DeviceObservations generated for this DeviceMetric is a setting that will influence the behavior of the Device.";
435            case CALCULATION: return "DeviceObservations generated for this DeviceMetric are calculated.";
436            case UNSPECIFIED: return "The category of this DeviceMetric is unspecified.";
437            case NULL: return null;
438            default: return "?";
439          }
440        }
441        public String getDisplay() {
442          switch (this) {
443            case MEASUREMENT: return "Measurement";
444            case SETTING: return "Setting";
445            case CALCULATION: return "Calculation";
446            case UNSPECIFIED: return "Unspecified";
447            case NULL: return null;
448            default: return "?";
449          }
450        }
451    }
452
453  public static class DeviceMetricCategoryEnumFactory implements EnumFactory<DeviceMetricCategory> {
454    public DeviceMetricCategory fromCode(String codeString) throws IllegalArgumentException {
455      if (codeString == null || "".equals(codeString))
456            if (codeString == null || "".equals(codeString))
457                return null;
458        if ("measurement".equals(codeString))
459          return DeviceMetricCategory.MEASUREMENT;
460        if ("setting".equals(codeString))
461          return DeviceMetricCategory.SETTING;
462        if ("calculation".equals(codeString))
463          return DeviceMetricCategory.CALCULATION;
464        if ("unspecified".equals(codeString))
465          return DeviceMetricCategory.UNSPECIFIED;
466        throw new IllegalArgumentException("Unknown DeviceMetricCategory code '"+codeString+"'");
467        }
468        public Enumeration<DeviceMetricCategory> fromType(Base code) throws FHIRException {
469          if (code == null)
470            return null;
471          if (code.isEmpty())
472            return new Enumeration<DeviceMetricCategory>(this);
473          String codeString = ((PrimitiveType) code).asStringValue();
474          if (codeString == null || "".equals(codeString))
475            return null;
476        if ("measurement".equals(codeString))
477          return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.MEASUREMENT);
478        if ("setting".equals(codeString))
479          return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.SETTING);
480        if ("calculation".equals(codeString))
481          return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.CALCULATION);
482        if ("unspecified".equals(codeString))
483          return new Enumeration<DeviceMetricCategory>(this, DeviceMetricCategory.UNSPECIFIED);
484        throw new FHIRException("Unknown DeviceMetricCategory code '"+codeString+"'");
485        }
486    public String toCode(DeviceMetricCategory code) {
487      if (code == DeviceMetricCategory.MEASUREMENT)
488        return "measurement";
489      if (code == DeviceMetricCategory.SETTING)
490        return "setting";
491      if (code == DeviceMetricCategory.CALCULATION)
492        return "calculation";
493      if (code == DeviceMetricCategory.UNSPECIFIED)
494        return "unspecified";
495      return "?";
496      }
497    public String toSystem(DeviceMetricCategory code) {
498      return code.getSystem();
499      }
500    }
501
502    public enum DeviceMetricCalibrationType {
503        /**
504         * Metric calibration method has not been identified.
505         */
506        UNSPECIFIED, 
507        /**
508         * Offset metric calibration method.
509         */
510        OFFSET, 
511        /**
512         * Gain metric calibration method.
513         */
514        GAIN, 
515        /**
516         * Two-point metric calibration method.
517         */
518        TWOPOINT, 
519        /**
520         * added to help the parsers with the generic types
521         */
522        NULL;
523        public static DeviceMetricCalibrationType fromCode(String codeString) throws FHIRException {
524            if (codeString == null || "".equals(codeString))
525                return null;
526        if ("unspecified".equals(codeString))
527          return UNSPECIFIED;
528        if ("offset".equals(codeString))
529          return OFFSET;
530        if ("gain".equals(codeString))
531          return GAIN;
532        if ("two-point".equals(codeString))
533          return TWOPOINT;
534        if (Configuration.isAcceptInvalidEnums())
535          return null;
536        else
537          throw new FHIRException("Unknown DeviceMetricCalibrationType code '"+codeString+"'");
538        }
539        public String toCode() {
540          switch (this) {
541            case UNSPECIFIED: return "unspecified";
542            case OFFSET: return "offset";
543            case GAIN: return "gain";
544            case TWOPOINT: return "two-point";
545            case NULL: return null;
546            default: return "?";
547          }
548        }
549        public String getSystem() {
550          switch (this) {
551            case UNSPECIFIED: return "http://hl7.org/fhir/metric-calibration-type";
552            case OFFSET: return "http://hl7.org/fhir/metric-calibration-type";
553            case GAIN: return "http://hl7.org/fhir/metric-calibration-type";
554            case TWOPOINT: return "http://hl7.org/fhir/metric-calibration-type";
555            case NULL: return null;
556            default: return "?";
557          }
558        }
559        public String getDefinition() {
560          switch (this) {
561            case UNSPECIFIED: return "Metric calibration method has not been identified.";
562            case OFFSET: return "Offset metric calibration method.";
563            case GAIN: return "Gain metric calibration method.";
564            case TWOPOINT: return "Two-point metric calibration method.";
565            case NULL: return null;
566            default: return "?";
567          }
568        }
569        public String getDisplay() {
570          switch (this) {
571            case UNSPECIFIED: return "Unspecified";
572            case OFFSET: return "Offset";
573            case GAIN: return "Gain";
574            case TWOPOINT: return "Two Point";
575            case NULL: return null;
576            default: return "?";
577          }
578        }
579    }
580
581  public static class DeviceMetricCalibrationTypeEnumFactory implements EnumFactory<DeviceMetricCalibrationType> {
582    public DeviceMetricCalibrationType fromCode(String codeString) throws IllegalArgumentException {
583      if (codeString == null || "".equals(codeString))
584            if (codeString == null || "".equals(codeString))
585                return null;
586        if ("unspecified".equals(codeString))
587          return DeviceMetricCalibrationType.UNSPECIFIED;
588        if ("offset".equals(codeString))
589          return DeviceMetricCalibrationType.OFFSET;
590        if ("gain".equals(codeString))
591          return DeviceMetricCalibrationType.GAIN;
592        if ("two-point".equals(codeString))
593          return DeviceMetricCalibrationType.TWOPOINT;
594        throw new IllegalArgumentException("Unknown DeviceMetricCalibrationType code '"+codeString+"'");
595        }
596        public Enumeration<DeviceMetricCalibrationType> fromType(Base code) throws FHIRException {
597          if (code == null)
598            return null;
599          if (code.isEmpty())
600            return new Enumeration<DeviceMetricCalibrationType>(this);
601          String codeString = ((PrimitiveType) code).asStringValue();
602          if (codeString == null || "".equals(codeString))
603            return null;
604        if ("unspecified".equals(codeString))
605          return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.UNSPECIFIED);
606        if ("offset".equals(codeString))
607          return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.OFFSET);
608        if ("gain".equals(codeString))
609          return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.GAIN);
610        if ("two-point".equals(codeString))
611          return new Enumeration<DeviceMetricCalibrationType>(this, DeviceMetricCalibrationType.TWOPOINT);
612        throw new FHIRException("Unknown DeviceMetricCalibrationType code '"+codeString+"'");
613        }
614    public String toCode(DeviceMetricCalibrationType code) {
615      if (code == DeviceMetricCalibrationType.UNSPECIFIED)
616        return "unspecified";
617      if (code == DeviceMetricCalibrationType.OFFSET)
618        return "offset";
619      if (code == DeviceMetricCalibrationType.GAIN)
620        return "gain";
621      if (code == DeviceMetricCalibrationType.TWOPOINT)
622        return "two-point";
623      return "?";
624      }
625    public String toSystem(DeviceMetricCalibrationType code) {
626      return code.getSystem();
627      }
628    }
629
630    public enum DeviceMetricCalibrationState {
631        /**
632         * The metric has not been calibrated.
633         */
634        NOTCALIBRATED, 
635        /**
636         * The metric needs to be calibrated.
637         */
638        CALIBRATIONREQUIRED, 
639        /**
640         * The metric has been calibrated.
641         */
642        CALIBRATED, 
643        /**
644         * The state of calibration of this metric is unspecified.
645         */
646        UNSPECIFIED, 
647        /**
648         * added to help the parsers with the generic types
649         */
650        NULL;
651        public static DeviceMetricCalibrationState fromCode(String codeString) throws FHIRException {
652            if (codeString == null || "".equals(codeString))
653                return null;
654        if ("not-calibrated".equals(codeString))
655          return NOTCALIBRATED;
656        if ("calibration-required".equals(codeString))
657          return CALIBRATIONREQUIRED;
658        if ("calibrated".equals(codeString))
659          return CALIBRATED;
660        if ("unspecified".equals(codeString))
661          return UNSPECIFIED;
662        if (Configuration.isAcceptInvalidEnums())
663          return null;
664        else
665          throw new FHIRException("Unknown DeviceMetricCalibrationState code '"+codeString+"'");
666        }
667        public String toCode() {
668          switch (this) {
669            case NOTCALIBRATED: return "not-calibrated";
670            case CALIBRATIONREQUIRED: return "calibration-required";
671            case CALIBRATED: return "calibrated";
672            case UNSPECIFIED: return "unspecified";
673            case NULL: return null;
674            default: return "?";
675          }
676        }
677        public String getSystem() {
678          switch (this) {
679            case NOTCALIBRATED: return "http://hl7.org/fhir/metric-calibration-state";
680            case CALIBRATIONREQUIRED: return "http://hl7.org/fhir/metric-calibration-state";
681            case CALIBRATED: return "http://hl7.org/fhir/metric-calibration-state";
682            case UNSPECIFIED: return "http://hl7.org/fhir/metric-calibration-state";
683            case NULL: return null;
684            default: return "?";
685          }
686        }
687        public String getDefinition() {
688          switch (this) {
689            case NOTCALIBRATED: return "The metric has not been calibrated.";
690            case CALIBRATIONREQUIRED: return "The metric needs to be calibrated.";
691            case CALIBRATED: return "The metric has been calibrated.";
692            case UNSPECIFIED: return "The state of calibration of this metric is unspecified.";
693            case NULL: return null;
694            default: return "?";
695          }
696        }
697        public String getDisplay() {
698          switch (this) {
699            case NOTCALIBRATED: return "Not Calibrated";
700            case CALIBRATIONREQUIRED: return "Calibration Required";
701            case CALIBRATED: return "Calibrated";
702            case UNSPECIFIED: return "Unspecified";
703            case NULL: return null;
704            default: return "?";
705          }
706        }
707    }
708
709  public static class DeviceMetricCalibrationStateEnumFactory implements EnumFactory<DeviceMetricCalibrationState> {
710    public DeviceMetricCalibrationState fromCode(String codeString) throws IllegalArgumentException {
711      if (codeString == null || "".equals(codeString))
712            if (codeString == null || "".equals(codeString))
713                return null;
714        if ("not-calibrated".equals(codeString))
715          return DeviceMetricCalibrationState.NOTCALIBRATED;
716        if ("calibration-required".equals(codeString))
717          return DeviceMetricCalibrationState.CALIBRATIONREQUIRED;
718        if ("calibrated".equals(codeString))
719          return DeviceMetricCalibrationState.CALIBRATED;
720        if ("unspecified".equals(codeString))
721          return DeviceMetricCalibrationState.UNSPECIFIED;
722        throw new IllegalArgumentException("Unknown DeviceMetricCalibrationState code '"+codeString+"'");
723        }
724        public Enumeration<DeviceMetricCalibrationState> fromType(Base code) throws FHIRException {
725          if (code == null)
726            return null;
727          if (code.isEmpty())
728            return new Enumeration<DeviceMetricCalibrationState>(this);
729          String codeString = ((PrimitiveType) code).asStringValue();
730          if (codeString == null || "".equals(codeString))
731            return null;
732        if ("not-calibrated".equals(codeString))
733          return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.NOTCALIBRATED);
734        if ("calibration-required".equals(codeString))
735          return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.CALIBRATIONREQUIRED);
736        if ("calibrated".equals(codeString))
737          return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.CALIBRATED);
738        if ("unspecified".equals(codeString))
739          return new Enumeration<DeviceMetricCalibrationState>(this, DeviceMetricCalibrationState.UNSPECIFIED);
740        throw new FHIRException("Unknown DeviceMetricCalibrationState code '"+codeString+"'");
741        }
742    public String toCode(DeviceMetricCalibrationState code) {
743      if (code == DeviceMetricCalibrationState.NOTCALIBRATED)
744        return "not-calibrated";
745      if (code == DeviceMetricCalibrationState.CALIBRATIONREQUIRED)
746        return "calibration-required";
747      if (code == DeviceMetricCalibrationState.CALIBRATED)
748        return "calibrated";
749      if (code == DeviceMetricCalibrationState.UNSPECIFIED)
750        return "unspecified";
751      return "?";
752      }
753    public String toSystem(DeviceMetricCalibrationState code) {
754      return code.getSystem();
755      }
756    }
757
758    @Block()
759    public static class DeviceMetricCalibrationComponent extends BackboneElement implements IBaseBackboneElement {
760        /**
761         * Describes the type of the calibration method.
762         */
763        @Child(name = "type", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
764        @Description(shortDefinition="unspecified | offset | gain | two-point", formalDefinition="Describes the type of the calibration method." )
765        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/metric-calibration-type")
766        protected Enumeration<DeviceMetricCalibrationType> type;
767
768        /**
769         * Describes the state of the calibration.
770         */
771        @Child(name = "state", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
772        @Description(shortDefinition="not-calibrated | calibration-required | calibrated | unspecified", formalDefinition="Describes the state of the calibration." )
773        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/metric-calibration-state")
774        protected Enumeration<DeviceMetricCalibrationState> state;
775
776        /**
777         * Describes the time last calibration has been performed.
778         */
779        @Child(name = "time", type = {InstantType.class}, order=3, min=0, max=1, modifier=false, summary=true)
780        @Description(shortDefinition="Describes the time last calibration has been performed", formalDefinition="Describes the time last calibration has been performed." )
781        protected InstantType time;
782
783        private static final long serialVersionUID = 1163986578L;
784
785    /**
786     * Constructor
787     */
788      public DeviceMetricCalibrationComponent() {
789        super();
790      }
791
792        /**
793         * @return {@link #type} (Describes the type of the calibration method.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
794         */
795        public Enumeration<DeviceMetricCalibrationType> getTypeElement() { 
796          if (this.type == null)
797            if (Configuration.errorOnAutoCreate())
798              throw new Error("Attempt to auto-create DeviceMetricCalibrationComponent.type");
799            else if (Configuration.doAutoCreate())
800              this.type = new Enumeration<DeviceMetricCalibrationType>(new DeviceMetricCalibrationTypeEnumFactory()); // bb
801          return this.type;
802        }
803
804        public boolean hasTypeElement() { 
805          return this.type != null && !this.type.isEmpty();
806        }
807
808        public boolean hasType() { 
809          return this.type != null && !this.type.isEmpty();
810        }
811
812        /**
813         * @param value {@link #type} (Describes the type of the calibration method.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
814         */
815        public DeviceMetricCalibrationComponent setTypeElement(Enumeration<DeviceMetricCalibrationType> value) { 
816          this.type = value;
817          return this;
818        }
819
820        /**
821         * @return Describes the type of the calibration method.
822         */
823        public DeviceMetricCalibrationType getType() { 
824          return this.type == null ? null : this.type.getValue();
825        }
826
827        /**
828         * @param value Describes the type of the calibration method.
829         */
830        public DeviceMetricCalibrationComponent setType(DeviceMetricCalibrationType value) { 
831          if (value == null)
832            this.type = null;
833          else {
834            if (this.type == null)
835              this.type = new Enumeration<DeviceMetricCalibrationType>(new DeviceMetricCalibrationTypeEnumFactory());
836            this.type.setValue(value);
837          }
838          return this;
839        }
840
841        /**
842         * @return {@link #state} (Describes the state of the calibration.). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value
843         */
844        public Enumeration<DeviceMetricCalibrationState> getStateElement() { 
845          if (this.state == null)
846            if (Configuration.errorOnAutoCreate())
847              throw new Error("Attempt to auto-create DeviceMetricCalibrationComponent.state");
848            else if (Configuration.doAutoCreate())
849              this.state = new Enumeration<DeviceMetricCalibrationState>(new DeviceMetricCalibrationStateEnumFactory()); // bb
850          return this.state;
851        }
852
853        public boolean hasStateElement() { 
854          return this.state != null && !this.state.isEmpty();
855        }
856
857        public boolean hasState() { 
858          return this.state != null && !this.state.isEmpty();
859        }
860
861        /**
862         * @param value {@link #state} (Describes the state of the calibration.). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value
863         */
864        public DeviceMetricCalibrationComponent setStateElement(Enumeration<DeviceMetricCalibrationState> value) { 
865          this.state = value;
866          return this;
867        }
868
869        /**
870         * @return Describes the state of the calibration.
871         */
872        public DeviceMetricCalibrationState getState() { 
873          return this.state == null ? null : this.state.getValue();
874        }
875
876        /**
877         * @param value Describes the state of the calibration.
878         */
879        public DeviceMetricCalibrationComponent setState(DeviceMetricCalibrationState value) { 
880          if (value == null)
881            this.state = null;
882          else {
883            if (this.state == null)
884              this.state = new Enumeration<DeviceMetricCalibrationState>(new DeviceMetricCalibrationStateEnumFactory());
885            this.state.setValue(value);
886          }
887          return this;
888        }
889
890        /**
891         * @return {@link #time} (Describes the time last calibration has been performed.). This is the underlying object with id, value and extensions. The accessor "getTime" gives direct access to the value
892         */
893        public InstantType getTimeElement() { 
894          if (this.time == null)
895            if (Configuration.errorOnAutoCreate())
896              throw new Error("Attempt to auto-create DeviceMetricCalibrationComponent.time");
897            else if (Configuration.doAutoCreate())
898              this.time = new InstantType(); // bb
899          return this.time;
900        }
901
902        public boolean hasTimeElement() { 
903          return this.time != null && !this.time.isEmpty();
904        }
905
906        public boolean hasTime() { 
907          return this.time != null && !this.time.isEmpty();
908        }
909
910        /**
911         * @param value {@link #time} (Describes the time last calibration has been performed.). This is the underlying object with id, value and extensions. The accessor "getTime" gives direct access to the value
912         */
913        public DeviceMetricCalibrationComponent setTimeElement(InstantType value) { 
914          this.time = value;
915          return this;
916        }
917
918        /**
919         * @return Describes the time last calibration has been performed.
920         */
921        public Date getTime() { 
922          return this.time == null ? null : this.time.getValue();
923        }
924
925        /**
926         * @param value Describes the time last calibration has been performed.
927         */
928        public DeviceMetricCalibrationComponent setTime(Date value) { 
929          if (value == null)
930            this.time = null;
931          else {
932            if (this.time == null)
933              this.time = new InstantType();
934            this.time.setValue(value);
935          }
936          return this;
937        }
938
939        protected void listChildren(List<Property> children) {
940          super.listChildren(children);
941          children.add(new Property("type", "code", "Describes the type of the calibration method.", 0, 1, type));
942          children.add(new Property("state", "code", "Describes the state of the calibration.", 0, 1, state));
943          children.add(new Property("time", "instant", "Describes the time last calibration has been performed.", 0, 1, time));
944        }
945
946        @Override
947        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
948          switch (_hash) {
949          case 3575610: /*type*/  return new Property("type", "code", "Describes the type of the calibration method.", 0, 1, type);
950          case 109757585: /*state*/  return new Property("state", "code", "Describes the state of the calibration.", 0, 1, state);
951          case 3560141: /*time*/  return new Property("time", "instant", "Describes the time last calibration has been performed.", 0, 1, time);
952          default: return super.getNamedProperty(_hash, _name, _checkValid);
953          }
954
955        }
956
957      @Override
958      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
959        switch (hash) {
960        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DeviceMetricCalibrationType>
961        case 109757585: /*state*/ return this.state == null ? new Base[0] : new Base[] {this.state}; // Enumeration<DeviceMetricCalibrationState>
962        case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // InstantType
963        default: return super.getProperty(hash, name, checkValid);
964        }
965
966      }
967
968      @Override
969      public Base setProperty(int hash, String name, Base value) throws FHIRException {
970        switch (hash) {
971        case 3575610: // type
972          value = new DeviceMetricCalibrationTypeEnumFactory().fromType(castToCode(value));
973          this.type = (Enumeration) value; // Enumeration<DeviceMetricCalibrationType>
974          return value;
975        case 109757585: // state
976          value = new DeviceMetricCalibrationStateEnumFactory().fromType(castToCode(value));
977          this.state = (Enumeration) value; // Enumeration<DeviceMetricCalibrationState>
978          return value;
979        case 3560141: // time
980          this.time = castToInstant(value); // InstantType
981          return value;
982        default: return super.setProperty(hash, name, value);
983        }
984
985      }
986
987      @Override
988      public Base setProperty(String name, Base value) throws FHIRException {
989        if (name.equals("type")) {
990          value = new DeviceMetricCalibrationTypeEnumFactory().fromType(castToCode(value));
991          this.type = (Enumeration) value; // Enumeration<DeviceMetricCalibrationType>
992        } else if (name.equals("state")) {
993          value = new DeviceMetricCalibrationStateEnumFactory().fromType(castToCode(value));
994          this.state = (Enumeration) value; // Enumeration<DeviceMetricCalibrationState>
995        } else if (name.equals("time")) {
996          this.time = castToInstant(value); // InstantType
997        } else
998          return super.setProperty(name, value);
999        return value;
1000      }
1001
1002      @Override
1003      public Base makeProperty(int hash, String name) throws FHIRException {
1004        switch (hash) {
1005        case 3575610:  return getTypeElement();
1006        case 109757585:  return getStateElement();
1007        case 3560141:  return getTimeElement();
1008        default: return super.makeProperty(hash, name);
1009        }
1010
1011      }
1012
1013      @Override
1014      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1015        switch (hash) {
1016        case 3575610: /*type*/ return new String[] {"code"};
1017        case 109757585: /*state*/ return new String[] {"code"};
1018        case 3560141: /*time*/ return new String[] {"instant"};
1019        default: return super.getTypesForProperty(hash, name);
1020        }
1021
1022      }
1023
1024      @Override
1025      public Base addChild(String name) throws FHIRException {
1026        if (name.equals("type")) {
1027          throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.type");
1028        }
1029        else if (name.equals("state")) {
1030          throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.state");
1031        }
1032        else if (name.equals("time")) {
1033          throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.time");
1034        }
1035        else
1036          return super.addChild(name);
1037      }
1038
1039      public DeviceMetricCalibrationComponent copy() {
1040        DeviceMetricCalibrationComponent dst = new DeviceMetricCalibrationComponent();
1041        copyValues(dst);
1042        return dst;
1043      }
1044
1045      public void copyValues(DeviceMetricCalibrationComponent dst) {
1046        super.copyValues(dst);
1047        dst.type = type == null ? null : type.copy();
1048        dst.state = state == null ? null : state.copy();
1049        dst.time = time == null ? null : time.copy();
1050      }
1051
1052      @Override
1053      public boolean equalsDeep(Base other_) {
1054        if (!super.equalsDeep(other_))
1055          return false;
1056        if (!(other_ instanceof DeviceMetricCalibrationComponent))
1057          return false;
1058        DeviceMetricCalibrationComponent o = (DeviceMetricCalibrationComponent) other_;
1059        return compareDeep(type, o.type, true) && compareDeep(state, o.state, true) && compareDeep(time, o.time, true)
1060          ;
1061      }
1062
1063      @Override
1064      public boolean equalsShallow(Base other_) {
1065        if (!super.equalsShallow(other_))
1066          return false;
1067        if (!(other_ instanceof DeviceMetricCalibrationComponent))
1068          return false;
1069        DeviceMetricCalibrationComponent o = (DeviceMetricCalibrationComponent) other_;
1070        return compareValues(type, o.type, true) && compareValues(state, o.state, true) && compareValues(time, o.time, true)
1071          ;
1072      }
1073
1074      public boolean isEmpty() {
1075        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, state, time);
1076      }
1077
1078  public String fhirType() {
1079    return "DeviceMetric.calibration";
1080
1081  }
1082
1083  }
1084
1085    /**
1086     * Unique instance identifiers assigned to a device by the device or gateway software, manufacturers, other organizations or owners. For example: handle ID.
1087     */
1088    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1089    @Description(shortDefinition="Instance identifier", formalDefinition="Unique instance identifiers assigned to a device by the device or gateway software, manufacturers, other organizations or owners. For example: handle ID." )
1090    protected List<Identifier> identifier;
1091
1092    /**
1093     * Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.
1094     */
1095    @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
1096    @Description(shortDefinition="Identity of metric, for example Heart Rate or PEEP Setting", formalDefinition="Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc." )
1097    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/devicemetric-type")
1098    protected CodeableConcept type;
1099
1100    /**
1101     * Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc.
1102     */
1103    @Child(name = "unit", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1104    @Description(shortDefinition="Unit of Measure for the Metric", formalDefinition="Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc." )
1105    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/devicemetric-type")
1106    protected CodeableConcept unit;
1107
1108    /**
1109     * Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacturer, serial number, etc.
1110     */
1111    @Child(name = "source", type = {Device.class}, order=3, min=0, max=1, modifier=false, summary=true)
1112    @Description(shortDefinition="Describes the link to the source Device", formalDefinition="Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacturer, serial number, etc." )
1113    protected Reference source;
1114
1115    /**
1116     * The actual object that is the target of the reference (Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacturer, serial number, etc.)
1117     */
1118    protected Device sourceTarget;
1119
1120    /**
1121     * Describes the link to the  Device that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a Device that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.
1122     */
1123    @Child(name = "parent", type = {Device.class}, order=4, min=0, max=1, modifier=false, summary=true)
1124    @Description(shortDefinition="Describes the link to the parent Device", formalDefinition="Describes the link to the  Device that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a Device that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location." )
1125    protected Reference parent;
1126
1127    /**
1128     * The actual object that is the target of the reference (Describes the link to the  Device that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a Device that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.)
1129     */
1130    protected Device parentTarget;
1131
1132    /**
1133     * Indicates current operational state of the device. For example: On, Off, Standby, etc.
1134     */
1135    @Child(name = "operationalStatus", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1136    @Description(shortDefinition="on | off | standby | entered-in-error", formalDefinition="Indicates current operational state of the device. For example: On, Off, Standby, etc." )
1137    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/metric-operational-status")
1138    protected Enumeration<DeviceMetricOperationalStatus> operationalStatus;
1139
1140    /**
1141     * Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.
1142     */
1143    @Child(name = "color", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1144    @Description(shortDefinition="black | red | green | yellow | blue | magenta | cyan | white", formalDefinition="Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta." )
1145    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/metric-color")
1146    protected Enumeration<DeviceMetricColor> color;
1147
1148    /**
1149     * Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.
1150     */
1151    @Child(name = "category", type = {CodeType.class}, order=7, min=1, max=1, modifier=false, summary=true)
1152    @Description(shortDefinition="measurement | setting | calculation | unspecified", formalDefinition="Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation." )
1153    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/metric-category")
1154    protected Enumeration<DeviceMetricCategory> category;
1155
1156    /**
1157     * Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured.
1158     */
1159    @Child(name = "measurementPeriod", type = {Timing.class}, order=8, min=0, max=1, modifier=false, summary=true)
1160    @Description(shortDefinition="Describes the measurement repetition time", formalDefinition="Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured." )
1161    protected Timing measurementPeriod;
1162
1163    /**
1164     * Describes the calibrations that have been performed or that are required to be performed.
1165     */
1166    @Child(name = "calibration", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1167    @Description(shortDefinition="Describes the calibrations that have been performed or that are required to be performed", formalDefinition="Describes the calibrations that have been performed or that are required to be performed." )
1168    protected List<DeviceMetricCalibrationComponent> calibration;
1169
1170    private static final long serialVersionUID = 1309955219L;
1171
1172  /**
1173   * Constructor
1174   */
1175    public DeviceMetric() {
1176      super();
1177    }
1178
1179  /**
1180   * Constructor
1181   */
1182    public DeviceMetric(CodeableConcept type, Enumeration<DeviceMetricCategory> category) {
1183      super();
1184      this.type = type;
1185      this.category = category;
1186    }
1187
1188    /**
1189     * @return {@link #identifier} (Unique instance identifiers assigned to a device by the device or gateway software, manufacturers, other organizations or owners. For example: handle ID.)
1190     */
1191    public List<Identifier> getIdentifier() { 
1192      if (this.identifier == null)
1193        this.identifier = new ArrayList<Identifier>();
1194      return this.identifier;
1195    }
1196
1197    /**
1198     * @return Returns a reference to <code>this</code> for easy method chaining
1199     */
1200    public DeviceMetric setIdentifier(List<Identifier> theIdentifier) { 
1201      this.identifier = theIdentifier;
1202      return this;
1203    }
1204
1205    public boolean hasIdentifier() { 
1206      if (this.identifier == null)
1207        return false;
1208      for (Identifier item : this.identifier)
1209        if (!item.isEmpty())
1210          return true;
1211      return false;
1212    }
1213
1214    public Identifier addIdentifier() { //3
1215      Identifier t = new Identifier();
1216      if (this.identifier == null)
1217        this.identifier = new ArrayList<Identifier>();
1218      this.identifier.add(t);
1219      return t;
1220    }
1221
1222    public DeviceMetric addIdentifier(Identifier t) { //3
1223      if (t == null)
1224        return this;
1225      if (this.identifier == null)
1226        this.identifier = new ArrayList<Identifier>();
1227      this.identifier.add(t);
1228      return this;
1229    }
1230
1231    /**
1232     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1233     */
1234    public Identifier getIdentifierFirstRep() { 
1235      if (getIdentifier().isEmpty()) {
1236        addIdentifier();
1237      }
1238      return getIdentifier().get(0);
1239    }
1240
1241    /**
1242     * @return {@link #type} (Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.)
1243     */
1244    public CodeableConcept getType() { 
1245      if (this.type == null)
1246        if (Configuration.errorOnAutoCreate())
1247          throw new Error("Attempt to auto-create DeviceMetric.type");
1248        else if (Configuration.doAutoCreate())
1249          this.type = new CodeableConcept(); // cc
1250      return this.type;
1251    }
1252
1253    public boolean hasType() { 
1254      return this.type != null && !this.type.isEmpty();
1255    }
1256
1257    /**
1258     * @param value {@link #type} (Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.)
1259     */
1260    public DeviceMetric setType(CodeableConcept value) { 
1261      this.type = value;
1262      return this;
1263    }
1264
1265    /**
1266     * @return {@link #unit} (Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc.)
1267     */
1268    public CodeableConcept getUnit() { 
1269      if (this.unit == null)
1270        if (Configuration.errorOnAutoCreate())
1271          throw new Error("Attempt to auto-create DeviceMetric.unit");
1272        else if (Configuration.doAutoCreate())
1273          this.unit = new CodeableConcept(); // cc
1274      return this.unit;
1275    }
1276
1277    public boolean hasUnit() { 
1278      return this.unit != null && !this.unit.isEmpty();
1279    }
1280
1281    /**
1282     * @param value {@link #unit} (Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc.)
1283     */
1284    public DeviceMetric setUnit(CodeableConcept value) { 
1285      this.unit = value;
1286      return this;
1287    }
1288
1289    /**
1290     * @return {@link #source} (Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacturer, serial number, etc.)
1291     */
1292    public Reference getSource() { 
1293      if (this.source == null)
1294        if (Configuration.errorOnAutoCreate())
1295          throw new Error("Attempt to auto-create DeviceMetric.source");
1296        else if (Configuration.doAutoCreate())
1297          this.source = new Reference(); // cc
1298      return this.source;
1299    }
1300
1301    public boolean hasSource() { 
1302      return this.source != null && !this.source.isEmpty();
1303    }
1304
1305    /**
1306     * @param value {@link #source} (Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacturer, serial number, etc.)
1307     */
1308    public DeviceMetric setSource(Reference value) { 
1309      this.source = value;
1310      return this;
1311    }
1312
1313    /**
1314     * @return {@link #source} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacturer, serial number, etc.)
1315     */
1316    public Device getSourceTarget() { 
1317      if (this.sourceTarget == null)
1318        if (Configuration.errorOnAutoCreate())
1319          throw new Error("Attempt to auto-create DeviceMetric.source");
1320        else if (Configuration.doAutoCreate())
1321          this.sourceTarget = new Device(); // aa
1322      return this.sourceTarget;
1323    }
1324
1325    /**
1326     * @param value {@link #source} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacturer, serial number, etc.)
1327     */
1328    public DeviceMetric setSourceTarget(Device value) { 
1329      this.sourceTarget = value;
1330      return this;
1331    }
1332
1333    /**
1334     * @return {@link #parent} (Describes the link to the  Device that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a Device that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.)
1335     */
1336    public Reference getParent() { 
1337      if (this.parent == null)
1338        if (Configuration.errorOnAutoCreate())
1339          throw new Error("Attempt to auto-create DeviceMetric.parent");
1340        else if (Configuration.doAutoCreate())
1341          this.parent = new Reference(); // cc
1342      return this.parent;
1343    }
1344
1345    public boolean hasParent() { 
1346      return this.parent != null && !this.parent.isEmpty();
1347    }
1348
1349    /**
1350     * @param value {@link #parent} (Describes the link to the  Device that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a Device that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.)
1351     */
1352    public DeviceMetric setParent(Reference value) { 
1353      this.parent = value;
1354      return this;
1355    }
1356
1357    /**
1358     * @return {@link #parent} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Describes the link to the  Device that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a Device that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.)
1359     */
1360    public Device getParentTarget() { 
1361      if (this.parentTarget == null)
1362        if (Configuration.errorOnAutoCreate())
1363          throw new Error("Attempt to auto-create DeviceMetric.parent");
1364        else if (Configuration.doAutoCreate())
1365          this.parentTarget = new Device(); // aa
1366      return this.parentTarget;
1367    }
1368
1369    /**
1370     * @param value {@link #parent} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Describes the link to the  Device that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a Device that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.)
1371     */
1372    public DeviceMetric setParentTarget(Device value) { 
1373      this.parentTarget = value;
1374      return this;
1375    }
1376
1377    /**
1378     * @return {@link #operationalStatus} (Indicates current operational state of the device. For example: On, Off, Standby, etc.). This is the underlying object with id, value and extensions. The accessor "getOperationalStatus" gives direct access to the value
1379     */
1380    public Enumeration<DeviceMetricOperationalStatus> getOperationalStatusElement() { 
1381      if (this.operationalStatus == null)
1382        if (Configuration.errorOnAutoCreate())
1383          throw new Error("Attempt to auto-create DeviceMetric.operationalStatus");
1384        else if (Configuration.doAutoCreate())
1385          this.operationalStatus = new Enumeration<DeviceMetricOperationalStatus>(new DeviceMetricOperationalStatusEnumFactory()); // bb
1386      return this.operationalStatus;
1387    }
1388
1389    public boolean hasOperationalStatusElement() { 
1390      return this.operationalStatus != null && !this.operationalStatus.isEmpty();
1391    }
1392
1393    public boolean hasOperationalStatus() { 
1394      return this.operationalStatus != null && !this.operationalStatus.isEmpty();
1395    }
1396
1397    /**
1398     * @param value {@link #operationalStatus} (Indicates current operational state of the device. For example: On, Off, Standby, etc.). This is the underlying object with id, value and extensions. The accessor "getOperationalStatus" gives direct access to the value
1399     */
1400    public DeviceMetric setOperationalStatusElement(Enumeration<DeviceMetricOperationalStatus> value) { 
1401      this.operationalStatus = value;
1402      return this;
1403    }
1404
1405    /**
1406     * @return Indicates current operational state of the device. For example: On, Off, Standby, etc.
1407     */
1408    public DeviceMetricOperationalStatus getOperationalStatus() { 
1409      return this.operationalStatus == null ? null : this.operationalStatus.getValue();
1410    }
1411
1412    /**
1413     * @param value Indicates current operational state of the device. For example: On, Off, Standby, etc.
1414     */
1415    public DeviceMetric setOperationalStatus(DeviceMetricOperationalStatus value) { 
1416      if (value == null)
1417        this.operationalStatus = null;
1418      else {
1419        if (this.operationalStatus == null)
1420          this.operationalStatus = new Enumeration<DeviceMetricOperationalStatus>(new DeviceMetricOperationalStatusEnumFactory());
1421        this.operationalStatus.setValue(value);
1422      }
1423      return this;
1424    }
1425
1426    /**
1427     * @return {@link #color} (Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.). This is the underlying object with id, value and extensions. The accessor "getColor" gives direct access to the value
1428     */
1429    public Enumeration<DeviceMetricColor> getColorElement() { 
1430      if (this.color == null)
1431        if (Configuration.errorOnAutoCreate())
1432          throw new Error("Attempt to auto-create DeviceMetric.color");
1433        else if (Configuration.doAutoCreate())
1434          this.color = new Enumeration<DeviceMetricColor>(new DeviceMetricColorEnumFactory()); // bb
1435      return this.color;
1436    }
1437
1438    public boolean hasColorElement() { 
1439      return this.color != null && !this.color.isEmpty();
1440    }
1441
1442    public boolean hasColor() { 
1443      return this.color != null && !this.color.isEmpty();
1444    }
1445
1446    /**
1447     * @param value {@link #color} (Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.). This is the underlying object with id, value and extensions. The accessor "getColor" gives direct access to the value
1448     */
1449    public DeviceMetric setColorElement(Enumeration<DeviceMetricColor> value) { 
1450      this.color = value;
1451      return this;
1452    }
1453
1454    /**
1455     * @return Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.
1456     */
1457    public DeviceMetricColor getColor() { 
1458      return this.color == null ? null : this.color.getValue();
1459    }
1460
1461    /**
1462     * @param value Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.
1463     */
1464    public DeviceMetric setColor(DeviceMetricColor value) { 
1465      if (value == null)
1466        this.color = null;
1467      else {
1468        if (this.color == null)
1469          this.color = new Enumeration<DeviceMetricColor>(new DeviceMetricColorEnumFactory());
1470        this.color.setValue(value);
1471      }
1472      return this;
1473    }
1474
1475    /**
1476     * @return {@link #category} (Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
1477     */
1478    public Enumeration<DeviceMetricCategory> getCategoryElement() { 
1479      if (this.category == null)
1480        if (Configuration.errorOnAutoCreate())
1481          throw new Error("Attempt to auto-create DeviceMetric.category");
1482        else if (Configuration.doAutoCreate())
1483          this.category = new Enumeration<DeviceMetricCategory>(new DeviceMetricCategoryEnumFactory()); // bb
1484      return this.category;
1485    }
1486
1487    public boolean hasCategoryElement() { 
1488      return this.category != null && !this.category.isEmpty();
1489    }
1490
1491    public boolean hasCategory() { 
1492      return this.category != null && !this.category.isEmpty();
1493    }
1494
1495    /**
1496     * @param value {@link #category} (Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
1497     */
1498    public DeviceMetric setCategoryElement(Enumeration<DeviceMetricCategory> value) { 
1499      this.category = value;
1500      return this;
1501    }
1502
1503    /**
1504     * @return Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.
1505     */
1506    public DeviceMetricCategory getCategory() { 
1507      return this.category == null ? null : this.category.getValue();
1508    }
1509
1510    /**
1511     * @param value Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.
1512     */
1513    public DeviceMetric setCategory(DeviceMetricCategory value) { 
1514        if (this.category == null)
1515          this.category = new Enumeration<DeviceMetricCategory>(new DeviceMetricCategoryEnumFactory());
1516        this.category.setValue(value);
1517      return this;
1518    }
1519
1520    /**
1521     * @return {@link #measurementPeriod} (Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured.)
1522     */
1523    public Timing getMeasurementPeriod() { 
1524      if (this.measurementPeriod == null)
1525        if (Configuration.errorOnAutoCreate())
1526          throw new Error("Attempt to auto-create DeviceMetric.measurementPeriod");
1527        else if (Configuration.doAutoCreate())
1528          this.measurementPeriod = new Timing(); // cc
1529      return this.measurementPeriod;
1530    }
1531
1532    public boolean hasMeasurementPeriod() { 
1533      return this.measurementPeriod != null && !this.measurementPeriod.isEmpty();
1534    }
1535
1536    /**
1537     * @param value {@link #measurementPeriod} (Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured.)
1538     */
1539    public DeviceMetric setMeasurementPeriod(Timing value) { 
1540      this.measurementPeriod = value;
1541      return this;
1542    }
1543
1544    /**
1545     * @return {@link #calibration} (Describes the calibrations that have been performed or that are required to be performed.)
1546     */
1547    public List<DeviceMetricCalibrationComponent> getCalibration() { 
1548      if (this.calibration == null)
1549        this.calibration = new ArrayList<DeviceMetricCalibrationComponent>();
1550      return this.calibration;
1551    }
1552
1553    /**
1554     * @return Returns a reference to <code>this</code> for easy method chaining
1555     */
1556    public DeviceMetric setCalibration(List<DeviceMetricCalibrationComponent> theCalibration) { 
1557      this.calibration = theCalibration;
1558      return this;
1559    }
1560
1561    public boolean hasCalibration() { 
1562      if (this.calibration == null)
1563        return false;
1564      for (DeviceMetricCalibrationComponent item : this.calibration)
1565        if (!item.isEmpty())
1566          return true;
1567      return false;
1568    }
1569
1570    public DeviceMetricCalibrationComponent addCalibration() { //3
1571      DeviceMetricCalibrationComponent t = new DeviceMetricCalibrationComponent();
1572      if (this.calibration == null)
1573        this.calibration = new ArrayList<DeviceMetricCalibrationComponent>();
1574      this.calibration.add(t);
1575      return t;
1576    }
1577
1578    public DeviceMetric addCalibration(DeviceMetricCalibrationComponent t) { //3
1579      if (t == null)
1580        return this;
1581      if (this.calibration == null)
1582        this.calibration = new ArrayList<DeviceMetricCalibrationComponent>();
1583      this.calibration.add(t);
1584      return this;
1585    }
1586
1587    /**
1588     * @return The first repetition of repeating field {@link #calibration}, creating it if it does not already exist
1589     */
1590    public DeviceMetricCalibrationComponent getCalibrationFirstRep() { 
1591      if (getCalibration().isEmpty()) {
1592        addCalibration();
1593      }
1594      return getCalibration().get(0);
1595    }
1596
1597      protected void listChildren(List<Property> children) {
1598        super.listChildren(children);
1599        children.add(new Property("identifier", "Identifier", "Unique instance identifiers assigned to a device by the device or gateway software, manufacturers, other organizations or owners. For example: handle ID.", 0, java.lang.Integer.MAX_VALUE, identifier));
1600        children.add(new Property("type", "CodeableConcept", "Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.", 0, 1, type));
1601        children.add(new Property("unit", "CodeableConcept", "Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc.", 0, 1, unit));
1602        children.add(new Property("source", "Reference(Device)", "Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacturer, serial number, etc.", 0, 1, source));
1603        children.add(new Property("parent", "Reference(Device)", "Describes the link to the  Device that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a Device that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.", 0, 1, parent));
1604        children.add(new Property("operationalStatus", "code", "Indicates current operational state of the device. For example: On, Off, Standby, etc.", 0, 1, operationalStatus));
1605        children.add(new Property("color", "code", "Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.", 0, 1, color));
1606        children.add(new Property("category", "code", "Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.", 0, 1, category));
1607        children.add(new Property("measurementPeriod", "Timing", "Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured.", 0, 1, measurementPeriod));
1608        children.add(new Property("calibration", "", "Describes the calibrations that have been performed or that are required to be performed.", 0, java.lang.Integer.MAX_VALUE, calibration));
1609      }
1610
1611      @Override
1612      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1613        switch (_hash) {
1614        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique instance identifiers assigned to a device by the device or gateway software, manufacturers, other organizations or owners. For example: handle ID.", 0, java.lang.Integer.MAX_VALUE, identifier);
1615        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Describes the type of the metric. For example: Heart Rate, PEEP Setting, etc.", 0, 1, type);
1616        case 3594628: /*unit*/  return new Property("unit", "CodeableConcept", "Describes the unit that an observed value determined for this metric will have. For example: Percent, Seconds, etc.", 0, 1, unit);
1617        case -896505829: /*source*/  return new Property("source", "Reference(Device)", "Describes the link to the  Device that this DeviceMetric belongs to and that contains administrative device information such as manufacturer, serial number, etc.", 0, 1, source);
1618        case -995424086: /*parent*/  return new Property("parent", "Reference(Device)", "Describes the link to the  Device that this DeviceMetric belongs to and that provide information about the location of this DeviceMetric in the containment structure of the parent Device. An example would be a Device that represents a Channel. This reference can be used by a client application to distinguish DeviceMetrics that have the same type, but should be interpreted based on their containment location.", 0, 1, parent);
1619        case -2103166364: /*operationalStatus*/  return new Property("operationalStatus", "code", "Indicates current operational state of the device. For example: On, Off, Standby, etc.", 0, 1, operationalStatus);
1620        case 94842723: /*color*/  return new Property("color", "code", "Describes the color representation for the metric. This is often used to aid clinicians to track and identify parameter types by color. In practice, consider a Patient Monitor that has ECG/HR and Pleth for example; the parameters are displayed in different characteristic colors, such as HR-blue, BP-green, and PR and SpO2- magenta.", 0, 1, color);
1621        case 50511102: /*category*/  return new Property("category", "code", "Indicates the category of the observation generation process. A DeviceMetric can be for example a setting, measurement, or calculation.", 0, 1, category);
1622        case -1300332387: /*measurementPeriod*/  return new Property("measurementPeriod", "Timing", "Describes the measurement repetition time. This is not necessarily the same as the update period. The measurement repetition time can range from milliseconds up to hours. An example for a measurement repetition time in the range of milliseconds is the sampling rate of an ECG. An example for a measurement repetition time in the range of hours is a NIBP that is triggered automatically every hour. The update period may be different than the measurement repetition time, if the device does not update the published observed value with the same frequency as it was measured.", 0, 1, measurementPeriod);
1623        case 1421318634: /*calibration*/  return new Property("calibration", "", "Describes the calibrations that have been performed or that are required to be performed.", 0, java.lang.Integer.MAX_VALUE, calibration);
1624        default: return super.getNamedProperty(_hash, _name, _checkValid);
1625        }
1626
1627      }
1628
1629      @Override
1630      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1631        switch (hash) {
1632        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1633        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1634        case 3594628: /*unit*/ return this.unit == null ? new Base[0] : new Base[] {this.unit}; // CodeableConcept
1635        case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // Reference
1636        case -995424086: /*parent*/ return this.parent == null ? new Base[0] : new Base[] {this.parent}; // Reference
1637        case -2103166364: /*operationalStatus*/ return this.operationalStatus == null ? new Base[0] : new Base[] {this.operationalStatus}; // Enumeration<DeviceMetricOperationalStatus>
1638        case 94842723: /*color*/ return this.color == null ? new Base[0] : new Base[] {this.color}; // Enumeration<DeviceMetricColor>
1639        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Enumeration<DeviceMetricCategory>
1640        case -1300332387: /*measurementPeriod*/ return this.measurementPeriod == null ? new Base[0] : new Base[] {this.measurementPeriod}; // Timing
1641        case 1421318634: /*calibration*/ return this.calibration == null ? new Base[0] : this.calibration.toArray(new Base[this.calibration.size()]); // DeviceMetricCalibrationComponent
1642        default: return super.getProperty(hash, name, checkValid);
1643        }
1644
1645      }
1646
1647      @Override
1648      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1649        switch (hash) {
1650        case -1618432855: // identifier
1651          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1652          return value;
1653        case 3575610: // type
1654          this.type = castToCodeableConcept(value); // CodeableConcept
1655          return value;
1656        case 3594628: // unit
1657          this.unit = castToCodeableConcept(value); // CodeableConcept
1658          return value;
1659        case -896505829: // source
1660          this.source = castToReference(value); // Reference
1661          return value;
1662        case -995424086: // parent
1663          this.parent = castToReference(value); // Reference
1664          return value;
1665        case -2103166364: // operationalStatus
1666          value = new DeviceMetricOperationalStatusEnumFactory().fromType(castToCode(value));
1667          this.operationalStatus = (Enumeration) value; // Enumeration<DeviceMetricOperationalStatus>
1668          return value;
1669        case 94842723: // color
1670          value = new DeviceMetricColorEnumFactory().fromType(castToCode(value));
1671          this.color = (Enumeration) value; // Enumeration<DeviceMetricColor>
1672          return value;
1673        case 50511102: // category
1674          value = new DeviceMetricCategoryEnumFactory().fromType(castToCode(value));
1675          this.category = (Enumeration) value; // Enumeration<DeviceMetricCategory>
1676          return value;
1677        case -1300332387: // measurementPeriod
1678          this.measurementPeriod = castToTiming(value); // Timing
1679          return value;
1680        case 1421318634: // calibration
1681          this.getCalibration().add((DeviceMetricCalibrationComponent) value); // DeviceMetricCalibrationComponent
1682          return value;
1683        default: return super.setProperty(hash, name, value);
1684        }
1685
1686      }
1687
1688      @Override
1689      public Base setProperty(String name, Base value) throws FHIRException {
1690        if (name.equals("identifier")) {
1691          this.getIdentifier().add(castToIdentifier(value));
1692        } else if (name.equals("type")) {
1693          this.type = castToCodeableConcept(value); // CodeableConcept
1694        } else if (name.equals("unit")) {
1695          this.unit = castToCodeableConcept(value); // CodeableConcept
1696        } else if (name.equals("source")) {
1697          this.source = castToReference(value); // Reference
1698        } else if (name.equals("parent")) {
1699          this.parent = castToReference(value); // Reference
1700        } else if (name.equals("operationalStatus")) {
1701          value = new DeviceMetricOperationalStatusEnumFactory().fromType(castToCode(value));
1702          this.operationalStatus = (Enumeration) value; // Enumeration<DeviceMetricOperationalStatus>
1703        } else if (name.equals("color")) {
1704          value = new DeviceMetricColorEnumFactory().fromType(castToCode(value));
1705          this.color = (Enumeration) value; // Enumeration<DeviceMetricColor>
1706        } else if (name.equals("category")) {
1707          value = new DeviceMetricCategoryEnumFactory().fromType(castToCode(value));
1708          this.category = (Enumeration) value; // Enumeration<DeviceMetricCategory>
1709        } else if (name.equals("measurementPeriod")) {
1710          this.measurementPeriod = castToTiming(value); // Timing
1711        } else if (name.equals("calibration")) {
1712          this.getCalibration().add((DeviceMetricCalibrationComponent) value);
1713        } else
1714          return super.setProperty(name, value);
1715        return value;
1716      }
1717
1718      @Override
1719      public Base makeProperty(int hash, String name) throws FHIRException {
1720        switch (hash) {
1721        case -1618432855:  return addIdentifier(); 
1722        case 3575610:  return getType(); 
1723        case 3594628:  return getUnit(); 
1724        case -896505829:  return getSource(); 
1725        case -995424086:  return getParent(); 
1726        case -2103166364:  return getOperationalStatusElement();
1727        case 94842723:  return getColorElement();
1728        case 50511102:  return getCategoryElement();
1729        case -1300332387:  return getMeasurementPeriod(); 
1730        case 1421318634:  return addCalibration(); 
1731        default: return super.makeProperty(hash, name);
1732        }
1733
1734      }
1735
1736      @Override
1737      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1738        switch (hash) {
1739        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1740        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1741        case 3594628: /*unit*/ return new String[] {"CodeableConcept"};
1742        case -896505829: /*source*/ return new String[] {"Reference"};
1743        case -995424086: /*parent*/ return new String[] {"Reference"};
1744        case -2103166364: /*operationalStatus*/ return new String[] {"code"};
1745        case 94842723: /*color*/ return new String[] {"code"};
1746        case 50511102: /*category*/ return new String[] {"code"};
1747        case -1300332387: /*measurementPeriod*/ return new String[] {"Timing"};
1748        case 1421318634: /*calibration*/ return new String[] {};
1749        default: return super.getTypesForProperty(hash, name);
1750        }
1751
1752      }
1753
1754      @Override
1755      public Base addChild(String name) throws FHIRException {
1756        if (name.equals("identifier")) {
1757          return addIdentifier();
1758        }
1759        else if (name.equals("type")) {
1760          this.type = new CodeableConcept();
1761          return this.type;
1762        }
1763        else if (name.equals("unit")) {
1764          this.unit = new CodeableConcept();
1765          return this.unit;
1766        }
1767        else if (name.equals("source")) {
1768          this.source = new Reference();
1769          return this.source;
1770        }
1771        else if (name.equals("parent")) {
1772          this.parent = new Reference();
1773          return this.parent;
1774        }
1775        else if (name.equals("operationalStatus")) {
1776          throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.operationalStatus");
1777        }
1778        else if (name.equals("color")) {
1779          throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.color");
1780        }
1781        else if (name.equals("category")) {
1782          throw new FHIRException("Cannot call addChild on a primitive type DeviceMetric.category");
1783        }
1784        else if (name.equals("measurementPeriod")) {
1785          this.measurementPeriod = new Timing();
1786          return this.measurementPeriod;
1787        }
1788        else if (name.equals("calibration")) {
1789          return addCalibration();
1790        }
1791        else
1792          return super.addChild(name);
1793      }
1794
1795  public String fhirType() {
1796    return "DeviceMetric";
1797
1798  }
1799
1800      public DeviceMetric copy() {
1801        DeviceMetric dst = new DeviceMetric();
1802        copyValues(dst);
1803        return dst;
1804      }
1805
1806      public void copyValues(DeviceMetric dst) {
1807        super.copyValues(dst);
1808        if (identifier != null) {
1809          dst.identifier = new ArrayList<Identifier>();
1810          for (Identifier i : identifier)
1811            dst.identifier.add(i.copy());
1812        };
1813        dst.type = type == null ? null : type.copy();
1814        dst.unit = unit == null ? null : unit.copy();
1815        dst.source = source == null ? null : source.copy();
1816        dst.parent = parent == null ? null : parent.copy();
1817        dst.operationalStatus = operationalStatus == null ? null : operationalStatus.copy();
1818        dst.color = color == null ? null : color.copy();
1819        dst.category = category == null ? null : category.copy();
1820        dst.measurementPeriod = measurementPeriod == null ? null : measurementPeriod.copy();
1821        if (calibration != null) {
1822          dst.calibration = new ArrayList<DeviceMetricCalibrationComponent>();
1823          for (DeviceMetricCalibrationComponent i : calibration)
1824            dst.calibration.add(i.copy());
1825        };
1826      }
1827
1828      protected DeviceMetric typedCopy() {
1829        return copy();
1830      }
1831
1832      @Override
1833      public boolean equalsDeep(Base other_) {
1834        if (!super.equalsDeep(other_))
1835          return false;
1836        if (!(other_ instanceof DeviceMetric))
1837          return false;
1838        DeviceMetric o = (DeviceMetric) other_;
1839        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(unit, o.unit, true)
1840           && compareDeep(source, o.source, true) && compareDeep(parent, o.parent, true) && compareDeep(operationalStatus, o.operationalStatus, true)
1841           && compareDeep(color, o.color, true) && compareDeep(category, o.category, true) && compareDeep(measurementPeriod, o.measurementPeriod, true)
1842           && compareDeep(calibration, o.calibration, true);
1843      }
1844
1845      @Override
1846      public boolean equalsShallow(Base other_) {
1847        if (!super.equalsShallow(other_))
1848          return false;
1849        if (!(other_ instanceof DeviceMetric))
1850          return false;
1851        DeviceMetric o = (DeviceMetric) other_;
1852        return compareValues(operationalStatus, o.operationalStatus, true) && compareValues(color, o.color, true)
1853           && compareValues(category, o.category, true);
1854      }
1855
1856      public boolean isEmpty() {
1857        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, unit, source
1858          , parent, operationalStatus, color, category, measurementPeriod, calibration);
1859      }
1860
1861  @Override
1862  public ResourceType getResourceType() {
1863    return ResourceType.DeviceMetric;
1864   }
1865
1866 /**
1867   * Search parameter: <b>parent</b>
1868   * <p>
1869   * Description: <b>The parent DeviceMetric resource</b><br>
1870   * Type: <b>reference</b><br>
1871   * Path: <b>DeviceMetric.parent</b><br>
1872   * </p>
1873   */
1874  @SearchParamDefinition(name="parent", path="DeviceMetric.parent", description="The parent DeviceMetric resource", type="reference", target={Device.class } )
1875  public static final String SP_PARENT = "parent";
1876 /**
1877   * <b>Fluent Client</b> search parameter constant for <b>parent</b>
1878   * <p>
1879   * Description: <b>The parent DeviceMetric resource</b><br>
1880   * Type: <b>reference</b><br>
1881   * Path: <b>DeviceMetric.parent</b><br>
1882   * </p>
1883   */
1884  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARENT);
1885
1886/**
1887   * Constant for fluent queries to be used to add include statements. Specifies
1888   * the path value of "<b>DeviceMetric:parent</b>".
1889   */
1890  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARENT = new ca.uhn.fhir.model.api.Include("DeviceMetric:parent").toLocked();
1891
1892 /**
1893   * Search parameter: <b>identifier</b>
1894   * <p>
1895   * Description: <b>The identifier of the metric</b><br>
1896   * Type: <b>token</b><br>
1897   * Path: <b>DeviceMetric.identifier</b><br>
1898   * </p>
1899   */
1900  @SearchParamDefinition(name="identifier", path="DeviceMetric.identifier", description="The identifier of the metric", type="token" )
1901  public static final String SP_IDENTIFIER = "identifier";
1902 /**
1903   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1904   * <p>
1905   * Description: <b>The identifier of the metric</b><br>
1906   * Type: <b>token</b><br>
1907   * Path: <b>DeviceMetric.identifier</b><br>
1908   * </p>
1909   */
1910  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1911
1912 /**
1913   * Search parameter: <b>source</b>
1914   * <p>
1915   * Description: <b>The device resource</b><br>
1916   * Type: <b>reference</b><br>
1917   * Path: <b>DeviceMetric.source</b><br>
1918   * </p>
1919   */
1920  @SearchParamDefinition(name="source", path="DeviceMetric.source", description="The device resource", type="reference", target={Device.class } )
1921  public static final String SP_SOURCE = "source";
1922 /**
1923   * <b>Fluent Client</b> search parameter constant for <b>source</b>
1924   * <p>
1925   * Description: <b>The device resource</b><br>
1926   * Type: <b>reference</b><br>
1927   * Path: <b>DeviceMetric.source</b><br>
1928   * </p>
1929   */
1930  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SOURCE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SOURCE);
1931
1932/**
1933   * Constant for fluent queries to be used to add include statements. Specifies
1934   * the path value of "<b>DeviceMetric:source</b>".
1935   */
1936  public static final ca.uhn.fhir.model.api.Include INCLUDE_SOURCE = new ca.uhn.fhir.model.api.Include("DeviceMetric:source").toLocked();
1937
1938 /**
1939   * Search parameter: <b>type</b>
1940   * <p>
1941   * Description: <b>The component type</b><br>
1942   * Type: <b>token</b><br>
1943   * Path: <b>DeviceMetric.type</b><br>
1944   * </p>
1945   */
1946  @SearchParamDefinition(name="type", path="DeviceMetric.type", description="The component type", type="token" )
1947  public static final String SP_TYPE = "type";
1948 /**
1949   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1950   * <p>
1951   * Description: <b>The component type</b><br>
1952   * Type: <b>token</b><br>
1953   * Path: <b>DeviceMetric.type</b><br>
1954   * </p>
1955   */
1956  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
1957
1958 /**
1959   * Search parameter: <b>category</b>
1960   * <p>
1961   * Description: <b>The category of the metric</b><br>
1962   * Type: <b>token</b><br>
1963   * Path: <b>DeviceMetric.category</b><br>
1964   * </p>
1965   */
1966  @SearchParamDefinition(name="category", path="DeviceMetric.category", description="The category of the metric", type="token" )
1967  public static final String SP_CATEGORY = "category";
1968 /**
1969   * <b>Fluent Client</b> search parameter constant for <b>category</b>
1970   * <p>
1971   * Description: <b>The category of the metric</b><br>
1972   * Type: <b>token</b><br>
1973   * Path: <b>DeviceMetric.category</b><br>
1974   * </p>
1975   */
1976  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
1977
1978
1979}