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