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