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