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