001package org.hl7.fhir.r4.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.r4
006 * %%
007 * Copyright (C) 2014 - 2019 Health Level 7
008 * %%
009 * Licensed under the Apache License, Version 2.0 (the "License");
010 * you may not use this file except in compliance with the License.
011 * You may obtain a copy of the License at
012 * 
013 *      http://www.apache.org/licenses/LICENSE-2.0
014 * 
015 * Unless required by applicable law or agreed to in writing, software
016 * distributed under the License is distributed on an "AS IS" BASIS,
017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018 * See the License for the specific language governing permissions and
019 * limitations under the License.
020 * #L%
021 */
022
023/*
024  Copyright (c) 2011+, HL7, Inc.
025  All rights reserved.
026  
027  Redistribution and use in source and binary forms, with or without modification, 
028  are permitted provided that the following conditions are met:
029  
030   * Redistributions of source code must retain the above copyright notice, this 
031     list of conditions and the following disclaimer.
032   * Redistributions in binary form must reproduce the above copyright notice, 
033     this list of conditions and the following disclaimer in the documentation 
034     and/or other materials provided with the distribution.
035   * Neither the name of HL7 nor the names of its contributors may be used to 
036     endorse or promote products derived from this software without specific 
037     prior written permission.
038  
039  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
040  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
041  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
042  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
043  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
044  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
045  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
046  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
047  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
048  POSSIBILITY OF SUCH DAMAGE.
049  
050*/
051
052// Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0
053import java.util.ArrayList;
054import java.util.List;
055
056import org.hl7.fhir.exceptions.FHIRException;
057import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
058import org.hl7.fhir.utilities.Utilities;
059
060import ca.uhn.fhir.model.api.annotation.Block;
061import ca.uhn.fhir.model.api.annotation.Child;
062import ca.uhn.fhir.model.api.annotation.Description;
063import ca.uhn.fhir.model.api.annotation.ResourceDef;
064/**
065 * Todo.
066 */
067@ResourceDef(name="SubstanceReferenceInformation", profile="http://hl7.org/fhir/StructureDefinition/SubstanceReferenceInformation")
068public class SubstanceReferenceInformation extends DomainResource {
069
070    @Block()
071    public static class SubstanceReferenceInformationGeneComponent extends BackboneElement implements IBaseBackboneElement {
072        /**
073         * Todo.
074         */
075        @Child(name = "geneSequenceOrigin", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
076        @Description(shortDefinition="Todo", formalDefinition="Todo." )
077        protected CodeableConcept geneSequenceOrigin;
078
079        /**
080         * Todo.
081         */
082        @Child(name = "gene", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
083        @Description(shortDefinition="Todo", formalDefinition="Todo." )
084        protected CodeableConcept gene;
085
086        /**
087         * Todo.
088         */
089        @Child(name = "source", type = {DocumentReference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
090        @Description(shortDefinition="Todo", formalDefinition="Todo." )
091        protected List<Reference> source;
092        /**
093         * The actual objects that are the target of the reference (Todo.)
094         */
095        protected List<DocumentReference> sourceTarget;
096
097
098        private static final long serialVersionUID = 1615185105L;
099
100    /**
101     * Constructor
102     */
103      public SubstanceReferenceInformationGeneComponent() {
104        super();
105      }
106
107        /**
108         * @return {@link #geneSequenceOrigin} (Todo.)
109         */
110        public CodeableConcept getGeneSequenceOrigin() { 
111          if (this.geneSequenceOrigin == null)
112            if (Configuration.errorOnAutoCreate())
113              throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneComponent.geneSequenceOrigin");
114            else if (Configuration.doAutoCreate())
115              this.geneSequenceOrigin = new CodeableConcept(); // cc
116          return this.geneSequenceOrigin;
117        }
118
119        public boolean hasGeneSequenceOrigin() { 
120          return this.geneSequenceOrigin != null && !this.geneSequenceOrigin.isEmpty();
121        }
122
123        /**
124         * @param value {@link #geneSequenceOrigin} (Todo.)
125         */
126        public SubstanceReferenceInformationGeneComponent setGeneSequenceOrigin(CodeableConcept value) { 
127          this.geneSequenceOrigin = value;
128          return this;
129        }
130
131        /**
132         * @return {@link #gene} (Todo.)
133         */
134        public CodeableConcept getGene() { 
135          if (this.gene == null)
136            if (Configuration.errorOnAutoCreate())
137              throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneComponent.gene");
138            else if (Configuration.doAutoCreate())
139              this.gene = new CodeableConcept(); // cc
140          return this.gene;
141        }
142
143        public boolean hasGene() { 
144          return this.gene != null && !this.gene.isEmpty();
145        }
146
147        /**
148         * @param value {@link #gene} (Todo.)
149         */
150        public SubstanceReferenceInformationGeneComponent setGene(CodeableConcept value) { 
151          this.gene = value;
152          return this;
153        }
154
155        /**
156         * @return {@link #source} (Todo.)
157         */
158        public List<Reference> getSource() { 
159          if (this.source == null)
160            this.source = new ArrayList<Reference>();
161          return this.source;
162        }
163
164        /**
165         * @return Returns a reference to <code>this</code> for easy method chaining
166         */
167        public SubstanceReferenceInformationGeneComponent setSource(List<Reference> theSource) { 
168          this.source = theSource;
169          return this;
170        }
171
172        public boolean hasSource() { 
173          if (this.source == null)
174            return false;
175          for (Reference item : this.source)
176            if (!item.isEmpty())
177              return true;
178          return false;
179        }
180
181        public Reference addSource() { //3
182          Reference t = new Reference();
183          if (this.source == null)
184            this.source = new ArrayList<Reference>();
185          this.source.add(t);
186          return t;
187        }
188
189        public SubstanceReferenceInformationGeneComponent addSource(Reference t) { //3
190          if (t == null)
191            return this;
192          if (this.source == null)
193            this.source = new ArrayList<Reference>();
194          this.source.add(t);
195          return this;
196        }
197
198        /**
199         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist
200         */
201        public Reference getSourceFirstRep() { 
202          if (getSource().isEmpty()) {
203            addSource();
204          }
205          return getSource().get(0);
206        }
207
208        /**
209         * @deprecated Use Reference#setResource(IBaseResource) instead
210         */
211        @Deprecated
212        public List<DocumentReference> getSourceTarget() { 
213          if (this.sourceTarget == null)
214            this.sourceTarget = new ArrayList<DocumentReference>();
215          return this.sourceTarget;
216        }
217
218        /**
219         * @deprecated Use Reference#setResource(IBaseResource) instead
220         */
221        @Deprecated
222        public DocumentReference addSourceTarget() { 
223          DocumentReference r = new DocumentReference();
224          if (this.sourceTarget == null)
225            this.sourceTarget = new ArrayList<DocumentReference>();
226          this.sourceTarget.add(r);
227          return r;
228        }
229
230        protected void listChildren(List<Property> children) {
231          super.listChildren(children);
232          children.add(new Property("geneSequenceOrigin", "CodeableConcept", "Todo.", 0, 1, geneSequenceOrigin));
233          children.add(new Property("gene", "CodeableConcept", "Todo.", 0, 1, gene));
234          children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source));
235        }
236
237        @Override
238        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
239          switch (_hash) {
240          case -1089463108: /*geneSequenceOrigin*/  return new Property("geneSequenceOrigin", "CodeableConcept", "Todo.", 0, 1, geneSequenceOrigin);
241          case 3169045: /*gene*/  return new Property("gene", "CodeableConcept", "Todo.", 0, 1, gene);
242          case -896505829: /*source*/  return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source);
243          default: return super.getNamedProperty(_hash, _name, _checkValid);
244          }
245
246        }
247
248      @Override
249      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
250        switch (hash) {
251        case -1089463108: /*geneSequenceOrigin*/ return this.geneSequenceOrigin == null ? new Base[0] : new Base[] {this.geneSequenceOrigin}; // CodeableConcept
252        case 3169045: /*gene*/ return this.gene == null ? new Base[0] : new Base[] {this.gene}; // CodeableConcept
253        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference
254        default: return super.getProperty(hash, name, checkValid);
255        }
256
257      }
258
259      @Override
260      public Base setProperty(int hash, String name, Base value) throws FHIRException {
261        switch (hash) {
262        case -1089463108: // geneSequenceOrigin
263          this.geneSequenceOrigin = castToCodeableConcept(value); // CodeableConcept
264          return value;
265        case 3169045: // gene
266          this.gene = castToCodeableConcept(value); // CodeableConcept
267          return value;
268        case -896505829: // source
269          this.getSource().add(castToReference(value)); // Reference
270          return value;
271        default: return super.setProperty(hash, name, value);
272        }
273
274      }
275
276      @Override
277      public Base setProperty(String name, Base value) throws FHIRException {
278        if (name.equals("geneSequenceOrigin")) {
279          this.geneSequenceOrigin = castToCodeableConcept(value); // CodeableConcept
280        } else if (name.equals("gene")) {
281          this.gene = castToCodeableConcept(value); // CodeableConcept
282        } else if (name.equals("source")) {
283          this.getSource().add(castToReference(value));
284        } else
285          return super.setProperty(name, value);
286        return value;
287      }
288
289      @Override
290      public Base makeProperty(int hash, String name) throws FHIRException {
291        switch (hash) {
292        case -1089463108:  return getGeneSequenceOrigin(); 
293        case 3169045:  return getGene(); 
294        case -896505829:  return addSource(); 
295        default: return super.makeProperty(hash, name);
296        }
297
298      }
299
300      @Override
301      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
302        switch (hash) {
303        case -1089463108: /*geneSequenceOrigin*/ return new String[] {"CodeableConcept"};
304        case 3169045: /*gene*/ return new String[] {"CodeableConcept"};
305        case -896505829: /*source*/ return new String[] {"Reference"};
306        default: return super.getTypesForProperty(hash, name);
307        }
308
309      }
310
311      @Override
312      public Base addChild(String name) throws FHIRException {
313        if (name.equals("geneSequenceOrigin")) {
314          this.geneSequenceOrigin = new CodeableConcept();
315          return this.geneSequenceOrigin;
316        }
317        else if (name.equals("gene")) {
318          this.gene = new CodeableConcept();
319          return this.gene;
320        }
321        else if (name.equals("source")) {
322          return addSource();
323        }
324        else
325          return super.addChild(name);
326      }
327
328      public SubstanceReferenceInformationGeneComponent copy() {
329        SubstanceReferenceInformationGeneComponent dst = new SubstanceReferenceInformationGeneComponent();
330        copyValues(dst);
331        dst.geneSequenceOrigin = geneSequenceOrigin == null ? null : geneSequenceOrigin.copy();
332        dst.gene = gene == null ? null : gene.copy();
333        if (source != null) {
334          dst.source = new ArrayList<Reference>();
335          for (Reference i : source)
336            dst.source.add(i.copy());
337        };
338        return dst;
339      }
340
341      @Override
342      public boolean equalsDeep(Base other_) {
343        if (!super.equalsDeep(other_))
344          return false;
345        if (!(other_ instanceof SubstanceReferenceInformationGeneComponent))
346          return false;
347        SubstanceReferenceInformationGeneComponent o = (SubstanceReferenceInformationGeneComponent) other_;
348        return compareDeep(geneSequenceOrigin, o.geneSequenceOrigin, true) && compareDeep(gene, o.gene, true)
349           && compareDeep(source, o.source, true);
350      }
351
352      @Override
353      public boolean equalsShallow(Base other_) {
354        if (!super.equalsShallow(other_))
355          return false;
356        if (!(other_ instanceof SubstanceReferenceInformationGeneComponent))
357          return false;
358        SubstanceReferenceInformationGeneComponent o = (SubstanceReferenceInformationGeneComponent) other_;
359        return true;
360      }
361
362      public boolean isEmpty() {
363        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(geneSequenceOrigin, gene, source
364          );
365      }
366
367  public String fhirType() {
368    return "SubstanceReferenceInformation.gene";
369
370  }
371
372  }
373
374    @Block()
375    public static class SubstanceReferenceInformationGeneElementComponent extends BackboneElement implements IBaseBackboneElement {
376        /**
377         * Todo.
378         */
379        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
380        @Description(shortDefinition="Todo", formalDefinition="Todo." )
381        protected CodeableConcept type;
382
383        /**
384         * Todo.
385         */
386        @Child(name = "element", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=true)
387        @Description(shortDefinition="Todo", formalDefinition="Todo." )
388        protected Identifier element;
389
390        /**
391         * Todo.
392         */
393        @Child(name = "source", type = {DocumentReference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
394        @Description(shortDefinition="Todo", formalDefinition="Todo." )
395        protected List<Reference> source;
396        /**
397         * The actual objects that are the target of the reference (Todo.)
398         */
399        protected List<DocumentReference> sourceTarget;
400
401
402        private static final long serialVersionUID = 2055145950L;
403
404    /**
405     * Constructor
406     */
407      public SubstanceReferenceInformationGeneElementComponent() {
408        super();
409      }
410
411        /**
412         * @return {@link #type} (Todo.)
413         */
414        public CodeableConcept getType() { 
415          if (this.type == null)
416            if (Configuration.errorOnAutoCreate())
417              throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneElementComponent.type");
418            else if (Configuration.doAutoCreate())
419              this.type = new CodeableConcept(); // cc
420          return this.type;
421        }
422
423        public boolean hasType() { 
424          return this.type != null && !this.type.isEmpty();
425        }
426
427        /**
428         * @param value {@link #type} (Todo.)
429         */
430        public SubstanceReferenceInformationGeneElementComponent setType(CodeableConcept value) { 
431          this.type = value;
432          return this;
433        }
434
435        /**
436         * @return {@link #element} (Todo.)
437         */
438        public Identifier getElement() { 
439          if (this.element == null)
440            if (Configuration.errorOnAutoCreate())
441              throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneElementComponent.element");
442            else if (Configuration.doAutoCreate())
443              this.element = new Identifier(); // cc
444          return this.element;
445        }
446
447        public boolean hasElement() { 
448          return this.element != null && !this.element.isEmpty();
449        }
450
451        /**
452         * @param value {@link #element} (Todo.)
453         */
454        public SubstanceReferenceInformationGeneElementComponent setElement(Identifier value) { 
455          this.element = value;
456          return this;
457        }
458
459        /**
460         * @return {@link #source} (Todo.)
461         */
462        public List<Reference> getSource() { 
463          if (this.source == null)
464            this.source = new ArrayList<Reference>();
465          return this.source;
466        }
467
468        /**
469         * @return Returns a reference to <code>this</code> for easy method chaining
470         */
471        public SubstanceReferenceInformationGeneElementComponent setSource(List<Reference> theSource) { 
472          this.source = theSource;
473          return this;
474        }
475
476        public boolean hasSource() { 
477          if (this.source == null)
478            return false;
479          for (Reference item : this.source)
480            if (!item.isEmpty())
481              return true;
482          return false;
483        }
484
485        public Reference addSource() { //3
486          Reference t = new Reference();
487          if (this.source == null)
488            this.source = new ArrayList<Reference>();
489          this.source.add(t);
490          return t;
491        }
492
493        public SubstanceReferenceInformationGeneElementComponent addSource(Reference t) { //3
494          if (t == null)
495            return this;
496          if (this.source == null)
497            this.source = new ArrayList<Reference>();
498          this.source.add(t);
499          return this;
500        }
501
502        /**
503         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist
504         */
505        public Reference getSourceFirstRep() { 
506          if (getSource().isEmpty()) {
507            addSource();
508          }
509          return getSource().get(0);
510        }
511
512        /**
513         * @deprecated Use Reference#setResource(IBaseResource) instead
514         */
515        @Deprecated
516        public List<DocumentReference> getSourceTarget() { 
517          if (this.sourceTarget == null)
518            this.sourceTarget = new ArrayList<DocumentReference>();
519          return this.sourceTarget;
520        }
521
522        /**
523         * @deprecated Use Reference#setResource(IBaseResource) instead
524         */
525        @Deprecated
526        public DocumentReference addSourceTarget() { 
527          DocumentReference r = new DocumentReference();
528          if (this.sourceTarget == null)
529            this.sourceTarget = new ArrayList<DocumentReference>();
530          this.sourceTarget.add(r);
531          return r;
532        }
533
534        protected void listChildren(List<Property> children) {
535          super.listChildren(children);
536          children.add(new Property("type", "CodeableConcept", "Todo.", 0, 1, type));
537          children.add(new Property("element", "Identifier", "Todo.", 0, 1, element));
538          children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source));
539        }
540
541        @Override
542        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
543          switch (_hash) {
544          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Todo.", 0, 1, type);
545          case -1662836996: /*element*/  return new Property("element", "Identifier", "Todo.", 0, 1, element);
546          case -896505829: /*source*/  return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source);
547          default: return super.getNamedProperty(_hash, _name, _checkValid);
548          }
549
550        }
551
552      @Override
553      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
554        switch (hash) {
555        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
556        case -1662836996: /*element*/ return this.element == null ? new Base[0] : new Base[] {this.element}; // Identifier
557        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference
558        default: return super.getProperty(hash, name, checkValid);
559        }
560
561      }
562
563      @Override
564      public Base setProperty(int hash, String name, Base value) throws FHIRException {
565        switch (hash) {
566        case 3575610: // type
567          this.type = castToCodeableConcept(value); // CodeableConcept
568          return value;
569        case -1662836996: // element
570          this.element = castToIdentifier(value); // Identifier
571          return value;
572        case -896505829: // source
573          this.getSource().add(castToReference(value)); // Reference
574          return value;
575        default: return super.setProperty(hash, name, value);
576        }
577
578      }
579
580      @Override
581      public Base setProperty(String name, Base value) throws FHIRException {
582        if (name.equals("type")) {
583          this.type = castToCodeableConcept(value); // CodeableConcept
584        } else if (name.equals("element")) {
585          this.element = castToIdentifier(value); // Identifier
586        } else if (name.equals("source")) {
587          this.getSource().add(castToReference(value));
588        } else
589          return super.setProperty(name, value);
590        return value;
591      }
592
593      @Override
594      public Base makeProperty(int hash, String name) throws FHIRException {
595        switch (hash) {
596        case 3575610:  return getType(); 
597        case -1662836996:  return getElement(); 
598        case -896505829:  return addSource(); 
599        default: return super.makeProperty(hash, name);
600        }
601
602      }
603
604      @Override
605      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
606        switch (hash) {
607        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
608        case -1662836996: /*element*/ return new String[] {"Identifier"};
609        case -896505829: /*source*/ return new String[] {"Reference"};
610        default: return super.getTypesForProperty(hash, name);
611        }
612
613      }
614
615      @Override
616      public Base addChild(String name) throws FHIRException {
617        if (name.equals("type")) {
618          this.type = new CodeableConcept();
619          return this.type;
620        }
621        else if (name.equals("element")) {
622          this.element = new Identifier();
623          return this.element;
624        }
625        else if (name.equals("source")) {
626          return addSource();
627        }
628        else
629          return super.addChild(name);
630      }
631
632      public SubstanceReferenceInformationGeneElementComponent copy() {
633        SubstanceReferenceInformationGeneElementComponent dst = new SubstanceReferenceInformationGeneElementComponent();
634        copyValues(dst);
635        dst.type = type == null ? null : type.copy();
636        dst.element = element == null ? null : element.copy();
637        if (source != null) {
638          dst.source = new ArrayList<Reference>();
639          for (Reference i : source)
640            dst.source.add(i.copy());
641        };
642        return dst;
643      }
644
645      @Override
646      public boolean equalsDeep(Base other_) {
647        if (!super.equalsDeep(other_))
648          return false;
649        if (!(other_ instanceof SubstanceReferenceInformationGeneElementComponent))
650          return false;
651        SubstanceReferenceInformationGeneElementComponent o = (SubstanceReferenceInformationGeneElementComponent) other_;
652        return compareDeep(type, o.type, true) && compareDeep(element, o.element, true) && compareDeep(source, o.source, true)
653          ;
654      }
655
656      @Override
657      public boolean equalsShallow(Base other_) {
658        if (!super.equalsShallow(other_))
659          return false;
660        if (!(other_ instanceof SubstanceReferenceInformationGeneElementComponent))
661          return false;
662        SubstanceReferenceInformationGeneElementComponent o = (SubstanceReferenceInformationGeneElementComponent) other_;
663        return true;
664      }
665
666      public boolean isEmpty() {
667        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, element, source);
668      }
669
670  public String fhirType() {
671    return "SubstanceReferenceInformation.geneElement";
672
673  }
674
675  }
676
677    @Block()
678    public static class SubstanceReferenceInformationClassificationComponent extends BackboneElement implements IBaseBackboneElement {
679        /**
680         * Todo.
681         */
682        @Child(name = "domain", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
683        @Description(shortDefinition="Todo", formalDefinition="Todo." )
684        protected CodeableConcept domain;
685
686        /**
687         * Todo.
688         */
689        @Child(name = "classification", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
690        @Description(shortDefinition="Todo", formalDefinition="Todo." )
691        protected CodeableConcept classification;
692
693        /**
694         * Todo.
695         */
696        @Child(name = "subtype", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
697        @Description(shortDefinition="Todo", formalDefinition="Todo." )
698        protected List<CodeableConcept> subtype;
699
700        /**
701         * Todo.
702         */
703        @Child(name = "source", type = {DocumentReference.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
704        @Description(shortDefinition="Todo", formalDefinition="Todo." )
705        protected List<Reference> source;
706        /**
707         * The actual objects that are the target of the reference (Todo.)
708         */
709        protected List<DocumentReference> sourceTarget;
710
711
712        private static final long serialVersionUID = -430084579L;
713
714    /**
715     * Constructor
716     */
717      public SubstanceReferenceInformationClassificationComponent() {
718        super();
719      }
720
721        /**
722         * @return {@link #domain} (Todo.)
723         */
724        public CodeableConcept getDomain() { 
725          if (this.domain == null)
726            if (Configuration.errorOnAutoCreate())
727              throw new Error("Attempt to auto-create SubstanceReferenceInformationClassificationComponent.domain");
728            else if (Configuration.doAutoCreate())
729              this.domain = new CodeableConcept(); // cc
730          return this.domain;
731        }
732
733        public boolean hasDomain() { 
734          return this.domain != null && !this.domain.isEmpty();
735        }
736
737        /**
738         * @param value {@link #domain} (Todo.)
739         */
740        public SubstanceReferenceInformationClassificationComponent setDomain(CodeableConcept value) { 
741          this.domain = value;
742          return this;
743        }
744
745        /**
746         * @return {@link #classification} (Todo.)
747         */
748        public CodeableConcept getClassification() { 
749          if (this.classification == null)
750            if (Configuration.errorOnAutoCreate())
751              throw new Error("Attempt to auto-create SubstanceReferenceInformationClassificationComponent.classification");
752            else if (Configuration.doAutoCreate())
753              this.classification = new CodeableConcept(); // cc
754          return this.classification;
755        }
756
757        public boolean hasClassification() { 
758          return this.classification != null && !this.classification.isEmpty();
759        }
760
761        /**
762         * @param value {@link #classification} (Todo.)
763         */
764        public SubstanceReferenceInformationClassificationComponent setClassification(CodeableConcept value) { 
765          this.classification = value;
766          return this;
767        }
768
769        /**
770         * @return {@link #subtype} (Todo.)
771         */
772        public List<CodeableConcept> getSubtype() { 
773          if (this.subtype == null)
774            this.subtype = new ArrayList<CodeableConcept>();
775          return this.subtype;
776        }
777
778        /**
779         * @return Returns a reference to <code>this</code> for easy method chaining
780         */
781        public SubstanceReferenceInformationClassificationComponent setSubtype(List<CodeableConcept> theSubtype) { 
782          this.subtype = theSubtype;
783          return this;
784        }
785
786        public boolean hasSubtype() { 
787          if (this.subtype == null)
788            return false;
789          for (CodeableConcept item : this.subtype)
790            if (!item.isEmpty())
791              return true;
792          return false;
793        }
794
795        public CodeableConcept addSubtype() { //3
796          CodeableConcept t = new CodeableConcept();
797          if (this.subtype == null)
798            this.subtype = new ArrayList<CodeableConcept>();
799          this.subtype.add(t);
800          return t;
801        }
802
803        public SubstanceReferenceInformationClassificationComponent addSubtype(CodeableConcept t) { //3
804          if (t == null)
805            return this;
806          if (this.subtype == null)
807            this.subtype = new ArrayList<CodeableConcept>();
808          this.subtype.add(t);
809          return this;
810        }
811
812        /**
813         * @return The first repetition of repeating field {@link #subtype}, creating it if it does not already exist
814         */
815        public CodeableConcept getSubtypeFirstRep() { 
816          if (getSubtype().isEmpty()) {
817            addSubtype();
818          }
819          return getSubtype().get(0);
820        }
821
822        /**
823         * @return {@link #source} (Todo.)
824         */
825        public List<Reference> getSource() { 
826          if (this.source == null)
827            this.source = new ArrayList<Reference>();
828          return this.source;
829        }
830
831        /**
832         * @return Returns a reference to <code>this</code> for easy method chaining
833         */
834        public SubstanceReferenceInformationClassificationComponent setSource(List<Reference> theSource) { 
835          this.source = theSource;
836          return this;
837        }
838
839        public boolean hasSource() { 
840          if (this.source == null)
841            return false;
842          for (Reference item : this.source)
843            if (!item.isEmpty())
844              return true;
845          return false;
846        }
847
848        public Reference addSource() { //3
849          Reference t = new Reference();
850          if (this.source == null)
851            this.source = new ArrayList<Reference>();
852          this.source.add(t);
853          return t;
854        }
855
856        public SubstanceReferenceInformationClassificationComponent addSource(Reference t) { //3
857          if (t == null)
858            return this;
859          if (this.source == null)
860            this.source = new ArrayList<Reference>();
861          this.source.add(t);
862          return this;
863        }
864
865        /**
866         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist
867         */
868        public Reference getSourceFirstRep() { 
869          if (getSource().isEmpty()) {
870            addSource();
871          }
872          return getSource().get(0);
873        }
874
875        /**
876         * @deprecated Use Reference#setResource(IBaseResource) instead
877         */
878        @Deprecated
879        public List<DocumentReference> getSourceTarget() { 
880          if (this.sourceTarget == null)
881            this.sourceTarget = new ArrayList<DocumentReference>();
882          return this.sourceTarget;
883        }
884
885        /**
886         * @deprecated Use Reference#setResource(IBaseResource) instead
887         */
888        @Deprecated
889        public DocumentReference addSourceTarget() { 
890          DocumentReference r = new DocumentReference();
891          if (this.sourceTarget == null)
892            this.sourceTarget = new ArrayList<DocumentReference>();
893          this.sourceTarget.add(r);
894          return r;
895        }
896
897        protected void listChildren(List<Property> children) {
898          super.listChildren(children);
899          children.add(new Property("domain", "CodeableConcept", "Todo.", 0, 1, domain));
900          children.add(new Property("classification", "CodeableConcept", "Todo.", 0, 1, classification));
901          children.add(new Property("subtype", "CodeableConcept", "Todo.", 0, java.lang.Integer.MAX_VALUE, subtype));
902          children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source));
903        }
904
905        @Override
906        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
907          switch (_hash) {
908          case -1326197564: /*domain*/  return new Property("domain", "CodeableConcept", "Todo.", 0, 1, domain);
909          case 382350310: /*classification*/  return new Property("classification", "CodeableConcept", "Todo.", 0, 1, classification);
910          case -1867567750: /*subtype*/  return new Property("subtype", "CodeableConcept", "Todo.", 0, java.lang.Integer.MAX_VALUE, subtype);
911          case -896505829: /*source*/  return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source);
912          default: return super.getNamedProperty(_hash, _name, _checkValid);
913          }
914
915        }
916
917      @Override
918      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
919        switch (hash) {
920        case -1326197564: /*domain*/ return this.domain == null ? new Base[0] : new Base[] {this.domain}; // CodeableConcept
921        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : new Base[] {this.classification}; // CodeableConcept
922        case -1867567750: /*subtype*/ return this.subtype == null ? new Base[0] : this.subtype.toArray(new Base[this.subtype.size()]); // CodeableConcept
923        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference
924        default: return super.getProperty(hash, name, checkValid);
925        }
926
927      }
928
929      @Override
930      public Base setProperty(int hash, String name, Base value) throws FHIRException {
931        switch (hash) {
932        case -1326197564: // domain
933          this.domain = castToCodeableConcept(value); // CodeableConcept
934          return value;
935        case 382350310: // classification
936          this.classification = castToCodeableConcept(value); // CodeableConcept
937          return value;
938        case -1867567750: // subtype
939          this.getSubtype().add(castToCodeableConcept(value)); // CodeableConcept
940          return value;
941        case -896505829: // source
942          this.getSource().add(castToReference(value)); // Reference
943          return value;
944        default: return super.setProperty(hash, name, value);
945        }
946
947      }
948
949      @Override
950      public Base setProperty(String name, Base value) throws FHIRException {
951        if (name.equals("domain")) {
952          this.domain = castToCodeableConcept(value); // CodeableConcept
953        } else if (name.equals("classification")) {
954          this.classification = castToCodeableConcept(value); // CodeableConcept
955        } else if (name.equals("subtype")) {
956          this.getSubtype().add(castToCodeableConcept(value));
957        } else if (name.equals("source")) {
958          this.getSource().add(castToReference(value));
959        } else
960          return super.setProperty(name, value);
961        return value;
962      }
963
964      @Override
965      public Base makeProperty(int hash, String name) throws FHIRException {
966        switch (hash) {
967        case -1326197564:  return getDomain(); 
968        case 382350310:  return getClassification(); 
969        case -1867567750:  return addSubtype(); 
970        case -896505829:  return addSource(); 
971        default: return super.makeProperty(hash, name);
972        }
973
974      }
975
976      @Override
977      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
978        switch (hash) {
979        case -1326197564: /*domain*/ return new String[] {"CodeableConcept"};
980        case 382350310: /*classification*/ return new String[] {"CodeableConcept"};
981        case -1867567750: /*subtype*/ return new String[] {"CodeableConcept"};
982        case -896505829: /*source*/ return new String[] {"Reference"};
983        default: return super.getTypesForProperty(hash, name);
984        }
985
986      }
987
988      @Override
989      public Base addChild(String name) throws FHIRException {
990        if (name.equals("domain")) {
991          this.domain = new CodeableConcept();
992          return this.domain;
993        }
994        else if (name.equals("classification")) {
995          this.classification = new CodeableConcept();
996          return this.classification;
997        }
998        else if (name.equals("subtype")) {
999          return addSubtype();
1000        }
1001        else if (name.equals("source")) {
1002          return addSource();
1003        }
1004        else
1005          return super.addChild(name);
1006      }
1007
1008      public SubstanceReferenceInformationClassificationComponent copy() {
1009        SubstanceReferenceInformationClassificationComponent dst = new SubstanceReferenceInformationClassificationComponent();
1010        copyValues(dst);
1011        dst.domain = domain == null ? null : domain.copy();
1012        dst.classification = classification == null ? null : classification.copy();
1013        if (subtype != null) {
1014          dst.subtype = new ArrayList<CodeableConcept>();
1015          for (CodeableConcept i : subtype)
1016            dst.subtype.add(i.copy());
1017        };
1018        if (source != null) {
1019          dst.source = new ArrayList<Reference>();
1020          for (Reference i : source)
1021            dst.source.add(i.copy());
1022        };
1023        return dst;
1024      }
1025
1026      @Override
1027      public boolean equalsDeep(Base other_) {
1028        if (!super.equalsDeep(other_))
1029          return false;
1030        if (!(other_ instanceof SubstanceReferenceInformationClassificationComponent))
1031          return false;
1032        SubstanceReferenceInformationClassificationComponent o = (SubstanceReferenceInformationClassificationComponent) other_;
1033        return compareDeep(domain, o.domain, true) && compareDeep(classification, o.classification, true)
1034           && compareDeep(subtype, o.subtype, true) && compareDeep(source, o.source, true);
1035      }
1036
1037      @Override
1038      public boolean equalsShallow(Base other_) {
1039        if (!super.equalsShallow(other_))
1040          return false;
1041        if (!(other_ instanceof SubstanceReferenceInformationClassificationComponent))
1042          return false;
1043        SubstanceReferenceInformationClassificationComponent o = (SubstanceReferenceInformationClassificationComponent) other_;
1044        return true;
1045      }
1046
1047      public boolean isEmpty() {
1048        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(domain, classification, subtype
1049          , source);
1050      }
1051
1052  public String fhirType() {
1053    return "SubstanceReferenceInformation.classification";
1054
1055  }
1056
1057  }
1058
1059    @Block()
1060    public static class SubstanceReferenceInformationTargetComponent extends BackboneElement implements IBaseBackboneElement {
1061        /**
1062         * Todo.
1063         */
1064        @Child(name = "target", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1065        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1066        protected Identifier target;
1067
1068        /**
1069         * Todo.
1070         */
1071        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1072        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1073        protected CodeableConcept type;
1074
1075        /**
1076         * Todo.
1077         */
1078        @Child(name = "interaction", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1079        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1080        protected CodeableConcept interaction;
1081
1082        /**
1083         * Todo.
1084         */
1085        @Child(name = "organism", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
1086        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1087        protected CodeableConcept organism;
1088
1089        /**
1090         * Todo.
1091         */
1092        @Child(name = "organismType", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
1093        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1094        protected CodeableConcept organismType;
1095
1096        /**
1097         * Todo.
1098         */
1099        @Child(name = "amount", type = {Quantity.class, Range.class, StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1100        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1101        protected Type amount;
1102
1103        /**
1104         * Todo.
1105         */
1106        @Child(name = "amountType", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
1107        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1108        protected CodeableConcept amountType;
1109
1110        /**
1111         * Todo.
1112         */
1113        @Child(name = "source", type = {DocumentReference.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1114        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1115        protected List<Reference> source;
1116        /**
1117         * The actual objects that are the target of the reference (Todo.)
1118         */
1119        protected List<DocumentReference> sourceTarget;
1120
1121
1122        private static final long serialVersionUID = -1682270197L;
1123
1124    /**
1125     * Constructor
1126     */
1127      public SubstanceReferenceInformationTargetComponent() {
1128        super();
1129      }
1130
1131        /**
1132         * @return {@link #target} (Todo.)
1133         */
1134        public Identifier getTarget() { 
1135          if (this.target == null)
1136            if (Configuration.errorOnAutoCreate())
1137              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.target");
1138            else if (Configuration.doAutoCreate())
1139              this.target = new Identifier(); // cc
1140          return this.target;
1141        }
1142
1143        public boolean hasTarget() { 
1144          return this.target != null && !this.target.isEmpty();
1145        }
1146
1147        /**
1148         * @param value {@link #target} (Todo.)
1149         */
1150        public SubstanceReferenceInformationTargetComponent setTarget(Identifier value) { 
1151          this.target = value;
1152          return this;
1153        }
1154
1155        /**
1156         * @return {@link #type} (Todo.)
1157         */
1158        public CodeableConcept getType() { 
1159          if (this.type == null)
1160            if (Configuration.errorOnAutoCreate())
1161              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.type");
1162            else if (Configuration.doAutoCreate())
1163              this.type = new CodeableConcept(); // cc
1164          return this.type;
1165        }
1166
1167        public boolean hasType() { 
1168          return this.type != null && !this.type.isEmpty();
1169        }
1170
1171        /**
1172         * @param value {@link #type} (Todo.)
1173         */
1174        public SubstanceReferenceInformationTargetComponent setType(CodeableConcept value) { 
1175          this.type = value;
1176          return this;
1177        }
1178
1179        /**
1180         * @return {@link #interaction} (Todo.)
1181         */
1182        public CodeableConcept getInteraction() { 
1183          if (this.interaction == null)
1184            if (Configuration.errorOnAutoCreate())
1185              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.interaction");
1186            else if (Configuration.doAutoCreate())
1187              this.interaction = new CodeableConcept(); // cc
1188          return this.interaction;
1189        }
1190
1191        public boolean hasInteraction() { 
1192          return this.interaction != null && !this.interaction.isEmpty();
1193        }
1194
1195        /**
1196         * @param value {@link #interaction} (Todo.)
1197         */
1198        public SubstanceReferenceInformationTargetComponent setInteraction(CodeableConcept value) { 
1199          this.interaction = value;
1200          return this;
1201        }
1202
1203        /**
1204         * @return {@link #organism} (Todo.)
1205         */
1206        public CodeableConcept getOrganism() { 
1207          if (this.organism == null)
1208            if (Configuration.errorOnAutoCreate())
1209              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.organism");
1210            else if (Configuration.doAutoCreate())
1211              this.organism = new CodeableConcept(); // cc
1212          return this.organism;
1213        }
1214
1215        public boolean hasOrganism() { 
1216          return this.organism != null && !this.organism.isEmpty();
1217        }
1218
1219        /**
1220         * @param value {@link #organism} (Todo.)
1221         */
1222        public SubstanceReferenceInformationTargetComponent setOrganism(CodeableConcept value) { 
1223          this.organism = value;
1224          return this;
1225        }
1226
1227        /**
1228         * @return {@link #organismType} (Todo.)
1229         */
1230        public CodeableConcept getOrganismType() { 
1231          if (this.organismType == null)
1232            if (Configuration.errorOnAutoCreate())
1233              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.organismType");
1234            else if (Configuration.doAutoCreate())
1235              this.organismType = new CodeableConcept(); // cc
1236          return this.organismType;
1237        }
1238
1239        public boolean hasOrganismType() { 
1240          return this.organismType != null && !this.organismType.isEmpty();
1241        }
1242
1243        /**
1244         * @param value {@link #organismType} (Todo.)
1245         */
1246        public SubstanceReferenceInformationTargetComponent setOrganismType(CodeableConcept value) { 
1247          this.organismType = value;
1248          return this;
1249        }
1250
1251        /**
1252         * @return {@link #amount} (Todo.)
1253         */
1254        public Type getAmount() { 
1255          return this.amount;
1256        }
1257
1258        /**
1259         * @return {@link #amount} (Todo.)
1260         */
1261        public Quantity getAmountQuantity() throws FHIRException { 
1262          if (this.amount == null)
1263            this.amount = new Quantity();
1264          if (!(this.amount instanceof Quantity))
1265            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.amount.getClass().getName()+" was encountered");
1266          return (Quantity) this.amount;
1267        }
1268
1269        public boolean hasAmountQuantity() { 
1270          return this != null && this.amount instanceof Quantity;
1271        }
1272
1273        /**
1274         * @return {@link #amount} (Todo.)
1275         */
1276        public Range getAmountRange() throws FHIRException { 
1277          if (this.amount == null)
1278            this.amount = new Range();
1279          if (!(this.amount instanceof Range))
1280            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.amount.getClass().getName()+" was encountered");
1281          return (Range) this.amount;
1282        }
1283
1284        public boolean hasAmountRange() { 
1285          return this != null && this.amount instanceof Range;
1286        }
1287
1288        /**
1289         * @return {@link #amount} (Todo.)
1290         */
1291        public StringType getAmountStringType() throws FHIRException { 
1292          if (this.amount == null)
1293            this.amount = new StringType();
1294          if (!(this.amount instanceof StringType))
1295            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.amount.getClass().getName()+" was encountered");
1296          return (StringType) this.amount;
1297        }
1298
1299        public boolean hasAmountStringType() { 
1300          return this != null && this.amount instanceof StringType;
1301        }
1302
1303        public boolean hasAmount() { 
1304          return this.amount != null && !this.amount.isEmpty();
1305        }
1306
1307        /**
1308         * @param value {@link #amount} (Todo.)
1309         */
1310        public SubstanceReferenceInformationTargetComponent setAmount(Type value) { 
1311          if (value != null && !(value instanceof Quantity || value instanceof Range || value instanceof StringType))
1312            throw new Error("Not the right type for SubstanceReferenceInformation.target.amount[x]: "+value.fhirType());
1313          this.amount = value;
1314          return this;
1315        }
1316
1317        /**
1318         * @return {@link #amountType} (Todo.)
1319         */
1320        public CodeableConcept getAmountType() { 
1321          if (this.amountType == null)
1322            if (Configuration.errorOnAutoCreate())
1323              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.amountType");
1324            else if (Configuration.doAutoCreate())
1325              this.amountType = new CodeableConcept(); // cc
1326          return this.amountType;
1327        }
1328
1329        public boolean hasAmountType() { 
1330          return this.amountType != null && !this.amountType.isEmpty();
1331        }
1332
1333        /**
1334         * @param value {@link #amountType} (Todo.)
1335         */
1336        public SubstanceReferenceInformationTargetComponent setAmountType(CodeableConcept value) { 
1337          this.amountType = value;
1338          return this;
1339        }
1340
1341        /**
1342         * @return {@link #source} (Todo.)
1343         */
1344        public List<Reference> getSource() { 
1345          if (this.source == null)
1346            this.source = new ArrayList<Reference>();
1347          return this.source;
1348        }
1349
1350        /**
1351         * @return Returns a reference to <code>this</code> for easy method chaining
1352         */
1353        public SubstanceReferenceInformationTargetComponent setSource(List<Reference> theSource) { 
1354          this.source = theSource;
1355          return this;
1356        }
1357
1358        public boolean hasSource() { 
1359          if (this.source == null)
1360            return false;
1361          for (Reference item : this.source)
1362            if (!item.isEmpty())
1363              return true;
1364          return false;
1365        }
1366
1367        public Reference addSource() { //3
1368          Reference t = new Reference();
1369          if (this.source == null)
1370            this.source = new ArrayList<Reference>();
1371          this.source.add(t);
1372          return t;
1373        }
1374
1375        public SubstanceReferenceInformationTargetComponent addSource(Reference t) { //3
1376          if (t == null)
1377            return this;
1378          if (this.source == null)
1379            this.source = new ArrayList<Reference>();
1380          this.source.add(t);
1381          return this;
1382        }
1383
1384        /**
1385         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist
1386         */
1387        public Reference getSourceFirstRep() { 
1388          if (getSource().isEmpty()) {
1389            addSource();
1390          }
1391          return getSource().get(0);
1392        }
1393
1394        /**
1395         * @deprecated Use Reference#setResource(IBaseResource) instead
1396         */
1397        @Deprecated
1398        public List<DocumentReference> getSourceTarget() { 
1399          if (this.sourceTarget == null)
1400            this.sourceTarget = new ArrayList<DocumentReference>();
1401          return this.sourceTarget;
1402        }
1403
1404        /**
1405         * @deprecated Use Reference#setResource(IBaseResource) instead
1406         */
1407        @Deprecated
1408        public DocumentReference addSourceTarget() { 
1409          DocumentReference r = new DocumentReference();
1410          if (this.sourceTarget == null)
1411            this.sourceTarget = new ArrayList<DocumentReference>();
1412          this.sourceTarget.add(r);
1413          return r;
1414        }
1415
1416        protected void listChildren(List<Property> children) {
1417          super.listChildren(children);
1418          children.add(new Property("target", "Identifier", "Todo.", 0, 1, target));
1419          children.add(new Property("type", "CodeableConcept", "Todo.", 0, 1, type));
1420          children.add(new Property("interaction", "CodeableConcept", "Todo.", 0, 1, interaction));
1421          children.add(new Property("organism", "CodeableConcept", "Todo.", 0, 1, organism));
1422          children.add(new Property("organismType", "CodeableConcept", "Todo.", 0, 1, organismType));
1423          children.add(new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount));
1424          children.add(new Property("amountType", "CodeableConcept", "Todo.", 0, 1, amountType));
1425          children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source));
1426        }
1427
1428        @Override
1429        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1430          switch (_hash) {
1431          case -880905839: /*target*/  return new Property("target", "Identifier", "Todo.", 0, 1, target);
1432          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Todo.", 0, 1, type);
1433          case 1844104722: /*interaction*/  return new Property("interaction", "CodeableConcept", "Todo.", 0, 1, interaction);
1434          case 1316389074: /*organism*/  return new Property("organism", "CodeableConcept", "Todo.", 0, 1, organism);
1435          case 988662572: /*organismType*/  return new Property("organismType", "CodeableConcept", "Todo.", 0, 1, organismType);
1436          case 646780200: /*amount[x]*/  return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount);
1437          case -1413853096: /*amount*/  return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount);
1438          case 1664303363: /*amountQuantity*/  return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount);
1439          case -1223462971: /*amountRange*/  return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount);
1440          case 773651081: /*amountString*/  return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount);
1441          case -1424857166: /*amountType*/  return new Property("amountType", "CodeableConcept", "Todo.", 0, 1, amountType);
1442          case -896505829: /*source*/  return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source);
1443          default: return super.getNamedProperty(_hash, _name, _checkValid);
1444          }
1445
1446        }
1447
1448      @Override
1449      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1450        switch (hash) {
1451        case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Identifier
1452        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1453        case 1844104722: /*interaction*/ return this.interaction == null ? new Base[0] : new Base[] {this.interaction}; // CodeableConcept
1454        case 1316389074: /*organism*/ return this.organism == null ? new Base[0] : new Base[] {this.organism}; // CodeableConcept
1455        case 988662572: /*organismType*/ return this.organismType == null ? new Base[0] : new Base[] {this.organismType}; // CodeableConcept
1456        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Type
1457        case -1424857166: /*amountType*/ return this.amountType == null ? new Base[0] : new Base[] {this.amountType}; // CodeableConcept
1458        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference
1459        default: return super.getProperty(hash, name, checkValid);
1460        }
1461
1462      }
1463
1464      @Override
1465      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1466        switch (hash) {
1467        case -880905839: // target
1468          this.target = castToIdentifier(value); // Identifier
1469          return value;
1470        case 3575610: // type
1471          this.type = castToCodeableConcept(value); // CodeableConcept
1472          return value;
1473        case 1844104722: // interaction
1474          this.interaction = castToCodeableConcept(value); // CodeableConcept
1475          return value;
1476        case 1316389074: // organism
1477          this.organism = castToCodeableConcept(value); // CodeableConcept
1478          return value;
1479        case 988662572: // organismType
1480          this.organismType = castToCodeableConcept(value); // CodeableConcept
1481          return value;
1482        case -1413853096: // amount
1483          this.amount = castToType(value); // Type
1484          return value;
1485        case -1424857166: // amountType
1486          this.amountType = castToCodeableConcept(value); // CodeableConcept
1487          return value;
1488        case -896505829: // source
1489          this.getSource().add(castToReference(value)); // Reference
1490          return value;
1491        default: return super.setProperty(hash, name, value);
1492        }
1493
1494      }
1495
1496      @Override
1497      public Base setProperty(String name, Base value) throws FHIRException {
1498        if (name.equals("target")) {
1499          this.target = castToIdentifier(value); // Identifier
1500        } else if (name.equals("type")) {
1501          this.type = castToCodeableConcept(value); // CodeableConcept
1502        } else if (name.equals("interaction")) {
1503          this.interaction = castToCodeableConcept(value); // CodeableConcept
1504        } else if (name.equals("organism")) {
1505          this.organism = castToCodeableConcept(value); // CodeableConcept
1506        } else if (name.equals("organismType")) {
1507          this.organismType = castToCodeableConcept(value); // CodeableConcept
1508        } else if (name.equals("amount[x]")) {
1509          this.amount = castToType(value); // Type
1510        } else if (name.equals("amountType")) {
1511          this.amountType = castToCodeableConcept(value); // CodeableConcept
1512        } else if (name.equals("source")) {
1513          this.getSource().add(castToReference(value));
1514        } else
1515          return super.setProperty(name, value);
1516        return value;
1517      }
1518
1519      @Override
1520      public Base makeProperty(int hash, String name) throws FHIRException {
1521        switch (hash) {
1522        case -880905839:  return getTarget(); 
1523        case 3575610:  return getType(); 
1524        case 1844104722:  return getInteraction(); 
1525        case 1316389074:  return getOrganism(); 
1526        case 988662572:  return getOrganismType(); 
1527        case 646780200:  return getAmount(); 
1528        case -1413853096:  return getAmount(); 
1529        case -1424857166:  return getAmountType(); 
1530        case -896505829:  return addSource(); 
1531        default: return super.makeProperty(hash, name);
1532        }
1533
1534      }
1535
1536      @Override
1537      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1538        switch (hash) {
1539        case -880905839: /*target*/ return new String[] {"Identifier"};
1540        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1541        case 1844104722: /*interaction*/ return new String[] {"CodeableConcept"};
1542        case 1316389074: /*organism*/ return new String[] {"CodeableConcept"};
1543        case 988662572: /*organismType*/ return new String[] {"CodeableConcept"};
1544        case -1413853096: /*amount*/ return new String[] {"Quantity", "Range", "string"};
1545        case -1424857166: /*amountType*/ return new String[] {"CodeableConcept"};
1546        case -896505829: /*source*/ return new String[] {"Reference"};
1547        default: return super.getTypesForProperty(hash, name);
1548        }
1549
1550      }
1551
1552      @Override
1553      public Base addChild(String name) throws FHIRException {
1554        if (name.equals("target")) {
1555          this.target = new Identifier();
1556          return this.target;
1557        }
1558        else if (name.equals("type")) {
1559          this.type = new CodeableConcept();
1560          return this.type;
1561        }
1562        else if (name.equals("interaction")) {
1563          this.interaction = new CodeableConcept();
1564          return this.interaction;
1565        }
1566        else if (name.equals("organism")) {
1567          this.organism = new CodeableConcept();
1568          return this.organism;
1569        }
1570        else if (name.equals("organismType")) {
1571          this.organismType = new CodeableConcept();
1572          return this.organismType;
1573        }
1574        else if (name.equals("amountQuantity")) {
1575          this.amount = new Quantity();
1576          return this.amount;
1577        }
1578        else if (name.equals("amountRange")) {
1579          this.amount = new Range();
1580          return this.amount;
1581        }
1582        else if (name.equals("amountString")) {
1583          this.amount = new StringType();
1584          return this.amount;
1585        }
1586        else if (name.equals("amountType")) {
1587          this.amountType = new CodeableConcept();
1588          return this.amountType;
1589        }
1590        else if (name.equals("source")) {
1591          return addSource();
1592        }
1593        else
1594          return super.addChild(name);
1595      }
1596
1597      public SubstanceReferenceInformationTargetComponent copy() {
1598        SubstanceReferenceInformationTargetComponent dst = new SubstanceReferenceInformationTargetComponent();
1599        copyValues(dst);
1600        dst.target = target == null ? null : target.copy();
1601        dst.type = type == null ? null : type.copy();
1602        dst.interaction = interaction == null ? null : interaction.copy();
1603        dst.organism = organism == null ? null : organism.copy();
1604        dst.organismType = organismType == null ? null : organismType.copy();
1605        dst.amount = amount == null ? null : amount.copy();
1606        dst.amountType = amountType == null ? null : amountType.copy();
1607        if (source != null) {
1608          dst.source = new ArrayList<Reference>();
1609          for (Reference i : source)
1610            dst.source.add(i.copy());
1611        };
1612        return dst;
1613      }
1614
1615      @Override
1616      public boolean equalsDeep(Base other_) {
1617        if (!super.equalsDeep(other_))
1618          return false;
1619        if (!(other_ instanceof SubstanceReferenceInformationTargetComponent))
1620          return false;
1621        SubstanceReferenceInformationTargetComponent o = (SubstanceReferenceInformationTargetComponent) other_;
1622        return compareDeep(target, o.target, true) && compareDeep(type, o.type, true) && compareDeep(interaction, o.interaction, true)
1623           && compareDeep(organism, o.organism, true) && compareDeep(organismType, o.organismType, true) && compareDeep(amount, o.amount, true)
1624           && compareDeep(amountType, o.amountType, true) && compareDeep(source, o.source, true);
1625      }
1626
1627      @Override
1628      public boolean equalsShallow(Base other_) {
1629        if (!super.equalsShallow(other_))
1630          return false;
1631        if (!(other_ instanceof SubstanceReferenceInformationTargetComponent))
1632          return false;
1633        SubstanceReferenceInformationTargetComponent o = (SubstanceReferenceInformationTargetComponent) other_;
1634        return true;
1635      }
1636
1637      public boolean isEmpty() {
1638        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(target, type, interaction
1639          , organism, organismType, amount, amountType, source);
1640      }
1641
1642  public String fhirType() {
1643    return "SubstanceReferenceInformation.target";
1644
1645  }
1646
1647  }
1648
1649    /**
1650     * Todo.
1651     */
1652    @Child(name = "comment", type = {StringType.class}, order=0, min=0, max=1, modifier=false, summary=true)
1653    @Description(shortDefinition="Todo", formalDefinition="Todo." )
1654    protected StringType comment;
1655
1656    /**
1657     * Todo.
1658     */
1659    @Child(name = "gene", type = {}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1660    @Description(shortDefinition="Todo", formalDefinition="Todo." )
1661    protected List<SubstanceReferenceInformationGeneComponent> gene;
1662
1663    /**
1664     * Todo.
1665     */
1666    @Child(name = "geneElement", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1667    @Description(shortDefinition="Todo", formalDefinition="Todo." )
1668    protected List<SubstanceReferenceInformationGeneElementComponent> geneElement;
1669
1670    /**
1671     * Todo.
1672     */
1673    @Child(name = "classification", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1674    @Description(shortDefinition="Todo", formalDefinition="Todo." )
1675    protected List<SubstanceReferenceInformationClassificationComponent> classification;
1676
1677    /**
1678     * Todo.
1679     */
1680    @Child(name = "target", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1681    @Description(shortDefinition="Todo", formalDefinition="Todo." )
1682    protected List<SubstanceReferenceInformationTargetComponent> target;
1683
1684    private static final long serialVersionUID = 890303332L;
1685
1686  /**
1687   * Constructor
1688   */
1689    public SubstanceReferenceInformation() {
1690      super();
1691    }
1692
1693    /**
1694     * @return {@link #comment} (Todo.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
1695     */
1696    public StringType getCommentElement() { 
1697      if (this.comment == null)
1698        if (Configuration.errorOnAutoCreate())
1699          throw new Error("Attempt to auto-create SubstanceReferenceInformation.comment");
1700        else if (Configuration.doAutoCreate())
1701          this.comment = new StringType(); // bb
1702      return this.comment;
1703    }
1704
1705    public boolean hasCommentElement() { 
1706      return this.comment != null && !this.comment.isEmpty();
1707    }
1708
1709    public boolean hasComment() { 
1710      return this.comment != null && !this.comment.isEmpty();
1711    }
1712
1713    /**
1714     * @param value {@link #comment} (Todo.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
1715     */
1716    public SubstanceReferenceInformation setCommentElement(StringType value) { 
1717      this.comment = value;
1718      return this;
1719    }
1720
1721    /**
1722     * @return Todo.
1723     */
1724    public String getComment() { 
1725      return this.comment == null ? null : this.comment.getValue();
1726    }
1727
1728    /**
1729     * @param value Todo.
1730     */
1731    public SubstanceReferenceInformation setComment(String value) { 
1732      if (Utilities.noString(value))
1733        this.comment = null;
1734      else {
1735        if (this.comment == null)
1736          this.comment = new StringType();
1737        this.comment.setValue(value);
1738      }
1739      return this;
1740    }
1741
1742    /**
1743     * @return {@link #gene} (Todo.)
1744     */
1745    public List<SubstanceReferenceInformationGeneComponent> getGene() { 
1746      if (this.gene == null)
1747        this.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>();
1748      return this.gene;
1749    }
1750
1751    /**
1752     * @return Returns a reference to <code>this</code> for easy method chaining
1753     */
1754    public SubstanceReferenceInformation setGene(List<SubstanceReferenceInformationGeneComponent> theGene) { 
1755      this.gene = theGene;
1756      return this;
1757    }
1758
1759    public boolean hasGene() { 
1760      if (this.gene == null)
1761        return false;
1762      for (SubstanceReferenceInformationGeneComponent item : this.gene)
1763        if (!item.isEmpty())
1764          return true;
1765      return false;
1766    }
1767
1768    public SubstanceReferenceInformationGeneComponent addGene() { //3
1769      SubstanceReferenceInformationGeneComponent t = new SubstanceReferenceInformationGeneComponent();
1770      if (this.gene == null)
1771        this.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>();
1772      this.gene.add(t);
1773      return t;
1774    }
1775
1776    public SubstanceReferenceInformation addGene(SubstanceReferenceInformationGeneComponent t) { //3
1777      if (t == null)
1778        return this;
1779      if (this.gene == null)
1780        this.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>();
1781      this.gene.add(t);
1782      return this;
1783    }
1784
1785    /**
1786     * @return The first repetition of repeating field {@link #gene}, creating it if it does not already exist
1787     */
1788    public SubstanceReferenceInformationGeneComponent getGeneFirstRep() { 
1789      if (getGene().isEmpty()) {
1790        addGene();
1791      }
1792      return getGene().get(0);
1793    }
1794
1795    /**
1796     * @return {@link #geneElement} (Todo.)
1797     */
1798    public List<SubstanceReferenceInformationGeneElementComponent> getGeneElement() { 
1799      if (this.geneElement == null)
1800        this.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>();
1801      return this.geneElement;
1802    }
1803
1804    /**
1805     * @return Returns a reference to <code>this</code> for easy method chaining
1806     */
1807    public SubstanceReferenceInformation setGeneElement(List<SubstanceReferenceInformationGeneElementComponent> theGeneElement) { 
1808      this.geneElement = theGeneElement;
1809      return this;
1810    }
1811
1812    public boolean hasGeneElement() { 
1813      if (this.geneElement == null)
1814        return false;
1815      for (SubstanceReferenceInformationGeneElementComponent item : this.geneElement)
1816        if (!item.isEmpty())
1817          return true;
1818      return false;
1819    }
1820
1821    public SubstanceReferenceInformationGeneElementComponent addGeneElement() { //3
1822      SubstanceReferenceInformationGeneElementComponent t = new SubstanceReferenceInformationGeneElementComponent();
1823      if (this.geneElement == null)
1824        this.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>();
1825      this.geneElement.add(t);
1826      return t;
1827    }
1828
1829    public SubstanceReferenceInformation addGeneElement(SubstanceReferenceInformationGeneElementComponent t) { //3
1830      if (t == null)
1831        return this;
1832      if (this.geneElement == null)
1833        this.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>();
1834      this.geneElement.add(t);
1835      return this;
1836    }
1837
1838    /**
1839     * @return The first repetition of repeating field {@link #geneElement}, creating it if it does not already exist
1840     */
1841    public SubstanceReferenceInformationGeneElementComponent getGeneElementFirstRep() { 
1842      if (getGeneElement().isEmpty()) {
1843        addGeneElement();
1844      }
1845      return getGeneElement().get(0);
1846    }
1847
1848    /**
1849     * @return {@link #classification} (Todo.)
1850     */
1851    public List<SubstanceReferenceInformationClassificationComponent> getClassification() { 
1852      if (this.classification == null)
1853        this.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>();
1854      return this.classification;
1855    }
1856
1857    /**
1858     * @return Returns a reference to <code>this</code> for easy method chaining
1859     */
1860    public SubstanceReferenceInformation setClassification(List<SubstanceReferenceInformationClassificationComponent> theClassification) { 
1861      this.classification = theClassification;
1862      return this;
1863    }
1864
1865    public boolean hasClassification() { 
1866      if (this.classification == null)
1867        return false;
1868      for (SubstanceReferenceInformationClassificationComponent item : this.classification)
1869        if (!item.isEmpty())
1870          return true;
1871      return false;
1872    }
1873
1874    public SubstanceReferenceInformationClassificationComponent addClassification() { //3
1875      SubstanceReferenceInformationClassificationComponent t = new SubstanceReferenceInformationClassificationComponent();
1876      if (this.classification == null)
1877        this.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>();
1878      this.classification.add(t);
1879      return t;
1880    }
1881
1882    public SubstanceReferenceInformation addClassification(SubstanceReferenceInformationClassificationComponent t) { //3
1883      if (t == null)
1884        return this;
1885      if (this.classification == null)
1886        this.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>();
1887      this.classification.add(t);
1888      return this;
1889    }
1890
1891    /**
1892     * @return The first repetition of repeating field {@link #classification}, creating it if it does not already exist
1893     */
1894    public SubstanceReferenceInformationClassificationComponent getClassificationFirstRep() { 
1895      if (getClassification().isEmpty()) {
1896        addClassification();
1897      }
1898      return getClassification().get(0);
1899    }
1900
1901    /**
1902     * @return {@link #target} (Todo.)
1903     */
1904    public List<SubstanceReferenceInformationTargetComponent> getTarget() { 
1905      if (this.target == null)
1906        this.target = new ArrayList<SubstanceReferenceInformationTargetComponent>();
1907      return this.target;
1908    }
1909
1910    /**
1911     * @return Returns a reference to <code>this</code> for easy method chaining
1912     */
1913    public SubstanceReferenceInformation setTarget(List<SubstanceReferenceInformationTargetComponent> theTarget) { 
1914      this.target = theTarget;
1915      return this;
1916    }
1917
1918    public boolean hasTarget() { 
1919      if (this.target == null)
1920        return false;
1921      for (SubstanceReferenceInformationTargetComponent item : this.target)
1922        if (!item.isEmpty())
1923          return true;
1924      return false;
1925    }
1926
1927    public SubstanceReferenceInformationTargetComponent addTarget() { //3
1928      SubstanceReferenceInformationTargetComponent t = new SubstanceReferenceInformationTargetComponent();
1929      if (this.target == null)
1930        this.target = new ArrayList<SubstanceReferenceInformationTargetComponent>();
1931      this.target.add(t);
1932      return t;
1933    }
1934
1935    public SubstanceReferenceInformation addTarget(SubstanceReferenceInformationTargetComponent t) { //3
1936      if (t == null)
1937        return this;
1938      if (this.target == null)
1939        this.target = new ArrayList<SubstanceReferenceInformationTargetComponent>();
1940      this.target.add(t);
1941      return this;
1942    }
1943
1944    /**
1945     * @return The first repetition of repeating field {@link #target}, creating it if it does not already exist
1946     */
1947    public SubstanceReferenceInformationTargetComponent getTargetFirstRep() { 
1948      if (getTarget().isEmpty()) {
1949        addTarget();
1950      }
1951      return getTarget().get(0);
1952    }
1953
1954      protected void listChildren(List<Property> children) {
1955        super.listChildren(children);
1956        children.add(new Property("comment", "string", "Todo.", 0, 1, comment));
1957        children.add(new Property("gene", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, gene));
1958        children.add(new Property("geneElement", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, geneElement));
1959        children.add(new Property("classification", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, classification));
1960        children.add(new Property("target", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, target));
1961      }
1962
1963      @Override
1964      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1965        switch (_hash) {
1966        case 950398559: /*comment*/  return new Property("comment", "string", "Todo.", 0, 1, comment);
1967        case 3169045: /*gene*/  return new Property("gene", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, gene);
1968        case -94918105: /*geneElement*/  return new Property("geneElement", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, geneElement);
1969        case 382350310: /*classification*/  return new Property("classification", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, classification);
1970        case -880905839: /*target*/  return new Property("target", "", "Todo.", 0, java.lang.Integer.MAX_VALUE, target);
1971        default: return super.getNamedProperty(_hash, _name, _checkValid);
1972        }
1973
1974      }
1975
1976      @Override
1977      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1978        switch (hash) {
1979        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
1980        case 3169045: /*gene*/ return this.gene == null ? new Base[0] : this.gene.toArray(new Base[this.gene.size()]); // SubstanceReferenceInformationGeneComponent
1981        case -94918105: /*geneElement*/ return this.geneElement == null ? new Base[0] : this.geneElement.toArray(new Base[this.geneElement.size()]); // SubstanceReferenceInformationGeneElementComponent
1982        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : this.classification.toArray(new Base[this.classification.size()]); // SubstanceReferenceInformationClassificationComponent
1983        case -880905839: /*target*/ return this.target == null ? new Base[0] : this.target.toArray(new Base[this.target.size()]); // SubstanceReferenceInformationTargetComponent
1984        default: return super.getProperty(hash, name, checkValid);
1985        }
1986
1987      }
1988
1989      @Override
1990      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1991        switch (hash) {
1992        case 950398559: // comment
1993          this.comment = castToString(value); // StringType
1994          return value;
1995        case 3169045: // gene
1996          this.getGene().add((SubstanceReferenceInformationGeneComponent) value); // SubstanceReferenceInformationGeneComponent
1997          return value;
1998        case -94918105: // geneElement
1999          this.getGeneElement().add((SubstanceReferenceInformationGeneElementComponent) value); // SubstanceReferenceInformationGeneElementComponent
2000          return value;
2001        case 382350310: // classification
2002          this.getClassification().add((SubstanceReferenceInformationClassificationComponent) value); // SubstanceReferenceInformationClassificationComponent
2003          return value;
2004        case -880905839: // target
2005          this.getTarget().add((SubstanceReferenceInformationTargetComponent) value); // SubstanceReferenceInformationTargetComponent
2006          return value;
2007        default: return super.setProperty(hash, name, value);
2008        }
2009
2010      }
2011
2012      @Override
2013      public Base setProperty(String name, Base value) throws FHIRException {
2014        if (name.equals("comment")) {
2015          this.comment = castToString(value); // StringType
2016        } else if (name.equals("gene")) {
2017          this.getGene().add((SubstanceReferenceInformationGeneComponent) value);
2018        } else if (name.equals("geneElement")) {
2019          this.getGeneElement().add((SubstanceReferenceInformationGeneElementComponent) value);
2020        } else if (name.equals("classification")) {
2021          this.getClassification().add((SubstanceReferenceInformationClassificationComponent) value);
2022        } else if (name.equals("target")) {
2023          this.getTarget().add((SubstanceReferenceInformationTargetComponent) value);
2024        } else
2025          return super.setProperty(name, value);
2026        return value;
2027      }
2028
2029      @Override
2030      public Base makeProperty(int hash, String name) throws FHIRException {
2031        switch (hash) {
2032        case 950398559:  return getCommentElement();
2033        case 3169045:  return addGene(); 
2034        case -94918105:  return addGeneElement(); 
2035        case 382350310:  return addClassification(); 
2036        case -880905839:  return addTarget(); 
2037        default: return super.makeProperty(hash, name);
2038        }
2039
2040      }
2041
2042      @Override
2043      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2044        switch (hash) {
2045        case 950398559: /*comment*/ return new String[] {"string"};
2046        case 3169045: /*gene*/ return new String[] {};
2047        case -94918105: /*geneElement*/ return new String[] {};
2048        case 382350310: /*classification*/ return new String[] {};
2049        case -880905839: /*target*/ return new String[] {};
2050        default: return super.getTypesForProperty(hash, name);
2051        }
2052
2053      }
2054
2055      @Override
2056      public Base addChild(String name) throws FHIRException {
2057        if (name.equals("comment")) {
2058          throw new FHIRException("Cannot call addChild on a primitive type SubstanceReferenceInformation.comment");
2059        }
2060        else if (name.equals("gene")) {
2061          return addGene();
2062        }
2063        else if (name.equals("geneElement")) {
2064          return addGeneElement();
2065        }
2066        else if (name.equals("classification")) {
2067          return addClassification();
2068        }
2069        else if (name.equals("target")) {
2070          return addTarget();
2071        }
2072        else
2073          return super.addChild(name);
2074      }
2075
2076  public String fhirType() {
2077    return "SubstanceReferenceInformation";
2078
2079  }
2080
2081      public SubstanceReferenceInformation copy() {
2082        SubstanceReferenceInformation dst = new SubstanceReferenceInformation();
2083        copyValues(dst);
2084        dst.comment = comment == null ? null : comment.copy();
2085        if (gene != null) {
2086          dst.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>();
2087          for (SubstanceReferenceInformationGeneComponent i : gene)
2088            dst.gene.add(i.copy());
2089        };
2090        if (geneElement != null) {
2091          dst.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>();
2092          for (SubstanceReferenceInformationGeneElementComponent i : geneElement)
2093            dst.geneElement.add(i.copy());
2094        };
2095        if (classification != null) {
2096          dst.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>();
2097          for (SubstanceReferenceInformationClassificationComponent i : classification)
2098            dst.classification.add(i.copy());
2099        };
2100        if (target != null) {
2101          dst.target = new ArrayList<SubstanceReferenceInformationTargetComponent>();
2102          for (SubstanceReferenceInformationTargetComponent i : target)
2103            dst.target.add(i.copy());
2104        };
2105        return dst;
2106      }
2107
2108      protected SubstanceReferenceInformation typedCopy() {
2109        return copy();
2110      }
2111
2112      @Override
2113      public boolean equalsDeep(Base other_) {
2114        if (!super.equalsDeep(other_))
2115          return false;
2116        if (!(other_ instanceof SubstanceReferenceInformation))
2117          return false;
2118        SubstanceReferenceInformation o = (SubstanceReferenceInformation) other_;
2119        return compareDeep(comment, o.comment, true) && compareDeep(gene, o.gene, true) && compareDeep(geneElement, o.geneElement, true)
2120           && compareDeep(classification, o.classification, true) && compareDeep(target, o.target, true);
2121      }
2122
2123      @Override
2124      public boolean equalsShallow(Base other_) {
2125        if (!super.equalsShallow(other_))
2126          return false;
2127        if (!(other_ instanceof SubstanceReferenceInformation))
2128          return false;
2129        SubstanceReferenceInformation o = (SubstanceReferenceInformation) other_;
2130        return compareValues(comment, o.comment, true);
2131      }
2132
2133      public boolean isEmpty() {
2134        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(comment, gene, geneElement
2135          , classification, target);
2136      }
2137
2138  @Override
2139  public ResourceType getResourceType() {
2140    return ResourceType.SubstanceReferenceInformation;
2141   }
2142
2143
2144}
2145