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