001package org.hl7.fhir.r4b.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 Fri, Dec 31, 2021 05:58+1100 for FHIR v4.3.0-snapshot1
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r4b.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 * The detailed description of a substance, typically at a level beyond what is used for prescribing.
052 */
053@ResourceDef(name="SubstanceDefinition", profile="http://hl7.org/fhir/StructureDefinition/SubstanceDefinition")
054public class SubstanceDefinition extends DomainResource {
055
056    @Block()
057    public static class SubstanceDefinitionMoietyComponent extends BackboneElement implements IBaseBackboneElement {
058        /**
059         * Role that the moiety is playing.
060         */
061        @Child(name = "role", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
062        @Description(shortDefinition="Role that the moiety is playing", formalDefinition="Role that the moiety is playing." )
063        protected CodeableConcept role;
064
065        /**
066         * Identifier by which this moiety substance is known.
067         */
068        @Child(name = "identifier", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=true)
069        @Description(shortDefinition="Identifier by which this moiety substance is known", formalDefinition="Identifier by which this moiety substance is known." )
070        protected Identifier identifier;
071
072        /**
073         * Textual name for this moiety substance.
074         */
075        @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
076        @Description(shortDefinition="Textual name for this moiety substance", formalDefinition="Textual name for this moiety substance." )
077        protected StringType name;
078
079        /**
080         * Stereochemistry type.
081         */
082        @Child(name = "stereochemistry", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
083        @Description(shortDefinition="Stereochemistry type", formalDefinition="Stereochemistry type." )
084        protected CodeableConcept stereochemistry;
085
086        /**
087         * Optical activity type.
088         */
089        @Child(name = "opticalActivity", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
090        @Description(shortDefinition="Optical activity type", formalDefinition="Optical activity type." )
091        protected CodeableConcept opticalActivity;
092
093        /**
094         * Molecular formula for this moiety of this substance, typically using the Hill system.
095         */
096        @Child(name = "molecularFormula", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
097        @Description(shortDefinition="Molecular formula for this moiety of this substance, typically using the Hill system", formalDefinition="Molecular formula for this moiety of this substance, typically using the Hill system." )
098        protected StringType molecularFormula;
099
100        /**
101         * Quantitative value for this moiety.
102         */
103        @Child(name = "amount", type = {Quantity.class, StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
104        @Description(shortDefinition="Quantitative value for this moiety", formalDefinition="Quantitative value for this moiety." )
105        protected DataType amount;
106
107        /**
108         * The measurement type of the quantitative value.
109         */
110        @Child(name = "amountType", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true)
111        @Description(shortDefinition="The measurement type of the quantitative value", formalDefinition="The measurement type of the quantitative value." )
112        protected CodeableConcept amountType;
113
114        private static final long serialVersionUID = -1330905924L;
115
116    /**
117     * Constructor
118     */
119      public SubstanceDefinitionMoietyComponent() {
120        super();
121      }
122
123        /**
124         * @return {@link #role} (Role that the moiety is playing.)
125         */
126        public CodeableConcept getRole() { 
127          if (this.role == null)
128            if (Configuration.errorOnAutoCreate())
129              throw new Error("Attempt to auto-create SubstanceDefinitionMoietyComponent.role");
130            else if (Configuration.doAutoCreate())
131              this.role = new CodeableConcept(); // cc
132          return this.role;
133        }
134
135        public boolean hasRole() { 
136          return this.role != null && !this.role.isEmpty();
137        }
138
139        /**
140         * @param value {@link #role} (Role that the moiety is playing.)
141         */
142        public SubstanceDefinitionMoietyComponent setRole(CodeableConcept value) { 
143          this.role = value;
144          return this;
145        }
146
147        /**
148         * @return {@link #identifier} (Identifier by which this moiety substance is known.)
149         */
150        public Identifier getIdentifier() { 
151          if (this.identifier == null)
152            if (Configuration.errorOnAutoCreate())
153              throw new Error("Attempt to auto-create SubstanceDefinitionMoietyComponent.identifier");
154            else if (Configuration.doAutoCreate())
155              this.identifier = new Identifier(); // cc
156          return this.identifier;
157        }
158
159        public boolean hasIdentifier() { 
160          return this.identifier != null && !this.identifier.isEmpty();
161        }
162
163        /**
164         * @param value {@link #identifier} (Identifier by which this moiety substance is known.)
165         */
166        public SubstanceDefinitionMoietyComponent setIdentifier(Identifier value) { 
167          this.identifier = value;
168          return this;
169        }
170
171        /**
172         * @return {@link #name} (Textual name for this moiety substance.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
173         */
174        public StringType getNameElement() { 
175          if (this.name == null)
176            if (Configuration.errorOnAutoCreate())
177              throw new Error("Attempt to auto-create SubstanceDefinitionMoietyComponent.name");
178            else if (Configuration.doAutoCreate())
179              this.name = new StringType(); // bb
180          return this.name;
181        }
182
183        public boolean hasNameElement() { 
184          return this.name != null && !this.name.isEmpty();
185        }
186
187        public boolean hasName() { 
188          return this.name != null && !this.name.isEmpty();
189        }
190
191        /**
192         * @param value {@link #name} (Textual name for this moiety substance.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
193         */
194        public SubstanceDefinitionMoietyComponent setNameElement(StringType value) { 
195          this.name = value;
196          return this;
197        }
198
199        /**
200         * @return Textual name for this moiety substance.
201         */
202        public String getName() { 
203          return this.name == null ? null : this.name.getValue();
204        }
205
206        /**
207         * @param value Textual name for this moiety substance.
208         */
209        public SubstanceDefinitionMoietyComponent setName(String value) { 
210          if (Utilities.noString(value))
211            this.name = null;
212          else {
213            if (this.name == null)
214              this.name = new StringType();
215            this.name.setValue(value);
216          }
217          return this;
218        }
219
220        /**
221         * @return {@link #stereochemistry} (Stereochemistry type.)
222         */
223        public CodeableConcept getStereochemistry() { 
224          if (this.stereochemistry == null)
225            if (Configuration.errorOnAutoCreate())
226              throw new Error("Attempt to auto-create SubstanceDefinitionMoietyComponent.stereochemistry");
227            else if (Configuration.doAutoCreate())
228              this.stereochemistry = new CodeableConcept(); // cc
229          return this.stereochemistry;
230        }
231
232        public boolean hasStereochemistry() { 
233          return this.stereochemistry != null && !this.stereochemistry.isEmpty();
234        }
235
236        /**
237         * @param value {@link #stereochemistry} (Stereochemistry type.)
238         */
239        public SubstanceDefinitionMoietyComponent setStereochemistry(CodeableConcept value) { 
240          this.stereochemistry = value;
241          return this;
242        }
243
244        /**
245         * @return {@link #opticalActivity} (Optical activity type.)
246         */
247        public CodeableConcept getOpticalActivity() { 
248          if (this.opticalActivity == null)
249            if (Configuration.errorOnAutoCreate())
250              throw new Error("Attempt to auto-create SubstanceDefinitionMoietyComponent.opticalActivity");
251            else if (Configuration.doAutoCreate())
252              this.opticalActivity = new CodeableConcept(); // cc
253          return this.opticalActivity;
254        }
255
256        public boolean hasOpticalActivity() { 
257          return this.opticalActivity != null && !this.opticalActivity.isEmpty();
258        }
259
260        /**
261         * @param value {@link #opticalActivity} (Optical activity type.)
262         */
263        public SubstanceDefinitionMoietyComponent setOpticalActivity(CodeableConcept value) { 
264          this.opticalActivity = value;
265          return this;
266        }
267
268        /**
269         * @return {@link #molecularFormula} (Molecular formula for this moiety of this substance, typically using the Hill system.). This is the underlying object with id, value and extensions. The accessor "getMolecularFormula" gives direct access to the value
270         */
271        public StringType getMolecularFormulaElement() { 
272          if (this.molecularFormula == null)
273            if (Configuration.errorOnAutoCreate())
274              throw new Error("Attempt to auto-create SubstanceDefinitionMoietyComponent.molecularFormula");
275            else if (Configuration.doAutoCreate())
276              this.molecularFormula = new StringType(); // bb
277          return this.molecularFormula;
278        }
279
280        public boolean hasMolecularFormulaElement() { 
281          return this.molecularFormula != null && !this.molecularFormula.isEmpty();
282        }
283
284        public boolean hasMolecularFormula() { 
285          return this.molecularFormula != null && !this.molecularFormula.isEmpty();
286        }
287
288        /**
289         * @param value {@link #molecularFormula} (Molecular formula for this moiety of this substance, typically using the Hill system.). This is the underlying object with id, value and extensions. The accessor "getMolecularFormula" gives direct access to the value
290         */
291        public SubstanceDefinitionMoietyComponent setMolecularFormulaElement(StringType value) { 
292          this.molecularFormula = value;
293          return this;
294        }
295
296        /**
297         * @return Molecular formula for this moiety of this substance, typically using the Hill system.
298         */
299        public String getMolecularFormula() { 
300          return this.molecularFormula == null ? null : this.molecularFormula.getValue();
301        }
302
303        /**
304         * @param value Molecular formula for this moiety of this substance, typically using the Hill system.
305         */
306        public SubstanceDefinitionMoietyComponent setMolecularFormula(String value) { 
307          if (Utilities.noString(value))
308            this.molecularFormula = null;
309          else {
310            if (this.molecularFormula == null)
311              this.molecularFormula = new StringType();
312            this.molecularFormula.setValue(value);
313          }
314          return this;
315        }
316
317        /**
318         * @return {@link #amount} (Quantitative value for this moiety.)
319         */
320        public DataType getAmount() { 
321          return this.amount;
322        }
323
324        /**
325         * @return {@link #amount} (Quantitative value for this moiety.)
326         */
327        public Quantity getAmountQuantity() throws FHIRException { 
328          if (this.amount == null)
329            this.amount = new Quantity();
330          if (!(this.amount instanceof Quantity))
331            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.amount.getClass().getName()+" was encountered");
332          return (Quantity) this.amount;
333        }
334
335        public boolean hasAmountQuantity() { 
336          return this != null && this.amount instanceof Quantity;
337        }
338
339        /**
340         * @return {@link #amount} (Quantitative value for this moiety.)
341         */
342        public StringType getAmountStringType() throws FHIRException { 
343          if (this.amount == null)
344            this.amount = new StringType();
345          if (!(this.amount instanceof StringType))
346            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.amount.getClass().getName()+" was encountered");
347          return (StringType) this.amount;
348        }
349
350        public boolean hasAmountStringType() { 
351          return this != null && this.amount instanceof StringType;
352        }
353
354        public boolean hasAmount() { 
355          return this.amount != null && !this.amount.isEmpty();
356        }
357
358        /**
359         * @param value {@link #amount} (Quantitative value for this moiety.)
360         */
361        public SubstanceDefinitionMoietyComponent setAmount(DataType value) { 
362          if (value != null && !(value instanceof Quantity || value instanceof StringType))
363            throw new Error("Not the right type for SubstanceDefinition.moiety.amount[x]: "+value.fhirType());
364          this.amount = value;
365          return this;
366        }
367
368        /**
369         * @return {@link #amountType} (The measurement type of the quantitative value.)
370         */
371        public CodeableConcept getAmountType() { 
372          if (this.amountType == null)
373            if (Configuration.errorOnAutoCreate())
374              throw new Error("Attempt to auto-create SubstanceDefinitionMoietyComponent.amountType");
375            else if (Configuration.doAutoCreate())
376              this.amountType = new CodeableConcept(); // cc
377          return this.amountType;
378        }
379
380        public boolean hasAmountType() { 
381          return this.amountType != null && !this.amountType.isEmpty();
382        }
383
384        /**
385         * @param value {@link #amountType} (The measurement type of the quantitative value.)
386         */
387        public SubstanceDefinitionMoietyComponent setAmountType(CodeableConcept value) { 
388          this.amountType = value;
389          return this;
390        }
391
392        protected void listChildren(List<Property> children) {
393          super.listChildren(children);
394          children.add(new Property("role", "CodeableConcept", "Role that the moiety is playing.", 0, 1, role));
395          children.add(new Property("identifier", "Identifier", "Identifier by which this moiety substance is known.", 0, 1, identifier));
396          children.add(new Property("name", "string", "Textual name for this moiety substance.", 0, 1, name));
397          children.add(new Property("stereochemistry", "CodeableConcept", "Stereochemistry type.", 0, 1, stereochemistry));
398          children.add(new Property("opticalActivity", "CodeableConcept", "Optical activity type.", 0, 1, opticalActivity));
399          children.add(new Property("molecularFormula", "string", "Molecular formula for this moiety of this substance, typically using the Hill system.", 0, 1, molecularFormula));
400          children.add(new Property("amount[x]", "Quantity|string", "Quantitative value for this moiety.", 0, 1, amount));
401          children.add(new Property("amountType", "CodeableConcept", "The measurement type of the quantitative value.", 0, 1, amountType));
402        }
403
404        @Override
405        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
406          switch (_hash) {
407          case 3506294: /*role*/  return new Property("role", "CodeableConcept", "Role that the moiety is playing.", 0, 1, role);
408          case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier by which this moiety substance is known.", 0, 1, identifier);
409          case 3373707: /*name*/  return new Property("name", "string", "Textual name for this moiety substance.", 0, 1, name);
410          case 263475116: /*stereochemistry*/  return new Property("stereochemistry", "CodeableConcept", "Stereochemistry type.", 0, 1, stereochemistry);
411          case 1420900135: /*opticalActivity*/  return new Property("opticalActivity", "CodeableConcept", "Optical activity type.", 0, 1, opticalActivity);
412          case 616660246: /*molecularFormula*/  return new Property("molecularFormula", "string", "Molecular formula for this moiety of this substance, typically using the Hill system.", 0, 1, molecularFormula);
413          case 646780200: /*amount[x]*/  return new Property("amount[x]", "Quantity|string", "Quantitative value for this moiety.", 0, 1, amount);
414          case -1413853096: /*amount*/  return new Property("amount[x]", "Quantity|string", "Quantitative value for this moiety.", 0, 1, amount);
415          case 1664303363: /*amountQuantity*/  return new Property("amount[x]", "Quantity", "Quantitative value for this moiety.", 0, 1, amount);
416          case 773651081: /*amountString*/  return new Property("amount[x]", "string", "Quantitative value for this moiety.", 0, 1, amount);
417          case -1424857166: /*amountType*/  return new Property("amountType", "CodeableConcept", "The measurement type of the quantitative value.", 0, 1, amountType);
418          default: return super.getNamedProperty(_hash, _name, _checkValid);
419          }
420
421        }
422
423      @Override
424      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
425        switch (hash) {
426        case 3506294: /*role*/ return this.role == null ? new Base[0] : new Base[] {this.role}; // CodeableConcept
427        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
428        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
429        case 263475116: /*stereochemistry*/ return this.stereochemistry == null ? new Base[0] : new Base[] {this.stereochemistry}; // CodeableConcept
430        case 1420900135: /*opticalActivity*/ return this.opticalActivity == null ? new Base[0] : new Base[] {this.opticalActivity}; // CodeableConcept
431        case 616660246: /*molecularFormula*/ return this.molecularFormula == null ? new Base[0] : new Base[] {this.molecularFormula}; // StringType
432        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // DataType
433        case -1424857166: /*amountType*/ return this.amountType == null ? new Base[0] : new Base[] {this.amountType}; // CodeableConcept
434        default: return super.getProperty(hash, name, checkValid);
435        }
436
437      }
438
439      @Override
440      public Base setProperty(int hash, String name, Base value) throws FHIRException {
441        switch (hash) {
442        case 3506294: // role
443          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
444          return value;
445        case -1618432855: // identifier
446          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
447          return value;
448        case 3373707: // name
449          this.name = TypeConvertor.castToString(value); // StringType
450          return value;
451        case 263475116: // stereochemistry
452          this.stereochemistry = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
453          return value;
454        case 1420900135: // opticalActivity
455          this.opticalActivity = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
456          return value;
457        case 616660246: // molecularFormula
458          this.molecularFormula = TypeConvertor.castToString(value); // StringType
459          return value;
460        case -1413853096: // amount
461          this.amount = TypeConvertor.castToType(value); // DataType
462          return value;
463        case -1424857166: // amountType
464          this.amountType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
465          return value;
466        default: return super.setProperty(hash, name, value);
467        }
468
469      }
470
471      @Override
472      public Base setProperty(String name, Base value) throws FHIRException {
473        if (name.equals("role")) {
474          this.role = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
475        } else if (name.equals("identifier")) {
476          this.identifier = TypeConvertor.castToIdentifier(value); // Identifier
477        } else if (name.equals("name")) {
478          this.name = TypeConvertor.castToString(value); // StringType
479        } else if (name.equals("stereochemistry")) {
480          this.stereochemistry = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
481        } else if (name.equals("opticalActivity")) {
482          this.opticalActivity = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
483        } else if (name.equals("molecularFormula")) {
484          this.molecularFormula = TypeConvertor.castToString(value); // StringType
485        } else if (name.equals("amount[x]")) {
486          this.amount = TypeConvertor.castToType(value); // DataType
487        } else if (name.equals("amountType")) {
488          this.amountType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
489        } else
490          return super.setProperty(name, value);
491        return value;
492      }
493
494      @Override
495      public Base makeProperty(int hash, String name) throws FHIRException {
496        switch (hash) {
497        case 3506294:  return getRole();
498        case -1618432855:  return getIdentifier();
499        case 3373707:  return getNameElement();
500        case 263475116:  return getStereochemistry();
501        case 1420900135:  return getOpticalActivity();
502        case 616660246:  return getMolecularFormulaElement();
503        case 646780200:  return getAmount();
504        case -1413853096:  return getAmount();
505        case -1424857166:  return getAmountType();
506        default: return super.makeProperty(hash, name);
507        }
508
509      }
510
511      @Override
512      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
513        switch (hash) {
514        case 3506294: /*role*/ return new String[] {"CodeableConcept"};
515        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
516        case 3373707: /*name*/ return new String[] {"string"};
517        case 263475116: /*stereochemistry*/ return new String[] {"CodeableConcept"};
518        case 1420900135: /*opticalActivity*/ return new String[] {"CodeableConcept"};
519        case 616660246: /*molecularFormula*/ return new String[] {"string"};
520        case -1413853096: /*amount*/ return new String[] {"Quantity", "string"};
521        case -1424857166: /*amountType*/ return new String[] {"CodeableConcept"};
522        default: return super.getTypesForProperty(hash, name);
523        }
524
525      }
526
527      @Override
528      public Base addChild(String name) throws FHIRException {
529        if (name.equals("role")) {
530          this.role = new CodeableConcept();
531          return this.role;
532        }
533        else if (name.equals("identifier")) {
534          this.identifier = new Identifier();
535          return this.identifier;
536        }
537        else if (name.equals("name")) {
538          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.moiety.name");
539        }
540        else if (name.equals("stereochemistry")) {
541          this.stereochemistry = new CodeableConcept();
542          return this.stereochemistry;
543        }
544        else if (name.equals("opticalActivity")) {
545          this.opticalActivity = new CodeableConcept();
546          return this.opticalActivity;
547        }
548        else if (name.equals("molecularFormula")) {
549          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.moiety.molecularFormula");
550        }
551        else if (name.equals("amountQuantity")) {
552          this.amount = new Quantity();
553          return this.amount;
554        }
555        else if (name.equals("amountString")) {
556          this.amount = new StringType();
557          return this.amount;
558        }
559        else if (name.equals("amountType")) {
560          this.amountType = new CodeableConcept();
561          return this.amountType;
562        }
563        else
564          return super.addChild(name);
565      }
566
567      public SubstanceDefinitionMoietyComponent copy() {
568        SubstanceDefinitionMoietyComponent dst = new SubstanceDefinitionMoietyComponent();
569        copyValues(dst);
570        return dst;
571      }
572
573      public void copyValues(SubstanceDefinitionMoietyComponent dst) {
574        super.copyValues(dst);
575        dst.role = role == null ? null : role.copy();
576        dst.identifier = identifier == null ? null : identifier.copy();
577        dst.name = name == null ? null : name.copy();
578        dst.stereochemistry = stereochemistry == null ? null : stereochemistry.copy();
579        dst.opticalActivity = opticalActivity == null ? null : opticalActivity.copy();
580        dst.molecularFormula = molecularFormula == null ? null : molecularFormula.copy();
581        dst.amount = amount == null ? null : amount.copy();
582        dst.amountType = amountType == null ? null : amountType.copy();
583      }
584
585      @Override
586      public boolean equalsDeep(Base other_) {
587        if (!super.equalsDeep(other_))
588          return false;
589        if (!(other_ instanceof SubstanceDefinitionMoietyComponent))
590          return false;
591        SubstanceDefinitionMoietyComponent o = (SubstanceDefinitionMoietyComponent) other_;
592        return compareDeep(role, o.role, true) && compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true)
593           && compareDeep(stereochemistry, o.stereochemistry, true) && compareDeep(opticalActivity, o.opticalActivity, true)
594           && compareDeep(molecularFormula, o.molecularFormula, true) && compareDeep(amount, o.amount, true)
595           && compareDeep(amountType, o.amountType, true);
596      }
597
598      @Override
599      public boolean equalsShallow(Base other_) {
600        if (!super.equalsShallow(other_))
601          return false;
602        if (!(other_ instanceof SubstanceDefinitionMoietyComponent))
603          return false;
604        SubstanceDefinitionMoietyComponent o = (SubstanceDefinitionMoietyComponent) other_;
605        return compareValues(name, o.name, true) && compareValues(molecularFormula, o.molecularFormula, true)
606          ;
607      }
608
609      public boolean isEmpty() {
610        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(role, identifier, name, stereochemistry
611          , opticalActivity, molecularFormula, amount, amountType);
612      }
613
614  public String fhirType() {
615    return "SubstanceDefinition.moiety";
616
617  }
618
619  }
620
621    @Block()
622    public static class SubstanceDefinitionPropertyComponent extends BackboneElement implements IBaseBackboneElement {
623        /**
624         * A code expressing the type of characteristic.
625         */
626        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
627        @Description(shortDefinition="A code expressing the type of characteristic", formalDefinition="A code expressing the type of characteristic." )
628        protected CodeableConcept type;
629
630        /**
631         * A value for the characteristic.
632         */
633        @Child(name = "value", type = {CodeableConcept.class, Quantity.class, DateType.class, BooleanType.class, Attachment.class}, order=2, min=0, max=1, modifier=false, summary=true)
634        @Description(shortDefinition="A value for the characteristic", formalDefinition="A value for the characteristic." )
635        protected DataType value;
636
637        private static final long serialVersionUID = -1659186716L;
638
639    /**
640     * Constructor
641     */
642      public SubstanceDefinitionPropertyComponent() {
643        super();
644      }
645
646    /**
647     * Constructor
648     */
649      public SubstanceDefinitionPropertyComponent(CodeableConcept type) {
650        super();
651        this.setType(type);
652      }
653
654        /**
655         * @return {@link #type} (A code expressing the type of characteristic.)
656         */
657        public CodeableConcept getType() { 
658          if (this.type == null)
659            if (Configuration.errorOnAutoCreate())
660              throw new Error("Attempt to auto-create SubstanceDefinitionPropertyComponent.type");
661            else if (Configuration.doAutoCreate())
662              this.type = new CodeableConcept(); // cc
663          return this.type;
664        }
665
666        public boolean hasType() { 
667          return this.type != null && !this.type.isEmpty();
668        }
669
670        /**
671         * @param value {@link #type} (A code expressing the type of characteristic.)
672         */
673        public SubstanceDefinitionPropertyComponent setType(CodeableConcept value) { 
674          this.type = value;
675          return this;
676        }
677
678        /**
679         * @return {@link #value} (A value for the characteristic.)
680         */
681        public DataType getValue() { 
682          return this.value;
683        }
684
685        /**
686         * @return {@link #value} (A value for the characteristic.)
687         */
688        public CodeableConcept getValueCodeableConcept() throws FHIRException { 
689          if (this.value == null)
690            this.value = new CodeableConcept();
691          if (!(this.value instanceof CodeableConcept))
692            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.value.getClass().getName()+" was encountered");
693          return (CodeableConcept) this.value;
694        }
695
696        public boolean hasValueCodeableConcept() { 
697          return this != null && this.value instanceof CodeableConcept;
698        }
699
700        /**
701         * @return {@link #value} (A value for the characteristic.)
702         */
703        public Quantity getValueQuantity() throws FHIRException { 
704          if (this.value == null)
705            this.value = new Quantity();
706          if (!(this.value instanceof Quantity))
707            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.value.getClass().getName()+" was encountered");
708          return (Quantity) this.value;
709        }
710
711        public boolean hasValueQuantity() { 
712          return this != null && this.value instanceof Quantity;
713        }
714
715        /**
716         * @return {@link #value} (A value for the characteristic.)
717         */
718        public DateType getValueDateType() throws FHIRException { 
719          if (this.value == null)
720            this.value = new DateType();
721          if (!(this.value instanceof DateType))
722            throw new FHIRException("Type mismatch: the type DateType was expected, but "+this.value.getClass().getName()+" was encountered");
723          return (DateType) this.value;
724        }
725
726        public boolean hasValueDateType() { 
727          return this != null && this.value instanceof DateType;
728        }
729
730        /**
731         * @return {@link #value} (A value for the characteristic.)
732         */
733        public BooleanType getValueBooleanType() throws FHIRException { 
734          if (this.value == null)
735            this.value = new BooleanType();
736          if (!(this.value instanceof BooleanType))
737            throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.value.getClass().getName()+" was encountered");
738          return (BooleanType) this.value;
739        }
740
741        public boolean hasValueBooleanType() { 
742          return this != null && this.value instanceof BooleanType;
743        }
744
745        /**
746         * @return {@link #value} (A value for the characteristic.)
747         */
748        public Attachment getValueAttachment() throws FHIRException { 
749          if (this.value == null)
750            this.value = new Attachment();
751          if (!(this.value instanceof Attachment))
752            throw new FHIRException("Type mismatch: the type Attachment was expected, but "+this.value.getClass().getName()+" was encountered");
753          return (Attachment) this.value;
754        }
755
756        public boolean hasValueAttachment() { 
757          return this != null && this.value instanceof Attachment;
758        }
759
760        public boolean hasValue() { 
761          return this.value != null && !this.value.isEmpty();
762        }
763
764        /**
765         * @param value {@link #value} (A value for the characteristic.)
766         */
767        public SubstanceDefinitionPropertyComponent setValue(DataType value) { 
768          if (value != null && !(value instanceof CodeableConcept || value instanceof Quantity || value instanceof DateType || value instanceof BooleanType || value instanceof Attachment))
769            throw new Error("Not the right type for SubstanceDefinition.property.value[x]: "+value.fhirType());
770          this.value = value;
771          return this;
772        }
773
774        protected void listChildren(List<Property> children) {
775          super.listChildren(children);
776          children.add(new Property("type", "CodeableConcept", "A code expressing the type of characteristic.", 0, 1, type));
777          children.add(new Property("value[x]", "CodeableConcept|Quantity|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value));
778        }
779
780        @Override
781        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
782          switch (_hash) {
783          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A code expressing the type of characteristic.", 0, 1, type);
784          case -1410166417: /*value[x]*/  return new Property("value[x]", "CodeableConcept|Quantity|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value);
785          case 111972721: /*value*/  return new Property("value[x]", "CodeableConcept|Quantity|date|boolean|Attachment", "A value for the characteristic.", 0, 1, value);
786          case 924902896: /*valueCodeableConcept*/  return new Property("value[x]", "CodeableConcept", "A value for the characteristic.", 0, 1, value);
787          case -2029823716: /*valueQuantity*/  return new Property("value[x]", "Quantity", "A value for the characteristic.", 0, 1, value);
788          case -766192449: /*valueDate*/  return new Property("value[x]", "date", "A value for the characteristic.", 0, 1, value);
789          case 733421943: /*valueBoolean*/  return new Property("value[x]", "boolean", "A value for the characteristic.", 0, 1, value);
790          case -475566732: /*valueAttachment*/  return new Property("value[x]", "Attachment", "A value for the characteristic.", 0, 1, value);
791          default: return super.getNamedProperty(_hash, _name, _checkValid);
792          }
793
794        }
795
796      @Override
797      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
798        switch (hash) {
799        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
800        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DataType
801        default: return super.getProperty(hash, name, checkValid);
802        }
803
804      }
805
806      @Override
807      public Base setProperty(int hash, String name, Base value) throws FHIRException {
808        switch (hash) {
809        case 3575610: // type
810          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
811          return value;
812        case 111972721: // value
813          this.value = TypeConvertor.castToType(value); // DataType
814          return value;
815        default: return super.setProperty(hash, name, value);
816        }
817
818      }
819
820      @Override
821      public Base setProperty(String name, Base value) throws FHIRException {
822        if (name.equals("type")) {
823          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
824        } else if (name.equals("value[x]")) {
825          this.value = TypeConvertor.castToType(value); // DataType
826        } else
827          return super.setProperty(name, value);
828        return value;
829      }
830
831      @Override
832      public Base makeProperty(int hash, String name) throws FHIRException {
833        switch (hash) {
834        case 3575610:  return getType();
835        case -1410166417:  return getValue();
836        case 111972721:  return getValue();
837        default: return super.makeProperty(hash, name);
838        }
839
840      }
841
842      @Override
843      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
844        switch (hash) {
845        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
846        case 111972721: /*value*/ return new String[] {"CodeableConcept", "Quantity", "date", "boolean", "Attachment"};
847        default: return super.getTypesForProperty(hash, name);
848        }
849
850      }
851
852      @Override
853      public Base addChild(String name) throws FHIRException {
854        if (name.equals("type")) {
855          this.type = new CodeableConcept();
856          return this.type;
857        }
858        else if (name.equals("valueCodeableConcept")) {
859          this.value = new CodeableConcept();
860          return this.value;
861        }
862        else if (name.equals("valueQuantity")) {
863          this.value = new Quantity();
864          return this.value;
865        }
866        else if (name.equals("valueDate")) {
867          this.value = new DateType();
868          return this.value;
869        }
870        else if (name.equals("valueBoolean")) {
871          this.value = new BooleanType();
872          return this.value;
873        }
874        else if (name.equals("valueAttachment")) {
875          this.value = new Attachment();
876          return this.value;
877        }
878        else
879          return super.addChild(name);
880      }
881
882      public SubstanceDefinitionPropertyComponent copy() {
883        SubstanceDefinitionPropertyComponent dst = new SubstanceDefinitionPropertyComponent();
884        copyValues(dst);
885        return dst;
886      }
887
888      public void copyValues(SubstanceDefinitionPropertyComponent dst) {
889        super.copyValues(dst);
890        dst.type = type == null ? null : type.copy();
891        dst.value = value == null ? null : value.copy();
892      }
893
894      @Override
895      public boolean equalsDeep(Base other_) {
896        if (!super.equalsDeep(other_))
897          return false;
898        if (!(other_ instanceof SubstanceDefinitionPropertyComponent))
899          return false;
900        SubstanceDefinitionPropertyComponent o = (SubstanceDefinitionPropertyComponent) other_;
901        return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
902      }
903
904      @Override
905      public boolean equalsShallow(Base other_) {
906        if (!super.equalsShallow(other_))
907          return false;
908        if (!(other_ instanceof SubstanceDefinitionPropertyComponent))
909          return false;
910        SubstanceDefinitionPropertyComponent o = (SubstanceDefinitionPropertyComponent) other_;
911        return true;
912      }
913
914      public boolean isEmpty() {
915        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, value);
916      }
917
918  public String fhirType() {
919    return "SubstanceDefinition.property";
920
921  }
922
923  }
924
925    @Block()
926    public static class SubstanceDefinitionMolecularWeightComponent extends BackboneElement implements IBaseBackboneElement {
927        /**
928         * The method by which the molecular weight was determined.
929         */
930        @Child(name = "method", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
931        @Description(shortDefinition="The method by which the molecular weight was determined", formalDefinition="The method by which the molecular weight was determined." )
932        protected CodeableConcept method;
933
934        /**
935         * Type of molecular weight such as exact, average (also known as. number average), weight average.
936         */
937        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
938        @Description(shortDefinition="Type of molecular weight such as exact, average (also known as. number average), weight average", formalDefinition="Type of molecular weight such as exact, average (also known as. number average), weight average." )
939        protected CodeableConcept type;
940
941        /**
942         * Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.
943         */
944        @Child(name = "amount", type = {Quantity.class}, order=3, min=1, max=1, modifier=false, summary=true)
945        @Description(shortDefinition="Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field", formalDefinition="Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field." )
946        protected Quantity amount;
947
948        private static final long serialVersionUID = 805939780L;
949
950    /**
951     * Constructor
952     */
953      public SubstanceDefinitionMolecularWeightComponent() {
954        super();
955      }
956
957    /**
958     * Constructor
959     */
960      public SubstanceDefinitionMolecularWeightComponent(Quantity amount) {
961        super();
962        this.setAmount(amount);
963      }
964
965        /**
966         * @return {@link #method} (The method by which the molecular weight was determined.)
967         */
968        public CodeableConcept getMethod() { 
969          if (this.method == null)
970            if (Configuration.errorOnAutoCreate())
971              throw new Error("Attempt to auto-create SubstanceDefinitionMolecularWeightComponent.method");
972            else if (Configuration.doAutoCreate())
973              this.method = new CodeableConcept(); // cc
974          return this.method;
975        }
976
977        public boolean hasMethod() { 
978          return this.method != null && !this.method.isEmpty();
979        }
980
981        /**
982         * @param value {@link #method} (The method by which the molecular weight was determined.)
983         */
984        public SubstanceDefinitionMolecularWeightComponent setMethod(CodeableConcept value) { 
985          this.method = value;
986          return this;
987        }
988
989        /**
990         * @return {@link #type} (Type of molecular weight such as exact, average (also known as. number average), weight average.)
991         */
992        public CodeableConcept getType() { 
993          if (this.type == null)
994            if (Configuration.errorOnAutoCreate())
995              throw new Error("Attempt to auto-create SubstanceDefinitionMolecularWeightComponent.type");
996            else if (Configuration.doAutoCreate())
997              this.type = new CodeableConcept(); // cc
998          return this.type;
999        }
1000
1001        public boolean hasType() { 
1002          return this.type != null && !this.type.isEmpty();
1003        }
1004
1005        /**
1006         * @param value {@link #type} (Type of molecular weight such as exact, average (also known as. number average), weight average.)
1007         */
1008        public SubstanceDefinitionMolecularWeightComponent setType(CodeableConcept value) { 
1009          this.type = value;
1010          return this;
1011        }
1012
1013        /**
1014         * @return {@link #amount} (Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.)
1015         */
1016        public Quantity getAmount() { 
1017          if (this.amount == null)
1018            if (Configuration.errorOnAutoCreate())
1019              throw new Error("Attempt to auto-create SubstanceDefinitionMolecularWeightComponent.amount");
1020            else if (Configuration.doAutoCreate())
1021              this.amount = new Quantity(); // cc
1022          return this.amount;
1023        }
1024
1025        public boolean hasAmount() { 
1026          return this.amount != null && !this.amount.isEmpty();
1027        }
1028
1029        /**
1030         * @param value {@link #amount} (Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.)
1031         */
1032        public SubstanceDefinitionMolecularWeightComponent setAmount(Quantity value) { 
1033          this.amount = value;
1034          return this;
1035        }
1036
1037        protected void listChildren(List<Property> children) {
1038          super.listChildren(children);
1039          children.add(new Property("method", "CodeableConcept", "The method by which the molecular weight was determined.", 0, 1, method));
1040          children.add(new Property("type", "CodeableConcept", "Type of molecular weight such as exact, average (also known as. number average), weight average.", 0, 1, type));
1041          children.add(new Property("amount", "Quantity", "Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.", 0, 1, amount));
1042        }
1043
1044        @Override
1045        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1046          switch (_hash) {
1047          case -1077554975: /*method*/  return new Property("method", "CodeableConcept", "The method by which the molecular weight was determined.", 0, 1, method);
1048          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Type of molecular weight such as exact, average (also known as. number average), weight average.", 0, 1, type);
1049          case -1413853096: /*amount*/  return new Property("amount", "Quantity", "Used to capture quantitative values for a variety of elements. If only limits are given, the arithmetic mean would be the average. If only a single definite value for a given element is given, it would be captured in this field.", 0, 1, amount);
1050          default: return super.getNamedProperty(_hash, _name, _checkValid);
1051          }
1052
1053        }
1054
1055      @Override
1056      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1057        switch (hash) {
1058        case -1077554975: /*method*/ return this.method == null ? new Base[0] : new Base[] {this.method}; // CodeableConcept
1059        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1060        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Quantity
1061        default: return super.getProperty(hash, name, checkValid);
1062        }
1063
1064      }
1065
1066      @Override
1067      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1068        switch (hash) {
1069        case -1077554975: // method
1070          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1071          return value;
1072        case 3575610: // type
1073          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1074          return value;
1075        case -1413853096: // amount
1076          this.amount = TypeConvertor.castToQuantity(value); // Quantity
1077          return value;
1078        default: return super.setProperty(hash, name, value);
1079        }
1080
1081      }
1082
1083      @Override
1084      public Base setProperty(String name, Base value) throws FHIRException {
1085        if (name.equals("method")) {
1086          this.method = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1087        } else if (name.equals("type")) {
1088          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1089        } else if (name.equals("amount")) {
1090          this.amount = TypeConvertor.castToQuantity(value); // Quantity
1091        } else
1092          return super.setProperty(name, value);
1093        return value;
1094      }
1095
1096      @Override
1097      public Base makeProperty(int hash, String name) throws FHIRException {
1098        switch (hash) {
1099        case -1077554975:  return getMethod();
1100        case 3575610:  return getType();
1101        case -1413853096:  return getAmount();
1102        default: return super.makeProperty(hash, name);
1103        }
1104
1105      }
1106
1107      @Override
1108      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1109        switch (hash) {
1110        case -1077554975: /*method*/ return new String[] {"CodeableConcept"};
1111        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1112        case -1413853096: /*amount*/ return new String[] {"Quantity"};
1113        default: return super.getTypesForProperty(hash, name);
1114        }
1115
1116      }
1117
1118      @Override
1119      public Base addChild(String name) throws FHIRException {
1120        if (name.equals("method")) {
1121          this.method = new CodeableConcept();
1122          return this.method;
1123        }
1124        else if (name.equals("type")) {
1125          this.type = new CodeableConcept();
1126          return this.type;
1127        }
1128        else if (name.equals("amount")) {
1129          this.amount = new Quantity();
1130          return this.amount;
1131        }
1132        else
1133          return super.addChild(name);
1134      }
1135
1136      public SubstanceDefinitionMolecularWeightComponent copy() {
1137        SubstanceDefinitionMolecularWeightComponent dst = new SubstanceDefinitionMolecularWeightComponent();
1138        copyValues(dst);
1139        return dst;
1140      }
1141
1142      public void copyValues(SubstanceDefinitionMolecularWeightComponent dst) {
1143        super.copyValues(dst);
1144        dst.method = method == null ? null : method.copy();
1145        dst.type = type == null ? null : type.copy();
1146        dst.amount = amount == null ? null : amount.copy();
1147      }
1148
1149      @Override
1150      public boolean equalsDeep(Base other_) {
1151        if (!super.equalsDeep(other_))
1152          return false;
1153        if (!(other_ instanceof SubstanceDefinitionMolecularWeightComponent))
1154          return false;
1155        SubstanceDefinitionMolecularWeightComponent o = (SubstanceDefinitionMolecularWeightComponent) other_;
1156        return compareDeep(method, o.method, true) && compareDeep(type, o.type, true) && compareDeep(amount, o.amount, true)
1157          ;
1158      }
1159
1160      @Override
1161      public boolean equalsShallow(Base other_) {
1162        if (!super.equalsShallow(other_))
1163          return false;
1164        if (!(other_ instanceof SubstanceDefinitionMolecularWeightComponent))
1165          return false;
1166        SubstanceDefinitionMolecularWeightComponent o = (SubstanceDefinitionMolecularWeightComponent) other_;
1167        return true;
1168      }
1169
1170      public boolean isEmpty() {
1171        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(method, type, amount);
1172      }
1173
1174  public String fhirType() {
1175    return "SubstanceDefinition.molecularWeight";
1176
1177  }
1178
1179  }
1180
1181    @Block()
1182    public static class SubstanceDefinitionStructureComponent extends BackboneElement implements IBaseBackboneElement {
1183        /**
1184         * Stereochemistry type.
1185         */
1186        @Child(name = "stereochemistry", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1187        @Description(shortDefinition="Stereochemistry type", formalDefinition="Stereochemistry type." )
1188        protected CodeableConcept stereochemistry;
1189
1190        /**
1191         * Optical activity type.
1192         */
1193        @Child(name = "opticalActivity", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1194        @Description(shortDefinition="Optical activity type", formalDefinition="Optical activity type." )
1195        protected CodeableConcept opticalActivity;
1196
1197        /**
1198         * Molecular formula of this substance, typically using the Hill system.
1199         */
1200        @Child(name = "molecularFormula", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1201        @Description(shortDefinition="Molecular formula of this substance, typically using the Hill system", formalDefinition="Molecular formula of this substance, typically using the Hill system." )
1202        protected StringType molecularFormula;
1203
1204        /**
1205         * Specified per moiety according to the Hill system, i.e. first C, then H, then alphabetical, each moiety separated by a dot.
1206         */
1207        @Child(name = "molecularFormulaByMoiety", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1208        @Description(shortDefinition="Specified per moiety according to the Hill system, i.e. first C, then H, then alphabetical, each moiety separated by a dot", formalDefinition="Specified per moiety according to the Hill system, i.e. first C, then H, then alphabetical, each moiety separated by a dot." )
1209        protected StringType molecularFormulaByMoiety;
1210
1211        /**
1212         * The molecular weight or weight range (for proteins, polymers or nucleic acids).
1213         */
1214        @Child(name = "molecularWeight", type = {SubstanceDefinitionMolecularWeightComponent.class}, order=5, min=0, max=1, modifier=false, summary=true)
1215        @Description(shortDefinition="The molecular weight or weight range (for proteins, polymers or nucleic acids)", formalDefinition="The molecular weight or weight range (for proteins, polymers or nucleic acids)." )
1216        protected SubstanceDefinitionMolecularWeightComponent molecularWeight;
1217
1218        /**
1219         * The method used to elucidate the structure or characterization of the drug substance. Examples: X-ray, HPLC, NMR, Peptide mapping, Ligand binding assay.
1220         */
1221        @Child(name = "technique", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1222        @Description(shortDefinition="The method used to elucidate the structure or characterization of the drug substance. Examples: X-ray, HPLC, NMR, Peptide mapping, Ligand binding assay", formalDefinition="The method used to elucidate the structure or characterization of the drug substance. Examples: X-ray, HPLC, NMR, Peptide mapping, Ligand binding assay." )
1223        protected List<CodeableConcept> technique;
1224
1225        /**
1226         * Supporting literature about the source of information.
1227         */
1228        @Child(name = "sourceDocument", type = {DocumentReference.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1229        @Description(shortDefinition="Supporting literature about the source of information", formalDefinition="Supporting literature about the source of information." )
1230        protected List<Reference> sourceDocument;
1231
1232        /**
1233         * A depiction of the structure or characterization of the substance.
1234         */
1235        @Child(name = "representation", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1236        @Description(shortDefinition="A depiction of the structure or characterization of the substance", formalDefinition="A depiction of the structure or characterization of the substance." )
1237        protected List<SubstanceDefinitionStructureRepresentationComponent> representation;
1238
1239        private static final long serialVersionUID = -2137814144L;
1240
1241    /**
1242     * Constructor
1243     */
1244      public SubstanceDefinitionStructureComponent() {
1245        super();
1246      }
1247
1248        /**
1249         * @return {@link #stereochemistry} (Stereochemistry type.)
1250         */
1251        public CodeableConcept getStereochemistry() { 
1252          if (this.stereochemistry == null)
1253            if (Configuration.errorOnAutoCreate())
1254              throw new Error("Attempt to auto-create SubstanceDefinitionStructureComponent.stereochemistry");
1255            else if (Configuration.doAutoCreate())
1256              this.stereochemistry = new CodeableConcept(); // cc
1257          return this.stereochemistry;
1258        }
1259
1260        public boolean hasStereochemistry() { 
1261          return this.stereochemistry != null && !this.stereochemistry.isEmpty();
1262        }
1263
1264        /**
1265         * @param value {@link #stereochemistry} (Stereochemistry type.)
1266         */
1267        public SubstanceDefinitionStructureComponent setStereochemistry(CodeableConcept value) { 
1268          this.stereochemistry = value;
1269          return this;
1270        }
1271
1272        /**
1273         * @return {@link #opticalActivity} (Optical activity type.)
1274         */
1275        public CodeableConcept getOpticalActivity() { 
1276          if (this.opticalActivity == null)
1277            if (Configuration.errorOnAutoCreate())
1278              throw new Error("Attempt to auto-create SubstanceDefinitionStructureComponent.opticalActivity");
1279            else if (Configuration.doAutoCreate())
1280              this.opticalActivity = new CodeableConcept(); // cc
1281          return this.opticalActivity;
1282        }
1283
1284        public boolean hasOpticalActivity() { 
1285          return this.opticalActivity != null && !this.opticalActivity.isEmpty();
1286        }
1287
1288        /**
1289         * @param value {@link #opticalActivity} (Optical activity type.)
1290         */
1291        public SubstanceDefinitionStructureComponent setOpticalActivity(CodeableConcept value) { 
1292          this.opticalActivity = value;
1293          return this;
1294        }
1295
1296        /**
1297         * @return {@link #molecularFormula} (Molecular formula of this substance, typically using the Hill system.). This is the underlying object with id, value and extensions. The accessor "getMolecularFormula" gives direct access to the value
1298         */
1299        public StringType getMolecularFormulaElement() { 
1300          if (this.molecularFormula == null)
1301            if (Configuration.errorOnAutoCreate())
1302              throw new Error("Attempt to auto-create SubstanceDefinitionStructureComponent.molecularFormula");
1303            else if (Configuration.doAutoCreate())
1304              this.molecularFormula = new StringType(); // bb
1305          return this.molecularFormula;
1306        }
1307
1308        public boolean hasMolecularFormulaElement() { 
1309          return this.molecularFormula != null && !this.molecularFormula.isEmpty();
1310        }
1311
1312        public boolean hasMolecularFormula() { 
1313          return this.molecularFormula != null && !this.molecularFormula.isEmpty();
1314        }
1315
1316        /**
1317         * @param value {@link #molecularFormula} (Molecular formula of this substance, typically using the Hill system.). This is the underlying object with id, value and extensions. The accessor "getMolecularFormula" gives direct access to the value
1318         */
1319        public SubstanceDefinitionStructureComponent setMolecularFormulaElement(StringType value) { 
1320          this.molecularFormula = value;
1321          return this;
1322        }
1323
1324        /**
1325         * @return Molecular formula of this substance, typically using the Hill system.
1326         */
1327        public String getMolecularFormula() { 
1328          return this.molecularFormula == null ? null : this.molecularFormula.getValue();
1329        }
1330
1331        /**
1332         * @param value Molecular formula of this substance, typically using the Hill system.
1333         */
1334        public SubstanceDefinitionStructureComponent setMolecularFormula(String value) { 
1335          if (Utilities.noString(value))
1336            this.molecularFormula = null;
1337          else {
1338            if (this.molecularFormula == null)
1339              this.molecularFormula = new StringType();
1340            this.molecularFormula.setValue(value);
1341          }
1342          return this;
1343        }
1344
1345        /**
1346         * @return {@link #molecularFormulaByMoiety} (Specified per moiety according to the Hill system, i.e. first C, then H, then alphabetical, each moiety separated by a dot.). This is the underlying object with id, value and extensions. The accessor "getMolecularFormulaByMoiety" gives direct access to the value
1347         */
1348        public StringType getMolecularFormulaByMoietyElement() { 
1349          if (this.molecularFormulaByMoiety == null)
1350            if (Configuration.errorOnAutoCreate())
1351              throw new Error("Attempt to auto-create SubstanceDefinitionStructureComponent.molecularFormulaByMoiety");
1352            else if (Configuration.doAutoCreate())
1353              this.molecularFormulaByMoiety = new StringType(); // bb
1354          return this.molecularFormulaByMoiety;
1355        }
1356
1357        public boolean hasMolecularFormulaByMoietyElement() { 
1358          return this.molecularFormulaByMoiety != null && !this.molecularFormulaByMoiety.isEmpty();
1359        }
1360
1361        public boolean hasMolecularFormulaByMoiety() { 
1362          return this.molecularFormulaByMoiety != null && !this.molecularFormulaByMoiety.isEmpty();
1363        }
1364
1365        /**
1366         * @param value {@link #molecularFormulaByMoiety} (Specified per moiety according to the Hill system, i.e. first C, then H, then alphabetical, each moiety separated by a dot.). This is the underlying object with id, value and extensions. The accessor "getMolecularFormulaByMoiety" gives direct access to the value
1367         */
1368        public SubstanceDefinitionStructureComponent setMolecularFormulaByMoietyElement(StringType value) { 
1369          this.molecularFormulaByMoiety = value;
1370          return this;
1371        }
1372
1373        /**
1374         * @return Specified per moiety according to the Hill system, i.e. first C, then H, then alphabetical, each moiety separated by a dot.
1375         */
1376        public String getMolecularFormulaByMoiety() { 
1377          return this.molecularFormulaByMoiety == null ? null : this.molecularFormulaByMoiety.getValue();
1378        }
1379
1380        /**
1381         * @param value Specified per moiety according to the Hill system, i.e. first C, then H, then alphabetical, each moiety separated by a dot.
1382         */
1383        public SubstanceDefinitionStructureComponent setMolecularFormulaByMoiety(String value) { 
1384          if (Utilities.noString(value))
1385            this.molecularFormulaByMoiety = null;
1386          else {
1387            if (this.molecularFormulaByMoiety == null)
1388              this.molecularFormulaByMoiety = new StringType();
1389            this.molecularFormulaByMoiety.setValue(value);
1390          }
1391          return this;
1392        }
1393
1394        /**
1395         * @return {@link #molecularWeight} (The molecular weight or weight range (for proteins, polymers or nucleic acids).)
1396         */
1397        public SubstanceDefinitionMolecularWeightComponent getMolecularWeight() { 
1398          if (this.molecularWeight == null)
1399            if (Configuration.errorOnAutoCreate())
1400              throw new Error("Attempt to auto-create SubstanceDefinitionStructureComponent.molecularWeight");
1401            else if (Configuration.doAutoCreate())
1402              this.molecularWeight = new SubstanceDefinitionMolecularWeightComponent(); // cc
1403          return this.molecularWeight;
1404        }
1405
1406        public boolean hasMolecularWeight() { 
1407          return this.molecularWeight != null && !this.molecularWeight.isEmpty();
1408        }
1409
1410        /**
1411         * @param value {@link #molecularWeight} (The molecular weight or weight range (for proteins, polymers or nucleic acids).)
1412         */
1413        public SubstanceDefinitionStructureComponent setMolecularWeight(SubstanceDefinitionMolecularWeightComponent value) { 
1414          this.molecularWeight = value;
1415          return this;
1416        }
1417
1418        /**
1419         * @return {@link #technique} (The method used to elucidate the structure or characterization of the drug substance. Examples: X-ray, HPLC, NMR, Peptide mapping, Ligand binding assay.)
1420         */
1421        public List<CodeableConcept> getTechnique() { 
1422          if (this.technique == null)
1423            this.technique = new ArrayList<CodeableConcept>();
1424          return this.technique;
1425        }
1426
1427        /**
1428         * @return Returns a reference to <code>this</code> for easy method chaining
1429         */
1430        public SubstanceDefinitionStructureComponent setTechnique(List<CodeableConcept> theTechnique) { 
1431          this.technique = theTechnique;
1432          return this;
1433        }
1434
1435        public boolean hasTechnique() { 
1436          if (this.technique == null)
1437            return false;
1438          for (CodeableConcept item : this.technique)
1439            if (!item.isEmpty())
1440              return true;
1441          return false;
1442        }
1443
1444        public CodeableConcept addTechnique() { //3
1445          CodeableConcept t = new CodeableConcept();
1446          if (this.technique == null)
1447            this.technique = new ArrayList<CodeableConcept>();
1448          this.technique.add(t);
1449          return t;
1450        }
1451
1452        public SubstanceDefinitionStructureComponent addTechnique(CodeableConcept t) { //3
1453          if (t == null)
1454            return this;
1455          if (this.technique == null)
1456            this.technique = new ArrayList<CodeableConcept>();
1457          this.technique.add(t);
1458          return this;
1459        }
1460
1461        /**
1462         * @return The first repetition of repeating field {@link #technique}, creating it if it does not already exist {3}
1463         */
1464        public CodeableConcept getTechniqueFirstRep() { 
1465          if (getTechnique().isEmpty()) {
1466            addTechnique();
1467          }
1468          return getTechnique().get(0);
1469        }
1470
1471        /**
1472         * @return {@link #sourceDocument} (Supporting literature about the source of information.)
1473         */
1474        public List<Reference> getSourceDocument() { 
1475          if (this.sourceDocument == null)
1476            this.sourceDocument = new ArrayList<Reference>();
1477          return this.sourceDocument;
1478        }
1479
1480        /**
1481         * @return Returns a reference to <code>this</code> for easy method chaining
1482         */
1483        public SubstanceDefinitionStructureComponent setSourceDocument(List<Reference> theSourceDocument) { 
1484          this.sourceDocument = theSourceDocument;
1485          return this;
1486        }
1487
1488        public boolean hasSourceDocument() { 
1489          if (this.sourceDocument == null)
1490            return false;
1491          for (Reference item : this.sourceDocument)
1492            if (!item.isEmpty())
1493              return true;
1494          return false;
1495        }
1496
1497        public Reference addSourceDocument() { //3
1498          Reference t = new Reference();
1499          if (this.sourceDocument == null)
1500            this.sourceDocument = new ArrayList<Reference>();
1501          this.sourceDocument.add(t);
1502          return t;
1503        }
1504
1505        public SubstanceDefinitionStructureComponent addSourceDocument(Reference t) { //3
1506          if (t == null)
1507            return this;
1508          if (this.sourceDocument == null)
1509            this.sourceDocument = new ArrayList<Reference>();
1510          this.sourceDocument.add(t);
1511          return this;
1512        }
1513
1514        /**
1515         * @return The first repetition of repeating field {@link #sourceDocument}, creating it if it does not already exist {3}
1516         */
1517        public Reference getSourceDocumentFirstRep() { 
1518          if (getSourceDocument().isEmpty()) {
1519            addSourceDocument();
1520          }
1521          return getSourceDocument().get(0);
1522        }
1523
1524        /**
1525         * @return {@link #representation} (A depiction of the structure or characterization of the substance.)
1526         */
1527        public List<SubstanceDefinitionStructureRepresentationComponent> getRepresentation() { 
1528          if (this.representation == null)
1529            this.representation = new ArrayList<SubstanceDefinitionStructureRepresentationComponent>();
1530          return this.representation;
1531        }
1532
1533        /**
1534         * @return Returns a reference to <code>this</code> for easy method chaining
1535         */
1536        public SubstanceDefinitionStructureComponent setRepresentation(List<SubstanceDefinitionStructureRepresentationComponent> theRepresentation) { 
1537          this.representation = theRepresentation;
1538          return this;
1539        }
1540
1541        public boolean hasRepresentation() { 
1542          if (this.representation == null)
1543            return false;
1544          for (SubstanceDefinitionStructureRepresentationComponent item : this.representation)
1545            if (!item.isEmpty())
1546              return true;
1547          return false;
1548        }
1549
1550        public SubstanceDefinitionStructureRepresentationComponent addRepresentation() { //3
1551          SubstanceDefinitionStructureRepresentationComponent t = new SubstanceDefinitionStructureRepresentationComponent();
1552          if (this.representation == null)
1553            this.representation = new ArrayList<SubstanceDefinitionStructureRepresentationComponent>();
1554          this.representation.add(t);
1555          return t;
1556        }
1557
1558        public SubstanceDefinitionStructureComponent addRepresentation(SubstanceDefinitionStructureRepresentationComponent t) { //3
1559          if (t == null)
1560            return this;
1561          if (this.representation == null)
1562            this.representation = new ArrayList<SubstanceDefinitionStructureRepresentationComponent>();
1563          this.representation.add(t);
1564          return this;
1565        }
1566
1567        /**
1568         * @return The first repetition of repeating field {@link #representation}, creating it if it does not already exist {3}
1569         */
1570        public SubstanceDefinitionStructureRepresentationComponent getRepresentationFirstRep() { 
1571          if (getRepresentation().isEmpty()) {
1572            addRepresentation();
1573          }
1574          return getRepresentation().get(0);
1575        }
1576
1577        protected void listChildren(List<Property> children) {
1578          super.listChildren(children);
1579          children.add(new Property("stereochemistry", "CodeableConcept", "Stereochemistry type.", 0, 1, stereochemistry));
1580          children.add(new Property("opticalActivity", "CodeableConcept", "Optical activity type.", 0, 1, opticalActivity));
1581          children.add(new Property("molecularFormula", "string", "Molecular formula of this substance, typically using the Hill system.", 0, 1, molecularFormula));
1582          children.add(new Property("molecularFormulaByMoiety", "string", "Specified per moiety according to the Hill system, i.e. first C, then H, then alphabetical, each moiety separated by a dot.", 0, 1, molecularFormulaByMoiety));
1583          children.add(new Property("molecularWeight", "@SubstanceDefinition.molecularWeight", "The molecular weight or weight range (for proteins, polymers or nucleic acids).", 0, 1, molecularWeight));
1584          children.add(new Property("technique", "CodeableConcept", "The method used to elucidate the structure or characterization of the drug substance. Examples: X-ray, HPLC, NMR, Peptide mapping, Ligand binding assay.", 0, java.lang.Integer.MAX_VALUE, technique));
1585          children.add(new Property("sourceDocument", "Reference(DocumentReference)", "Supporting literature about the source of information.", 0, java.lang.Integer.MAX_VALUE, sourceDocument));
1586          children.add(new Property("representation", "", "A depiction of the structure or characterization of the substance.", 0, java.lang.Integer.MAX_VALUE, representation));
1587        }
1588
1589        @Override
1590        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1591          switch (_hash) {
1592          case 263475116: /*stereochemistry*/  return new Property("stereochemistry", "CodeableConcept", "Stereochemistry type.", 0, 1, stereochemistry);
1593          case 1420900135: /*opticalActivity*/  return new Property("opticalActivity", "CodeableConcept", "Optical activity type.", 0, 1, opticalActivity);
1594          case 616660246: /*molecularFormula*/  return new Property("molecularFormula", "string", "Molecular formula of this substance, typically using the Hill system.", 0, 1, molecularFormula);
1595          case 1315452848: /*molecularFormulaByMoiety*/  return new Property("molecularFormulaByMoiety", "string", "Specified per moiety according to the Hill system, i.e. first C, then H, then alphabetical, each moiety separated by a dot.", 0, 1, molecularFormulaByMoiety);
1596          case 635625672: /*molecularWeight*/  return new Property("molecularWeight", "@SubstanceDefinition.molecularWeight", "The molecular weight or weight range (for proteins, polymers or nucleic acids).", 0, 1, molecularWeight);
1597          case 1469675088: /*technique*/  return new Property("technique", "CodeableConcept", "The method used to elucidate the structure or characterization of the drug substance. Examples: X-ray, HPLC, NMR, Peptide mapping, Ligand binding assay.", 0, java.lang.Integer.MAX_VALUE, technique);
1598          case -501788074: /*sourceDocument*/  return new Property("sourceDocument", "Reference(DocumentReference)", "Supporting literature about the source of information.", 0, java.lang.Integer.MAX_VALUE, sourceDocument);
1599          case -671065907: /*representation*/  return new Property("representation", "", "A depiction of the structure or characterization of the substance.", 0, java.lang.Integer.MAX_VALUE, representation);
1600          default: return super.getNamedProperty(_hash, _name, _checkValid);
1601          }
1602
1603        }
1604
1605      @Override
1606      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1607        switch (hash) {
1608        case 263475116: /*stereochemistry*/ return this.stereochemistry == null ? new Base[0] : new Base[] {this.stereochemistry}; // CodeableConcept
1609        case 1420900135: /*opticalActivity*/ return this.opticalActivity == null ? new Base[0] : new Base[] {this.opticalActivity}; // CodeableConcept
1610        case 616660246: /*molecularFormula*/ return this.molecularFormula == null ? new Base[0] : new Base[] {this.molecularFormula}; // StringType
1611        case 1315452848: /*molecularFormulaByMoiety*/ return this.molecularFormulaByMoiety == null ? new Base[0] : new Base[] {this.molecularFormulaByMoiety}; // StringType
1612        case 635625672: /*molecularWeight*/ return this.molecularWeight == null ? new Base[0] : new Base[] {this.molecularWeight}; // SubstanceDefinitionMolecularWeightComponent
1613        case 1469675088: /*technique*/ return this.technique == null ? new Base[0] : this.technique.toArray(new Base[this.technique.size()]); // CodeableConcept
1614        case -501788074: /*sourceDocument*/ return this.sourceDocument == null ? new Base[0] : this.sourceDocument.toArray(new Base[this.sourceDocument.size()]); // Reference
1615        case -671065907: /*representation*/ return this.representation == null ? new Base[0] : this.representation.toArray(new Base[this.representation.size()]); // SubstanceDefinitionStructureRepresentationComponent
1616        default: return super.getProperty(hash, name, checkValid);
1617        }
1618
1619      }
1620
1621      @Override
1622      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1623        switch (hash) {
1624        case 263475116: // stereochemistry
1625          this.stereochemistry = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1626          return value;
1627        case 1420900135: // opticalActivity
1628          this.opticalActivity = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1629          return value;
1630        case 616660246: // molecularFormula
1631          this.molecularFormula = TypeConvertor.castToString(value); // StringType
1632          return value;
1633        case 1315452848: // molecularFormulaByMoiety
1634          this.molecularFormulaByMoiety = TypeConvertor.castToString(value); // StringType
1635          return value;
1636        case 635625672: // molecularWeight
1637          this.molecularWeight = (SubstanceDefinitionMolecularWeightComponent) value; // SubstanceDefinitionMolecularWeightComponent
1638          return value;
1639        case 1469675088: // technique
1640          this.getTechnique().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1641          return value;
1642        case -501788074: // sourceDocument
1643          this.getSourceDocument().add(TypeConvertor.castToReference(value)); // Reference
1644          return value;
1645        case -671065907: // representation
1646          this.getRepresentation().add((SubstanceDefinitionStructureRepresentationComponent) value); // SubstanceDefinitionStructureRepresentationComponent
1647          return value;
1648        default: return super.setProperty(hash, name, value);
1649        }
1650
1651      }
1652
1653      @Override
1654      public Base setProperty(String name, Base value) throws FHIRException {
1655        if (name.equals("stereochemistry")) {
1656          this.stereochemistry = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1657        } else if (name.equals("opticalActivity")) {
1658          this.opticalActivity = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1659        } else if (name.equals("molecularFormula")) {
1660          this.molecularFormula = TypeConvertor.castToString(value); // StringType
1661        } else if (name.equals("molecularFormulaByMoiety")) {
1662          this.molecularFormulaByMoiety = TypeConvertor.castToString(value); // StringType
1663        } else if (name.equals("molecularWeight")) {
1664          this.molecularWeight = (SubstanceDefinitionMolecularWeightComponent) value; // SubstanceDefinitionMolecularWeightComponent
1665        } else if (name.equals("technique")) {
1666          this.getTechnique().add(TypeConvertor.castToCodeableConcept(value));
1667        } else if (name.equals("sourceDocument")) {
1668          this.getSourceDocument().add(TypeConvertor.castToReference(value));
1669        } else if (name.equals("representation")) {
1670          this.getRepresentation().add((SubstanceDefinitionStructureRepresentationComponent) value);
1671        } else
1672          return super.setProperty(name, value);
1673        return value;
1674      }
1675
1676      @Override
1677      public Base makeProperty(int hash, String name) throws FHIRException {
1678        switch (hash) {
1679        case 263475116:  return getStereochemistry();
1680        case 1420900135:  return getOpticalActivity();
1681        case 616660246:  return getMolecularFormulaElement();
1682        case 1315452848:  return getMolecularFormulaByMoietyElement();
1683        case 635625672:  return getMolecularWeight();
1684        case 1469675088:  return addTechnique(); 
1685        case -501788074:  return addSourceDocument(); 
1686        case -671065907:  return addRepresentation(); 
1687        default: return super.makeProperty(hash, name);
1688        }
1689
1690      }
1691
1692      @Override
1693      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1694        switch (hash) {
1695        case 263475116: /*stereochemistry*/ return new String[] {"CodeableConcept"};
1696        case 1420900135: /*opticalActivity*/ return new String[] {"CodeableConcept"};
1697        case 616660246: /*molecularFormula*/ return new String[] {"string"};
1698        case 1315452848: /*molecularFormulaByMoiety*/ return new String[] {"string"};
1699        case 635625672: /*molecularWeight*/ return new String[] {"@SubstanceDefinition.molecularWeight"};
1700        case 1469675088: /*technique*/ return new String[] {"CodeableConcept"};
1701        case -501788074: /*sourceDocument*/ return new String[] {"Reference"};
1702        case -671065907: /*representation*/ return new String[] {};
1703        default: return super.getTypesForProperty(hash, name);
1704        }
1705
1706      }
1707
1708      @Override
1709      public Base addChild(String name) throws FHIRException {
1710        if (name.equals("stereochemistry")) {
1711          this.stereochemistry = new CodeableConcept();
1712          return this.stereochemistry;
1713        }
1714        else if (name.equals("opticalActivity")) {
1715          this.opticalActivity = new CodeableConcept();
1716          return this.opticalActivity;
1717        }
1718        else if (name.equals("molecularFormula")) {
1719          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.structure.molecularFormula");
1720        }
1721        else if (name.equals("molecularFormulaByMoiety")) {
1722          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.structure.molecularFormulaByMoiety");
1723        }
1724        else if (name.equals("molecularWeight")) {
1725          this.molecularWeight = new SubstanceDefinitionMolecularWeightComponent();
1726          return this.molecularWeight;
1727        }
1728        else if (name.equals("technique")) {
1729          return addTechnique();
1730        }
1731        else if (name.equals("sourceDocument")) {
1732          return addSourceDocument();
1733        }
1734        else if (name.equals("representation")) {
1735          return addRepresentation();
1736        }
1737        else
1738          return super.addChild(name);
1739      }
1740
1741      public SubstanceDefinitionStructureComponent copy() {
1742        SubstanceDefinitionStructureComponent dst = new SubstanceDefinitionStructureComponent();
1743        copyValues(dst);
1744        return dst;
1745      }
1746
1747      public void copyValues(SubstanceDefinitionStructureComponent dst) {
1748        super.copyValues(dst);
1749        dst.stereochemistry = stereochemistry == null ? null : stereochemistry.copy();
1750        dst.opticalActivity = opticalActivity == null ? null : opticalActivity.copy();
1751        dst.molecularFormula = molecularFormula == null ? null : molecularFormula.copy();
1752        dst.molecularFormulaByMoiety = molecularFormulaByMoiety == null ? null : molecularFormulaByMoiety.copy();
1753        dst.molecularWeight = molecularWeight == null ? null : molecularWeight.copy();
1754        if (technique != null) {
1755          dst.technique = new ArrayList<CodeableConcept>();
1756          for (CodeableConcept i : technique)
1757            dst.technique.add(i.copy());
1758        };
1759        if (sourceDocument != null) {
1760          dst.sourceDocument = new ArrayList<Reference>();
1761          for (Reference i : sourceDocument)
1762            dst.sourceDocument.add(i.copy());
1763        };
1764        if (representation != null) {
1765          dst.representation = new ArrayList<SubstanceDefinitionStructureRepresentationComponent>();
1766          for (SubstanceDefinitionStructureRepresentationComponent i : representation)
1767            dst.representation.add(i.copy());
1768        };
1769      }
1770
1771      @Override
1772      public boolean equalsDeep(Base other_) {
1773        if (!super.equalsDeep(other_))
1774          return false;
1775        if (!(other_ instanceof SubstanceDefinitionStructureComponent))
1776          return false;
1777        SubstanceDefinitionStructureComponent o = (SubstanceDefinitionStructureComponent) other_;
1778        return compareDeep(stereochemistry, o.stereochemistry, true) && compareDeep(opticalActivity, o.opticalActivity, true)
1779           && compareDeep(molecularFormula, o.molecularFormula, true) && compareDeep(molecularFormulaByMoiety, o.molecularFormulaByMoiety, true)
1780           && compareDeep(molecularWeight, o.molecularWeight, true) && compareDeep(technique, o.technique, true)
1781           && compareDeep(sourceDocument, o.sourceDocument, true) && compareDeep(representation, o.representation, true)
1782          ;
1783      }
1784
1785      @Override
1786      public boolean equalsShallow(Base other_) {
1787        if (!super.equalsShallow(other_))
1788          return false;
1789        if (!(other_ instanceof SubstanceDefinitionStructureComponent))
1790          return false;
1791        SubstanceDefinitionStructureComponent o = (SubstanceDefinitionStructureComponent) other_;
1792        return compareValues(molecularFormula, o.molecularFormula, true) && compareValues(molecularFormulaByMoiety, o.molecularFormulaByMoiety, true)
1793          ;
1794      }
1795
1796      public boolean isEmpty() {
1797        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(stereochemistry, opticalActivity
1798          , molecularFormula, molecularFormulaByMoiety, molecularWeight, technique, sourceDocument
1799          , representation);
1800      }
1801
1802  public String fhirType() {
1803    return "SubstanceDefinition.structure";
1804
1805  }
1806
1807  }
1808
1809    @Block()
1810    public static class SubstanceDefinitionStructureRepresentationComponent extends BackboneElement implements IBaseBackboneElement {
1811        /**
1812         * The kind of structural representation (e.g. full, partial) or the technique used to derive the analytical characterization of the substance (e.g. x-ray, HPLC, NMR, peptide mapping, ligand binding assay, etc.).
1813         */
1814        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
1815        @Description(shortDefinition="The kind of structural representation (e.g. full, partial) or the technique used to derive the analytical characterization of the substance (e.g. x-ray, HPLC, NMR, peptide mapping, ligand binding assay, etc.)", formalDefinition="The kind of structural representation (e.g. full, partial) or the technique used to derive the analytical characterization of the substance (e.g. x-ray, HPLC, NMR, peptide mapping, ligand binding assay, etc.)." )
1816        protected CodeableConcept type;
1817
1818        /**
1819         * The structural representation or characterization as a text string in a standard format.
1820         */
1821        @Child(name = "representation", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1822        @Description(shortDefinition="The structural representation or characterization as a text string in a standard format", formalDefinition="The structural representation or characterization as a text string in a standard format." )
1823        protected StringType representation;
1824
1825        /**
1826         * The format of the representation e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF. The logical content type rather than the physical file format of a document.
1827         */
1828        @Child(name = "format", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1829        @Description(shortDefinition="The format of the representation e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF. The logical content type rather than the physical file format of a document", formalDefinition="The format of the representation e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF. The logical content type rather than the physical file format of a document." )
1830        protected CodeableConcept format;
1831
1832        /**
1833         * An attached file with the structural representation or characterization e.g. a molecular structure graphic of the substance, a JCAMP or AnIML file.
1834         */
1835        @Child(name = "document", type = {DocumentReference.class}, order=4, min=0, max=1, modifier=false, summary=true)
1836        @Description(shortDefinition="An attached file with the structural representation or characterization e.g. a molecular structure graphic of the substance, a JCAMP or AnIML file", formalDefinition="An attached file with the structural representation or characterization e.g. a molecular structure graphic of the substance, a JCAMP or AnIML file." )
1837        protected Reference document;
1838
1839        private static final long serialVersionUID = 138704347L;
1840
1841    /**
1842     * Constructor
1843     */
1844      public SubstanceDefinitionStructureRepresentationComponent() {
1845        super();
1846      }
1847
1848        /**
1849         * @return {@link #type} (The kind of structural representation (e.g. full, partial) or the technique used to derive the analytical characterization of the substance (e.g. x-ray, HPLC, NMR, peptide mapping, ligand binding assay, etc.).)
1850         */
1851        public CodeableConcept getType() { 
1852          if (this.type == null)
1853            if (Configuration.errorOnAutoCreate())
1854              throw new Error("Attempt to auto-create SubstanceDefinitionStructureRepresentationComponent.type");
1855            else if (Configuration.doAutoCreate())
1856              this.type = new CodeableConcept(); // cc
1857          return this.type;
1858        }
1859
1860        public boolean hasType() { 
1861          return this.type != null && !this.type.isEmpty();
1862        }
1863
1864        /**
1865         * @param value {@link #type} (The kind of structural representation (e.g. full, partial) or the technique used to derive the analytical characterization of the substance (e.g. x-ray, HPLC, NMR, peptide mapping, ligand binding assay, etc.).)
1866         */
1867        public SubstanceDefinitionStructureRepresentationComponent setType(CodeableConcept value) { 
1868          this.type = value;
1869          return this;
1870        }
1871
1872        /**
1873         * @return {@link #representation} (The structural representation or characterization as a text string in a standard format.). This is the underlying object with id, value and extensions. The accessor "getRepresentation" gives direct access to the value
1874         */
1875        public StringType getRepresentationElement() { 
1876          if (this.representation == null)
1877            if (Configuration.errorOnAutoCreate())
1878              throw new Error("Attempt to auto-create SubstanceDefinitionStructureRepresentationComponent.representation");
1879            else if (Configuration.doAutoCreate())
1880              this.representation = new StringType(); // bb
1881          return this.representation;
1882        }
1883
1884        public boolean hasRepresentationElement() { 
1885          return this.representation != null && !this.representation.isEmpty();
1886        }
1887
1888        public boolean hasRepresentation() { 
1889          return this.representation != null && !this.representation.isEmpty();
1890        }
1891
1892        /**
1893         * @param value {@link #representation} (The structural representation or characterization as a text string in a standard format.). This is the underlying object with id, value and extensions. The accessor "getRepresentation" gives direct access to the value
1894         */
1895        public SubstanceDefinitionStructureRepresentationComponent setRepresentationElement(StringType value) { 
1896          this.representation = value;
1897          return this;
1898        }
1899
1900        /**
1901         * @return The structural representation or characterization as a text string in a standard format.
1902         */
1903        public String getRepresentation() { 
1904          return this.representation == null ? null : this.representation.getValue();
1905        }
1906
1907        /**
1908         * @param value The structural representation or characterization as a text string in a standard format.
1909         */
1910        public SubstanceDefinitionStructureRepresentationComponent setRepresentation(String value) { 
1911          if (Utilities.noString(value))
1912            this.representation = null;
1913          else {
1914            if (this.representation == null)
1915              this.representation = new StringType();
1916            this.representation.setValue(value);
1917          }
1918          return this;
1919        }
1920
1921        /**
1922         * @return {@link #format} (The format of the representation e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF. The logical content type rather than the physical file format of a document.)
1923         */
1924        public CodeableConcept getFormat() { 
1925          if (this.format == null)
1926            if (Configuration.errorOnAutoCreate())
1927              throw new Error("Attempt to auto-create SubstanceDefinitionStructureRepresentationComponent.format");
1928            else if (Configuration.doAutoCreate())
1929              this.format = new CodeableConcept(); // cc
1930          return this.format;
1931        }
1932
1933        public boolean hasFormat() { 
1934          return this.format != null && !this.format.isEmpty();
1935        }
1936
1937        /**
1938         * @param value {@link #format} (The format of the representation e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF. The logical content type rather than the physical file format of a document.)
1939         */
1940        public SubstanceDefinitionStructureRepresentationComponent setFormat(CodeableConcept value) { 
1941          this.format = value;
1942          return this;
1943        }
1944
1945        /**
1946         * @return {@link #document} (An attached file with the structural representation or characterization e.g. a molecular structure graphic of the substance, a JCAMP or AnIML file.)
1947         */
1948        public Reference getDocument() { 
1949          if (this.document == null)
1950            if (Configuration.errorOnAutoCreate())
1951              throw new Error("Attempt to auto-create SubstanceDefinitionStructureRepresentationComponent.document");
1952            else if (Configuration.doAutoCreate())
1953              this.document = new Reference(); // cc
1954          return this.document;
1955        }
1956
1957        public boolean hasDocument() { 
1958          return this.document != null && !this.document.isEmpty();
1959        }
1960
1961        /**
1962         * @param value {@link #document} (An attached file with the structural representation or characterization e.g. a molecular structure graphic of the substance, a JCAMP or AnIML file.)
1963         */
1964        public SubstanceDefinitionStructureRepresentationComponent setDocument(Reference value) { 
1965          this.document = value;
1966          return this;
1967        }
1968
1969        protected void listChildren(List<Property> children) {
1970          super.listChildren(children);
1971          children.add(new Property("type", "CodeableConcept", "The kind of structural representation (e.g. full, partial) or the technique used to derive the analytical characterization of the substance (e.g. x-ray, HPLC, NMR, peptide mapping, ligand binding assay, etc.).", 0, 1, type));
1972          children.add(new Property("representation", "string", "The structural representation or characterization as a text string in a standard format.", 0, 1, representation));
1973          children.add(new Property("format", "CodeableConcept", "The format of the representation e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF. The logical content type rather than the physical file format of a document.", 0, 1, format));
1974          children.add(new Property("document", "Reference(DocumentReference)", "An attached file with the structural representation or characterization e.g. a molecular structure graphic of the substance, a JCAMP or AnIML file.", 0, 1, document));
1975        }
1976
1977        @Override
1978        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1979          switch (_hash) {
1980          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "The kind of structural representation (e.g. full, partial) or the technique used to derive the analytical characterization of the substance (e.g. x-ray, HPLC, NMR, peptide mapping, ligand binding assay, etc.).", 0, 1, type);
1981          case -671065907: /*representation*/  return new Property("representation", "string", "The structural representation or characterization as a text string in a standard format.", 0, 1, representation);
1982          case -1268779017: /*format*/  return new Property("format", "CodeableConcept", "The format of the representation e.g. InChI, SMILES, MOLFILE, CDX, SDF, PDB, mmCIF. The logical content type rather than the physical file format of a document.", 0, 1, format);
1983          case 861720859: /*document*/  return new Property("document", "Reference(DocumentReference)", "An attached file with the structural representation or characterization e.g. a molecular structure graphic of the substance, a JCAMP or AnIML file.", 0, 1, document);
1984          default: return super.getNamedProperty(_hash, _name, _checkValid);
1985          }
1986
1987        }
1988
1989      @Override
1990      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1991        switch (hash) {
1992        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1993        case -671065907: /*representation*/ return this.representation == null ? new Base[0] : new Base[] {this.representation}; // StringType
1994        case -1268779017: /*format*/ return this.format == null ? new Base[0] : new Base[] {this.format}; // CodeableConcept
1995        case 861720859: /*document*/ return this.document == null ? new Base[0] : new Base[] {this.document}; // Reference
1996        default: return super.getProperty(hash, name, checkValid);
1997        }
1998
1999      }
2000
2001      @Override
2002      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2003        switch (hash) {
2004        case 3575610: // type
2005          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2006          return value;
2007        case -671065907: // representation
2008          this.representation = TypeConvertor.castToString(value); // StringType
2009          return value;
2010        case -1268779017: // format
2011          this.format = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2012          return value;
2013        case 861720859: // document
2014          this.document = TypeConvertor.castToReference(value); // Reference
2015          return value;
2016        default: return super.setProperty(hash, name, value);
2017        }
2018
2019      }
2020
2021      @Override
2022      public Base setProperty(String name, Base value) throws FHIRException {
2023        if (name.equals("type")) {
2024          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2025        } else if (name.equals("representation")) {
2026          this.representation = TypeConvertor.castToString(value); // StringType
2027        } else if (name.equals("format")) {
2028          this.format = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2029        } else if (name.equals("document")) {
2030          this.document = TypeConvertor.castToReference(value); // Reference
2031        } else
2032          return super.setProperty(name, value);
2033        return value;
2034      }
2035
2036      @Override
2037      public Base makeProperty(int hash, String name) throws FHIRException {
2038        switch (hash) {
2039        case 3575610:  return getType();
2040        case -671065907:  return getRepresentationElement();
2041        case -1268779017:  return getFormat();
2042        case 861720859:  return getDocument();
2043        default: return super.makeProperty(hash, name);
2044        }
2045
2046      }
2047
2048      @Override
2049      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2050        switch (hash) {
2051        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2052        case -671065907: /*representation*/ return new String[] {"string"};
2053        case -1268779017: /*format*/ return new String[] {"CodeableConcept"};
2054        case 861720859: /*document*/ return new String[] {"Reference"};
2055        default: return super.getTypesForProperty(hash, name);
2056        }
2057
2058      }
2059
2060      @Override
2061      public Base addChild(String name) throws FHIRException {
2062        if (name.equals("type")) {
2063          this.type = new CodeableConcept();
2064          return this.type;
2065        }
2066        else if (name.equals("representation")) {
2067          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.structure.representation.representation");
2068        }
2069        else if (name.equals("format")) {
2070          this.format = new CodeableConcept();
2071          return this.format;
2072        }
2073        else if (name.equals("document")) {
2074          this.document = new Reference();
2075          return this.document;
2076        }
2077        else
2078          return super.addChild(name);
2079      }
2080
2081      public SubstanceDefinitionStructureRepresentationComponent copy() {
2082        SubstanceDefinitionStructureRepresentationComponent dst = new SubstanceDefinitionStructureRepresentationComponent();
2083        copyValues(dst);
2084        return dst;
2085      }
2086
2087      public void copyValues(SubstanceDefinitionStructureRepresentationComponent dst) {
2088        super.copyValues(dst);
2089        dst.type = type == null ? null : type.copy();
2090        dst.representation = representation == null ? null : representation.copy();
2091        dst.format = format == null ? null : format.copy();
2092        dst.document = document == null ? null : document.copy();
2093      }
2094
2095      @Override
2096      public boolean equalsDeep(Base other_) {
2097        if (!super.equalsDeep(other_))
2098          return false;
2099        if (!(other_ instanceof SubstanceDefinitionStructureRepresentationComponent))
2100          return false;
2101        SubstanceDefinitionStructureRepresentationComponent o = (SubstanceDefinitionStructureRepresentationComponent) other_;
2102        return compareDeep(type, o.type, true) && compareDeep(representation, o.representation, true) && compareDeep(format, o.format, true)
2103           && compareDeep(document, o.document, true);
2104      }
2105
2106      @Override
2107      public boolean equalsShallow(Base other_) {
2108        if (!super.equalsShallow(other_))
2109          return false;
2110        if (!(other_ instanceof SubstanceDefinitionStructureRepresentationComponent))
2111          return false;
2112        SubstanceDefinitionStructureRepresentationComponent o = (SubstanceDefinitionStructureRepresentationComponent) other_;
2113        return compareValues(representation, o.representation, true);
2114      }
2115
2116      public boolean isEmpty() {
2117        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, representation, format
2118          , document);
2119      }
2120
2121  public String fhirType() {
2122    return "SubstanceDefinition.structure.representation";
2123
2124  }
2125
2126  }
2127
2128    @Block()
2129    public static class SubstanceDefinitionCodeComponent extends BackboneElement implements IBaseBackboneElement {
2130        /**
2131         * The specific code.
2132         */
2133        @Child(name = "code", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
2134        @Description(shortDefinition="The specific code", formalDefinition="The specific code." )
2135        protected CodeableConcept code;
2136
2137        /**
2138         * Status of the code assignment, for example 'provisional', 'approved'.
2139         */
2140        @Child(name = "status", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
2141        @Description(shortDefinition="Status of the code assignment, for example 'provisional', 'approved'", formalDefinition="Status of the code assignment, for example 'provisional', 'approved'." )
2142        protected CodeableConcept status;
2143
2144        /**
2145         * The date at which the code status is changed as part of the terminology maintenance.
2146         */
2147        @Child(name = "statusDate", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2148        @Description(shortDefinition="The date at which the code status is changed as part of the terminology maintenance", formalDefinition="The date at which the code status is changed as part of the terminology maintenance." )
2149        protected DateTimeType statusDate;
2150
2151        /**
2152         * Any comment can be provided in this field, if necessary.
2153         */
2154        @Child(name = "note", type = {Annotation.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2155        @Description(shortDefinition="Any comment can be provided in this field, if necessary", formalDefinition="Any comment can be provided in this field, if necessary." )
2156        protected List<Annotation> note;
2157
2158        /**
2159         * Supporting literature.
2160         */
2161        @Child(name = "source", type = {DocumentReference.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2162        @Description(shortDefinition="Supporting literature", formalDefinition="Supporting literature." )
2163        protected List<Reference> source;
2164
2165        private static final long serialVersionUID = 1140562105L;
2166
2167    /**
2168     * Constructor
2169     */
2170      public SubstanceDefinitionCodeComponent() {
2171        super();
2172      }
2173
2174        /**
2175         * @return {@link #code} (The specific code.)
2176         */
2177        public CodeableConcept getCode() { 
2178          if (this.code == null)
2179            if (Configuration.errorOnAutoCreate())
2180              throw new Error("Attempt to auto-create SubstanceDefinitionCodeComponent.code");
2181            else if (Configuration.doAutoCreate())
2182              this.code = new CodeableConcept(); // cc
2183          return this.code;
2184        }
2185
2186        public boolean hasCode() { 
2187          return this.code != null && !this.code.isEmpty();
2188        }
2189
2190        /**
2191         * @param value {@link #code} (The specific code.)
2192         */
2193        public SubstanceDefinitionCodeComponent setCode(CodeableConcept value) { 
2194          this.code = value;
2195          return this;
2196        }
2197
2198        /**
2199         * @return {@link #status} (Status of the code assignment, for example 'provisional', 'approved'.)
2200         */
2201        public CodeableConcept getStatus() { 
2202          if (this.status == null)
2203            if (Configuration.errorOnAutoCreate())
2204              throw new Error("Attempt to auto-create SubstanceDefinitionCodeComponent.status");
2205            else if (Configuration.doAutoCreate())
2206              this.status = new CodeableConcept(); // cc
2207          return this.status;
2208        }
2209
2210        public boolean hasStatus() { 
2211          return this.status != null && !this.status.isEmpty();
2212        }
2213
2214        /**
2215         * @param value {@link #status} (Status of the code assignment, for example 'provisional', 'approved'.)
2216         */
2217        public SubstanceDefinitionCodeComponent setStatus(CodeableConcept value) { 
2218          this.status = value;
2219          return this;
2220        }
2221
2222        /**
2223         * @return {@link #statusDate} (The date at which the code status is changed as part of the terminology maintenance.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
2224         */
2225        public DateTimeType getStatusDateElement() { 
2226          if (this.statusDate == null)
2227            if (Configuration.errorOnAutoCreate())
2228              throw new Error("Attempt to auto-create SubstanceDefinitionCodeComponent.statusDate");
2229            else if (Configuration.doAutoCreate())
2230              this.statusDate = new DateTimeType(); // bb
2231          return this.statusDate;
2232        }
2233
2234        public boolean hasStatusDateElement() { 
2235          return this.statusDate != null && !this.statusDate.isEmpty();
2236        }
2237
2238        public boolean hasStatusDate() { 
2239          return this.statusDate != null && !this.statusDate.isEmpty();
2240        }
2241
2242        /**
2243         * @param value {@link #statusDate} (The date at which the code status is changed as part of the terminology maintenance.). This is the underlying object with id, value and extensions. The accessor "getStatusDate" gives direct access to the value
2244         */
2245        public SubstanceDefinitionCodeComponent setStatusDateElement(DateTimeType value) { 
2246          this.statusDate = value;
2247          return this;
2248        }
2249
2250        /**
2251         * @return The date at which the code status is changed as part of the terminology maintenance.
2252         */
2253        public Date getStatusDate() { 
2254          return this.statusDate == null ? null : this.statusDate.getValue();
2255        }
2256
2257        /**
2258         * @param value The date at which the code status is changed as part of the terminology maintenance.
2259         */
2260        public SubstanceDefinitionCodeComponent setStatusDate(Date value) { 
2261          if (value == null)
2262            this.statusDate = null;
2263          else {
2264            if (this.statusDate == null)
2265              this.statusDate = new DateTimeType();
2266            this.statusDate.setValue(value);
2267          }
2268          return this;
2269        }
2270
2271        /**
2272         * @return {@link #note} (Any comment can be provided in this field, if necessary.)
2273         */
2274        public List<Annotation> getNote() { 
2275          if (this.note == null)
2276            this.note = new ArrayList<Annotation>();
2277          return this.note;
2278        }
2279
2280        /**
2281         * @return Returns a reference to <code>this</code> for easy method chaining
2282         */
2283        public SubstanceDefinitionCodeComponent setNote(List<Annotation> theNote) { 
2284          this.note = theNote;
2285          return this;
2286        }
2287
2288        public boolean hasNote() { 
2289          if (this.note == null)
2290            return false;
2291          for (Annotation item : this.note)
2292            if (!item.isEmpty())
2293              return true;
2294          return false;
2295        }
2296
2297        public Annotation addNote() { //3
2298          Annotation t = new Annotation();
2299          if (this.note == null)
2300            this.note = new ArrayList<Annotation>();
2301          this.note.add(t);
2302          return t;
2303        }
2304
2305        public SubstanceDefinitionCodeComponent addNote(Annotation t) { //3
2306          if (t == null)
2307            return this;
2308          if (this.note == null)
2309            this.note = new ArrayList<Annotation>();
2310          this.note.add(t);
2311          return this;
2312        }
2313
2314        /**
2315         * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
2316         */
2317        public Annotation getNoteFirstRep() { 
2318          if (getNote().isEmpty()) {
2319            addNote();
2320          }
2321          return getNote().get(0);
2322        }
2323
2324        /**
2325         * @return {@link #source} (Supporting literature.)
2326         */
2327        public List<Reference> getSource() { 
2328          if (this.source == null)
2329            this.source = new ArrayList<Reference>();
2330          return this.source;
2331        }
2332
2333        /**
2334         * @return Returns a reference to <code>this</code> for easy method chaining
2335         */
2336        public SubstanceDefinitionCodeComponent setSource(List<Reference> theSource) { 
2337          this.source = theSource;
2338          return this;
2339        }
2340
2341        public boolean hasSource() { 
2342          if (this.source == null)
2343            return false;
2344          for (Reference item : this.source)
2345            if (!item.isEmpty())
2346              return true;
2347          return false;
2348        }
2349
2350        public Reference addSource() { //3
2351          Reference t = new Reference();
2352          if (this.source == null)
2353            this.source = new ArrayList<Reference>();
2354          this.source.add(t);
2355          return t;
2356        }
2357
2358        public SubstanceDefinitionCodeComponent addSource(Reference t) { //3
2359          if (t == null)
2360            return this;
2361          if (this.source == null)
2362            this.source = new ArrayList<Reference>();
2363          this.source.add(t);
2364          return this;
2365        }
2366
2367        /**
2368         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist {3}
2369         */
2370        public Reference getSourceFirstRep() { 
2371          if (getSource().isEmpty()) {
2372            addSource();
2373          }
2374          return getSource().get(0);
2375        }
2376
2377        protected void listChildren(List<Property> children) {
2378          super.listChildren(children);
2379          children.add(new Property("code", "CodeableConcept", "The specific code.", 0, 1, code));
2380          children.add(new Property("status", "CodeableConcept", "Status of the code assignment, for example 'provisional', 'approved'.", 0, 1, status));
2381          children.add(new Property("statusDate", "dateTime", "The date at which the code status is changed as part of the terminology maintenance.", 0, 1, statusDate));
2382          children.add(new Property("note", "Annotation", "Any comment can be provided in this field, if necessary.", 0, java.lang.Integer.MAX_VALUE, note));
2383          children.add(new Property("source", "Reference(DocumentReference)", "Supporting literature.", 0, java.lang.Integer.MAX_VALUE, source));
2384        }
2385
2386        @Override
2387        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2388          switch (_hash) {
2389          case 3059181: /*code*/  return new Property("code", "CodeableConcept", "The specific code.", 0, 1, code);
2390          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "Status of the code assignment, for example 'provisional', 'approved'.", 0, 1, status);
2391          case 247524032: /*statusDate*/  return new Property("statusDate", "dateTime", "The date at which the code status is changed as part of the terminology maintenance.", 0, 1, statusDate);
2392          case 3387378: /*note*/  return new Property("note", "Annotation", "Any comment can be provided in this field, if necessary.", 0, java.lang.Integer.MAX_VALUE, note);
2393          case -896505829: /*source*/  return new Property("source", "Reference(DocumentReference)", "Supporting literature.", 0, java.lang.Integer.MAX_VALUE, source);
2394          default: return super.getNamedProperty(_hash, _name, _checkValid);
2395          }
2396
2397        }
2398
2399      @Override
2400      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2401        switch (hash) {
2402        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
2403        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
2404        case 247524032: /*statusDate*/ return this.statusDate == null ? new Base[0] : new Base[] {this.statusDate}; // DateTimeType
2405        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
2406        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference
2407        default: return super.getProperty(hash, name, checkValid);
2408        }
2409
2410      }
2411
2412      @Override
2413      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2414        switch (hash) {
2415        case 3059181: // code
2416          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2417          return value;
2418        case -892481550: // status
2419          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2420          return value;
2421        case 247524032: // statusDate
2422          this.statusDate = TypeConvertor.castToDateTime(value); // DateTimeType
2423          return value;
2424        case 3387378: // note
2425          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
2426          return value;
2427        case -896505829: // source
2428          this.getSource().add(TypeConvertor.castToReference(value)); // Reference
2429          return value;
2430        default: return super.setProperty(hash, name, value);
2431        }
2432
2433      }
2434
2435      @Override
2436      public Base setProperty(String name, Base value) throws FHIRException {
2437        if (name.equals("code")) {
2438          this.code = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2439        } else if (name.equals("status")) {
2440          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
2441        } else if (name.equals("statusDate")) {
2442          this.statusDate = TypeConvertor.castToDateTime(value); // DateTimeType
2443        } else if (name.equals("note")) {
2444          this.getNote().add(TypeConvertor.castToAnnotation(value));
2445        } else if (name.equals("source")) {
2446          this.getSource().add(TypeConvertor.castToReference(value));
2447        } else
2448          return super.setProperty(name, value);
2449        return value;
2450      }
2451
2452      @Override
2453      public Base makeProperty(int hash, String name) throws FHIRException {
2454        switch (hash) {
2455        case 3059181:  return getCode();
2456        case -892481550:  return getStatus();
2457        case 247524032:  return getStatusDateElement();
2458        case 3387378:  return addNote(); 
2459        case -896505829:  return addSource(); 
2460        default: return super.makeProperty(hash, name);
2461        }
2462
2463      }
2464
2465      @Override
2466      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2467        switch (hash) {
2468        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
2469        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
2470        case 247524032: /*statusDate*/ return new String[] {"dateTime"};
2471        case 3387378: /*note*/ return new String[] {"Annotation"};
2472        case -896505829: /*source*/ return new String[] {"Reference"};
2473        default: return super.getTypesForProperty(hash, name);
2474        }
2475
2476      }
2477
2478      @Override
2479      public Base addChild(String name) throws FHIRException {
2480        if (name.equals("code")) {
2481          this.code = new CodeableConcept();
2482          return this.code;
2483        }
2484        else if (name.equals("status")) {
2485          this.status = new CodeableConcept();
2486          return this.status;
2487        }
2488        else if (name.equals("statusDate")) {
2489          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.code.statusDate");
2490        }
2491        else if (name.equals("note")) {
2492          return addNote();
2493        }
2494        else if (name.equals("source")) {
2495          return addSource();
2496        }
2497        else
2498          return super.addChild(name);
2499      }
2500
2501      public SubstanceDefinitionCodeComponent copy() {
2502        SubstanceDefinitionCodeComponent dst = new SubstanceDefinitionCodeComponent();
2503        copyValues(dst);
2504        return dst;
2505      }
2506
2507      public void copyValues(SubstanceDefinitionCodeComponent dst) {
2508        super.copyValues(dst);
2509        dst.code = code == null ? null : code.copy();
2510        dst.status = status == null ? null : status.copy();
2511        dst.statusDate = statusDate == null ? null : statusDate.copy();
2512        if (note != null) {
2513          dst.note = new ArrayList<Annotation>();
2514          for (Annotation i : note)
2515            dst.note.add(i.copy());
2516        };
2517        if (source != null) {
2518          dst.source = new ArrayList<Reference>();
2519          for (Reference i : source)
2520            dst.source.add(i.copy());
2521        };
2522      }
2523
2524      @Override
2525      public boolean equalsDeep(Base other_) {
2526        if (!super.equalsDeep(other_))
2527          return false;
2528        if (!(other_ instanceof SubstanceDefinitionCodeComponent))
2529          return false;
2530        SubstanceDefinitionCodeComponent o = (SubstanceDefinitionCodeComponent) other_;
2531        return compareDeep(code, o.code, true) && compareDeep(status, o.status, true) && compareDeep(statusDate, o.statusDate, true)
2532           && compareDeep(note, o.note, true) && compareDeep(source, o.source, true);
2533      }
2534
2535      @Override
2536      public boolean equalsShallow(Base other_) {
2537        if (!super.equalsShallow(other_))
2538          return false;
2539        if (!(other_ instanceof SubstanceDefinitionCodeComponent))
2540          return false;
2541        SubstanceDefinitionCodeComponent o = (SubstanceDefinitionCodeComponent) other_;
2542        return compareValues(statusDate, o.statusDate, true);
2543      }
2544
2545      public boolean isEmpty() {
2546        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, status, statusDate
2547          , note, source);
2548      }
2549
2550  public String fhirType() {
2551    return "SubstanceDefinition.code";
2552
2553  }
2554
2555  }
2556
2557    @Block()
2558    public static class SubstanceDefinitionNameComponent extends BackboneElement implements IBaseBackboneElement {
2559        /**
2560         * The actual name.
2561         */
2562        @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
2563        @Description(shortDefinition="The actual name", formalDefinition="The actual name." )
2564        protected StringType name;
2565
2566        /**
2567         * Name type, for example 'systematic',  'scientific, 'brand'.
2568         */
2569        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
2570        @Description(shortDefinition="Name type, for example 'systematic',  'scientific, 'brand'", formalDefinition="Name type, for example 'systematic',  'scientific, 'brand'." )
2571        protected CodeableConcept type;
2572
2573        /**
2574         * The status of the name, for example 'current', 'proposed'.
2575         */
2576        @Child(name = "status", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
2577        @Description(shortDefinition="The status of the name, for example 'current', 'proposed'", formalDefinition="The status of the name, for example 'current', 'proposed'." )
2578        protected CodeableConcept status;
2579
2580        /**
2581         * If this is the preferred name for this substance.
2582         */
2583        @Child(name = "preferred", type = {BooleanType.class}, order=4, min=0, max=1, modifier=false, summary=true)
2584        @Description(shortDefinition="If this is the preferred name for this substance", formalDefinition="If this is the preferred name for this substance." )
2585        protected BooleanType preferred;
2586
2587        /**
2588         * Human language that the name is written in.
2589         */
2590        @Child(name = "language", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2591        @Description(shortDefinition="Human language that the name is written in", formalDefinition="Human language that the name is written in." )
2592        protected List<CodeableConcept> language;
2593
2594        /**
2595         * The use context of this name for example if there is a different name a drug active ingredient as opposed to a food colour additive.
2596         */
2597        @Child(name = "domain", type = {CodeableConcept.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2598        @Description(shortDefinition="The use context of this name for example if there is a different name a drug active ingredient as opposed to a food colour additive", formalDefinition="The use context of this name for example if there is a different name a drug active ingredient as opposed to a food colour additive." )
2599        protected List<CodeableConcept> domain;
2600
2601        /**
2602         * The jurisdiction where this name applies.
2603         */
2604        @Child(name = "jurisdiction", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2605        @Description(shortDefinition="The jurisdiction where this name applies", formalDefinition="The jurisdiction where this name applies." )
2606        protected List<CodeableConcept> jurisdiction;
2607
2608        /**
2609         * A synonym of this particular name, by which the substance is also known.
2610         */
2611        @Child(name = "synonym", type = {SubstanceDefinitionNameComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2612        @Description(shortDefinition="A synonym of this particular name, by which the substance is also known", formalDefinition="A synonym of this particular name, by which the substance is also known." )
2613        protected List<SubstanceDefinitionNameComponent> synonym;
2614
2615        /**
2616         * A translation for this name into another human language.
2617         */
2618        @Child(name = "translation", type = {SubstanceDefinitionNameComponent.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2619        @Description(shortDefinition="A translation for this name into another human language", formalDefinition="A translation for this name into another human language." )
2620        protected List<SubstanceDefinitionNameComponent> translation;
2621
2622        /**
2623         * Details of the official nature of this name.
2624         */
2625        @Child(name = "official", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2626        @Description(shortDefinition="Details of the official nature of this name", formalDefinition="Details of the official nature of this name." )
2627        protected List<SubstanceDefinitionNameOfficialComponent> official;
2628
2629        /**
2630         * Supporting literature.
2631         */
2632        @Child(name = "source", type = {DocumentReference.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2633        @Description(shortDefinition="Supporting literature", formalDefinition="Supporting literature." )
2634        protected List<Reference> source;
2635
2636        private static final long serialVersionUID = -1184238780L;
2637
2638    /**
2639     * Constructor
2640     */
2641      public SubstanceDefinitionNameComponent() {
2642        super();
2643      }
2644
2645    /**
2646     * Constructor
2647     */
2648      public SubstanceDefinitionNameComponent(String name) {
2649        super();
2650        this.setName(name);
2651      }
2652
2653        /**
2654         * @return {@link #name} (The actual name.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2655         */
2656        public StringType getNameElement() { 
2657          if (this.name == null)
2658            if (Configuration.errorOnAutoCreate())
2659              throw new Error("Attempt to auto-create SubstanceDefinitionNameComponent.name");
2660            else if (Configuration.doAutoCreate())
2661              this.name = new StringType(); // bb
2662          return this.name;
2663        }
2664
2665        public boolean hasNameElement() { 
2666          return this.name != null && !this.name.isEmpty();
2667        }
2668
2669        public boolean hasName() { 
2670          return this.name != null && !this.name.isEmpty();
2671        }
2672
2673        /**
2674         * @param value {@link #name} (The actual name.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
2675         */
2676        public SubstanceDefinitionNameComponent setNameElement(StringType value) { 
2677          this.name = value;
2678          return this;
2679        }
2680
2681        /**
2682         * @return The actual name.
2683         */
2684        public String getName() { 
2685          return this.name == null ? null : this.name.getValue();
2686        }
2687
2688        /**
2689         * @param value The actual name.
2690         */
2691        public SubstanceDefinitionNameComponent setName(String value) { 
2692            if (this.name == null)
2693              this.name = new StringType();
2694            this.name.setValue(value);
2695          return this;
2696        }
2697
2698        /**
2699         * @return {@link #type} (Name type, for example 'systematic',  'scientific, 'brand'.)
2700         */
2701        public CodeableConcept getType() { 
2702          if (this.type == null)
2703            if (Configuration.errorOnAutoCreate())
2704              throw new Error("Attempt to auto-create SubstanceDefinitionNameComponent.type");
2705            else if (Configuration.doAutoCreate())
2706              this.type = new CodeableConcept(); // cc
2707          return this.type;
2708        }
2709
2710        public boolean hasType() { 
2711          return this.type != null && !this.type.isEmpty();
2712        }
2713
2714        /**
2715         * @param value {@link #type} (Name type, for example 'systematic',  'scientific, 'brand'.)
2716         */
2717        public SubstanceDefinitionNameComponent setType(CodeableConcept value) { 
2718          this.type = value;
2719          return this;
2720        }
2721
2722        /**
2723         * @return {@link #status} (The status of the name, for example 'current', 'proposed'.)
2724         */
2725        public CodeableConcept getStatus() { 
2726          if (this.status == null)
2727            if (Configuration.errorOnAutoCreate())
2728              throw new Error("Attempt to auto-create SubstanceDefinitionNameComponent.status");
2729            else if (Configuration.doAutoCreate())
2730              this.status = new CodeableConcept(); // cc
2731          return this.status;
2732        }
2733
2734        public boolean hasStatus() { 
2735          return this.status != null && !this.status.isEmpty();
2736        }
2737
2738        /**
2739         * @param value {@link #status} (The status of the name, for example 'current', 'proposed'.)
2740         */
2741        public SubstanceDefinitionNameComponent setStatus(CodeableConcept value) { 
2742          this.status = value;
2743          return this;
2744        }
2745
2746        /**
2747         * @return {@link #preferred} (If this is the preferred name for this substance.). This is the underlying object with id, value and extensions. The accessor "getPreferred" gives direct access to the value
2748         */
2749        public BooleanType getPreferredElement() { 
2750          if (this.preferred == null)
2751            if (Configuration.errorOnAutoCreate())
2752              throw new Error("Attempt to auto-create SubstanceDefinitionNameComponent.preferred");
2753            else if (Configuration.doAutoCreate())
2754              this.preferred = new BooleanType(); // bb
2755          return this.preferred;
2756        }
2757
2758        public boolean hasPreferredElement() { 
2759          return this.preferred != null && !this.preferred.isEmpty();
2760        }
2761
2762        public boolean hasPreferred() { 
2763          return this.preferred != null && !this.preferred.isEmpty();
2764        }
2765
2766        /**
2767         * @param value {@link #preferred} (If this is the preferred name for this substance.). This is the underlying object with id, value and extensions. The accessor "getPreferred" gives direct access to the value
2768         */
2769        public SubstanceDefinitionNameComponent setPreferredElement(BooleanType value) { 
2770          this.preferred = value;
2771          return this;
2772        }
2773
2774        /**
2775         * @return If this is the preferred name for this substance.
2776         */
2777        public boolean getPreferred() { 
2778          return this.preferred == null || this.preferred.isEmpty() ? false : this.preferred.getValue();
2779        }
2780
2781        /**
2782         * @param value If this is the preferred name for this substance.
2783         */
2784        public SubstanceDefinitionNameComponent setPreferred(boolean value) { 
2785            if (this.preferred == null)
2786              this.preferred = new BooleanType();
2787            this.preferred.setValue(value);
2788          return this;
2789        }
2790
2791        /**
2792         * @return {@link #language} (Human language that the name is written in.)
2793         */
2794        public List<CodeableConcept> getLanguage() { 
2795          if (this.language == null)
2796            this.language = new ArrayList<CodeableConcept>();
2797          return this.language;
2798        }
2799
2800        /**
2801         * @return Returns a reference to <code>this</code> for easy method chaining
2802         */
2803        public SubstanceDefinitionNameComponent setLanguage(List<CodeableConcept> theLanguage) { 
2804          this.language = theLanguage;
2805          return this;
2806        }
2807
2808        public boolean hasLanguage() { 
2809          if (this.language == null)
2810            return false;
2811          for (CodeableConcept item : this.language)
2812            if (!item.isEmpty())
2813              return true;
2814          return false;
2815        }
2816
2817        public CodeableConcept addLanguage() { //3
2818          CodeableConcept t = new CodeableConcept();
2819          if (this.language == null)
2820            this.language = new ArrayList<CodeableConcept>();
2821          this.language.add(t);
2822          return t;
2823        }
2824
2825        public SubstanceDefinitionNameComponent addLanguage(CodeableConcept t) { //3
2826          if (t == null)
2827            return this;
2828          if (this.language == null)
2829            this.language = new ArrayList<CodeableConcept>();
2830          this.language.add(t);
2831          return this;
2832        }
2833
2834        /**
2835         * @return The first repetition of repeating field {@link #language}, creating it if it does not already exist {3}
2836         */
2837        public CodeableConcept getLanguageFirstRep() { 
2838          if (getLanguage().isEmpty()) {
2839            addLanguage();
2840          }
2841          return getLanguage().get(0);
2842        }
2843
2844        /**
2845         * @return {@link #domain} (The use context of this name for example if there is a different name a drug active ingredient as opposed to a food colour additive.)
2846         */
2847        public List<CodeableConcept> getDomain() { 
2848          if (this.domain == null)
2849            this.domain = new ArrayList<CodeableConcept>();
2850          return this.domain;
2851        }
2852
2853        /**
2854         * @return Returns a reference to <code>this</code> for easy method chaining
2855         */
2856        public SubstanceDefinitionNameComponent setDomain(List<CodeableConcept> theDomain) { 
2857          this.domain = theDomain;
2858          return this;
2859        }
2860
2861        public boolean hasDomain() { 
2862          if (this.domain == null)
2863            return false;
2864          for (CodeableConcept item : this.domain)
2865            if (!item.isEmpty())
2866              return true;
2867          return false;
2868        }
2869
2870        public CodeableConcept addDomain() { //3
2871          CodeableConcept t = new CodeableConcept();
2872          if (this.domain == null)
2873            this.domain = new ArrayList<CodeableConcept>();
2874          this.domain.add(t);
2875          return t;
2876        }
2877
2878        public SubstanceDefinitionNameComponent addDomain(CodeableConcept t) { //3
2879          if (t == null)
2880            return this;
2881          if (this.domain == null)
2882            this.domain = new ArrayList<CodeableConcept>();
2883          this.domain.add(t);
2884          return this;
2885        }
2886
2887        /**
2888         * @return The first repetition of repeating field {@link #domain}, creating it if it does not already exist {3}
2889         */
2890        public CodeableConcept getDomainFirstRep() { 
2891          if (getDomain().isEmpty()) {
2892            addDomain();
2893          }
2894          return getDomain().get(0);
2895        }
2896
2897        /**
2898         * @return {@link #jurisdiction} (The jurisdiction where this name applies.)
2899         */
2900        public List<CodeableConcept> getJurisdiction() { 
2901          if (this.jurisdiction == null)
2902            this.jurisdiction = new ArrayList<CodeableConcept>();
2903          return this.jurisdiction;
2904        }
2905
2906        /**
2907         * @return Returns a reference to <code>this</code> for easy method chaining
2908         */
2909        public SubstanceDefinitionNameComponent setJurisdiction(List<CodeableConcept> theJurisdiction) { 
2910          this.jurisdiction = theJurisdiction;
2911          return this;
2912        }
2913
2914        public boolean hasJurisdiction() { 
2915          if (this.jurisdiction == null)
2916            return false;
2917          for (CodeableConcept item : this.jurisdiction)
2918            if (!item.isEmpty())
2919              return true;
2920          return false;
2921        }
2922
2923        public CodeableConcept addJurisdiction() { //3
2924          CodeableConcept t = new CodeableConcept();
2925          if (this.jurisdiction == null)
2926            this.jurisdiction = new ArrayList<CodeableConcept>();
2927          this.jurisdiction.add(t);
2928          return t;
2929        }
2930
2931        public SubstanceDefinitionNameComponent addJurisdiction(CodeableConcept t) { //3
2932          if (t == null)
2933            return this;
2934          if (this.jurisdiction == null)
2935            this.jurisdiction = new ArrayList<CodeableConcept>();
2936          this.jurisdiction.add(t);
2937          return this;
2938        }
2939
2940        /**
2941         * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist {3}
2942         */
2943        public CodeableConcept getJurisdictionFirstRep() { 
2944          if (getJurisdiction().isEmpty()) {
2945            addJurisdiction();
2946          }
2947          return getJurisdiction().get(0);
2948        }
2949
2950        /**
2951         * @return {@link #synonym} (A synonym of this particular name, by which the substance is also known.)
2952         */
2953        public List<SubstanceDefinitionNameComponent> getSynonym() { 
2954          if (this.synonym == null)
2955            this.synonym = new ArrayList<SubstanceDefinitionNameComponent>();
2956          return this.synonym;
2957        }
2958
2959        /**
2960         * @return Returns a reference to <code>this</code> for easy method chaining
2961         */
2962        public SubstanceDefinitionNameComponent setSynonym(List<SubstanceDefinitionNameComponent> theSynonym) { 
2963          this.synonym = theSynonym;
2964          return this;
2965        }
2966
2967        public boolean hasSynonym() { 
2968          if (this.synonym == null)
2969            return false;
2970          for (SubstanceDefinitionNameComponent item : this.synonym)
2971            if (!item.isEmpty())
2972              return true;
2973          return false;
2974        }
2975
2976        public SubstanceDefinitionNameComponent addSynonym() { //3
2977          SubstanceDefinitionNameComponent t = new SubstanceDefinitionNameComponent();
2978          if (this.synonym == null)
2979            this.synonym = new ArrayList<SubstanceDefinitionNameComponent>();
2980          this.synonym.add(t);
2981          return t;
2982        }
2983
2984        public SubstanceDefinitionNameComponent addSynonym(SubstanceDefinitionNameComponent t) { //3
2985          if (t == null)
2986            return this;
2987          if (this.synonym == null)
2988            this.synonym = new ArrayList<SubstanceDefinitionNameComponent>();
2989          this.synonym.add(t);
2990          return this;
2991        }
2992
2993        /**
2994         * @return The first repetition of repeating field {@link #synonym}, creating it if it does not already exist {3}
2995         */
2996        public SubstanceDefinitionNameComponent getSynonymFirstRep() { 
2997          if (getSynonym().isEmpty()) {
2998            addSynonym();
2999          }
3000          return getSynonym().get(0);
3001        }
3002
3003        /**
3004         * @return {@link #translation} (A translation for this name into another human language.)
3005         */
3006        public List<SubstanceDefinitionNameComponent> getTranslation() { 
3007          if (this.translation == null)
3008            this.translation = new ArrayList<SubstanceDefinitionNameComponent>();
3009          return this.translation;
3010        }
3011
3012        /**
3013         * @return Returns a reference to <code>this</code> for easy method chaining
3014         */
3015        public SubstanceDefinitionNameComponent setTranslation(List<SubstanceDefinitionNameComponent> theTranslation) { 
3016          this.translation = theTranslation;
3017          return this;
3018        }
3019
3020        public boolean hasTranslation() { 
3021          if (this.translation == null)
3022            return false;
3023          for (SubstanceDefinitionNameComponent item : this.translation)
3024            if (!item.isEmpty())
3025              return true;
3026          return false;
3027        }
3028
3029        public SubstanceDefinitionNameComponent addTranslation() { //3
3030          SubstanceDefinitionNameComponent t = new SubstanceDefinitionNameComponent();
3031          if (this.translation == null)
3032            this.translation = new ArrayList<SubstanceDefinitionNameComponent>();
3033          this.translation.add(t);
3034          return t;
3035        }
3036
3037        public SubstanceDefinitionNameComponent addTranslation(SubstanceDefinitionNameComponent t) { //3
3038          if (t == null)
3039            return this;
3040          if (this.translation == null)
3041            this.translation = new ArrayList<SubstanceDefinitionNameComponent>();
3042          this.translation.add(t);
3043          return this;
3044        }
3045
3046        /**
3047         * @return The first repetition of repeating field {@link #translation}, creating it if it does not already exist {3}
3048         */
3049        public SubstanceDefinitionNameComponent getTranslationFirstRep() { 
3050          if (getTranslation().isEmpty()) {
3051            addTranslation();
3052          }
3053          return getTranslation().get(0);
3054        }
3055
3056        /**
3057         * @return {@link #official} (Details of the official nature of this name.)
3058         */
3059        public List<SubstanceDefinitionNameOfficialComponent> getOfficial() { 
3060          if (this.official == null)
3061            this.official = new ArrayList<SubstanceDefinitionNameOfficialComponent>();
3062          return this.official;
3063        }
3064
3065        /**
3066         * @return Returns a reference to <code>this</code> for easy method chaining
3067         */
3068        public SubstanceDefinitionNameComponent setOfficial(List<SubstanceDefinitionNameOfficialComponent> theOfficial) { 
3069          this.official = theOfficial;
3070          return this;
3071        }
3072
3073        public boolean hasOfficial() { 
3074          if (this.official == null)
3075            return false;
3076          for (SubstanceDefinitionNameOfficialComponent item : this.official)
3077            if (!item.isEmpty())
3078              return true;
3079          return false;
3080        }
3081
3082        public SubstanceDefinitionNameOfficialComponent addOfficial() { //3
3083          SubstanceDefinitionNameOfficialComponent t = new SubstanceDefinitionNameOfficialComponent();
3084          if (this.official == null)
3085            this.official = new ArrayList<SubstanceDefinitionNameOfficialComponent>();
3086          this.official.add(t);
3087          return t;
3088        }
3089
3090        public SubstanceDefinitionNameComponent addOfficial(SubstanceDefinitionNameOfficialComponent t) { //3
3091          if (t == null)
3092            return this;
3093          if (this.official == null)
3094            this.official = new ArrayList<SubstanceDefinitionNameOfficialComponent>();
3095          this.official.add(t);
3096          return this;
3097        }
3098
3099        /**
3100         * @return The first repetition of repeating field {@link #official}, creating it if it does not already exist {3}
3101         */
3102        public SubstanceDefinitionNameOfficialComponent getOfficialFirstRep() { 
3103          if (getOfficial().isEmpty()) {
3104            addOfficial();
3105          }
3106          return getOfficial().get(0);
3107        }
3108
3109        /**
3110         * @return {@link #source} (Supporting literature.)
3111         */
3112        public List<Reference> getSource() { 
3113          if (this.source == null)
3114            this.source = new ArrayList<Reference>();
3115          return this.source;
3116        }
3117
3118        /**
3119         * @return Returns a reference to <code>this</code> for easy method chaining
3120         */
3121        public SubstanceDefinitionNameComponent setSource(List<Reference> theSource) { 
3122          this.source = theSource;
3123          return this;
3124        }
3125
3126        public boolean hasSource() { 
3127          if (this.source == null)
3128            return false;
3129          for (Reference item : this.source)
3130            if (!item.isEmpty())
3131              return true;
3132          return false;
3133        }
3134
3135        public Reference addSource() { //3
3136          Reference t = new Reference();
3137          if (this.source == null)
3138            this.source = new ArrayList<Reference>();
3139          this.source.add(t);
3140          return t;
3141        }
3142
3143        public SubstanceDefinitionNameComponent addSource(Reference t) { //3
3144          if (t == null)
3145            return this;
3146          if (this.source == null)
3147            this.source = new ArrayList<Reference>();
3148          this.source.add(t);
3149          return this;
3150        }
3151
3152        /**
3153         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist {3}
3154         */
3155        public Reference getSourceFirstRep() { 
3156          if (getSource().isEmpty()) {
3157            addSource();
3158          }
3159          return getSource().get(0);
3160        }
3161
3162        protected void listChildren(List<Property> children) {
3163          super.listChildren(children);
3164          children.add(new Property("name", "string", "The actual name.", 0, 1, name));
3165          children.add(new Property("type", "CodeableConcept", "Name type, for example 'systematic',  'scientific, 'brand'.", 0, 1, type));
3166          children.add(new Property("status", "CodeableConcept", "The status of the name, for example 'current', 'proposed'.", 0, 1, status));
3167          children.add(new Property("preferred", "boolean", "If this is the preferred name for this substance.", 0, 1, preferred));
3168          children.add(new Property("language", "CodeableConcept", "Human language that the name is written in.", 0, java.lang.Integer.MAX_VALUE, language));
3169          children.add(new Property("domain", "CodeableConcept", "The use context of this name for example if there is a different name a drug active ingredient as opposed to a food colour additive.", 0, java.lang.Integer.MAX_VALUE, domain));
3170          children.add(new Property("jurisdiction", "CodeableConcept", "The jurisdiction where this name applies.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
3171          children.add(new Property("synonym", "@SubstanceDefinition.name", "A synonym of this particular name, by which the substance is also known.", 0, java.lang.Integer.MAX_VALUE, synonym));
3172          children.add(new Property("translation", "@SubstanceDefinition.name", "A translation for this name into another human language.", 0, java.lang.Integer.MAX_VALUE, translation));
3173          children.add(new Property("official", "", "Details of the official nature of this name.", 0, java.lang.Integer.MAX_VALUE, official));
3174          children.add(new Property("source", "Reference(DocumentReference)", "Supporting literature.", 0, java.lang.Integer.MAX_VALUE, source));
3175        }
3176
3177        @Override
3178        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3179          switch (_hash) {
3180          case 3373707: /*name*/  return new Property("name", "string", "The actual name.", 0, 1, name);
3181          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Name type, for example 'systematic',  'scientific, 'brand'.", 0, 1, type);
3182          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "The status of the name, for example 'current', 'proposed'.", 0, 1, status);
3183          case -1294005119: /*preferred*/  return new Property("preferred", "boolean", "If this is the preferred name for this substance.", 0, 1, preferred);
3184          case -1613589672: /*language*/  return new Property("language", "CodeableConcept", "Human language that the name is written in.", 0, java.lang.Integer.MAX_VALUE, language);
3185          case -1326197564: /*domain*/  return new Property("domain", "CodeableConcept", "The use context of this name for example if there is a different name a drug active ingredient as opposed to a food colour additive.", 0, java.lang.Integer.MAX_VALUE, domain);
3186          case -507075711: /*jurisdiction*/  return new Property("jurisdiction", "CodeableConcept", "The jurisdiction where this name applies.", 0, java.lang.Integer.MAX_VALUE, jurisdiction);
3187          case -1742128133: /*synonym*/  return new Property("synonym", "@SubstanceDefinition.name", "A synonym of this particular name, by which the substance is also known.", 0, java.lang.Integer.MAX_VALUE, synonym);
3188          case -1840647503: /*translation*/  return new Property("translation", "@SubstanceDefinition.name", "A translation for this name into another human language.", 0, java.lang.Integer.MAX_VALUE, translation);
3189          case -765289749: /*official*/  return new Property("official", "", "Details of the official nature of this name.", 0, java.lang.Integer.MAX_VALUE, official);
3190          case -896505829: /*source*/  return new Property("source", "Reference(DocumentReference)", "Supporting literature.", 0, java.lang.Integer.MAX_VALUE, source);
3191          default: return super.getNamedProperty(_hash, _name, _checkValid);
3192          }
3193
3194        }
3195
3196      @Override
3197      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3198        switch (hash) {
3199        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
3200        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3201        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
3202        case -1294005119: /*preferred*/ return this.preferred == null ? new Base[0] : new Base[] {this.preferred}; // BooleanType
3203        case -1613589672: /*language*/ return this.language == null ? new Base[0] : this.language.toArray(new Base[this.language.size()]); // CodeableConcept
3204        case -1326197564: /*domain*/ return this.domain == null ? new Base[0] : this.domain.toArray(new Base[this.domain.size()]); // CodeableConcept
3205        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
3206        case -1742128133: /*synonym*/ return this.synonym == null ? new Base[0] : this.synonym.toArray(new Base[this.synonym.size()]); // SubstanceDefinitionNameComponent
3207        case -1840647503: /*translation*/ return this.translation == null ? new Base[0] : this.translation.toArray(new Base[this.translation.size()]); // SubstanceDefinitionNameComponent
3208        case -765289749: /*official*/ return this.official == null ? new Base[0] : this.official.toArray(new Base[this.official.size()]); // SubstanceDefinitionNameOfficialComponent
3209        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference
3210        default: return super.getProperty(hash, name, checkValid);
3211        }
3212
3213      }
3214
3215      @Override
3216      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3217        switch (hash) {
3218        case 3373707: // name
3219          this.name = TypeConvertor.castToString(value); // StringType
3220          return value;
3221        case 3575610: // type
3222          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3223          return value;
3224        case -892481550: // status
3225          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3226          return value;
3227        case -1294005119: // preferred
3228          this.preferred = TypeConvertor.castToBoolean(value); // BooleanType
3229          return value;
3230        case -1613589672: // language
3231          this.getLanguage().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3232          return value;
3233        case -1326197564: // domain
3234          this.getDomain().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3235          return value;
3236        case -507075711: // jurisdiction
3237          this.getJurisdiction().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
3238          return value;
3239        case -1742128133: // synonym
3240          this.getSynonym().add((SubstanceDefinitionNameComponent) value); // SubstanceDefinitionNameComponent
3241          return value;
3242        case -1840647503: // translation
3243          this.getTranslation().add((SubstanceDefinitionNameComponent) value); // SubstanceDefinitionNameComponent
3244          return value;
3245        case -765289749: // official
3246          this.getOfficial().add((SubstanceDefinitionNameOfficialComponent) value); // SubstanceDefinitionNameOfficialComponent
3247          return value;
3248        case -896505829: // source
3249          this.getSource().add(TypeConvertor.castToReference(value)); // Reference
3250          return value;
3251        default: return super.setProperty(hash, name, value);
3252        }
3253
3254      }
3255
3256      @Override
3257      public Base setProperty(String name, Base value) throws FHIRException {
3258        if (name.equals("name")) {
3259          this.name = TypeConvertor.castToString(value); // StringType
3260        } else if (name.equals("type")) {
3261          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3262        } else if (name.equals("status")) {
3263          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3264        } else if (name.equals("preferred")) {
3265          this.preferred = TypeConvertor.castToBoolean(value); // BooleanType
3266        } else if (name.equals("language")) {
3267          this.getLanguage().add(TypeConvertor.castToCodeableConcept(value));
3268        } else if (name.equals("domain")) {
3269          this.getDomain().add(TypeConvertor.castToCodeableConcept(value));
3270        } else if (name.equals("jurisdiction")) {
3271          this.getJurisdiction().add(TypeConvertor.castToCodeableConcept(value));
3272        } else if (name.equals("synonym")) {
3273          this.getSynonym().add((SubstanceDefinitionNameComponent) value);
3274        } else if (name.equals("translation")) {
3275          this.getTranslation().add((SubstanceDefinitionNameComponent) value);
3276        } else if (name.equals("official")) {
3277          this.getOfficial().add((SubstanceDefinitionNameOfficialComponent) value);
3278        } else if (name.equals("source")) {
3279          this.getSource().add(TypeConvertor.castToReference(value));
3280        } else
3281          return super.setProperty(name, value);
3282        return value;
3283      }
3284
3285      @Override
3286      public Base makeProperty(int hash, String name) throws FHIRException {
3287        switch (hash) {
3288        case 3373707:  return getNameElement();
3289        case 3575610:  return getType();
3290        case -892481550:  return getStatus();
3291        case -1294005119:  return getPreferredElement();
3292        case -1613589672:  return addLanguage(); 
3293        case -1326197564:  return addDomain(); 
3294        case -507075711:  return addJurisdiction(); 
3295        case -1742128133:  return addSynonym(); 
3296        case -1840647503:  return addTranslation(); 
3297        case -765289749:  return addOfficial(); 
3298        case -896505829:  return addSource(); 
3299        default: return super.makeProperty(hash, name);
3300        }
3301
3302      }
3303
3304      @Override
3305      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3306        switch (hash) {
3307        case 3373707: /*name*/ return new String[] {"string"};
3308        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3309        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
3310        case -1294005119: /*preferred*/ return new String[] {"boolean"};
3311        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
3312        case -1326197564: /*domain*/ return new String[] {"CodeableConcept"};
3313        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
3314        case -1742128133: /*synonym*/ return new String[] {"@SubstanceDefinition.name"};
3315        case -1840647503: /*translation*/ return new String[] {"@SubstanceDefinition.name"};
3316        case -765289749: /*official*/ return new String[] {};
3317        case -896505829: /*source*/ return new String[] {"Reference"};
3318        default: return super.getTypesForProperty(hash, name);
3319        }
3320
3321      }
3322
3323      @Override
3324      public Base addChild(String name) throws FHIRException {
3325        if (name.equals("name")) {
3326          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.name.name");
3327        }
3328        else if (name.equals("type")) {
3329          this.type = new CodeableConcept();
3330          return this.type;
3331        }
3332        else if (name.equals("status")) {
3333          this.status = new CodeableConcept();
3334          return this.status;
3335        }
3336        else if (name.equals("preferred")) {
3337          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.name.preferred");
3338        }
3339        else if (name.equals("language")) {
3340          return addLanguage();
3341        }
3342        else if (name.equals("domain")) {
3343          return addDomain();
3344        }
3345        else if (name.equals("jurisdiction")) {
3346          return addJurisdiction();
3347        }
3348        else if (name.equals("synonym")) {
3349          return addSynonym();
3350        }
3351        else if (name.equals("translation")) {
3352          return addTranslation();
3353        }
3354        else if (name.equals("official")) {
3355          return addOfficial();
3356        }
3357        else if (name.equals("source")) {
3358          return addSource();
3359        }
3360        else
3361          return super.addChild(name);
3362      }
3363
3364      public SubstanceDefinitionNameComponent copy() {
3365        SubstanceDefinitionNameComponent dst = new SubstanceDefinitionNameComponent();
3366        copyValues(dst);
3367        return dst;
3368      }
3369
3370      public void copyValues(SubstanceDefinitionNameComponent dst) {
3371        super.copyValues(dst);
3372        dst.name = name == null ? null : name.copy();
3373        dst.type = type == null ? null : type.copy();
3374        dst.status = status == null ? null : status.copy();
3375        dst.preferred = preferred == null ? null : preferred.copy();
3376        if (language != null) {
3377          dst.language = new ArrayList<CodeableConcept>();
3378          for (CodeableConcept i : language)
3379            dst.language.add(i.copy());
3380        };
3381        if (domain != null) {
3382          dst.domain = new ArrayList<CodeableConcept>();
3383          for (CodeableConcept i : domain)
3384            dst.domain.add(i.copy());
3385        };
3386        if (jurisdiction != null) {
3387          dst.jurisdiction = new ArrayList<CodeableConcept>();
3388          for (CodeableConcept i : jurisdiction)
3389            dst.jurisdiction.add(i.copy());
3390        };
3391        if (synonym != null) {
3392          dst.synonym = new ArrayList<SubstanceDefinitionNameComponent>();
3393          for (SubstanceDefinitionNameComponent i : synonym)
3394            dst.synonym.add(i.copy());
3395        };
3396        if (translation != null) {
3397          dst.translation = new ArrayList<SubstanceDefinitionNameComponent>();
3398          for (SubstanceDefinitionNameComponent i : translation)
3399            dst.translation.add(i.copy());
3400        };
3401        if (official != null) {
3402          dst.official = new ArrayList<SubstanceDefinitionNameOfficialComponent>();
3403          for (SubstanceDefinitionNameOfficialComponent i : official)
3404            dst.official.add(i.copy());
3405        };
3406        if (source != null) {
3407          dst.source = new ArrayList<Reference>();
3408          for (Reference i : source)
3409            dst.source.add(i.copy());
3410        };
3411      }
3412
3413      @Override
3414      public boolean equalsDeep(Base other_) {
3415        if (!super.equalsDeep(other_))
3416          return false;
3417        if (!(other_ instanceof SubstanceDefinitionNameComponent))
3418          return false;
3419        SubstanceDefinitionNameComponent o = (SubstanceDefinitionNameComponent) other_;
3420        return compareDeep(name, o.name, true) && compareDeep(type, o.type, true) && compareDeep(status, o.status, true)
3421           && compareDeep(preferred, o.preferred, true) && compareDeep(language, o.language, true) && compareDeep(domain, o.domain, true)
3422           && compareDeep(jurisdiction, o.jurisdiction, true) && compareDeep(synonym, o.synonym, true) && compareDeep(translation, o.translation, true)
3423           && compareDeep(official, o.official, true) && compareDeep(source, o.source, true);
3424      }
3425
3426      @Override
3427      public boolean equalsShallow(Base other_) {
3428        if (!super.equalsShallow(other_))
3429          return false;
3430        if (!(other_ instanceof SubstanceDefinitionNameComponent))
3431          return false;
3432        SubstanceDefinitionNameComponent o = (SubstanceDefinitionNameComponent) other_;
3433        return compareValues(name, o.name, true) && compareValues(preferred, o.preferred, true);
3434      }
3435
3436      public boolean isEmpty() {
3437        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, type, status, preferred
3438          , language, domain, jurisdiction, synonym, translation, official, source);
3439      }
3440
3441  public String fhirType() {
3442    return "SubstanceDefinition.name";
3443
3444  }
3445
3446  }
3447
3448    @Block()
3449    public static class SubstanceDefinitionNameOfficialComponent extends BackboneElement implements IBaseBackboneElement {
3450        /**
3451         * Which authority uses this official name.
3452         */
3453        @Child(name = "authority", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
3454        @Description(shortDefinition="Which authority uses this official name", formalDefinition="Which authority uses this official name." )
3455        protected CodeableConcept authority;
3456
3457        /**
3458         * The status of the official name, for example 'provisional', 'approved'.
3459         */
3460        @Child(name = "status", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
3461        @Description(shortDefinition="The status of the official name, for example 'provisional', 'approved'", formalDefinition="The status of the official name, for example 'provisional', 'approved'." )
3462        protected CodeableConcept status;
3463
3464        /**
3465         * Date of official name change.
3466         */
3467        @Child(name = "date", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
3468        @Description(shortDefinition="Date of official name change", formalDefinition="Date of official name change." )
3469        protected DateTimeType date;
3470
3471        private static final long serialVersionUID = -2040011008L;
3472
3473    /**
3474     * Constructor
3475     */
3476      public SubstanceDefinitionNameOfficialComponent() {
3477        super();
3478      }
3479
3480        /**
3481         * @return {@link #authority} (Which authority uses this official name.)
3482         */
3483        public CodeableConcept getAuthority() { 
3484          if (this.authority == null)
3485            if (Configuration.errorOnAutoCreate())
3486              throw new Error("Attempt to auto-create SubstanceDefinitionNameOfficialComponent.authority");
3487            else if (Configuration.doAutoCreate())
3488              this.authority = new CodeableConcept(); // cc
3489          return this.authority;
3490        }
3491
3492        public boolean hasAuthority() { 
3493          return this.authority != null && !this.authority.isEmpty();
3494        }
3495
3496        /**
3497         * @param value {@link #authority} (Which authority uses this official name.)
3498         */
3499        public SubstanceDefinitionNameOfficialComponent setAuthority(CodeableConcept value) { 
3500          this.authority = value;
3501          return this;
3502        }
3503
3504        /**
3505         * @return {@link #status} (The status of the official name, for example 'provisional', 'approved'.)
3506         */
3507        public CodeableConcept getStatus() { 
3508          if (this.status == null)
3509            if (Configuration.errorOnAutoCreate())
3510              throw new Error("Attempt to auto-create SubstanceDefinitionNameOfficialComponent.status");
3511            else if (Configuration.doAutoCreate())
3512              this.status = new CodeableConcept(); // cc
3513          return this.status;
3514        }
3515
3516        public boolean hasStatus() { 
3517          return this.status != null && !this.status.isEmpty();
3518        }
3519
3520        /**
3521         * @param value {@link #status} (The status of the official name, for example 'provisional', 'approved'.)
3522         */
3523        public SubstanceDefinitionNameOfficialComponent setStatus(CodeableConcept value) { 
3524          this.status = value;
3525          return this;
3526        }
3527
3528        /**
3529         * @return {@link #date} (Date of official name change.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3530         */
3531        public DateTimeType getDateElement() { 
3532          if (this.date == null)
3533            if (Configuration.errorOnAutoCreate())
3534              throw new Error("Attempt to auto-create SubstanceDefinitionNameOfficialComponent.date");
3535            else if (Configuration.doAutoCreate())
3536              this.date = new DateTimeType(); // bb
3537          return this.date;
3538        }
3539
3540        public boolean hasDateElement() { 
3541          return this.date != null && !this.date.isEmpty();
3542        }
3543
3544        public boolean hasDate() { 
3545          return this.date != null && !this.date.isEmpty();
3546        }
3547
3548        /**
3549         * @param value {@link #date} (Date of official name change.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3550         */
3551        public SubstanceDefinitionNameOfficialComponent setDateElement(DateTimeType value) { 
3552          this.date = value;
3553          return this;
3554        }
3555
3556        /**
3557         * @return Date of official name change.
3558         */
3559        public Date getDate() { 
3560          return this.date == null ? null : this.date.getValue();
3561        }
3562
3563        /**
3564         * @param value Date of official name change.
3565         */
3566        public SubstanceDefinitionNameOfficialComponent setDate(Date value) { 
3567          if (value == null)
3568            this.date = null;
3569          else {
3570            if (this.date == null)
3571              this.date = new DateTimeType();
3572            this.date.setValue(value);
3573          }
3574          return this;
3575        }
3576
3577        protected void listChildren(List<Property> children) {
3578          super.listChildren(children);
3579          children.add(new Property("authority", "CodeableConcept", "Which authority uses this official name.", 0, 1, authority));
3580          children.add(new Property("status", "CodeableConcept", "The status of the official name, for example 'provisional', 'approved'.", 0, 1, status));
3581          children.add(new Property("date", "dateTime", "Date of official name change.", 0, 1, date));
3582        }
3583
3584        @Override
3585        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3586          switch (_hash) {
3587          case 1475610435: /*authority*/  return new Property("authority", "CodeableConcept", "Which authority uses this official name.", 0, 1, authority);
3588          case -892481550: /*status*/  return new Property("status", "CodeableConcept", "The status of the official name, for example 'provisional', 'approved'.", 0, 1, status);
3589          case 3076014: /*date*/  return new Property("date", "dateTime", "Date of official name change.", 0, 1, date);
3590          default: return super.getNamedProperty(_hash, _name, _checkValid);
3591          }
3592
3593        }
3594
3595      @Override
3596      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3597        switch (hash) {
3598        case 1475610435: /*authority*/ return this.authority == null ? new Base[0] : new Base[] {this.authority}; // CodeableConcept
3599        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
3600        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
3601        default: return super.getProperty(hash, name, checkValid);
3602        }
3603
3604      }
3605
3606      @Override
3607      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3608        switch (hash) {
3609        case 1475610435: // authority
3610          this.authority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3611          return value;
3612        case -892481550: // status
3613          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3614          return value;
3615        case 3076014: // date
3616          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
3617          return value;
3618        default: return super.setProperty(hash, name, value);
3619        }
3620
3621      }
3622
3623      @Override
3624      public Base setProperty(String name, Base value) throws FHIRException {
3625        if (name.equals("authority")) {
3626          this.authority = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3627        } else if (name.equals("status")) {
3628          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
3629        } else if (name.equals("date")) {
3630          this.date = TypeConvertor.castToDateTime(value); // DateTimeType
3631        } else
3632          return super.setProperty(name, value);
3633        return value;
3634      }
3635
3636      @Override
3637      public Base makeProperty(int hash, String name) throws FHIRException {
3638        switch (hash) {
3639        case 1475610435:  return getAuthority();
3640        case -892481550:  return getStatus();
3641        case 3076014:  return getDateElement();
3642        default: return super.makeProperty(hash, name);
3643        }
3644
3645      }
3646
3647      @Override
3648      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3649        switch (hash) {
3650        case 1475610435: /*authority*/ return new String[] {"CodeableConcept"};
3651        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
3652        case 3076014: /*date*/ return new String[] {"dateTime"};
3653        default: return super.getTypesForProperty(hash, name);
3654        }
3655
3656      }
3657
3658      @Override
3659      public Base addChild(String name) throws FHIRException {
3660        if (name.equals("authority")) {
3661          this.authority = new CodeableConcept();
3662          return this.authority;
3663        }
3664        else if (name.equals("status")) {
3665          this.status = new CodeableConcept();
3666          return this.status;
3667        }
3668        else if (name.equals("date")) {
3669          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.name.official.date");
3670        }
3671        else
3672          return super.addChild(name);
3673      }
3674
3675      public SubstanceDefinitionNameOfficialComponent copy() {
3676        SubstanceDefinitionNameOfficialComponent dst = new SubstanceDefinitionNameOfficialComponent();
3677        copyValues(dst);
3678        return dst;
3679      }
3680
3681      public void copyValues(SubstanceDefinitionNameOfficialComponent dst) {
3682        super.copyValues(dst);
3683        dst.authority = authority == null ? null : authority.copy();
3684        dst.status = status == null ? null : status.copy();
3685        dst.date = date == null ? null : date.copy();
3686      }
3687
3688      @Override
3689      public boolean equalsDeep(Base other_) {
3690        if (!super.equalsDeep(other_))
3691          return false;
3692        if (!(other_ instanceof SubstanceDefinitionNameOfficialComponent))
3693          return false;
3694        SubstanceDefinitionNameOfficialComponent o = (SubstanceDefinitionNameOfficialComponent) other_;
3695        return compareDeep(authority, o.authority, true) && compareDeep(status, o.status, true) && compareDeep(date, o.date, true)
3696          ;
3697      }
3698
3699      @Override
3700      public boolean equalsShallow(Base other_) {
3701        if (!super.equalsShallow(other_))
3702          return false;
3703        if (!(other_ instanceof SubstanceDefinitionNameOfficialComponent))
3704          return false;
3705        SubstanceDefinitionNameOfficialComponent o = (SubstanceDefinitionNameOfficialComponent) other_;
3706        return compareValues(date, o.date, true);
3707      }
3708
3709      public boolean isEmpty() {
3710        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(authority, status, date
3711          );
3712      }
3713
3714  public String fhirType() {
3715    return "SubstanceDefinition.name.official";
3716
3717  }
3718
3719  }
3720
3721    @Block()
3722    public static class SubstanceDefinitionRelationshipComponent extends BackboneElement implements IBaseBackboneElement {
3723        /**
3724         * A pointer to another substance, as a resource or just a representational code.
3725         */
3726        @Child(name = "substanceDefinition", type = {SubstanceDefinition.class, CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
3727        @Description(shortDefinition="A pointer to another substance, as a resource or just a representational code", formalDefinition="A pointer to another substance, as a resource or just a representational code." )
3728        protected DataType substanceDefinition;
3729
3730        /**
3731         * For example "salt to parent", "active moiety", "starting material", "polymorph", "impurity of".
3732         */
3733        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=1, max=1, modifier=false, summary=true)
3734        @Description(shortDefinition="For example \"salt to parent\", \"active moiety\", \"starting material\", \"polymorph\", \"impurity of\"", formalDefinition="For example \"salt to parent\", \"active moiety\", \"starting material\", \"polymorph\", \"impurity of\"." )
3735        protected CodeableConcept type;
3736
3737        /**
3738         * For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships.
3739         */
3740        @Child(name = "isDefining", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
3741        @Description(shortDefinition="For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships", formalDefinition="For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships." )
3742        protected BooleanType isDefining;
3743
3744        /**
3745         * A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.
3746         */
3747        @Child(name = "amount", type = {Quantity.class, Ratio.class, StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3748        @Description(shortDefinition="A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other", formalDefinition="A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other." )
3749        protected DataType amount;
3750
3751        /**
3752         * For use when the numeric has an uncertain range.
3753         */
3754        @Child(name = "amountRatioHighLimit", type = {Ratio.class}, order=5, min=0, max=1, modifier=false, summary=true)
3755        @Description(shortDefinition="For use when the numeric has an uncertain range", formalDefinition="For use when the numeric has an uncertain range." )
3756        protected Ratio amountRatioHighLimit;
3757
3758        /**
3759         * An operator for the amount, for example "average", "approximately", "less than".
3760         */
3761        @Child(name = "amountType", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=true)
3762        @Description(shortDefinition="An operator for the amount, for example \"average\", \"approximately\", \"less than\"", formalDefinition="An operator for the amount, for example \"average\", \"approximately\", \"less than\"." )
3763        protected CodeableConcept amountType;
3764
3765        /**
3766         * Supporting literature.
3767         */
3768        @Child(name = "source", type = {DocumentReference.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3769        @Description(shortDefinition="Supporting literature", formalDefinition="Supporting literature." )
3770        protected List<Reference> source;
3771
3772        private static final long serialVersionUID = 447426308L;
3773
3774    /**
3775     * Constructor
3776     */
3777      public SubstanceDefinitionRelationshipComponent() {
3778        super();
3779      }
3780
3781    /**
3782     * Constructor
3783     */
3784      public SubstanceDefinitionRelationshipComponent(CodeableConcept type) {
3785        super();
3786        this.setType(type);
3787      }
3788
3789        /**
3790         * @return {@link #substanceDefinition} (A pointer to another substance, as a resource or just a representational code.)
3791         */
3792        public DataType getSubstanceDefinition() { 
3793          return this.substanceDefinition;
3794        }
3795
3796        /**
3797         * @return {@link #substanceDefinition} (A pointer to another substance, as a resource or just a representational code.)
3798         */
3799        public Reference getSubstanceDefinitionReference() throws FHIRException { 
3800          if (this.substanceDefinition == null)
3801            this.substanceDefinition = new Reference();
3802          if (!(this.substanceDefinition instanceof Reference))
3803            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.substanceDefinition.getClass().getName()+" was encountered");
3804          return (Reference) this.substanceDefinition;
3805        }
3806
3807        public boolean hasSubstanceDefinitionReference() { 
3808          return this != null && this.substanceDefinition instanceof Reference;
3809        }
3810
3811        /**
3812         * @return {@link #substanceDefinition} (A pointer to another substance, as a resource or just a representational code.)
3813         */
3814        public CodeableConcept getSubstanceDefinitionCodeableConcept() throws FHIRException { 
3815          if (this.substanceDefinition == null)
3816            this.substanceDefinition = new CodeableConcept();
3817          if (!(this.substanceDefinition instanceof CodeableConcept))
3818            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.substanceDefinition.getClass().getName()+" was encountered");
3819          return (CodeableConcept) this.substanceDefinition;
3820        }
3821
3822        public boolean hasSubstanceDefinitionCodeableConcept() { 
3823          return this != null && this.substanceDefinition instanceof CodeableConcept;
3824        }
3825
3826        public boolean hasSubstanceDefinition() { 
3827          return this.substanceDefinition != null && !this.substanceDefinition.isEmpty();
3828        }
3829
3830        /**
3831         * @param value {@link #substanceDefinition} (A pointer to another substance, as a resource or just a representational code.)
3832         */
3833        public SubstanceDefinitionRelationshipComponent setSubstanceDefinition(DataType value) { 
3834          if (value != null && !(value instanceof Reference || value instanceof CodeableConcept))
3835            throw new Error("Not the right type for SubstanceDefinition.relationship.substanceDefinition[x]: "+value.fhirType());
3836          this.substanceDefinition = value;
3837          return this;
3838        }
3839
3840        /**
3841         * @return {@link #type} (For example "salt to parent", "active moiety", "starting material", "polymorph", "impurity of".)
3842         */
3843        public CodeableConcept getType() { 
3844          if (this.type == null)
3845            if (Configuration.errorOnAutoCreate())
3846              throw new Error("Attempt to auto-create SubstanceDefinitionRelationshipComponent.type");
3847            else if (Configuration.doAutoCreate())
3848              this.type = new CodeableConcept(); // cc
3849          return this.type;
3850        }
3851
3852        public boolean hasType() { 
3853          return this.type != null && !this.type.isEmpty();
3854        }
3855
3856        /**
3857         * @param value {@link #type} (For example "salt to parent", "active moiety", "starting material", "polymorph", "impurity of".)
3858         */
3859        public SubstanceDefinitionRelationshipComponent setType(CodeableConcept value) { 
3860          this.type = value;
3861          return this;
3862        }
3863
3864        /**
3865         * @return {@link #isDefining} (For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships.). This is the underlying object with id, value and extensions. The accessor "getIsDefining" gives direct access to the value
3866         */
3867        public BooleanType getIsDefiningElement() { 
3868          if (this.isDefining == null)
3869            if (Configuration.errorOnAutoCreate())
3870              throw new Error("Attempt to auto-create SubstanceDefinitionRelationshipComponent.isDefining");
3871            else if (Configuration.doAutoCreate())
3872              this.isDefining = new BooleanType(); // bb
3873          return this.isDefining;
3874        }
3875
3876        public boolean hasIsDefiningElement() { 
3877          return this.isDefining != null && !this.isDefining.isEmpty();
3878        }
3879
3880        public boolean hasIsDefining() { 
3881          return this.isDefining != null && !this.isDefining.isEmpty();
3882        }
3883
3884        /**
3885         * @param value {@link #isDefining} (For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships.). This is the underlying object with id, value and extensions. The accessor "getIsDefining" gives direct access to the value
3886         */
3887        public SubstanceDefinitionRelationshipComponent setIsDefiningElement(BooleanType value) { 
3888          this.isDefining = value;
3889          return this;
3890        }
3891
3892        /**
3893         * @return For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships.
3894         */
3895        public boolean getIsDefining() { 
3896          return this.isDefining == null || this.isDefining.isEmpty() ? false : this.isDefining.getValue();
3897        }
3898
3899        /**
3900         * @param value For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships.
3901         */
3902        public SubstanceDefinitionRelationshipComponent setIsDefining(boolean value) { 
3903            if (this.isDefining == null)
3904              this.isDefining = new BooleanType();
3905            this.isDefining.setValue(value);
3906          return this;
3907        }
3908
3909        /**
3910         * @return {@link #amount} (A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.)
3911         */
3912        public DataType getAmount() { 
3913          return this.amount;
3914        }
3915
3916        /**
3917         * @return {@link #amount} (A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.)
3918         */
3919        public Quantity getAmountQuantity() throws FHIRException { 
3920          if (this.amount == null)
3921            this.amount = new Quantity();
3922          if (!(this.amount instanceof Quantity))
3923            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.amount.getClass().getName()+" was encountered");
3924          return (Quantity) this.amount;
3925        }
3926
3927        public boolean hasAmountQuantity() { 
3928          return this != null && this.amount instanceof Quantity;
3929        }
3930
3931        /**
3932         * @return {@link #amount} (A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.)
3933         */
3934        public Ratio getAmountRatio() throws FHIRException { 
3935          if (this.amount == null)
3936            this.amount = new Ratio();
3937          if (!(this.amount instanceof Ratio))
3938            throw new FHIRException("Type mismatch: the type Ratio was expected, but "+this.amount.getClass().getName()+" was encountered");
3939          return (Ratio) this.amount;
3940        }
3941
3942        public boolean hasAmountRatio() { 
3943          return this != null && this.amount instanceof Ratio;
3944        }
3945
3946        /**
3947         * @return {@link #amount} (A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.)
3948         */
3949        public StringType getAmountStringType() throws FHIRException { 
3950          if (this.amount == null)
3951            this.amount = new StringType();
3952          if (!(this.amount instanceof StringType))
3953            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.amount.getClass().getName()+" was encountered");
3954          return (StringType) this.amount;
3955        }
3956
3957        public boolean hasAmountStringType() { 
3958          return this != null && this.amount instanceof StringType;
3959        }
3960
3961        public boolean hasAmount() { 
3962          return this.amount != null && !this.amount.isEmpty();
3963        }
3964
3965        /**
3966         * @param value {@link #amount} (A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.)
3967         */
3968        public SubstanceDefinitionRelationshipComponent setAmount(DataType value) { 
3969          if (value != null && !(value instanceof Quantity || value instanceof Ratio || value instanceof StringType))
3970            throw new Error("Not the right type for SubstanceDefinition.relationship.amount[x]: "+value.fhirType());
3971          this.amount = value;
3972          return this;
3973        }
3974
3975        /**
3976         * @return {@link #amountRatioHighLimit} (For use when the numeric has an uncertain range.)
3977         */
3978        public Ratio getAmountRatioHighLimit() { 
3979          if (this.amountRatioHighLimit == null)
3980            if (Configuration.errorOnAutoCreate())
3981              throw new Error("Attempt to auto-create SubstanceDefinitionRelationshipComponent.amountRatioHighLimit");
3982            else if (Configuration.doAutoCreate())
3983              this.amountRatioHighLimit = new Ratio(); // cc
3984          return this.amountRatioHighLimit;
3985        }
3986
3987        public boolean hasAmountRatioHighLimit() { 
3988          return this.amountRatioHighLimit != null && !this.amountRatioHighLimit.isEmpty();
3989        }
3990
3991        /**
3992         * @param value {@link #amountRatioHighLimit} (For use when the numeric has an uncertain range.)
3993         */
3994        public SubstanceDefinitionRelationshipComponent setAmountRatioHighLimit(Ratio value) { 
3995          this.amountRatioHighLimit = value;
3996          return this;
3997        }
3998
3999        /**
4000         * @return {@link #amountType} (An operator for the amount, for example "average", "approximately", "less than".)
4001         */
4002        public CodeableConcept getAmountType() { 
4003          if (this.amountType == null)
4004            if (Configuration.errorOnAutoCreate())
4005              throw new Error("Attempt to auto-create SubstanceDefinitionRelationshipComponent.amountType");
4006            else if (Configuration.doAutoCreate())
4007              this.amountType = new CodeableConcept(); // cc
4008          return this.amountType;
4009        }
4010
4011        public boolean hasAmountType() { 
4012          return this.amountType != null && !this.amountType.isEmpty();
4013        }
4014
4015        /**
4016         * @param value {@link #amountType} (An operator for the amount, for example "average", "approximately", "less than".)
4017         */
4018        public SubstanceDefinitionRelationshipComponent setAmountType(CodeableConcept value) { 
4019          this.amountType = value;
4020          return this;
4021        }
4022
4023        /**
4024         * @return {@link #source} (Supporting literature.)
4025         */
4026        public List<Reference> getSource() { 
4027          if (this.source == null)
4028            this.source = new ArrayList<Reference>();
4029          return this.source;
4030        }
4031
4032        /**
4033         * @return Returns a reference to <code>this</code> for easy method chaining
4034         */
4035        public SubstanceDefinitionRelationshipComponent setSource(List<Reference> theSource) { 
4036          this.source = theSource;
4037          return this;
4038        }
4039
4040        public boolean hasSource() { 
4041          if (this.source == null)
4042            return false;
4043          for (Reference item : this.source)
4044            if (!item.isEmpty())
4045              return true;
4046          return false;
4047        }
4048
4049        public Reference addSource() { //3
4050          Reference t = new Reference();
4051          if (this.source == null)
4052            this.source = new ArrayList<Reference>();
4053          this.source.add(t);
4054          return t;
4055        }
4056
4057        public SubstanceDefinitionRelationshipComponent addSource(Reference t) { //3
4058          if (t == null)
4059            return this;
4060          if (this.source == null)
4061            this.source = new ArrayList<Reference>();
4062          this.source.add(t);
4063          return this;
4064        }
4065
4066        /**
4067         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist {3}
4068         */
4069        public Reference getSourceFirstRep() { 
4070          if (getSource().isEmpty()) {
4071            addSource();
4072          }
4073          return getSource().get(0);
4074        }
4075
4076        protected void listChildren(List<Property> children) {
4077          super.listChildren(children);
4078          children.add(new Property("substanceDefinition[x]", "Reference(SubstanceDefinition)|CodeableConcept", "A pointer to another substance, as a resource or just a representational code.", 0, 1, substanceDefinition));
4079          children.add(new Property("type", "CodeableConcept", "For example \"salt to parent\", \"active moiety\", \"starting material\", \"polymorph\", \"impurity of\".", 0, 1, type));
4080          children.add(new Property("isDefining", "boolean", "For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships.", 0, 1, isDefining));
4081          children.add(new Property("amount[x]", "Quantity|Ratio|string", "A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.", 0, 1, amount));
4082          children.add(new Property("amountRatioHighLimit", "Ratio", "For use when the numeric has an uncertain range.", 0, 1, amountRatioHighLimit));
4083          children.add(new Property("amountType", "CodeableConcept", "An operator for the amount, for example \"average\", \"approximately\", \"less than\".", 0, 1, amountType));
4084          children.add(new Property("source", "Reference(DocumentReference)", "Supporting literature.", 0, java.lang.Integer.MAX_VALUE, source));
4085        }
4086
4087        @Override
4088        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4089          switch (_hash) {
4090          case -1767011651: /*substanceDefinition[x]*/  return new Property("substanceDefinition[x]", "Reference(SubstanceDefinition)|CodeableConcept", "A pointer to another substance, as a resource or just a representational code.", 0, 1, substanceDefinition);
4091          case 718195427: /*substanceDefinition*/  return new Property("substanceDefinition[x]", "Reference(SubstanceDefinition)|CodeableConcept", "A pointer to another substance, as a resource or just a representational code.", 0, 1, substanceDefinition);
4092          case -308206680: /*substanceDefinitionReference*/  return new Property("substanceDefinition[x]", "Reference(SubstanceDefinition)", "A pointer to another substance, as a resource or just a representational code.", 0, 1, substanceDefinition);
4093          case -132490690: /*substanceDefinitionCodeableConcept*/  return new Property("substanceDefinition[x]", "CodeableConcept", "A pointer to another substance, as a resource or just a representational code.", 0, 1, substanceDefinition);
4094          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "For example \"salt to parent\", \"active moiety\", \"starting material\", \"polymorph\", \"impurity of\".", 0, 1, type);
4095          case -141812990: /*isDefining*/  return new Property("isDefining", "boolean", "For example where an enzyme strongly bonds with a particular substance, this is a defining relationship for that enzyme, out of several possible substance relationships.", 0, 1, isDefining);
4096          case 646780200: /*amount[x]*/  return new Property("amount[x]", "Quantity|Ratio|string", "A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.", 0, 1, amount);
4097          case -1413853096: /*amount*/  return new Property("amount[x]", "Quantity|Ratio|string", "A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.", 0, 1, amount);
4098          case 1664303363: /*amountQuantity*/  return new Property("amount[x]", "Quantity", "A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.", 0, 1, amount);
4099          case -1223457133: /*amountRatio*/  return new Property("amount[x]", "Ratio", "A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.", 0, 1, amount);
4100          case 773651081: /*amountString*/  return new Property("amount[x]", "string", "A numeric factor for the relationship, for instance to express that the salt of a substance has some percentage of the active substance in relation to some other.", 0, 1, amount);
4101          case -1832648218: /*amountRatioHighLimit*/  return new Property("amountRatioHighLimit", "Ratio", "For use when the numeric has an uncertain range.", 0, 1, amountRatioHighLimit);
4102          case -1424857166: /*amountType*/  return new Property("amountType", "CodeableConcept", "An operator for the amount, for example \"average\", \"approximately\", \"less than\".", 0, 1, amountType);
4103          case -896505829: /*source*/  return new Property("source", "Reference(DocumentReference)", "Supporting literature.", 0, java.lang.Integer.MAX_VALUE, source);
4104          default: return super.getNamedProperty(_hash, _name, _checkValid);
4105          }
4106
4107        }
4108
4109      @Override
4110      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4111        switch (hash) {
4112        case 718195427: /*substanceDefinition*/ return this.substanceDefinition == null ? new Base[0] : new Base[] {this.substanceDefinition}; // DataType
4113        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
4114        case -141812990: /*isDefining*/ return this.isDefining == null ? new Base[0] : new Base[] {this.isDefining}; // BooleanType
4115        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // DataType
4116        case -1832648218: /*amountRatioHighLimit*/ return this.amountRatioHighLimit == null ? new Base[0] : new Base[] {this.amountRatioHighLimit}; // Ratio
4117        case -1424857166: /*amountType*/ return this.amountType == null ? new Base[0] : new Base[] {this.amountType}; // CodeableConcept
4118        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference
4119        default: return super.getProperty(hash, name, checkValid);
4120        }
4121
4122      }
4123
4124      @Override
4125      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4126        switch (hash) {
4127        case 718195427: // substanceDefinition
4128          this.substanceDefinition = TypeConvertor.castToType(value); // DataType
4129          return value;
4130        case 3575610: // type
4131          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4132          return value;
4133        case -141812990: // isDefining
4134          this.isDefining = TypeConvertor.castToBoolean(value); // BooleanType
4135          return value;
4136        case -1413853096: // amount
4137          this.amount = TypeConvertor.castToType(value); // DataType
4138          return value;
4139        case -1832648218: // amountRatioHighLimit
4140          this.amountRatioHighLimit = TypeConvertor.castToRatio(value); // Ratio
4141          return value;
4142        case -1424857166: // amountType
4143          this.amountType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4144          return value;
4145        case -896505829: // source
4146          this.getSource().add(TypeConvertor.castToReference(value)); // Reference
4147          return value;
4148        default: return super.setProperty(hash, name, value);
4149        }
4150
4151      }
4152
4153      @Override
4154      public Base setProperty(String name, Base value) throws FHIRException {
4155        if (name.equals("substanceDefinition[x]")) {
4156          this.substanceDefinition = TypeConvertor.castToType(value); // DataType
4157        } else if (name.equals("type")) {
4158          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4159        } else if (name.equals("isDefining")) {
4160          this.isDefining = TypeConvertor.castToBoolean(value); // BooleanType
4161        } else if (name.equals("amount[x]")) {
4162          this.amount = TypeConvertor.castToType(value); // DataType
4163        } else if (name.equals("amountRatioHighLimit")) {
4164          this.amountRatioHighLimit = TypeConvertor.castToRatio(value); // Ratio
4165        } else if (name.equals("amountType")) {
4166          this.amountType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4167        } else if (name.equals("source")) {
4168          this.getSource().add(TypeConvertor.castToReference(value));
4169        } else
4170          return super.setProperty(name, value);
4171        return value;
4172      }
4173
4174      @Override
4175      public Base makeProperty(int hash, String name) throws FHIRException {
4176        switch (hash) {
4177        case -1767011651:  return getSubstanceDefinition();
4178        case 718195427:  return getSubstanceDefinition();
4179        case 3575610:  return getType();
4180        case -141812990:  return getIsDefiningElement();
4181        case 646780200:  return getAmount();
4182        case -1413853096:  return getAmount();
4183        case -1832648218:  return getAmountRatioHighLimit();
4184        case -1424857166:  return getAmountType();
4185        case -896505829:  return addSource(); 
4186        default: return super.makeProperty(hash, name);
4187        }
4188
4189      }
4190
4191      @Override
4192      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4193        switch (hash) {
4194        case 718195427: /*substanceDefinition*/ return new String[] {"Reference", "CodeableConcept"};
4195        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
4196        case -141812990: /*isDefining*/ return new String[] {"boolean"};
4197        case -1413853096: /*amount*/ return new String[] {"Quantity", "Ratio", "string"};
4198        case -1832648218: /*amountRatioHighLimit*/ return new String[] {"Ratio"};
4199        case -1424857166: /*amountType*/ return new String[] {"CodeableConcept"};
4200        case -896505829: /*source*/ return new String[] {"Reference"};
4201        default: return super.getTypesForProperty(hash, name);
4202        }
4203
4204      }
4205
4206      @Override
4207      public Base addChild(String name) throws FHIRException {
4208        if (name.equals("substanceDefinitionReference")) {
4209          this.substanceDefinition = new Reference();
4210          return this.substanceDefinition;
4211        }
4212        else if (name.equals("substanceDefinitionCodeableConcept")) {
4213          this.substanceDefinition = new CodeableConcept();
4214          return this.substanceDefinition;
4215        }
4216        else if (name.equals("type")) {
4217          this.type = new CodeableConcept();
4218          return this.type;
4219        }
4220        else if (name.equals("isDefining")) {
4221          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.relationship.isDefining");
4222        }
4223        else if (name.equals("amountQuantity")) {
4224          this.amount = new Quantity();
4225          return this.amount;
4226        }
4227        else if (name.equals("amountRatio")) {
4228          this.amount = new Ratio();
4229          return this.amount;
4230        }
4231        else if (name.equals("amountString")) {
4232          this.amount = new StringType();
4233          return this.amount;
4234        }
4235        else if (name.equals("amountRatioHighLimit")) {
4236          this.amountRatioHighLimit = new Ratio();
4237          return this.amountRatioHighLimit;
4238        }
4239        else if (name.equals("amountType")) {
4240          this.amountType = new CodeableConcept();
4241          return this.amountType;
4242        }
4243        else if (name.equals("source")) {
4244          return addSource();
4245        }
4246        else
4247          return super.addChild(name);
4248      }
4249
4250      public SubstanceDefinitionRelationshipComponent copy() {
4251        SubstanceDefinitionRelationshipComponent dst = new SubstanceDefinitionRelationshipComponent();
4252        copyValues(dst);
4253        return dst;
4254      }
4255
4256      public void copyValues(SubstanceDefinitionRelationshipComponent dst) {
4257        super.copyValues(dst);
4258        dst.substanceDefinition = substanceDefinition == null ? null : substanceDefinition.copy();
4259        dst.type = type == null ? null : type.copy();
4260        dst.isDefining = isDefining == null ? null : isDefining.copy();
4261        dst.amount = amount == null ? null : amount.copy();
4262        dst.amountRatioHighLimit = amountRatioHighLimit == null ? null : amountRatioHighLimit.copy();
4263        dst.amountType = amountType == null ? null : amountType.copy();
4264        if (source != null) {
4265          dst.source = new ArrayList<Reference>();
4266          for (Reference i : source)
4267            dst.source.add(i.copy());
4268        };
4269      }
4270
4271      @Override
4272      public boolean equalsDeep(Base other_) {
4273        if (!super.equalsDeep(other_))
4274          return false;
4275        if (!(other_ instanceof SubstanceDefinitionRelationshipComponent))
4276          return false;
4277        SubstanceDefinitionRelationshipComponent o = (SubstanceDefinitionRelationshipComponent) other_;
4278        return compareDeep(substanceDefinition, o.substanceDefinition, true) && compareDeep(type, o.type, true)
4279           && compareDeep(isDefining, o.isDefining, true) && compareDeep(amount, o.amount, true) && compareDeep(amountRatioHighLimit, o.amountRatioHighLimit, true)
4280           && compareDeep(amountType, o.amountType, true) && compareDeep(source, o.source, true);
4281      }
4282
4283      @Override
4284      public boolean equalsShallow(Base other_) {
4285        if (!super.equalsShallow(other_))
4286          return false;
4287        if (!(other_ instanceof SubstanceDefinitionRelationshipComponent))
4288          return false;
4289        SubstanceDefinitionRelationshipComponent o = (SubstanceDefinitionRelationshipComponent) other_;
4290        return compareValues(isDefining, o.isDefining, true);
4291      }
4292
4293      public boolean isEmpty() {
4294        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(substanceDefinition, type
4295          , isDefining, amount, amountRatioHighLimit, amountType, source);
4296      }
4297
4298  public String fhirType() {
4299    return "SubstanceDefinition.relationship";
4300
4301  }
4302
4303  }
4304
4305    @Block()
4306    public static class SubstanceDefinitionSourceMaterialComponent extends BackboneElement implements IBaseBackboneElement {
4307        /**
4308         * A classification that provides the origin of the raw material. Example: cat hair would be an Animal source type.
4309         */
4310        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
4311        @Description(shortDefinition="A classification that provides the origin of the raw material. Example: cat hair would be an Animal source type", formalDefinition="A classification that provides the origin of the raw material. Example: cat hair would be an Animal source type." )
4312        protected CodeableConcept type;
4313
4314        /**
4315         * The genus of an organism, typically referring to the Latin epithet of the genus element of the plant/animal scientific name.
4316         */
4317        @Child(name = "genus", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
4318        @Description(shortDefinition="The genus of an organism, typically referring to the Latin epithet of the genus element of the plant/animal scientific name", formalDefinition="The genus of an organism, typically referring to the Latin epithet of the genus element of the plant/animal scientific name." )
4319        protected CodeableConcept genus;
4320
4321        /**
4322         * The species of an organism, typically referring to the Latin epithet of the species of the plant/animal.
4323         */
4324        @Child(name = "species", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
4325        @Description(shortDefinition="The species of an organism, typically referring to the Latin epithet of the species of the plant/animal", formalDefinition="The species of an organism, typically referring to the Latin epithet of the species of the plant/animal." )
4326        protected CodeableConcept species;
4327
4328        /**
4329         * An anatomical origin of the source material within an organism.
4330         */
4331        @Child(name = "part", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
4332        @Description(shortDefinition="An anatomical origin of the source material within an organism", formalDefinition="An anatomical origin of the source material within an organism." )
4333        protected CodeableConcept part;
4334
4335        /**
4336         * The country or countries where the material is harvested.
4337         */
4338        @Child(name = "countryOfOrigin", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4339        @Description(shortDefinition="The country or countries where the material is harvested", formalDefinition="The country or countries where the material is harvested." )
4340        protected List<CodeableConcept> countryOfOrigin;
4341
4342        private static final long serialVersionUID = 569352795L;
4343
4344    /**
4345     * Constructor
4346     */
4347      public SubstanceDefinitionSourceMaterialComponent() {
4348        super();
4349      }
4350
4351        /**
4352         * @return {@link #type} (A classification that provides the origin of the raw material. Example: cat hair would be an Animal source type.)
4353         */
4354        public CodeableConcept getType() { 
4355          if (this.type == null)
4356            if (Configuration.errorOnAutoCreate())
4357              throw new Error("Attempt to auto-create SubstanceDefinitionSourceMaterialComponent.type");
4358            else if (Configuration.doAutoCreate())
4359              this.type = new CodeableConcept(); // cc
4360          return this.type;
4361        }
4362
4363        public boolean hasType() { 
4364          return this.type != null && !this.type.isEmpty();
4365        }
4366
4367        /**
4368         * @param value {@link #type} (A classification that provides the origin of the raw material. Example: cat hair would be an Animal source type.)
4369         */
4370        public SubstanceDefinitionSourceMaterialComponent setType(CodeableConcept value) { 
4371          this.type = value;
4372          return this;
4373        }
4374
4375        /**
4376         * @return {@link #genus} (The genus of an organism, typically referring to the Latin epithet of the genus element of the plant/animal scientific name.)
4377         */
4378        public CodeableConcept getGenus() { 
4379          if (this.genus == null)
4380            if (Configuration.errorOnAutoCreate())
4381              throw new Error("Attempt to auto-create SubstanceDefinitionSourceMaterialComponent.genus");
4382            else if (Configuration.doAutoCreate())
4383              this.genus = new CodeableConcept(); // cc
4384          return this.genus;
4385        }
4386
4387        public boolean hasGenus() { 
4388          return this.genus != null && !this.genus.isEmpty();
4389        }
4390
4391        /**
4392         * @param value {@link #genus} (The genus of an organism, typically referring to the Latin epithet of the genus element of the plant/animal scientific name.)
4393         */
4394        public SubstanceDefinitionSourceMaterialComponent setGenus(CodeableConcept value) { 
4395          this.genus = value;
4396          return this;
4397        }
4398
4399        /**
4400         * @return {@link #species} (The species of an organism, typically referring to the Latin epithet of the species of the plant/animal.)
4401         */
4402        public CodeableConcept getSpecies() { 
4403          if (this.species == null)
4404            if (Configuration.errorOnAutoCreate())
4405              throw new Error("Attempt to auto-create SubstanceDefinitionSourceMaterialComponent.species");
4406            else if (Configuration.doAutoCreate())
4407              this.species = new CodeableConcept(); // cc
4408          return this.species;
4409        }
4410
4411        public boolean hasSpecies() { 
4412          return this.species != null && !this.species.isEmpty();
4413        }
4414
4415        /**
4416         * @param value {@link #species} (The species of an organism, typically referring to the Latin epithet of the species of the plant/animal.)
4417         */
4418        public SubstanceDefinitionSourceMaterialComponent setSpecies(CodeableConcept value) { 
4419          this.species = value;
4420          return this;
4421        }
4422
4423        /**
4424         * @return {@link #part} (An anatomical origin of the source material within an organism.)
4425         */
4426        public CodeableConcept getPart() { 
4427          if (this.part == null)
4428            if (Configuration.errorOnAutoCreate())
4429              throw new Error("Attempt to auto-create SubstanceDefinitionSourceMaterialComponent.part");
4430            else if (Configuration.doAutoCreate())
4431              this.part = new CodeableConcept(); // cc
4432          return this.part;
4433        }
4434
4435        public boolean hasPart() { 
4436          return this.part != null && !this.part.isEmpty();
4437        }
4438
4439        /**
4440         * @param value {@link #part} (An anatomical origin of the source material within an organism.)
4441         */
4442        public SubstanceDefinitionSourceMaterialComponent setPart(CodeableConcept value) { 
4443          this.part = value;
4444          return this;
4445        }
4446
4447        /**
4448         * @return {@link #countryOfOrigin} (The country or countries where the material is harvested.)
4449         */
4450        public List<CodeableConcept> getCountryOfOrigin() { 
4451          if (this.countryOfOrigin == null)
4452            this.countryOfOrigin = new ArrayList<CodeableConcept>();
4453          return this.countryOfOrigin;
4454        }
4455
4456        /**
4457         * @return Returns a reference to <code>this</code> for easy method chaining
4458         */
4459        public SubstanceDefinitionSourceMaterialComponent setCountryOfOrigin(List<CodeableConcept> theCountryOfOrigin) { 
4460          this.countryOfOrigin = theCountryOfOrigin;
4461          return this;
4462        }
4463
4464        public boolean hasCountryOfOrigin() { 
4465          if (this.countryOfOrigin == null)
4466            return false;
4467          for (CodeableConcept item : this.countryOfOrigin)
4468            if (!item.isEmpty())
4469              return true;
4470          return false;
4471        }
4472
4473        public CodeableConcept addCountryOfOrigin() { //3
4474          CodeableConcept t = new CodeableConcept();
4475          if (this.countryOfOrigin == null)
4476            this.countryOfOrigin = new ArrayList<CodeableConcept>();
4477          this.countryOfOrigin.add(t);
4478          return t;
4479        }
4480
4481        public SubstanceDefinitionSourceMaterialComponent addCountryOfOrigin(CodeableConcept t) { //3
4482          if (t == null)
4483            return this;
4484          if (this.countryOfOrigin == null)
4485            this.countryOfOrigin = new ArrayList<CodeableConcept>();
4486          this.countryOfOrigin.add(t);
4487          return this;
4488        }
4489
4490        /**
4491         * @return The first repetition of repeating field {@link #countryOfOrigin}, creating it if it does not already exist {3}
4492         */
4493        public CodeableConcept getCountryOfOriginFirstRep() { 
4494          if (getCountryOfOrigin().isEmpty()) {
4495            addCountryOfOrigin();
4496          }
4497          return getCountryOfOrigin().get(0);
4498        }
4499
4500        protected void listChildren(List<Property> children) {
4501          super.listChildren(children);
4502          children.add(new Property("type", "CodeableConcept", "A classification that provides the origin of the raw material. Example: cat hair would be an Animal source type.", 0, 1, type));
4503          children.add(new Property("genus", "CodeableConcept", "The genus of an organism, typically referring to the Latin epithet of the genus element of the plant/animal scientific name.", 0, 1, genus));
4504          children.add(new Property("species", "CodeableConcept", "The species of an organism, typically referring to the Latin epithet of the species of the plant/animal.", 0, 1, species));
4505          children.add(new Property("part", "CodeableConcept", "An anatomical origin of the source material within an organism.", 0, 1, part));
4506          children.add(new Property("countryOfOrigin", "CodeableConcept", "The country or countries where the material is harvested.", 0, java.lang.Integer.MAX_VALUE, countryOfOrigin));
4507        }
4508
4509        @Override
4510        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4511          switch (_hash) {
4512          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "A classification that provides the origin of the raw material. Example: cat hair would be an Animal source type.", 0, 1, type);
4513          case 98241006: /*genus*/  return new Property("genus", "CodeableConcept", "The genus of an organism, typically referring to the Latin epithet of the genus element of the plant/animal scientific name.", 0, 1, genus);
4514          case -2008465092: /*species*/  return new Property("species", "CodeableConcept", "The species of an organism, typically referring to the Latin epithet of the species of the plant/animal.", 0, 1, species);
4515          case 3433459: /*part*/  return new Property("part", "CodeableConcept", "An anatomical origin of the source material within an organism.", 0, 1, part);
4516          case 57176467: /*countryOfOrigin*/  return new Property("countryOfOrigin", "CodeableConcept", "The country or countries where the material is harvested.", 0, java.lang.Integer.MAX_VALUE, countryOfOrigin);
4517          default: return super.getNamedProperty(_hash, _name, _checkValid);
4518          }
4519
4520        }
4521
4522      @Override
4523      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4524        switch (hash) {
4525        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
4526        case 98241006: /*genus*/ return this.genus == null ? new Base[0] : new Base[] {this.genus}; // CodeableConcept
4527        case -2008465092: /*species*/ return this.species == null ? new Base[0] : new Base[] {this.species}; // CodeableConcept
4528        case 3433459: /*part*/ return this.part == null ? new Base[0] : new Base[] {this.part}; // CodeableConcept
4529        case 57176467: /*countryOfOrigin*/ return this.countryOfOrigin == null ? new Base[0] : this.countryOfOrigin.toArray(new Base[this.countryOfOrigin.size()]); // CodeableConcept
4530        default: return super.getProperty(hash, name, checkValid);
4531        }
4532
4533      }
4534
4535      @Override
4536      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4537        switch (hash) {
4538        case 3575610: // type
4539          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4540          return value;
4541        case 98241006: // genus
4542          this.genus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4543          return value;
4544        case -2008465092: // species
4545          this.species = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4546          return value;
4547        case 3433459: // part
4548          this.part = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4549          return value;
4550        case 57176467: // countryOfOrigin
4551          this.getCountryOfOrigin().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
4552          return value;
4553        default: return super.setProperty(hash, name, value);
4554        }
4555
4556      }
4557
4558      @Override
4559      public Base setProperty(String name, Base value) throws FHIRException {
4560        if (name.equals("type")) {
4561          this.type = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4562        } else if (name.equals("genus")) {
4563          this.genus = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4564        } else if (name.equals("species")) {
4565          this.species = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4566        } else if (name.equals("part")) {
4567          this.part = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
4568        } else if (name.equals("countryOfOrigin")) {
4569          this.getCountryOfOrigin().add(TypeConvertor.castToCodeableConcept(value));
4570        } else
4571          return super.setProperty(name, value);
4572        return value;
4573      }
4574
4575      @Override
4576      public Base makeProperty(int hash, String name) throws FHIRException {
4577        switch (hash) {
4578        case 3575610:  return getType();
4579        case 98241006:  return getGenus();
4580        case -2008465092:  return getSpecies();
4581        case 3433459:  return getPart();
4582        case 57176467:  return addCountryOfOrigin(); 
4583        default: return super.makeProperty(hash, name);
4584        }
4585
4586      }
4587
4588      @Override
4589      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4590        switch (hash) {
4591        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
4592        case 98241006: /*genus*/ return new String[] {"CodeableConcept"};
4593        case -2008465092: /*species*/ return new String[] {"CodeableConcept"};
4594        case 3433459: /*part*/ return new String[] {"CodeableConcept"};
4595        case 57176467: /*countryOfOrigin*/ return new String[] {"CodeableConcept"};
4596        default: return super.getTypesForProperty(hash, name);
4597        }
4598
4599      }
4600
4601      @Override
4602      public Base addChild(String name) throws FHIRException {
4603        if (name.equals("type")) {
4604          this.type = new CodeableConcept();
4605          return this.type;
4606        }
4607        else if (name.equals("genus")) {
4608          this.genus = new CodeableConcept();
4609          return this.genus;
4610        }
4611        else if (name.equals("species")) {
4612          this.species = new CodeableConcept();
4613          return this.species;
4614        }
4615        else if (name.equals("part")) {
4616          this.part = new CodeableConcept();
4617          return this.part;
4618        }
4619        else if (name.equals("countryOfOrigin")) {
4620          return addCountryOfOrigin();
4621        }
4622        else
4623          return super.addChild(name);
4624      }
4625
4626      public SubstanceDefinitionSourceMaterialComponent copy() {
4627        SubstanceDefinitionSourceMaterialComponent dst = new SubstanceDefinitionSourceMaterialComponent();
4628        copyValues(dst);
4629        return dst;
4630      }
4631
4632      public void copyValues(SubstanceDefinitionSourceMaterialComponent dst) {
4633        super.copyValues(dst);
4634        dst.type = type == null ? null : type.copy();
4635        dst.genus = genus == null ? null : genus.copy();
4636        dst.species = species == null ? null : species.copy();
4637        dst.part = part == null ? null : part.copy();
4638        if (countryOfOrigin != null) {
4639          dst.countryOfOrigin = new ArrayList<CodeableConcept>();
4640          for (CodeableConcept i : countryOfOrigin)
4641            dst.countryOfOrigin.add(i.copy());
4642        };
4643      }
4644
4645      @Override
4646      public boolean equalsDeep(Base other_) {
4647        if (!super.equalsDeep(other_))
4648          return false;
4649        if (!(other_ instanceof SubstanceDefinitionSourceMaterialComponent))
4650          return false;
4651        SubstanceDefinitionSourceMaterialComponent o = (SubstanceDefinitionSourceMaterialComponent) other_;
4652        return compareDeep(type, o.type, true) && compareDeep(genus, o.genus, true) && compareDeep(species, o.species, true)
4653           && compareDeep(part, o.part, true) && compareDeep(countryOfOrigin, o.countryOfOrigin, true);
4654      }
4655
4656      @Override
4657      public boolean equalsShallow(Base other_) {
4658        if (!super.equalsShallow(other_))
4659          return false;
4660        if (!(other_ instanceof SubstanceDefinitionSourceMaterialComponent))
4661          return false;
4662        SubstanceDefinitionSourceMaterialComponent o = (SubstanceDefinitionSourceMaterialComponent) other_;
4663        return true;
4664      }
4665
4666      public boolean isEmpty() {
4667        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, genus, species, part
4668          , countryOfOrigin);
4669      }
4670
4671  public String fhirType() {
4672    return "SubstanceDefinition.sourceMaterial";
4673
4674  }
4675
4676  }
4677
4678    /**
4679     * Identifier by which this substance is known.
4680     */
4681    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4682    @Description(shortDefinition="Identifier by which this substance is known", formalDefinition="Identifier by which this substance is known." )
4683    protected List<Identifier> identifier;
4684
4685    /**
4686     * A business level identifier of the substance.
4687     */
4688    @Child(name = "version", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
4689    @Description(shortDefinition="A business level identifier of the substance", formalDefinition="A business level identifier of the substance." )
4690    protected StringType version;
4691
4692    /**
4693     * Status of substance within the catalogue e.g. approved.
4694     */
4695    @Child(name = "status", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
4696    @Description(shortDefinition="Status of substance within the catalogue e.g. approved", formalDefinition="Status of substance within the catalogue e.g. approved." )
4697    protected CodeableConcept status;
4698
4699    /**
4700     * A high level categorization, e.g. polymer or nucleic acid, or food, chemical, biological, or a lower level such as the general types of polymer (linear or branch chain) or type of impurity (process related or contaminant).
4701     */
4702    @Child(name = "classification", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4703    @Description(shortDefinition="A high level categorization, e.g. polymer or nucleic acid, or food, chemical, biological, or a lower level such as the general types of polymer (linear or branch chain) or type of impurity (process related or contaminant)", formalDefinition="A high level categorization, e.g. polymer or nucleic acid, or food, chemical, biological, or a lower level such as the general types of polymer (linear or branch chain) or type of impurity (process related or contaminant)." )
4704    protected List<CodeableConcept> classification;
4705
4706    /**
4707     * If the substance applies to only human or veterinary use.
4708     */
4709    @Child(name = "domain", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
4710    @Description(shortDefinition="If the substance applies to only human or veterinary use", formalDefinition="If the substance applies to only human or veterinary use." )
4711    protected CodeableConcept domain;
4712
4713    /**
4714     * The quality standard, established benchmark, to which substance complies (e.g. USP/NF, Ph. Eur, JP, BP, Company Standard).
4715     */
4716    @Child(name = "grade", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4717    @Description(shortDefinition="The quality standard, established benchmark, to which substance complies (e.g. USP/NF, Ph. Eur, JP, BP, Company Standard)", formalDefinition="The quality standard, established benchmark, to which substance complies (e.g. USP/NF, Ph. Eur, JP, BP, Company Standard)." )
4718    protected List<CodeableConcept> grade;
4719
4720    /**
4721     * Textual description of the substance.
4722     */
4723    @Child(name = "description", type = {MarkdownType.class}, order=6, min=0, max=1, modifier=false, summary=true)
4724    @Description(shortDefinition="Textual description of the substance", formalDefinition="Textual description of the substance." )
4725    protected MarkdownType description;
4726
4727    /**
4728     * Supporting literature.
4729     */
4730    @Child(name = "informationSource", type = {Citation.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4731    @Description(shortDefinition="Supporting literature", formalDefinition="Supporting literature." )
4732    protected List<Reference> informationSource;
4733
4734    /**
4735     * Textual comment about the substance's catalogue or registry record.
4736     */
4737    @Child(name = "note", type = {Annotation.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4738    @Description(shortDefinition="Textual comment about the substance's catalogue or registry record", formalDefinition="Textual comment about the substance's catalogue or registry record." )
4739    protected List<Annotation> note;
4740
4741    /**
4742     * A company that makes this substance.
4743     */
4744    @Child(name = "manufacturer", type = {Organization.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4745    @Description(shortDefinition="A company that makes this substance", formalDefinition="A company that makes this substance." )
4746    protected List<Reference> manufacturer;
4747
4748    /**
4749     * A company that supplies this substance.
4750     */
4751    @Child(name = "supplier", type = {Organization.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4752    @Description(shortDefinition="A company that supplies this substance", formalDefinition="A company that supplies this substance." )
4753    protected List<Reference> supplier;
4754
4755    /**
4756     * Moiety, for structural modifications.
4757     */
4758    @Child(name = "moiety", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4759    @Description(shortDefinition="Moiety, for structural modifications", formalDefinition="Moiety, for structural modifications." )
4760    protected List<SubstanceDefinitionMoietyComponent> moiety;
4761
4762    /**
4763     * General specifications for this substance.
4764     */
4765    @Child(name = "property", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4766    @Description(shortDefinition="General specifications for this substance", formalDefinition="General specifications for this substance." )
4767    protected List<SubstanceDefinitionPropertyComponent> property;
4768
4769    /**
4770     * The molecular weight or weight range (for proteins, polymers or nucleic acids).
4771     */
4772    @Child(name = "molecularWeight", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4773    @Description(shortDefinition="The molecular weight or weight range (for proteins, polymers or nucleic acids)", formalDefinition="The molecular weight or weight range (for proteins, polymers or nucleic acids)." )
4774    protected List<SubstanceDefinitionMolecularWeightComponent> molecularWeight;
4775
4776    /**
4777     * Structural information.
4778     */
4779    @Child(name = "structure", type = {}, order=14, min=0, max=1, modifier=false, summary=true)
4780    @Description(shortDefinition="Structural information", formalDefinition="Structural information." )
4781    protected SubstanceDefinitionStructureComponent structure;
4782
4783    /**
4784     * Codes associated with the substance.
4785     */
4786    @Child(name = "code", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4787    @Description(shortDefinition="Codes associated with the substance", formalDefinition="Codes associated with the substance." )
4788    protected List<SubstanceDefinitionCodeComponent> code;
4789
4790    /**
4791     * Names applicable to this substance.
4792     */
4793    @Child(name = "name", type = {}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4794    @Description(shortDefinition="Names applicable to this substance", formalDefinition="Names applicable to this substance." )
4795    protected List<SubstanceDefinitionNameComponent> name;
4796
4797    /**
4798     * A link between this substance and another, with details of the relationship.
4799     */
4800    @Child(name = "relationship", type = {}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
4801    @Description(shortDefinition="A link between this substance and another, with details of the relationship", formalDefinition="A link between this substance and another, with details of the relationship." )
4802    protected List<SubstanceDefinitionRelationshipComponent> relationship;
4803
4804    /**
4805     * Material or taxonomic/anatomical source for the substance.
4806     */
4807    @Child(name = "sourceMaterial", type = {}, order=18, min=0, max=1, modifier=false, summary=true)
4808    @Description(shortDefinition="Material or taxonomic/anatomical source for the substance", formalDefinition="Material or taxonomic/anatomical source for the substance." )
4809    protected SubstanceDefinitionSourceMaterialComponent sourceMaterial;
4810
4811    private static final long serialVersionUID = -1919269649L;
4812
4813  /**
4814   * Constructor
4815   */
4816    public SubstanceDefinition() {
4817      super();
4818    }
4819
4820    /**
4821     * @return {@link #identifier} (Identifier by which this substance is known.)
4822     */
4823    public List<Identifier> getIdentifier() { 
4824      if (this.identifier == null)
4825        this.identifier = new ArrayList<Identifier>();
4826      return this.identifier;
4827    }
4828
4829    /**
4830     * @return Returns a reference to <code>this</code> for easy method chaining
4831     */
4832    public SubstanceDefinition setIdentifier(List<Identifier> theIdentifier) { 
4833      this.identifier = theIdentifier;
4834      return this;
4835    }
4836
4837    public boolean hasIdentifier() { 
4838      if (this.identifier == null)
4839        return false;
4840      for (Identifier item : this.identifier)
4841        if (!item.isEmpty())
4842          return true;
4843      return false;
4844    }
4845
4846    public Identifier addIdentifier() { //3
4847      Identifier t = new Identifier();
4848      if (this.identifier == null)
4849        this.identifier = new ArrayList<Identifier>();
4850      this.identifier.add(t);
4851      return t;
4852    }
4853
4854    public SubstanceDefinition addIdentifier(Identifier t) { //3
4855      if (t == null)
4856        return this;
4857      if (this.identifier == null)
4858        this.identifier = new ArrayList<Identifier>();
4859      this.identifier.add(t);
4860      return this;
4861    }
4862
4863    /**
4864     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
4865     */
4866    public Identifier getIdentifierFirstRep() { 
4867      if (getIdentifier().isEmpty()) {
4868        addIdentifier();
4869      }
4870      return getIdentifier().get(0);
4871    }
4872
4873    /**
4874     * @return {@link #version} (A business level identifier of the substance.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
4875     */
4876    public StringType getVersionElement() { 
4877      if (this.version == null)
4878        if (Configuration.errorOnAutoCreate())
4879          throw new Error("Attempt to auto-create SubstanceDefinition.version");
4880        else if (Configuration.doAutoCreate())
4881          this.version = new StringType(); // bb
4882      return this.version;
4883    }
4884
4885    public boolean hasVersionElement() { 
4886      return this.version != null && !this.version.isEmpty();
4887    }
4888
4889    public boolean hasVersion() { 
4890      return this.version != null && !this.version.isEmpty();
4891    }
4892
4893    /**
4894     * @param value {@link #version} (A business level identifier of the substance.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
4895     */
4896    public SubstanceDefinition setVersionElement(StringType value) { 
4897      this.version = value;
4898      return this;
4899    }
4900
4901    /**
4902     * @return A business level identifier of the substance.
4903     */
4904    public String getVersion() { 
4905      return this.version == null ? null : this.version.getValue();
4906    }
4907
4908    /**
4909     * @param value A business level identifier of the substance.
4910     */
4911    public SubstanceDefinition setVersion(String value) { 
4912      if (Utilities.noString(value))
4913        this.version = null;
4914      else {
4915        if (this.version == null)
4916          this.version = new StringType();
4917        this.version.setValue(value);
4918      }
4919      return this;
4920    }
4921
4922    /**
4923     * @return {@link #status} (Status of substance within the catalogue e.g. approved.)
4924     */
4925    public CodeableConcept getStatus() { 
4926      if (this.status == null)
4927        if (Configuration.errorOnAutoCreate())
4928          throw new Error("Attempt to auto-create SubstanceDefinition.status");
4929        else if (Configuration.doAutoCreate())
4930          this.status = new CodeableConcept(); // cc
4931      return this.status;
4932    }
4933
4934    public boolean hasStatus() { 
4935      return this.status != null && !this.status.isEmpty();
4936    }
4937
4938    /**
4939     * @param value {@link #status} (Status of substance within the catalogue e.g. approved.)
4940     */
4941    public SubstanceDefinition setStatus(CodeableConcept value) { 
4942      this.status = value;
4943      return this;
4944    }
4945
4946    /**
4947     * @return {@link #classification} (A high level categorization, e.g. polymer or nucleic acid, or food, chemical, biological, or a lower level such as the general types of polymer (linear or branch chain) or type of impurity (process related or contaminant).)
4948     */
4949    public List<CodeableConcept> getClassification() { 
4950      if (this.classification == null)
4951        this.classification = new ArrayList<CodeableConcept>();
4952      return this.classification;
4953    }
4954
4955    /**
4956     * @return Returns a reference to <code>this</code> for easy method chaining
4957     */
4958    public SubstanceDefinition setClassification(List<CodeableConcept> theClassification) { 
4959      this.classification = theClassification;
4960      return this;
4961    }
4962
4963    public boolean hasClassification() { 
4964      if (this.classification == null)
4965        return false;
4966      for (CodeableConcept item : this.classification)
4967        if (!item.isEmpty())
4968          return true;
4969      return false;
4970    }
4971
4972    public CodeableConcept addClassification() { //3
4973      CodeableConcept t = new CodeableConcept();
4974      if (this.classification == null)
4975        this.classification = new ArrayList<CodeableConcept>();
4976      this.classification.add(t);
4977      return t;
4978    }
4979
4980    public SubstanceDefinition addClassification(CodeableConcept t) { //3
4981      if (t == null)
4982        return this;
4983      if (this.classification == null)
4984        this.classification = new ArrayList<CodeableConcept>();
4985      this.classification.add(t);
4986      return this;
4987    }
4988
4989    /**
4990     * @return The first repetition of repeating field {@link #classification}, creating it if it does not already exist {3}
4991     */
4992    public CodeableConcept getClassificationFirstRep() { 
4993      if (getClassification().isEmpty()) {
4994        addClassification();
4995      }
4996      return getClassification().get(0);
4997    }
4998
4999    /**
5000     * @return {@link #domain} (If the substance applies to only human or veterinary use.)
5001     */
5002    public CodeableConcept getDomain() { 
5003      if (this.domain == null)
5004        if (Configuration.errorOnAutoCreate())
5005          throw new Error("Attempt to auto-create SubstanceDefinition.domain");
5006        else if (Configuration.doAutoCreate())
5007          this.domain = new CodeableConcept(); // cc
5008      return this.domain;
5009    }
5010
5011    public boolean hasDomain() { 
5012      return this.domain != null && !this.domain.isEmpty();
5013    }
5014
5015    /**
5016     * @param value {@link #domain} (If the substance applies to only human or veterinary use.)
5017     */
5018    public SubstanceDefinition setDomain(CodeableConcept value) { 
5019      this.domain = value;
5020      return this;
5021    }
5022
5023    /**
5024     * @return {@link #grade} (The quality standard, established benchmark, to which substance complies (e.g. USP/NF, Ph. Eur, JP, BP, Company Standard).)
5025     */
5026    public List<CodeableConcept> getGrade() { 
5027      if (this.grade == null)
5028        this.grade = new ArrayList<CodeableConcept>();
5029      return this.grade;
5030    }
5031
5032    /**
5033     * @return Returns a reference to <code>this</code> for easy method chaining
5034     */
5035    public SubstanceDefinition setGrade(List<CodeableConcept> theGrade) { 
5036      this.grade = theGrade;
5037      return this;
5038    }
5039
5040    public boolean hasGrade() { 
5041      if (this.grade == null)
5042        return false;
5043      for (CodeableConcept item : this.grade)
5044        if (!item.isEmpty())
5045          return true;
5046      return false;
5047    }
5048
5049    public CodeableConcept addGrade() { //3
5050      CodeableConcept t = new CodeableConcept();
5051      if (this.grade == null)
5052        this.grade = new ArrayList<CodeableConcept>();
5053      this.grade.add(t);
5054      return t;
5055    }
5056
5057    public SubstanceDefinition addGrade(CodeableConcept t) { //3
5058      if (t == null)
5059        return this;
5060      if (this.grade == null)
5061        this.grade = new ArrayList<CodeableConcept>();
5062      this.grade.add(t);
5063      return this;
5064    }
5065
5066    /**
5067     * @return The first repetition of repeating field {@link #grade}, creating it if it does not already exist {3}
5068     */
5069    public CodeableConcept getGradeFirstRep() { 
5070      if (getGrade().isEmpty()) {
5071        addGrade();
5072      }
5073      return getGrade().get(0);
5074    }
5075
5076    /**
5077     * @return {@link #description} (Textual description of the substance.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
5078     */
5079    public MarkdownType getDescriptionElement() { 
5080      if (this.description == null)
5081        if (Configuration.errorOnAutoCreate())
5082          throw new Error("Attempt to auto-create SubstanceDefinition.description");
5083        else if (Configuration.doAutoCreate())
5084          this.description = new MarkdownType(); // bb
5085      return this.description;
5086    }
5087
5088    public boolean hasDescriptionElement() { 
5089      return this.description != null && !this.description.isEmpty();
5090    }
5091
5092    public boolean hasDescription() { 
5093      return this.description != null && !this.description.isEmpty();
5094    }
5095
5096    /**
5097     * @param value {@link #description} (Textual description of the substance.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
5098     */
5099    public SubstanceDefinition setDescriptionElement(MarkdownType value) { 
5100      this.description = value;
5101      return this;
5102    }
5103
5104    /**
5105     * @return Textual description of the substance.
5106     */
5107    public String getDescription() { 
5108      return this.description == null ? null : this.description.getValue();
5109    }
5110
5111    /**
5112     * @param value Textual description of the substance.
5113     */
5114    public SubstanceDefinition setDescription(String value) { 
5115      if (value == null)
5116        this.description = null;
5117      else {
5118        if (this.description == null)
5119          this.description = new MarkdownType();
5120        this.description.setValue(value);
5121      }
5122      return this;
5123    }
5124
5125    /**
5126     * @return {@link #informationSource} (Supporting literature.)
5127     */
5128    public List<Reference> getInformationSource() { 
5129      if (this.informationSource == null)
5130        this.informationSource = new ArrayList<Reference>();
5131      return this.informationSource;
5132    }
5133
5134    /**
5135     * @return Returns a reference to <code>this</code> for easy method chaining
5136     */
5137    public SubstanceDefinition setInformationSource(List<Reference> theInformationSource) { 
5138      this.informationSource = theInformationSource;
5139      return this;
5140    }
5141
5142    public boolean hasInformationSource() { 
5143      if (this.informationSource == null)
5144        return false;
5145      for (Reference item : this.informationSource)
5146        if (!item.isEmpty())
5147          return true;
5148      return false;
5149    }
5150
5151    public Reference addInformationSource() { //3
5152      Reference t = new Reference();
5153      if (this.informationSource == null)
5154        this.informationSource = new ArrayList<Reference>();
5155      this.informationSource.add(t);
5156      return t;
5157    }
5158
5159    public SubstanceDefinition addInformationSource(Reference t) { //3
5160      if (t == null)
5161        return this;
5162      if (this.informationSource == null)
5163        this.informationSource = new ArrayList<Reference>();
5164      this.informationSource.add(t);
5165      return this;
5166    }
5167
5168    /**
5169     * @return The first repetition of repeating field {@link #informationSource}, creating it if it does not already exist {3}
5170     */
5171    public Reference getInformationSourceFirstRep() { 
5172      if (getInformationSource().isEmpty()) {
5173        addInformationSource();
5174      }
5175      return getInformationSource().get(0);
5176    }
5177
5178    /**
5179     * @return {@link #note} (Textual comment about the substance's catalogue or registry record.)
5180     */
5181    public List<Annotation> getNote() { 
5182      if (this.note == null)
5183        this.note = new ArrayList<Annotation>();
5184      return this.note;
5185    }
5186
5187    /**
5188     * @return Returns a reference to <code>this</code> for easy method chaining
5189     */
5190    public SubstanceDefinition setNote(List<Annotation> theNote) { 
5191      this.note = theNote;
5192      return this;
5193    }
5194
5195    public boolean hasNote() { 
5196      if (this.note == null)
5197        return false;
5198      for (Annotation item : this.note)
5199        if (!item.isEmpty())
5200          return true;
5201      return false;
5202    }
5203
5204    public Annotation addNote() { //3
5205      Annotation t = new Annotation();
5206      if (this.note == null)
5207        this.note = new ArrayList<Annotation>();
5208      this.note.add(t);
5209      return t;
5210    }
5211
5212    public SubstanceDefinition addNote(Annotation t) { //3
5213      if (t == null)
5214        return this;
5215      if (this.note == null)
5216        this.note = new ArrayList<Annotation>();
5217      this.note.add(t);
5218      return this;
5219    }
5220
5221    /**
5222     * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist {3}
5223     */
5224    public Annotation getNoteFirstRep() { 
5225      if (getNote().isEmpty()) {
5226        addNote();
5227      }
5228      return getNote().get(0);
5229    }
5230
5231    /**
5232     * @return {@link #manufacturer} (A company that makes this substance.)
5233     */
5234    public List<Reference> getManufacturer() { 
5235      if (this.manufacturer == null)
5236        this.manufacturer = new ArrayList<Reference>();
5237      return this.manufacturer;
5238    }
5239
5240    /**
5241     * @return Returns a reference to <code>this</code> for easy method chaining
5242     */
5243    public SubstanceDefinition setManufacturer(List<Reference> theManufacturer) { 
5244      this.manufacturer = theManufacturer;
5245      return this;
5246    }
5247
5248    public boolean hasManufacturer() { 
5249      if (this.manufacturer == null)
5250        return false;
5251      for (Reference item : this.manufacturer)
5252        if (!item.isEmpty())
5253          return true;
5254      return false;
5255    }
5256
5257    public Reference addManufacturer() { //3
5258      Reference t = new Reference();
5259      if (this.manufacturer == null)
5260        this.manufacturer = new ArrayList<Reference>();
5261      this.manufacturer.add(t);
5262      return t;
5263    }
5264
5265    public SubstanceDefinition addManufacturer(Reference t) { //3
5266      if (t == null)
5267        return this;
5268      if (this.manufacturer == null)
5269        this.manufacturer = new ArrayList<Reference>();
5270      this.manufacturer.add(t);
5271      return this;
5272    }
5273
5274    /**
5275     * @return The first repetition of repeating field {@link #manufacturer}, creating it if it does not already exist {3}
5276     */
5277    public Reference getManufacturerFirstRep() { 
5278      if (getManufacturer().isEmpty()) {
5279        addManufacturer();
5280      }
5281      return getManufacturer().get(0);
5282    }
5283
5284    /**
5285     * @return {@link #supplier} (A company that supplies this substance.)
5286     */
5287    public List<Reference> getSupplier() { 
5288      if (this.supplier == null)
5289        this.supplier = new ArrayList<Reference>();
5290      return this.supplier;
5291    }
5292
5293    /**
5294     * @return Returns a reference to <code>this</code> for easy method chaining
5295     */
5296    public SubstanceDefinition setSupplier(List<Reference> theSupplier) { 
5297      this.supplier = theSupplier;
5298      return this;
5299    }
5300
5301    public boolean hasSupplier() { 
5302      if (this.supplier == null)
5303        return false;
5304      for (Reference item : this.supplier)
5305        if (!item.isEmpty())
5306          return true;
5307      return false;
5308    }
5309
5310    public Reference addSupplier() { //3
5311      Reference t = new Reference();
5312      if (this.supplier == null)
5313        this.supplier = new ArrayList<Reference>();
5314      this.supplier.add(t);
5315      return t;
5316    }
5317
5318    public SubstanceDefinition addSupplier(Reference t) { //3
5319      if (t == null)
5320        return this;
5321      if (this.supplier == null)
5322        this.supplier = new ArrayList<Reference>();
5323      this.supplier.add(t);
5324      return this;
5325    }
5326
5327    /**
5328     * @return The first repetition of repeating field {@link #supplier}, creating it if it does not already exist {3}
5329     */
5330    public Reference getSupplierFirstRep() { 
5331      if (getSupplier().isEmpty()) {
5332        addSupplier();
5333      }
5334      return getSupplier().get(0);
5335    }
5336
5337    /**
5338     * @return {@link #moiety} (Moiety, for structural modifications.)
5339     */
5340    public List<SubstanceDefinitionMoietyComponent> getMoiety() { 
5341      if (this.moiety == null)
5342        this.moiety = new ArrayList<SubstanceDefinitionMoietyComponent>();
5343      return this.moiety;
5344    }
5345
5346    /**
5347     * @return Returns a reference to <code>this</code> for easy method chaining
5348     */
5349    public SubstanceDefinition setMoiety(List<SubstanceDefinitionMoietyComponent> theMoiety) { 
5350      this.moiety = theMoiety;
5351      return this;
5352    }
5353
5354    public boolean hasMoiety() { 
5355      if (this.moiety == null)
5356        return false;
5357      for (SubstanceDefinitionMoietyComponent item : this.moiety)
5358        if (!item.isEmpty())
5359          return true;
5360      return false;
5361    }
5362
5363    public SubstanceDefinitionMoietyComponent addMoiety() { //3
5364      SubstanceDefinitionMoietyComponent t = new SubstanceDefinitionMoietyComponent();
5365      if (this.moiety == null)
5366        this.moiety = new ArrayList<SubstanceDefinitionMoietyComponent>();
5367      this.moiety.add(t);
5368      return t;
5369    }
5370
5371    public SubstanceDefinition addMoiety(SubstanceDefinitionMoietyComponent t) { //3
5372      if (t == null)
5373        return this;
5374      if (this.moiety == null)
5375        this.moiety = new ArrayList<SubstanceDefinitionMoietyComponent>();
5376      this.moiety.add(t);
5377      return this;
5378    }
5379
5380    /**
5381     * @return The first repetition of repeating field {@link #moiety}, creating it if it does not already exist {3}
5382     */
5383    public SubstanceDefinitionMoietyComponent getMoietyFirstRep() { 
5384      if (getMoiety().isEmpty()) {
5385        addMoiety();
5386      }
5387      return getMoiety().get(0);
5388    }
5389
5390    /**
5391     * @return {@link #property} (General specifications for this substance.)
5392     */
5393    public List<SubstanceDefinitionPropertyComponent> getProperty() { 
5394      if (this.property == null)
5395        this.property = new ArrayList<SubstanceDefinitionPropertyComponent>();
5396      return this.property;
5397    }
5398
5399    /**
5400     * @return Returns a reference to <code>this</code> for easy method chaining
5401     */
5402    public SubstanceDefinition setProperty(List<SubstanceDefinitionPropertyComponent> theProperty) { 
5403      this.property = theProperty;
5404      return this;
5405    }
5406
5407    public boolean hasProperty() { 
5408      if (this.property == null)
5409        return false;
5410      for (SubstanceDefinitionPropertyComponent item : this.property)
5411        if (!item.isEmpty())
5412          return true;
5413      return false;
5414    }
5415
5416    public SubstanceDefinitionPropertyComponent addProperty() { //3
5417      SubstanceDefinitionPropertyComponent t = new SubstanceDefinitionPropertyComponent();
5418      if (this.property == null)
5419        this.property = new ArrayList<SubstanceDefinitionPropertyComponent>();
5420      this.property.add(t);
5421      return t;
5422    }
5423
5424    public SubstanceDefinition addProperty(SubstanceDefinitionPropertyComponent t) { //3
5425      if (t == null)
5426        return this;
5427      if (this.property == null)
5428        this.property = new ArrayList<SubstanceDefinitionPropertyComponent>();
5429      this.property.add(t);
5430      return this;
5431    }
5432
5433    /**
5434     * @return The first repetition of repeating field {@link #property}, creating it if it does not already exist {3}
5435     */
5436    public SubstanceDefinitionPropertyComponent getPropertyFirstRep() { 
5437      if (getProperty().isEmpty()) {
5438        addProperty();
5439      }
5440      return getProperty().get(0);
5441    }
5442
5443    /**
5444     * @return {@link #molecularWeight} (The molecular weight or weight range (for proteins, polymers or nucleic acids).)
5445     */
5446    public List<SubstanceDefinitionMolecularWeightComponent> getMolecularWeight() { 
5447      if (this.molecularWeight == null)
5448        this.molecularWeight = new ArrayList<SubstanceDefinitionMolecularWeightComponent>();
5449      return this.molecularWeight;
5450    }
5451
5452    /**
5453     * @return Returns a reference to <code>this</code> for easy method chaining
5454     */
5455    public SubstanceDefinition setMolecularWeight(List<SubstanceDefinitionMolecularWeightComponent> theMolecularWeight) { 
5456      this.molecularWeight = theMolecularWeight;
5457      return this;
5458    }
5459
5460    public boolean hasMolecularWeight() { 
5461      if (this.molecularWeight == null)
5462        return false;
5463      for (SubstanceDefinitionMolecularWeightComponent item : this.molecularWeight)
5464        if (!item.isEmpty())
5465          return true;
5466      return false;
5467    }
5468
5469    public SubstanceDefinitionMolecularWeightComponent addMolecularWeight() { //3
5470      SubstanceDefinitionMolecularWeightComponent t = new SubstanceDefinitionMolecularWeightComponent();
5471      if (this.molecularWeight == null)
5472        this.molecularWeight = new ArrayList<SubstanceDefinitionMolecularWeightComponent>();
5473      this.molecularWeight.add(t);
5474      return t;
5475    }
5476
5477    public SubstanceDefinition addMolecularWeight(SubstanceDefinitionMolecularWeightComponent t) { //3
5478      if (t == null)
5479        return this;
5480      if (this.molecularWeight == null)
5481        this.molecularWeight = new ArrayList<SubstanceDefinitionMolecularWeightComponent>();
5482      this.molecularWeight.add(t);
5483      return this;
5484    }
5485
5486    /**
5487     * @return The first repetition of repeating field {@link #molecularWeight}, creating it if it does not already exist {3}
5488     */
5489    public SubstanceDefinitionMolecularWeightComponent getMolecularWeightFirstRep() { 
5490      if (getMolecularWeight().isEmpty()) {
5491        addMolecularWeight();
5492      }
5493      return getMolecularWeight().get(0);
5494    }
5495
5496    /**
5497     * @return {@link #structure} (Structural information.)
5498     */
5499    public SubstanceDefinitionStructureComponent getStructure() { 
5500      if (this.structure == null)
5501        if (Configuration.errorOnAutoCreate())
5502          throw new Error("Attempt to auto-create SubstanceDefinition.structure");
5503        else if (Configuration.doAutoCreate())
5504          this.structure = new SubstanceDefinitionStructureComponent(); // cc
5505      return this.structure;
5506    }
5507
5508    public boolean hasStructure() { 
5509      return this.structure != null && !this.structure.isEmpty();
5510    }
5511
5512    /**
5513     * @param value {@link #structure} (Structural information.)
5514     */
5515    public SubstanceDefinition setStructure(SubstanceDefinitionStructureComponent value) { 
5516      this.structure = value;
5517      return this;
5518    }
5519
5520    /**
5521     * @return {@link #code} (Codes associated with the substance.)
5522     */
5523    public List<SubstanceDefinitionCodeComponent> getCode() { 
5524      if (this.code == null)
5525        this.code = new ArrayList<SubstanceDefinitionCodeComponent>();
5526      return this.code;
5527    }
5528
5529    /**
5530     * @return Returns a reference to <code>this</code> for easy method chaining
5531     */
5532    public SubstanceDefinition setCode(List<SubstanceDefinitionCodeComponent> theCode) { 
5533      this.code = theCode;
5534      return this;
5535    }
5536
5537    public boolean hasCode() { 
5538      if (this.code == null)
5539        return false;
5540      for (SubstanceDefinitionCodeComponent item : this.code)
5541        if (!item.isEmpty())
5542          return true;
5543      return false;
5544    }
5545
5546    public SubstanceDefinitionCodeComponent addCode() { //3
5547      SubstanceDefinitionCodeComponent t = new SubstanceDefinitionCodeComponent();
5548      if (this.code == null)
5549        this.code = new ArrayList<SubstanceDefinitionCodeComponent>();
5550      this.code.add(t);
5551      return t;
5552    }
5553
5554    public SubstanceDefinition addCode(SubstanceDefinitionCodeComponent t) { //3
5555      if (t == null)
5556        return this;
5557      if (this.code == null)
5558        this.code = new ArrayList<SubstanceDefinitionCodeComponent>();
5559      this.code.add(t);
5560      return this;
5561    }
5562
5563    /**
5564     * @return The first repetition of repeating field {@link #code}, creating it if it does not already exist {3}
5565     */
5566    public SubstanceDefinitionCodeComponent getCodeFirstRep() { 
5567      if (getCode().isEmpty()) {
5568        addCode();
5569      }
5570      return getCode().get(0);
5571    }
5572
5573    /**
5574     * @return {@link #name} (Names applicable to this substance.)
5575     */
5576    public List<SubstanceDefinitionNameComponent> getName() { 
5577      if (this.name == null)
5578        this.name = new ArrayList<SubstanceDefinitionNameComponent>();
5579      return this.name;
5580    }
5581
5582    /**
5583     * @return Returns a reference to <code>this</code> for easy method chaining
5584     */
5585    public SubstanceDefinition setName(List<SubstanceDefinitionNameComponent> theName) { 
5586      this.name = theName;
5587      return this;
5588    }
5589
5590    public boolean hasName() { 
5591      if (this.name == null)
5592        return false;
5593      for (SubstanceDefinitionNameComponent item : this.name)
5594        if (!item.isEmpty())
5595          return true;
5596      return false;
5597    }
5598
5599    public SubstanceDefinitionNameComponent addName() { //3
5600      SubstanceDefinitionNameComponent t = new SubstanceDefinitionNameComponent();
5601      if (this.name == null)
5602        this.name = new ArrayList<SubstanceDefinitionNameComponent>();
5603      this.name.add(t);
5604      return t;
5605    }
5606
5607    public SubstanceDefinition addName(SubstanceDefinitionNameComponent t) { //3
5608      if (t == null)
5609        return this;
5610      if (this.name == null)
5611        this.name = new ArrayList<SubstanceDefinitionNameComponent>();
5612      this.name.add(t);
5613      return this;
5614    }
5615
5616    /**
5617     * @return The first repetition of repeating field {@link #name}, creating it if it does not already exist {3}
5618     */
5619    public SubstanceDefinitionNameComponent getNameFirstRep() { 
5620      if (getName().isEmpty()) {
5621        addName();
5622      }
5623      return getName().get(0);
5624    }
5625
5626    /**
5627     * @return {@link #relationship} (A link between this substance and another, with details of the relationship.)
5628     */
5629    public List<SubstanceDefinitionRelationshipComponent> getRelationship() { 
5630      if (this.relationship == null)
5631        this.relationship = new ArrayList<SubstanceDefinitionRelationshipComponent>();
5632      return this.relationship;
5633    }
5634
5635    /**
5636     * @return Returns a reference to <code>this</code> for easy method chaining
5637     */
5638    public SubstanceDefinition setRelationship(List<SubstanceDefinitionRelationshipComponent> theRelationship) { 
5639      this.relationship = theRelationship;
5640      return this;
5641    }
5642
5643    public boolean hasRelationship() { 
5644      if (this.relationship == null)
5645        return false;
5646      for (SubstanceDefinitionRelationshipComponent item : this.relationship)
5647        if (!item.isEmpty())
5648          return true;
5649      return false;
5650    }
5651
5652    public SubstanceDefinitionRelationshipComponent addRelationship() { //3
5653      SubstanceDefinitionRelationshipComponent t = new SubstanceDefinitionRelationshipComponent();
5654      if (this.relationship == null)
5655        this.relationship = new ArrayList<SubstanceDefinitionRelationshipComponent>();
5656      this.relationship.add(t);
5657      return t;
5658    }
5659
5660    public SubstanceDefinition addRelationship(SubstanceDefinitionRelationshipComponent t) { //3
5661      if (t == null)
5662        return this;
5663      if (this.relationship == null)
5664        this.relationship = new ArrayList<SubstanceDefinitionRelationshipComponent>();
5665      this.relationship.add(t);
5666      return this;
5667    }
5668
5669    /**
5670     * @return The first repetition of repeating field {@link #relationship}, creating it if it does not already exist {3}
5671     */
5672    public SubstanceDefinitionRelationshipComponent getRelationshipFirstRep() { 
5673      if (getRelationship().isEmpty()) {
5674        addRelationship();
5675      }
5676      return getRelationship().get(0);
5677    }
5678
5679    /**
5680     * @return {@link #sourceMaterial} (Material or taxonomic/anatomical source for the substance.)
5681     */
5682    public SubstanceDefinitionSourceMaterialComponent getSourceMaterial() { 
5683      if (this.sourceMaterial == null)
5684        if (Configuration.errorOnAutoCreate())
5685          throw new Error("Attempt to auto-create SubstanceDefinition.sourceMaterial");
5686        else if (Configuration.doAutoCreate())
5687          this.sourceMaterial = new SubstanceDefinitionSourceMaterialComponent(); // cc
5688      return this.sourceMaterial;
5689    }
5690
5691    public boolean hasSourceMaterial() { 
5692      return this.sourceMaterial != null && !this.sourceMaterial.isEmpty();
5693    }
5694
5695    /**
5696     * @param value {@link #sourceMaterial} (Material or taxonomic/anatomical source for the substance.)
5697     */
5698    public SubstanceDefinition setSourceMaterial(SubstanceDefinitionSourceMaterialComponent value) { 
5699      this.sourceMaterial = value;
5700      return this;
5701    }
5702
5703      protected void listChildren(List<Property> children) {
5704        super.listChildren(children);
5705        children.add(new Property("identifier", "Identifier", "Identifier by which this substance is known.", 0, java.lang.Integer.MAX_VALUE, identifier));
5706        children.add(new Property("version", "string", "A business level identifier of the substance.", 0, 1, version));
5707        children.add(new Property("status", "CodeableConcept", "Status of substance within the catalogue e.g. approved.", 0, 1, status));
5708        children.add(new Property("classification", "CodeableConcept", "A high level categorization, e.g. polymer or nucleic acid, or food, chemical, biological, or a lower level such as the general types of polymer (linear or branch chain) or type of impurity (process related or contaminant).", 0, java.lang.Integer.MAX_VALUE, classification));
5709        children.add(new Property("domain", "CodeableConcept", "If the substance applies to only human or veterinary use.", 0, 1, domain));
5710        children.add(new Property("grade", "CodeableConcept", "The quality standard, established benchmark, to which substance complies (e.g. USP/NF, Ph. Eur, JP, BP, Company Standard).", 0, java.lang.Integer.MAX_VALUE, grade));
5711        children.add(new Property("description", "markdown", "Textual description of the substance.", 0, 1, description));
5712        children.add(new Property("informationSource", "Reference(Citation)", "Supporting literature.", 0, java.lang.Integer.MAX_VALUE, informationSource));
5713        children.add(new Property("note", "Annotation", "Textual comment about the substance's catalogue or registry record.", 0, java.lang.Integer.MAX_VALUE, note));
5714        children.add(new Property("manufacturer", "Reference(Organization)", "A company that makes this substance.", 0, java.lang.Integer.MAX_VALUE, manufacturer));
5715        children.add(new Property("supplier", "Reference(Organization)", "A company that supplies this substance.", 0, java.lang.Integer.MAX_VALUE, supplier));
5716        children.add(new Property("moiety", "", "Moiety, for structural modifications.", 0, java.lang.Integer.MAX_VALUE, moiety));
5717        children.add(new Property("property", "", "General specifications for this substance.", 0, java.lang.Integer.MAX_VALUE, property));
5718        children.add(new Property("molecularWeight", "", "The molecular weight or weight range (for proteins, polymers or nucleic acids).", 0, java.lang.Integer.MAX_VALUE, molecularWeight));
5719        children.add(new Property("structure", "", "Structural information.", 0, 1, structure));
5720        children.add(new Property("code", "", "Codes associated with the substance.", 0, java.lang.Integer.MAX_VALUE, code));
5721        children.add(new Property("name", "", "Names applicable to this substance.", 0, java.lang.Integer.MAX_VALUE, name));
5722        children.add(new Property("relationship", "", "A link between this substance and another, with details of the relationship.", 0, java.lang.Integer.MAX_VALUE, relationship));
5723        children.add(new Property("sourceMaterial", "", "Material or taxonomic/anatomical source for the substance.", 0, 1, sourceMaterial));
5724      }
5725
5726      @Override
5727      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5728        switch (_hash) {
5729        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier by which this substance is known.", 0, java.lang.Integer.MAX_VALUE, identifier);
5730        case 351608024: /*version*/  return new Property("version", "string", "A business level identifier of the substance.", 0, 1, version);
5731        case -892481550: /*status*/  return new Property("status", "CodeableConcept", "Status of substance within the catalogue e.g. approved.", 0, 1, status);
5732        case 382350310: /*classification*/  return new Property("classification", "CodeableConcept", "A high level categorization, e.g. polymer or nucleic acid, or food, chemical, biological, or a lower level such as the general types of polymer (linear or branch chain) or type of impurity (process related or contaminant).", 0, java.lang.Integer.MAX_VALUE, classification);
5733        case -1326197564: /*domain*/  return new Property("domain", "CodeableConcept", "If the substance applies to only human or veterinary use.", 0, 1, domain);
5734        case 98615255: /*grade*/  return new Property("grade", "CodeableConcept", "The quality standard, established benchmark, to which substance complies (e.g. USP/NF, Ph. Eur, JP, BP, Company Standard).", 0, java.lang.Integer.MAX_VALUE, grade);
5735        case -1724546052: /*description*/  return new Property("description", "markdown", "Textual description of the substance.", 0, 1, description);
5736        case -2123220889: /*informationSource*/  return new Property("informationSource", "Reference(Citation)", "Supporting literature.", 0, java.lang.Integer.MAX_VALUE, informationSource);
5737        case 3387378: /*note*/  return new Property("note", "Annotation", "Textual comment about the substance's catalogue or registry record.", 0, java.lang.Integer.MAX_VALUE, note);
5738        case -1969347631: /*manufacturer*/  return new Property("manufacturer", "Reference(Organization)", "A company that makes this substance.", 0, java.lang.Integer.MAX_VALUE, manufacturer);
5739        case -1663305268: /*supplier*/  return new Property("supplier", "Reference(Organization)", "A company that supplies this substance.", 0, java.lang.Integer.MAX_VALUE, supplier);
5740        case -1068650173: /*moiety*/  return new Property("moiety", "", "Moiety, for structural modifications.", 0, java.lang.Integer.MAX_VALUE, moiety);
5741        case -993141291: /*property*/  return new Property("property", "", "General specifications for this substance.", 0, java.lang.Integer.MAX_VALUE, property);
5742        case 635625672: /*molecularWeight*/  return new Property("molecularWeight", "", "The molecular weight or weight range (for proteins, polymers or nucleic acids).", 0, java.lang.Integer.MAX_VALUE, molecularWeight);
5743        case 144518515: /*structure*/  return new Property("structure", "", "Structural information.", 0, 1, structure);
5744        case 3059181: /*code*/  return new Property("code", "", "Codes associated with the substance.", 0, java.lang.Integer.MAX_VALUE, code);
5745        case 3373707: /*name*/  return new Property("name", "", "Names applicable to this substance.", 0, java.lang.Integer.MAX_VALUE, name);
5746        case -261851592: /*relationship*/  return new Property("relationship", "", "A link between this substance and another, with details of the relationship.", 0, java.lang.Integer.MAX_VALUE, relationship);
5747        case -1064442270: /*sourceMaterial*/  return new Property("sourceMaterial", "", "Material or taxonomic/anatomical source for the substance.", 0, 1, sourceMaterial);
5748        default: return super.getNamedProperty(_hash, _name, _checkValid);
5749        }
5750
5751      }
5752
5753      @Override
5754      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5755        switch (hash) {
5756        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
5757        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
5758        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // CodeableConcept
5759        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : this.classification.toArray(new Base[this.classification.size()]); // CodeableConcept
5760        case -1326197564: /*domain*/ return this.domain == null ? new Base[0] : new Base[] {this.domain}; // CodeableConcept
5761        case 98615255: /*grade*/ return this.grade == null ? new Base[0] : this.grade.toArray(new Base[this.grade.size()]); // CodeableConcept
5762        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
5763        case -2123220889: /*informationSource*/ return this.informationSource == null ? new Base[0] : this.informationSource.toArray(new Base[this.informationSource.size()]); // Reference
5764        case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation
5765        case -1969347631: /*manufacturer*/ return this.manufacturer == null ? new Base[0] : this.manufacturer.toArray(new Base[this.manufacturer.size()]); // Reference
5766        case -1663305268: /*supplier*/ return this.supplier == null ? new Base[0] : this.supplier.toArray(new Base[this.supplier.size()]); // Reference
5767        case -1068650173: /*moiety*/ return this.moiety == null ? new Base[0] : this.moiety.toArray(new Base[this.moiety.size()]); // SubstanceDefinitionMoietyComponent
5768        case -993141291: /*property*/ return this.property == null ? new Base[0] : this.property.toArray(new Base[this.property.size()]); // SubstanceDefinitionPropertyComponent
5769        case 635625672: /*molecularWeight*/ return this.molecularWeight == null ? new Base[0] : this.molecularWeight.toArray(new Base[this.molecularWeight.size()]); // SubstanceDefinitionMolecularWeightComponent
5770        case 144518515: /*structure*/ return this.structure == null ? new Base[0] : new Base[] {this.structure}; // SubstanceDefinitionStructureComponent
5771        case 3059181: /*code*/ return this.code == null ? new Base[0] : this.code.toArray(new Base[this.code.size()]); // SubstanceDefinitionCodeComponent
5772        case 3373707: /*name*/ return this.name == null ? new Base[0] : this.name.toArray(new Base[this.name.size()]); // SubstanceDefinitionNameComponent
5773        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : this.relationship.toArray(new Base[this.relationship.size()]); // SubstanceDefinitionRelationshipComponent
5774        case -1064442270: /*sourceMaterial*/ return this.sourceMaterial == null ? new Base[0] : new Base[] {this.sourceMaterial}; // SubstanceDefinitionSourceMaterialComponent
5775        default: return super.getProperty(hash, name, checkValid);
5776        }
5777
5778      }
5779
5780      @Override
5781      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5782        switch (hash) {
5783        case -1618432855: // identifier
5784          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
5785          return value;
5786        case 351608024: // version
5787          this.version = TypeConvertor.castToString(value); // StringType
5788          return value;
5789        case -892481550: // status
5790          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5791          return value;
5792        case 382350310: // classification
5793          this.getClassification().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5794          return value;
5795        case -1326197564: // domain
5796          this.domain = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5797          return value;
5798        case 98615255: // grade
5799          this.getGrade().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
5800          return value;
5801        case -1724546052: // description
5802          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
5803          return value;
5804        case -2123220889: // informationSource
5805          this.getInformationSource().add(TypeConvertor.castToReference(value)); // Reference
5806          return value;
5807        case 3387378: // note
5808          this.getNote().add(TypeConvertor.castToAnnotation(value)); // Annotation
5809          return value;
5810        case -1969347631: // manufacturer
5811          this.getManufacturer().add(TypeConvertor.castToReference(value)); // Reference
5812          return value;
5813        case -1663305268: // supplier
5814          this.getSupplier().add(TypeConvertor.castToReference(value)); // Reference
5815          return value;
5816        case -1068650173: // moiety
5817          this.getMoiety().add((SubstanceDefinitionMoietyComponent) value); // SubstanceDefinitionMoietyComponent
5818          return value;
5819        case -993141291: // property
5820          this.getProperty().add((SubstanceDefinitionPropertyComponent) value); // SubstanceDefinitionPropertyComponent
5821          return value;
5822        case 635625672: // molecularWeight
5823          this.getMolecularWeight().add((SubstanceDefinitionMolecularWeightComponent) value); // SubstanceDefinitionMolecularWeightComponent
5824          return value;
5825        case 144518515: // structure
5826          this.structure = (SubstanceDefinitionStructureComponent) value; // SubstanceDefinitionStructureComponent
5827          return value;
5828        case 3059181: // code
5829          this.getCode().add((SubstanceDefinitionCodeComponent) value); // SubstanceDefinitionCodeComponent
5830          return value;
5831        case 3373707: // name
5832          this.getName().add((SubstanceDefinitionNameComponent) value); // SubstanceDefinitionNameComponent
5833          return value;
5834        case -261851592: // relationship
5835          this.getRelationship().add((SubstanceDefinitionRelationshipComponent) value); // SubstanceDefinitionRelationshipComponent
5836          return value;
5837        case -1064442270: // sourceMaterial
5838          this.sourceMaterial = (SubstanceDefinitionSourceMaterialComponent) value; // SubstanceDefinitionSourceMaterialComponent
5839          return value;
5840        default: return super.setProperty(hash, name, value);
5841        }
5842
5843      }
5844
5845      @Override
5846      public Base setProperty(String name, Base value) throws FHIRException {
5847        if (name.equals("identifier")) {
5848          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
5849        } else if (name.equals("version")) {
5850          this.version = TypeConvertor.castToString(value); // StringType
5851        } else if (name.equals("status")) {
5852          this.status = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5853        } else if (name.equals("classification")) {
5854          this.getClassification().add(TypeConvertor.castToCodeableConcept(value));
5855        } else if (name.equals("domain")) {
5856          this.domain = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
5857        } else if (name.equals("grade")) {
5858          this.getGrade().add(TypeConvertor.castToCodeableConcept(value));
5859        } else if (name.equals("description")) {
5860          this.description = TypeConvertor.castToMarkdown(value); // MarkdownType
5861        } else if (name.equals("informationSource")) {
5862          this.getInformationSource().add(TypeConvertor.castToReference(value));
5863        } else if (name.equals("note")) {
5864          this.getNote().add(TypeConvertor.castToAnnotation(value));
5865        } else if (name.equals("manufacturer")) {
5866          this.getManufacturer().add(TypeConvertor.castToReference(value));
5867        } else if (name.equals("supplier")) {
5868          this.getSupplier().add(TypeConvertor.castToReference(value));
5869        } else if (name.equals("moiety")) {
5870          this.getMoiety().add((SubstanceDefinitionMoietyComponent) value);
5871        } else if (name.equals("property")) {
5872          this.getProperty().add((SubstanceDefinitionPropertyComponent) value);
5873        } else if (name.equals("molecularWeight")) {
5874          this.getMolecularWeight().add((SubstanceDefinitionMolecularWeightComponent) value);
5875        } else if (name.equals("structure")) {
5876          this.structure = (SubstanceDefinitionStructureComponent) value; // SubstanceDefinitionStructureComponent
5877        } else if (name.equals("code")) {
5878          this.getCode().add((SubstanceDefinitionCodeComponent) value);
5879        } else if (name.equals("name")) {
5880          this.getName().add((SubstanceDefinitionNameComponent) value);
5881        } else if (name.equals("relationship")) {
5882          this.getRelationship().add((SubstanceDefinitionRelationshipComponent) value);
5883        } else if (name.equals("sourceMaterial")) {
5884          this.sourceMaterial = (SubstanceDefinitionSourceMaterialComponent) value; // SubstanceDefinitionSourceMaterialComponent
5885        } else
5886          return super.setProperty(name, value);
5887        return value;
5888      }
5889
5890      @Override
5891      public Base makeProperty(int hash, String name) throws FHIRException {
5892        switch (hash) {
5893        case -1618432855:  return addIdentifier(); 
5894        case 351608024:  return getVersionElement();
5895        case -892481550:  return getStatus();
5896        case 382350310:  return addClassification(); 
5897        case -1326197564:  return getDomain();
5898        case 98615255:  return addGrade(); 
5899        case -1724546052:  return getDescriptionElement();
5900        case -2123220889:  return addInformationSource(); 
5901        case 3387378:  return addNote(); 
5902        case -1969347631:  return addManufacturer(); 
5903        case -1663305268:  return addSupplier(); 
5904        case -1068650173:  return addMoiety(); 
5905        case -993141291:  return addProperty(); 
5906        case 635625672:  return addMolecularWeight(); 
5907        case 144518515:  return getStructure();
5908        case 3059181:  return addCode(); 
5909        case 3373707:  return addName(); 
5910        case -261851592:  return addRelationship(); 
5911        case -1064442270:  return getSourceMaterial();
5912        default: return super.makeProperty(hash, name);
5913        }
5914
5915      }
5916
5917      @Override
5918      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5919        switch (hash) {
5920        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
5921        case 351608024: /*version*/ return new String[] {"string"};
5922        case -892481550: /*status*/ return new String[] {"CodeableConcept"};
5923        case 382350310: /*classification*/ return new String[] {"CodeableConcept"};
5924        case -1326197564: /*domain*/ return new String[] {"CodeableConcept"};
5925        case 98615255: /*grade*/ return new String[] {"CodeableConcept"};
5926        case -1724546052: /*description*/ return new String[] {"markdown"};
5927        case -2123220889: /*informationSource*/ return new String[] {"Reference"};
5928        case 3387378: /*note*/ return new String[] {"Annotation"};
5929        case -1969347631: /*manufacturer*/ return new String[] {"Reference"};
5930        case -1663305268: /*supplier*/ return new String[] {"Reference"};
5931        case -1068650173: /*moiety*/ return new String[] {};
5932        case -993141291: /*property*/ return new String[] {};
5933        case 635625672: /*molecularWeight*/ return new String[] {};
5934        case 144518515: /*structure*/ return new String[] {};
5935        case 3059181: /*code*/ return new String[] {};
5936        case 3373707: /*name*/ return new String[] {};
5937        case -261851592: /*relationship*/ return new String[] {};
5938        case -1064442270: /*sourceMaterial*/ return new String[] {};
5939        default: return super.getTypesForProperty(hash, name);
5940        }
5941
5942      }
5943
5944      @Override
5945      public Base addChild(String name) throws FHIRException {
5946        if (name.equals("identifier")) {
5947          return addIdentifier();
5948        }
5949        else if (name.equals("version")) {
5950          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.version");
5951        }
5952        else if (name.equals("status")) {
5953          this.status = new CodeableConcept();
5954          return this.status;
5955        }
5956        else if (name.equals("classification")) {
5957          return addClassification();
5958        }
5959        else if (name.equals("domain")) {
5960          this.domain = new CodeableConcept();
5961          return this.domain;
5962        }
5963        else if (name.equals("grade")) {
5964          return addGrade();
5965        }
5966        else if (name.equals("description")) {
5967          throw new FHIRException("Cannot call addChild on a primitive type SubstanceDefinition.description");
5968        }
5969        else if (name.equals("informationSource")) {
5970          return addInformationSource();
5971        }
5972        else if (name.equals("note")) {
5973          return addNote();
5974        }
5975        else if (name.equals("manufacturer")) {
5976          return addManufacturer();
5977        }
5978        else if (name.equals("supplier")) {
5979          return addSupplier();
5980        }
5981        else if (name.equals("moiety")) {
5982          return addMoiety();
5983        }
5984        else if (name.equals("property")) {
5985          return addProperty();
5986        }
5987        else if (name.equals("molecularWeight")) {
5988          return addMolecularWeight();
5989        }
5990        else if (name.equals("structure")) {
5991          this.structure = new SubstanceDefinitionStructureComponent();
5992          return this.structure;
5993        }
5994        else if (name.equals("code")) {
5995          return addCode();
5996        }
5997        else if (name.equals("name")) {
5998          return addName();
5999        }
6000        else if (name.equals("relationship")) {
6001          return addRelationship();
6002        }
6003        else if (name.equals("sourceMaterial")) {
6004          this.sourceMaterial = new SubstanceDefinitionSourceMaterialComponent();
6005          return this.sourceMaterial;
6006        }
6007        else
6008          return super.addChild(name);
6009      }
6010
6011  public String fhirType() {
6012    return "SubstanceDefinition";
6013
6014  }
6015
6016      public SubstanceDefinition copy() {
6017        SubstanceDefinition dst = new SubstanceDefinition();
6018        copyValues(dst);
6019        return dst;
6020      }
6021
6022      public void copyValues(SubstanceDefinition dst) {
6023        super.copyValues(dst);
6024        if (identifier != null) {
6025          dst.identifier = new ArrayList<Identifier>();
6026          for (Identifier i : identifier)
6027            dst.identifier.add(i.copy());
6028        };
6029        dst.version = version == null ? null : version.copy();
6030        dst.status = status == null ? null : status.copy();
6031        if (classification != null) {
6032          dst.classification = new ArrayList<CodeableConcept>();
6033          for (CodeableConcept i : classification)
6034            dst.classification.add(i.copy());
6035        };
6036        dst.domain = domain == null ? null : domain.copy();
6037        if (grade != null) {
6038          dst.grade = new ArrayList<CodeableConcept>();
6039          for (CodeableConcept i : grade)
6040            dst.grade.add(i.copy());
6041        };
6042        dst.description = description == null ? null : description.copy();
6043        if (informationSource != null) {
6044          dst.informationSource = new ArrayList<Reference>();
6045          for (Reference i : informationSource)
6046            dst.informationSource.add(i.copy());
6047        };
6048        if (note != null) {
6049          dst.note = new ArrayList<Annotation>();
6050          for (Annotation i : note)
6051            dst.note.add(i.copy());
6052        };
6053        if (manufacturer != null) {
6054          dst.manufacturer = new ArrayList<Reference>();
6055          for (Reference i : manufacturer)
6056            dst.manufacturer.add(i.copy());
6057        };
6058        if (supplier != null) {
6059          dst.supplier = new ArrayList<Reference>();
6060          for (Reference i : supplier)
6061            dst.supplier.add(i.copy());
6062        };
6063        if (moiety != null) {
6064          dst.moiety = new ArrayList<SubstanceDefinitionMoietyComponent>();
6065          for (SubstanceDefinitionMoietyComponent i : moiety)
6066            dst.moiety.add(i.copy());
6067        };
6068        if (property != null) {
6069          dst.property = new ArrayList<SubstanceDefinitionPropertyComponent>();
6070          for (SubstanceDefinitionPropertyComponent i : property)
6071            dst.property.add(i.copy());
6072        };
6073        if (molecularWeight != null) {
6074          dst.molecularWeight = new ArrayList<SubstanceDefinitionMolecularWeightComponent>();
6075          for (SubstanceDefinitionMolecularWeightComponent i : molecularWeight)
6076            dst.molecularWeight.add(i.copy());
6077        };
6078        dst.structure = structure == null ? null : structure.copy();
6079        if (code != null) {
6080          dst.code = new ArrayList<SubstanceDefinitionCodeComponent>();
6081          for (SubstanceDefinitionCodeComponent i : code)
6082            dst.code.add(i.copy());
6083        };
6084        if (name != null) {
6085          dst.name = new ArrayList<SubstanceDefinitionNameComponent>();
6086          for (SubstanceDefinitionNameComponent i : name)
6087            dst.name.add(i.copy());
6088        };
6089        if (relationship != null) {
6090          dst.relationship = new ArrayList<SubstanceDefinitionRelationshipComponent>();
6091          for (SubstanceDefinitionRelationshipComponent i : relationship)
6092            dst.relationship.add(i.copy());
6093        };
6094        dst.sourceMaterial = sourceMaterial == null ? null : sourceMaterial.copy();
6095      }
6096
6097      protected SubstanceDefinition typedCopy() {
6098        return copy();
6099      }
6100
6101      @Override
6102      public boolean equalsDeep(Base other_) {
6103        if (!super.equalsDeep(other_))
6104          return false;
6105        if (!(other_ instanceof SubstanceDefinition))
6106          return false;
6107        SubstanceDefinition o = (SubstanceDefinition) other_;
6108        return compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true) && compareDeep(status, o.status, true)
6109           && compareDeep(classification, o.classification, true) && compareDeep(domain, o.domain, true) && compareDeep(grade, o.grade, true)
6110           && compareDeep(description, o.description, true) && compareDeep(informationSource, o.informationSource, true)
6111           && compareDeep(note, o.note, true) && compareDeep(manufacturer, o.manufacturer, true) && compareDeep(supplier, o.supplier, true)
6112           && compareDeep(moiety, o.moiety, true) && compareDeep(property, o.property, true) && compareDeep(molecularWeight, o.molecularWeight, true)
6113           && compareDeep(structure, o.structure, true) && compareDeep(code, o.code, true) && compareDeep(name, o.name, true)
6114           && compareDeep(relationship, o.relationship, true) && compareDeep(sourceMaterial, o.sourceMaterial, true)
6115          ;
6116      }
6117
6118      @Override
6119      public boolean equalsShallow(Base other_) {
6120        if (!super.equalsShallow(other_))
6121          return false;
6122        if (!(other_ instanceof SubstanceDefinition))
6123          return false;
6124        SubstanceDefinition o = (SubstanceDefinition) other_;
6125        return compareValues(version, o.version, true) && compareValues(description, o.description, true);
6126      }
6127
6128      public boolean isEmpty() {
6129        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, version, status
6130          , classification, domain, grade, description, informationSource, note, manufacturer
6131          , supplier, moiety, property, molecularWeight, structure, code, name, relationship
6132          , sourceMaterial);
6133      }
6134
6135  @Override
6136  public ResourceType getResourceType() {
6137    return ResourceType.SubstanceDefinition;
6138   }
6139
6140 /**
6141   * Search parameter: <b>classification</b>
6142   * <p>
6143   * Description: <b>High or low level categorization, e.g. polymer vs. nucleic acid or linear vs. branch chain</b><br>
6144   * Type: <b>token</b><br>
6145   * Path: <b>SubstanceDefinition.classification</b><br>
6146   * </p>
6147   */
6148  @SearchParamDefinition(name="classification", path="SubstanceDefinition.classification", description="High or low level categorization, e.g. polymer vs. nucleic acid or linear vs. branch chain", type="token" )
6149  public static final String SP_CLASSIFICATION = "classification";
6150 /**
6151   * <b>Fluent Client</b> search parameter constant for <b>classification</b>
6152   * <p>
6153   * Description: <b>High or low level categorization, e.g. polymer vs. nucleic acid or linear vs. branch chain</b><br>
6154   * Type: <b>token</b><br>
6155   * Path: <b>SubstanceDefinition.classification</b><br>
6156   * </p>
6157   */
6158  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CLASSIFICATION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CLASSIFICATION);
6159
6160 /**
6161   * Search parameter: <b>code</b>
6162   * <p>
6163   * Description: <b>The specific code</b><br>
6164   * Type: <b>token</b><br>
6165   * Path: <b>SubstanceDefinition.code.code</b><br>
6166   * </p>
6167   */
6168  @SearchParamDefinition(name="code", path="SubstanceDefinition.code.code", description="The specific code", type="token" )
6169  public static final String SP_CODE = "code";
6170 /**
6171   * <b>Fluent Client</b> search parameter constant for <b>code</b>
6172   * <p>
6173   * Description: <b>The specific code</b><br>
6174   * Type: <b>token</b><br>
6175   * Path: <b>SubstanceDefinition.code.code</b><br>
6176   * </p>
6177   */
6178  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
6179
6180 /**
6181   * Search parameter: <b>domain</b>
6182   * <p>
6183   * Description: <b>If the substance applies to only human or veterinary use</b><br>
6184   * Type: <b>token</b><br>
6185   * Path: <b>SubstanceDefinition.domain</b><br>
6186   * </p>
6187   */
6188  @SearchParamDefinition(name="domain", path="SubstanceDefinition.domain", description="If the substance applies to only human or veterinary use", type="token" )
6189  public static final String SP_DOMAIN = "domain";
6190 /**
6191   * <b>Fluent Client</b> search parameter constant for <b>domain</b>
6192   * <p>
6193   * Description: <b>If the substance applies to only human or veterinary use</b><br>
6194   * Type: <b>token</b><br>
6195   * Path: <b>SubstanceDefinition.domain</b><br>
6196   * </p>
6197   */
6198  public static final ca.uhn.fhir.rest.gclient.TokenClientParam DOMAIN = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_DOMAIN);
6199
6200 /**
6201   * Search parameter: <b>identifier</b>
6202   * <p>
6203   * Description: <b>Identifier by which this substance is known</b><br>
6204   * Type: <b>token</b><br>
6205   * Path: <b>SubstanceDefinition.identifier</b><br>
6206   * </p>
6207   */
6208  @SearchParamDefinition(name="identifier", path="SubstanceDefinition.identifier", description="Identifier by which this substance is known", type="token" )
6209  public static final String SP_IDENTIFIER = "identifier";
6210 /**
6211   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
6212   * <p>
6213   * Description: <b>Identifier by which this substance is known</b><br>
6214   * Type: <b>token</b><br>
6215   * Path: <b>SubstanceDefinition.identifier</b><br>
6216   * </p>
6217   */
6218  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
6219
6220 /**
6221   * Search parameter: <b>name</b>
6222   * <p>
6223   * Description: <b>The actual name</b><br>
6224   * Type: <b>string</b><br>
6225   * Path: <b>SubstanceDefinition.name.name</b><br>
6226   * </p>
6227   */
6228  @SearchParamDefinition(name="name", path="SubstanceDefinition.name.name", description="The actual name", type="string" )
6229  public static final String SP_NAME = "name";
6230 /**
6231   * <b>Fluent Client</b> search parameter constant for <b>name</b>
6232   * <p>
6233   * Description: <b>The actual name</b><br>
6234   * Type: <b>string</b><br>
6235   * Path: <b>SubstanceDefinition.name.name</b><br>
6236   * </p>
6237   */
6238  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
6239
6240
6241}
6242