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