001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * This is a specialized resource that defines the characteristics and capabilities of a device.
052 */
053@ResourceDef(name="DeviceDefinition", profile="http://hl7.org/fhir/StructureDefinition/DeviceDefinition")
054public class DeviceDefinition extends DomainResource {
055
056    public enum DeviceCorrectiveActionScope {
057        /**
058         * The corrective action was intended for all units of the same model.
059         */
060        MODEL, 
061        /**
062         * The corrective action was intended for a specific batch of units identified by a lot number.
063         */
064        LOTNUMBERS, 
065        /**
066         * The corrective action was intended for an individual unit (or a set of units) individually identified by serial number.
067         */
068        SERIALNUMBERS, 
069        /**
070         * added to help the parsers with the generic types
071         */
072        NULL;
073        public static DeviceCorrectiveActionScope fromCode(String codeString) throws FHIRException {
074            if (codeString == null || "".equals(codeString))
075                return null;
076        if ("model".equals(codeString))
077          return MODEL;
078        if ("lot-numbers".equals(codeString))
079          return LOTNUMBERS;
080        if ("serial-numbers".equals(codeString))
081          return SERIALNUMBERS;
082        if (Configuration.isAcceptInvalidEnums())
083          return null;
084        else
085          throw new FHIRException("Unknown DeviceCorrectiveActionScope code '"+codeString+"'");
086        }
087        public String toCode() {
088          switch (this) {
089            case MODEL: return "model";
090            case LOTNUMBERS: return "lot-numbers";
091            case SERIALNUMBERS: return "serial-numbers";
092            case NULL: return null;
093            default: return "?";
094          }
095        }
096        public String getSystem() {
097          switch (this) {
098            case MODEL: return "http://hl7.org/fhir/device-correctiveactionscope";
099            case LOTNUMBERS: return "http://hl7.org/fhir/device-correctiveactionscope";
100            case SERIALNUMBERS: return "http://hl7.org/fhir/device-correctiveactionscope";
101            case NULL: return null;
102            default: return "?";
103          }
104        }
105        public String getDefinition() {
106          switch (this) {
107            case MODEL: return "The corrective action was intended for all units of the same model.";
108            case LOTNUMBERS: return "The corrective action was intended for a specific batch of units identified by a lot number.";
109            case SERIALNUMBERS: return "The corrective action was intended for an individual unit (or a set of units) individually identified by serial number.";
110            case NULL: return null;
111            default: return "?";
112          }
113        }
114        public String getDisplay() {
115          switch (this) {
116            case MODEL: return "Model";
117            case LOTNUMBERS: return "Lot Numbers";
118            case SERIALNUMBERS: return "Serial Numbers";
119            case NULL: return null;
120            default: return "?";
121          }
122        }
123    }
124
125  public static class DeviceCorrectiveActionScopeEnumFactory implements EnumFactory<DeviceCorrectiveActionScope> {
126    public DeviceCorrectiveActionScope fromCode(String codeString) throws IllegalArgumentException {
127      if (codeString == null || "".equals(codeString))
128            if (codeString == null || "".equals(codeString))
129                return null;
130        if ("model".equals(codeString))
131          return DeviceCorrectiveActionScope.MODEL;
132        if ("lot-numbers".equals(codeString))
133          return DeviceCorrectiveActionScope.LOTNUMBERS;
134        if ("serial-numbers".equals(codeString))
135          return DeviceCorrectiveActionScope.SERIALNUMBERS;
136        throw new IllegalArgumentException("Unknown DeviceCorrectiveActionScope code '"+codeString+"'");
137        }
138        public Enumeration<DeviceCorrectiveActionScope> fromType(PrimitiveType<?> code) throws FHIRException {
139          if (code == null)
140            return null;
141          if (code.isEmpty())
142            return new Enumeration<DeviceCorrectiveActionScope>(this, DeviceCorrectiveActionScope.NULL, code);
143          String codeString = ((PrimitiveType) code).asStringValue();
144          if (codeString == null || "".equals(codeString))
145            return new Enumeration<DeviceCorrectiveActionScope>(this, DeviceCorrectiveActionScope.NULL, code);
146        if ("model".equals(codeString))
147          return new Enumeration<DeviceCorrectiveActionScope>(this, DeviceCorrectiveActionScope.MODEL, code);
148        if ("lot-numbers".equals(codeString))
149          return new Enumeration<DeviceCorrectiveActionScope>(this, DeviceCorrectiveActionScope.LOTNUMBERS, code);
150        if ("serial-numbers".equals(codeString))
151          return new Enumeration<DeviceCorrectiveActionScope>(this, DeviceCorrectiveActionScope.SERIALNUMBERS, code);
152        throw new FHIRException("Unknown DeviceCorrectiveActionScope code '"+codeString+"'");
153        }
154    public String toCode(DeviceCorrectiveActionScope code) {
155      if (code == DeviceCorrectiveActionScope.MODEL)
156        return "model";
157      if (code == DeviceCorrectiveActionScope.LOTNUMBERS)
158        return "lot-numbers";
159      if (code == DeviceCorrectiveActionScope.SERIALNUMBERS)
160        return "serial-numbers";
161      return "?";
162      }
163    public String toSystem(DeviceCorrectiveActionScope code) {
164      return code.getSystem();
165      }
166    }
167
168    public enum DeviceDefinitionRegulatoryIdentifierType {
169        /**
170         * EUDAMED's basic UDI-DI identifier.
171         */
172        BASIC, 
173        /**
174         * EUDAMED's master UDI-DI identifier.
175         */
176        MASTER, 
177        /**
178         * The identifier is a license number.
179         */
180        LICENSE, 
181        /**
182         * added to help the parsers with the generic types
183         */
184        NULL;
185        public static DeviceDefinitionRegulatoryIdentifierType fromCode(String codeString) throws FHIRException {
186            if (codeString == null || "".equals(codeString))
187                return null;
188        if ("basic".equals(codeString))
189          return BASIC;
190        if ("master".equals(codeString))
191          return MASTER;
192        if ("license".equals(codeString))
193          return LICENSE;
194        if (Configuration.isAcceptInvalidEnums())
195          return null;
196        else
197          throw new FHIRException("Unknown DeviceDefinitionRegulatoryIdentifierType code '"+codeString+"'");
198        }
199        public String toCode() {
200          switch (this) {
201            case BASIC: return "basic";
202            case MASTER: return "master";
203            case LICENSE: return "license";
204            case NULL: return null;
205            default: return "?";
206          }
207        }
208        public String getSystem() {
209          switch (this) {
210            case BASIC: return "http://hl7.org/fhir/devicedefinition-regulatory-identifier-type";
211            case MASTER: return "http://hl7.org/fhir/devicedefinition-regulatory-identifier-type";
212            case LICENSE: return "http://hl7.org/fhir/devicedefinition-regulatory-identifier-type";
213            case NULL: return null;
214            default: return "?";
215          }
216        }
217        public String getDefinition() {
218          switch (this) {
219            case BASIC: return "EUDAMED's basic UDI-DI identifier.";
220            case MASTER: return "EUDAMED's master UDI-DI identifier.";
221            case LICENSE: return "The identifier is a license number.";
222            case NULL: return null;
223            default: return "?";
224          }
225        }
226        public String getDisplay() {
227          switch (this) {
228            case BASIC: return "Basic";
229            case MASTER: return "Master";
230            case LICENSE: return "License";
231            case NULL: return null;
232            default: return "?";
233          }
234        }
235    }
236
237  public static class DeviceDefinitionRegulatoryIdentifierTypeEnumFactory implements EnumFactory<DeviceDefinitionRegulatoryIdentifierType> {
238    public DeviceDefinitionRegulatoryIdentifierType fromCode(String codeString) throws IllegalArgumentException {
239      if (codeString == null || "".equals(codeString))
240            if (codeString == null || "".equals(codeString))
241                return null;
242        if ("basic".equals(codeString))
243          return DeviceDefinitionRegulatoryIdentifierType.BASIC;
244        if ("master".equals(codeString))
245          return DeviceDefinitionRegulatoryIdentifierType.MASTER;
246        if ("license".equals(codeString))
247          return DeviceDefinitionRegulatoryIdentifierType.LICENSE;
248        throw new IllegalArgumentException("Unknown DeviceDefinitionRegulatoryIdentifierType code '"+codeString+"'");
249        }
250        public Enumeration<DeviceDefinitionRegulatoryIdentifierType> fromType(PrimitiveType<?> code) throws FHIRException {
251          if (code == null)
252            return null;
253          if (code.isEmpty())
254            return new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(this, DeviceDefinitionRegulatoryIdentifierType.NULL, code);
255          String codeString = ((PrimitiveType) code).asStringValue();
256          if (codeString == null || "".equals(codeString))
257            return new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(this, DeviceDefinitionRegulatoryIdentifierType.NULL, code);
258        if ("basic".equals(codeString))
259          return new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(this, DeviceDefinitionRegulatoryIdentifierType.BASIC, code);
260        if ("master".equals(codeString))
261          return new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(this, DeviceDefinitionRegulatoryIdentifierType.MASTER, code);
262        if ("license".equals(codeString))
263          return new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(this, DeviceDefinitionRegulatoryIdentifierType.LICENSE, code);
264        throw new FHIRException("Unknown DeviceDefinitionRegulatoryIdentifierType code '"+codeString+"'");
265        }
266    public String toCode(DeviceDefinitionRegulatoryIdentifierType code) {
267      if (code == DeviceDefinitionRegulatoryIdentifierType.BASIC)
268        return "basic";
269      if (code == DeviceDefinitionRegulatoryIdentifierType.MASTER)
270        return "master";
271      if (code == DeviceDefinitionRegulatoryIdentifierType.LICENSE)
272        return "license";
273      return "?";
274      }
275    public String toSystem(DeviceDefinitionRegulatoryIdentifierType code) {
276      return code.getSystem();
277      }
278    }
279
280    public enum DeviceProductionIdentifierInUDI {
281        /**
282         * The label includes the lot number.
283         */
284        LOTNUMBER, 
285        /**
286         * The label includes the manufacture date.
287         */
288        MANUFACTUREDDATE, 
289        /**
290         * The label includes the serial number.
291         */
292        SERIALNUMBER, 
293        /**
294         * The label includes the expiration date.
295         */
296        EXPIRATIONDATE, 
297        /**
298         * The label includes the biological source identifier.
299         */
300        BIOLOGICALSOURCE, 
301        /**
302         * The label includes the software version.
303         */
304        SOFTWAREVERSION, 
305        /**
306         * added to help the parsers with the generic types
307         */
308        NULL;
309        public static DeviceProductionIdentifierInUDI fromCode(String codeString) throws FHIRException {
310            if (codeString == null || "".equals(codeString))
311                return null;
312        if ("lot-number".equals(codeString))
313          return LOTNUMBER;
314        if ("manufactured-date".equals(codeString))
315          return MANUFACTUREDDATE;
316        if ("serial-number".equals(codeString))
317          return SERIALNUMBER;
318        if ("expiration-date".equals(codeString))
319          return EXPIRATIONDATE;
320        if ("biological-source".equals(codeString))
321          return BIOLOGICALSOURCE;
322        if ("software-version".equals(codeString))
323          return SOFTWAREVERSION;
324        if (Configuration.isAcceptInvalidEnums())
325          return null;
326        else
327          throw new FHIRException("Unknown DeviceProductionIdentifierInUDI code '"+codeString+"'");
328        }
329        public String toCode() {
330          switch (this) {
331            case LOTNUMBER: return "lot-number";
332            case MANUFACTUREDDATE: return "manufactured-date";
333            case SERIALNUMBER: return "serial-number";
334            case EXPIRATIONDATE: return "expiration-date";
335            case BIOLOGICALSOURCE: return "biological-source";
336            case SOFTWAREVERSION: return "software-version";
337            case NULL: return null;
338            default: return "?";
339          }
340        }
341        public String getSystem() {
342          switch (this) {
343            case LOTNUMBER: return "http://hl7.org/fhir/device-productidentifierinudi";
344            case MANUFACTUREDDATE: return "http://hl7.org/fhir/device-productidentifierinudi";
345            case SERIALNUMBER: return "http://hl7.org/fhir/device-productidentifierinudi";
346            case EXPIRATIONDATE: return "http://hl7.org/fhir/device-productidentifierinudi";
347            case BIOLOGICALSOURCE: return "http://hl7.org/fhir/device-productidentifierinudi";
348            case SOFTWAREVERSION: return "http://hl7.org/fhir/device-productidentifierinudi";
349            case NULL: return null;
350            default: return "?";
351          }
352        }
353        public String getDefinition() {
354          switch (this) {
355            case LOTNUMBER: return "The label includes the lot number.";
356            case MANUFACTUREDDATE: return "The label includes the manufacture date.";
357            case SERIALNUMBER: return "The label includes the serial number.";
358            case EXPIRATIONDATE: return "The label includes the expiration date.";
359            case BIOLOGICALSOURCE: return "The label includes the biological source identifier.";
360            case SOFTWAREVERSION: return "The label includes the software version.";
361            case NULL: return null;
362            default: return "?";
363          }
364        }
365        public String getDisplay() {
366          switch (this) {
367            case LOTNUMBER: return "Lot Number";
368            case MANUFACTUREDDATE: return "Manufactured date";
369            case SERIALNUMBER: return "Serial Number";
370            case EXPIRATIONDATE: return "Expiration date";
371            case BIOLOGICALSOURCE: return "Biological source";
372            case SOFTWAREVERSION: return "Software Version";
373            case NULL: return null;
374            default: return "?";
375          }
376        }
377    }
378
379  public static class DeviceProductionIdentifierInUDIEnumFactory implements EnumFactory<DeviceProductionIdentifierInUDI> {
380    public DeviceProductionIdentifierInUDI fromCode(String codeString) throws IllegalArgumentException {
381      if (codeString == null || "".equals(codeString))
382            if (codeString == null || "".equals(codeString))
383                return null;
384        if ("lot-number".equals(codeString))
385          return DeviceProductionIdentifierInUDI.LOTNUMBER;
386        if ("manufactured-date".equals(codeString))
387          return DeviceProductionIdentifierInUDI.MANUFACTUREDDATE;
388        if ("serial-number".equals(codeString))
389          return DeviceProductionIdentifierInUDI.SERIALNUMBER;
390        if ("expiration-date".equals(codeString))
391          return DeviceProductionIdentifierInUDI.EXPIRATIONDATE;
392        if ("biological-source".equals(codeString))
393          return DeviceProductionIdentifierInUDI.BIOLOGICALSOURCE;
394        if ("software-version".equals(codeString))
395          return DeviceProductionIdentifierInUDI.SOFTWAREVERSION;
396        throw new IllegalArgumentException("Unknown DeviceProductionIdentifierInUDI code '"+codeString+"'");
397        }
398        public Enumeration<DeviceProductionIdentifierInUDI> fromType(PrimitiveType<?> code) throws FHIRException {
399          if (code == null)
400            return null;
401          if (code.isEmpty())
402            return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.NULL, code);
403          String codeString = ((PrimitiveType) code).asStringValue();
404          if (codeString == null || "".equals(codeString))
405            return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.NULL, code);
406        if ("lot-number".equals(codeString))
407          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.LOTNUMBER, code);
408        if ("manufactured-date".equals(codeString))
409          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.MANUFACTUREDDATE, code);
410        if ("serial-number".equals(codeString))
411          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.SERIALNUMBER, code);
412        if ("expiration-date".equals(codeString))
413          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.EXPIRATIONDATE, code);
414        if ("biological-source".equals(codeString))
415          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.BIOLOGICALSOURCE, code);
416        if ("software-version".equals(codeString))
417          return new Enumeration<DeviceProductionIdentifierInUDI>(this, DeviceProductionIdentifierInUDI.SOFTWAREVERSION, code);
418        throw new FHIRException("Unknown DeviceProductionIdentifierInUDI code '"+codeString+"'");
419        }
420    public String toCode(DeviceProductionIdentifierInUDI code) {
421      if (code == DeviceProductionIdentifierInUDI.LOTNUMBER)
422        return "lot-number";
423      if (code == DeviceProductionIdentifierInUDI.MANUFACTUREDDATE)
424        return "manufactured-date";
425      if (code == DeviceProductionIdentifierInUDI.SERIALNUMBER)
426        return "serial-number";
427      if (code == DeviceProductionIdentifierInUDI.EXPIRATIONDATE)
428        return "expiration-date";
429      if (code == DeviceProductionIdentifierInUDI.BIOLOGICALSOURCE)
430        return "biological-source";
431      if (code == DeviceProductionIdentifierInUDI.SOFTWAREVERSION)
432        return "software-version";
433      return "?";
434      }
435    public String toSystem(DeviceProductionIdentifierInUDI code) {
436      return code.getSystem();
437      }
438    }
439
440    @Block()
441    public static class DeviceDefinitionUdiDeviceIdentifierComponent extends BackboneElement implements IBaseBackboneElement {
442        /**
443         * The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.
444         */
445        @Child(name = "deviceIdentifier", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=false)
446        @Description(shortDefinition="The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier", formalDefinition="The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier." )
447        protected StringType deviceIdentifier;
448
449        /**
450         * The organization that assigns the identifier algorithm.
451         */
452        @Child(name = "issuer", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=false)
453        @Description(shortDefinition="The organization that assigns the identifier algorithm", formalDefinition="The organization that assigns the identifier algorithm." )
454        protected UriType issuer;
455
456        /**
457         * The jurisdiction to which the deviceIdentifier applies.
458         */
459        @Child(name = "jurisdiction", type = {UriType.class}, order=3, min=1, max=1, modifier=false, summary=false)
460        @Description(shortDefinition="The jurisdiction to which the deviceIdentifier applies", formalDefinition="The jurisdiction to which the deviceIdentifier applies." )
461        protected UriType jurisdiction;
462
463        /**
464         * Indicates where and when the device is available on the market.
465         */
466        @Child(name = "marketDistribution", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
467        @Description(shortDefinition="Indicates whether and when the device is available on the market", formalDefinition="Indicates where and when the device is available on the market." )
468        protected List<UdiDeviceIdentifierMarketDistributionComponent> marketDistribution;
469
470        private static final long serialVersionUID = -1819796108L;
471
472    /**
473     * Constructor
474     */
475      public DeviceDefinitionUdiDeviceIdentifierComponent() {
476        super();
477      }
478
479    /**
480     * Constructor
481     */
482      public DeviceDefinitionUdiDeviceIdentifierComponent(String deviceIdentifier, String issuer, String jurisdiction) {
483        super();
484        this.setDeviceIdentifier(deviceIdentifier);
485        this.setIssuer(issuer);
486        this.setJurisdiction(jurisdiction);
487      }
488
489        /**
490         * @return {@link #deviceIdentifier} (The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
491         */
492        public StringType getDeviceIdentifierElement() { 
493          if (this.deviceIdentifier == null)
494            if (Configuration.errorOnAutoCreate())
495              throw new Error("Attempt to auto-create DeviceDefinitionUdiDeviceIdentifierComponent.deviceIdentifier");
496            else if (Configuration.doAutoCreate())
497              this.deviceIdentifier = new StringType(); // bb
498          return this.deviceIdentifier;
499        }
500
501        public boolean hasDeviceIdentifierElement() { 
502          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
503        }
504
505        public boolean hasDeviceIdentifier() { 
506          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
507        }
508
509        /**
510         * @param value {@link #deviceIdentifier} (The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
511         */
512        public DeviceDefinitionUdiDeviceIdentifierComponent setDeviceIdentifierElement(StringType value) { 
513          this.deviceIdentifier = value;
514          return this;
515        }
516
517        /**
518         * @return The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.
519         */
520        public String getDeviceIdentifier() { 
521          return this.deviceIdentifier == null ? null : this.deviceIdentifier.getValue();
522        }
523
524        /**
525         * @param value The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.
526         */
527        public DeviceDefinitionUdiDeviceIdentifierComponent setDeviceIdentifier(String value) { 
528            if (this.deviceIdentifier == null)
529              this.deviceIdentifier = new StringType();
530            this.deviceIdentifier.setValue(value);
531          return this;
532        }
533
534        /**
535         * @return {@link #issuer} (The organization that assigns the identifier algorithm.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
536         */
537        public UriType getIssuerElement() { 
538          if (this.issuer == null)
539            if (Configuration.errorOnAutoCreate())
540              throw new Error("Attempt to auto-create DeviceDefinitionUdiDeviceIdentifierComponent.issuer");
541            else if (Configuration.doAutoCreate())
542              this.issuer = new UriType(); // bb
543          return this.issuer;
544        }
545
546        public boolean hasIssuerElement() { 
547          return this.issuer != null && !this.issuer.isEmpty();
548        }
549
550        public boolean hasIssuer() { 
551          return this.issuer != null && !this.issuer.isEmpty();
552        }
553
554        /**
555         * @param value {@link #issuer} (The organization that assigns the identifier algorithm.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
556         */
557        public DeviceDefinitionUdiDeviceIdentifierComponent setIssuerElement(UriType value) { 
558          this.issuer = value;
559          return this;
560        }
561
562        /**
563         * @return The organization that assigns the identifier algorithm.
564         */
565        public String getIssuer() { 
566          return this.issuer == null ? null : this.issuer.getValue();
567        }
568
569        /**
570         * @param value The organization that assigns the identifier algorithm.
571         */
572        public DeviceDefinitionUdiDeviceIdentifierComponent setIssuer(String value) { 
573            if (this.issuer == null)
574              this.issuer = new UriType();
575            this.issuer.setValue(value);
576          return this;
577        }
578
579        /**
580         * @return {@link #jurisdiction} (The jurisdiction to which the deviceIdentifier applies.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
581         */
582        public UriType getJurisdictionElement() { 
583          if (this.jurisdiction == null)
584            if (Configuration.errorOnAutoCreate())
585              throw new Error("Attempt to auto-create DeviceDefinitionUdiDeviceIdentifierComponent.jurisdiction");
586            else if (Configuration.doAutoCreate())
587              this.jurisdiction = new UriType(); // bb
588          return this.jurisdiction;
589        }
590
591        public boolean hasJurisdictionElement() { 
592          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
593        }
594
595        public boolean hasJurisdiction() { 
596          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
597        }
598
599        /**
600         * @param value {@link #jurisdiction} (The jurisdiction to which the deviceIdentifier applies.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
601         */
602        public DeviceDefinitionUdiDeviceIdentifierComponent setJurisdictionElement(UriType value) { 
603          this.jurisdiction = value;
604          return this;
605        }
606
607        /**
608         * @return The jurisdiction to which the deviceIdentifier applies.
609         */
610        public String getJurisdiction() { 
611          return this.jurisdiction == null ? null : this.jurisdiction.getValue();
612        }
613
614        /**
615         * @param value The jurisdiction to which the deviceIdentifier applies.
616         */
617        public DeviceDefinitionUdiDeviceIdentifierComponent setJurisdiction(String value) { 
618            if (this.jurisdiction == null)
619              this.jurisdiction = new UriType();
620            this.jurisdiction.setValue(value);
621          return this;
622        }
623
624        /**
625         * @return {@link #marketDistribution} (Indicates where and when the device is available on the market.)
626         */
627        public List<UdiDeviceIdentifierMarketDistributionComponent> getMarketDistribution() { 
628          if (this.marketDistribution == null)
629            this.marketDistribution = new ArrayList<UdiDeviceIdentifierMarketDistributionComponent>();
630          return this.marketDistribution;
631        }
632
633        /**
634         * @return Returns a reference to <code>this</code> for easy method chaining
635         */
636        public DeviceDefinitionUdiDeviceIdentifierComponent setMarketDistribution(List<UdiDeviceIdentifierMarketDistributionComponent> theMarketDistribution) { 
637          this.marketDistribution = theMarketDistribution;
638          return this;
639        }
640
641        public boolean hasMarketDistribution() { 
642          if (this.marketDistribution == null)
643            return false;
644          for (UdiDeviceIdentifierMarketDistributionComponent item : this.marketDistribution)
645            if (!item.isEmpty())
646              return true;
647          return false;
648        }
649
650        public UdiDeviceIdentifierMarketDistributionComponent addMarketDistribution() { //3
651          UdiDeviceIdentifierMarketDistributionComponent t = new UdiDeviceIdentifierMarketDistributionComponent();
652          if (this.marketDistribution == null)
653            this.marketDistribution = new ArrayList<UdiDeviceIdentifierMarketDistributionComponent>();
654          this.marketDistribution.add(t);
655          return t;
656        }
657
658        public DeviceDefinitionUdiDeviceIdentifierComponent addMarketDistribution(UdiDeviceIdentifierMarketDistributionComponent t) { //3
659          if (t == null)
660            return this;
661          if (this.marketDistribution == null)
662            this.marketDistribution = new ArrayList<UdiDeviceIdentifierMarketDistributionComponent>();
663          this.marketDistribution.add(t);
664          return this;
665        }
666
667        /**
668         * @return The first repetition of repeating field {@link #marketDistribution}, creating it if it does not already exist {3}
669         */
670        public UdiDeviceIdentifierMarketDistributionComponent getMarketDistributionFirstRep() { 
671          if (getMarketDistribution().isEmpty()) {
672            addMarketDistribution();
673          }
674          return getMarketDistribution().get(0);
675        }
676
677        protected void listChildren(List<Property> children) {
678          super.listChildren(children);
679          children.add(new Property("deviceIdentifier", "string", "The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.", 0, 1, deviceIdentifier));
680          children.add(new Property("issuer", "uri", "The organization that assigns the identifier algorithm.", 0, 1, issuer));
681          children.add(new Property("jurisdiction", "uri", "The jurisdiction to which the deviceIdentifier applies.", 0, 1, jurisdiction));
682          children.add(new Property("marketDistribution", "", "Indicates where and when the device is available on the market.", 0, java.lang.Integer.MAX_VALUE, marketDistribution));
683        }
684
685        @Override
686        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
687          switch (_hash) {
688          case 1322005407: /*deviceIdentifier*/  return new Property("deviceIdentifier", "string", "The identifier that is to be associated with every Device that references this DeviceDefintiion for the issuer and jurisdiction provided in the DeviceDefinition.udiDeviceIdentifier.", 0, 1, deviceIdentifier);
689          case -1179159879: /*issuer*/  return new Property("issuer", "uri", "The organization that assigns the identifier algorithm.", 0, 1, issuer);
690          case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "uri", "The jurisdiction to which the deviceIdentifier applies.", 0, 1, jurisdiction);
691          case 530037984: /*marketDistribution*/  return new Property("marketDistribution", "", "Indicates where and when the device is available on the market.", 0, java.lang.Integer.MAX_VALUE, marketDistribution);
692          default: return super.getNamedProperty(_hash, _name, _checkValid);
693          }
694
695        }
696
697      @Override
698      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
699        switch (hash) {
700        case 1322005407: /*deviceIdentifier*/ return this.deviceIdentifier == null ? new Base[0] : new Base[] {this.deviceIdentifier}; // StringType
701        case -1179159879: /*issuer*/ return this.issuer == null ? new Base[0] : new Base[] {this.issuer}; // UriType
702        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : new Base[] {this.jurisdiction}; // UriType
703        case 530037984: /*marketDistribution*/ return this.marketDistribution == null ? new Base[0] : this.marketDistribution.toArray(new Base[this.marketDistribution.size()]); // UdiDeviceIdentifierMarketDistributionComponent
704        default: return super.getProperty(hash, name, checkValid);
705        }
706
707      }
708
709      @Override
710      public Base setProperty(int hash, String name, Base value) throws FHIRException {
711        switch (hash) {
712        case 1322005407: // deviceIdentifier
713          this.deviceIdentifier = TypeConvertor.castToString(value); // StringType
714          return value;
715        case -1179159879: // issuer
716          this.issuer = TypeConvertor.castToUri(value); // UriType
717          return value;
718        case -507075711: // jurisdiction
719          this.jurisdiction = TypeConvertor.castToUri(value); // UriType
720          return value;
721        case 530037984: // marketDistribution
722          this.getMarketDistribution().add((UdiDeviceIdentifierMarketDistributionComponent) value); // UdiDeviceIdentifierMarketDistributionComponent
723          return value;
724        default: return super.setProperty(hash, name, value);
725        }
726
727      }
728
729      @Override
730      public Base setProperty(String name, Base value) throws FHIRException {
731        if (name.equals("deviceIdentifier")) {
732          this.deviceIdentifier = TypeConvertor.castToString(value); // StringType
733        } else if (name.equals("issuer")) {
734          this.issuer = TypeConvertor.castToUri(value); // UriType
735        } else if (name.equals("jurisdiction")) {
736          this.jurisdiction = TypeConvertor.castToUri(value); // UriType
737        } else if (name.equals("marketDistribution")) {
738          this.getMarketDistribution().add((UdiDeviceIdentifierMarketDistributionComponent) value);
739        } else
740          return super.setProperty(name, value);
741        return value;
742      }
743
744  @Override
745  public void removeChild(String name, Base value) throws FHIRException {
746        if (name.equals("deviceIdentifier")) {
747          this.deviceIdentifier = null;
748        } else if (name.equals("issuer")) {
749          this.issuer = null;
750        } else if (name.equals("jurisdiction")) {
751          this.jurisdiction = null;
752        } else if (name.equals("marketDistribution")) {
753          this.getMarketDistribution().remove((UdiDeviceIdentifierMarketDistributionComponent) value);
754        } else
755          super.removeChild(name, value);
756        
757      }
758
759      @Override
760      public Base makeProperty(int hash, String name) throws FHIRException {
761        switch (hash) {
762        case 1322005407:  return getDeviceIdentifierElement();
763        case -1179159879:  return getIssuerElement();
764        case -507075711:  return getJurisdictionElement();
765        case 530037984:  return addMarketDistribution(); 
766        default: return super.makeProperty(hash, name);
767        }
768
769      }
770
771      @Override
772      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
773        switch (hash) {
774        case 1322005407: /*deviceIdentifier*/ return new String[] {"string"};
775        case -1179159879: /*issuer*/ return new String[] {"uri"};
776        case -507075711: /*jurisdiction*/ return new String[] {"uri"};
777        case 530037984: /*marketDistribution*/ return new String[] {};
778        default: return super.getTypesForProperty(hash, name);
779        }
780
781      }
782
783      @Override
784      public Base addChild(String name) throws FHIRException {
785        if (name.equals("deviceIdentifier")) {
786          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.udiDeviceIdentifier.deviceIdentifier");
787        }
788        else if (name.equals("issuer")) {
789          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.udiDeviceIdentifier.issuer");
790        }
791        else if (name.equals("jurisdiction")) {
792          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.udiDeviceIdentifier.jurisdiction");
793        }
794        else if (name.equals("marketDistribution")) {
795          return addMarketDistribution();
796        }
797        else
798          return super.addChild(name);
799      }
800
801      public DeviceDefinitionUdiDeviceIdentifierComponent copy() {
802        DeviceDefinitionUdiDeviceIdentifierComponent dst = new DeviceDefinitionUdiDeviceIdentifierComponent();
803        copyValues(dst);
804        return dst;
805      }
806
807      public void copyValues(DeviceDefinitionUdiDeviceIdentifierComponent dst) {
808        super.copyValues(dst);
809        dst.deviceIdentifier = deviceIdentifier == null ? null : deviceIdentifier.copy();
810        dst.issuer = issuer == null ? null : issuer.copy();
811        dst.jurisdiction = jurisdiction == null ? null : jurisdiction.copy();
812        if (marketDistribution != null) {
813          dst.marketDistribution = new ArrayList<UdiDeviceIdentifierMarketDistributionComponent>();
814          for (UdiDeviceIdentifierMarketDistributionComponent i : marketDistribution)
815            dst.marketDistribution.add(i.copy());
816        };
817      }
818
819      @Override
820      public boolean equalsDeep(Base other_) {
821        if (!super.equalsDeep(other_))
822          return false;
823        if (!(other_ instanceof DeviceDefinitionUdiDeviceIdentifierComponent))
824          return false;
825        DeviceDefinitionUdiDeviceIdentifierComponent o = (DeviceDefinitionUdiDeviceIdentifierComponent) other_;
826        return compareDeep(deviceIdentifier, o.deviceIdentifier, true) && compareDeep(issuer, o.issuer, true)
827           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(marketDistribution, o.marketDistribution, true)
828          ;
829      }
830
831      @Override
832      public boolean equalsShallow(Base other_) {
833        if (!super.equalsShallow(other_))
834          return false;
835        if (!(other_ instanceof DeviceDefinitionUdiDeviceIdentifierComponent))
836          return false;
837        DeviceDefinitionUdiDeviceIdentifierComponent o = (DeviceDefinitionUdiDeviceIdentifierComponent) other_;
838        return compareValues(deviceIdentifier, o.deviceIdentifier, true) && compareValues(issuer, o.issuer, true)
839           && compareValues(jurisdiction, o.jurisdiction, true);
840      }
841
842      public boolean isEmpty() {
843        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(deviceIdentifier, issuer, jurisdiction
844          , marketDistribution);
845      }
846
847  public String fhirType() {
848    return "DeviceDefinition.udiDeviceIdentifier";
849
850  }
851
852  }
853
854    @Block()
855    public static class UdiDeviceIdentifierMarketDistributionComponent extends BackboneElement implements IBaseBackboneElement {
856        /**
857         * Begin and end dates for the commercial distribution of the device.
858         */
859        @Child(name = "marketPeriod", type = {Period.class}, order=1, min=1, max=1, modifier=false, summary=false)
860        @Description(shortDefinition="Begin and end dates for the commercial distribution of the device", formalDefinition="Begin and end dates for the commercial distribution of the device." )
861        protected Period marketPeriod;
862
863        /**
864         * National state or territory to which the marketDistribution recers, typically where the device is commercialized.
865         */
866        @Child(name = "subJurisdiction", type = {UriType.class}, order=2, min=1, max=1, modifier=false, summary=false)
867        @Description(shortDefinition="National state or territory where the device is commercialized", formalDefinition="National state or territory to which the marketDistribution recers, typically where the device is commercialized." )
868        protected UriType subJurisdiction;
869
870        private static final long serialVersionUID = -1459036847L;
871
872    /**
873     * Constructor
874     */
875      public UdiDeviceIdentifierMarketDistributionComponent() {
876        super();
877      }
878
879    /**
880     * Constructor
881     */
882      public UdiDeviceIdentifierMarketDistributionComponent(Period marketPeriod, String subJurisdiction) {
883        super();
884        this.setMarketPeriod(marketPeriod);
885        this.setSubJurisdiction(subJurisdiction);
886      }
887
888        /**
889         * @return {@link #marketPeriod} (Begin and end dates for the commercial distribution of the device.)
890         */
891        public Period getMarketPeriod() { 
892          if (this.marketPeriod == null)
893            if (Configuration.errorOnAutoCreate())
894              throw new Error("Attempt to auto-create UdiDeviceIdentifierMarketDistributionComponent.marketPeriod");
895            else if (Configuration.doAutoCreate())
896              this.marketPeriod = new Period(); // cc
897          return this.marketPeriod;
898        }
899
900        public boolean hasMarketPeriod() { 
901          return this.marketPeriod != null && !this.marketPeriod.isEmpty();
902        }
903
904        /**
905         * @param value {@link #marketPeriod} (Begin and end dates for the commercial distribution of the device.)
906         */
907        public UdiDeviceIdentifierMarketDistributionComponent setMarketPeriod(Period value) { 
908          this.marketPeriod = value;
909          return this;
910        }
911
912        /**
913         * @return {@link #subJurisdiction} (National state or territory to which the marketDistribution recers, typically where the device is commercialized.). This is the underlying object with id, value and extensions. The accessor "getSubJurisdiction" gives direct access to the value
914         */
915        public UriType getSubJurisdictionElement() { 
916          if (this.subJurisdiction == null)
917            if (Configuration.errorOnAutoCreate())
918              throw new Error("Attempt to auto-create UdiDeviceIdentifierMarketDistributionComponent.subJurisdiction");
919            else if (Configuration.doAutoCreate())
920              this.subJurisdiction = new UriType(); // bb
921          return this.subJurisdiction;
922        }
923
924        public boolean hasSubJurisdictionElement() { 
925          return this.subJurisdiction != null && !this.subJurisdiction.isEmpty();
926        }
927
928        public boolean hasSubJurisdiction() { 
929          return this.subJurisdiction != null && !this.subJurisdiction.isEmpty();
930        }
931
932        /**
933         * @param value {@link #subJurisdiction} (National state or territory to which the marketDistribution recers, typically where the device is commercialized.). This is the underlying object with id, value and extensions. The accessor "getSubJurisdiction" gives direct access to the value
934         */
935        public UdiDeviceIdentifierMarketDistributionComponent setSubJurisdictionElement(UriType value) { 
936          this.subJurisdiction = value;
937          return this;
938        }
939
940        /**
941         * @return National state or territory to which the marketDistribution recers, typically where the device is commercialized.
942         */
943        public String getSubJurisdiction() { 
944          return this.subJurisdiction == null ? null : this.subJurisdiction.getValue();
945        }
946
947        /**
948         * @param value National state or territory to which the marketDistribution recers, typically where the device is commercialized.
949         */
950        public UdiDeviceIdentifierMarketDistributionComponent setSubJurisdiction(String value) { 
951            if (this.subJurisdiction == null)
952              this.subJurisdiction = new UriType();
953            this.subJurisdiction.setValue(value);
954          return this;
955        }
956
957        protected void listChildren(List<Property> children) {
958          super.listChildren(children);
959          children.add(new Property("marketPeriod", "Period", "Begin and end dates for the commercial distribution of the device.", 0, 1, marketPeriod));
960          children.add(new Property("subJurisdiction", "uri", "National state or territory to which the marketDistribution recers, typically where the device is commercialized.", 0, 1, subJurisdiction));
961        }
962
963        @Override
964        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
965          switch (_hash) {
966          case -183772899: /*marketPeriod*/  return new Property("marketPeriod", "Period", "Begin and end dates for the commercial distribution of the device.", 0, 1, marketPeriod);
967          case -777497119: /*subJurisdiction*/  return new Property("subJurisdiction", "uri", "National state or territory to which the marketDistribution recers, typically where the device is commercialized.", 0, 1, subJurisdiction);
968          default: return super.getNamedProperty(_hash, _name, _checkValid);
969          }
970
971        }
972
973      @Override
974      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
975        switch (hash) {
976        case -183772899: /*marketPeriod*/ return this.marketPeriod == null ? new Base[0] : new Base[] {this.marketPeriod}; // Period
977        case -777497119: /*subJurisdiction*/ return this.subJurisdiction == null ? new Base[0] : new Base[] {this.subJurisdiction}; // UriType
978        default: return super.getProperty(hash, name, checkValid);
979        }
980
981      }
982
983      @Override
984      public Base setProperty(int hash, String name, Base value) throws FHIRException {
985        switch (hash) {
986        case -183772899: // marketPeriod
987          this.marketPeriod = TypeConvertor.castToPeriod(value); // Period
988          return value;
989        case -777497119: // subJurisdiction
990          this.subJurisdiction = TypeConvertor.castToUri(value); // UriType
991          return value;
992        default: return super.setProperty(hash, name, value);
993        }
994
995      }
996
997      @Override
998      public Base setProperty(String name, Base value) throws FHIRException {
999        if (name.equals("marketPeriod")) {
1000          this.marketPeriod = TypeConvertor.castToPeriod(value); // Period
1001        } else if (name.equals("subJurisdiction")) {
1002          this.subJurisdiction = TypeConvertor.castToUri(value); // UriType
1003        } else
1004          return super.setProperty(name, value);
1005        return value;
1006      }
1007
1008  @Override
1009  public void removeChild(String name, Base value) throws FHIRException {
1010        if (name.equals("marketPeriod")) {
1011          this.marketPeriod = null;
1012        } else if (name.equals("subJurisdiction")) {
1013          this.subJurisdiction = null;
1014        } else
1015          super.removeChild(name, value);
1016        
1017      }
1018
1019      @Override
1020      public Base makeProperty(int hash, String name) throws FHIRException {
1021        switch (hash) {
1022        case -183772899:  return getMarketPeriod();
1023        case -777497119:  return getSubJurisdictionElement();
1024        default: return super.makeProperty(hash, name);
1025        }
1026
1027      }
1028
1029      @Override
1030      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1031        switch (hash) {
1032        case -183772899: /*marketPeriod*/ return new String[] {"Period"};
1033        case -777497119: /*subJurisdiction*/ return new String[] {"uri"};
1034        default: return super.getTypesForProperty(hash, name);
1035        }
1036
1037      }
1038
1039      @Override
1040      public Base addChild(String name) throws FHIRException {
1041        if (name.equals("marketPeriod")) {
1042          this.marketPeriod = new Period();
1043          return this.marketPeriod;
1044        }
1045        else if (name.equals("subJurisdiction")) {
1046          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.udiDeviceIdentifier.marketDistribution.subJurisdiction");
1047        }
1048        else
1049          return super.addChild(name);
1050      }
1051
1052      public UdiDeviceIdentifierMarketDistributionComponent copy() {
1053        UdiDeviceIdentifierMarketDistributionComponent dst = new UdiDeviceIdentifierMarketDistributionComponent();
1054        copyValues(dst);
1055        return dst;
1056      }
1057
1058      public void copyValues(UdiDeviceIdentifierMarketDistributionComponent dst) {
1059        super.copyValues(dst);
1060        dst.marketPeriod = marketPeriod == null ? null : marketPeriod.copy();
1061        dst.subJurisdiction = subJurisdiction == null ? null : subJurisdiction.copy();
1062      }
1063
1064      @Override
1065      public boolean equalsDeep(Base other_) {
1066        if (!super.equalsDeep(other_))
1067          return false;
1068        if (!(other_ instanceof UdiDeviceIdentifierMarketDistributionComponent))
1069          return false;
1070        UdiDeviceIdentifierMarketDistributionComponent o = (UdiDeviceIdentifierMarketDistributionComponent) other_;
1071        return compareDeep(marketPeriod, o.marketPeriod, true) && compareDeep(subJurisdiction, o.subJurisdiction, true)
1072          ;
1073      }
1074
1075      @Override
1076      public boolean equalsShallow(Base other_) {
1077        if (!super.equalsShallow(other_))
1078          return false;
1079        if (!(other_ instanceof UdiDeviceIdentifierMarketDistributionComponent))
1080          return false;
1081        UdiDeviceIdentifierMarketDistributionComponent o = (UdiDeviceIdentifierMarketDistributionComponent) other_;
1082        return compareValues(subJurisdiction, o.subJurisdiction, true);
1083      }
1084
1085      public boolean isEmpty() {
1086        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(marketPeriod, subJurisdiction
1087          );
1088      }
1089
1090  public String fhirType() {
1091    return "DeviceDefinition.udiDeviceIdentifier.marketDistribution";
1092
1093  }
1094
1095  }
1096
1097    @Block()
1098    public static class DeviceDefinitionRegulatoryIdentifierComponent extends BackboneElement implements IBaseBackboneElement {
1099        /**
1100         * The type of identifier itself.
1101         */
1102        @Child(name = "type", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1103        @Description(shortDefinition="basic | master | license", formalDefinition="The type of identifier itself." )
1104        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/devicedefinition-regulatory-identifier-type")
1105        protected Enumeration<DeviceDefinitionRegulatoryIdentifierType> type;
1106
1107        /**
1108         * The identifier itself.
1109         */
1110        @Child(name = "deviceIdentifier", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=false)
1111        @Description(shortDefinition="The identifier itself", formalDefinition="The identifier itself." )
1112        protected StringType deviceIdentifier;
1113
1114        /**
1115         * The organization that issued this identifier.
1116         */
1117        @Child(name = "issuer", type = {UriType.class}, order=3, min=1, max=1, modifier=false, summary=false)
1118        @Description(shortDefinition="The organization that issued this identifier", formalDefinition="The organization that issued this identifier." )
1119        protected UriType issuer;
1120
1121        /**
1122         * The jurisdiction to which the deviceIdentifier applies.
1123         */
1124        @Child(name = "jurisdiction", type = {UriType.class}, order=4, min=1, max=1, modifier=false, summary=false)
1125        @Description(shortDefinition="The jurisdiction to which the deviceIdentifier applies", formalDefinition="The jurisdiction to which the deviceIdentifier applies." )
1126        protected UriType jurisdiction;
1127
1128        private static final long serialVersionUID = 1438058623L;
1129
1130    /**
1131     * Constructor
1132     */
1133      public DeviceDefinitionRegulatoryIdentifierComponent() {
1134        super();
1135      }
1136
1137    /**
1138     * Constructor
1139     */
1140      public DeviceDefinitionRegulatoryIdentifierComponent(DeviceDefinitionRegulatoryIdentifierType type, String deviceIdentifier, String issuer, String jurisdiction) {
1141        super();
1142        this.setType(type);
1143        this.setDeviceIdentifier(deviceIdentifier);
1144        this.setIssuer(issuer);
1145        this.setJurisdiction(jurisdiction);
1146      }
1147
1148        /**
1149         * @return {@link #type} (The type of identifier itself.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1150         */
1151        public Enumeration<DeviceDefinitionRegulatoryIdentifierType> getTypeElement() { 
1152          if (this.type == null)
1153            if (Configuration.errorOnAutoCreate())
1154              throw new Error("Attempt to auto-create DeviceDefinitionRegulatoryIdentifierComponent.type");
1155            else if (Configuration.doAutoCreate())
1156              this.type = new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(new DeviceDefinitionRegulatoryIdentifierTypeEnumFactory()); // bb
1157          return this.type;
1158        }
1159
1160        public boolean hasTypeElement() { 
1161          return this.type != null && !this.type.isEmpty();
1162        }
1163
1164        public boolean hasType() { 
1165          return this.type != null && !this.type.isEmpty();
1166        }
1167
1168        /**
1169         * @param value {@link #type} (The type of identifier itself.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1170         */
1171        public DeviceDefinitionRegulatoryIdentifierComponent setTypeElement(Enumeration<DeviceDefinitionRegulatoryIdentifierType> value) { 
1172          this.type = value;
1173          return this;
1174        }
1175
1176        /**
1177         * @return The type of identifier itself.
1178         */
1179        public DeviceDefinitionRegulatoryIdentifierType getType() { 
1180          return this.type == null ? null : this.type.getValue();
1181        }
1182
1183        /**
1184         * @param value The type of identifier itself.
1185         */
1186        public DeviceDefinitionRegulatoryIdentifierComponent setType(DeviceDefinitionRegulatoryIdentifierType value) { 
1187            if (this.type == null)
1188              this.type = new Enumeration<DeviceDefinitionRegulatoryIdentifierType>(new DeviceDefinitionRegulatoryIdentifierTypeEnumFactory());
1189            this.type.setValue(value);
1190          return this;
1191        }
1192
1193        /**
1194         * @return {@link #deviceIdentifier} (The identifier itself.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
1195         */
1196        public StringType getDeviceIdentifierElement() { 
1197          if (this.deviceIdentifier == null)
1198            if (Configuration.errorOnAutoCreate())
1199              throw new Error("Attempt to auto-create DeviceDefinitionRegulatoryIdentifierComponent.deviceIdentifier");
1200            else if (Configuration.doAutoCreate())
1201              this.deviceIdentifier = new StringType(); // bb
1202          return this.deviceIdentifier;
1203        }
1204
1205        public boolean hasDeviceIdentifierElement() { 
1206          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
1207        }
1208
1209        public boolean hasDeviceIdentifier() { 
1210          return this.deviceIdentifier != null && !this.deviceIdentifier.isEmpty();
1211        }
1212
1213        /**
1214         * @param value {@link #deviceIdentifier} (The identifier itself.). This is the underlying object with id, value and extensions. The accessor "getDeviceIdentifier" gives direct access to the value
1215         */
1216        public DeviceDefinitionRegulatoryIdentifierComponent setDeviceIdentifierElement(StringType value) { 
1217          this.deviceIdentifier = value;
1218          return this;
1219        }
1220
1221        /**
1222         * @return The identifier itself.
1223         */
1224        public String getDeviceIdentifier() { 
1225          return this.deviceIdentifier == null ? null : this.deviceIdentifier.getValue();
1226        }
1227
1228        /**
1229         * @param value The identifier itself.
1230         */
1231        public DeviceDefinitionRegulatoryIdentifierComponent setDeviceIdentifier(String value) { 
1232            if (this.deviceIdentifier == null)
1233              this.deviceIdentifier = new StringType();
1234            this.deviceIdentifier.setValue(value);
1235          return this;
1236        }
1237
1238        /**
1239         * @return {@link #issuer} (The organization that issued this identifier.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
1240         */
1241        public UriType getIssuerElement() { 
1242          if (this.issuer == null)
1243            if (Configuration.errorOnAutoCreate())
1244              throw new Error("Attempt to auto-create DeviceDefinitionRegulatoryIdentifierComponent.issuer");
1245            else if (Configuration.doAutoCreate())
1246              this.issuer = new UriType(); // bb
1247          return this.issuer;
1248        }
1249
1250        public boolean hasIssuerElement() { 
1251          return this.issuer != null && !this.issuer.isEmpty();
1252        }
1253
1254        public boolean hasIssuer() { 
1255          return this.issuer != null && !this.issuer.isEmpty();
1256        }
1257
1258        /**
1259         * @param value {@link #issuer} (The organization that issued this identifier.). This is the underlying object with id, value and extensions. The accessor "getIssuer" gives direct access to the value
1260         */
1261        public DeviceDefinitionRegulatoryIdentifierComponent setIssuerElement(UriType value) { 
1262          this.issuer = value;
1263          return this;
1264        }
1265
1266        /**
1267         * @return The organization that issued this identifier.
1268         */
1269        public String getIssuer() { 
1270          return this.issuer == null ? null : this.issuer.getValue();
1271        }
1272
1273        /**
1274         * @param value The organization that issued this identifier.
1275         */
1276        public DeviceDefinitionRegulatoryIdentifierComponent setIssuer(String value) { 
1277            if (this.issuer == null)
1278              this.issuer = new UriType();
1279            this.issuer.setValue(value);
1280          return this;
1281        }
1282
1283        /**
1284         * @return {@link #jurisdiction} (The jurisdiction to which the deviceIdentifier applies.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
1285         */
1286        public UriType getJurisdictionElement() { 
1287          if (this.jurisdiction == null)
1288            if (Configuration.errorOnAutoCreate())
1289              throw new Error("Attempt to auto-create DeviceDefinitionRegulatoryIdentifierComponent.jurisdiction");
1290            else if (Configuration.doAutoCreate())
1291              this.jurisdiction = new UriType(); // bb
1292          return this.jurisdiction;
1293        }
1294
1295        public boolean hasJurisdictionElement() { 
1296          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
1297        }
1298
1299        public boolean hasJurisdiction() { 
1300          return this.jurisdiction != null && !this.jurisdiction.isEmpty();
1301        }
1302
1303        /**
1304         * @param value {@link #jurisdiction} (The jurisdiction to which the deviceIdentifier applies.). This is the underlying object with id, value and extensions. The accessor "getJurisdiction" gives direct access to the value
1305         */
1306        public DeviceDefinitionRegulatoryIdentifierComponent setJurisdictionElement(UriType value) { 
1307          this.jurisdiction = value;
1308          return this;
1309        }
1310
1311        /**
1312         * @return The jurisdiction to which the deviceIdentifier applies.
1313         */
1314        public String getJurisdiction() { 
1315          return this.jurisdiction == null ? null : this.jurisdiction.getValue();
1316        }
1317
1318        /**
1319         * @param value The jurisdiction to which the deviceIdentifier applies.
1320         */
1321        public DeviceDefinitionRegulatoryIdentifierComponent setJurisdiction(String value) { 
1322            if (this.jurisdiction == null)
1323              this.jurisdiction = new UriType();
1324            this.jurisdiction.setValue(value);
1325          return this;
1326        }
1327
1328        protected void listChildren(List<Property> children) {
1329          super.listChildren(children);
1330          children.add(new Property("type", "code", "The type of identifier itself.", 0, 1, type));
1331          children.add(new Property("deviceIdentifier", "string", "The identifier itself.", 0, 1, deviceIdentifier));
1332          children.add(new Property("issuer", "uri", "The organization that issued this identifier.", 0, 1, issuer));
1333          children.add(new Property("jurisdiction", "uri", "The jurisdiction to which the deviceIdentifier applies.", 0, 1, jurisdiction));
1334        }
1335
1336        @Override
1337        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1338          switch (_hash) {
1339          case 3575610: /*type*/  return new Property("type", "code", "The type of identifier itself.", 0, 1, type);
1340          case 1322005407: /*deviceIdentifier*/  return new Property("deviceIdentifier", "string", "The identifier itself.", 0, 1, deviceIdentifier);
1341          case -1179159879: /*issuer*/  return new Property("issuer", "uri", "The organization that issued this identifier.", 0, 1, issuer);
1342          case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "uri", "The jurisdiction to which the deviceIdentifier applies.", 0, 1, jurisdiction);
1343          default: return super.getNamedProperty(_hash, _name, _checkValid);
1344          }
1345
1346        }
1347
1348      @Override
1349      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1350        switch (hash) {
1351        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DeviceDefinitionRegulatoryIdentifierType>
1352        case 1322005407: /*deviceIdentifier*/ return this.deviceIdentifier == null ? new Base[0] : new Base[] {this.deviceIdentifier}; // StringType
1353        case -1179159879: /*issuer*/ return this.issuer == null ? new Base[0] : new Base[] {this.issuer}; // UriType
1354        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : new Base[] {this.jurisdiction}; // UriType
1355        default: return super.getProperty(hash, name, checkValid);
1356        }
1357
1358      }
1359
1360      @Override
1361      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1362        switch (hash) {
1363        case 3575610: // type
1364          value = new DeviceDefinitionRegulatoryIdentifierTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1365          this.type = (Enumeration) value; // Enumeration<DeviceDefinitionRegulatoryIdentifierType>
1366          return value;
1367        case 1322005407: // deviceIdentifier
1368          this.deviceIdentifier = TypeConvertor.castToString(value); // StringType
1369          return value;
1370        case -1179159879: // issuer
1371          this.issuer = TypeConvertor.castToUri(value); // UriType
1372          return value;
1373        case -507075711: // jurisdiction
1374          this.jurisdiction = TypeConvertor.castToUri(value); // UriType
1375          return value;
1376        default: return super.setProperty(hash, name, value);
1377        }
1378
1379      }
1380
1381      @Override
1382      public Base setProperty(String name, Base value) throws FHIRException {
1383        if (name.equals("type")) {
1384          value = new DeviceDefinitionRegulatoryIdentifierTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1385          this.type = (Enumeration) value; // Enumeration<DeviceDefinitionRegulatoryIdentifierType>
1386        } else if (name.equals("deviceIdentifier")) {
1387          this.deviceIdentifier = TypeConvertor.castToString(value); // StringType
1388        } else if (name.equals("issuer")) {
1389          this.issuer = TypeConvertor.castToUri(value); // UriType
1390        } else if (name.equals("jurisdiction")) {
1391          this.jurisdiction = TypeConvertor.castToUri(value); // UriType
1392        } else
1393          return super.setProperty(name, value);
1394        return value;
1395      }
1396
1397  @Override
1398  public void removeChild(String name, Base value) throws FHIRException {
1399        if (name.equals("type")) {
1400          value = new DeviceDefinitionRegulatoryIdentifierTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1401          this.type = (Enumeration) value; // Enumeration<DeviceDefinitionRegulatoryIdentifierType>
1402        } else if (name.equals("deviceIdentifier")) {
1403          this.deviceIdentifier = null;
1404        } else if (name.equals("issuer")) {
1405          this.issuer = null;
1406        } else if (name.equals("jurisdiction")) {
1407          this.jurisdiction = null;
1408        } else
1409          super.removeChild(name, value);
1410        
1411      }
1412
1413      @Override
1414      public Base makeProperty(int hash, String name) throws FHIRException {
1415        switch (hash) {
1416        case 3575610:  return getTypeElement();
1417        case 1322005407:  return getDeviceIdentifierElement();
1418        case -1179159879:  return getIssuerElement();
1419        case -507075711:  return getJurisdictionElement();
1420        default: return super.makeProperty(hash, name);
1421        }
1422
1423      }
1424
1425      @Override
1426      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1427        switch (hash) {
1428        case 3575610: /*type*/ return new String[] {"code"};
1429        case 1322005407: /*deviceIdentifier*/ return new String[] {"string"};
1430        case -1179159879: /*issuer*/ return new String[] {"uri"};
1431        case -507075711: /*jurisdiction*/ return new String[] {"uri"};
1432        default: return super.getTypesForProperty(hash, name);
1433        }
1434
1435      }
1436
1437      @Override
1438      public Base addChild(String name) throws FHIRException {
1439        if (name.equals("type")) {
1440          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.regulatoryIdentifier.type");
1441        }
1442        else if (name.equals("deviceIdentifier")) {
1443          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.regulatoryIdentifier.deviceIdentifier");
1444        }
1445        else if (name.equals("issuer")) {
1446          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.regulatoryIdentifier.issuer");
1447        }
1448        else if (name.equals("jurisdiction")) {
1449          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.regulatoryIdentifier.jurisdiction");
1450        }
1451        else
1452          return super.addChild(name);
1453      }
1454
1455      public DeviceDefinitionRegulatoryIdentifierComponent copy() {
1456        DeviceDefinitionRegulatoryIdentifierComponent dst = new DeviceDefinitionRegulatoryIdentifierComponent();
1457        copyValues(dst);
1458        return dst;
1459      }
1460
1461      public void copyValues(DeviceDefinitionRegulatoryIdentifierComponent dst) {
1462        super.copyValues(dst);
1463        dst.type = type == null ? null : type.copy();
1464        dst.deviceIdentifier = deviceIdentifier == null ? null : deviceIdentifier.copy();
1465        dst.issuer = issuer == null ? null : issuer.copy();
1466        dst.jurisdiction = jurisdiction == null ? null : jurisdiction.copy();
1467      }
1468
1469      @Override
1470      public boolean equalsDeep(Base other_) {
1471        if (!super.equalsDeep(other_))
1472          return false;
1473        if (!(other_ instanceof DeviceDefinitionRegulatoryIdentifierComponent))
1474          return false;
1475        DeviceDefinitionRegulatoryIdentifierComponent o = (DeviceDefinitionRegulatoryIdentifierComponent) other_;
1476        return compareDeep(type, o.type, true) && compareDeep(deviceIdentifier, o.deviceIdentifier, true)
1477           && compareDeep(issuer, o.issuer, true) && compareDeep(jurisdiction, o.jurisdiction, true);
1478      }
1479
1480      @Override
1481      public boolean equalsShallow(Base other_) {
1482        if (!super.equalsShallow(other_))
1483          return false;
1484        if (!(other_ instanceof DeviceDefinitionRegulatoryIdentifierComponent))
1485          return false;
1486        DeviceDefinitionRegulatoryIdentifierComponent o = (DeviceDefinitionRegulatoryIdentifierComponent) other_;
1487        return compareValues(type, o.type, true) && compareValues(deviceIdentifier, o.deviceIdentifier, true)
1488           && compareValues(issuer, o.issuer, true) && compareValues(jurisdiction, o.jurisdiction, true);
1489      }
1490
1491      public boolean isEmpty() {
1492        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, deviceIdentifier, issuer
1493          , jurisdiction);
1494      }
1495
1496  public String fhirType() {
1497    return "DeviceDefinition.regulatoryIdentifier";
1498
1499  }
1500
1501  }
1502
1503    @Block()
1504    public static class DeviceDefinitionDeviceNameComponent extends BackboneElement implements IBaseBackboneElement {
1505        /**
1506         * A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.
1507         */
1508        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1509        @Description(shortDefinition="A name that is used to refer to the device", formalDefinition="A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other." )
1510        protected StringType name;
1511
1512        /**
1513         * The type of deviceName.
1514RegisteredName | UserFriendlyName | PatientReportedName.
1515         */
1516        @Child(name = "type", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
1517        @Description(shortDefinition="registered-name | user-friendly-name | patient-reported-name", formalDefinition="The type of deviceName.\nRegisteredName | UserFriendlyName | PatientReportedName." )
1518        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-nametype")
1519        protected Enumeration<DeviceNameType> type;
1520
1521        private static final long serialVersionUID = 918983440L;
1522
1523    /**
1524     * Constructor
1525     */
1526      public DeviceDefinitionDeviceNameComponent() {
1527        super();
1528      }
1529
1530    /**
1531     * Constructor
1532     */
1533      public DeviceDefinitionDeviceNameComponent(String name, DeviceNameType type) {
1534        super();
1535        this.setName(name);
1536        this.setType(type);
1537      }
1538
1539        /**
1540         * @return {@link #name} (A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1541         */
1542        public StringType getNameElement() { 
1543          if (this.name == null)
1544            if (Configuration.errorOnAutoCreate())
1545              throw new Error("Attempt to auto-create DeviceDefinitionDeviceNameComponent.name");
1546            else if (Configuration.doAutoCreate())
1547              this.name = new StringType(); // bb
1548          return this.name;
1549        }
1550
1551        public boolean hasNameElement() { 
1552          return this.name != null && !this.name.isEmpty();
1553        }
1554
1555        public boolean hasName() { 
1556          return this.name != null && !this.name.isEmpty();
1557        }
1558
1559        /**
1560         * @param value {@link #name} (A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1561         */
1562        public DeviceDefinitionDeviceNameComponent setNameElement(StringType value) { 
1563          this.name = value;
1564          return this;
1565        }
1566
1567        /**
1568         * @return A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.
1569         */
1570        public String getName() { 
1571          return this.name == null ? null : this.name.getValue();
1572        }
1573
1574        /**
1575         * @param value A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.
1576         */
1577        public DeviceDefinitionDeviceNameComponent setName(String value) { 
1578            if (this.name == null)
1579              this.name = new StringType();
1580            this.name.setValue(value);
1581          return this;
1582        }
1583
1584        /**
1585         * @return {@link #type} (The type of deviceName.
1586RegisteredName | UserFriendlyName | PatientReportedName.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1587         */
1588        public Enumeration<DeviceNameType> getTypeElement() { 
1589          if (this.type == null)
1590            if (Configuration.errorOnAutoCreate())
1591              throw new Error("Attempt to auto-create DeviceDefinitionDeviceNameComponent.type");
1592            else if (Configuration.doAutoCreate())
1593              this.type = new Enumeration<DeviceNameType>(new DeviceNameTypeEnumFactory()); // bb
1594          return this.type;
1595        }
1596
1597        public boolean hasTypeElement() { 
1598          return this.type != null && !this.type.isEmpty();
1599        }
1600
1601        public boolean hasType() { 
1602          return this.type != null && !this.type.isEmpty();
1603        }
1604
1605        /**
1606         * @param value {@link #type} (The type of deviceName.
1607RegisteredName | UserFriendlyName | PatientReportedName.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1608         */
1609        public DeviceDefinitionDeviceNameComponent setTypeElement(Enumeration<DeviceNameType> value) { 
1610          this.type = value;
1611          return this;
1612        }
1613
1614        /**
1615         * @return The type of deviceName.
1616RegisteredName | UserFriendlyName | PatientReportedName.
1617         */
1618        public DeviceNameType getType() { 
1619          return this.type == null ? null : this.type.getValue();
1620        }
1621
1622        /**
1623         * @param value The type of deviceName.
1624RegisteredName | UserFriendlyName | PatientReportedName.
1625         */
1626        public DeviceDefinitionDeviceNameComponent setType(DeviceNameType value) { 
1627            if (this.type == null)
1628              this.type = new Enumeration<DeviceNameType>(new DeviceNameTypeEnumFactory());
1629            this.type.setValue(value);
1630          return this;
1631        }
1632
1633        protected void listChildren(List<Property> children) {
1634          super.listChildren(children);
1635          children.add(new Property("name", "string", "A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.", 0, 1, name));
1636          children.add(new Property("type", "code", "The type of deviceName.\nRegisteredName | UserFriendlyName | PatientReportedName.", 0, 1, type));
1637        }
1638
1639        @Override
1640        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1641          switch (_hash) {
1642          case 3373707: /*name*/  return new Property("name", "string", "A human-friendly name that is used to refer to the device - depending on the type, it can be the brand name, the common name or alias, or other.", 0, 1, name);
1643          case 3575610: /*type*/  return new Property("type", "code", "The type of deviceName.\nRegisteredName | UserFriendlyName | PatientReportedName.", 0, 1, type);
1644          default: return super.getNamedProperty(_hash, _name, _checkValid);
1645          }
1646
1647        }
1648
1649      @Override
1650      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1651        switch (hash) {
1652        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1653        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<DeviceNameType>
1654        default: return super.getProperty(hash, name, checkValid);
1655        }
1656
1657      }
1658
1659      @Override
1660      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1661        switch (hash) {
1662        case 3373707: // name
1663          this.name = TypeConvertor.castToString(value); // StringType
1664          return value;
1665        case 3575610: // type
1666          value = new DeviceNameTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1667          this.type = (Enumeration) value; // Enumeration<DeviceNameType>
1668          return value;
1669        default: return super.setProperty(hash, name, value);
1670        }
1671
1672      }
1673
1674      @Override
1675      public Base setProperty(String name, Base value) throws FHIRException {
1676        if (name.equals("name")) {
1677          this.name = TypeConvertor.castToString(value); // StringType
1678        } else if (name.equals("type")) {
1679          value = new DeviceNameTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1680          this.type = (Enumeration) value; // Enumeration<DeviceNameType>
1681        } else
1682          return super.setProperty(name, value);
1683        return value;
1684      }
1685
1686  @Override
1687  public void removeChild(String name, Base value) throws FHIRException {
1688        if (name.equals("name")) {
1689          this.name = null;
1690        } else if (name.equals("type")) {
1691          value = new DeviceNameTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1692          this.type = (Enumeration) value; // Enumeration<DeviceNameType>
1693        } else
1694          super.removeChild(name, value);
1695        
1696      }
1697
1698      @Override
1699      public Base makeProperty(int hash, String name) throws FHIRException {
1700        switch (hash) {
1701        case 3373707:  return getNameElement();
1702        case 3575610:  return getTypeElement();
1703        default: return super.makeProperty(hash, name);
1704        }
1705
1706      }
1707
1708      @Override
1709      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1710        switch (hash) {
1711        case 3373707: /*name*/ return new String[] {"string"};
1712        case 3575610: /*type*/ return new String[] {"code"};
1713        default: return super.getTypesForProperty(hash, name);
1714        }
1715
1716      }
1717
1718      @Override
1719      public Base addChild(String name) throws FHIRException {
1720        if (name.equals("name")) {
1721          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.deviceName.name");
1722        }
1723        else if (name.equals("type")) {
1724          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.deviceName.type");
1725        }
1726        else
1727          return super.addChild(name);
1728      }
1729
1730      public DeviceDefinitionDeviceNameComponent copy() {
1731        DeviceDefinitionDeviceNameComponent dst = new DeviceDefinitionDeviceNameComponent();
1732        copyValues(dst);
1733        return dst;
1734      }
1735
1736      public void copyValues(DeviceDefinitionDeviceNameComponent dst) {
1737        super.copyValues(dst);
1738        dst.name = name == null ? null : name.copy();
1739        dst.type = type == null ? null : type.copy();
1740      }
1741
1742      @Override
1743      public boolean equalsDeep(Base other_) {
1744        if (!super.equalsDeep(other_))
1745          return false;
1746        if (!(other_ instanceof DeviceDefinitionDeviceNameComponent))
1747          return false;
1748        DeviceDefinitionDeviceNameComponent o = (DeviceDefinitionDeviceNameComponent) other_;
1749        return compareDeep(name, o.name, true) && compareDeep(type, o.type, true);
1750      }
1751
1752      @Override
1753      public boolean equalsShallow(Base other_) {
1754        if (!super.equalsShallow(other_))
1755          return false;
1756        if (!(other_ instanceof DeviceDefinitionDeviceNameComponent))
1757          return false;
1758        DeviceDefinitionDeviceNameComponent o = (DeviceDefinitionDeviceNameComponent) other_;
1759        return compareValues(name, o.name, true) && compareValues(type, o.type, true);
1760      }
1761
1762      public boolean isEmpty() {
1763        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type);
1764      }
1765
1766  public String fhirType() {
1767    return "DeviceDefinition.deviceName";
1768
1769  }
1770
1771  }
1772
1773    @Block()
1774    public static class DeviceDefinitionClassificationComponent extends BackboneElement implements IBaseBackboneElement {
1775        /**
1776         * A classification or risk class of the device model.
1777         */
1778        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
1779        @Description(shortDefinition="A classification or risk class of the device model", formalDefinition="A classification or risk class of the device model." )
1780        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-type")
1781        protected CodeableConcept type;
1782
1783        /**
1784         * Further information qualifying this classification of the device model.
1785         */
1786        @Child(name = "justification", type = {RelatedArtifact.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1787        @Description(shortDefinition="Further information qualifying this classification of the device model", formalDefinition="Further information qualifying this classification of the device model." )
1788        protected List<RelatedArtifact> justification;
1789
1790        private static final long serialVersionUID = -1343788026L;
1791
1792    /**
1793     * Constructor
1794     */
1795      public DeviceDefinitionClassificationComponent() {
1796        super();
1797      }
1798
1799    /**
1800     * Constructor
1801     */
1802      public DeviceDefinitionClassificationComponent(CodeableConcept type) {
1803        super();
1804        this.setType(type);
1805      }
1806
1807        /**
1808         * @return {@link #type} (A classification or risk class of the device model.)
1809         */
1810        public CodeableConcept getType() { 
1811          if (this.type == null)
1812            if (Configuration.errorOnAutoCreate())
1813              throw new Error("Attempt to auto-create DeviceDefinitionClassificationComponent.type");
1814            else if (Configuration.doAutoCreate())
1815              this.type = new CodeableConcept(); // cc
1816          return this.type;
1817        }
1818
1819        public boolean hasType() { 
1820          return this.type != null && !this.type.isEmpty();
1821        }
1822
1823        /**
1824         * @param value {@link #type} (A classification or risk class of the device model.)
1825         */
1826        public DeviceDefinitionClassificationComponent setType(CodeableConcept value) { 
1827          this.type = value;
1828          return this;
1829        }
1830
1831        /**
1832         * @return {@link #justification} (Further information qualifying this classification of the device model.)
1833         */
1834        public List<RelatedArtifact> getJustification() { 
1835          if (this.justification == null)
1836            this.justification = new ArrayList<RelatedArtifact>();
1837          return this.justification;
1838        }
1839
1840        /**
1841         * @return Returns a reference to <code>this</code> for easy method chaining
1842         */
1843        public DeviceDefinitionClassificationComponent setJustification(List<RelatedArtifact> theJustification) { 
1844          this.justification = theJustification;
1845          return this;
1846        }
1847
1848        public boolean hasJustification() { 
1849          if (this.justification == null)
1850            return false;
1851          for (RelatedArtifact item : this.justification)
1852            if (!item.isEmpty())
1853              return true;
1854          return false;
1855        }
1856
1857        public RelatedArtifact addJustification() { //3
1858          RelatedArtifact t = new RelatedArtifact();
1859          if (this.justification == null)
1860            this.justification = new ArrayList<RelatedArtifact>();
1861          this.justification.add(t);
1862          return t;
1863        }
1864
1865        public DeviceDefinitionClassificationComponent addJustification(RelatedArtifact t) { //3
1866          if (t == null)
1867            return this;
1868          if (this.justification == null)
1869            this.justification = new ArrayList<RelatedArtifact>();
1870          this.justification.add(t);
1871          return this;
1872        }
1873
1874        /**
1875         * @return The first repetition of repeating field {@link #justification}, creating it if it does not already exist {3}
1876         */
1877        public RelatedArtifact getJustificationFirstRep() { 
1878          if (getJustification().isEmpty()) {
1879            addJustification();
1880          }
1881          return getJustification().get(0);
1882        }
1883
1884        protected void listChildren(List<Property> children) {
1885          super.listChildren(children);
1886          children.add(new Property("type", "CodeableConcept", "A classification or risk class of the device model.", 0, 1, type));
1887          children.add(new Property("justification", "RelatedArtifact", "Further information qualifying this classification of the device model.", 0, java.lang.Integer.MAX_VALUE, justification));
1888        }
1889
1890        @Override
1891        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1892          switch (_hash) {
1893          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A classification or risk class of the device model.", 0, 1, type);
1894          case 1864993522: /*justification*/  return new Property("justification", "RelatedArtifact", "Further information qualifying this classification of the device model.", 0, java.lang.Integer.MAX_VALUE, justification);
1895          default: return super.getNamedProperty(_hash, _name, _checkValid);
1896          }
1897
1898        }
1899
1900      @Override
1901      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1902        switch (hash) {
1903        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1904        case 1864993522: /*justification*/ return this.justification == null ? new Base[0] : this.justification.toArray(new Base[this.justification.size()]); // RelatedArtifact
1905        default: return super.getProperty(hash, name, checkValid);
1906        }
1907
1908      }
1909
1910      @Override
1911      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1912        switch (hash) {
1913        case 3575610: // type
1914          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1915          return value;
1916        case 1864993522: // justification
1917          this.getJustification().add(TypeConvertor.castToRelatedArtifact(value)); // RelatedArtifact
1918          return value;
1919        default: return super.setProperty(hash, name, value);
1920        }
1921
1922      }
1923
1924      @Override
1925      public Base setProperty(String name, Base value) throws FHIRException {
1926        if (name.equals("type")) {
1927          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1928        } else if (name.equals("justification")) {
1929          this.getJustification().add(TypeConvertor.castToRelatedArtifact(value));
1930        } else
1931          return super.setProperty(name, value);
1932        return value;
1933      }
1934
1935  @Override
1936  public void removeChild(String name, Base value) throws FHIRException {
1937        if (name.equals("type")) {
1938          this.type = null;
1939        } else if (name.equals("justification")) {
1940          this.getJustification().remove(value);
1941        } else
1942          super.removeChild(name, value);
1943        
1944      }
1945
1946      @Override
1947      public Base makeProperty(int hash, String name) throws FHIRException {
1948        switch (hash) {
1949        case 3575610:  return getType();
1950        case 1864993522:  return addJustification(); 
1951        default: return super.makeProperty(hash, name);
1952        }
1953
1954      }
1955
1956      @Override
1957      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1958        switch (hash) {
1959        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1960        case 1864993522: /*justification*/ return new String[] {"RelatedArtifact"};
1961        default: return super.getTypesForProperty(hash, name);
1962        }
1963
1964      }
1965
1966      @Override
1967      public Base addChild(String name) throws FHIRException {
1968        if (name.equals("type")) {
1969          this.type = new CodeableConcept();
1970          return this.type;
1971        }
1972        else if (name.equals("justification")) {
1973          return addJustification();
1974        }
1975        else
1976          return super.addChild(name);
1977      }
1978
1979      public DeviceDefinitionClassificationComponent copy() {
1980        DeviceDefinitionClassificationComponent dst = new DeviceDefinitionClassificationComponent();
1981        copyValues(dst);
1982        return dst;
1983      }
1984
1985      public void copyValues(DeviceDefinitionClassificationComponent dst) {
1986        super.copyValues(dst);
1987        dst.type = type == null ? null : type.copy();
1988        if (justification != null) {
1989          dst.justification = new ArrayList<RelatedArtifact>();
1990          for (RelatedArtifact i : justification)
1991            dst.justification.add(i.copy());
1992        };
1993      }
1994
1995      @Override
1996      public boolean equalsDeep(Base other_) {
1997        if (!super.equalsDeep(other_))
1998          return false;
1999        if (!(other_ instanceof DeviceDefinitionClassificationComponent))
2000          return false;
2001        DeviceDefinitionClassificationComponent o = (DeviceDefinitionClassificationComponent) other_;
2002        return compareDeep(type, o.type, true) && compareDeep(justification, o.justification, true);
2003      }
2004
2005      @Override
2006      public boolean equalsShallow(Base other_) {
2007        if (!super.equalsShallow(other_))
2008          return false;
2009        if (!(other_ instanceof DeviceDefinitionClassificationComponent))
2010          return false;
2011        DeviceDefinitionClassificationComponent o = (DeviceDefinitionClassificationComponent) other_;
2012        return true;
2013      }
2014
2015      public boolean isEmpty() {
2016        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, justification);
2017      }
2018
2019  public String fhirType() {
2020    return "DeviceDefinition.classification";
2021
2022  }
2023
2024  }
2025
2026    @Block()
2027    public static class DeviceDefinitionConformsToComponent extends BackboneElement implements IBaseBackboneElement {
2028        /**
2029         * Describes the type of the standard, specification, or formal guidance.
2030         */
2031        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
2032        @Description(shortDefinition="Describes the common type of the standard, specification, or formal guidance", formalDefinition="Describes the type of the standard, specification, or formal guidance." )
2033        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-specification-category")
2034        protected CodeableConcept category;
2035
2036        /**
2037         * Code that identifies the specific standard, specification, protocol, formal guidance, regulation, legislation, or certification scheme to which the device adheres.
2038         */
2039        @Child(name = "specification", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
2040        @Description(shortDefinition="Identifies the standard, specification, or formal guidance that the device adheres to the Device Specification type", formalDefinition="Code that identifies the specific standard, specification, protocol, formal guidance, regulation, legislation, or certification scheme to which the device adheres." )
2041        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-specification-type")
2042        protected CodeableConcept specification;
2043
2044        /**
2045         * Identifies the specific form or variant of the standard, specification, or formal guidance. This may be a 'version number', release, document edition, publication year, or other label.
2046         */
2047        @Child(name = "version", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2048        @Description(shortDefinition="The specific form or variant of the standard, specification or formal guidance", formalDefinition="Identifies the specific form or variant of the standard, specification, or formal guidance. This may be a 'version number', release, document edition, publication year, or other label." )
2049        protected List<StringType> version;
2050
2051        /**
2052         * Standard, regulation, certification, or guidance website, document, or other publication, or similar, supporting the conformance.
2053         */
2054        @Child(name = "source", type = {RelatedArtifact.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2055        @Description(shortDefinition="Standard, regulation, certification, or guidance website, document, or other publication, or similar, supporting the conformance", formalDefinition="Standard, regulation, certification, or guidance website, document, or other publication, or similar, supporting the conformance." )
2056        protected List<RelatedArtifact> source;
2057
2058        private static final long serialVersionUID = -370906560L;
2059
2060    /**
2061     * Constructor
2062     */
2063      public DeviceDefinitionConformsToComponent() {
2064        super();
2065      }
2066
2067    /**
2068     * Constructor
2069     */
2070      public DeviceDefinitionConformsToComponent(CodeableConcept specification) {
2071        super();
2072        this.setSpecification(specification);
2073      }
2074
2075        /**
2076         * @return {@link #category} (Describes the type of the standard, specification, or formal guidance.)
2077         */
2078        public CodeableConcept getCategory() { 
2079          if (this.category == null)
2080            if (Configuration.errorOnAutoCreate())
2081              throw new Error("Attempt to auto-create DeviceDefinitionConformsToComponent.category");
2082            else if (Configuration.doAutoCreate())
2083              this.category = new CodeableConcept(); // cc
2084          return this.category;
2085        }
2086
2087        public boolean hasCategory() { 
2088          return this.category != null && !this.category.isEmpty();
2089        }
2090
2091        /**
2092         * @param value {@link #category} (Describes the type of the standard, specification, or formal guidance.)
2093         */
2094        public DeviceDefinitionConformsToComponent setCategory(CodeableConcept value) { 
2095          this.category = value;
2096          return this;
2097        }
2098
2099        /**
2100         * @return {@link #specification} (Code that identifies the specific standard, specification, protocol, formal guidance, regulation, legislation, or certification scheme to which the device adheres.)
2101         */
2102        public CodeableConcept getSpecification() { 
2103          if (this.specification == null)
2104            if (Configuration.errorOnAutoCreate())
2105              throw new Error("Attempt to auto-create DeviceDefinitionConformsToComponent.specification");
2106            else if (Configuration.doAutoCreate())
2107              this.specification = new CodeableConcept(); // cc
2108          return this.specification;
2109        }
2110
2111        public boolean hasSpecification() { 
2112          return this.specification != null && !this.specification.isEmpty();
2113        }
2114
2115        /**
2116         * @param value {@link #specification} (Code that identifies the specific standard, specification, protocol, formal guidance, regulation, legislation, or certification scheme to which the device adheres.)
2117         */
2118        public DeviceDefinitionConformsToComponent setSpecification(CodeableConcept value) { 
2119          this.specification = value;
2120          return this;
2121        }
2122
2123        /**
2124         * @return {@link #version} (Identifies the specific form or variant of the standard, specification, or formal guidance. This may be a 'version number', release, document edition, publication year, or other label.)
2125         */
2126        public List<StringType> getVersion() { 
2127          if (this.version == null)
2128            this.version = new ArrayList<StringType>();
2129          return this.version;
2130        }
2131
2132        /**
2133         * @return Returns a reference to <code>this</code> for easy method chaining
2134         */
2135        public DeviceDefinitionConformsToComponent setVersion(List<StringType> theVersion) { 
2136          this.version = theVersion;
2137          return this;
2138        }
2139
2140        public boolean hasVersion() { 
2141          if (this.version == null)
2142            return false;
2143          for (StringType item : this.version)
2144            if (!item.isEmpty())
2145              return true;
2146          return false;
2147        }
2148
2149        /**
2150         * @return {@link #version} (Identifies the specific form or variant of the standard, specification, or formal guidance. This may be a 'version number', release, document edition, publication year, or other label.)
2151         */
2152        public StringType addVersionElement() {//2 
2153          StringType t = new StringType();
2154          if (this.version == null)
2155            this.version = new ArrayList<StringType>();
2156          this.version.add(t);
2157          return t;
2158        }
2159
2160        /**
2161         * @param value {@link #version} (Identifies the specific form or variant of the standard, specification, or formal guidance. This may be a 'version number', release, document edition, publication year, or other label.)
2162         */
2163        public DeviceDefinitionConformsToComponent addVersion(String value) { //1
2164          StringType t = new StringType();
2165          t.setValue(value);
2166          if (this.version == null)
2167            this.version = new ArrayList<StringType>();
2168          this.version.add(t);
2169          return this;
2170        }
2171
2172        /**
2173         * @param value {@link #version} (Identifies the specific form or variant of the standard, specification, or formal guidance. This may be a 'version number', release, document edition, publication year, or other label.)
2174         */
2175        public boolean hasVersion(String value) { 
2176          if (this.version == null)
2177            return false;
2178          for (StringType v : this.version)
2179            if (v.getValue().equals(value)) // string
2180              return true;
2181          return false;
2182        }
2183
2184        /**
2185         * @return {@link #source} (Standard, regulation, certification, or guidance website, document, or other publication, or similar, supporting the conformance.)
2186         */
2187        public List<RelatedArtifact> getSource() { 
2188          if (this.source == null)
2189            this.source = new ArrayList<RelatedArtifact>();
2190          return this.source;
2191        }
2192
2193        /**
2194         * @return Returns a reference to <code>this</code> for easy method chaining
2195         */
2196        public DeviceDefinitionConformsToComponent setSource(List<RelatedArtifact> theSource) { 
2197          this.source = theSource;
2198          return this;
2199        }
2200
2201        public boolean hasSource() { 
2202          if (this.source == null)
2203            return false;
2204          for (RelatedArtifact item : this.source)
2205            if (!item.isEmpty())
2206              return true;
2207          return false;
2208        }
2209
2210        public RelatedArtifact addSource() { //3
2211          RelatedArtifact t = new RelatedArtifact();
2212          if (this.source == null)
2213            this.source = new ArrayList<RelatedArtifact>();
2214          this.source.add(t);
2215          return t;
2216        }
2217
2218        public DeviceDefinitionConformsToComponent addSource(RelatedArtifact t) { //3
2219          if (t == null)
2220            return this;
2221          if (this.source == null)
2222            this.source = new ArrayList<RelatedArtifact>();
2223          this.source.add(t);
2224          return this;
2225        }
2226
2227        /**
2228         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist {3}
2229         */
2230        public RelatedArtifact getSourceFirstRep() { 
2231          if (getSource().isEmpty()) {
2232            addSource();
2233          }
2234          return getSource().get(0);
2235        }
2236
2237        protected void listChildren(List<Property> children) {
2238          super.listChildren(children);
2239          children.add(new Property("category", "CodeableConcept", "Describes the type of the standard, specification, or formal guidance.", 0, 1, category));
2240          children.add(new Property("specification", "CodeableConcept", "Code that identifies the specific standard, specification, protocol, formal guidance, regulation, legislation, or certification scheme to which the device adheres.", 0, 1, specification));
2241          children.add(new Property("version", "string", "Identifies the specific form or variant of the standard, specification, or formal guidance. This may be a 'version number', release, document edition, publication year, or other label.", 0, java.lang.Integer.MAX_VALUE, version));
2242          children.add(new Property("source", "RelatedArtifact", "Standard, regulation, certification, or guidance website, document, or other publication, or similar, supporting the conformance.", 0, java.lang.Integer.MAX_VALUE, source));
2243        }
2244
2245        @Override
2246        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2247          switch (_hash) {
2248          case 50511102: /*category*/  return new Property("category", "CodeableConcept", "Describes the type of the standard, specification, or formal guidance.", 0, 1, category);
2249          case 1307197699: /*specification*/  return new Property("specification", "CodeableConcept", "Code that identifies the specific standard, specification, protocol, formal guidance, regulation, legislation, or certification scheme to which the device adheres.", 0, 1, specification);
2250          case 351608024: /*version*/  return new Property("version", "string", "Identifies the specific form or variant of the standard, specification, or formal guidance. This may be a 'version number', release, document edition, publication year, or other label.", 0, java.lang.Integer.MAX_VALUE, version);
2251          case -896505829: /*source*/  return new Property("source", "RelatedArtifact", "Standard, regulation, certification, or guidance website, document, or other publication, or similar, supporting the conformance.", 0, java.lang.Integer.MAX_VALUE, source);
2252          default: return super.getNamedProperty(_hash, _name, _checkValid);
2253          }
2254
2255        }
2256
2257      @Override
2258      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2259        switch (hash) {
2260        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
2261        case 1307197699: /*specification*/ return this.specification == null ? new Base[0] : new Base[] {this.specification}; // CodeableConcept
2262        case 351608024: /*version*/ return this.version == null ? new Base[0] : this.version.toArray(new Base[this.version.size()]); // StringType
2263        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // RelatedArtifact
2264        default: return super.getProperty(hash, name, checkValid);
2265        }
2266
2267      }
2268
2269      @Override
2270      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2271        switch (hash) {
2272        case 50511102: // category
2273          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2274          return value;
2275        case 1307197699: // specification
2276          this.specification = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2277          return value;
2278        case 351608024: // version
2279          this.getVersion().add(TypeConvertor.castToString(value)); // StringType
2280          return value;
2281        case -896505829: // source
2282          this.getSource().add(TypeConvertor.castToRelatedArtifact(value)); // RelatedArtifact
2283          return value;
2284        default: return super.setProperty(hash, name, value);
2285        }
2286
2287      }
2288
2289      @Override
2290      public Base setProperty(String name, Base value) throws FHIRException {
2291        if (name.equals("category")) {
2292          this.category = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2293        } else if (name.equals("specification")) {
2294          this.specification = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2295        } else if (name.equals("version")) {
2296          this.getVersion().add(TypeConvertor.castToString(value));
2297        } else if (name.equals("source")) {
2298          this.getSource().add(TypeConvertor.castToRelatedArtifact(value));
2299        } else
2300          return super.setProperty(name, value);
2301        return value;
2302      }
2303
2304  @Override
2305  public void removeChild(String name, Base value) throws FHIRException {
2306        if (name.equals("category")) {
2307          this.category = null;
2308        } else if (name.equals("specification")) {
2309          this.specification = null;
2310        } else if (name.equals("version")) {
2311          this.getVersion().remove(value);
2312        } else if (name.equals("source")) {
2313          this.getSource().remove(value);
2314        } else
2315          super.removeChild(name, value);
2316        
2317      }
2318
2319      @Override
2320      public Base makeProperty(int hash, String name) throws FHIRException {
2321        switch (hash) {
2322        case 50511102:  return getCategory();
2323        case 1307197699:  return getSpecification();
2324        case 351608024:  return addVersionElement();
2325        case -896505829:  return addSource(); 
2326        default: return super.makeProperty(hash, name);
2327        }
2328
2329      }
2330
2331      @Override
2332      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2333        switch (hash) {
2334        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2335        case 1307197699: /*specification*/ return new String[] {"CodeableConcept"};
2336        case 351608024: /*version*/ return new String[] {"string"};
2337        case -896505829: /*source*/ return new String[] {"RelatedArtifact"};
2338        default: return super.getTypesForProperty(hash, name);
2339        }
2340
2341      }
2342
2343      @Override
2344      public Base addChild(String name) throws FHIRException {
2345        if (name.equals("category")) {
2346          this.category = new CodeableConcept();
2347          return this.category;
2348        }
2349        else if (name.equals("specification")) {
2350          this.specification = new CodeableConcept();
2351          return this.specification;
2352        }
2353        else if (name.equals("version")) {
2354          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.conformsTo.version");
2355        }
2356        else if (name.equals("source")) {
2357          return addSource();
2358        }
2359        else
2360          return super.addChild(name);
2361      }
2362
2363      public DeviceDefinitionConformsToComponent copy() {
2364        DeviceDefinitionConformsToComponent dst = new DeviceDefinitionConformsToComponent();
2365        copyValues(dst);
2366        return dst;
2367      }
2368
2369      public void copyValues(DeviceDefinitionConformsToComponent dst) {
2370        super.copyValues(dst);
2371        dst.category = category == null ? null : category.copy();
2372        dst.specification = specification == null ? null : specification.copy();
2373        if (version != null) {
2374          dst.version = new ArrayList<StringType>();
2375          for (StringType i : version)
2376            dst.version.add(i.copy());
2377        };
2378        if (source != null) {
2379          dst.source = new ArrayList<RelatedArtifact>();
2380          for (RelatedArtifact i : source)
2381            dst.source.add(i.copy());
2382        };
2383      }
2384
2385      @Override
2386      public boolean equalsDeep(Base other_) {
2387        if (!super.equalsDeep(other_))
2388          return false;
2389        if (!(other_ instanceof DeviceDefinitionConformsToComponent))
2390          return false;
2391        DeviceDefinitionConformsToComponent o = (DeviceDefinitionConformsToComponent) other_;
2392        return compareDeep(category, o.category, true) && compareDeep(specification, o.specification, true)
2393           && compareDeep(version, o.version, true) && compareDeep(source, o.source, true);
2394      }
2395
2396      @Override
2397      public boolean equalsShallow(Base other_) {
2398        if (!super.equalsShallow(other_))
2399          return false;
2400        if (!(other_ instanceof DeviceDefinitionConformsToComponent))
2401          return false;
2402        DeviceDefinitionConformsToComponent o = (DeviceDefinitionConformsToComponent) other_;
2403        return compareValues(version, o.version, true);
2404      }
2405
2406      public boolean isEmpty() {
2407        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, specification, version
2408          , source);
2409      }
2410
2411  public String fhirType() {
2412    return "DeviceDefinition.conformsTo";
2413
2414  }
2415
2416  }
2417
2418    @Block()
2419    public static class DeviceDefinitionHasPartComponent extends BackboneElement implements IBaseBackboneElement {
2420        /**
2421         * Reference to the device that is part of the current device.
2422         */
2423        @Child(name = "reference", type = {DeviceDefinition.class}, order=1, min=1, max=1, modifier=false, summary=true)
2424        @Description(shortDefinition="Reference to the part", formalDefinition="Reference to the device that is part of the current device." )
2425        protected Reference reference;
2426
2427        /**
2428         * Number of instances of the component device in the current device.
2429         */
2430        @Child(name = "count", type = {IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2431        @Description(shortDefinition="Number of occurrences of the part", formalDefinition="Number of instances of the component device in the current device." )
2432        protected IntegerType count;
2433
2434        private static final long serialVersionUID = -1166127369L;
2435
2436    /**
2437     * Constructor
2438     */
2439      public DeviceDefinitionHasPartComponent() {
2440        super();
2441      }
2442
2443    /**
2444     * Constructor
2445     */
2446      public DeviceDefinitionHasPartComponent(Reference reference) {
2447        super();
2448        this.setReference(reference);
2449      }
2450
2451        /**
2452         * @return {@link #reference} (Reference to the device that is part of the current device.)
2453         */
2454        public Reference getReference() { 
2455          if (this.reference == null)
2456            if (Configuration.errorOnAutoCreate())
2457              throw new Error("Attempt to auto-create DeviceDefinitionHasPartComponent.reference");
2458            else if (Configuration.doAutoCreate())
2459              this.reference = new Reference(); // cc
2460          return this.reference;
2461        }
2462
2463        public boolean hasReference() { 
2464          return this.reference != null && !this.reference.isEmpty();
2465        }
2466
2467        /**
2468         * @param value {@link #reference} (Reference to the device that is part of the current device.)
2469         */
2470        public DeviceDefinitionHasPartComponent setReference(Reference value) { 
2471          this.reference = value;
2472          return this;
2473        }
2474
2475        /**
2476         * @return {@link #count} (Number of instances of the component device in the current device.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
2477         */
2478        public IntegerType getCountElement() { 
2479          if (this.count == null)
2480            if (Configuration.errorOnAutoCreate())
2481              throw new Error("Attempt to auto-create DeviceDefinitionHasPartComponent.count");
2482            else if (Configuration.doAutoCreate())
2483              this.count = new IntegerType(); // bb
2484          return this.count;
2485        }
2486
2487        public boolean hasCountElement() { 
2488          return this.count != null && !this.count.isEmpty();
2489        }
2490
2491        public boolean hasCount() { 
2492          return this.count != null && !this.count.isEmpty();
2493        }
2494
2495        /**
2496         * @param value {@link #count} (Number of instances of the component device in the current device.). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
2497         */
2498        public DeviceDefinitionHasPartComponent setCountElement(IntegerType value) { 
2499          this.count = value;
2500          return this;
2501        }
2502
2503        /**
2504         * @return Number of instances of the component device in the current device.
2505         */
2506        public int getCount() { 
2507          return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue();
2508        }
2509
2510        /**
2511         * @param value Number of instances of the component device in the current device.
2512         */
2513        public DeviceDefinitionHasPartComponent setCount(int value) { 
2514            if (this.count == null)
2515              this.count = new IntegerType();
2516            this.count.setValue(value);
2517          return this;
2518        }
2519
2520        protected void listChildren(List<Property> children) {
2521          super.listChildren(children);
2522          children.add(new Property("reference", "Reference(DeviceDefinition)", "Reference to the device that is part of the current device.", 0, 1, reference));
2523          children.add(new Property("count", "integer", "Number of instances of the component device in the current device.", 0, 1, count));
2524        }
2525
2526        @Override
2527        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2528          switch (_hash) {
2529          case -925155509: /*reference*/  return new Property("reference", "Reference(DeviceDefinition)", "Reference to the device that is part of the current device.", 0, 1, reference);
2530          case 94851343: /*count*/  return new Property("count", "integer", "Number of instances of the component device in the current device.", 0, 1, count);
2531          default: return super.getNamedProperty(_hash, _name, _checkValid);
2532          }
2533
2534        }
2535
2536      @Override
2537      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2538        switch (hash) {
2539        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // Reference
2540        case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // IntegerType
2541        default: return super.getProperty(hash, name, checkValid);
2542        }
2543
2544      }
2545
2546      @Override
2547      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2548        switch (hash) {
2549        case -925155509: // reference
2550          this.reference = TypeConvertor.castToReference(value); // Reference
2551          return value;
2552        case 94851343: // count
2553          this.count = TypeConvertor.castToInteger(value); // IntegerType
2554          return value;
2555        default: return super.setProperty(hash, name, value);
2556        }
2557
2558      }
2559
2560      @Override
2561      public Base setProperty(String name, Base value) throws FHIRException {
2562        if (name.equals("reference")) {
2563          this.reference = TypeConvertor.castToReference(value); // Reference
2564        } else if (name.equals("count")) {
2565          this.count = TypeConvertor.castToInteger(value); // IntegerType
2566        } else
2567          return super.setProperty(name, value);
2568        return value;
2569      }
2570
2571  @Override
2572  public void removeChild(String name, Base value) throws FHIRException {
2573        if (name.equals("reference")) {
2574          this.reference = null;
2575        } else if (name.equals("count")) {
2576          this.count = null;
2577        } else
2578          super.removeChild(name, value);
2579        
2580      }
2581
2582      @Override
2583      public Base makeProperty(int hash, String name) throws FHIRException {
2584        switch (hash) {
2585        case -925155509:  return getReference();
2586        case 94851343:  return getCountElement();
2587        default: return super.makeProperty(hash, name);
2588        }
2589
2590      }
2591
2592      @Override
2593      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2594        switch (hash) {
2595        case -925155509: /*reference*/ return new String[] {"Reference"};
2596        case 94851343: /*count*/ return new String[] {"integer"};
2597        default: return super.getTypesForProperty(hash, name);
2598        }
2599
2600      }
2601
2602      @Override
2603      public Base addChild(String name) throws FHIRException {
2604        if (name.equals("reference")) {
2605          this.reference = new Reference();
2606          return this.reference;
2607        }
2608        else if (name.equals("count")) {
2609          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.hasPart.count");
2610        }
2611        else
2612          return super.addChild(name);
2613      }
2614
2615      public DeviceDefinitionHasPartComponent copy() {
2616        DeviceDefinitionHasPartComponent dst = new DeviceDefinitionHasPartComponent();
2617        copyValues(dst);
2618        return dst;
2619      }
2620
2621      public void copyValues(DeviceDefinitionHasPartComponent dst) {
2622        super.copyValues(dst);
2623        dst.reference = reference == null ? null : reference.copy();
2624        dst.count = count == null ? null : count.copy();
2625      }
2626
2627      @Override
2628      public boolean equalsDeep(Base other_) {
2629        if (!super.equalsDeep(other_))
2630          return false;
2631        if (!(other_ instanceof DeviceDefinitionHasPartComponent))
2632          return false;
2633        DeviceDefinitionHasPartComponent o = (DeviceDefinitionHasPartComponent) other_;
2634        return compareDeep(reference, o.reference, true) && compareDeep(count, o.count, true);
2635      }
2636
2637      @Override
2638      public boolean equalsShallow(Base other_) {
2639        if (!super.equalsShallow(other_))
2640          return false;
2641        if (!(other_ instanceof DeviceDefinitionHasPartComponent))
2642          return false;
2643        DeviceDefinitionHasPartComponent o = (DeviceDefinitionHasPartComponent) other_;
2644        return compareValues(count, o.count, true);
2645      }
2646
2647      public boolean isEmpty() {
2648        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(reference, count);
2649      }
2650
2651  public String fhirType() {
2652    return "DeviceDefinition.hasPart";
2653
2654  }
2655
2656  }
2657
2658    @Block()
2659    public static class DeviceDefinitionPackagingComponent extends BackboneElement implements IBaseBackboneElement {
2660        /**
2661         * The business identifier of the packaged medication.
2662         */
2663        @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=false)
2664        @Description(shortDefinition="Business identifier of the packaged medication", formalDefinition="The business identifier of the packaged medication." )
2665        protected Identifier identifier;
2666
2667        /**
2668         * A code that defines the specific type of packaging.
2669         */
2670        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2671        @Description(shortDefinition="A code that defines the specific type of packaging", formalDefinition="A code that defines the specific type of packaging." )
2672        protected CodeableConcept type;
2673
2674        /**
2675         * The number of items contained in the package (devices or sub-packages).
2676         */
2677        @Child(name = "count", type = {IntegerType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2678        @Description(shortDefinition="The number of items contained in the package (devices or sub-packages)", formalDefinition="The number of items contained in the package (devices or sub-packages)." )
2679        protected IntegerType count;
2680
2681        /**
2682         * An organization that distributes the packaged device.
2683         */
2684        @Child(name = "distributor", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2685        @Description(shortDefinition="An organization that distributes the packaged device", formalDefinition="An organization that distributes the packaged device." )
2686        protected List<PackagingDistributorComponent> distributor;
2687
2688        /**
2689         * Unique Device Identifier (UDI) Barcode string on the packaging.
2690         */
2691        @Child(name = "udiDeviceIdentifier", type = {DeviceDefinitionUdiDeviceIdentifierComponent.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2692        @Description(shortDefinition="Unique Device Identifier (UDI) Barcode string on the packaging", formalDefinition="Unique Device Identifier (UDI) Barcode string on the packaging." )
2693        protected List<DeviceDefinitionUdiDeviceIdentifierComponent> udiDeviceIdentifier;
2694
2695        /**
2696         * Allows packages within packages.
2697         */
2698        @Child(name = "packaging", type = {DeviceDefinitionPackagingComponent.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2699        @Description(shortDefinition="Allows packages within packages", formalDefinition="Allows packages within packages." )
2700        protected List<DeviceDefinitionPackagingComponent> packaging;
2701
2702        private static final long serialVersionUID = 1022373074L;
2703
2704    /**
2705     * Constructor
2706     */
2707      public DeviceDefinitionPackagingComponent() {
2708        super();
2709      }
2710
2711        /**
2712         * @return {@link #identifier} (The business identifier of the packaged medication.)
2713         */
2714        public Identifier getIdentifier() { 
2715          if (this.identifier == null)
2716            if (Configuration.errorOnAutoCreate())
2717              throw new Error("Attempt to auto-create DeviceDefinitionPackagingComponent.identifier");
2718            else if (Configuration.doAutoCreate())
2719              this.identifier = new Identifier(); // cc
2720          return this.identifier;
2721        }
2722
2723        public boolean hasIdentifier() { 
2724          return this.identifier != null && !this.identifier.isEmpty();
2725        }
2726
2727        /**
2728         * @param value {@link #identifier} (The business identifier of the packaged medication.)
2729         */
2730        public DeviceDefinitionPackagingComponent setIdentifier(Identifier value) { 
2731          this.identifier = value;
2732          return this;
2733        }
2734
2735        /**
2736         * @return {@link #type} (A code that defines the specific type of packaging.)
2737         */
2738        public CodeableConcept getType() { 
2739          if (this.type == null)
2740            if (Configuration.errorOnAutoCreate())
2741              throw new Error("Attempt to auto-create DeviceDefinitionPackagingComponent.type");
2742            else if (Configuration.doAutoCreate())
2743              this.type = new CodeableConcept(); // cc
2744          return this.type;
2745        }
2746
2747        public boolean hasType() { 
2748          return this.type != null && !this.type.isEmpty();
2749        }
2750
2751        /**
2752         * @param value {@link #type} (A code that defines the specific type of packaging.)
2753         */
2754        public DeviceDefinitionPackagingComponent setType(CodeableConcept value) { 
2755          this.type = value;
2756          return this;
2757        }
2758
2759        /**
2760         * @return {@link #count} (The number of items contained in the package (devices or sub-packages).). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
2761         */
2762        public IntegerType getCountElement() { 
2763          if (this.count == null)
2764            if (Configuration.errorOnAutoCreate())
2765              throw new Error("Attempt to auto-create DeviceDefinitionPackagingComponent.count");
2766            else if (Configuration.doAutoCreate())
2767              this.count = new IntegerType(); // bb
2768          return this.count;
2769        }
2770
2771        public boolean hasCountElement() { 
2772          return this.count != null && !this.count.isEmpty();
2773        }
2774
2775        public boolean hasCount() { 
2776          return this.count != null && !this.count.isEmpty();
2777        }
2778
2779        /**
2780         * @param value {@link #count} (The number of items contained in the package (devices or sub-packages).). This is the underlying object with id, value and extensions. The accessor "getCount" gives direct access to the value
2781         */
2782        public DeviceDefinitionPackagingComponent setCountElement(IntegerType value) { 
2783          this.count = value;
2784          return this;
2785        }
2786
2787        /**
2788         * @return The number of items contained in the package (devices or sub-packages).
2789         */
2790        public int getCount() { 
2791          return this.count == null || this.count.isEmpty() ? 0 : this.count.getValue();
2792        }
2793
2794        /**
2795         * @param value The number of items contained in the package (devices or sub-packages).
2796         */
2797        public DeviceDefinitionPackagingComponent setCount(int value) { 
2798            if (this.count == null)
2799              this.count = new IntegerType();
2800            this.count.setValue(value);
2801          return this;
2802        }
2803
2804        /**
2805         * @return {@link #distributor} (An organization that distributes the packaged device.)
2806         */
2807        public List<PackagingDistributorComponent> getDistributor() { 
2808          if (this.distributor == null)
2809            this.distributor = new ArrayList<PackagingDistributorComponent>();
2810          return this.distributor;
2811        }
2812
2813        /**
2814         * @return Returns a reference to <code>this</code> for easy method chaining
2815         */
2816        public DeviceDefinitionPackagingComponent setDistributor(List<PackagingDistributorComponent> theDistributor) { 
2817          this.distributor = theDistributor;
2818          return this;
2819        }
2820
2821        public boolean hasDistributor() { 
2822          if (this.distributor == null)
2823            return false;
2824          for (PackagingDistributorComponent item : this.distributor)
2825            if (!item.isEmpty())
2826              return true;
2827          return false;
2828        }
2829
2830        public PackagingDistributorComponent addDistributor() { //3
2831          PackagingDistributorComponent t = new PackagingDistributorComponent();
2832          if (this.distributor == null)
2833            this.distributor = new ArrayList<PackagingDistributorComponent>();
2834          this.distributor.add(t);
2835          return t;
2836        }
2837
2838        public DeviceDefinitionPackagingComponent addDistributor(PackagingDistributorComponent t) { //3
2839          if (t == null)
2840            return this;
2841          if (this.distributor == null)
2842            this.distributor = new ArrayList<PackagingDistributorComponent>();
2843          this.distributor.add(t);
2844          return this;
2845        }
2846
2847        /**
2848         * @return The first repetition of repeating field {@link #distributor}, creating it if it does not already exist {3}
2849         */
2850        public PackagingDistributorComponent getDistributorFirstRep() { 
2851          if (getDistributor().isEmpty()) {
2852            addDistributor();
2853          }
2854          return getDistributor().get(0);
2855        }
2856
2857        /**
2858         * @return {@link #udiDeviceIdentifier} (Unique Device Identifier (UDI) Barcode string on the packaging.)
2859         */
2860        public List<DeviceDefinitionUdiDeviceIdentifierComponent> getUdiDeviceIdentifier() { 
2861          if (this.udiDeviceIdentifier == null)
2862            this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
2863          return this.udiDeviceIdentifier;
2864        }
2865
2866        /**
2867         * @return Returns a reference to <code>this</code> for easy method chaining
2868         */
2869        public DeviceDefinitionPackagingComponent setUdiDeviceIdentifier(List<DeviceDefinitionUdiDeviceIdentifierComponent> theUdiDeviceIdentifier) { 
2870          this.udiDeviceIdentifier = theUdiDeviceIdentifier;
2871          return this;
2872        }
2873
2874        public boolean hasUdiDeviceIdentifier() { 
2875          if (this.udiDeviceIdentifier == null)
2876            return false;
2877          for (DeviceDefinitionUdiDeviceIdentifierComponent item : this.udiDeviceIdentifier)
2878            if (!item.isEmpty())
2879              return true;
2880          return false;
2881        }
2882
2883        public DeviceDefinitionUdiDeviceIdentifierComponent addUdiDeviceIdentifier() { //3
2884          DeviceDefinitionUdiDeviceIdentifierComponent t = new DeviceDefinitionUdiDeviceIdentifierComponent();
2885          if (this.udiDeviceIdentifier == null)
2886            this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
2887          this.udiDeviceIdentifier.add(t);
2888          return t;
2889        }
2890
2891        public DeviceDefinitionPackagingComponent addUdiDeviceIdentifier(DeviceDefinitionUdiDeviceIdentifierComponent t) { //3
2892          if (t == null)
2893            return this;
2894          if (this.udiDeviceIdentifier == null)
2895            this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
2896          this.udiDeviceIdentifier.add(t);
2897          return this;
2898        }
2899
2900        /**
2901         * @return The first repetition of repeating field {@link #udiDeviceIdentifier}, creating it if it does not already exist {3}
2902         */
2903        public DeviceDefinitionUdiDeviceIdentifierComponent getUdiDeviceIdentifierFirstRep() { 
2904          if (getUdiDeviceIdentifier().isEmpty()) {
2905            addUdiDeviceIdentifier();
2906          }
2907          return getUdiDeviceIdentifier().get(0);
2908        }
2909
2910        /**
2911         * @return {@link #packaging} (Allows packages within packages.)
2912         */
2913        public List<DeviceDefinitionPackagingComponent> getPackaging() { 
2914          if (this.packaging == null)
2915            this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
2916          return this.packaging;
2917        }
2918
2919        /**
2920         * @return Returns a reference to <code>this</code> for easy method chaining
2921         */
2922        public DeviceDefinitionPackagingComponent setPackaging(List<DeviceDefinitionPackagingComponent> thePackaging) { 
2923          this.packaging = thePackaging;
2924          return this;
2925        }
2926
2927        public boolean hasPackaging() { 
2928          if (this.packaging == null)
2929            return false;
2930          for (DeviceDefinitionPackagingComponent item : this.packaging)
2931            if (!item.isEmpty())
2932              return true;
2933          return false;
2934        }
2935
2936        public DeviceDefinitionPackagingComponent addPackaging() { //3
2937          DeviceDefinitionPackagingComponent t = new DeviceDefinitionPackagingComponent();
2938          if (this.packaging == null)
2939            this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
2940          this.packaging.add(t);
2941          return t;
2942        }
2943
2944        public DeviceDefinitionPackagingComponent addPackaging(DeviceDefinitionPackagingComponent t) { //3
2945          if (t == null)
2946            return this;
2947          if (this.packaging == null)
2948            this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
2949          this.packaging.add(t);
2950          return this;
2951        }
2952
2953        /**
2954         * @return The first repetition of repeating field {@link #packaging}, creating it if it does not already exist {3}
2955         */
2956        public DeviceDefinitionPackagingComponent getPackagingFirstRep() { 
2957          if (getPackaging().isEmpty()) {
2958            addPackaging();
2959          }
2960          return getPackaging().get(0);
2961        }
2962
2963        protected void listChildren(List<Property> children) {
2964          super.listChildren(children);
2965          children.add(new Property("identifier", "Identifier", "The business identifier of the packaged medication.", 0, 1, identifier));
2966          children.add(new Property("type", "CodeableConcept", "A code that defines the specific type of packaging.", 0, 1, type));
2967          children.add(new Property("count", "integer", "The number of items contained in the package (devices or sub-packages).", 0, 1, count));
2968          children.add(new Property("distributor", "", "An organization that distributes the packaged device.", 0, java.lang.Integer.MAX_VALUE, distributor));
2969          children.add(new Property("udiDeviceIdentifier", "@DeviceDefinition.udiDeviceIdentifier", "Unique Device Identifier (UDI) Barcode string on the packaging.", 0, java.lang.Integer.MAX_VALUE, udiDeviceIdentifier));
2970          children.add(new Property("packaging", "@DeviceDefinition.packaging", "Allows packages within packages.", 0, java.lang.Integer.MAX_VALUE, packaging));
2971        }
2972
2973        @Override
2974        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2975          switch (_hash) {
2976          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The business identifier of the packaged medication.", 0, 1, identifier);
2977          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A code that defines the specific type of packaging.", 0, 1, type);
2978          case 94851343: /*count*/  return new Property("count", "integer", "The number of items contained in the package (devices or sub-packages).", 0, 1, count);
2979          case 1334482919: /*distributor*/  return new Property("distributor", "", "An organization that distributes the packaged device.", 0, java.lang.Integer.MAX_VALUE, distributor);
2980          case -99121287: /*udiDeviceIdentifier*/  return new Property("udiDeviceIdentifier", "@DeviceDefinition.udiDeviceIdentifier", "Unique Device Identifier (UDI) Barcode string on the packaging.", 0, java.lang.Integer.MAX_VALUE, udiDeviceIdentifier);
2981          case 1802065795: /*packaging*/  return new Property("packaging", "@DeviceDefinition.packaging", "Allows packages within packages.", 0, java.lang.Integer.MAX_VALUE, packaging);
2982          default: return super.getNamedProperty(_hash, _name, _checkValid);
2983          }
2984
2985        }
2986
2987      @Override
2988      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2989        switch (hash) {
2990        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
2991        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
2992        case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // IntegerType
2993        case 1334482919: /*distributor*/ return this.distributor == null ? new Base[0] : this.distributor.toArray(new Base[this.distributor.size()]); // PackagingDistributorComponent
2994        case -99121287: /*udiDeviceIdentifier*/ return this.udiDeviceIdentifier == null ? new Base[0] : this.udiDeviceIdentifier.toArray(new Base[this.udiDeviceIdentifier.size()]); // DeviceDefinitionUdiDeviceIdentifierComponent
2995        case 1802065795: /*packaging*/ return this.packaging == null ? new Base[0] : this.packaging.toArray(new Base[this.packaging.size()]); // DeviceDefinitionPackagingComponent
2996        default: return super.getProperty(hash, name, checkValid);
2997        }
2998
2999      }
3000
3001      @Override
3002      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3003        switch (hash) {
3004        case -1618432855: // identifier
3005          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
3006          return value;
3007        case 3575610: // type
3008          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3009          return value;
3010        case 94851343: // count
3011          this.count = TypeConvertor.castToInteger(value); // IntegerType
3012          return value;
3013        case 1334482919: // distributor
3014          this.getDistributor().add((PackagingDistributorComponent) value); // PackagingDistributorComponent
3015          return value;
3016        case -99121287: // udiDeviceIdentifier
3017          this.getUdiDeviceIdentifier().add((DeviceDefinitionUdiDeviceIdentifierComponent) value); // DeviceDefinitionUdiDeviceIdentifierComponent
3018          return value;
3019        case 1802065795: // packaging
3020          this.getPackaging().add((DeviceDefinitionPackagingComponent) value); // DeviceDefinitionPackagingComponent
3021          return value;
3022        default: return super.setProperty(hash, name, value);
3023        }
3024
3025      }
3026
3027      @Override
3028      public Base setProperty(String name, Base value) throws FHIRException {
3029        if (name.equals("identifier")) {
3030          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
3031        } else if (name.equals("type")) {
3032          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3033        } else if (name.equals("count")) {
3034          this.count = TypeConvertor.castToInteger(value); // IntegerType
3035        } else if (name.equals("distributor")) {
3036          this.getDistributor().add((PackagingDistributorComponent) value);
3037        } else if (name.equals("udiDeviceIdentifier")) {
3038          this.getUdiDeviceIdentifier().add((DeviceDefinitionUdiDeviceIdentifierComponent) value);
3039        } else if (name.equals("packaging")) {
3040          this.getPackaging().add((DeviceDefinitionPackagingComponent) value);
3041        } else
3042          return super.setProperty(name, value);
3043        return value;
3044      }
3045
3046  @Override
3047  public void removeChild(String name, Base value) throws FHIRException {
3048        if (name.equals("identifier")) {
3049          this.identifier = null;
3050        } else if (name.equals("type")) {
3051          this.type = null;
3052        } else if (name.equals("count")) {
3053          this.count = null;
3054        } else if (name.equals("distributor")) {
3055          this.getDistributor().remove((PackagingDistributorComponent) value);
3056        } else if (name.equals("udiDeviceIdentifier")) {
3057          this.getUdiDeviceIdentifier().remove((DeviceDefinitionUdiDeviceIdentifierComponent) value);
3058        } else if (name.equals("packaging")) {
3059          this.getPackaging().remove((DeviceDefinitionPackagingComponent) value);
3060        } else
3061          super.removeChild(name, value);
3062        
3063      }
3064
3065      @Override
3066      public Base makeProperty(int hash, String name) throws FHIRException {
3067        switch (hash) {
3068        case -1618432855:  return getIdentifier();
3069        case 3575610:  return getType();
3070        case 94851343:  return getCountElement();
3071        case 1334482919:  return addDistributor(); 
3072        case -99121287:  return addUdiDeviceIdentifier(); 
3073        case 1802065795:  return addPackaging(); 
3074        default: return super.makeProperty(hash, name);
3075        }
3076
3077      }
3078
3079      @Override
3080      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3081        switch (hash) {
3082        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3083        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3084        case 94851343: /*count*/ return new String[] {"integer"};
3085        case 1334482919: /*distributor*/ return new String[] {};
3086        case -99121287: /*udiDeviceIdentifier*/ return new String[] {"@DeviceDefinition.udiDeviceIdentifier"};
3087        case 1802065795: /*packaging*/ return new String[] {"@DeviceDefinition.packaging"};
3088        default: return super.getTypesForProperty(hash, name);
3089        }
3090
3091      }
3092
3093      @Override
3094      public Base addChild(String name) throws FHIRException {
3095        if (name.equals("identifier")) {
3096          this.identifier = new Identifier();
3097          return this.identifier;
3098        }
3099        else if (name.equals("type")) {
3100          this.type = new CodeableConcept();
3101          return this.type;
3102        }
3103        else if (name.equals("count")) {
3104          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.packaging.count");
3105        }
3106        else if (name.equals("distributor")) {
3107          return addDistributor();
3108        }
3109        else if (name.equals("udiDeviceIdentifier")) {
3110          return addUdiDeviceIdentifier();
3111        }
3112        else if (name.equals("packaging")) {
3113          return addPackaging();
3114        }
3115        else
3116          return super.addChild(name);
3117      }
3118
3119      public DeviceDefinitionPackagingComponent copy() {
3120        DeviceDefinitionPackagingComponent dst = new DeviceDefinitionPackagingComponent();
3121        copyValues(dst);
3122        return dst;
3123      }
3124
3125      public void copyValues(DeviceDefinitionPackagingComponent dst) {
3126        super.copyValues(dst);
3127        dst.identifier = identifier == null ? null : identifier.copy();
3128        dst.type = type == null ? null : type.copy();
3129        dst.count = count == null ? null : count.copy();
3130        if (distributor != null) {
3131          dst.distributor = new ArrayList<PackagingDistributorComponent>();
3132          for (PackagingDistributorComponent i : distributor)
3133            dst.distributor.add(i.copy());
3134        };
3135        if (udiDeviceIdentifier != null) {
3136          dst.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
3137          for (DeviceDefinitionUdiDeviceIdentifierComponent i : udiDeviceIdentifier)
3138            dst.udiDeviceIdentifier.add(i.copy());
3139        };
3140        if (packaging != null) {
3141          dst.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
3142          for (DeviceDefinitionPackagingComponent i : packaging)
3143            dst.packaging.add(i.copy());
3144        };
3145      }
3146
3147      @Override
3148      public boolean equalsDeep(Base other_) {
3149        if (!super.equalsDeep(other_))
3150          return false;
3151        if (!(other_ instanceof DeviceDefinitionPackagingComponent))
3152          return false;
3153        DeviceDefinitionPackagingComponent o = (DeviceDefinitionPackagingComponent) other_;
3154        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(count, o.count, true)
3155           && compareDeep(distributor, o.distributor, true) && compareDeep(udiDeviceIdentifier, o.udiDeviceIdentifier, true)
3156           && compareDeep(packaging, o.packaging, true);
3157      }
3158
3159      @Override
3160      public boolean equalsShallow(Base other_) {
3161        if (!super.equalsShallow(other_))
3162          return false;
3163        if (!(other_ instanceof DeviceDefinitionPackagingComponent))
3164          return false;
3165        DeviceDefinitionPackagingComponent o = (DeviceDefinitionPackagingComponent) other_;
3166        return compareValues(count, o.count, true);
3167      }
3168
3169      public boolean isEmpty() {
3170        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, count
3171          , distributor, udiDeviceIdentifier, packaging);
3172      }
3173
3174  public String fhirType() {
3175    return "DeviceDefinition.packaging";
3176
3177  }
3178
3179  }
3180
3181    @Block()
3182    public static class PackagingDistributorComponent extends BackboneElement implements IBaseBackboneElement {
3183        /**
3184         * Distributor's human-readable name.
3185         */
3186        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
3187        @Description(shortDefinition="Distributor's human-readable name", formalDefinition="Distributor's human-readable name." )
3188        protected StringType name;
3189
3190        /**
3191         * Distributor as an Organization resource.
3192         */
3193        @Child(name = "organizationReference", type = {Organization.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3194        @Description(shortDefinition="Distributor as an Organization resource", formalDefinition="Distributor as an Organization resource." )
3195        protected List<Reference> organizationReference;
3196
3197        private static final long serialVersionUID = 1587433419L;
3198
3199    /**
3200     * Constructor
3201     */
3202      public PackagingDistributorComponent() {
3203        super();
3204      }
3205
3206        /**
3207         * @return {@link #name} (Distributor's human-readable name.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
3208         */
3209        public StringType getNameElement() { 
3210          if (this.name == null)
3211            if (Configuration.errorOnAutoCreate())
3212              throw new Error("Attempt to auto-create PackagingDistributorComponent.name");
3213            else if (Configuration.doAutoCreate())
3214              this.name = new StringType(); // bb
3215          return this.name;
3216        }
3217
3218        public boolean hasNameElement() { 
3219          return this.name != null && !this.name.isEmpty();
3220        }
3221
3222        public boolean hasName() { 
3223          return this.name != null && !this.name.isEmpty();
3224        }
3225
3226        /**
3227         * @param value {@link #name} (Distributor's human-readable name.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
3228         */
3229        public PackagingDistributorComponent setNameElement(StringType value) { 
3230          this.name = value;
3231          return this;
3232        }
3233
3234        /**
3235         * @return Distributor's human-readable name.
3236         */
3237        public String getName() { 
3238          return this.name == null ? null : this.name.getValue();
3239        }
3240
3241        /**
3242         * @param value Distributor's human-readable name.
3243         */
3244        public PackagingDistributorComponent setName(String value) { 
3245          if (Utilities.noString(value))
3246            this.name = null;
3247          else {
3248            if (this.name == null)
3249              this.name = new StringType();
3250            this.name.setValue(value);
3251          }
3252          return this;
3253        }
3254
3255        /**
3256         * @return {@link #organizationReference} (Distributor as an Organization resource.)
3257         */
3258        public List<Reference> getOrganizationReference() { 
3259          if (this.organizationReference == null)
3260            this.organizationReference = new ArrayList<Reference>();
3261          return this.organizationReference;
3262        }
3263
3264        /**
3265         * @return Returns a reference to <code>this</code> for easy method chaining
3266         */
3267        public PackagingDistributorComponent setOrganizationReference(List<Reference> theOrganizationReference) { 
3268          this.organizationReference = theOrganizationReference;
3269          return this;
3270        }
3271
3272        public boolean hasOrganizationReference() { 
3273          if (this.organizationReference == null)
3274            return false;
3275          for (Reference item : this.organizationReference)
3276            if (!item.isEmpty())
3277              return true;
3278          return false;
3279        }
3280
3281        public Reference addOrganizationReference() { //3
3282          Reference t = new Reference();
3283          if (this.organizationReference == null)
3284            this.organizationReference = new ArrayList<Reference>();
3285          this.organizationReference.add(t);
3286          return t;
3287        }
3288
3289        public PackagingDistributorComponent addOrganizationReference(Reference t) { //3
3290          if (t == null)
3291            return this;
3292          if (this.organizationReference == null)
3293            this.organizationReference = new ArrayList<Reference>();
3294          this.organizationReference.add(t);
3295          return this;
3296        }
3297
3298        /**
3299         * @return The first repetition of repeating field {@link #organizationReference}, creating it if it does not already exist {3}
3300         */
3301        public Reference getOrganizationReferenceFirstRep() { 
3302          if (getOrganizationReference().isEmpty()) {
3303            addOrganizationReference();
3304          }
3305          return getOrganizationReference().get(0);
3306        }
3307
3308        protected void listChildren(List<Property> children) {
3309          super.listChildren(children);
3310          children.add(new Property("name", "string", "Distributor's human-readable name.", 0, 1, name));
3311          children.add(new Property("organizationReference", "Reference(Organization)", "Distributor as an Organization resource.", 0, java.lang.Integer.MAX_VALUE, organizationReference));
3312        }
3313
3314        @Override
3315        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3316          switch (_hash) {
3317          case 3373707: /*name*/  return new Property("name", "string", "Distributor's human-readable name.", 0, 1, name);
3318          case 1860475736: /*organizationReference*/  return new Property("organizationReference", "Reference(Organization)", "Distributor as an Organization resource.", 0, java.lang.Integer.MAX_VALUE, organizationReference);
3319          default: return super.getNamedProperty(_hash, _name, _checkValid);
3320          }
3321
3322        }
3323
3324      @Override
3325      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3326        switch (hash) {
3327        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
3328        case 1860475736: /*organizationReference*/ return this.organizationReference == null ? new Base[0] : this.organizationReference.toArray(new Base[this.organizationReference.size()]); // Reference
3329        default: return super.getProperty(hash, name, checkValid);
3330        }
3331
3332      }
3333
3334      @Override
3335      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3336        switch (hash) {
3337        case 3373707: // name
3338          this.name = TypeConvertor.castToString(value); // StringType
3339          return value;
3340        case 1860475736: // organizationReference
3341          this.getOrganizationReference().add(TypeConvertor.castToReference(value)); // Reference
3342          return value;
3343        default: return super.setProperty(hash, name, value);
3344        }
3345
3346      }
3347
3348      @Override
3349      public Base setProperty(String name, Base value) throws FHIRException {
3350        if (name.equals("name")) {
3351          this.name = TypeConvertor.castToString(value); // StringType
3352        } else if (name.equals("organizationReference")) {
3353          this.getOrganizationReference().add(TypeConvertor.castToReference(value));
3354        } else
3355          return super.setProperty(name, value);
3356        return value;
3357      }
3358
3359  @Override
3360  public void removeChild(String name, Base value) throws FHIRException {
3361        if (name.equals("name")) {
3362          this.name = null;
3363        } else if (name.equals("organizationReference")) {
3364          this.getOrganizationReference().remove(value);
3365        } else
3366          super.removeChild(name, value);
3367        
3368      }
3369
3370      @Override
3371      public Base makeProperty(int hash, String name) throws FHIRException {
3372        switch (hash) {
3373        case 3373707:  return getNameElement();
3374        case 1860475736:  return addOrganizationReference(); 
3375        default: return super.makeProperty(hash, name);
3376        }
3377
3378      }
3379
3380      @Override
3381      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3382        switch (hash) {
3383        case 3373707: /*name*/ return new String[] {"string"};
3384        case 1860475736: /*organizationReference*/ return new String[] {"Reference"};
3385        default: return super.getTypesForProperty(hash, name);
3386        }
3387
3388      }
3389
3390      @Override
3391      public Base addChild(String name) throws FHIRException {
3392        if (name.equals("name")) {
3393          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.packaging.distributor.name");
3394        }
3395        else if (name.equals("organizationReference")) {
3396          return addOrganizationReference();
3397        }
3398        else
3399          return super.addChild(name);
3400      }
3401
3402      public PackagingDistributorComponent copy() {
3403        PackagingDistributorComponent dst = new PackagingDistributorComponent();
3404        copyValues(dst);
3405        return dst;
3406      }
3407
3408      public void copyValues(PackagingDistributorComponent dst) {
3409        super.copyValues(dst);
3410        dst.name = name == null ? null : name.copy();
3411        if (organizationReference != null) {
3412          dst.organizationReference = new ArrayList<Reference>();
3413          for (Reference i : organizationReference)
3414            dst.organizationReference.add(i.copy());
3415        };
3416      }
3417
3418      @Override
3419      public boolean equalsDeep(Base other_) {
3420        if (!super.equalsDeep(other_))
3421          return false;
3422        if (!(other_ instanceof PackagingDistributorComponent))
3423          return false;
3424        PackagingDistributorComponent o = (PackagingDistributorComponent) other_;
3425        return compareDeep(name, o.name, true) && compareDeep(organizationReference, o.organizationReference, true)
3426          ;
3427      }
3428
3429      @Override
3430      public boolean equalsShallow(Base other_) {
3431        if (!super.equalsShallow(other_))
3432          return false;
3433        if (!(other_ instanceof PackagingDistributorComponent))
3434          return false;
3435        PackagingDistributorComponent o = (PackagingDistributorComponent) other_;
3436        return compareValues(name, o.name, true);
3437      }
3438
3439      public boolean isEmpty() {
3440        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, organizationReference
3441          );
3442      }
3443
3444  public String fhirType() {
3445    return "DeviceDefinition.packaging.distributor";
3446
3447  }
3448
3449  }
3450
3451    @Block()
3452    public static class DeviceDefinitionVersionComponent extends BackboneElement implements IBaseBackboneElement {
3453        /**
3454         * The type of the device version, e.g. manufacturer, approved, internal.
3455         */
3456        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
3457        @Description(shortDefinition="The type of the device version, e.g. manufacturer, approved, internal", formalDefinition="The type of the device version, e.g. manufacturer, approved, internal." )
3458        protected CodeableConcept type;
3459
3460        /**
3461         * The hardware or software module of the device to which the version applies.
3462         */
3463        @Child(name = "component", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=false)
3464        @Description(shortDefinition="The hardware or software module of the device to which the version applies", formalDefinition="The hardware or software module of the device to which the version applies." )
3465        protected Identifier component;
3466
3467        /**
3468         * The version text.
3469         */
3470        @Child(name = "value", type = {StringType.class}, order=3, min=1, max=1, modifier=false, summary=false)
3471        @Description(shortDefinition="The version text", formalDefinition="The version text." )
3472        protected StringType value;
3473
3474        private static final long serialVersionUID = 645214295L;
3475
3476    /**
3477     * Constructor
3478     */
3479      public DeviceDefinitionVersionComponent() {
3480        super();
3481      }
3482
3483    /**
3484     * Constructor
3485     */
3486      public DeviceDefinitionVersionComponent(String value) {
3487        super();
3488        this.setValue(value);
3489      }
3490
3491        /**
3492         * @return {@link #type} (The type of the device version, e.g. manufacturer, approved, internal.)
3493         */
3494        public CodeableConcept getType() { 
3495          if (this.type == null)
3496            if (Configuration.errorOnAutoCreate())
3497              throw new Error("Attempt to auto-create DeviceDefinitionVersionComponent.type");
3498            else if (Configuration.doAutoCreate())
3499              this.type = new CodeableConcept(); // cc
3500          return this.type;
3501        }
3502
3503        public boolean hasType() { 
3504          return this.type != null && !this.type.isEmpty();
3505        }
3506
3507        /**
3508         * @param value {@link #type} (The type of the device version, e.g. manufacturer, approved, internal.)
3509         */
3510        public DeviceDefinitionVersionComponent setType(CodeableConcept value) { 
3511          this.type = value;
3512          return this;
3513        }
3514
3515        /**
3516         * @return {@link #component} (The hardware or software module of the device to which the version applies.)
3517         */
3518        public Identifier getComponent() { 
3519          if (this.component == null)
3520            if (Configuration.errorOnAutoCreate())
3521              throw new Error("Attempt to auto-create DeviceDefinitionVersionComponent.component");
3522            else if (Configuration.doAutoCreate())
3523              this.component = new Identifier(); // cc
3524          return this.component;
3525        }
3526
3527        public boolean hasComponent() { 
3528          return this.component != null && !this.component.isEmpty();
3529        }
3530
3531        /**
3532         * @param value {@link #component} (The hardware or software module of the device to which the version applies.)
3533         */
3534        public DeviceDefinitionVersionComponent setComponent(Identifier value) { 
3535          this.component = value;
3536          return this;
3537        }
3538
3539        /**
3540         * @return {@link #value} (The version text.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
3541         */
3542        public StringType getValueElement() { 
3543          if (this.value == null)
3544            if (Configuration.errorOnAutoCreate())
3545              throw new Error("Attempt to auto-create DeviceDefinitionVersionComponent.value");
3546            else if (Configuration.doAutoCreate())
3547              this.value = new StringType(); // bb
3548          return this.value;
3549        }
3550
3551        public boolean hasValueElement() { 
3552          return this.value != null && !this.value.isEmpty();
3553        }
3554
3555        public boolean hasValue() { 
3556          return this.value != null && !this.value.isEmpty();
3557        }
3558
3559        /**
3560         * @param value {@link #value} (The version text.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
3561         */
3562        public DeviceDefinitionVersionComponent setValueElement(StringType value) { 
3563          this.value = value;
3564          return this;
3565        }
3566
3567        /**
3568         * @return The version text.
3569         */
3570        public String getValue() { 
3571          return this.value == null ? null : this.value.getValue();
3572        }
3573
3574        /**
3575         * @param value The version text.
3576         */
3577        public DeviceDefinitionVersionComponent setValue(String value) { 
3578            if (this.value == null)
3579              this.value = new StringType();
3580            this.value.setValue(value);
3581          return this;
3582        }
3583
3584        protected void listChildren(List<Property> children) {
3585          super.listChildren(children);
3586          children.add(new Property("type", "CodeableConcept", "The type of the device version, e.g. manufacturer, approved, internal.", 0, 1, type));
3587          children.add(new Property("component", "Identifier", "The hardware or software module of the device to which the version applies.", 0, 1, component));
3588          children.add(new Property("value", "string", "The version text.", 0, 1, value));
3589        }
3590
3591        @Override
3592        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3593          switch (_hash) {
3594          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The type of the device version, e.g. manufacturer, approved, internal.", 0, 1, type);
3595          case -1399907075: /*component*/  return new Property("component", "Identifier", "The hardware or software module of the device to which the version applies.", 0, 1, component);
3596          case 111972721: /*value*/  return new Property("value", "string", "The version text.", 0, 1, value);
3597          default: return super.getNamedProperty(_hash, _name, _checkValid);
3598          }
3599
3600        }
3601
3602      @Override
3603      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3604        switch (hash) {
3605        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3606        case -1399907075: /*component*/ return this.component == null ? new Base[0] : new Base[] {this.component}; // Identifier
3607        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
3608        default: return super.getProperty(hash, name, checkValid);
3609        }
3610
3611      }
3612
3613      @Override
3614      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3615        switch (hash) {
3616        case 3575610: // type
3617          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3618          return value;
3619        case -1399907075: // component
3620          this.component = TypeConvertor.castToIdentifier(value); // Identifier
3621          return value;
3622        case 111972721: // value
3623          this.value = TypeConvertor.castToString(value); // StringType
3624          return value;
3625        default: return super.setProperty(hash, name, value);
3626        }
3627
3628      }
3629
3630      @Override
3631      public Base setProperty(String name, Base value) throws FHIRException {
3632        if (name.equals("type")) {
3633          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3634        } else if (name.equals("component")) {
3635          this.component = TypeConvertor.castToIdentifier(value); // Identifier
3636        } else if (name.equals("value")) {
3637          this.value = TypeConvertor.castToString(value); // StringType
3638        } else
3639          return super.setProperty(name, value);
3640        return value;
3641      }
3642
3643  @Override
3644  public void removeChild(String name, Base value) throws FHIRException {
3645        if (name.equals("type")) {
3646          this.type = null;
3647        } else if (name.equals("component")) {
3648          this.component = null;
3649        } else if (name.equals("value")) {
3650          this.value = null;
3651        } else
3652          super.removeChild(name, value);
3653        
3654      }
3655
3656      @Override
3657      public Base makeProperty(int hash, String name) throws FHIRException {
3658        switch (hash) {
3659        case 3575610:  return getType();
3660        case -1399907075:  return getComponent();
3661        case 111972721:  return getValueElement();
3662        default: return super.makeProperty(hash, name);
3663        }
3664
3665      }
3666
3667      @Override
3668      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3669        switch (hash) {
3670        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3671        case -1399907075: /*component*/ return new String[] {"Identifier"};
3672        case 111972721: /*value*/ return new String[] {"string"};
3673        default: return super.getTypesForProperty(hash, name);
3674        }
3675
3676      }
3677
3678      @Override
3679      public Base addChild(String name) throws FHIRException {
3680        if (name.equals("type")) {
3681          this.type = new CodeableConcept();
3682          return this.type;
3683        }
3684        else if (name.equals("component")) {
3685          this.component = new Identifier();
3686          return this.component;
3687        }
3688        else if (name.equals("value")) {
3689          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.version.value");
3690        }
3691        else
3692          return super.addChild(name);
3693      }
3694
3695      public DeviceDefinitionVersionComponent copy() {
3696        DeviceDefinitionVersionComponent dst = new DeviceDefinitionVersionComponent();
3697        copyValues(dst);
3698        return dst;
3699      }
3700
3701      public void copyValues(DeviceDefinitionVersionComponent dst) {
3702        super.copyValues(dst);
3703        dst.type = type == null ? null : type.copy();
3704        dst.component = component == null ? null : component.copy();
3705        dst.value = value == null ? null : value.copy();
3706      }
3707
3708      @Override
3709      public boolean equalsDeep(Base other_) {
3710        if (!super.equalsDeep(other_))
3711          return false;
3712        if (!(other_ instanceof DeviceDefinitionVersionComponent))
3713          return false;
3714        DeviceDefinitionVersionComponent o = (DeviceDefinitionVersionComponent) other_;
3715        return compareDeep(type, o.type, true) && compareDeep(component, o.component, true) && compareDeep(value, o.value, true)
3716          ;
3717      }
3718
3719      @Override
3720      public boolean equalsShallow(Base other_) {
3721        if (!super.equalsShallow(other_))
3722          return false;
3723        if (!(other_ instanceof DeviceDefinitionVersionComponent))
3724          return false;
3725        DeviceDefinitionVersionComponent o = (DeviceDefinitionVersionComponent) other_;
3726        return compareValues(value, o.value, true);
3727      }
3728
3729      public boolean isEmpty() {
3730        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, component, value);
3731      }
3732
3733  public String fhirType() {
3734    return "DeviceDefinition.version";
3735
3736  }
3737
3738  }
3739
3740    @Block()
3741    public static class DeviceDefinitionPropertyComponent extends BackboneElement implements IBaseBackboneElement {
3742        /**
3743         * Code that specifies the property such as a resolution or color being represented.
3744         */
3745        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
3746        @Description(shortDefinition="Code that specifies the property being represented", formalDefinition="Code that specifies the property such as a resolution or color being represented." )
3747        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-property-type")
3748        protected CodeableConcept type;
3749
3750        /**
3751         * The value of the property specified by the associated property.type code.
3752         */
3753        @Child(name = "value", type = {Quantity.class, CodeableConcept.class, StringType.class, BooleanType.class, IntegerType.class, Range.class, Attachment.class}, order=2, min=1, max=1, modifier=false, summary=false)
3754        @Description(shortDefinition="Value of the property", formalDefinition="The value of the property specified by the associated property.type code." )
3755        protected DataType value;
3756
3757        private static final long serialVersionUID = -1659186716L;
3758
3759    /**
3760     * Constructor
3761     */
3762      public DeviceDefinitionPropertyComponent() {
3763        super();
3764      }
3765
3766    /**
3767     * Constructor
3768     */
3769      public DeviceDefinitionPropertyComponent(CodeableConcept type, DataType value) {
3770        super();
3771        this.setType(type);
3772        this.setValue(value);
3773      }
3774
3775        /**
3776         * @return {@link #type} (Code that specifies the property such as a resolution or color being represented.)
3777         */
3778        public CodeableConcept getType() { 
3779          if (this.type == null)
3780            if (Configuration.errorOnAutoCreate())
3781              throw new Error("Attempt to auto-create DeviceDefinitionPropertyComponent.type");
3782            else if (Configuration.doAutoCreate())
3783              this.type = new CodeableConcept(); // cc
3784          return this.type;
3785        }
3786
3787        public boolean hasType() { 
3788          return this.type != null && !this.type.isEmpty();
3789        }
3790
3791        /**
3792         * @param value {@link #type} (Code that specifies the property such as a resolution or color being represented.)
3793         */
3794        public DeviceDefinitionPropertyComponent setType(CodeableConcept value) { 
3795          this.type = value;
3796          return this;
3797        }
3798
3799        /**
3800         * @return {@link #value} (The value of the property specified by the associated property.type code.)
3801         */
3802        public DataType getValue() { 
3803          return this.value;
3804        }
3805
3806        /**
3807         * @return {@link #value} (The value of the property specified by the associated property.type code.)
3808         */
3809        public Quantity getValueQuantity() throws FHIRException { 
3810          if (this.value == null)
3811            this.value = new Quantity();
3812          if (!(this.value instanceof Quantity))
3813            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
3814          return (Quantity) this.value;
3815        }
3816
3817        public boolean hasValueQuantity() { 
3818          return this != null && this.value instanceof Quantity;
3819        }
3820
3821        /**
3822         * @return {@link #value} (The value of the property specified by the associated property.type code.)
3823         */
3824        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
3825          if (this.value == null)
3826            this.value = new CodeableConcept();
3827          if (!(this.value instanceof CodeableConcept))
3828            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
3829          return (CodeableConcept) this.value;
3830        }
3831
3832        public boolean hasValueCodeableConcept() { 
3833          return this != null && this.value instanceof CodeableConcept;
3834        }
3835
3836        /**
3837         * @return {@link #value} (The value of the property specified by the associated property.type code.)
3838         */
3839        public StringType getValueStringType() throws FHIRException { 
3840          if (this.value == null)
3841            this.value = new StringType();
3842          if (!(this.value instanceof StringType))
3843            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.value.getClass().getName()+" was encountered");
3844          return (StringType) this.value;
3845        }
3846
3847        public boolean hasValueStringType() { 
3848          return this != null && this.value instanceof StringType;
3849        }
3850
3851        /**
3852         * @return {@link #value} (The value of the property specified by the associated property.type code.)
3853         */
3854        public BooleanType getValueBooleanType() throws FHIRException { 
3855          if (this.value == null)
3856            this.value = new BooleanType();
3857          if (!(this.value instanceof BooleanType))
3858            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
3859          return (BooleanType) this.value;
3860        }
3861
3862        public boolean hasValueBooleanType() { 
3863          return this != null && this.value instanceof BooleanType;
3864        }
3865
3866        /**
3867         * @return {@link #value} (The value of the property specified by the associated property.type code.)
3868         */
3869        public IntegerType getValueIntegerType() throws FHIRException { 
3870          if (this.value == null)
3871            this.value = new IntegerType();
3872          if (!(this.value instanceof IntegerType))
3873            throw new FHIRException("Type mismatch: the type IntegerType was expected, but "+this.value.getClass().getName()+" was encountered");
3874          return (IntegerType) this.value;
3875        }
3876
3877        public boolean hasValueIntegerType() { 
3878          return this != null && this.value instanceof IntegerType;
3879        }
3880
3881        /**
3882         * @return {@link #value} (The value of the property specified by the associated property.type code.)
3883         */
3884        public Range getValueRange() throws FHIRException { 
3885          if (this.value == null)
3886            this.value = new Range();
3887          if (!(this.value instanceof Range))
3888            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.value.getClass().getName()+" was encountered");
3889          return (Range) this.value;
3890        }
3891
3892        public boolean hasValueRange() { 
3893          return this != null && this.value instanceof Range;
3894        }
3895
3896        /**
3897         * @return {@link #value} (The value of the property specified by the associated property.type code.)
3898         */
3899        public Attachment getValueAttachment() throws FHIRException { 
3900          if (this.value == null)
3901            this.value = new Attachment();
3902          if (!(this.value instanceof Attachment))
3903            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
3904          return (Attachment) this.value;
3905        }
3906
3907        public boolean hasValueAttachment() { 
3908          return this != null && this.value instanceof Attachment;
3909        }
3910
3911        public boolean hasValue() { 
3912          return this.value != null && !this.value.isEmpty();
3913        }
3914
3915        /**
3916         * @param value {@link #value} (The value of the property specified by the associated property.type code.)
3917         */
3918        public DeviceDefinitionPropertyComponent setValue(DataType value) { 
3919          if (value != null && !(value instanceof Quantity || value instanceof CodeableConcept || value instanceof StringType || value instanceof BooleanType || value instanceof IntegerType || value instanceof Range || value instanceof Attachment))
3920            throw new FHIRException("Not the right type for DeviceDefinition.property.value[x]: "+value.fhirType());
3921          this.value = value;
3922          return this;
3923        }
3924
3925        protected void listChildren(List<Property> children) {
3926          super.listChildren(children);
3927          children.add(new Property("type", "CodeableConcept", "Code that specifies the property such as a resolution or color being represented.", 0, 1, type));
3928          children.add(new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Attachment", "The value of the property specified by the associated property.type code.", 0, 1, value));
3929        }
3930
3931        @Override
3932        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3933          switch (_hash) {
3934          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Code that specifies the property such as a resolution or color being represented.", 0, 1, type);
3935          case -1410166417: /*value[x]*/  return new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Attachment", "The value of the property specified by the associated property.type code.", 0, 1, value);
3936          case 111972721: /*value*/  return new Property("value[x]", "Quantity|CodeableConcept|string|boolean|integer|Range|Attachment", "The value of the property specified by the associated property.type code.", 0, 1, value);
3937          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "The value of the property specified by the associated property.type code.", 0, 1, value);
3938          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "CodeableConcept", "The value of the property specified by the associated property.type code.", 0, 1, value);
3939          case -1424603934: /*valueString*/  return new Property("value[x]", "string", "The value of the property specified by the associated property.type code.", 0, 1, value);
3940          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "The value of the property specified by the associated property.type code.", 0, 1, value);
3941          case -1668204915: /*valueInteger*/  return new Property("value[x]", "integer", "The value of the property specified by the associated property.type code.", 0, 1, value);
3942          case 2030761548: /*valueRange*/  return new Property("value[x]", "Range", "The value of the property specified by the associated property.type code.", 0, 1, value);
3943          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "The value of the property specified by the associated property.type code.", 0, 1, value);
3944          default: return super.getNamedProperty(_hash, _name, _checkValid);
3945          }
3946
3947        }
3948
3949      @Override
3950      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3951        switch (hash) {
3952        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3953        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
3954        default: return super.getProperty(hash, name, checkValid);
3955        }
3956
3957      }
3958
3959      @Override
3960      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3961        switch (hash) {
3962        case 3575610: // type
3963          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3964          return value;
3965        case 111972721: // value
3966          this.value = TypeConvertor.castToType(value); // DataType
3967          return value;
3968        default: return super.setProperty(hash, name, value);
3969        }
3970
3971      }
3972
3973      @Override
3974      public Base setProperty(String name, Base value) throws FHIRException {
3975        if (name.equals("type")) {
3976          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3977        } else if (name.equals("value[x]")) {
3978          this.value = TypeConvertor.castToType(value); // DataType
3979        } else
3980          return super.setProperty(name, value);
3981        return value;
3982      }
3983
3984  @Override
3985  public void removeChild(String name, Base value) throws FHIRException {
3986        if (name.equals("type")) {
3987          this.type = null;
3988        } else if (name.equals("value[x]")) {
3989          this.value = null;
3990        } else
3991          super.removeChild(name, value);
3992        
3993      }
3994
3995      @Override
3996      public Base makeProperty(int hash, String name) throws FHIRException {
3997        switch (hash) {
3998        case 3575610:  return getType();
3999        case -1410166417:  return getValue();
4000        case 111972721:  return getValue();
4001        default: return super.makeProperty(hash, name);
4002        }
4003
4004      }
4005
4006      @Override
4007      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4008        switch (hash) {
4009        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
4010        case 111972721: /*value*/ return new String[] {"Quantity", "CodeableConcept", "string", "boolean", "integer", "Range", "Attachment"};
4011        default: return super.getTypesForProperty(hash, name);
4012        }
4013
4014      }
4015
4016      @Override
4017      public Base addChild(String name) throws FHIRException {
4018        if (name.equals("type")) {
4019          this.type = new CodeableConcept();
4020          return this.type;
4021        }
4022        else if (name.equals("valueQuantity")) {
4023          this.value = new Quantity();
4024          return this.value;
4025        }
4026        else if (name.equals("valueCodeableConcept")) {
4027          this.value = new CodeableConcept();
4028          return this.value;
4029        }
4030        else if (name.equals("valueString")) {
4031          this.value = new StringType();
4032          return this.value;
4033        }
4034        else if (name.equals("valueBoolean")) {
4035          this.value = new BooleanType();
4036          return this.value;
4037        }
4038        else if (name.equals("valueInteger")) {
4039          this.value = new IntegerType();
4040          return this.value;
4041        }
4042        else if (name.equals("valueRange")) {
4043          this.value = new Range();
4044          return this.value;
4045        }
4046        else if (name.equals("valueAttachment")) {
4047          this.value = new Attachment();
4048          return this.value;
4049        }
4050        else
4051          return super.addChild(name);
4052      }
4053
4054      public DeviceDefinitionPropertyComponent copy() {
4055        DeviceDefinitionPropertyComponent dst = new DeviceDefinitionPropertyComponent();
4056        copyValues(dst);
4057        return dst;
4058      }
4059
4060      public void copyValues(DeviceDefinitionPropertyComponent dst) {
4061        super.copyValues(dst);
4062        dst.type = type == null ? null : type.copy();
4063        dst.value = value == null ? null : value.copy();
4064      }
4065
4066      @Override
4067      public boolean equalsDeep(Base other_) {
4068        if (!super.equalsDeep(other_))
4069          return false;
4070        if (!(other_ instanceof DeviceDefinitionPropertyComponent))
4071          return false;
4072        DeviceDefinitionPropertyComponent o = (DeviceDefinitionPropertyComponent) other_;
4073        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
4074      }
4075
4076      @Override
4077      public boolean equalsShallow(Base other_) {
4078        if (!super.equalsShallow(other_))
4079          return false;
4080        if (!(other_ instanceof DeviceDefinitionPropertyComponent))
4081          return false;
4082        DeviceDefinitionPropertyComponent o = (DeviceDefinitionPropertyComponent) other_;
4083        return true;
4084      }
4085
4086      public boolean isEmpty() {
4087        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
4088      }
4089
4090  public String fhirType() {
4091    return "DeviceDefinition.property";
4092
4093  }
4094
4095  }
4096
4097    @Block()
4098    public static class DeviceDefinitionLinkComponent extends BackboneElement implements IBaseBackboneElement {
4099        /**
4100         * The type indicates the relationship of the related device to the device instance.
4101         */
4102        @Child(name = "relation", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=false)
4103        @Description(shortDefinition="The type indicates the relationship of the related device to the device instance", formalDefinition="The type indicates the relationship of the related device to the device instance." )
4104        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/devicedefinition-relationtype")
4105        protected Coding relation;
4106
4107        /**
4108         * A reference to the linked device.
4109         */
4110        @Child(name = "relatedDevice", type = {CodeableReference.class}, order=2, min=1, max=1, modifier=false, summary=false)
4111        @Description(shortDefinition="A reference to the linked device", formalDefinition="A reference to the linked device." )
4112        protected CodeableReference relatedDevice;
4113
4114        private static final long serialVersionUID = 627614461L;
4115
4116    /**
4117     * Constructor
4118     */
4119      public DeviceDefinitionLinkComponent() {
4120        super();
4121      }
4122
4123    /**
4124     * Constructor
4125     */
4126      public DeviceDefinitionLinkComponent(Coding relation, CodeableReference relatedDevice) {
4127        super();
4128        this.setRelation(relation);
4129        this.setRelatedDevice(relatedDevice);
4130      }
4131
4132        /**
4133         * @return {@link #relation} (The type indicates the relationship of the related device to the device instance.)
4134         */
4135        public Coding getRelation() { 
4136          if (this.relation == null)
4137            if (Configuration.errorOnAutoCreate())
4138              throw new Error("Attempt to auto-create DeviceDefinitionLinkComponent.relation");
4139            else if (Configuration.doAutoCreate())
4140              this.relation = new Coding(); // cc
4141          return this.relation;
4142        }
4143
4144        public boolean hasRelation() { 
4145          return this.relation != null && !this.relation.isEmpty();
4146        }
4147
4148        /**
4149         * @param value {@link #relation} (The type indicates the relationship of the related device to the device instance.)
4150         */
4151        public DeviceDefinitionLinkComponent setRelation(Coding value) { 
4152          this.relation = value;
4153          return this;
4154        }
4155
4156        /**
4157         * @return {@link #relatedDevice} (A reference to the linked device.)
4158         */
4159        public CodeableReference getRelatedDevice() { 
4160          if (this.relatedDevice == null)
4161            if (Configuration.errorOnAutoCreate())
4162              throw new Error("Attempt to auto-create DeviceDefinitionLinkComponent.relatedDevice");
4163            else if (Configuration.doAutoCreate())
4164              this.relatedDevice = new CodeableReference(); // cc
4165          return this.relatedDevice;
4166        }
4167
4168        public boolean hasRelatedDevice() { 
4169          return this.relatedDevice != null && !this.relatedDevice.isEmpty();
4170        }
4171
4172        /**
4173         * @param value {@link #relatedDevice} (A reference to the linked device.)
4174         */
4175        public DeviceDefinitionLinkComponent setRelatedDevice(CodeableReference value) { 
4176          this.relatedDevice = value;
4177          return this;
4178        }
4179
4180        protected void listChildren(List<Property> children) {
4181          super.listChildren(children);
4182          children.add(new Property("relation", "Coding", "The type indicates the relationship of the related device to the device instance.", 0, 1, relation));
4183          children.add(new Property("relatedDevice", "CodeableReference(DeviceDefinition)", "A reference to the linked device.", 0, 1, relatedDevice));
4184        }
4185
4186        @Override
4187        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4188          switch (_hash) {
4189          case -554436100: /*relation*/  return new Property("relation", "Coding", "The type indicates the relationship of the related device to the device instance.", 0, 1, relation);
4190          case -296314271: /*relatedDevice*/  return new Property("relatedDevice", "CodeableReference(DeviceDefinition)", "A reference to the linked device.", 0, 1, relatedDevice);
4191          default: return super.getNamedProperty(_hash, _name, _checkValid);
4192          }
4193
4194        }
4195
4196      @Override
4197      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4198        switch (hash) {
4199        case -554436100: /*relation*/ return this.relation == null ? new Base[0] : new Base[] {this.relation}; // Coding
4200        case -296314271: /*relatedDevice*/ return this.relatedDevice == null ? new Base[0] : new Base[] {this.relatedDevice}; // CodeableReference
4201        default: return super.getProperty(hash, name, checkValid);
4202        }
4203
4204      }
4205
4206      @Override
4207      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4208        switch (hash) {
4209        case -554436100: // relation
4210          this.relation = TypeConvertor.castToCoding(value); // Coding
4211          return value;
4212        case -296314271: // relatedDevice
4213          this.relatedDevice = TypeConvertor.castToCodeableReference(value); // CodeableReference
4214          return value;
4215        default: return super.setProperty(hash, name, value);
4216        }
4217
4218      }
4219
4220      @Override
4221      public Base setProperty(String name, Base value) throws FHIRException {
4222        if (name.equals("relation")) {
4223          this.relation = TypeConvertor.castToCoding(value); // Coding
4224        } else if (name.equals("relatedDevice")) {
4225          this.relatedDevice = TypeConvertor.castToCodeableReference(value); // CodeableReference
4226        } else
4227          return super.setProperty(name, value);
4228        return value;
4229      }
4230
4231  @Override
4232  public void removeChild(String name, Base value) throws FHIRException {
4233        if (name.equals("relation")) {
4234          this.relation = null;
4235        } else if (name.equals("relatedDevice")) {
4236          this.relatedDevice = null;
4237        } else
4238          super.removeChild(name, value);
4239        
4240      }
4241
4242      @Override
4243      public Base makeProperty(int hash, String name) throws FHIRException {
4244        switch (hash) {
4245        case -554436100:  return getRelation();
4246        case -296314271:  return getRelatedDevice();
4247        default: return super.makeProperty(hash, name);
4248        }
4249
4250      }
4251
4252      @Override
4253      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4254        switch (hash) {
4255        case -554436100: /*relation*/ return new String[] {"Coding"};
4256        case -296314271: /*relatedDevice*/ return new String[] {"CodeableReference"};
4257        default: return super.getTypesForProperty(hash, name);
4258        }
4259
4260      }
4261
4262      @Override
4263      public Base addChild(String name) throws FHIRException {
4264        if (name.equals("relation")) {
4265          this.relation = new Coding();
4266          return this.relation;
4267        }
4268        else if (name.equals("relatedDevice")) {
4269          this.relatedDevice = new CodeableReference();
4270          return this.relatedDevice;
4271        }
4272        else
4273          return super.addChild(name);
4274      }
4275
4276      public DeviceDefinitionLinkComponent copy() {
4277        DeviceDefinitionLinkComponent dst = new DeviceDefinitionLinkComponent();
4278        copyValues(dst);
4279        return dst;
4280      }
4281
4282      public void copyValues(DeviceDefinitionLinkComponent dst) {
4283        super.copyValues(dst);
4284        dst.relation = relation == null ? null : relation.copy();
4285        dst.relatedDevice = relatedDevice == null ? null : relatedDevice.copy();
4286      }
4287
4288      @Override
4289      public boolean equalsDeep(Base other_) {
4290        if (!super.equalsDeep(other_))
4291          return false;
4292        if (!(other_ instanceof DeviceDefinitionLinkComponent))
4293          return false;
4294        DeviceDefinitionLinkComponent o = (DeviceDefinitionLinkComponent) other_;
4295        return compareDeep(relation, o.relation, true) && compareDeep(relatedDevice, o.relatedDevice, true)
4296          ;
4297      }
4298
4299      @Override
4300      public boolean equalsShallow(Base other_) {
4301        if (!super.equalsShallow(other_))
4302          return false;
4303        if (!(other_ instanceof DeviceDefinitionLinkComponent))
4304          return false;
4305        DeviceDefinitionLinkComponent o = (DeviceDefinitionLinkComponent) other_;
4306        return true;
4307      }
4308
4309      public boolean isEmpty() {
4310        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(relation, relatedDevice);
4311      }
4312
4313  public String fhirType() {
4314    return "DeviceDefinition.link";
4315
4316  }
4317
4318  }
4319
4320    @Block()
4321    public static class DeviceDefinitionMaterialComponent extends BackboneElement implements IBaseBackboneElement {
4322        /**
4323         * A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials.
4324         */
4325        @Child(name = "substance", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
4326        @Description(shortDefinition="A relevant substance that the device contains, may contain, or is made of", formalDefinition="A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials." )
4327        protected CodeableConcept substance;
4328
4329        /**
4330         * Indicates an alternative material of the device.
4331         */
4332        @Child(name = "alternate", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
4333        @Description(shortDefinition="Indicates an alternative material of the device", formalDefinition="Indicates an alternative material of the device." )
4334        protected BooleanType alternate;
4335
4336        /**
4337         * Whether the substance is a known or suspected allergen.
4338         */
4339        @Child(name = "allergenicIndicator", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=false)
4340        @Description(shortDefinition="Whether the substance is a known or suspected allergen", formalDefinition="Whether the substance is a known or suspected allergen." )
4341        protected BooleanType allergenicIndicator;
4342
4343        private static final long serialVersionUID = 1232736508L;
4344
4345    /**
4346     * Constructor
4347     */
4348      public DeviceDefinitionMaterialComponent() {
4349        super();
4350      }
4351
4352    /**
4353     * Constructor
4354     */
4355      public DeviceDefinitionMaterialComponent(CodeableConcept substance) {
4356        super();
4357        this.setSubstance(substance);
4358      }
4359
4360        /**
4361         * @return {@link #substance} (A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials.)
4362         */
4363        public CodeableConcept getSubstance() { 
4364          if (this.substance == null)
4365            if (Configuration.errorOnAutoCreate())
4366              throw new Error("Attempt to auto-create DeviceDefinitionMaterialComponent.substance");
4367            else if (Configuration.doAutoCreate())
4368              this.substance = new CodeableConcept(); // cc
4369          return this.substance;
4370        }
4371
4372        public boolean hasSubstance() { 
4373          return this.substance != null && !this.substance.isEmpty();
4374        }
4375
4376        /**
4377         * @param value {@link #substance} (A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials.)
4378         */
4379        public DeviceDefinitionMaterialComponent setSubstance(CodeableConcept value) { 
4380          this.substance = value;
4381          return this;
4382        }
4383
4384        /**
4385         * @return {@link #alternate} (Indicates an alternative material of the device.). This is the underlying object with id, value and extensions. The accessor "getAlternate" gives direct access to the value
4386         */
4387        public BooleanType getAlternateElement() { 
4388          if (this.alternate == null)
4389            if (Configuration.errorOnAutoCreate())
4390              throw new Error("Attempt to auto-create DeviceDefinitionMaterialComponent.alternate");
4391            else if (Configuration.doAutoCreate())
4392              this.alternate = new BooleanType(); // bb
4393          return this.alternate;
4394        }
4395
4396        public boolean hasAlternateElement() { 
4397          return this.alternate != null && !this.alternate.isEmpty();
4398        }
4399
4400        public boolean hasAlternate() { 
4401          return this.alternate != null && !this.alternate.isEmpty();
4402        }
4403
4404        /**
4405         * @param value {@link #alternate} (Indicates an alternative material of the device.). This is the underlying object with id, value and extensions. The accessor "getAlternate" gives direct access to the value
4406         */
4407        public DeviceDefinitionMaterialComponent setAlternateElement(BooleanType value) { 
4408          this.alternate = value;
4409          return this;
4410        }
4411
4412        /**
4413         * @return Indicates an alternative material of the device.
4414         */
4415        public boolean getAlternate() { 
4416          return this.alternate == null || this.alternate.isEmpty() ? false : this.alternate.getValue();
4417        }
4418
4419        /**
4420         * @param value Indicates an alternative material of the device.
4421         */
4422        public DeviceDefinitionMaterialComponent setAlternate(boolean value) { 
4423            if (this.alternate == null)
4424              this.alternate = new BooleanType();
4425            this.alternate.setValue(value);
4426          return this;
4427        }
4428
4429        /**
4430         * @return {@link #allergenicIndicator} (Whether the substance is a known or suspected allergen.). This is the underlying object with id, value and extensions. The accessor "getAllergenicIndicator" gives direct access to the value
4431         */
4432        public BooleanType getAllergenicIndicatorElement() { 
4433          if (this.allergenicIndicator == null)
4434            if (Configuration.errorOnAutoCreate())
4435              throw new Error("Attempt to auto-create DeviceDefinitionMaterialComponent.allergenicIndicator");
4436            else if (Configuration.doAutoCreate())
4437              this.allergenicIndicator = new BooleanType(); // bb
4438          return this.allergenicIndicator;
4439        }
4440
4441        public boolean hasAllergenicIndicatorElement() { 
4442          return this.allergenicIndicator != null && !this.allergenicIndicator.isEmpty();
4443        }
4444
4445        public boolean hasAllergenicIndicator() { 
4446          return this.allergenicIndicator != null && !this.allergenicIndicator.isEmpty();
4447        }
4448
4449        /**
4450         * @param value {@link #allergenicIndicator} (Whether the substance is a known or suspected allergen.). This is the underlying object with id, value and extensions. The accessor "getAllergenicIndicator" gives direct access to the value
4451         */
4452        public DeviceDefinitionMaterialComponent setAllergenicIndicatorElement(BooleanType value) { 
4453          this.allergenicIndicator = value;
4454          return this;
4455        }
4456
4457        /**
4458         * @return Whether the substance is a known or suspected allergen.
4459         */
4460        public boolean getAllergenicIndicator() { 
4461          return this.allergenicIndicator == null || this.allergenicIndicator.isEmpty() ? false : this.allergenicIndicator.getValue();
4462        }
4463
4464        /**
4465         * @param value Whether the substance is a known or suspected allergen.
4466         */
4467        public DeviceDefinitionMaterialComponent setAllergenicIndicator(boolean value) { 
4468            if (this.allergenicIndicator == null)
4469              this.allergenicIndicator = new BooleanType();
4470            this.allergenicIndicator.setValue(value);
4471          return this;
4472        }
4473
4474        protected void listChildren(List<Property> children) {
4475          super.listChildren(children);
4476          children.add(new Property("substance", "CodeableConcept", "A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials.", 0, 1, substance));
4477          children.add(new Property("alternate", "boolean", "Indicates an alternative material of the device.", 0, 1, alternate));
4478          children.add(new Property("allergenicIndicator", "boolean", "Whether the substance is a known or suspected allergen.", 0, 1, allergenicIndicator));
4479        }
4480
4481        @Override
4482        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4483          switch (_hash) {
4484          case 530040176: /*substance*/  return new Property("substance", "CodeableConcept", "A substance that the device contains, may contain, or is made of - for example latex - to be used to determine patient compatibility. This is not intended to represent the composition of the device, only the clinically relevant materials.", 0, 1, substance);
4485          case -1408024454: /*alternate*/  return new Property("alternate", "boolean", "Indicates an alternative material of the device.", 0, 1, alternate);
4486          case 75406931: /*allergenicIndicator*/  return new Property("allergenicIndicator", "boolean", "Whether the substance is a known or suspected allergen.", 0, 1, allergenicIndicator);
4487          default: return super.getNamedProperty(_hash, _name, _checkValid);
4488          }
4489
4490        }
4491
4492      @Override
4493      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4494        switch (hash) {
4495        case 530040176: /*substance*/ return this.substance == null ? new Base[0] : new Base[] {this.substance}; // CodeableConcept
4496        case -1408024454: /*alternate*/ return this.alternate == null ? new Base[0] : new Base[] {this.alternate}; // BooleanType
4497        case 75406931: /*allergenicIndicator*/ return this.allergenicIndicator == null ? new Base[0] : new Base[] {this.allergenicIndicator}; // BooleanType
4498        default: return super.getProperty(hash, name, checkValid);
4499        }
4500
4501      }
4502
4503      @Override
4504      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4505        switch (hash) {
4506        case 530040176: // substance
4507          this.substance = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4508          return value;
4509        case -1408024454: // alternate
4510          this.alternate = TypeConvertor.castToBoolean(value); // BooleanType
4511          return value;
4512        case 75406931: // allergenicIndicator
4513          this.allergenicIndicator = TypeConvertor.castToBoolean(value); // BooleanType
4514          return value;
4515        default: return super.setProperty(hash, name, value);
4516        }
4517
4518      }
4519
4520      @Override
4521      public Base setProperty(String name, Base value) throws FHIRException {
4522        if (name.equals("substance")) {
4523          this.substance = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4524        } else if (name.equals("alternate")) {
4525          this.alternate = TypeConvertor.castToBoolean(value); // BooleanType
4526        } else if (name.equals("allergenicIndicator")) {
4527          this.allergenicIndicator = TypeConvertor.castToBoolean(value); // BooleanType
4528        } else
4529          return super.setProperty(name, value);
4530        return value;
4531      }
4532
4533  @Override
4534  public void removeChild(String name, Base value) throws FHIRException {
4535        if (name.equals("substance")) {
4536          this.substance = null;
4537        } else if (name.equals("alternate")) {
4538          this.alternate = null;
4539        } else if (name.equals("allergenicIndicator")) {
4540          this.allergenicIndicator = null;
4541        } else
4542          super.removeChild(name, value);
4543        
4544      }
4545
4546      @Override
4547      public Base makeProperty(int hash, String name) throws FHIRException {
4548        switch (hash) {
4549        case 530040176:  return getSubstance();
4550        case -1408024454:  return getAlternateElement();
4551        case 75406931:  return getAllergenicIndicatorElement();
4552        default: return super.makeProperty(hash, name);
4553        }
4554
4555      }
4556
4557      @Override
4558      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4559        switch (hash) {
4560        case 530040176: /*substance*/ return new String[] {"CodeableConcept"};
4561        case -1408024454: /*alternate*/ return new String[] {"boolean"};
4562        case 75406931: /*allergenicIndicator*/ return new String[] {"boolean"};
4563        default: return super.getTypesForProperty(hash, name);
4564        }
4565
4566      }
4567
4568      @Override
4569      public Base addChild(String name) throws FHIRException {
4570        if (name.equals("substance")) {
4571          this.substance = new CodeableConcept();
4572          return this.substance;
4573        }
4574        else if (name.equals("alternate")) {
4575          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.material.alternate");
4576        }
4577        else if (name.equals("allergenicIndicator")) {
4578          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.material.allergenicIndicator");
4579        }
4580        else
4581          return super.addChild(name);
4582      }
4583
4584      public DeviceDefinitionMaterialComponent copy() {
4585        DeviceDefinitionMaterialComponent dst = new DeviceDefinitionMaterialComponent();
4586        copyValues(dst);
4587        return dst;
4588      }
4589
4590      public void copyValues(DeviceDefinitionMaterialComponent dst) {
4591        super.copyValues(dst);
4592        dst.substance = substance == null ? null : substance.copy();
4593        dst.alternate = alternate == null ? null : alternate.copy();
4594        dst.allergenicIndicator = allergenicIndicator == null ? null : allergenicIndicator.copy();
4595      }
4596
4597      @Override
4598      public boolean equalsDeep(Base other_) {
4599        if (!super.equalsDeep(other_))
4600          return false;
4601        if (!(other_ instanceof DeviceDefinitionMaterialComponent))
4602          return false;
4603        DeviceDefinitionMaterialComponent o = (DeviceDefinitionMaterialComponent) other_;
4604        return compareDeep(substance, o.substance, true) && compareDeep(alternate, o.alternate, true) && compareDeep(allergenicIndicator, o.allergenicIndicator, true)
4605          ;
4606      }
4607
4608      @Override
4609      public boolean equalsShallow(Base other_) {
4610        if (!super.equalsShallow(other_))
4611          return false;
4612        if (!(other_ instanceof DeviceDefinitionMaterialComponent))
4613          return false;
4614        DeviceDefinitionMaterialComponent o = (DeviceDefinitionMaterialComponent) other_;
4615        return compareValues(alternate, o.alternate, true) && compareValues(allergenicIndicator, o.allergenicIndicator, true)
4616          ;
4617      }
4618
4619      public boolean isEmpty() {
4620        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(substance, alternate, allergenicIndicator
4621          );
4622      }
4623
4624  public String fhirType() {
4625    return "DeviceDefinition.material";
4626
4627  }
4628
4629  }
4630
4631    @Block()
4632    public static class DeviceDefinitionGuidelineComponent extends BackboneElement implements IBaseBackboneElement {
4633        /**
4634         * The circumstances that form the setting for using the device.
4635         */
4636        @Child(name = "useContext", type = {UsageContext.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4637        @Description(shortDefinition="The circumstances that form the setting for using the device", formalDefinition="The circumstances that form the setting for using the device." )
4638        protected List<UsageContext> useContext;
4639
4640        /**
4641         * Detailed written and visual directions for the user on how to use the device.
4642         */
4643        @Child(name = "usageInstruction", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=false)
4644        @Description(shortDefinition="Detailed written and visual directions for the user on how to use the device", formalDefinition="Detailed written and visual directions for the user on how to use the device." )
4645        protected MarkdownType usageInstruction;
4646
4647        /**
4648         * A source of information or reference for this guideline.
4649         */
4650        @Child(name = "relatedArtifact", type = {RelatedArtifact.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4651        @Description(shortDefinition="A source of information or reference for this guideline", formalDefinition="A source of information or reference for this guideline." )
4652        protected List<RelatedArtifact> relatedArtifact;
4653
4654        /**
4655         * A clinical condition for which the device was designed to be used.
4656         */
4657        @Child(name = "indication", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4658        @Description(shortDefinition="A clinical condition for which the device was designed to be used", formalDefinition="A clinical condition for which the device was designed to be used." )
4659        protected List<CodeableConcept> indication;
4660
4661        /**
4662         * A specific situation when a device should not be used because it may cause harm.
4663         */
4664        @Child(name = "contraindication", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4665        @Description(shortDefinition="A specific situation when a device should not be used because it may cause harm", formalDefinition="A specific situation when a device should not be used because it may cause harm." )
4666        protected List<CodeableConcept> contraindication;
4667
4668        /**
4669         * Specific hazard alert information that a user needs to know before using the device.
4670         */
4671        @Child(name = "warning", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4672        @Description(shortDefinition="Specific hazard alert information that a user needs to know before using the device", formalDefinition="Specific hazard alert information that a user needs to know before using the device." )
4673        protected List<CodeableConcept> warning;
4674
4675        /**
4676         * A description of the general purpose or medical use of the device or its function.
4677         */
4678        @Child(name = "intendedUse", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
4679        @Description(shortDefinition="A description of the general purpose or medical use of the device or its function", formalDefinition="A description of the general purpose or medical use of the device or its function." )
4680        protected StringType intendedUse;
4681
4682        private static final long serialVersionUID = -1323961659L;
4683
4684    /**
4685     * Constructor
4686     */
4687      public DeviceDefinitionGuidelineComponent() {
4688        super();
4689      }
4690
4691        /**
4692         * @return {@link #useContext} (The circumstances that form the setting for using the device.)
4693         */
4694        public List<UsageContext> getUseContext() { 
4695          if (this.useContext == null)
4696            this.useContext = new ArrayList<UsageContext>();
4697          return this.useContext;
4698        }
4699
4700        /**
4701         * @return Returns a reference to <code>this</code> for easy method chaining
4702         */
4703        public DeviceDefinitionGuidelineComponent setUseContext(List<UsageContext> theUseContext) { 
4704          this.useContext = theUseContext;
4705          return this;
4706        }
4707
4708        public boolean hasUseContext() { 
4709          if (this.useContext == null)
4710            return false;
4711          for (UsageContext item : this.useContext)
4712            if (!item.isEmpty())
4713              return true;
4714          return false;
4715        }
4716
4717        public UsageContext addUseContext() { //3
4718          UsageContext t = new UsageContext();
4719          if (this.useContext == null)
4720            this.useContext = new ArrayList<UsageContext>();
4721          this.useContext.add(t);
4722          return t;
4723        }
4724
4725        public DeviceDefinitionGuidelineComponent addUseContext(UsageContext t) { //3
4726          if (t == null)
4727            return this;
4728          if (this.useContext == null)
4729            this.useContext = new ArrayList<UsageContext>();
4730          this.useContext.add(t);
4731          return this;
4732        }
4733
4734        /**
4735         * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist {3}
4736         */
4737        public UsageContext getUseContextFirstRep() { 
4738          if (getUseContext().isEmpty()) {
4739            addUseContext();
4740          }
4741          return getUseContext().get(0);
4742        }
4743
4744        /**
4745         * @return {@link #usageInstruction} (Detailed written and visual directions for the user on how to use the device.). This is the underlying object with id, value and extensions. The accessor "getUsageInstruction" gives direct access to the value
4746         */
4747        public MarkdownType getUsageInstructionElement() { 
4748          if (this.usageInstruction == null)
4749            if (Configuration.errorOnAutoCreate())
4750              throw new Error("Attempt to auto-create DeviceDefinitionGuidelineComponent.usageInstruction");
4751            else if (Configuration.doAutoCreate())
4752              this.usageInstruction = new MarkdownType(); // bb
4753          return this.usageInstruction;
4754        }
4755
4756        public boolean hasUsageInstructionElement() { 
4757          return this.usageInstruction != null && !this.usageInstruction.isEmpty();
4758        }
4759
4760        public boolean hasUsageInstruction() { 
4761          return this.usageInstruction != null && !this.usageInstruction.isEmpty();
4762        }
4763
4764        /**
4765         * @param value {@link #usageInstruction} (Detailed written and visual directions for the user on how to use the device.). This is the underlying object with id, value and extensions. The accessor "getUsageInstruction" gives direct access to the value
4766         */
4767        public DeviceDefinitionGuidelineComponent setUsageInstructionElement(MarkdownType value) { 
4768          this.usageInstruction = value;
4769          return this;
4770        }
4771
4772        /**
4773         * @return Detailed written and visual directions for the user on how to use the device.
4774         */
4775        public String getUsageInstruction() { 
4776          return this.usageInstruction == null ? null : this.usageInstruction.getValue();
4777        }
4778
4779        /**
4780         * @param value Detailed written and visual directions for the user on how to use the device.
4781         */
4782        public DeviceDefinitionGuidelineComponent setUsageInstruction(String value) { 
4783          if (Utilities.noString(value))
4784            this.usageInstruction = null;
4785          else {
4786            if (this.usageInstruction == null)
4787              this.usageInstruction = new MarkdownType();
4788            this.usageInstruction.setValue(value);
4789          }
4790          return this;
4791        }
4792
4793        /**
4794         * @return {@link #relatedArtifact} (A source of information or reference for this guideline.)
4795         */
4796        public List<RelatedArtifact> getRelatedArtifact() { 
4797          if (this.relatedArtifact == null)
4798            this.relatedArtifact = new ArrayList<RelatedArtifact>();
4799          return this.relatedArtifact;
4800        }
4801
4802        /**
4803         * @return Returns a reference to <code>this</code> for easy method chaining
4804         */
4805        public DeviceDefinitionGuidelineComponent setRelatedArtifact(List<RelatedArtifact> theRelatedArtifact) { 
4806          this.relatedArtifact = theRelatedArtifact;
4807          return this;
4808        }
4809
4810        public boolean hasRelatedArtifact() { 
4811          if (this.relatedArtifact == null)
4812            return false;
4813          for (RelatedArtifact item : this.relatedArtifact)
4814            if (!item.isEmpty())
4815              return true;
4816          return false;
4817        }
4818
4819        public RelatedArtifact addRelatedArtifact() { //3
4820          RelatedArtifact t = new RelatedArtifact();
4821          if (this.relatedArtifact == null)
4822            this.relatedArtifact = new ArrayList<RelatedArtifact>();
4823          this.relatedArtifact.add(t);
4824          return t;
4825        }
4826
4827        public DeviceDefinitionGuidelineComponent addRelatedArtifact(RelatedArtifact t) { //3
4828          if (t == null)
4829            return this;
4830          if (this.relatedArtifact == null)
4831            this.relatedArtifact = new ArrayList<RelatedArtifact>();
4832          this.relatedArtifact.add(t);
4833          return this;
4834        }
4835
4836        /**
4837         * @return The first repetition of repeating field {@link #relatedArtifact}, creating it if it does not already exist {3}
4838         */
4839        public RelatedArtifact getRelatedArtifactFirstRep() { 
4840          if (getRelatedArtifact().isEmpty()) {
4841            addRelatedArtifact();
4842          }
4843          return getRelatedArtifact().get(0);
4844        }
4845
4846        /**
4847         * @return {@link #indication} (A clinical condition for which the device was designed to be used.)
4848         */
4849        public List<CodeableConcept> getIndication() { 
4850          if (this.indication == null)
4851            this.indication = new ArrayList<CodeableConcept>();
4852          return this.indication;
4853        }
4854
4855        /**
4856         * @return Returns a reference to <code>this</code> for easy method chaining
4857         */
4858        public DeviceDefinitionGuidelineComponent setIndication(List<CodeableConcept> theIndication) { 
4859          this.indication = theIndication;
4860          return this;
4861        }
4862
4863        public boolean hasIndication() { 
4864          if (this.indication == null)
4865            return false;
4866          for (CodeableConcept item : this.indication)
4867            if (!item.isEmpty())
4868              return true;
4869          return false;
4870        }
4871
4872        public CodeableConcept addIndication() { //3
4873          CodeableConcept t = new CodeableConcept();
4874          if (this.indication == null)
4875            this.indication = new ArrayList<CodeableConcept>();
4876          this.indication.add(t);
4877          return t;
4878        }
4879
4880        public DeviceDefinitionGuidelineComponent addIndication(CodeableConcept t) { //3
4881          if (t == null)
4882            return this;
4883          if (this.indication == null)
4884            this.indication = new ArrayList<CodeableConcept>();
4885          this.indication.add(t);
4886          return this;
4887        }
4888
4889        /**
4890         * @return The first repetition of repeating field {@link #indication}, creating it if it does not already exist {3}
4891         */
4892        public CodeableConcept getIndicationFirstRep() { 
4893          if (getIndication().isEmpty()) {
4894            addIndication();
4895          }
4896          return getIndication().get(0);
4897        }
4898
4899        /**
4900         * @return {@link #contraindication} (A specific situation when a device should not be used because it may cause harm.)
4901         */
4902        public List<CodeableConcept> getContraindication() { 
4903          if (this.contraindication == null)
4904            this.contraindication = new ArrayList<CodeableConcept>();
4905          return this.contraindication;
4906        }
4907
4908        /**
4909         * @return Returns a reference to <code>this</code> for easy method chaining
4910         */
4911        public DeviceDefinitionGuidelineComponent setContraindication(List<CodeableConcept> theContraindication) { 
4912          this.contraindication = theContraindication;
4913          return this;
4914        }
4915
4916        public boolean hasContraindication() { 
4917          if (this.contraindication == null)
4918            return false;
4919          for (CodeableConcept item : this.contraindication)
4920            if (!item.isEmpty())
4921              return true;
4922          return false;
4923        }
4924
4925        public CodeableConcept addContraindication() { //3
4926          CodeableConcept t = new CodeableConcept();
4927          if (this.contraindication == null)
4928            this.contraindication = new ArrayList<CodeableConcept>();
4929          this.contraindication.add(t);
4930          return t;
4931        }
4932
4933        public DeviceDefinitionGuidelineComponent addContraindication(CodeableConcept t) { //3
4934          if (t == null)
4935            return this;
4936          if (this.contraindication == null)
4937            this.contraindication = new ArrayList<CodeableConcept>();
4938          this.contraindication.add(t);
4939          return this;
4940        }
4941
4942        /**
4943         * @return The first repetition of repeating field {@link #contraindication}, creating it if it does not already exist {3}
4944         */
4945        public CodeableConcept getContraindicationFirstRep() { 
4946          if (getContraindication().isEmpty()) {
4947            addContraindication();
4948          }
4949          return getContraindication().get(0);
4950        }
4951
4952        /**
4953         * @return {@link #warning} (Specific hazard alert information that a user needs to know before using the device.)
4954         */
4955        public List<CodeableConcept> getWarning() { 
4956          if (this.warning == null)
4957            this.warning = new ArrayList<CodeableConcept>();
4958          return this.warning;
4959        }
4960
4961        /**
4962         * @return Returns a reference to <code>this</code> for easy method chaining
4963         */
4964        public DeviceDefinitionGuidelineComponent setWarning(List<CodeableConcept> theWarning) { 
4965          this.warning = theWarning;
4966          return this;
4967        }
4968
4969        public boolean hasWarning() { 
4970          if (this.warning == null)
4971            return false;
4972          for (CodeableConcept item : this.warning)
4973            if (!item.isEmpty())
4974              return true;
4975          return false;
4976        }
4977
4978        public CodeableConcept addWarning() { //3
4979          CodeableConcept t = new CodeableConcept();
4980          if (this.warning == null)
4981            this.warning = new ArrayList<CodeableConcept>();
4982          this.warning.add(t);
4983          return t;
4984        }
4985
4986        public DeviceDefinitionGuidelineComponent addWarning(CodeableConcept t) { //3
4987          if (t == null)
4988            return this;
4989          if (this.warning == null)
4990            this.warning = new ArrayList<CodeableConcept>();
4991          this.warning.add(t);
4992          return this;
4993        }
4994
4995        /**
4996         * @return The first repetition of repeating field {@link #warning}, creating it if it does not already exist {3}
4997         */
4998        public CodeableConcept getWarningFirstRep() { 
4999          if (getWarning().isEmpty()) {
5000            addWarning();
5001          }
5002          return getWarning().get(0);
5003        }
5004
5005        /**
5006         * @return {@link #intendedUse} (A description of the general purpose or medical use of the device or its function.). This is the underlying object with id, value and extensions. The accessor "getIntendedUse" gives direct access to the value
5007         */
5008        public StringType getIntendedUseElement() { 
5009          if (this.intendedUse == null)
5010            if (Configuration.errorOnAutoCreate())
5011              throw new Error("Attempt to auto-create DeviceDefinitionGuidelineComponent.intendedUse");
5012            else if (Configuration.doAutoCreate())
5013              this.intendedUse = new StringType(); // bb
5014          return this.intendedUse;
5015        }
5016
5017        public boolean hasIntendedUseElement() { 
5018          return this.intendedUse != null && !this.intendedUse.isEmpty();
5019        }
5020
5021        public boolean hasIntendedUse() { 
5022          return this.intendedUse != null && !this.intendedUse.isEmpty();
5023        }
5024
5025        /**
5026         * @param value {@link #intendedUse} (A description of the general purpose or medical use of the device or its function.). This is the underlying object with id, value and extensions. The accessor "getIntendedUse" gives direct access to the value
5027         */
5028        public DeviceDefinitionGuidelineComponent setIntendedUseElement(StringType value) { 
5029          this.intendedUse = value;
5030          return this;
5031        }
5032
5033        /**
5034         * @return A description of the general purpose or medical use of the device or its function.
5035         */
5036        public String getIntendedUse() { 
5037          return this.intendedUse == null ? null : this.intendedUse.getValue();
5038        }
5039
5040        /**
5041         * @param value A description of the general purpose or medical use of the device or its function.
5042         */
5043        public DeviceDefinitionGuidelineComponent setIntendedUse(String value) { 
5044          if (Utilities.noString(value))
5045            this.intendedUse = null;
5046          else {
5047            if (this.intendedUse == null)
5048              this.intendedUse = new StringType();
5049            this.intendedUse.setValue(value);
5050          }
5051          return this;
5052        }
5053
5054        protected void listChildren(List<Property> children) {
5055          super.listChildren(children);
5056          children.add(new Property("useContext", "UsageContext", "The circumstances that form the setting for using the device.", 0, java.lang.Integer.MAX_VALUE, useContext));
5057          children.add(new Property("usageInstruction", "markdown", "Detailed written and visual directions for the user on how to use the device.", 0, 1, usageInstruction));
5058          children.add(new Property("relatedArtifact", "RelatedArtifact", "A source of information or reference for this guideline.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact));
5059          children.add(new Property("indication", "CodeableConcept", "A clinical condition for which the device was designed to be used.", 0, java.lang.Integer.MAX_VALUE, indication));
5060          children.add(new Property("contraindication", "CodeableConcept", "A specific situation when a device should not be used because it may cause harm.", 0, java.lang.Integer.MAX_VALUE, contraindication));
5061          children.add(new Property("warning", "CodeableConcept", "Specific hazard alert information that a user needs to know before using the device.", 0, java.lang.Integer.MAX_VALUE, warning));
5062          children.add(new Property("intendedUse", "string", "A description of the general purpose or medical use of the device or its function.", 0, 1, intendedUse));
5063        }
5064
5065        @Override
5066        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5067          switch (_hash) {
5068          case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The circumstances that form the setting for using the device.", 0, java.lang.Integer.MAX_VALUE, useContext);
5069          case 2138372141: /*usageInstruction*/  return new Property("usageInstruction", "markdown", "Detailed written and visual directions for the user on how to use the device.", 0, 1, usageInstruction);
5070          case 666807069: /*relatedArtifact*/  return new Property("relatedArtifact", "RelatedArtifact", "A source of information or reference for this guideline.", 0, java.lang.Integer.MAX_VALUE, relatedArtifact);
5071          case -597168804: /*indication*/  return new Property("indication", "CodeableConcept", "A clinical condition for which the device was designed to be used.", 0, java.lang.Integer.MAX_VALUE, indication);
5072          case 107135229: /*contraindication*/  return new Property("contraindication", "CodeableConcept", "A specific situation when a device should not be used because it may cause harm.", 0, java.lang.Integer.MAX_VALUE, contraindication);
5073          case 1124446108: /*warning*/  return new Property("warning", "CodeableConcept", "Specific hazard alert information that a user needs to know before using the device.", 0, java.lang.Integer.MAX_VALUE, warning);
5074          case -1618671268: /*intendedUse*/  return new Property("intendedUse", "string", "A description of the general purpose or medical use of the device or its function.", 0, 1, intendedUse);
5075          default: return super.getNamedProperty(_hash, _name, _checkValid);
5076          }
5077
5078        }
5079
5080      @Override
5081      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5082        switch (hash) {
5083        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
5084        case 2138372141: /*usageInstruction*/ return this.usageInstruction == null ? new Base[0] : new Base[] {this.usageInstruction}; // MarkdownType
5085        case 666807069: /*relatedArtifact*/ return this.relatedArtifact == null ? new Base[0] : this.relatedArtifact.toArray(new Base[this.relatedArtifact.size()]); // RelatedArtifact
5086        case -597168804: /*indication*/ return this.indication == null ? new Base[0] : this.indication.toArray(new Base[this.indication.size()]); // CodeableConcept
5087        case 107135229: /*contraindication*/ return this.contraindication == null ? new Base[0] : this.contraindication.toArray(new Base[this.contraindication.size()]); // CodeableConcept
5088        case 1124446108: /*warning*/ return this.warning == null ? new Base[0] : this.warning.toArray(new Base[this.warning.size()]); // CodeableConcept
5089        case -1618671268: /*intendedUse*/ return this.intendedUse == null ? new Base[0] : new Base[] {this.intendedUse}; // StringType
5090        default: return super.getProperty(hash, name, checkValid);
5091        }
5092
5093      }
5094
5095      @Override
5096      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5097        switch (hash) {
5098        case -669707736: // useContext
5099          this.getUseContext().add(TypeConvertor.castToUsageContext(value)); // UsageContext
5100          return value;
5101        case 2138372141: // usageInstruction
5102          this.usageInstruction = TypeConvertor.castToMarkdown(value); // MarkdownType
5103          return value;
5104        case 666807069: // relatedArtifact
5105          this.getRelatedArtifact().add(TypeConvertor.castToRelatedArtifact(value)); // RelatedArtifact
5106          return value;
5107        case -597168804: // indication
5108          this.getIndication().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5109          return value;
5110        case 107135229: // contraindication
5111          this.getContraindication().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5112          return value;
5113        case 1124446108: // warning
5114          this.getWarning().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5115          return value;
5116        case -1618671268: // intendedUse
5117          this.intendedUse = TypeConvertor.castToString(value); // StringType
5118          return value;
5119        default: return super.setProperty(hash, name, value);
5120        }
5121
5122      }
5123
5124      @Override
5125      public Base setProperty(String name, Base value) throws FHIRException {
5126        if (name.equals("useContext")) {
5127          this.getUseContext().add(TypeConvertor.castToUsageContext(value));
5128        } else if (name.equals("usageInstruction")) {
5129          this.usageInstruction = TypeConvertor.castToMarkdown(value); // MarkdownType
5130        } else if (name.equals("relatedArtifact")) {
5131          this.getRelatedArtifact().add(TypeConvertor.castToRelatedArtifact(value));
5132        } else if (name.equals("indication")) {
5133          this.getIndication().add(TypeConvertor.castToCodeableConcept(value));
5134        } else if (name.equals("contraindication")) {
5135          this.getContraindication().add(TypeConvertor.castToCodeableConcept(value));
5136        } else if (name.equals("warning")) {
5137          this.getWarning().add(TypeConvertor.castToCodeableConcept(value));
5138        } else if (name.equals("intendedUse")) {
5139          this.intendedUse = TypeConvertor.castToString(value); // StringType
5140        } else
5141          return super.setProperty(name, value);
5142        return value;
5143      }
5144
5145  @Override
5146  public void removeChild(String name, Base value) throws FHIRException {
5147        if (name.equals("useContext")) {
5148          this.getUseContext().remove(value);
5149        } else if (name.equals("usageInstruction")) {
5150          this.usageInstruction = null;
5151        } else if (name.equals("relatedArtifact")) {
5152          this.getRelatedArtifact().remove(value);
5153        } else if (name.equals("indication")) {
5154          this.getIndication().remove(value);
5155        } else if (name.equals("contraindication")) {
5156          this.getContraindication().remove(value);
5157        } else if (name.equals("warning")) {
5158          this.getWarning().remove(value);
5159        } else if (name.equals("intendedUse")) {
5160          this.intendedUse = null;
5161        } else
5162          super.removeChild(name, value);
5163        
5164      }
5165
5166      @Override
5167      public Base makeProperty(int hash, String name) throws FHIRException {
5168        switch (hash) {
5169        case -669707736:  return addUseContext(); 
5170        case 2138372141:  return getUsageInstructionElement();
5171        case 666807069:  return addRelatedArtifact(); 
5172        case -597168804:  return addIndication(); 
5173        case 107135229:  return addContraindication(); 
5174        case 1124446108:  return addWarning(); 
5175        case -1618671268:  return getIntendedUseElement();
5176        default: return super.makeProperty(hash, name);
5177        }
5178
5179      }
5180
5181      @Override
5182      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5183        switch (hash) {
5184        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
5185        case 2138372141: /*usageInstruction*/ return new String[] {"markdown"};
5186        case 666807069: /*relatedArtifact*/ return new String[] {"RelatedArtifact"};
5187        case -597168804: /*indication*/ return new String[] {"CodeableConcept"};
5188        case 107135229: /*contraindication*/ return new String[] {"CodeableConcept"};
5189        case 1124446108: /*warning*/ return new String[] {"CodeableConcept"};
5190        case -1618671268: /*intendedUse*/ return new String[] {"string"};
5191        default: return super.getTypesForProperty(hash, name);
5192        }
5193
5194      }
5195
5196      @Override
5197      public Base addChild(String name) throws FHIRException {
5198        if (name.equals("useContext")) {
5199          return addUseContext();
5200        }
5201        else if (name.equals("usageInstruction")) {
5202          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.guideline.usageInstruction");
5203        }
5204        else if (name.equals("relatedArtifact")) {
5205          return addRelatedArtifact();
5206        }
5207        else if (name.equals("indication")) {
5208          return addIndication();
5209        }
5210        else if (name.equals("contraindication")) {
5211          return addContraindication();
5212        }
5213        else if (name.equals("warning")) {
5214          return addWarning();
5215        }
5216        else if (name.equals("intendedUse")) {
5217          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.guideline.intendedUse");
5218        }
5219        else
5220          return super.addChild(name);
5221      }
5222
5223      public DeviceDefinitionGuidelineComponent copy() {
5224        DeviceDefinitionGuidelineComponent dst = new DeviceDefinitionGuidelineComponent();
5225        copyValues(dst);
5226        return dst;
5227      }
5228
5229      public void copyValues(DeviceDefinitionGuidelineComponent dst) {
5230        super.copyValues(dst);
5231        if (useContext != null) {
5232          dst.useContext = new ArrayList<UsageContext>();
5233          for (UsageContext i : useContext)
5234            dst.useContext.add(i.copy());
5235        };
5236        dst.usageInstruction = usageInstruction == null ? null : usageInstruction.copy();
5237        if (relatedArtifact != null) {
5238          dst.relatedArtifact = new ArrayList<RelatedArtifact>();
5239          for (RelatedArtifact i : relatedArtifact)
5240            dst.relatedArtifact.add(i.copy());
5241        };
5242        if (indication != null) {
5243          dst.indication = new ArrayList<CodeableConcept>();
5244          for (CodeableConcept i : indication)
5245            dst.indication.add(i.copy());
5246        };
5247        if (contraindication != null) {
5248          dst.contraindication = new ArrayList<CodeableConcept>();
5249          for (CodeableConcept i : contraindication)
5250            dst.contraindication.add(i.copy());
5251        };
5252        if (warning != null) {
5253          dst.warning = new ArrayList<CodeableConcept>();
5254          for (CodeableConcept i : warning)
5255            dst.warning.add(i.copy());
5256        };
5257        dst.intendedUse = intendedUse == null ? null : intendedUse.copy();
5258      }
5259
5260      @Override
5261      public boolean equalsDeep(Base other_) {
5262        if (!super.equalsDeep(other_))
5263          return false;
5264        if (!(other_ instanceof DeviceDefinitionGuidelineComponent))
5265          return false;
5266        DeviceDefinitionGuidelineComponent o = (DeviceDefinitionGuidelineComponent) other_;
5267        return compareDeep(useContext, o.useContext, true) && compareDeep(usageInstruction, o.usageInstruction, true)
5268           && compareDeep(relatedArtifact, o.relatedArtifact, true) && compareDeep(indication, o.indication, true)
5269           && compareDeep(contraindication, o.contraindication, true) && compareDeep(warning, o.warning, true)
5270           && compareDeep(intendedUse, o.intendedUse, true);
5271      }
5272
5273      @Override
5274      public boolean equalsShallow(Base other_) {
5275        if (!super.equalsShallow(other_))
5276          return false;
5277        if (!(other_ instanceof DeviceDefinitionGuidelineComponent))
5278          return false;
5279        DeviceDefinitionGuidelineComponent o = (DeviceDefinitionGuidelineComponent) other_;
5280        return compareValues(usageInstruction, o.usageInstruction, true) && compareValues(intendedUse, o.intendedUse, true)
5281          ;
5282      }
5283
5284      public boolean isEmpty() {
5285        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(useContext, usageInstruction
5286          , relatedArtifact, indication, contraindication, warning, intendedUse);
5287      }
5288
5289  public String fhirType() {
5290    return "DeviceDefinition.guideline";
5291
5292  }
5293
5294  }
5295
5296    @Block()
5297    public static class DeviceDefinitionCorrectiveActionComponent extends BackboneElement implements IBaseBackboneElement {
5298        /**
5299         * Whether the last corrective action known for this device was a recall.
5300         */
5301        @Child(name = "recall", type = {BooleanType.class}, order=1, min=1, max=1, modifier=false, summary=false)
5302        @Description(shortDefinition="Whether the corrective action was a recall", formalDefinition="Whether the last corrective action known for this device was a recall." )
5303        protected BooleanType recall;
5304
5305        /**
5306         * The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.
5307         */
5308        @Child(name = "scope", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
5309        @Description(shortDefinition="model | lot-numbers | serial-numbers", formalDefinition="The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name." )
5310        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-correctiveactionscope")
5311        protected Enumeration<DeviceCorrectiveActionScope> scope;
5312
5313        /**
5314         * Start and end dates of the  corrective action.
5315         */
5316        @Child(name = "period", type = {Period.class}, order=3, min=1, max=1, modifier=false, summary=false)
5317        @Description(shortDefinition="Start and end dates of the  corrective action", formalDefinition="Start and end dates of the  corrective action." )
5318        protected Period period;
5319
5320        private static final long serialVersionUID = -1936691252L;
5321
5322    /**
5323     * Constructor
5324     */
5325      public DeviceDefinitionCorrectiveActionComponent() {
5326        super();
5327      }
5328
5329    /**
5330     * Constructor
5331     */
5332      public DeviceDefinitionCorrectiveActionComponent(boolean recall, Period period) {
5333        super();
5334        this.setRecall(recall);
5335        this.setPeriod(period);
5336      }
5337
5338        /**
5339         * @return {@link #recall} (Whether the last corrective action known for this device was a recall.). This is the underlying object with id, value and extensions. The accessor "getRecall" gives direct access to the value
5340         */
5341        public BooleanType getRecallElement() { 
5342          if (this.recall == null)
5343            if (Configuration.errorOnAutoCreate())
5344              throw new Error("Attempt to auto-create DeviceDefinitionCorrectiveActionComponent.recall");
5345            else if (Configuration.doAutoCreate())
5346              this.recall = new BooleanType(); // bb
5347          return this.recall;
5348        }
5349
5350        public boolean hasRecallElement() { 
5351          return this.recall != null && !this.recall.isEmpty();
5352        }
5353
5354        public boolean hasRecall() { 
5355          return this.recall != null && !this.recall.isEmpty();
5356        }
5357
5358        /**
5359         * @param value {@link #recall} (Whether the last corrective action known for this device was a recall.). This is the underlying object with id, value and extensions. The accessor "getRecall" gives direct access to the value
5360         */
5361        public DeviceDefinitionCorrectiveActionComponent setRecallElement(BooleanType value) { 
5362          this.recall = value;
5363          return this;
5364        }
5365
5366        /**
5367         * @return Whether the last corrective action known for this device was a recall.
5368         */
5369        public boolean getRecall() { 
5370          return this.recall == null || this.recall.isEmpty() ? false : this.recall.getValue();
5371        }
5372
5373        /**
5374         * @param value Whether the last corrective action known for this device was a recall.
5375         */
5376        public DeviceDefinitionCorrectiveActionComponent setRecall(boolean value) { 
5377            if (this.recall == null)
5378              this.recall = new BooleanType();
5379            this.recall.setValue(value);
5380          return this;
5381        }
5382
5383        /**
5384         * @return {@link #scope} (The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.). This is the underlying object with id, value and extensions. The accessor "getScope" gives direct access to the value
5385         */
5386        public Enumeration<DeviceCorrectiveActionScope> getScopeElement() { 
5387          if (this.scope == null)
5388            if (Configuration.errorOnAutoCreate())
5389              throw new Error("Attempt to auto-create DeviceDefinitionCorrectiveActionComponent.scope");
5390            else if (Configuration.doAutoCreate())
5391              this.scope = new Enumeration<DeviceCorrectiveActionScope>(new DeviceCorrectiveActionScopeEnumFactory()); // bb
5392          return this.scope;
5393        }
5394
5395        public boolean hasScopeElement() { 
5396          return this.scope != null && !this.scope.isEmpty();
5397        }
5398
5399        public boolean hasScope() { 
5400          return this.scope != null && !this.scope.isEmpty();
5401        }
5402
5403        /**
5404         * @param value {@link #scope} (The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.). This is the underlying object with id, value and extensions. The accessor "getScope" gives direct access to the value
5405         */
5406        public DeviceDefinitionCorrectiveActionComponent setScopeElement(Enumeration<DeviceCorrectiveActionScope> value) { 
5407          this.scope = value;
5408          return this;
5409        }
5410
5411        /**
5412         * @return The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.
5413         */
5414        public DeviceCorrectiveActionScope getScope() { 
5415          return this.scope == null ? null : this.scope.getValue();
5416        }
5417
5418        /**
5419         * @param value The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.
5420         */
5421        public DeviceDefinitionCorrectiveActionComponent setScope(DeviceCorrectiveActionScope value) { 
5422          if (value == null)
5423            this.scope = null;
5424          else {
5425            if (this.scope == null)
5426              this.scope = new Enumeration<DeviceCorrectiveActionScope>(new DeviceCorrectiveActionScopeEnumFactory());
5427            this.scope.setValue(value);
5428          }
5429          return this;
5430        }
5431
5432        /**
5433         * @return {@link #period} (Start and end dates of the  corrective action.)
5434         */
5435        public Period getPeriod() { 
5436          if (this.period == null)
5437            if (Configuration.errorOnAutoCreate())
5438              throw new Error("Attempt to auto-create DeviceDefinitionCorrectiveActionComponent.period");
5439            else if (Configuration.doAutoCreate())
5440              this.period = new Period(); // cc
5441          return this.period;
5442        }
5443
5444        public boolean hasPeriod() { 
5445          return this.period != null && !this.period.isEmpty();
5446        }
5447
5448        /**
5449         * @param value {@link #period} (Start and end dates of the  corrective action.)
5450         */
5451        public DeviceDefinitionCorrectiveActionComponent setPeriod(Period value) { 
5452          this.period = value;
5453          return this;
5454        }
5455
5456        protected void listChildren(List<Property> children) {
5457          super.listChildren(children);
5458          children.add(new Property("recall", "boolean", "Whether the last corrective action known for this device was a recall.", 0, 1, recall));
5459          children.add(new Property("scope", "code", "The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.", 0, 1, scope));
5460          children.add(new Property("period", "Period", "Start and end dates of the  corrective action.", 0, 1, period));
5461        }
5462
5463        @Override
5464        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5465          switch (_hash) {
5466          case -934922479: /*recall*/  return new Property("recall", "boolean", "Whether the last corrective action known for this device was a recall.", 0, 1, recall);
5467          case 109264468: /*scope*/  return new Property("scope", "code", "The scope of the corrective action - whether the action targeted all units of a given device model, or only a specific set of batches identified by lot numbers, or individually identified devices identified by the serial name.", 0, 1, scope);
5468          case -991726143: /*period*/  return new Property("period", "Period", "Start and end dates of the  corrective action.", 0, 1, period);
5469          default: return super.getNamedProperty(_hash, _name, _checkValid);
5470          }
5471
5472        }
5473
5474      @Override
5475      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5476        switch (hash) {
5477        case -934922479: /*recall*/ return this.recall == null ? new Base[0] : new Base[] {this.recall}; // BooleanType
5478        case 109264468: /*scope*/ return this.scope == null ? new Base[0] : new Base[] {this.scope}; // Enumeration<DeviceCorrectiveActionScope>
5479        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
5480        default: return super.getProperty(hash, name, checkValid);
5481        }
5482
5483      }
5484
5485      @Override
5486      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5487        switch (hash) {
5488        case -934922479: // recall
5489          this.recall = TypeConvertor.castToBoolean(value); // BooleanType
5490          return value;
5491        case 109264468: // scope
5492          value = new DeviceCorrectiveActionScopeEnumFactory().fromType(TypeConvertor.castToCode(value));
5493          this.scope = (Enumeration) value; // Enumeration<DeviceCorrectiveActionScope>
5494          return value;
5495        case -991726143: // period
5496          this.period = TypeConvertor.castToPeriod(value); // Period
5497          return value;
5498        default: return super.setProperty(hash, name, value);
5499        }
5500
5501      }
5502
5503      @Override
5504      public Base setProperty(String name, Base value) throws FHIRException {
5505        if (name.equals("recall")) {
5506          this.recall = TypeConvertor.castToBoolean(value); // BooleanType
5507        } else if (name.equals("scope")) {
5508          value = new DeviceCorrectiveActionScopeEnumFactory().fromType(TypeConvertor.castToCode(value));
5509          this.scope = (Enumeration) value; // Enumeration<DeviceCorrectiveActionScope>
5510        } else if (name.equals("period")) {
5511          this.period = TypeConvertor.castToPeriod(value); // Period
5512        } else
5513          return super.setProperty(name, value);
5514        return value;
5515      }
5516
5517  @Override
5518  public void removeChild(String name, Base value) throws FHIRException {
5519        if (name.equals("recall")) {
5520          this.recall = null;
5521        } else if (name.equals("scope")) {
5522          value = new DeviceCorrectiveActionScopeEnumFactory().fromType(TypeConvertor.castToCode(value));
5523          this.scope = (Enumeration) value; // Enumeration<DeviceCorrectiveActionScope>
5524        } else if (name.equals("period")) {
5525          this.period = null;
5526        } else
5527          super.removeChild(name, value);
5528        
5529      }
5530
5531      @Override
5532      public Base makeProperty(int hash, String name) throws FHIRException {
5533        switch (hash) {
5534        case -934922479:  return getRecallElement();
5535        case 109264468:  return getScopeElement();
5536        case -991726143:  return getPeriod();
5537        default: return super.makeProperty(hash, name);
5538        }
5539
5540      }
5541
5542      @Override
5543      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5544        switch (hash) {
5545        case -934922479: /*recall*/ return new String[] {"boolean"};
5546        case 109264468: /*scope*/ return new String[] {"code"};
5547        case -991726143: /*period*/ return new String[] {"Period"};
5548        default: return super.getTypesForProperty(hash, name);
5549        }
5550
5551      }
5552
5553      @Override
5554      public Base addChild(String name) throws FHIRException {
5555        if (name.equals("recall")) {
5556          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.correctiveAction.recall");
5557        }
5558        else if (name.equals("scope")) {
5559          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.correctiveAction.scope");
5560        }
5561        else if (name.equals("period")) {
5562          this.period = new Period();
5563          return this.period;
5564        }
5565        else
5566          return super.addChild(name);
5567      }
5568
5569      public DeviceDefinitionCorrectiveActionComponent copy() {
5570        DeviceDefinitionCorrectiveActionComponent dst = new DeviceDefinitionCorrectiveActionComponent();
5571        copyValues(dst);
5572        return dst;
5573      }
5574
5575      public void copyValues(DeviceDefinitionCorrectiveActionComponent dst) {
5576        super.copyValues(dst);
5577        dst.recall = recall == null ? null : recall.copy();
5578        dst.scope = scope == null ? null : scope.copy();
5579        dst.period = period == null ? null : period.copy();
5580      }
5581
5582      @Override
5583      public boolean equalsDeep(Base other_) {
5584        if (!super.equalsDeep(other_))
5585          return false;
5586        if (!(other_ instanceof DeviceDefinitionCorrectiveActionComponent))
5587          return false;
5588        DeviceDefinitionCorrectiveActionComponent o = (DeviceDefinitionCorrectiveActionComponent) other_;
5589        return compareDeep(recall, o.recall, true) && compareDeep(scope, o.scope, true) && compareDeep(period, o.period, true)
5590          ;
5591      }
5592
5593      @Override
5594      public boolean equalsShallow(Base other_) {
5595        if (!super.equalsShallow(other_))
5596          return false;
5597        if (!(other_ instanceof DeviceDefinitionCorrectiveActionComponent))
5598          return false;
5599        DeviceDefinitionCorrectiveActionComponent o = (DeviceDefinitionCorrectiveActionComponent) other_;
5600        return compareValues(recall, o.recall, true) && compareValues(scope, o.scope, true);
5601      }
5602
5603      public boolean isEmpty() {
5604        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(recall, scope, period);
5605      }
5606
5607  public String fhirType() {
5608    return "DeviceDefinition.correctiveAction";
5609
5610  }
5611
5612  }
5613
5614    @Block()
5615    public static class DeviceDefinitionChargeItemComponent extends BackboneElement implements IBaseBackboneElement {
5616        /**
5617         * The code or reference for the charge item.
5618         */
5619        @Child(name = "chargeItemCode", type = {CodeableReference.class}, order=1, min=1, max=1, modifier=false, summary=false)
5620        @Description(shortDefinition="The code or reference for the charge item", formalDefinition="The code or reference for the charge item." )
5621        protected CodeableReference chargeItemCode;
5622
5623        /**
5624         * Coefficient applicable to the billing code.
5625         */
5626        @Child(name = "count", type = {Quantity.class}, order=2, min=1, max=1, modifier=false, summary=false)
5627        @Description(shortDefinition="Coefficient applicable to the billing code", formalDefinition="Coefficient applicable to the billing code." )
5628        protected Quantity count;
5629
5630        /**
5631         * A specific time period in which this charge item applies.
5632         */
5633        @Child(name = "effectivePeriod", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=false)
5634        @Description(shortDefinition="A specific time period in which this charge item applies", formalDefinition="A specific time period in which this charge item applies." )
5635        protected Period effectivePeriod;
5636
5637        /**
5638         * The context to which this charge item applies.
5639         */
5640        @Child(name = "useContext", type = {UsageContext.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5641        @Description(shortDefinition="The context to which this charge item applies", formalDefinition="The context to which this charge item applies." )
5642        protected List<UsageContext> useContext;
5643
5644        private static final long serialVersionUID = 1312166907L;
5645
5646    /**
5647     * Constructor
5648     */
5649      public DeviceDefinitionChargeItemComponent() {
5650        super();
5651      }
5652
5653    /**
5654     * Constructor
5655     */
5656      public DeviceDefinitionChargeItemComponent(CodeableReference chargeItemCode, Quantity count) {
5657        super();
5658        this.setChargeItemCode(chargeItemCode);
5659        this.setCount(count);
5660      }
5661
5662        /**
5663         * @return {@link #chargeItemCode} (The code or reference for the charge item.)
5664         */
5665        public CodeableReference getChargeItemCode() { 
5666          if (this.chargeItemCode == null)
5667            if (Configuration.errorOnAutoCreate())
5668              throw new Error("Attempt to auto-create DeviceDefinitionChargeItemComponent.chargeItemCode");
5669            else if (Configuration.doAutoCreate())
5670              this.chargeItemCode = new CodeableReference(); // cc
5671          return this.chargeItemCode;
5672        }
5673
5674        public boolean hasChargeItemCode() { 
5675          return this.chargeItemCode != null && !this.chargeItemCode.isEmpty();
5676        }
5677
5678        /**
5679         * @param value {@link #chargeItemCode} (The code or reference for the charge item.)
5680         */
5681        public DeviceDefinitionChargeItemComponent setChargeItemCode(CodeableReference value) { 
5682          this.chargeItemCode = value;
5683          return this;
5684        }
5685
5686        /**
5687         * @return {@link #count} (Coefficient applicable to the billing code.)
5688         */
5689        public Quantity getCount() { 
5690          if (this.count == null)
5691            if (Configuration.errorOnAutoCreate())
5692              throw new Error("Attempt to auto-create DeviceDefinitionChargeItemComponent.count");
5693            else if (Configuration.doAutoCreate())
5694              this.count = new Quantity(); // cc
5695          return this.count;
5696        }
5697
5698        public boolean hasCount() { 
5699          return this.count != null && !this.count.isEmpty();
5700        }
5701
5702        /**
5703         * @param value {@link #count} (Coefficient applicable to the billing code.)
5704         */
5705        public DeviceDefinitionChargeItemComponent setCount(Quantity value) { 
5706          this.count = value;
5707          return this;
5708        }
5709
5710        /**
5711         * @return {@link #effectivePeriod} (A specific time period in which this charge item applies.)
5712         */
5713        public Period getEffectivePeriod() { 
5714          if (this.effectivePeriod == null)
5715            if (Configuration.errorOnAutoCreate())
5716              throw new Error("Attempt to auto-create DeviceDefinitionChargeItemComponent.effectivePeriod");
5717            else if (Configuration.doAutoCreate())
5718              this.effectivePeriod = new Period(); // cc
5719          return this.effectivePeriod;
5720        }
5721
5722        public boolean hasEffectivePeriod() { 
5723          return this.effectivePeriod != null && !this.effectivePeriod.isEmpty();
5724        }
5725
5726        /**
5727         * @param value {@link #effectivePeriod} (A specific time period in which this charge item applies.)
5728         */
5729        public DeviceDefinitionChargeItemComponent setEffectivePeriod(Period value) { 
5730          this.effectivePeriod = value;
5731          return this;
5732        }
5733
5734        /**
5735         * @return {@link #useContext} (The context to which this charge item applies.)
5736         */
5737        public List<UsageContext> getUseContext() { 
5738          if (this.useContext == null)
5739            this.useContext = new ArrayList<UsageContext>();
5740          return this.useContext;
5741        }
5742
5743        /**
5744         * @return Returns a reference to <code>this</code> for easy method chaining
5745         */
5746        public DeviceDefinitionChargeItemComponent setUseContext(List<UsageContext> theUseContext) { 
5747          this.useContext = theUseContext;
5748          return this;
5749        }
5750
5751        public boolean hasUseContext() { 
5752          if (this.useContext == null)
5753            return false;
5754          for (UsageContext item : this.useContext)
5755            if (!item.isEmpty())
5756              return true;
5757          return false;
5758        }
5759
5760        public UsageContext addUseContext() { //3
5761          UsageContext t = new UsageContext();
5762          if (this.useContext == null)
5763            this.useContext = new ArrayList<UsageContext>();
5764          this.useContext.add(t);
5765          return t;
5766        }
5767
5768        public DeviceDefinitionChargeItemComponent addUseContext(UsageContext t) { //3
5769          if (t == null)
5770            return this;
5771          if (this.useContext == null)
5772            this.useContext = new ArrayList<UsageContext>();
5773          this.useContext.add(t);
5774          return this;
5775        }
5776
5777        /**
5778         * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist {3}
5779         */
5780        public UsageContext getUseContextFirstRep() { 
5781          if (getUseContext().isEmpty()) {
5782            addUseContext();
5783          }
5784          return getUseContext().get(0);
5785        }
5786
5787        protected void listChildren(List<Property> children) {
5788          super.listChildren(children);
5789          children.add(new Property("chargeItemCode", "CodeableReference(ChargeItemDefinition)", "The code or reference for the charge item.", 0, 1, chargeItemCode));
5790          children.add(new Property("count", "Quantity", "Coefficient applicable to the billing code.", 0, 1, count));
5791          children.add(new Property("effectivePeriod", "Period", "A specific time period in which this charge item applies.", 0, 1, effectivePeriod));
5792          children.add(new Property("useContext", "UsageContext", "The context to which this charge item applies.", 0, java.lang.Integer.MAX_VALUE, useContext));
5793        }
5794
5795        @Override
5796        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5797          switch (_hash) {
5798          case -2001375628: /*chargeItemCode*/  return new Property("chargeItemCode", "CodeableReference(ChargeItemDefinition)", "The code or reference for the charge item.", 0, 1, chargeItemCode);
5799          case 94851343: /*count*/  return new Property("count", "Quantity", "Coefficient applicable to the billing code.", 0, 1, count);
5800          case -403934648: /*effectivePeriod*/  return new Property("effectivePeriod", "Period", "A specific time period in which this charge item applies.", 0, 1, effectivePeriod);
5801          case -669707736: /*useContext*/  return new Property("useContext", "UsageContext", "The context to which this charge item applies.", 0, java.lang.Integer.MAX_VALUE, useContext);
5802          default: return super.getNamedProperty(_hash, _name, _checkValid);
5803          }
5804
5805        }
5806
5807      @Override
5808      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5809        switch (hash) {
5810        case -2001375628: /*chargeItemCode*/ return this.chargeItemCode == null ? new Base[0] : new Base[] {this.chargeItemCode}; // CodeableReference
5811        case 94851343: /*count*/ return this.count == null ? new Base[0] : new Base[] {this.count}; // Quantity
5812        case -403934648: /*effectivePeriod*/ return this.effectivePeriod == null ? new Base[0] : new Base[] {this.effectivePeriod}; // Period
5813        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
5814        default: return super.getProperty(hash, name, checkValid);
5815        }
5816
5817      }
5818
5819      @Override
5820      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5821        switch (hash) {
5822        case -2001375628: // chargeItemCode
5823          this.chargeItemCode = TypeConvertor.castToCodeableReference(value); // CodeableReference
5824          return value;
5825        case 94851343: // count
5826          this.count = TypeConvertor.castToQuantity(value); // Quantity
5827          return value;
5828        case -403934648: // effectivePeriod
5829          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
5830          return value;
5831        case -669707736: // useContext
5832          this.getUseContext().add(TypeConvertor.castToUsageContext(value)); // UsageContext
5833          return value;
5834        default: return super.setProperty(hash, name, value);
5835        }
5836
5837      }
5838
5839      @Override
5840      public Base setProperty(String name, Base value) throws FHIRException {
5841        if (name.equals("chargeItemCode")) {
5842          this.chargeItemCode = TypeConvertor.castToCodeableReference(value); // CodeableReference
5843        } else if (name.equals("count")) {
5844          this.count = TypeConvertor.castToQuantity(value); // Quantity
5845        } else if (name.equals("effectivePeriod")) {
5846          this.effectivePeriod = TypeConvertor.castToPeriod(value); // Period
5847        } else if (name.equals("useContext")) {
5848          this.getUseContext().add(TypeConvertor.castToUsageContext(value));
5849        } else
5850          return super.setProperty(name, value);
5851        return value;
5852      }
5853
5854  @Override
5855  public void removeChild(String name, Base value) throws FHIRException {
5856        if (name.equals("chargeItemCode")) {
5857          this.chargeItemCode = null;
5858        } else if (name.equals("count")) {
5859          this.count = null;
5860        } else if (name.equals("effectivePeriod")) {
5861          this.effectivePeriod = null;
5862        } else if (name.equals("useContext")) {
5863          this.getUseContext().remove(value);
5864        } else
5865          super.removeChild(name, value);
5866        
5867      }
5868
5869      @Override
5870      public Base makeProperty(int hash, String name) throws FHIRException {
5871        switch (hash) {
5872        case -2001375628:  return getChargeItemCode();
5873        case 94851343:  return getCount();
5874        case -403934648:  return getEffectivePeriod();
5875        case -669707736:  return addUseContext(); 
5876        default: return super.makeProperty(hash, name);
5877        }
5878
5879      }
5880
5881      @Override
5882      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5883        switch (hash) {
5884        case -2001375628: /*chargeItemCode*/ return new String[] {"CodeableReference"};
5885        case 94851343: /*count*/ return new String[] {"Quantity"};
5886        case -403934648: /*effectivePeriod*/ return new String[] {"Period"};
5887        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
5888        default: return super.getTypesForProperty(hash, name);
5889        }
5890
5891      }
5892
5893      @Override
5894      public Base addChild(String name) throws FHIRException {
5895        if (name.equals("chargeItemCode")) {
5896          this.chargeItemCode = new CodeableReference();
5897          return this.chargeItemCode;
5898        }
5899        else if (name.equals("count")) {
5900          this.count = new Quantity();
5901          return this.count;
5902        }
5903        else if (name.equals("effectivePeriod")) {
5904          this.effectivePeriod = new Period();
5905          return this.effectivePeriod;
5906        }
5907        else if (name.equals("useContext")) {
5908          return addUseContext();
5909        }
5910        else
5911          return super.addChild(name);
5912      }
5913
5914      public DeviceDefinitionChargeItemComponent copy() {
5915        DeviceDefinitionChargeItemComponent dst = new DeviceDefinitionChargeItemComponent();
5916        copyValues(dst);
5917        return dst;
5918      }
5919
5920      public void copyValues(DeviceDefinitionChargeItemComponent dst) {
5921        super.copyValues(dst);
5922        dst.chargeItemCode = chargeItemCode == null ? null : chargeItemCode.copy();
5923        dst.count = count == null ? null : count.copy();
5924        dst.effectivePeriod = effectivePeriod == null ? null : effectivePeriod.copy();
5925        if (useContext != null) {
5926          dst.useContext = new ArrayList<UsageContext>();
5927          for (UsageContext i : useContext)
5928            dst.useContext.add(i.copy());
5929        };
5930      }
5931
5932      @Override
5933      public boolean equalsDeep(Base other_) {
5934        if (!super.equalsDeep(other_))
5935          return false;
5936        if (!(other_ instanceof DeviceDefinitionChargeItemComponent))
5937          return false;
5938        DeviceDefinitionChargeItemComponent o = (DeviceDefinitionChargeItemComponent) other_;
5939        return compareDeep(chargeItemCode, o.chargeItemCode, true) && compareDeep(count, o.count, true)
5940           && compareDeep(effectivePeriod, o.effectivePeriod, true) && compareDeep(useContext, o.useContext, true)
5941          ;
5942      }
5943
5944      @Override
5945      public boolean equalsShallow(Base other_) {
5946        if (!super.equalsShallow(other_))
5947          return false;
5948        if (!(other_ instanceof DeviceDefinitionChargeItemComponent))
5949          return false;
5950        DeviceDefinitionChargeItemComponent o = (DeviceDefinitionChargeItemComponent) other_;
5951        return true;
5952      }
5953
5954      public boolean isEmpty() {
5955        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(chargeItemCode, count, effectivePeriod
5956          , useContext);
5957      }
5958
5959  public String fhirType() {
5960    return "DeviceDefinition.chargeItem";
5961
5962  }
5963
5964  }
5965
5966    /**
5967     * Additional information to describe the device.
5968     */
5969    @Child(name = "description", type = {MarkdownType.class}, order=0, min=0, max=1, modifier=false, summary=false)
5970    @Description(shortDefinition="Additional information to describe the device", formalDefinition="Additional information to describe the device." )
5971    protected MarkdownType description;
5972
5973    /**
5974     * Unique instance identifiers assigned to a device by the software, manufacturers, other organizations or owners. For example: handle ID. The identifier is typically valued if the udiDeviceIdentifier, partNumber or modelNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type.
5975     */
5976    @Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
5977    @Description(shortDefinition="Instance identifier", formalDefinition="Unique instance identifiers assigned to a device by the software, manufacturers, other organizations or owners. For example: handle ID. The identifier is typically valued if the udiDeviceIdentifier, partNumber or modelNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type." )
5978    protected List<Identifier> identifier;
5979
5980    /**
5981     * Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.
5982     */
5983    @Child(name = "udiDeviceIdentifier", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5984    @Description(shortDefinition="Unique Device Identifier (UDI) Barcode string", formalDefinition="Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold." )
5985    protected List<DeviceDefinitionUdiDeviceIdentifierComponent> udiDeviceIdentifier;
5986
5987    /**
5988     * Identifier associated with the regulatory documentation (certificates, technical documentation, post-market surveillance documentation and reports) of a set of device models sharing the same intended purpose, risk class and essential design and manufacturing characteristics. One example is the Basic UDI-DI in Europe.
5989     */
5990    @Child(name = "regulatoryIdentifier", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
5991    @Description(shortDefinition="Regulatory identifier(s) associated with this device", formalDefinition="Identifier associated with the regulatory documentation (certificates, technical documentation, post-market surveillance documentation and reports) of a set of device models sharing the same intended purpose, risk class and essential design and manufacturing characteristics. One example is the Basic UDI-DI in Europe." )
5992    protected List<DeviceDefinitionRegulatoryIdentifierComponent> regulatoryIdentifier;
5993
5994    /**
5995     * The part number or catalog number of the device.
5996     */
5997    @Child(name = "partNumber", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
5998    @Description(shortDefinition="The part number or catalog number of the device", formalDefinition="The part number or catalog number of the device." )
5999    protected StringType partNumber;
6000
6001    /**
6002     * A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction.
6003     */
6004    @Child(name = "manufacturer", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=true)
6005    @Description(shortDefinition="Name of device manufacturer", formalDefinition="A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction." )
6006    protected Reference manufacturer;
6007
6008    /**
6009     * The name or names of the device as given by the manufacturer.
6010     */
6011    @Child(name = "deviceName", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6012    @Description(shortDefinition="The name or names of the device as given by the manufacturer", formalDefinition="The name or names of the device as given by the manufacturer." )
6013    protected List<DeviceDefinitionDeviceNameComponent> deviceName;
6014
6015    /**
6016     * The model number for the device for example as defined by the manufacturer or labeler, or other agency.
6017     */
6018    @Child(name = "modelNumber", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
6019    @Description(shortDefinition="The catalog or model number for the device for example as defined by the manufacturer", formalDefinition="The model number for the device for example as defined by the manufacturer or labeler, or other agency." )
6020    protected StringType modelNumber;
6021
6022    /**
6023     * What kind of device or device system this is.
6024     */
6025    @Child(name = "classification", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6026    @Description(shortDefinition="What kind of device or device system this is", formalDefinition="What kind of device or device system this is." )
6027    protected List<DeviceDefinitionClassificationComponent> classification;
6028
6029    /**
6030     * Identifies the standards, specifications, or formal guidances for the capabilities supported by the device. The device may be certified as conformant to these specifications e.g., communication, performance, process, measurement, or specialization standards.
6031     */
6032    @Child(name = "conformsTo", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6033    @Description(shortDefinition="Identifies the standards, specifications, or formal guidances for the capabilities supported by the device", formalDefinition="Identifies the standards, specifications, or formal guidances for the capabilities supported by the device. The device may be certified as conformant to these specifications e.g., communication, performance, process, measurement, or specialization standards." )
6034    protected List<DeviceDefinitionConformsToComponent> conformsTo;
6035
6036    /**
6037     * A device that is part (for example a component) of the present device.
6038     */
6039    @Child(name = "hasPart", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6040    @Description(shortDefinition="A device, part of the current one", formalDefinition="A device that is part (for example a component) of the present device." )
6041    protected List<DeviceDefinitionHasPartComponent> hasPart;
6042
6043    /**
6044     * Information about the packaging of the device, i.e. how the device is packaged.
6045     */
6046    @Child(name = "packaging", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6047    @Description(shortDefinition="Information about the packaging of the device, i.e. how the device is packaged", formalDefinition="Information about the packaging of the device, i.e. how the device is packaged." )
6048    protected List<DeviceDefinitionPackagingComponent> packaging;
6049
6050    /**
6051     * The version of the device or software.
6052     */
6053    @Child(name = "version", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6054    @Description(shortDefinition="The version of the device or software", formalDefinition="The version of the device or software." )
6055    protected List<DeviceDefinitionVersionComponent> version;
6056
6057    /**
6058     * Safety characteristics of the device.
6059     */
6060    @Child(name = "safety", type = {CodeableConcept.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
6061    @Description(shortDefinition="Safety characteristics of the device", formalDefinition="Safety characteristics of the device." )
6062    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-safety")
6063    protected List<CodeableConcept> safety;
6064
6065    /**
6066     * Shelf Life and storage information.
6067     */
6068    @Child(name = "shelfLifeStorage", type = {ProductShelfLife.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6069    @Description(shortDefinition="Shelf Life and storage information", formalDefinition="Shelf Life and storage information." )
6070    protected List<ProductShelfLife> shelfLifeStorage;
6071
6072    /**
6073     * Language code for the human-readable text strings produced by the device (all supported).
6074     */
6075    @Child(name = "languageCode", type = {CodeableConcept.class}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6076    @Description(shortDefinition="Language code for the human-readable text strings produced by the device (all supported)", formalDefinition="Language code for the human-readable text strings produced by the device (all supported)." )
6077    protected List<CodeableConcept> languageCode;
6078
6079    /**
6080     * Static or essentially fixed characteristics or features of this kind of device that are otherwise not captured in more specific attributes, e.g., time or timing attributes, resolution, accuracy, and physical attributes.
6081     */
6082    @Child(name = "property", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6083    @Description(shortDefinition="Inherent, essentially fixed, characteristics of this kind of device, e.g., time properties, size, etc", formalDefinition="Static or essentially fixed characteristics or features of this kind of device that are otherwise not captured in more specific attributes, e.g., time or timing attributes, resolution, accuracy, and physical attributes." )
6084    protected List<DeviceDefinitionPropertyComponent> property;
6085
6086    /**
6087     * An organization that is responsible for the provision and ongoing maintenance of the device.
6088     */
6089    @Child(name = "owner", type = {Organization.class}, order=17, min=0, max=1, modifier=false, summary=false)
6090    @Description(shortDefinition="Organization responsible for device", formalDefinition="An organization that is responsible for the provision and ongoing maintenance of the device." )
6091    protected Reference owner;
6092
6093    /**
6094     * Contact details for an organization or a particular human that is responsible for the device.
6095     */
6096    @Child(name = "contact", type = {ContactPoint.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6097    @Description(shortDefinition="Details for human/organization for support", formalDefinition="Contact details for an organization or a particular human that is responsible for the device." )
6098    protected List<ContactPoint> contact;
6099
6100    /**
6101     * An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.
6102     */
6103    @Child(name = "link", type = {}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6104    @Description(shortDefinition="An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device", formalDefinition="An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device." )
6105    protected List<DeviceDefinitionLinkComponent> link;
6106
6107    /**
6108     * Descriptive information, usage information or implantation information that is not captured in an existing element.
6109     */
6110    @Child(name = "note", type = {Annotation.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6111    @Description(shortDefinition="Device notes and comments", formalDefinition="Descriptive information, usage information or implantation information that is not captured in an existing element." )
6112    protected List<Annotation> note;
6113
6114    /**
6115     * A substance used to create the material(s) of which the device is made.
6116     */
6117    @Child(name = "material", type = {}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6118    @Description(shortDefinition="A substance used to create the material(s) of which the device is made", formalDefinition="A substance used to create the material(s) of which the device is made." )
6119    protected List<DeviceDefinitionMaterialComponent> material;
6120
6121    /**
6122     * Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.
6123     */
6124    @Child(name = "productionIdentifierInUDI", type = {CodeType.class}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6125    @Description(shortDefinition="lot-number | manufactured-date | serial-number | expiration-date | biological-source | software-version", formalDefinition="Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label." )
6126    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/device-productidentifierinudi")
6127    protected List<Enumeration<DeviceProductionIdentifierInUDI>> productionIdentifierInUDI;
6128
6129    /**
6130     * Information aimed at providing directions for the usage of this model of device.
6131     */
6132    @Child(name = "guideline", type = {}, order=23, min=0, max=1, modifier=false, summary=false)
6133    @Description(shortDefinition="Information aimed at providing directions for the usage of this model of device", formalDefinition="Information aimed at providing directions for the usage of this model of device." )
6134    protected DeviceDefinitionGuidelineComponent guideline;
6135
6136    /**
6137     * Tracking of latest field safety corrective action.
6138     */
6139    @Child(name = "correctiveAction", type = {}, order=24, min=0, max=1, modifier=false, summary=false)
6140    @Description(shortDefinition="Tracking of latest field safety corrective action", formalDefinition="Tracking of latest field safety corrective action." )
6141    protected DeviceDefinitionCorrectiveActionComponent correctiveAction;
6142
6143    /**
6144     * Billing code or reference associated with the device.
6145     */
6146    @Child(name = "chargeItem", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
6147    @Description(shortDefinition="Billing code or reference associated with the device", formalDefinition="Billing code or reference associated with the device." )
6148    protected List<DeviceDefinitionChargeItemComponent> chargeItem;
6149
6150    private static final long serialVersionUID = -260935704L;
6151
6152  /**
6153   * Constructor
6154   */
6155    public DeviceDefinition() {
6156      super();
6157    }
6158
6159    /**
6160     * @return {@link #description} (Additional information to describe the device.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
6161     */
6162    public MarkdownType getDescriptionElement() { 
6163      if (this.description == null)
6164        if (Configuration.errorOnAutoCreate())
6165          throw new Error("Attempt to auto-create DeviceDefinition.description");
6166        else if (Configuration.doAutoCreate())
6167          this.description = new MarkdownType(); // bb
6168      return this.description;
6169    }
6170
6171    public boolean hasDescriptionElement() { 
6172      return this.description != null && !this.description.isEmpty();
6173    }
6174
6175    public boolean hasDescription() { 
6176      return this.description != null && !this.description.isEmpty();
6177    }
6178
6179    /**
6180     * @param value {@link #description} (Additional information to describe the device.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
6181     */
6182    public DeviceDefinition setDescriptionElement(MarkdownType value) { 
6183      this.description = value;
6184      return this;
6185    }
6186
6187    /**
6188     * @return Additional information to describe the device.
6189     */
6190    public String getDescription() { 
6191      return this.description == null ? null : this.description.getValue();
6192    }
6193
6194    /**
6195     * @param value Additional information to describe the device.
6196     */
6197    public DeviceDefinition setDescription(String value) { 
6198      if (Utilities.noString(value))
6199        this.description = null;
6200      else {
6201        if (this.description == null)
6202          this.description = new MarkdownType();
6203        this.description.setValue(value);
6204      }
6205      return this;
6206    }
6207
6208    /**
6209     * @return {@link #identifier} (Unique instance identifiers assigned to a device by the software, manufacturers, other organizations or owners. For example: handle ID. The identifier is typically valued if the udiDeviceIdentifier, partNumber or modelNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type.)
6210     */
6211    public List<Identifier> getIdentifier() { 
6212      if (this.identifier == null)
6213        this.identifier = new ArrayList<Identifier>();
6214      return this.identifier;
6215    }
6216
6217    /**
6218     * @return Returns a reference to <code>this</code> for easy method chaining
6219     */
6220    public DeviceDefinition setIdentifier(List<Identifier> theIdentifier) { 
6221      this.identifier = theIdentifier;
6222      return this;
6223    }
6224
6225    public boolean hasIdentifier() { 
6226      if (this.identifier == null)
6227        return false;
6228      for (Identifier item : this.identifier)
6229        if (!item.isEmpty())
6230          return true;
6231      return false;
6232    }
6233
6234    public Identifier addIdentifier() { //3
6235      Identifier t = new Identifier();
6236      if (this.identifier == null)
6237        this.identifier = new ArrayList<Identifier>();
6238      this.identifier.add(t);
6239      return t;
6240    }
6241
6242    public DeviceDefinition addIdentifier(Identifier t) { //3
6243      if (t == null)
6244        return this;
6245      if (this.identifier == null)
6246        this.identifier = new ArrayList<Identifier>();
6247      this.identifier.add(t);
6248      return this;
6249    }
6250
6251    /**
6252     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
6253     */
6254    public Identifier getIdentifierFirstRep() { 
6255      if (getIdentifier().isEmpty()) {
6256        addIdentifier();
6257      }
6258      return getIdentifier().get(0);
6259    }
6260
6261    /**
6262     * @return {@link #udiDeviceIdentifier} (Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.)
6263     */
6264    public List<DeviceDefinitionUdiDeviceIdentifierComponent> getUdiDeviceIdentifier() { 
6265      if (this.udiDeviceIdentifier == null)
6266        this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
6267      return this.udiDeviceIdentifier;
6268    }
6269
6270    /**
6271     * @return Returns a reference to <code>this</code> for easy method chaining
6272     */
6273    public DeviceDefinition setUdiDeviceIdentifier(List<DeviceDefinitionUdiDeviceIdentifierComponent> theUdiDeviceIdentifier) { 
6274      this.udiDeviceIdentifier = theUdiDeviceIdentifier;
6275      return this;
6276    }
6277
6278    public boolean hasUdiDeviceIdentifier() { 
6279      if (this.udiDeviceIdentifier == null)
6280        return false;
6281      for (DeviceDefinitionUdiDeviceIdentifierComponent item : this.udiDeviceIdentifier)
6282        if (!item.isEmpty())
6283          return true;
6284      return false;
6285    }
6286
6287    public DeviceDefinitionUdiDeviceIdentifierComponent addUdiDeviceIdentifier() { //3
6288      DeviceDefinitionUdiDeviceIdentifierComponent t = new DeviceDefinitionUdiDeviceIdentifierComponent();
6289      if (this.udiDeviceIdentifier == null)
6290        this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
6291      this.udiDeviceIdentifier.add(t);
6292      return t;
6293    }
6294
6295    public DeviceDefinition addUdiDeviceIdentifier(DeviceDefinitionUdiDeviceIdentifierComponent t) { //3
6296      if (t == null)
6297        return this;
6298      if (this.udiDeviceIdentifier == null)
6299        this.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
6300      this.udiDeviceIdentifier.add(t);
6301      return this;
6302    }
6303
6304    /**
6305     * @return The first repetition of repeating field {@link #udiDeviceIdentifier}, creating it if it does not already exist {3}
6306     */
6307    public DeviceDefinitionUdiDeviceIdentifierComponent getUdiDeviceIdentifierFirstRep() { 
6308      if (getUdiDeviceIdentifier().isEmpty()) {
6309        addUdiDeviceIdentifier();
6310      }
6311      return getUdiDeviceIdentifier().get(0);
6312    }
6313
6314    /**
6315     * @return {@link #regulatoryIdentifier} (Identifier associated with the regulatory documentation (certificates, technical documentation, post-market surveillance documentation and reports) of a set of device models sharing the same intended purpose, risk class and essential design and manufacturing characteristics. One example is the Basic UDI-DI in Europe.)
6316     */
6317    public List<DeviceDefinitionRegulatoryIdentifierComponent> getRegulatoryIdentifier() { 
6318      if (this.regulatoryIdentifier == null)
6319        this.regulatoryIdentifier = new ArrayList<DeviceDefinitionRegulatoryIdentifierComponent>();
6320      return this.regulatoryIdentifier;
6321    }
6322
6323    /**
6324     * @return Returns a reference to <code>this</code> for easy method chaining
6325     */
6326    public DeviceDefinition setRegulatoryIdentifier(List<DeviceDefinitionRegulatoryIdentifierComponent> theRegulatoryIdentifier) { 
6327      this.regulatoryIdentifier = theRegulatoryIdentifier;
6328      return this;
6329    }
6330
6331    public boolean hasRegulatoryIdentifier() { 
6332      if (this.regulatoryIdentifier == null)
6333        return false;
6334      for (DeviceDefinitionRegulatoryIdentifierComponent item : this.regulatoryIdentifier)
6335        if (!item.isEmpty())
6336          return true;
6337      return false;
6338    }
6339
6340    public DeviceDefinitionRegulatoryIdentifierComponent addRegulatoryIdentifier() { //3
6341      DeviceDefinitionRegulatoryIdentifierComponent t = new DeviceDefinitionRegulatoryIdentifierComponent();
6342      if (this.regulatoryIdentifier == null)
6343        this.regulatoryIdentifier = new ArrayList<DeviceDefinitionRegulatoryIdentifierComponent>();
6344      this.regulatoryIdentifier.add(t);
6345      return t;
6346    }
6347
6348    public DeviceDefinition addRegulatoryIdentifier(DeviceDefinitionRegulatoryIdentifierComponent t) { //3
6349      if (t == null)
6350        return this;
6351      if (this.regulatoryIdentifier == null)
6352        this.regulatoryIdentifier = new ArrayList<DeviceDefinitionRegulatoryIdentifierComponent>();
6353      this.regulatoryIdentifier.add(t);
6354      return this;
6355    }
6356
6357    /**
6358     * @return The first repetition of repeating field {@link #regulatoryIdentifier}, creating it if it does not already exist {3}
6359     */
6360    public DeviceDefinitionRegulatoryIdentifierComponent getRegulatoryIdentifierFirstRep() { 
6361      if (getRegulatoryIdentifier().isEmpty()) {
6362        addRegulatoryIdentifier();
6363      }
6364      return getRegulatoryIdentifier().get(0);
6365    }
6366
6367    /**
6368     * @return {@link #partNumber} (The part number or catalog number of the device.). This is the underlying object with id, value and extensions. The accessor "getPartNumber" gives direct access to the value
6369     */
6370    public StringType getPartNumberElement() { 
6371      if (this.partNumber == null)
6372        if (Configuration.errorOnAutoCreate())
6373          throw new Error("Attempt to auto-create DeviceDefinition.partNumber");
6374        else if (Configuration.doAutoCreate())
6375          this.partNumber = new StringType(); // bb
6376      return this.partNumber;
6377    }
6378
6379    public boolean hasPartNumberElement() { 
6380      return this.partNumber != null && !this.partNumber.isEmpty();
6381    }
6382
6383    public boolean hasPartNumber() { 
6384      return this.partNumber != null && !this.partNumber.isEmpty();
6385    }
6386
6387    /**
6388     * @param value {@link #partNumber} (The part number or catalog number of the device.). This is the underlying object with id, value and extensions. The accessor "getPartNumber" gives direct access to the value
6389     */
6390    public DeviceDefinition setPartNumberElement(StringType value) { 
6391      this.partNumber = value;
6392      return this;
6393    }
6394
6395    /**
6396     * @return The part number or catalog number of the device.
6397     */
6398    public String getPartNumber() { 
6399      return this.partNumber == null ? null : this.partNumber.getValue();
6400    }
6401
6402    /**
6403     * @param value The part number or catalog number of the device.
6404     */
6405    public DeviceDefinition setPartNumber(String value) { 
6406      if (Utilities.noString(value))
6407        this.partNumber = null;
6408      else {
6409        if (this.partNumber == null)
6410          this.partNumber = new StringType();
6411        this.partNumber.setValue(value);
6412      }
6413      return this;
6414    }
6415
6416    /**
6417     * @return {@link #manufacturer} (A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction.)
6418     */
6419    public Reference getManufacturer() { 
6420      if (this.manufacturer == null)
6421        if (Configuration.errorOnAutoCreate())
6422          throw new Error("Attempt to auto-create DeviceDefinition.manufacturer");
6423        else if (Configuration.doAutoCreate())
6424          this.manufacturer = new Reference(); // cc
6425      return this.manufacturer;
6426    }
6427
6428    public boolean hasManufacturer() { 
6429      return this.manufacturer != null && !this.manufacturer.isEmpty();
6430    }
6431
6432    /**
6433     * @param value {@link #manufacturer} (A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction.)
6434     */
6435    public DeviceDefinition setManufacturer(Reference value) { 
6436      this.manufacturer = value;
6437      return this;
6438    }
6439
6440    /**
6441     * @return {@link #deviceName} (The name or names of the device as given by the manufacturer.)
6442     */
6443    public List<DeviceDefinitionDeviceNameComponent> getDeviceName() { 
6444      if (this.deviceName == null)
6445        this.deviceName = new ArrayList<DeviceDefinitionDeviceNameComponent>();
6446      return this.deviceName;
6447    }
6448
6449    /**
6450     * @return Returns a reference to <code>this</code> for easy method chaining
6451     */
6452    public DeviceDefinition setDeviceName(List<DeviceDefinitionDeviceNameComponent> theDeviceName) { 
6453      this.deviceName = theDeviceName;
6454      return this;
6455    }
6456
6457    public boolean hasDeviceName() { 
6458      if (this.deviceName == null)
6459        return false;
6460      for (DeviceDefinitionDeviceNameComponent item : this.deviceName)
6461        if (!item.isEmpty())
6462          return true;
6463      return false;
6464    }
6465
6466    public DeviceDefinitionDeviceNameComponent addDeviceName() { //3
6467      DeviceDefinitionDeviceNameComponent t = new DeviceDefinitionDeviceNameComponent();
6468      if (this.deviceName == null)
6469        this.deviceName = new ArrayList<DeviceDefinitionDeviceNameComponent>();
6470      this.deviceName.add(t);
6471      return t;
6472    }
6473
6474    public DeviceDefinition addDeviceName(DeviceDefinitionDeviceNameComponent t) { //3
6475      if (t == null)
6476        return this;
6477      if (this.deviceName == null)
6478        this.deviceName = new ArrayList<DeviceDefinitionDeviceNameComponent>();
6479      this.deviceName.add(t);
6480      return this;
6481    }
6482
6483    /**
6484     * @return The first repetition of repeating field {@link #deviceName}, creating it if it does not already exist {3}
6485     */
6486    public DeviceDefinitionDeviceNameComponent getDeviceNameFirstRep() { 
6487      if (getDeviceName().isEmpty()) {
6488        addDeviceName();
6489      }
6490      return getDeviceName().get(0);
6491    }
6492
6493    /**
6494     * @return {@link #modelNumber} (The model number for the device for example as defined by the manufacturer or labeler, or other agency.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
6495     */
6496    public StringType getModelNumberElement() { 
6497      if (this.modelNumber == null)
6498        if (Configuration.errorOnAutoCreate())
6499          throw new Error("Attempt to auto-create DeviceDefinition.modelNumber");
6500        else if (Configuration.doAutoCreate())
6501          this.modelNumber = new StringType(); // bb
6502      return this.modelNumber;
6503    }
6504
6505    public boolean hasModelNumberElement() { 
6506      return this.modelNumber != null && !this.modelNumber.isEmpty();
6507    }
6508
6509    public boolean hasModelNumber() { 
6510      return this.modelNumber != null && !this.modelNumber.isEmpty();
6511    }
6512
6513    /**
6514     * @param value {@link #modelNumber} (The model number for the device for example as defined by the manufacturer or labeler, or other agency.). This is the underlying object with id, value and extensions. The accessor "getModelNumber" gives direct access to the value
6515     */
6516    public DeviceDefinition setModelNumberElement(StringType value) { 
6517      this.modelNumber = value;
6518      return this;
6519    }
6520
6521    /**
6522     * @return The model number for the device for example as defined by the manufacturer or labeler, or other agency.
6523     */
6524    public String getModelNumber() { 
6525      return this.modelNumber == null ? null : this.modelNumber.getValue();
6526    }
6527
6528    /**
6529     * @param value The model number for the device for example as defined by the manufacturer or labeler, or other agency.
6530     */
6531    public DeviceDefinition setModelNumber(String value) { 
6532      if (Utilities.noString(value))
6533        this.modelNumber = null;
6534      else {
6535        if (this.modelNumber == null)
6536          this.modelNumber = new StringType();
6537        this.modelNumber.setValue(value);
6538      }
6539      return this;
6540    }
6541
6542    /**
6543     * @return {@link #classification} (What kind of device or device system this is.)
6544     */
6545    public List<DeviceDefinitionClassificationComponent> getClassification() { 
6546      if (this.classification == null)
6547        this.classification = new ArrayList<DeviceDefinitionClassificationComponent>();
6548      return this.classification;
6549    }
6550
6551    /**
6552     * @return Returns a reference to <code>this</code> for easy method chaining
6553     */
6554    public DeviceDefinition setClassification(List<DeviceDefinitionClassificationComponent> theClassification) { 
6555      this.classification = theClassification;
6556      return this;
6557    }
6558
6559    public boolean hasClassification() { 
6560      if (this.classification == null)
6561        return false;
6562      for (DeviceDefinitionClassificationComponent item : this.classification)
6563        if (!item.isEmpty())
6564          return true;
6565      return false;
6566    }
6567
6568    public DeviceDefinitionClassificationComponent addClassification() { //3
6569      DeviceDefinitionClassificationComponent t = new DeviceDefinitionClassificationComponent();
6570      if (this.classification == null)
6571        this.classification = new ArrayList<DeviceDefinitionClassificationComponent>();
6572      this.classification.add(t);
6573      return t;
6574    }
6575
6576    public DeviceDefinition addClassification(DeviceDefinitionClassificationComponent t) { //3
6577      if (t == null)
6578        return this;
6579      if (this.classification == null)
6580        this.classification = new ArrayList<DeviceDefinitionClassificationComponent>();
6581      this.classification.add(t);
6582      return this;
6583    }
6584
6585    /**
6586     * @return The first repetition of repeating field {@link #classification}, creating it if it does not already exist {3}
6587     */
6588    public DeviceDefinitionClassificationComponent getClassificationFirstRep() { 
6589      if (getClassification().isEmpty()) {
6590        addClassification();
6591      }
6592      return getClassification().get(0);
6593    }
6594
6595    /**
6596     * @return {@link #conformsTo} (Identifies the standards, specifications, or formal guidances for the capabilities supported by the device. The device may be certified as conformant to these specifications e.g., communication, performance, process, measurement, or specialization standards.)
6597     */
6598    public List<DeviceDefinitionConformsToComponent> getConformsTo() { 
6599      if (this.conformsTo == null)
6600        this.conformsTo = new ArrayList<DeviceDefinitionConformsToComponent>();
6601      return this.conformsTo;
6602    }
6603
6604    /**
6605     * @return Returns a reference to <code>this</code> for easy method chaining
6606     */
6607    public DeviceDefinition setConformsTo(List<DeviceDefinitionConformsToComponent> theConformsTo) { 
6608      this.conformsTo = theConformsTo;
6609      return this;
6610    }
6611
6612    public boolean hasConformsTo() { 
6613      if (this.conformsTo == null)
6614        return false;
6615      for (DeviceDefinitionConformsToComponent item : this.conformsTo)
6616        if (!item.isEmpty())
6617          return true;
6618      return false;
6619    }
6620
6621    public DeviceDefinitionConformsToComponent addConformsTo() { //3
6622      DeviceDefinitionConformsToComponent t = new DeviceDefinitionConformsToComponent();
6623      if (this.conformsTo == null)
6624        this.conformsTo = new ArrayList<DeviceDefinitionConformsToComponent>();
6625      this.conformsTo.add(t);
6626      return t;
6627    }
6628
6629    public DeviceDefinition addConformsTo(DeviceDefinitionConformsToComponent t) { //3
6630      if (t == null)
6631        return this;
6632      if (this.conformsTo == null)
6633        this.conformsTo = new ArrayList<DeviceDefinitionConformsToComponent>();
6634      this.conformsTo.add(t);
6635      return this;
6636    }
6637
6638    /**
6639     * @return The first repetition of repeating field {@link #conformsTo}, creating it if it does not already exist {3}
6640     */
6641    public DeviceDefinitionConformsToComponent getConformsToFirstRep() { 
6642      if (getConformsTo().isEmpty()) {
6643        addConformsTo();
6644      }
6645      return getConformsTo().get(0);
6646    }
6647
6648    /**
6649     * @return {@link #hasPart} (A device that is part (for example a component) of the present device.)
6650     */
6651    public List<DeviceDefinitionHasPartComponent> getHasPart() { 
6652      if (this.hasPart == null)
6653        this.hasPart = new ArrayList<DeviceDefinitionHasPartComponent>();
6654      return this.hasPart;
6655    }
6656
6657    /**
6658     * @return Returns a reference to <code>this</code> for easy method chaining
6659     */
6660    public DeviceDefinition setHasPart(List<DeviceDefinitionHasPartComponent> theHasPart) { 
6661      this.hasPart = theHasPart;
6662      return this;
6663    }
6664
6665    public boolean hasHasPart() { 
6666      if (this.hasPart == null)
6667        return false;
6668      for (DeviceDefinitionHasPartComponent item : this.hasPart)
6669        if (!item.isEmpty())
6670          return true;
6671      return false;
6672    }
6673
6674    public DeviceDefinitionHasPartComponent addHasPart() { //3
6675      DeviceDefinitionHasPartComponent t = new DeviceDefinitionHasPartComponent();
6676      if (this.hasPart == null)
6677        this.hasPart = new ArrayList<DeviceDefinitionHasPartComponent>();
6678      this.hasPart.add(t);
6679      return t;
6680    }
6681
6682    public DeviceDefinition addHasPart(DeviceDefinitionHasPartComponent t) { //3
6683      if (t == null)
6684        return this;
6685      if (this.hasPart == null)
6686        this.hasPart = new ArrayList<DeviceDefinitionHasPartComponent>();
6687      this.hasPart.add(t);
6688      return this;
6689    }
6690
6691    /**
6692     * @return The first repetition of repeating field {@link #hasPart}, creating it if it does not already exist {3}
6693     */
6694    public DeviceDefinitionHasPartComponent getHasPartFirstRep() { 
6695      if (getHasPart().isEmpty()) {
6696        addHasPart();
6697      }
6698      return getHasPart().get(0);
6699    }
6700
6701    /**
6702     * @return {@link #packaging} (Information about the packaging of the device, i.e. how the device is packaged.)
6703     */
6704    public List<DeviceDefinitionPackagingComponent> getPackaging() { 
6705      if (this.packaging == null)
6706        this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
6707      return this.packaging;
6708    }
6709
6710    /**
6711     * @return Returns a reference to <code>this</code> for easy method chaining
6712     */
6713    public DeviceDefinition setPackaging(List<DeviceDefinitionPackagingComponent> thePackaging) { 
6714      this.packaging = thePackaging;
6715      return this;
6716    }
6717
6718    public boolean hasPackaging() { 
6719      if (this.packaging == null)
6720        return false;
6721      for (DeviceDefinitionPackagingComponent item : this.packaging)
6722        if (!item.isEmpty())
6723          return true;
6724      return false;
6725    }
6726
6727    public DeviceDefinitionPackagingComponent addPackaging() { //3
6728      DeviceDefinitionPackagingComponent t = new DeviceDefinitionPackagingComponent();
6729      if (this.packaging == null)
6730        this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
6731      this.packaging.add(t);
6732      return t;
6733    }
6734
6735    public DeviceDefinition addPackaging(DeviceDefinitionPackagingComponent t) { //3
6736      if (t == null)
6737        return this;
6738      if (this.packaging == null)
6739        this.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
6740      this.packaging.add(t);
6741      return this;
6742    }
6743
6744    /**
6745     * @return The first repetition of repeating field {@link #packaging}, creating it if it does not already exist {3}
6746     */
6747    public DeviceDefinitionPackagingComponent getPackagingFirstRep() { 
6748      if (getPackaging().isEmpty()) {
6749        addPackaging();
6750      }
6751      return getPackaging().get(0);
6752    }
6753
6754    /**
6755     * @return {@link #version} (The version of the device or software.)
6756     */
6757    public List<DeviceDefinitionVersionComponent> getVersion() { 
6758      if (this.version == null)
6759        this.version = new ArrayList<DeviceDefinitionVersionComponent>();
6760      return this.version;
6761    }
6762
6763    /**
6764     * @return Returns a reference to <code>this</code> for easy method chaining
6765     */
6766    public DeviceDefinition setVersion(List<DeviceDefinitionVersionComponent> theVersion) { 
6767      this.version = theVersion;
6768      return this;
6769    }
6770
6771    public boolean hasVersion() { 
6772      if (this.version == null)
6773        return false;
6774      for (DeviceDefinitionVersionComponent item : this.version)
6775        if (!item.isEmpty())
6776          return true;
6777      return false;
6778    }
6779
6780    public DeviceDefinitionVersionComponent addVersion() { //3
6781      DeviceDefinitionVersionComponent t = new DeviceDefinitionVersionComponent();
6782      if (this.version == null)
6783        this.version = new ArrayList<DeviceDefinitionVersionComponent>();
6784      this.version.add(t);
6785      return t;
6786    }
6787
6788    public DeviceDefinition addVersion(DeviceDefinitionVersionComponent t) { //3
6789      if (t == null)
6790        return this;
6791      if (this.version == null)
6792        this.version = new ArrayList<DeviceDefinitionVersionComponent>();
6793      this.version.add(t);
6794      return this;
6795    }
6796
6797    /**
6798     * @return The first repetition of repeating field {@link #version}, creating it if it does not already exist {3}
6799     */
6800    public DeviceDefinitionVersionComponent getVersionFirstRep() { 
6801      if (getVersion().isEmpty()) {
6802        addVersion();
6803      }
6804      return getVersion().get(0);
6805    }
6806
6807    /**
6808     * @return {@link #safety} (Safety characteristics of the device.)
6809     */
6810    public List<CodeableConcept> getSafety() { 
6811      if (this.safety == null)
6812        this.safety = new ArrayList<CodeableConcept>();
6813      return this.safety;
6814    }
6815
6816    /**
6817     * @return Returns a reference to <code>this</code> for easy method chaining
6818     */
6819    public DeviceDefinition setSafety(List<CodeableConcept> theSafety) { 
6820      this.safety = theSafety;
6821      return this;
6822    }
6823
6824    public boolean hasSafety() { 
6825      if (this.safety == null)
6826        return false;
6827      for (CodeableConcept item : this.safety)
6828        if (!item.isEmpty())
6829          return true;
6830      return false;
6831    }
6832
6833    public CodeableConcept addSafety() { //3
6834      CodeableConcept t = new CodeableConcept();
6835      if (this.safety == null)
6836        this.safety = new ArrayList<CodeableConcept>();
6837      this.safety.add(t);
6838      return t;
6839    }
6840
6841    public DeviceDefinition addSafety(CodeableConcept t) { //3
6842      if (t == null)
6843        return this;
6844      if (this.safety == null)
6845        this.safety = new ArrayList<CodeableConcept>();
6846      this.safety.add(t);
6847      return this;
6848    }
6849
6850    /**
6851     * @return The first repetition of repeating field {@link #safety}, creating it if it does not already exist {3}
6852     */
6853    public CodeableConcept getSafetyFirstRep() { 
6854      if (getSafety().isEmpty()) {
6855        addSafety();
6856      }
6857      return getSafety().get(0);
6858    }
6859
6860    /**
6861     * @return {@link #shelfLifeStorage} (Shelf Life and storage information.)
6862     */
6863    public List<ProductShelfLife> getShelfLifeStorage() { 
6864      if (this.shelfLifeStorage == null)
6865        this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
6866      return this.shelfLifeStorage;
6867    }
6868
6869    /**
6870     * @return Returns a reference to <code>this</code> for easy method chaining
6871     */
6872    public DeviceDefinition setShelfLifeStorage(List<ProductShelfLife> theShelfLifeStorage) { 
6873      this.shelfLifeStorage = theShelfLifeStorage;
6874      return this;
6875    }
6876
6877    public boolean hasShelfLifeStorage() { 
6878      if (this.shelfLifeStorage == null)
6879        return false;
6880      for (ProductShelfLife item : this.shelfLifeStorage)
6881        if (!item.isEmpty())
6882          return true;
6883      return false;
6884    }
6885
6886    public ProductShelfLife addShelfLifeStorage() { //3
6887      ProductShelfLife t = new ProductShelfLife();
6888      if (this.shelfLifeStorage == null)
6889        this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
6890      this.shelfLifeStorage.add(t);
6891      return t;
6892    }
6893
6894    public DeviceDefinition addShelfLifeStorage(ProductShelfLife t) { //3
6895      if (t == null)
6896        return this;
6897      if (this.shelfLifeStorage == null)
6898        this.shelfLifeStorage = new ArrayList<ProductShelfLife>();
6899      this.shelfLifeStorage.add(t);
6900      return this;
6901    }
6902
6903    /**
6904     * @return The first repetition of repeating field {@link #shelfLifeStorage}, creating it if it does not already exist {3}
6905     */
6906    public ProductShelfLife getShelfLifeStorageFirstRep() { 
6907      if (getShelfLifeStorage().isEmpty()) {
6908        addShelfLifeStorage();
6909      }
6910      return getShelfLifeStorage().get(0);
6911    }
6912
6913    /**
6914     * @return {@link #languageCode} (Language code for the human-readable text strings produced by the device (all supported).)
6915     */
6916    public List<CodeableConcept> getLanguageCode() { 
6917      if (this.languageCode == null)
6918        this.languageCode = new ArrayList<CodeableConcept>();
6919      return this.languageCode;
6920    }
6921
6922    /**
6923     * @return Returns a reference to <code>this</code> for easy method chaining
6924     */
6925    public DeviceDefinition setLanguageCode(List<CodeableConcept> theLanguageCode) { 
6926      this.languageCode = theLanguageCode;
6927      return this;
6928    }
6929
6930    public boolean hasLanguageCode() { 
6931      if (this.languageCode == null)
6932        return false;
6933      for (CodeableConcept item : this.languageCode)
6934        if (!item.isEmpty())
6935          return true;
6936      return false;
6937    }
6938
6939    public CodeableConcept addLanguageCode() { //3
6940      CodeableConcept t = new CodeableConcept();
6941      if (this.languageCode == null)
6942        this.languageCode = new ArrayList<CodeableConcept>();
6943      this.languageCode.add(t);
6944      return t;
6945    }
6946
6947    public DeviceDefinition addLanguageCode(CodeableConcept t) { //3
6948      if (t == null)
6949        return this;
6950      if (this.languageCode == null)
6951        this.languageCode = new ArrayList<CodeableConcept>();
6952      this.languageCode.add(t);
6953      return this;
6954    }
6955
6956    /**
6957     * @return The first repetition of repeating field {@link #languageCode}, creating it if it does not already exist {3}
6958     */
6959    public CodeableConcept getLanguageCodeFirstRep() { 
6960      if (getLanguageCode().isEmpty()) {
6961        addLanguageCode();
6962      }
6963      return getLanguageCode().get(0);
6964    }
6965
6966    /**
6967     * @return {@link #property} (Static or essentially fixed characteristics or features of this kind of device that are otherwise not captured in more specific attributes, e.g., time or timing attributes, resolution, accuracy, and physical attributes.)
6968     */
6969    public List<DeviceDefinitionPropertyComponent> getProperty() { 
6970      if (this.property == null)
6971        this.property = new ArrayList<DeviceDefinitionPropertyComponent>();
6972      return this.property;
6973    }
6974
6975    /**
6976     * @return Returns a reference to <code>this</code> for easy method chaining
6977     */
6978    public DeviceDefinition setProperty(List<DeviceDefinitionPropertyComponent> theProperty) { 
6979      this.property = theProperty;
6980      return this;
6981    }
6982
6983    public boolean hasProperty() { 
6984      if (this.property == null)
6985        return false;
6986      for (DeviceDefinitionPropertyComponent item : this.property)
6987        if (!item.isEmpty())
6988          return true;
6989      return false;
6990    }
6991
6992    public DeviceDefinitionPropertyComponent addProperty() { //3
6993      DeviceDefinitionPropertyComponent t = new DeviceDefinitionPropertyComponent();
6994      if (this.property == null)
6995        this.property = new ArrayList<DeviceDefinitionPropertyComponent>();
6996      this.property.add(t);
6997      return t;
6998    }
6999
7000    public DeviceDefinition addProperty(DeviceDefinitionPropertyComponent t) { //3
7001      if (t == null)
7002        return this;
7003      if (this.property == null)
7004        this.property = new ArrayList<DeviceDefinitionPropertyComponent>();
7005      this.property.add(t);
7006      return this;
7007    }
7008
7009    /**
7010     * @return The first repetition of repeating field {@link #property}, creating it if it does not already exist {3}
7011     */
7012    public DeviceDefinitionPropertyComponent getPropertyFirstRep() { 
7013      if (getProperty().isEmpty()) {
7014        addProperty();
7015      }
7016      return getProperty().get(0);
7017    }
7018
7019    /**
7020     * @return {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
7021     */
7022    public Reference getOwner() { 
7023      if (this.owner == null)
7024        if (Configuration.errorOnAutoCreate())
7025          throw new Error("Attempt to auto-create DeviceDefinition.owner");
7026        else if (Configuration.doAutoCreate())
7027          this.owner = new Reference(); // cc
7028      return this.owner;
7029    }
7030
7031    public boolean hasOwner() { 
7032      return this.owner != null && !this.owner.isEmpty();
7033    }
7034
7035    /**
7036     * @param value {@link #owner} (An organization that is responsible for the provision and ongoing maintenance of the device.)
7037     */
7038    public DeviceDefinition setOwner(Reference value) { 
7039      this.owner = value;
7040      return this;
7041    }
7042
7043    /**
7044     * @return {@link #contact} (Contact details for an organization or a particular human that is responsible for the device.)
7045     */
7046    public List<ContactPoint> getContact() { 
7047      if (this.contact == null)
7048        this.contact = new ArrayList<ContactPoint>();
7049      return this.contact;
7050    }
7051
7052    /**
7053     * @return Returns a reference to <code>this</code> for easy method chaining
7054     */
7055    public DeviceDefinition setContact(List<ContactPoint> theContact) { 
7056      this.contact = theContact;
7057      return this;
7058    }
7059
7060    public boolean hasContact() { 
7061      if (this.contact == null)
7062        return false;
7063      for (ContactPoint item : this.contact)
7064        if (!item.isEmpty())
7065          return true;
7066      return false;
7067    }
7068
7069    public ContactPoint addContact() { //3
7070      ContactPoint t = new ContactPoint();
7071      if (this.contact == null)
7072        this.contact = new ArrayList<ContactPoint>();
7073      this.contact.add(t);
7074      return t;
7075    }
7076
7077    public DeviceDefinition addContact(ContactPoint t) { //3
7078      if (t == null)
7079        return this;
7080      if (this.contact == null)
7081        this.contact = new ArrayList<ContactPoint>();
7082      this.contact.add(t);
7083      return this;
7084    }
7085
7086    /**
7087     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
7088     */
7089    public ContactPoint getContactFirstRep() { 
7090      if (getContact().isEmpty()) {
7091        addContact();
7092      }
7093      return getContact().get(0);
7094    }
7095
7096    /**
7097     * @return {@link #link} (An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.)
7098     */
7099    public List<DeviceDefinitionLinkComponent> getLink() { 
7100      if (this.link == null)
7101        this.link = new ArrayList<DeviceDefinitionLinkComponent>();
7102      return this.link;
7103    }
7104
7105    /**
7106     * @return Returns a reference to <code>this</code> for easy method chaining
7107     */
7108    public DeviceDefinition setLink(List<DeviceDefinitionLinkComponent> theLink) { 
7109      this.link = theLink;
7110      return this;
7111    }
7112
7113    public boolean hasLink() { 
7114      if (this.link == null)
7115        return false;
7116      for (DeviceDefinitionLinkComponent item : this.link)
7117        if (!item.isEmpty())
7118          return true;
7119      return false;
7120    }
7121
7122    public DeviceDefinitionLinkComponent addLink() { //3
7123      DeviceDefinitionLinkComponent t = new DeviceDefinitionLinkComponent();
7124      if (this.link == null)
7125        this.link = new ArrayList<DeviceDefinitionLinkComponent>();
7126      this.link.add(t);
7127      return t;
7128    }
7129
7130    public DeviceDefinition addLink(DeviceDefinitionLinkComponent t) { //3
7131      if (t == null)
7132        return this;
7133      if (this.link == null)
7134        this.link = new ArrayList<DeviceDefinitionLinkComponent>();
7135      this.link.add(t);
7136      return this;
7137    }
7138
7139    /**
7140     * @return The first repetition of repeating field {@link #link}, creating it if it does not already exist {3}
7141     */
7142    public DeviceDefinitionLinkComponent getLinkFirstRep() { 
7143      if (getLink().isEmpty()) {
7144        addLink();
7145      }
7146      return getLink().get(0);
7147    }
7148
7149    /**
7150     * @return {@link #note} (Descriptive information, usage information or implantation information that is not captured in an existing element.)
7151     */
7152    public List<Annotation> getNote() { 
7153      if (this.note == null)
7154        this.note = new ArrayList<Annotation>();
7155      return this.note;
7156    }
7157
7158    /**
7159     * @return Returns a reference to <code>this</code> for easy method chaining
7160     */
7161    public DeviceDefinition setNote(List<Annotation> theNote) { 
7162      this.note = theNote;
7163      return this;
7164    }
7165
7166    public boolean hasNote() { 
7167      if (this.note == null)
7168        return false;
7169      for (Annotation item : this.note)
7170        if (!item.isEmpty())
7171          return true;
7172      return false;
7173    }
7174
7175    public Annotation addNote() { //3
7176      Annotation t = new Annotation();
7177      if (this.note == null)
7178        this.note = new ArrayList<Annotation>();
7179      this.note.add(t);
7180      return t;
7181    }
7182
7183    public DeviceDefinition addNote(Annotation t) { //3
7184      if (t == null)
7185        return this;
7186      if (this.note == null)
7187        this.note = new ArrayList<Annotation>();
7188      this.note.add(t);
7189      return this;
7190    }
7191
7192    /**
7193     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
7194     */
7195    public Annotation getNoteFirstRep() { 
7196      if (getNote().isEmpty()) {
7197        addNote();
7198      }
7199      return getNote().get(0);
7200    }
7201
7202    /**
7203     * @return {@link #material} (A substance used to create the material(s) of which the device is made.)
7204     */
7205    public List<DeviceDefinitionMaterialComponent> getMaterial() { 
7206      if (this.material == null)
7207        this.material = new ArrayList<DeviceDefinitionMaterialComponent>();
7208      return this.material;
7209    }
7210
7211    /**
7212     * @return Returns a reference to <code>this</code> for easy method chaining
7213     */
7214    public DeviceDefinition setMaterial(List<DeviceDefinitionMaterialComponent> theMaterial) { 
7215      this.material = theMaterial;
7216      return this;
7217    }
7218
7219    public boolean hasMaterial() { 
7220      if (this.material == null)
7221        return false;
7222      for (DeviceDefinitionMaterialComponent item : this.material)
7223        if (!item.isEmpty())
7224          return true;
7225      return false;
7226    }
7227
7228    public DeviceDefinitionMaterialComponent addMaterial() { //3
7229      DeviceDefinitionMaterialComponent t = new DeviceDefinitionMaterialComponent();
7230      if (this.material == null)
7231        this.material = new ArrayList<DeviceDefinitionMaterialComponent>();
7232      this.material.add(t);
7233      return t;
7234    }
7235
7236    public DeviceDefinition addMaterial(DeviceDefinitionMaterialComponent t) { //3
7237      if (t == null)
7238        return this;
7239      if (this.material == null)
7240        this.material = new ArrayList<DeviceDefinitionMaterialComponent>();
7241      this.material.add(t);
7242      return this;
7243    }
7244
7245    /**
7246     * @return The first repetition of repeating field {@link #material}, creating it if it does not already exist {3}
7247     */
7248    public DeviceDefinitionMaterialComponent getMaterialFirstRep() { 
7249      if (getMaterial().isEmpty()) {
7250        addMaterial();
7251      }
7252      return getMaterial().get(0);
7253    }
7254
7255    /**
7256     * @return {@link #productionIdentifierInUDI} (Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.)
7257     */
7258    public List<Enumeration<DeviceProductionIdentifierInUDI>> getProductionIdentifierInUDI() { 
7259      if (this.productionIdentifierInUDI == null)
7260        this.productionIdentifierInUDI = new ArrayList<Enumeration<DeviceProductionIdentifierInUDI>>();
7261      return this.productionIdentifierInUDI;
7262    }
7263
7264    /**
7265     * @return Returns a reference to <code>this</code> for easy method chaining
7266     */
7267    public DeviceDefinition setProductionIdentifierInUDI(List<Enumeration<DeviceProductionIdentifierInUDI>> theProductionIdentifierInUDI) { 
7268      this.productionIdentifierInUDI = theProductionIdentifierInUDI;
7269      return this;
7270    }
7271
7272    public boolean hasProductionIdentifierInUDI() { 
7273      if (this.productionIdentifierInUDI == null)
7274        return false;
7275      for (Enumeration<DeviceProductionIdentifierInUDI> item : this.productionIdentifierInUDI)
7276        if (!item.isEmpty())
7277          return true;
7278      return false;
7279    }
7280
7281    /**
7282     * @return {@link #productionIdentifierInUDI} (Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.)
7283     */
7284    public Enumeration<DeviceProductionIdentifierInUDI> addProductionIdentifierInUDIElement() {//2 
7285      Enumeration<DeviceProductionIdentifierInUDI> t = new Enumeration<DeviceProductionIdentifierInUDI>(new DeviceProductionIdentifierInUDIEnumFactory());
7286      if (this.productionIdentifierInUDI == null)
7287        this.productionIdentifierInUDI = new ArrayList<Enumeration<DeviceProductionIdentifierInUDI>>();
7288      this.productionIdentifierInUDI.add(t);
7289      return t;
7290    }
7291
7292    /**
7293     * @param value {@link #productionIdentifierInUDI} (Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.)
7294     */
7295    public DeviceDefinition addProductionIdentifierInUDI(DeviceProductionIdentifierInUDI value) { //1
7296      Enumeration<DeviceProductionIdentifierInUDI> t = new Enumeration<DeviceProductionIdentifierInUDI>(new DeviceProductionIdentifierInUDIEnumFactory());
7297      t.setValue(value);
7298      if (this.productionIdentifierInUDI == null)
7299        this.productionIdentifierInUDI = new ArrayList<Enumeration<DeviceProductionIdentifierInUDI>>();
7300      this.productionIdentifierInUDI.add(t);
7301      return this;
7302    }
7303
7304    /**
7305     * @param value {@link #productionIdentifierInUDI} (Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.)
7306     */
7307    public boolean hasProductionIdentifierInUDI(DeviceProductionIdentifierInUDI value) { 
7308      if (this.productionIdentifierInUDI == null)
7309        return false;
7310      for (Enumeration<DeviceProductionIdentifierInUDI> v : this.productionIdentifierInUDI)
7311        if (v.getValue().equals(value)) // code
7312          return true;
7313      return false;
7314    }
7315
7316    /**
7317     * @return {@link #guideline} (Information aimed at providing directions for the usage of this model of device.)
7318     */
7319    public DeviceDefinitionGuidelineComponent getGuideline() { 
7320      if (this.guideline == null)
7321        if (Configuration.errorOnAutoCreate())
7322          throw new Error("Attempt to auto-create DeviceDefinition.guideline");
7323        else if (Configuration.doAutoCreate())
7324          this.guideline = new DeviceDefinitionGuidelineComponent(); // cc
7325      return this.guideline;
7326    }
7327
7328    public boolean hasGuideline() { 
7329      return this.guideline != null && !this.guideline.isEmpty();
7330    }
7331
7332    /**
7333     * @param value {@link #guideline} (Information aimed at providing directions for the usage of this model of device.)
7334     */
7335    public DeviceDefinition setGuideline(DeviceDefinitionGuidelineComponent value) { 
7336      this.guideline = value;
7337      return this;
7338    }
7339
7340    /**
7341     * @return {@link #correctiveAction} (Tracking of latest field safety corrective action.)
7342     */
7343    public DeviceDefinitionCorrectiveActionComponent getCorrectiveAction() { 
7344      if (this.correctiveAction == null)
7345        if (Configuration.errorOnAutoCreate())
7346          throw new Error("Attempt to auto-create DeviceDefinition.correctiveAction");
7347        else if (Configuration.doAutoCreate())
7348          this.correctiveAction = new DeviceDefinitionCorrectiveActionComponent(); // cc
7349      return this.correctiveAction;
7350    }
7351
7352    public boolean hasCorrectiveAction() { 
7353      return this.correctiveAction != null && !this.correctiveAction.isEmpty();
7354    }
7355
7356    /**
7357     * @param value {@link #correctiveAction} (Tracking of latest field safety corrective action.)
7358     */
7359    public DeviceDefinition setCorrectiveAction(DeviceDefinitionCorrectiveActionComponent value) { 
7360      this.correctiveAction = value;
7361      return this;
7362    }
7363
7364    /**
7365     * @return {@link #chargeItem} (Billing code or reference associated with the device.)
7366     */
7367    public List<DeviceDefinitionChargeItemComponent> getChargeItem() { 
7368      if (this.chargeItem == null)
7369        this.chargeItem = new ArrayList<DeviceDefinitionChargeItemComponent>();
7370      return this.chargeItem;
7371    }
7372
7373    /**
7374     * @return Returns a reference to <code>this</code> for easy method chaining
7375     */
7376    public DeviceDefinition setChargeItem(List<DeviceDefinitionChargeItemComponent> theChargeItem) { 
7377      this.chargeItem = theChargeItem;
7378      return this;
7379    }
7380
7381    public boolean hasChargeItem() { 
7382      if (this.chargeItem == null)
7383        return false;
7384      for (DeviceDefinitionChargeItemComponent item : this.chargeItem)
7385        if (!item.isEmpty())
7386          return true;
7387      return false;
7388    }
7389
7390    public DeviceDefinitionChargeItemComponent addChargeItem() { //3
7391      DeviceDefinitionChargeItemComponent t = new DeviceDefinitionChargeItemComponent();
7392      if (this.chargeItem == null)
7393        this.chargeItem = new ArrayList<DeviceDefinitionChargeItemComponent>();
7394      this.chargeItem.add(t);
7395      return t;
7396    }
7397
7398    public DeviceDefinition addChargeItem(DeviceDefinitionChargeItemComponent t) { //3
7399      if (t == null)
7400        return this;
7401      if (this.chargeItem == null)
7402        this.chargeItem = new ArrayList<DeviceDefinitionChargeItemComponent>();
7403      this.chargeItem.add(t);
7404      return this;
7405    }
7406
7407    /**
7408     * @return The first repetition of repeating field {@link #chargeItem}, creating it if it does not already exist {3}
7409     */
7410    public DeviceDefinitionChargeItemComponent getChargeItemFirstRep() { 
7411      if (getChargeItem().isEmpty()) {
7412        addChargeItem();
7413      }
7414      return getChargeItem().get(0);
7415    }
7416
7417      protected void listChildren(List<Property> children) {
7418        super.listChildren(children);
7419        children.add(new Property("description", "markdown", "Additional information to describe the device.", 0, 1, description));
7420        children.add(new Property("identifier", "Identifier", "Unique instance identifiers assigned to a device by the software, manufacturers, other organizations or owners. For example: handle ID. The identifier is typically valued if the udiDeviceIdentifier, partNumber or modelNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type.", 0, java.lang.Integer.MAX_VALUE, identifier));
7421        children.add(new Property("udiDeviceIdentifier", "", "Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.", 0, java.lang.Integer.MAX_VALUE, udiDeviceIdentifier));
7422        children.add(new Property("regulatoryIdentifier", "", "Identifier associated with the regulatory documentation (certificates, technical documentation, post-market surveillance documentation and reports) of a set of device models sharing the same intended purpose, risk class and essential design and manufacturing characteristics. One example is the Basic UDI-DI in Europe.", 0, java.lang.Integer.MAX_VALUE, regulatoryIdentifier));
7423        children.add(new Property("partNumber", "string", "The part number or catalog number of the device.", 0, 1, partNumber));
7424        children.add(new Property("manufacturer", "Reference(Organization)", "A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction.", 0, 1, manufacturer));
7425        children.add(new Property("deviceName", "", "The name or names of the device as given by the manufacturer.", 0, java.lang.Integer.MAX_VALUE, deviceName));
7426        children.add(new Property("modelNumber", "string", "The model number for the device for example as defined by the manufacturer or labeler, or other agency.", 0, 1, modelNumber));
7427        children.add(new Property("classification", "", "What kind of device or device system this is.", 0, java.lang.Integer.MAX_VALUE, classification));
7428        children.add(new Property("conformsTo", "", "Identifies the standards, specifications, or formal guidances for the capabilities supported by the device. The device may be certified as conformant to these specifications e.g., communication, performance, process, measurement, or specialization standards.", 0, java.lang.Integer.MAX_VALUE, conformsTo));
7429        children.add(new Property("hasPart", "", "A device that is part (for example a component) of the present device.", 0, java.lang.Integer.MAX_VALUE, hasPart));
7430        children.add(new Property("packaging", "", "Information about the packaging of the device, i.e. how the device is packaged.", 0, java.lang.Integer.MAX_VALUE, packaging));
7431        children.add(new Property("version", "", "The version of the device or software.", 0, java.lang.Integer.MAX_VALUE, version));
7432        children.add(new Property("safety", "CodeableConcept", "Safety characteristics of the device.", 0, java.lang.Integer.MAX_VALUE, safety));
7433        children.add(new Property("shelfLifeStorage", "ProductShelfLife", "Shelf Life and storage information.", 0, java.lang.Integer.MAX_VALUE, shelfLifeStorage));
7434        children.add(new Property("languageCode", "CodeableConcept", "Language code for the human-readable text strings produced by the device (all supported).", 0, java.lang.Integer.MAX_VALUE, languageCode));
7435        children.add(new Property("property", "", "Static or essentially fixed characteristics or features of this kind of device that are otherwise not captured in more specific attributes, e.g., time or timing attributes, resolution, accuracy, and physical attributes.", 0, java.lang.Integer.MAX_VALUE, property));
7436        children.add(new Property("owner", "Reference(Organization)", "An organization that is responsible for the provision and ongoing maintenance of the device.", 0, 1, owner));
7437        children.add(new Property("contact", "ContactPoint", "Contact details for an organization or a particular human that is responsible for the device.", 0, java.lang.Integer.MAX_VALUE, contact));
7438        children.add(new Property("link", "", "An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.", 0, java.lang.Integer.MAX_VALUE, link));
7439        children.add(new Property("note", "Annotation", "Descriptive information, usage information or implantation information that is not captured in an existing element.", 0, java.lang.Integer.MAX_VALUE, note));
7440        children.add(new Property("material", "", "A substance used to create the material(s) of which the device is made.", 0, java.lang.Integer.MAX_VALUE, material));
7441        children.add(new Property("productionIdentifierInUDI", "code", "Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.", 0, java.lang.Integer.MAX_VALUE, productionIdentifierInUDI));
7442        children.add(new Property("guideline", "", "Information aimed at providing directions for the usage of this model of device.", 0, 1, guideline));
7443        children.add(new Property("correctiveAction", "", "Tracking of latest field safety corrective action.", 0, 1, correctiveAction));
7444        children.add(new Property("chargeItem", "", "Billing code or reference associated with the device.", 0, java.lang.Integer.MAX_VALUE, chargeItem));
7445      }
7446
7447      @Override
7448      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7449        switch (_hash) {
7450        case -1724546052: /*description*/  return new Property("description", "markdown", "Additional information to describe the device.", 0, 1, description);
7451        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique instance identifiers assigned to a device by the software, manufacturers, other organizations or owners. For example: handle ID. The identifier is typically valued if the udiDeviceIdentifier, partNumber or modelNumber is not valued and represents a different type of identifier.  However, it is permissible to still include those identifiers in DeviceDefinition.identifier with the appropriate identifier.type.", 0, java.lang.Integer.MAX_VALUE, identifier);
7452        case -99121287: /*udiDeviceIdentifier*/  return new Property("udiDeviceIdentifier", "", "Unique device identifier (UDI) assigned to device label or package.  Note that the Device may include multiple udiCarriers as it either may include just the udiCarrier for the jurisdiction it is sold, or for multiple jurisdictions it could have been sold.", 0, java.lang.Integer.MAX_VALUE, udiDeviceIdentifier);
7453        case 455683425: /*regulatoryIdentifier*/  return new Property("regulatoryIdentifier", "", "Identifier associated with the regulatory documentation (certificates, technical documentation, post-market surveillance documentation and reports) of a set of device models sharing the same intended purpose, risk class and essential design and manufacturing characteristics. One example is the Basic UDI-DI in Europe.", 0, java.lang.Integer.MAX_VALUE, regulatoryIdentifier);
7454        case -731502308: /*partNumber*/  return new Property("partNumber", "string", "The part number or catalog number of the device.", 0, 1, partNumber);
7455        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "Reference(Organization)", "A name of the manufacturer  or legal representative e.g. labeler. Whether this is the actual manufacturer or the labeler or responsible depends on implementation and jurisdiction.", 0, 1, manufacturer);
7456        case 780988929: /*deviceName*/  return new Property("deviceName", "", "The name or names of the device as given by the manufacturer.", 0, java.lang.Integer.MAX_VALUE, deviceName);
7457        case 346619858: /*modelNumber*/  return new Property("modelNumber", "string", "The model number for the device for example as defined by the manufacturer or labeler, or other agency.", 0, 1, modelNumber);
7458        case 382350310: /*classification*/  return new Property("classification", "", "What kind of device or device system this is.", 0, java.lang.Integer.MAX_VALUE, classification);
7459        case 1014198088: /*conformsTo*/  return new Property("conformsTo", "", "Identifies the standards, specifications, or formal guidances for the capabilities supported by the device. The device may be certified as conformant to these specifications e.g., communication, performance, process, measurement, or specialization standards.", 0, java.lang.Integer.MAX_VALUE, conformsTo);
7460        case 696815021: /*hasPart*/  return new Property("hasPart", "", "A device that is part (for example a component) of the present device.", 0, java.lang.Integer.MAX_VALUE, hasPart);
7461        case 1802065795: /*packaging*/  return new Property("packaging", "", "Information about the packaging of the device, i.e. how the device is packaged.", 0, java.lang.Integer.MAX_VALUE, packaging);
7462        case 351608024: /*version*/  return new Property("version", "", "The version of the device or software.", 0, java.lang.Integer.MAX_VALUE, version);
7463        case -909893934: /*safety*/  return new Property("safety", "CodeableConcept", "Safety characteristics of the device.", 0, java.lang.Integer.MAX_VALUE, safety);
7464        case 172049237: /*shelfLifeStorage*/  return new Property("shelfLifeStorage", "ProductShelfLife", "Shelf Life and storage information.", 0, java.lang.Integer.MAX_VALUE, shelfLifeStorage);
7465        case -2092349083: /*languageCode*/  return new Property("languageCode", "CodeableConcept", "Language code for the human-readable text strings produced by the device (all supported).", 0, java.lang.Integer.MAX_VALUE, languageCode);
7466        case -993141291: /*property*/  return new Property("property", "", "Static or essentially fixed characteristics or features of this kind of device that are otherwise not captured in more specific attributes, e.g., time or timing attributes, resolution, accuracy, and physical attributes.", 0, java.lang.Integer.MAX_VALUE, property);
7467        case 106164915: /*owner*/  return new Property("owner", "Reference(Organization)", "An organization that is responsible for the provision and ongoing maintenance of the device.", 0, 1, owner);
7468        case 951526432: /*contact*/  return new Property("contact", "ContactPoint", "Contact details for an organization or a particular human that is responsible for the device.", 0, java.lang.Integer.MAX_VALUE, contact);
7469        case 3321850: /*link*/  return new Property("link", "", "An associated device, attached to, used with, communicating with or linking a previous or new device model to the focal device.", 0, java.lang.Integer.MAX_VALUE, link);
7470        case 3387378: /*note*/  return new Property("note", "Annotation", "Descriptive information, usage information or implantation information that is not captured in an existing element.", 0, java.lang.Integer.MAX_VALUE, note);
7471        case 299066663: /*material*/  return new Property("material", "", "A substance used to create the material(s) of which the device is made.", 0, java.lang.Integer.MAX_VALUE, material);
7472        case 312405811: /*productionIdentifierInUDI*/  return new Property("productionIdentifierInUDI", "code", "Indicates the production identifier(s) that are expected to appear in the UDI carrier on the device label.", 0, java.lang.Integer.MAX_VALUE, productionIdentifierInUDI);
7473        case -2075718416: /*guideline*/  return new Property("guideline", "", "Information aimed at providing directions for the usage of this model of device.", 0, 1, guideline);
7474        case 1354575876: /*correctiveAction*/  return new Property("correctiveAction", "", "Tracking of latest field safety corrective action.", 0, 1, correctiveAction);
7475        case 1417779175: /*chargeItem*/  return new Property("chargeItem", "", "Billing code or reference associated with the device.", 0, java.lang.Integer.MAX_VALUE, chargeItem);
7476        default: return super.getNamedProperty(_hash, _name, _checkValid);
7477        }
7478
7479      }
7480
7481      @Override
7482      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7483        switch (hash) {
7484        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
7485        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
7486        case -99121287: /*udiDeviceIdentifier*/ return this.udiDeviceIdentifier == null ? new Base[0] : this.udiDeviceIdentifier.toArray(new Base[this.udiDeviceIdentifier.size()]); // DeviceDefinitionUdiDeviceIdentifierComponent
7487        case 455683425: /*regulatoryIdentifier*/ return this.regulatoryIdentifier == null ? new Base[0] : this.regulatoryIdentifier.toArray(new Base[this.regulatoryIdentifier.size()]); // DeviceDefinitionRegulatoryIdentifierComponent
7488        case -731502308: /*partNumber*/ return this.partNumber == null ? new Base[0] : new Base[] {this.partNumber}; // StringType
7489        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : new Base[] {this.manufacturer}; // Reference
7490        case 780988929: /*deviceName*/ return this.deviceName == null ? new Base[0] : this.deviceName.toArray(new Base[this.deviceName.size()]); // DeviceDefinitionDeviceNameComponent
7491        case 346619858: /*modelNumber*/ return this.modelNumber == null ? new Base[0] : new Base[] {this.modelNumber}; // StringType
7492        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : this.classification.toArray(new Base[this.classification.size()]); // DeviceDefinitionClassificationComponent
7493        case 1014198088: /*conformsTo*/ return this.conformsTo == null ? new Base[0] : this.conformsTo.toArray(new Base[this.conformsTo.size()]); // DeviceDefinitionConformsToComponent
7494        case 696815021: /*hasPart*/ return this.hasPart == null ? new Base[0] : this.hasPart.toArray(new Base[this.hasPart.size()]); // DeviceDefinitionHasPartComponent
7495        case 1802065795: /*packaging*/ return this.packaging == null ? new Base[0] : this.packaging.toArray(new Base[this.packaging.size()]); // DeviceDefinitionPackagingComponent
7496        case 351608024: /*version*/ return this.version == null ? new Base[0] : this.version.toArray(new Base[this.version.size()]); // DeviceDefinitionVersionComponent
7497        case -909893934: /*safety*/ return this.safety == null ? new Base[0] : this.safety.toArray(new Base[this.safety.size()]); // CodeableConcept
7498        case 172049237: /*shelfLifeStorage*/ return this.shelfLifeStorage == null ? new Base[0] : this.shelfLifeStorage.toArray(new Base[this.shelfLifeStorage.size()]); // ProductShelfLife
7499        case -2092349083: /*languageCode*/ return this.languageCode == null ? new Base[0] : this.languageCode.toArray(new Base[this.languageCode.size()]); // CodeableConcept
7500        case -993141291: /*property*/ return this.property == null ? new Base[0] : this.property.toArray(new Base[this.property.size()]); // DeviceDefinitionPropertyComponent
7501        case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
7502        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
7503        case 3321850: /*link*/ return this.link == null ? new Base[0] : this.link.toArray(new Base[this.link.size()]); // DeviceDefinitionLinkComponent
7504        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
7505        case 299066663: /*material*/ return this.material == null ? new Base[0] : this.material.toArray(new Base[this.material.size()]); // DeviceDefinitionMaterialComponent
7506        case 312405811: /*productionIdentifierInUDI*/ return this.productionIdentifierInUDI == null ? new Base[0] : this.productionIdentifierInUDI.toArray(new Base[this.productionIdentifierInUDI.size()]); // Enumeration<DeviceProductionIdentifierInUDI>
7507        case -2075718416: /*guideline*/ return this.guideline == null ? new Base[0] : new Base[] {this.guideline}; // DeviceDefinitionGuidelineComponent
7508        case 1354575876: /*correctiveAction*/ return this.correctiveAction == null ? new Base[0] : new Base[] {this.correctiveAction}; // DeviceDefinitionCorrectiveActionComponent
7509        case 1417779175: /*chargeItem*/ return this.chargeItem == null ? new Base[0] : this.chargeItem.toArray(new Base[this.chargeItem.size()]); // DeviceDefinitionChargeItemComponent
7510        default: return super.getProperty(hash, name, checkValid);
7511        }
7512
7513      }
7514
7515      @Override
7516      public Base setProperty(int hash, String name, Base value) throws FHIRException {
7517        switch (hash) {
7518        case -1724546052: // description
7519          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
7520          return value;
7521        case -1618432855: // identifier
7522          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
7523          return value;
7524        case -99121287: // udiDeviceIdentifier
7525          this.getUdiDeviceIdentifier().add((DeviceDefinitionUdiDeviceIdentifierComponent) value); // DeviceDefinitionUdiDeviceIdentifierComponent
7526          return value;
7527        case 455683425: // regulatoryIdentifier
7528          this.getRegulatoryIdentifier().add((DeviceDefinitionRegulatoryIdentifierComponent) value); // DeviceDefinitionRegulatoryIdentifierComponent
7529          return value;
7530        case -731502308: // partNumber
7531          this.partNumber = TypeConvertor.castToString(value); // StringType
7532          return value;
7533        case -1969347631: // manufacturer
7534          this.manufacturer = TypeConvertor.castToReference(value); // Reference
7535          return value;
7536        case 780988929: // deviceName
7537          this.getDeviceName().add((DeviceDefinitionDeviceNameComponent) value); // DeviceDefinitionDeviceNameComponent
7538          return value;
7539        case 346619858: // modelNumber
7540          this.modelNumber = TypeConvertor.castToString(value); // StringType
7541          return value;
7542        case 382350310: // classification
7543          this.getClassification().add((DeviceDefinitionClassificationComponent) value); // DeviceDefinitionClassificationComponent
7544          return value;
7545        case 1014198088: // conformsTo
7546          this.getConformsTo().add((DeviceDefinitionConformsToComponent) value); // DeviceDefinitionConformsToComponent
7547          return value;
7548        case 696815021: // hasPart
7549          this.getHasPart().add((DeviceDefinitionHasPartComponent) value); // DeviceDefinitionHasPartComponent
7550          return value;
7551        case 1802065795: // packaging
7552          this.getPackaging().add((DeviceDefinitionPackagingComponent) value); // DeviceDefinitionPackagingComponent
7553          return value;
7554        case 351608024: // version
7555          this.getVersion().add((DeviceDefinitionVersionComponent) value); // DeviceDefinitionVersionComponent
7556          return value;
7557        case -909893934: // safety
7558          this.getSafety().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7559          return value;
7560        case 172049237: // shelfLifeStorage
7561          this.getShelfLifeStorage().add(TypeConvertor.castToProductShelfLife(value)); // ProductShelfLife
7562          return value;
7563        case -2092349083: // languageCode
7564          this.getLanguageCode().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
7565          return value;
7566        case -993141291: // property
7567          this.getProperty().add((DeviceDefinitionPropertyComponent) value); // DeviceDefinitionPropertyComponent
7568          return value;
7569        case 106164915: // owner
7570          this.owner = TypeConvertor.castToReference(value); // Reference
7571          return value;
7572        case 951526432: // contact
7573          this.getContact().add(TypeConvertor.castToContactPoint(value)); // ContactPoint
7574          return value;
7575        case 3321850: // link
7576          this.getLink().add((DeviceDefinitionLinkComponent) value); // DeviceDefinitionLinkComponent
7577          return value;
7578        case 3387378: // note
7579          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
7580          return value;
7581        case 299066663: // material
7582          this.getMaterial().add((DeviceDefinitionMaterialComponent) value); // DeviceDefinitionMaterialComponent
7583          return value;
7584        case 312405811: // productionIdentifierInUDI
7585          value = new DeviceProductionIdentifierInUDIEnumFactory().fromType(TypeConvertor.castToCode(value));
7586          this.getProductionIdentifierInUDI().add((Enumeration) value); // Enumeration<DeviceProductionIdentifierInUDI>
7587          return value;
7588        case -2075718416: // guideline
7589          this.guideline = (DeviceDefinitionGuidelineComponent) value; // DeviceDefinitionGuidelineComponent
7590          return value;
7591        case 1354575876: // correctiveAction
7592          this.correctiveAction = (DeviceDefinitionCorrectiveActionComponent) value; // DeviceDefinitionCorrectiveActionComponent
7593          return value;
7594        case 1417779175: // chargeItem
7595          this.getChargeItem().add((DeviceDefinitionChargeItemComponent) value); // DeviceDefinitionChargeItemComponent
7596          return value;
7597        default: return super.setProperty(hash, name, value);
7598        }
7599
7600      }
7601
7602      @Override
7603      public Base setProperty(String name, Base value) throws FHIRException {
7604        if (name.equals("description")) {
7605          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
7606        } else if (name.equals("identifier")) {
7607          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
7608        } else if (name.equals("udiDeviceIdentifier")) {
7609          this.getUdiDeviceIdentifier().add((DeviceDefinitionUdiDeviceIdentifierComponent) value);
7610        } else if (name.equals("regulatoryIdentifier")) {
7611          this.getRegulatoryIdentifier().add((DeviceDefinitionRegulatoryIdentifierComponent) value);
7612        } else if (name.equals("partNumber")) {
7613          this.partNumber = TypeConvertor.castToString(value); // StringType
7614        } else if (name.equals("manufacturer")) {
7615          this.manufacturer = TypeConvertor.castToReference(value); // Reference
7616        } else if (name.equals("deviceName")) {
7617          this.getDeviceName().add((DeviceDefinitionDeviceNameComponent) value);
7618        } else if (name.equals("modelNumber")) {
7619          this.modelNumber = TypeConvertor.castToString(value); // StringType
7620        } else if (name.equals("classification")) {
7621          this.getClassification().add((DeviceDefinitionClassificationComponent) value);
7622        } else if (name.equals("conformsTo")) {
7623          this.getConformsTo().add((DeviceDefinitionConformsToComponent) value);
7624        } else if (name.equals("hasPart")) {
7625          this.getHasPart().add((DeviceDefinitionHasPartComponent) value);
7626        } else if (name.equals("packaging")) {
7627          this.getPackaging().add((DeviceDefinitionPackagingComponent) value);
7628        } else if (name.equals("version")) {
7629          this.getVersion().add((DeviceDefinitionVersionComponent) value);
7630        } else if (name.equals("safety")) {
7631          this.getSafety().add(TypeConvertor.castToCodeableConcept(value));
7632        } else if (name.equals("shelfLifeStorage")) {
7633          this.getShelfLifeStorage().add(TypeConvertor.castToProductShelfLife(value));
7634        } else if (name.equals("languageCode")) {
7635          this.getLanguageCode().add(TypeConvertor.castToCodeableConcept(value));
7636        } else if (name.equals("property")) {
7637          this.getProperty().add((DeviceDefinitionPropertyComponent) value);
7638        } else if (name.equals("owner")) {
7639          this.owner = TypeConvertor.castToReference(value); // Reference
7640        } else if (name.equals("contact")) {
7641          this.getContact().add(TypeConvertor.castToContactPoint(value));
7642        } else if (name.equals("link")) {
7643          this.getLink().add((DeviceDefinitionLinkComponent) value);
7644        } else if (name.equals("note")) {
7645          this.getNote().add(TypeConvertor.castToAnnotation(value));
7646        } else if (name.equals("material")) {
7647          this.getMaterial().add((DeviceDefinitionMaterialComponent) value);
7648        } else if (name.equals("productionIdentifierInUDI")) {
7649          value = new DeviceProductionIdentifierInUDIEnumFactory().fromType(TypeConvertor.castToCode(value));
7650          this.getProductionIdentifierInUDI().add((Enumeration) value);
7651        } else if (name.equals("guideline")) {
7652          this.guideline = (DeviceDefinitionGuidelineComponent) value; // DeviceDefinitionGuidelineComponent
7653        } else if (name.equals("correctiveAction")) {
7654          this.correctiveAction = (DeviceDefinitionCorrectiveActionComponent) value; // DeviceDefinitionCorrectiveActionComponent
7655        } else if (name.equals("chargeItem")) {
7656          this.getChargeItem().add((DeviceDefinitionChargeItemComponent) value);
7657        } else
7658          return super.setProperty(name, value);
7659        return value;
7660      }
7661
7662  @Override
7663  public void removeChild(String name, Base value) throws FHIRException {
7664        if (name.equals("description")) {
7665          this.description = null;
7666        } else if (name.equals("identifier")) {
7667          this.getIdentifier().remove(value);
7668        } else if (name.equals("udiDeviceIdentifier")) {
7669          this.getUdiDeviceIdentifier().remove((DeviceDefinitionUdiDeviceIdentifierComponent) value);
7670        } else if (name.equals("regulatoryIdentifier")) {
7671          this.getRegulatoryIdentifier().remove((DeviceDefinitionRegulatoryIdentifierComponent) value);
7672        } else if (name.equals("partNumber")) {
7673          this.partNumber = null;
7674        } else if (name.equals("manufacturer")) {
7675          this.manufacturer = null;
7676        } else if (name.equals("deviceName")) {
7677          this.getDeviceName().remove((DeviceDefinitionDeviceNameComponent) value);
7678        } else if (name.equals("modelNumber")) {
7679          this.modelNumber = null;
7680        } else if (name.equals("classification")) {
7681          this.getClassification().remove((DeviceDefinitionClassificationComponent) value);
7682        } else if (name.equals("conformsTo")) {
7683          this.getConformsTo().remove((DeviceDefinitionConformsToComponent) value);
7684        } else if (name.equals("hasPart")) {
7685          this.getHasPart().remove((DeviceDefinitionHasPartComponent) value);
7686        } else if (name.equals("packaging")) {
7687          this.getPackaging().remove((DeviceDefinitionPackagingComponent) value);
7688        } else if (name.equals("version")) {
7689          this.getVersion().remove((DeviceDefinitionVersionComponent) value);
7690        } else if (name.equals("safety")) {
7691          this.getSafety().remove(value);
7692        } else if (name.equals("shelfLifeStorage")) {
7693          this.getShelfLifeStorage().remove(value);
7694        } else if (name.equals("languageCode")) {
7695          this.getLanguageCode().remove(value);
7696        } else if (name.equals("property")) {
7697          this.getProperty().remove((DeviceDefinitionPropertyComponent) value);
7698        } else if (name.equals("owner")) {
7699          this.owner = null;
7700        } else if (name.equals("contact")) {
7701          this.getContact().remove(value);
7702        } else if (name.equals("link")) {
7703          this.getLink().remove((DeviceDefinitionLinkComponent) value);
7704        } else if (name.equals("note")) {
7705          this.getNote().remove(value);
7706        } else if (name.equals("material")) {
7707          this.getMaterial().remove((DeviceDefinitionMaterialComponent) value);
7708        } else if (name.equals("productionIdentifierInUDI")) {
7709          value = new DeviceProductionIdentifierInUDIEnumFactory().fromType(TypeConvertor.castToCode(value));
7710          this.getProductionIdentifierInUDI().remove((Enumeration) value);
7711        } else if (name.equals("guideline")) {
7712          this.guideline = (DeviceDefinitionGuidelineComponent) value; // DeviceDefinitionGuidelineComponent
7713        } else if (name.equals("correctiveAction")) {
7714          this.correctiveAction = (DeviceDefinitionCorrectiveActionComponent) value; // DeviceDefinitionCorrectiveActionComponent
7715        } else if (name.equals("chargeItem")) {
7716          this.getChargeItem().remove((DeviceDefinitionChargeItemComponent) value);
7717        } else
7718          super.removeChild(name, value);
7719        
7720      }
7721
7722      @Override
7723      public Base makeProperty(int hash, String name) throws FHIRException {
7724        switch (hash) {
7725        case -1724546052:  return getDescriptionElement();
7726        case -1618432855:  return addIdentifier(); 
7727        case -99121287:  return addUdiDeviceIdentifier(); 
7728        case 455683425:  return addRegulatoryIdentifier(); 
7729        case -731502308:  return getPartNumberElement();
7730        case -1969347631:  return getManufacturer();
7731        case 780988929:  return addDeviceName(); 
7732        case 346619858:  return getModelNumberElement();
7733        case 382350310:  return addClassification(); 
7734        case 1014198088:  return addConformsTo(); 
7735        case 696815021:  return addHasPart(); 
7736        case 1802065795:  return addPackaging(); 
7737        case 351608024:  return addVersion(); 
7738        case -909893934:  return addSafety(); 
7739        case 172049237:  return addShelfLifeStorage(); 
7740        case -2092349083:  return addLanguageCode(); 
7741        case -993141291:  return addProperty(); 
7742        case 106164915:  return getOwner();
7743        case 951526432:  return addContact(); 
7744        case 3321850:  return addLink(); 
7745        case 3387378:  return addNote(); 
7746        case 299066663:  return addMaterial(); 
7747        case 312405811:  return addProductionIdentifierInUDIElement();
7748        case -2075718416:  return getGuideline();
7749        case 1354575876:  return getCorrectiveAction();
7750        case 1417779175:  return addChargeItem(); 
7751        default: return super.makeProperty(hash, name);
7752        }
7753
7754      }
7755
7756      @Override
7757      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7758        switch (hash) {
7759        case -1724546052: /*description*/ return new String[] {"markdown"};
7760        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
7761        case -99121287: /*udiDeviceIdentifier*/ return new String[] {};
7762        case 455683425: /*regulatoryIdentifier*/ return new String[] {};
7763        case -731502308: /*partNumber*/ return new String[] {"string"};
7764        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
7765        case 780988929: /*deviceName*/ return new String[] {};
7766        case 346619858: /*modelNumber*/ return new String[] {"string"};
7767        case 382350310: /*classification*/ return new String[] {};
7768        case 1014198088: /*conformsTo*/ return new String[] {};
7769        case 696815021: /*hasPart*/ return new String[] {};
7770        case 1802065795: /*packaging*/ return new String[] {};
7771        case 351608024: /*version*/ return new String[] {};
7772        case -909893934: /*safety*/ return new String[] {"CodeableConcept"};
7773        case 172049237: /*shelfLifeStorage*/ return new String[] {"ProductShelfLife"};
7774        case -2092349083: /*languageCode*/ return new String[] {"CodeableConcept"};
7775        case -993141291: /*property*/ return new String[] {};
7776        case 106164915: /*owner*/ return new String[] {"Reference"};
7777        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
7778        case 3321850: /*link*/ return new String[] {};
7779        case 3387378: /*note*/ return new String[] {"Annotation"};
7780        case 299066663: /*material*/ return new String[] {};
7781        case 312405811: /*productionIdentifierInUDI*/ return new String[] {"code"};
7782        case -2075718416: /*guideline*/ return new String[] {};
7783        case 1354575876: /*correctiveAction*/ return new String[] {};
7784        case 1417779175: /*chargeItem*/ return new String[] {};
7785        default: return super.getTypesForProperty(hash, name);
7786        }
7787
7788      }
7789
7790      @Override
7791      public Base addChild(String name) throws FHIRException {
7792        if (name.equals("description")) {
7793          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.description");
7794        }
7795        else if (name.equals("identifier")) {
7796          return addIdentifier();
7797        }
7798        else if (name.equals("udiDeviceIdentifier")) {
7799          return addUdiDeviceIdentifier();
7800        }
7801        else if (name.equals("regulatoryIdentifier")) {
7802          return addRegulatoryIdentifier();
7803        }
7804        else if (name.equals("partNumber")) {
7805          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.partNumber");
7806        }
7807        else if (name.equals("manufacturer")) {
7808          this.manufacturer = new Reference();
7809          return this.manufacturer;
7810        }
7811        else if (name.equals("deviceName")) {
7812          return addDeviceName();
7813        }
7814        else if (name.equals("modelNumber")) {
7815          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.modelNumber");
7816        }
7817        else if (name.equals("classification")) {
7818          return addClassification();
7819        }
7820        else if (name.equals("conformsTo")) {
7821          return addConformsTo();
7822        }
7823        else if (name.equals("hasPart")) {
7824          return addHasPart();
7825        }
7826        else if (name.equals("packaging")) {
7827          return addPackaging();
7828        }
7829        else if (name.equals("version")) {
7830          return addVersion();
7831        }
7832        else if (name.equals("safety")) {
7833          return addSafety();
7834        }
7835        else if (name.equals("shelfLifeStorage")) {
7836          return addShelfLifeStorage();
7837        }
7838        else if (name.equals("languageCode")) {
7839          return addLanguageCode();
7840        }
7841        else if (name.equals("property")) {
7842          return addProperty();
7843        }
7844        else if (name.equals("owner")) {
7845          this.owner = new Reference();
7846          return this.owner;
7847        }
7848        else if (name.equals("contact")) {
7849          return addContact();
7850        }
7851        else if (name.equals("link")) {
7852          return addLink();
7853        }
7854        else if (name.equals("note")) {
7855          return addNote();
7856        }
7857        else if (name.equals("material")) {
7858          return addMaterial();
7859        }
7860        else if (name.equals("productionIdentifierInUDI")) {
7861          throw new FHIRException("Cannot call addChild on a singleton property DeviceDefinition.productionIdentifierInUDI");
7862        }
7863        else if (name.equals("guideline")) {
7864          this.guideline = new DeviceDefinitionGuidelineComponent();
7865          return this.guideline;
7866        }
7867        else if (name.equals("correctiveAction")) {
7868          this.correctiveAction = new DeviceDefinitionCorrectiveActionComponent();
7869          return this.correctiveAction;
7870        }
7871        else if (name.equals("chargeItem")) {
7872          return addChargeItem();
7873        }
7874        else
7875          return super.addChild(name);
7876      }
7877
7878  public String fhirType() {
7879    return "DeviceDefinition";
7880
7881  }
7882
7883      public DeviceDefinition copy() {
7884        DeviceDefinition dst = new DeviceDefinition();
7885        copyValues(dst);
7886        return dst;
7887      }
7888
7889      public void copyValues(DeviceDefinition dst) {
7890        super.copyValues(dst);
7891        dst.description = description == null ? null : description.copy();
7892        if (identifier != null) {
7893          dst.identifier = new ArrayList<Identifier>();
7894          for (Identifier i : identifier)
7895            dst.identifier.add(i.copy());
7896        };
7897        if (udiDeviceIdentifier != null) {
7898          dst.udiDeviceIdentifier = new ArrayList<DeviceDefinitionUdiDeviceIdentifierComponent>();
7899          for (DeviceDefinitionUdiDeviceIdentifierComponent i : udiDeviceIdentifier)
7900            dst.udiDeviceIdentifier.add(i.copy());
7901        };
7902        if (regulatoryIdentifier != null) {
7903          dst.regulatoryIdentifier = new ArrayList<DeviceDefinitionRegulatoryIdentifierComponent>();
7904          for (DeviceDefinitionRegulatoryIdentifierComponent i : regulatoryIdentifier)
7905            dst.regulatoryIdentifier.add(i.copy());
7906        };
7907        dst.partNumber = partNumber == null ? null : partNumber.copy();
7908        dst.manufacturer = manufacturer == null ? null : manufacturer.copy();
7909        if (deviceName != null) {
7910          dst.deviceName = new ArrayList<DeviceDefinitionDeviceNameComponent>();
7911          for (DeviceDefinitionDeviceNameComponent i : deviceName)
7912            dst.deviceName.add(i.copy());
7913        };
7914        dst.modelNumber = modelNumber == null ? null : modelNumber.copy();
7915        if (classification != null) {
7916          dst.classification = new ArrayList<DeviceDefinitionClassificationComponent>();
7917          for (DeviceDefinitionClassificationComponent i : classification)
7918            dst.classification.add(i.copy());
7919        };
7920        if (conformsTo != null) {
7921          dst.conformsTo = new ArrayList<DeviceDefinitionConformsToComponent>();
7922          for (DeviceDefinitionConformsToComponent i : conformsTo)
7923            dst.conformsTo.add(i.copy());
7924        };
7925        if (hasPart != null) {
7926          dst.hasPart = new ArrayList<DeviceDefinitionHasPartComponent>();
7927          for (DeviceDefinitionHasPartComponent i : hasPart)
7928            dst.hasPart.add(i.copy());
7929        };
7930        if (packaging != null) {
7931          dst.packaging = new ArrayList<DeviceDefinitionPackagingComponent>();
7932          for (DeviceDefinitionPackagingComponent i : packaging)
7933            dst.packaging.add(i.copy());
7934        };
7935        if (version != null) {
7936          dst.version = new ArrayList<DeviceDefinitionVersionComponent>();
7937          for (DeviceDefinitionVersionComponent i : version)
7938            dst.version.add(i.copy());
7939        };
7940        if (safety != null) {
7941          dst.safety = new ArrayList<CodeableConcept>();
7942          for (CodeableConcept i : safety)
7943            dst.safety.add(i.copy());
7944        };
7945        if (shelfLifeStorage != null) {
7946          dst.shelfLifeStorage = new ArrayList<ProductShelfLife>();
7947          for (ProductShelfLife i : shelfLifeStorage)
7948            dst.shelfLifeStorage.add(i.copy());
7949        };
7950        if (languageCode != null) {
7951          dst.languageCode = new ArrayList<CodeableConcept>();
7952          for (CodeableConcept i : languageCode)
7953            dst.languageCode.add(i.copy());
7954        };
7955        if (property != null) {
7956          dst.property = new ArrayList<DeviceDefinitionPropertyComponent>();
7957          for (DeviceDefinitionPropertyComponent i : property)
7958            dst.property.add(i.copy());
7959        };
7960        dst.owner = owner == null ? null : owner.copy();
7961        if (contact != null) {
7962          dst.contact = new ArrayList<ContactPoint>();
7963          for (ContactPoint i : contact)
7964            dst.contact.add(i.copy());
7965        };
7966        if (link != null) {
7967          dst.link = new ArrayList<DeviceDefinitionLinkComponent>();
7968          for (DeviceDefinitionLinkComponent i : link)
7969            dst.link.add(i.copy());
7970        };
7971        if (note != null) {
7972          dst.note = new ArrayList<Annotation>();
7973          for (Annotation i : note)
7974            dst.note.add(i.copy());
7975        };
7976        if (material != null) {
7977          dst.material = new ArrayList<DeviceDefinitionMaterialComponent>();
7978          for (DeviceDefinitionMaterialComponent i : material)
7979            dst.material.add(i.copy());
7980        };
7981        if (productionIdentifierInUDI != null) {
7982          dst.productionIdentifierInUDI = new ArrayList<Enumeration<DeviceProductionIdentifierInUDI>>();
7983          for (Enumeration<DeviceProductionIdentifierInUDI> i : productionIdentifierInUDI)
7984            dst.productionIdentifierInUDI.add(i.copy());
7985        };
7986        dst.guideline = guideline == null ? null : guideline.copy();
7987        dst.correctiveAction = correctiveAction == null ? null : correctiveAction.copy();
7988        if (chargeItem != null) {
7989          dst.chargeItem = new ArrayList<DeviceDefinitionChargeItemComponent>();
7990          for (DeviceDefinitionChargeItemComponent i : chargeItem)
7991            dst.chargeItem.add(i.copy());
7992        };
7993      }
7994
7995      protected DeviceDefinition typedCopy() {
7996        return copy();
7997      }
7998
7999      @Override
8000      public boolean equalsDeep(Base other_) {
8001        if (!super.equalsDeep(other_))
8002          return false;
8003        if (!(other_ instanceof DeviceDefinition))
8004          return false;
8005        DeviceDefinition o = (DeviceDefinition) other_;
8006        return compareDeep(description, o.description, true) && compareDeep(identifier, o.identifier, true)
8007           && compareDeep(udiDeviceIdentifier, o.udiDeviceIdentifier, true) && compareDeep(regulatoryIdentifier, o.regulatoryIdentifier, true)
8008           && compareDeep(partNumber, o.partNumber, true) && compareDeep(manufacturer, o.manufacturer, true)
8009           && compareDeep(deviceName, o.deviceName, true) && compareDeep(modelNumber, o.modelNumber, true)
8010           && compareDeep(classification, o.classification, true) && compareDeep(conformsTo, o.conformsTo, true)
8011           && compareDeep(hasPart, o.hasPart, true) && compareDeep(packaging, o.packaging, true) && compareDeep(version, o.version, true)
8012           && compareDeep(safety, o.safety, true) && compareDeep(shelfLifeStorage, o.shelfLifeStorage, true)
8013           && compareDeep(languageCode, o.languageCode, true) && compareDeep(property, o.property, true) && compareDeep(owner, o.owner, true)
8014           && compareDeep(contact, o.contact, true) && compareDeep(link, o.link, true) && compareDeep(note, o.note, true)
8015           && compareDeep(material, o.material, true) && compareDeep(productionIdentifierInUDI, o.productionIdentifierInUDI, true)
8016           && compareDeep(guideline, o.guideline, true) && compareDeep(correctiveAction, o.correctiveAction, true)
8017           && compareDeep(chargeItem, o.chargeItem, true);
8018      }
8019
8020      @Override
8021      public boolean equalsShallow(Base other_) {
8022        if (!super.equalsShallow(other_))
8023          return false;
8024        if (!(other_ instanceof DeviceDefinition))
8025          return false;
8026        DeviceDefinition o = (DeviceDefinition) other_;
8027        return compareValues(description, o.description, true) && compareValues(partNumber, o.partNumber, true)
8028           && compareValues(modelNumber, o.modelNumber, true) && compareValues(productionIdentifierInUDI, o.productionIdentifierInUDI, true)
8029          ;
8030      }
8031
8032      public boolean isEmpty() {
8033        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(description, identifier, udiDeviceIdentifier
8034          , regulatoryIdentifier, partNumber, manufacturer, deviceName, modelNumber, classification
8035          , conformsTo, hasPart, packaging, version, safety, shelfLifeStorage, languageCode
8036          , property, owner, contact, link, note, material, productionIdentifierInUDI, guideline
8037          , correctiveAction, chargeItem);
8038      }
8039
8040  @Override
8041  public ResourceType getResourceType() {
8042    return ResourceType.DeviceDefinition;
8043   }
8044
8045 /**
8046   * Search parameter: <b>device-name</b>
8047   * <p>
8048   * Description: <b>A server defined search that may match any of the string fields in DeviceDefinition.name or DeviceDefinition.classification.type - the latter to search for 'generic' devices.</b><br>
8049   * Type: <b>string</b><br>
8050   * Path: <b>DeviceDefinition.deviceName.name | DeviceDefinition.classification.type.coding.display | DeviceDefinition.classification.type.text</b><br>
8051   * </p>
8052   */
8053  @SearchParamDefinition(name="device-name", path="DeviceDefinition.deviceName.name | DeviceDefinition.classification.type.coding.display | DeviceDefinition.classification.type.text", description="A server defined search that may match any of the string fields in DeviceDefinition.name or DeviceDefinition.classification.type - the latter to search for 'generic' devices.", type="string" )
8054  public static final String SP_DEVICE_NAME = "device-name";
8055 /**
8056   * <b>Fluent Client</b> search parameter constant for <b>device-name</b>
8057   * <p>
8058   * Description: <b>A server defined search that may match any of the string fields in DeviceDefinition.name or DeviceDefinition.classification.type - the latter to search for 'generic' devices.</b><br>
8059   * Type: <b>string</b><br>
8060   * Path: <b>DeviceDefinition.deviceName.name | DeviceDefinition.classification.type.coding.display | DeviceDefinition.classification.type.text</b><br>
8061   * </p>
8062   */
8063  public static final ca.uhn.fhir.rest.gclient.StringClientParam DEVICE_NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DEVICE_NAME);
8064
8065 /**
8066   * Search parameter: <b>identifier</b>
8067   * <p>
8068   * Description: <b>The identifier of the component</b><br>
8069   * Type: <b>token</b><br>
8070   * Path: <b>DeviceDefinition.identifier</b><br>
8071   * </p>
8072   */
8073  @SearchParamDefinition(name="identifier", path="DeviceDefinition.identifier", description="The identifier of the component", type="token" )
8074  public static final String SP_IDENTIFIER = "identifier";
8075 /**
8076   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
8077   * <p>
8078   * Description: <b>The identifier of the component</b><br>
8079   * Type: <b>token</b><br>
8080   * Path: <b>DeviceDefinition.identifier</b><br>
8081   * </p>
8082   */
8083  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
8084
8085 /**
8086   * Search parameter: <b>manufacturer</b>
8087   * <p>
8088   * Description: <b>The manufacturer of the device</b><br>
8089   * Type: <b>reference</b><br>
8090   * Path: <b>DeviceDefinition.manufacturer</b><br>
8091   * </p>
8092   */
8093  @SearchParamDefinition(name="manufacturer", path="DeviceDefinition.manufacturer", description="The manufacturer of the device", type="reference", target={Organization.class } )
8094  public static final String SP_MANUFACTURER = "manufacturer";
8095 /**
8096   * <b>Fluent Client</b> search parameter constant for <b>manufacturer</b>
8097   * <p>
8098   * Description: <b>The manufacturer of the device</b><br>
8099   * Type: <b>reference</b><br>
8100   * Path: <b>DeviceDefinition.manufacturer</b><br>
8101   * </p>
8102   */
8103  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MANUFACTURER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MANUFACTURER);
8104
8105/**
8106   * Constant for fluent queries to be used to add include statements. Specifies
8107   * the path value of "<b>DeviceDefinition:manufacturer</b>".
8108   */
8109  public static final ca.uhn.fhir.model.api.Include INCLUDE_MANUFACTURER = new ca.uhn.fhir.model.api.Include("DeviceDefinition:manufacturer").toLocked();
8110
8111 /**
8112   * Search parameter: <b>organization</b>
8113   * <p>
8114   * Description: <b>The organization responsible for the device</b><br>
8115   * Type: <b>reference</b><br>
8116   * Path: <b>DeviceDefinition.owner</b><br>
8117   * </p>
8118   */
8119  @SearchParamDefinition(name="organization", path="DeviceDefinition.owner", description="The organization responsible for the device", type="reference", target={Organization.class } )
8120  public static final String SP_ORGANIZATION = "organization";
8121 /**
8122   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
8123   * <p>
8124   * Description: <b>The organization responsible for the device</b><br>
8125   * Type: <b>reference</b><br>
8126   * Path: <b>DeviceDefinition.owner</b><br>
8127   * </p>
8128   */
8129  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
8130
8131/**
8132   * Constant for fluent queries to be used to add include statements. Specifies
8133   * the path value of "<b>DeviceDefinition:organization</b>".
8134   */
8135  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("DeviceDefinition:organization").toLocked();
8136
8137 /**
8138   * Search parameter: <b>specification</b>
8139   * <p>
8140   * Description: <b>The specification that the device conforms to</b><br>
8141   * Type: <b>token</b><br>
8142   * Path: <b>DeviceDefinition.conformsTo.specification</b><br>
8143   * </p>
8144   */
8145  @SearchParamDefinition(name="specification", path="DeviceDefinition.conformsTo.specification", description="The specification that the device conforms to", type="token" )
8146  public static final String SP_SPECIFICATION = "specification";
8147 /**
8148   * <b>Fluent Client</b> search parameter constant for <b>specification</b>
8149   * <p>
8150   * Description: <b>The specification that the device conforms to</b><br>
8151   * Type: <b>token</b><br>
8152   * Path: <b>DeviceDefinition.conformsTo.specification</b><br>
8153   * </p>
8154   */
8155  public static final ca.uhn.fhir.rest.gclient.TokenClientParam SPECIFICATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_SPECIFICATION);
8156
8157 /**
8158   * Search parameter: <b>type</b>
8159   * <p>
8160   * Description: <b>The device type</b><br>
8161   * Type: <b>token</b><br>
8162   * Path: <b>DeviceDefinition.conformsTo.category</b><br>
8163   * </p>
8164   */
8165  @SearchParamDefinition(name="type", path="DeviceDefinition.conformsTo.category", description="The device type", type="token" )
8166  public static final String SP_TYPE = "type";
8167 /**
8168   * <b>Fluent Client</b> search parameter constant for <b>type</b>
8169   * <p>
8170   * Description: <b>The device type</b><br>
8171   * Type: <b>token</b><br>
8172   * Path: <b>DeviceDefinition.conformsTo.category</b><br>
8173   * </p>
8174   */
8175  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
8176
8177
8178}
8179