001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * Todo.
050 */
051@ResourceDef(name="SubstanceReferenceInformation", profile="http://hl7.org/fhir/StructureDefinition/SubstanceReferenceInformation")
052public class SubstanceReferenceInformation extends DomainResource {
053
054    @Block()
055    public static class SubstanceReferenceInformationGeneComponent extends BackboneElement implements IBaseBackboneElement {
056        /**
057         * Todo.
058         */
059        @Child(name = "geneSequenceOrigin", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
060        @Description(shortDefinition="Todo", formalDefinition="Todo." )
061        protected CodeableConcept geneSequenceOrigin;
062
063        /**
064         * Todo.
065         */
066        @Child(name = "gene", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
067        @Description(shortDefinition="Todo", formalDefinition="Todo." )
068        protected CodeableConcept gene;
069
070        /**
071         * Todo.
072         */
073        @Child(name = "source", type = {DocumentReference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
074        @Description(shortDefinition="Todo", formalDefinition="Todo." )
075        protected List<Reference> source;
076        /**
077         * The actual objects that are the target of the reference (Todo.)
078         */
079        protected List<DocumentReference> sourceTarget;
080
081
082        private static final long serialVersionUID = 1615185105L;
083
084    /**
085     * Constructor
086     */
087      public SubstanceReferenceInformationGeneComponent() {
088        super();
089      }
090
091        /**
092         * @return {@link #geneSequenceOrigin} (Todo.)
093         */
094        public CodeableConcept getGeneSequenceOrigin() { 
095          if (this.geneSequenceOrigin == null)
096            if (Configuration.errorOnAutoCreate())
097              throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneComponent.geneSequenceOrigin");
098            else if (Configuration.doAutoCreate())
099              this.geneSequenceOrigin = new CodeableConcept(); // cc
100          return this.geneSequenceOrigin;
101        }
102
103        public boolean hasGeneSequenceOrigin() { 
104          return this.geneSequenceOrigin != null && !this.geneSequenceOrigin.isEmpty();
105        }
106
107        /**
108         * @param value {@link #geneSequenceOrigin} (Todo.)
109         */
110        public SubstanceReferenceInformationGeneComponent setGeneSequenceOrigin(CodeableConcept value) { 
111          this.geneSequenceOrigin = value;
112          return this;
113        }
114
115        /**
116         * @return {@link #gene} (Todo.)
117         */
118        public CodeableConcept getGene() { 
119          if (this.gene == null)
120            if (Configuration.errorOnAutoCreate())
121              throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneComponent.gene");
122            else if (Configuration.doAutoCreate())
123              this.gene = new CodeableConcept(); // cc
124          return this.gene;
125        }
126
127        public boolean hasGene() { 
128          return this.gene != null && !this.gene.isEmpty();
129        }
130
131        /**
132         * @param value {@link #gene} (Todo.)
133         */
134        public SubstanceReferenceInformationGeneComponent setGene(CodeableConcept value) { 
135          this.gene = value;
136          return this;
137        }
138
139        /**
140         * @return {@link #source} (Todo.)
141         */
142        public List<Reference> getSource() { 
143          if (this.source == null)
144            this.source = new ArrayList<Reference>();
145          return this.source;
146        }
147
148        /**
149         * @return Returns a reference to <code>this</code> for easy method chaining
150         */
151        public SubstanceReferenceInformationGeneComponent setSource(List<Reference> theSource) { 
152          this.source = theSource;
153          return this;
154        }
155
156        public boolean hasSource() { 
157          if (this.source == null)
158            return false;
159          for (Reference item : this.source)
160            if (!item.isEmpty())
161              return true;
162          return false;
163        }
164
165        public Reference addSource() { //3
166          Reference t = new Reference();
167          if (this.source == null)
168            this.source = new ArrayList<Reference>();
169          this.source.add(t);
170          return t;
171        }
172
173        public SubstanceReferenceInformationGeneComponent addSource(Reference t) { //3
174          if (t == null)
175            return this;
176          if (this.source == null)
177            this.source = new ArrayList<Reference>();
178          this.source.add(t);
179          return this;
180        }
181
182        /**
183         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist
184         */
185        public Reference getSourceFirstRep() { 
186          if (getSource().isEmpty()) {
187            addSource();
188          }
189          return getSource().get(0);
190        }
191
192        /**
193         * @deprecated Use Reference#setResource(IBaseResource) instead
194         */
195        @Deprecated
196        public List<DocumentReference> getSourceTarget() { 
197          if (this.sourceTarget == null)
198            this.sourceTarget = new ArrayList<DocumentReference>();
199          return this.sourceTarget;
200        }
201
202        /**
203         * @deprecated Use Reference#setResource(IBaseResource) instead
204         */
205        @Deprecated
206        public DocumentReference addSourceTarget() { 
207          DocumentReference r = new DocumentReference();
208          if (this.sourceTarget == null)
209            this.sourceTarget = new ArrayList<DocumentReference>();
210          this.sourceTarget.add(r);
211          return r;
212        }
213
214        protected void listChildren(List<Property> children) {
215          super.listChildren(children);
216          children.add(new Property("geneSequenceOrigin", "CodeableConcept", "Todo.", 0, 1, geneSequenceOrigin));
217          children.add(new Property("gene", "CodeableConcept", "Todo.", 0, 1, gene));
218          children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source));
219        }
220
221        @Override
222        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
223          switch (_hash) {
224          case -1089463108: /*geneSequenceOrigin*/  return new Property("geneSequenceOrigin", "CodeableConcept", "Todo.", 0, 1, geneSequenceOrigin);
225          case 3169045: /*gene*/  return new Property("gene", "CodeableConcept", "Todo.", 0, 1, gene);
226          case -896505829: /*source*/  return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source);
227          default: return super.getNamedProperty(_hash, _name, _checkValid);
228          }
229
230        }
231
232      @Override
233      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
234        switch (hash) {
235        case -1089463108: /*geneSequenceOrigin*/ return this.geneSequenceOrigin == null ? new Base[0] : new Base[] {this.geneSequenceOrigin}; // CodeableConcept
236        case 3169045: /*gene*/ return this.gene == null ? new Base[0] : new Base[] {this.gene}; // CodeableConcept
237        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference
238        default: return super.getProperty(hash, name, checkValid);
239        }
240
241      }
242
243      @Override
244      public Base setProperty(int hash, String name, Base value) throws FHIRException {
245        switch (hash) {
246        case -1089463108: // geneSequenceOrigin
247          this.geneSequenceOrigin = castToCodeableConcept(value); // CodeableConcept
248          return value;
249        case 3169045: // gene
250          this.gene = castToCodeableConcept(value); // CodeableConcept
251          return value;
252        case -896505829: // source
253          this.getSource().add(castToReference(value)); // Reference
254          return value;
255        default: return super.setProperty(hash, name, value);
256        }
257
258      }
259
260      @Override
261      public Base setProperty(String name, Base value) throws FHIRException {
262        if (name.equals("geneSequenceOrigin")) {
263          this.geneSequenceOrigin = castToCodeableConcept(value); // CodeableConcept
264        } else if (name.equals("gene")) {
265          this.gene = castToCodeableConcept(value); // CodeableConcept
266        } else if (name.equals("source")) {
267          this.getSource().add(castToReference(value));
268        } else
269          return super.setProperty(name, value);
270        return value;
271      }
272
273      @Override
274      public Base makeProperty(int hash, String name) throws FHIRException {
275        switch (hash) {
276        case -1089463108:  return getGeneSequenceOrigin(); 
277        case 3169045:  return getGene(); 
278        case -896505829:  return addSource(); 
279        default: return super.makeProperty(hash, name);
280        }
281
282      }
283
284      @Override
285      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
286        switch (hash) {
287        case -1089463108: /*geneSequenceOrigin*/ return new String[] {"CodeableConcept"};
288        case 3169045: /*gene*/ return new String[] {"CodeableConcept"};
289        case -896505829: /*source*/ return new String[] {"Reference"};
290        default: return super.getTypesForProperty(hash, name);
291        }
292
293      }
294
295      @Override
296      public Base addChild(String name) throws FHIRException {
297        if (name.equals("geneSequenceOrigin")) {
298          this.geneSequenceOrigin = new CodeableConcept();
299          return this.geneSequenceOrigin;
300        }
301        else if (name.equals("gene")) {
302          this.gene = new CodeableConcept();
303          return this.gene;
304        }
305        else if (name.equals("source")) {
306          return addSource();
307        }
308        else
309          return super.addChild(name);
310      }
311
312      public SubstanceReferenceInformationGeneComponent copy() {
313        SubstanceReferenceInformationGeneComponent dst = new SubstanceReferenceInformationGeneComponent();
314        copyValues(dst);
315        return dst;
316      }
317
318      public void copyValues(SubstanceReferenceInformationGeneComponent dst) {
319        super.copyValues(dst);
320        dst.geneSequenceOrigin = geneSequenceOrigin == null ? null : geneSequenceOrigin.copy();
321        dst.gene = gene == null ? null : gene.copy();
322        if (source != null) {
323          dst.source = new ArrayList<Reference>();
324          for (Reference i : source)
325            dst.source.add(i.copy());
326        };
327      }
328
329      @Override
330      public boolean equalsDeep(Base other_) {
331        if (!super.equalsDeep(other_))
332          return false;
333        if (!(other_ instanceof SubstanceReferenceInformationGeneComponent))
334          return false;
335        SubstanceReferenceInformationGeneComponent o = (SubstanceReferenceInformationGeneComponent) other_;
336        return compareDeep(geneSequenceOrigin, o.geneSequenceOrigin, true) && compareDeep(gene, o.gene, true)
337           && compareDeep(source, o.source, true);
338      }
339
340      @Override
341      public boolean equalsShallow(Base other_) {
342        if (!super.equalsShallow(other_))
343          return false;
344        if (!(other_ instanceof SubstanceReferenceInformationGeneComponent))
345          return false;
346        SubstanceReferenceInformationGeneComponent o = (SubstanceReferenceInformationGeneComponent) other_;
347        return true;
348      }
349
350      public boolean isEmpty() {
351        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(geneSequenceOrigin, gene, source
352          );
353      }
354
355  public String fhirType() {
356    return "SubstanceReferenceInformation.gene";
357
358  }
359
360  }
361
362    @Block()
363    public static class SubstanceReferenceInformationGeneElementComponent extends BackboneElement implements IBaseBackboneElement {
364        /**
365         * Todo.
366         */
367        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
368        @Description(shortDefinition="Todo", formalDefinition="Todo." )
369        protected CodeableConcept type;
370
371        /**
372         * Todo.
373         */
374        @Child(name = "element", type = {Identifier.class}, order=2, min=0, max=1, modifier=false, summary=true)
375        @Description(shortDefinition="Todo", formalDefinition="Todo." )
376        protected Identifier element;
377
378        /**
379         * Todo.
380         */
381        @Child(name = "source", type = {DocumentReference.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
382        @Description(shortDefinition="Todo", formalDefinition="Todo." )
383        protected List<Reference> source;
384        /**
385         * The actual objects that are the target of the reference (Todo.)
386         */
387        protected List<DocumentReference> sourceTarget;
388
389
390        private static final long serialVersionUID = 2055145950L;
391
392    /**
393     * Constructor
394     */
395      public SubstanceReferenceInformationGeneElementComponent() {
396        super();
397      }
398
399        /**
400         * @return {@link #type} (Todo.)
401         */
402        public CodeableConcept getType() { 
403          if (this.type == null)
404            if (Configuration.errorOnAutoCreate())
405              throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneElementComponent.type");
406            else if (Configuration.doAutoCreate())
407              this.type = new CodeableConcept(); // cc
408          return this.type;
409        }
410
411        public boolean hasType() { 
412          return this.type != null && !this.type.isEmpty();
413        }
414
415        /**
416         * @param value {@link #type} (Todo.)
417         */
418        public SubstanceReferenceInformationGeneElementComponent setType(CodeableConcept value) { 
419          this.type = value;
420          return this;
421        }
422
423        /**
424         * @return {@link #element} (Todo.)
425         */
426        public Identifier getElement() { 
427          if (this.element == null)
428            if (Configuration.errorOnAutoCreate())
429              throw new Error("Attempt to auto-create SubstanceReferenceInformationGeneElementComponent.element");
430            else if (Configuration.doAutoCreate())
431              this.element = new Identifier(); // cc
432          return this.element;
433        }
434
435        public boolean hasElement() { 
436          return this.element != null && !this.element.isEmpty();
437        }
438
439        /**
440         * @param value {@link #element} (Todo.)
441         */
442        public SubstanceReferenceInformationGeneElementComponent setElement(Identifier value) { 
443          this.element = value;
444          return this;
445        }
446
447        /**
448         * @return {@link #source} (Todo.)
449         */
450        public List<Reference> getSource() { 
451          if (this.source == null)
452            this.source = new ArrayList<Reference>();
453          return this.source;
454        }
455
456        /**
457         * @return Returns a reference to <code>this</code> for easy method chaining
458         */
459        public SubstanceReferenceInformationGeneElementComponent setSource(List<Reference> theSource) { 
460          this.source = theSource;
461          return this;
462        }
463
464        public boolean hasSource() { 
465          if (this.source == null)
466            return false;
467          for (Reference item : this.source)
468            if (!item.isEmpty())
469              return true;
470          return false;
471        }
472
473        public Reference addSource() { //3
474          Reference t = new Reference();
475          if (this.source == null)
476            this.source = new ArrayList<Reference>();
477          this.source.add(t);
478          return t;
479        }
480
481        public SubstanceReferenceInformationGeneElementComponent addSource(Reference t) { //3
482          if (t == null)
483            return this;
484          if (this.source == null)
485            this.source = new ArrayList<Reference>();
486          this.source.add(t);
487          return this;
488        }
489
490        /**
491         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist
492         */
493        public Reference getSourceFirstRep() { 
494          if (getSource().isEmpty()) {
495            addSource();
496          }
497          return getSource().get(0);
498        }
499
500        /**
501         * @deprecated Use Reference#setResource(IBaseResource) instead
502         */
503        @Deprecated
504        public List<DocumentReference> getSourceTarget() { 
505          if (this.sourceTarget == null)
506            this.sourceTarget = new ArrayList<DocumentReference>();
507          return this.sourceTarget;
508        }
509
510        /**
511         * @deprecated Use Reference#setResource(IBaseResource) instead
512         */
513        @Deprecated
514        public DocumentReference addSourceTarget() { 
515          DocumentReference r = new DocumentReference();
516          if (this.sourceTarget == null)
517            this.sourceTarget = new ArrayList<DocumentReference>();
518          this.sourceTarget.add(r);
519          return r;
520        }
521
522        protected void listChildren(List<Property> children) {
523          super.listChildren(children);
524          children.add(new Property("type", "CodeableConcept", "Todo.", 0, 1, type));
525          children.add(new Property("element", "Identifier", "Todo.", 0, 1, element));
526          children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source));
527        }
528
529        @Override
530        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
531          switch (_hash) {
532          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Todo.", 0, 1, type);
533          case -1662836996: /*element*/  return new Property("element", "Identifier", "Todo.", 0, 1, element);
534          case -896505829: /*source*/  return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source);
535          default: return super.getNamedProperty(_hash, _name, _checkValid);
536          }
537
538        }
539
540      @Override
541      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
542        switch (hash) {
543        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
544        case -1662836996: /*element*/ return this.element == null ? new Base[0] : new Base[] {this.element}; // Identifier
545        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference
546        default: return super.getProperty(hash, name, checkValid);
547        }
548
549      }
550
551      @Override
552      public Base setProperty(int hash, String name, Base value) throws FHIRException {
553        switch (hash) {
554        case 3575610: // type
555          this.type = castToCodeableConcept(value); // CodeableConcept
556          return value;
557        case -1662836996: // element
558          this.element = castToIdentifier(value); // Identifier
559          return value;
560        case -896505829: // source
561          this.getSource().add(castToReference(value)); // Reference
562          return value;
563        default: return super.setProperty(hash, name, value);
564        }
565
566      }
567
568      @Override
569      public Base setProperty(String name, Base value) throws FHIRException {
570        if (name.equals("type")) {
571          this.type = castToCodeableConcept(value); // CodeableConcept
572        } else if (name.equals("element")) {
573          this.element = castToIdentifier(value); // Identifier
574        } else if (name.equals("source")) {
575          this.getSource().add(castToReference(value));
576        } else
577          return super.setProperty(name, value);
578        return value;
579      }
580
581      @Override
582      public Base makeProperty(int hash, String name) throws FHIRException {
583        switch (hash) {
584        case 3575610:  return getType(); 
585        case -1662836996:  return getElement(); 
586        case -896505829:  return addSource(); 
587        default: return super.makeProperty(hash, name);
588        }
589
590      }
591
592      @Override
593      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
594        switch (hash) {
595        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
596        case -1662836996: /*element*/ return new String[] {"Identifier"};
597        case -896505829: /*source*/ return new String[] {"Reference"};
598        default: return super.getTypesForProperty(hash, name);
599        }
600
601      }
602
603      @Override
604      public Base addChild(String name) throws FHIRException {
605        if (name.equals("type")) {
606          this.type = new CodeableConcept();
607          return this.type;
608        }
609        else if (name.equals("element")) {
610          this.element = new Identifier();
611          return this.element;
612        }
613        else if (name.equals("source")) {
614          return addSource();
615        }
616        else
617          return super.addChild(name);
618      }
619
620      public SubstanceReferenceInformationGeneElementComponent copy() {
621        SubstanceReferenceInformationGeneElementComponent dst = new SubstanceReferenceInformationGeneElementComponent();
622        copyValues(dst);
623        return dst;
624      }
625
626      public void copyValues(SubstanceReferenceInformationGeneElementComponent dst) {
627        super.copyValues(dst);
628        dst.type = type == null ? null : type.copy();
629        dst.element = element == null ? null : element.copy();
630        if (source != null) {
631          dst.source = new ArrayList<Reference>();
632          for (Reference i : source)
633            dst.source.add(i.copy());
634        };
635      }
636
637      @Override
638      public boolean equalsDeep(Base other_) {
639        if (!super.equalsDeep(other_))
640          return false;
641        if (!(other_ instanceof SubstanceReferenceInformationGeneElementComponent))
642          return false;
643        SubstanceReferenceInformationGeneElementComponent o = (SubstanceReferenceInformationGeneElementComponent) other_;
644        return compareDeep(type, o.type, true) && compareDeep(element, o.element, true) && compareDeep(source, o.source, true)
645          ;
646      }
647
648      @Override
649      public boolean equalsShallow(Base other_) {
650        if (!super.equalsShallow(other_))
651          return false;
652        if (!(other_ instanceof SubstanceReferenceInformationGeneElementComponent))
653          return false;
654        SubstanceReferenceInformationGeneElementComponent o = (SubstanceReferenceInformationGeneElementComponent) other_;
655        return true;
656      }
657
658      public boolean isEmpty() {
659        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, element, source);
660      }
661
662  public String fhirType() {
663    return "SubstanceReferenceInformation.geneElement";
664
665  }
666
667  }
668
669    @Block()
670    public static class SubstanceReferenceInformationClassificationComponent extends BackboneElement implements IBaseBackboneElement {
671        /**
672         * Todo.
673         */
674        @Child(name = "domain", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
675        @Description(shortDefinition="Todo", formalDefinition="Todo." )
676        protected CodeableConcept domain;
677
678        /**
679         * Todo.
680         */
681        @Child(name = "classification", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
682        @Description(shortDefinition="Todo", formalDefinition="Todo." )
683        protected CodeableConcept classification;
684
685        /**
686         * Todo.
687         */
688        @Child(name = "subtype", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
689        @Description(shortDefinition="Todo", formalDefinition="Todo." )
690        protected List<CodeableConcept> subtype;
691
692        /**
693         * Todo.
694         */
695        @Child(name = "source", type = {DocumentReference.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
696        @Description(shortDefinition="Todo", formalDefinition="Todo." )
697        protected List<Reference> source;
698        /**
699         * The actual objects that are the target of the reference (Todo.)
700         */
701        protected List<DocumentReference> sourceTarget;
702
703
704        private static final long serialVersionUID = -430084579L;
705
706    /**
707     * Constructor
708     */
709      public SubstanceReferenceInformationClassificationComponent() {
710        super();
711      }
712
713        /**
714         * @return {@link #domain} (Todo.)
715         */
716        public CodeableConcept getDomain() { 
717          if (this.domain == null)
718            if (Configuration.errorOnAutoCreate())
719              throw new Error("Attempt to auto-create SubstanceReferenceInformationClassificationComponent.domain");
720            else if (Configuration.doAutoCreate())
721              this.domain = new CodeableConcept(); // cc
722          return this.domain;
723        }
724
725        public boolean hasDomain() { 
726          return this.domain != null && !this.domain.isEmpty();
727        }
728
729        /**
730         * @param value {@link #domain} (Todo.)
731         */
732        public SubstanceReferenceInformationClassificationComponent setDomain(CodeableConcept value) { 
733          this.domain = value;
734          return this;
735        }
736
737        /**
738         * @return {@link #classification} (Todo.)
739         */
740        public CodeableConcept getClassification() { 
741          if (this.classification == null)
742            if (Configuration.errorOnAutoCreate())
743              throw new Error("Attempt to auto-create SubstanceReferenceInformationClassificationComponent.classification");
744            else if (Configuration.doAutoCreate())
745              this.classification = new CodeableConcept(); // cc
746          return this.classification;
747        }
748
749        public boolean hasClassification() { 
750          return this.classification != null && !this.classification.isEmpty();
751        }
752
753        /**
754         * @param value {@link #classification} (Todo.)
755         */
756        public SubstanceReferenceInformationClassificationComponent setClassification(CodeableConcept value) { 
757          this.classification = value;
758          return this;
759        }
760
761        /**
762         * @return {@link #subtype} (Todo.)
763         */
764        public List<CodeableConcept> getSubtype() { 
765          if (this.subtype == null)
766            this.subtype = new ArrayList<CodeableConcept>();
767          return this.subtype;
768        }
769
770        /**
771         * @return Returns a reference to <code>this</code> for easy method chaining
772         */
773        public SubstanceReferenceInformationClassificationComponent setSubtype(List<CodeableConcept> theSubtype) { 
774          this.subtype = theSubtype;
775          return this;
776        }
777
778        public boolean hasSubtype() { 
779          if (this.subtype == null)
780            return false;
781          for (CodeableConcept item : this.subtype)
782            if (!item.isEmpty())
783              return true;
784          return false;
785        }
786
787        public CodeableConcept addSubtype() { //3
788          CodeableConcept t = new CodeableConcept();
789          if (this.subtype == null)
790            this.subtype = new ArrayList<CodeableConcept>();
791          this.subtype.add(t);
792          return t;
793        }
794
795        public SubstanceReferenceInformationClassificationComponent addSubtype(CodeableConcept t) { //3
796          if (t == null)
797            return this;
798          if (this.subtype == null)
799            this.subtype = new ArrayList<CodeableConcept>();
800          this.subtype.add(t);
801          return this;
802        }
803
804        /**
805         * @return The first repetition of repeating field {@link #subtype}, creating it if it does not already exist
806         */
807        public CodeableConcept getSubtypeFirstRep() { 
808          if (getSubtype().isEmpty()) {
809            addSubtype();
810          }
811          return getSubtype().get(0);
812        }
813
814        /**
815         * @return {@link #source} (Todo.)
816         */
817        public List<Reference> getSource() { 
818          if (this.source == null)
819            this.source = new ArrayList<Reference>();
820          return this.source;
821        }
822
823        /**
824         * @return Returns a reference to <code>this</code> for easy method chaining
825         */
826        public SubstanceReferenceInformationClassificationComponent setSource(List<Reference> theSource) { 
827          this.source = theSource;
828          return this;
829        }
830
831        public boolean hasSource() { 
832          if (this.source == null)
833            return false;
834          for (Reference item : this.source)
835            if (!item.isEmpty())
836              return true;
837          return false;
838        }
839
840        public Reference addSource() { //3
841          Reference t = new Reference();
842          if (this.source == null)
843            this.source = new ArrayList<Reference>();
844          this.source.add(t);
845          return t;
846        }
847
848        public SubstanceReferenceInformationClassificationComponent addSource(Reference t) { //3
849          if (t == null)
850            return this;
851          if (this.source == null)
852            this.source = new ArrayList<Reference>();
853          this.source.add(t);
854          return this;
855        }
856
857        /**
858         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist
859         */
860        public Reference getSourceFirstRep() { 
861          if (getSource().isEmpty()) {
862            addSource();
863          }
864          return getSource().get(0);
865        }
866
867        /**
868         * @deprecated Use Reference#setResource(IBaseResource) instead
869         */
870        @Deprecated
871        public List<DocumentReference> getSourceTarget() { 
872          if (this.sourceTarget == null)
873            this.sourceTarget = new ArrayList<DocumentReference>();
874          return this.sourceTarget;
875        }
876
877        /**
878         * @deprecated Use Reference#setResource(IBaseResource) instead
879         */
880        @Deprecated
881        public DocumentReference addSourceTarget() { 
882          DocumentReference r = new DocumentReference();
883          if (this.sourceTarget == null)
884            this.sourceTarget = new ArrayList<DocumentReference>();
885          this.sourceTarget.add(r);
886          return r;
887        }
888
889        protected void listChildren(List<Property> children) {
890          super.listChildren(children);
891          children.add(new Property("domain", "CodeableConcept", "Todo.", 0, 1, domain));
892          children.add(new Property("classification", "CodeableConcept", "Todo.", 0, 1, classification));
893          children.add(new Property("subtype", "CodeableConcept", "Todo.", 0, java.lang.Integer.MAX_VALUE, subtype));
894          children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source));
895        }
896
897        @Override
898        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
899          switch (_hash) {
900          case -1326197564: /*domain*/  return new Property("domain", "CodeableConcept", "Todo.", 0, 1, domain);
901          case 382350310: /*classification*/  return new Property("classification", "CodeableConcept", "Todo.", 0, 1, classification);
902          case -1867567750: /*subtype*/  return new Property("subtype", "CodeableConcept", "Todo.", 0, java.lang.Integer.MAX_VALUE, subtype);
903          case -896505829: /*source*/  return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source);
904          default: return super.getNamedProperty(_hash, _name, _checkValid);
905          }
906
907        }
908
909      @Override
910      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
911        switch (hash) {
912        case -1326197564: /*domain*/ return this.domain == null ? new Base[0] : new Base[] {this.domain}; // CodeableConcept
913        case 382350310: /*classification*/ return this.classification == null ? new Base[0] : new Base[] {this.classification}; // CodeableConcept
914        case -1867567750: /*subtype*/ return this.subtype == null ? new Base[0] : this.subtype.toArray(new Base[this.subtype.size()]); // CodeableConcept
915        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference
916        default: return super.getProperty(hash, name, checkValid);
917        }
918
919      }
920
921      @Override
922      public Base setProperty(int hash, String name, Base value) throws FHIRException {
923        switch (hash) {
924        case -1326197564: // domain
925          this.domain = castToCodeableConcept(value); // CodeableConcept
926          return value;
927        case 382350310: // classification
928          this.classification = castToCodeableConcept(value); // CodeableConcept
929          return value;
930        case -1867567750: // subtype
931          this.getSubtype().add(castToCodeableConcept(value)); // CodeableConcept
932          return value;
933        case -896505829: // source
934          this.getSource().add(castToReference(value)); // Reference
935          return value;
936        default: return super.setProperty(hash, name, value);
937        }
938
939      }
940
941      @Override
942      public Base setProperty(String name, Base value) throws FHIRException {
943        if (name.equals("domain")) {
944          this.domain = castToCodeableConcept(value); // CodeableConcept
945        } else if (name.equals("classification")) {
946          this.classification = castToCodeableConcept(value); // CodeableConcept
947        } else if (name.equals("subtype")) {
948          this.getSubtype().add(castToCodeableConcept(value));
949        } else if (name.equals("source")) {
950          this.getSource().add(castToReference(value));
951        } else
952          return super.setProperty(name, value);
953        return value;
954      }
955
956      @Override
957      public Base makeProperty(int hash, String name) throws FHIRException {
958        switch (hash) {
959        case -1326197564:  return getDomain(); 
960        case 382350310:  return getClassification(); 
961        case -1867567750:  return addSubtype(); 
962        case -896505829:  return addSource(); 
963        default: return super.makeProperty(hash, name);
964        }
965
966      }
967
968      @Override
969      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
970        switch (hash) {
971        case -1326197564: /*domain*/ return new String[] {"CodeableConcept"};
972        case 382350310: /*classification*/ return new String[] {"CodeableConcept"};
973        case -1867567750: /*subtype*/ return new String[] {"CodeableConcept"};
974        case -896505829: /*source*/ return new String[] {"Reference"};
975        default: return super.getTypesForProperty(hash, name);
976        }
977
978      }
979
980      @Override
981      public Base addChild(String name) throws FHIRException {
982        if (name.equals("domain")) {
983          this.domain = new CodeableConcept();
984          return this.domain;
985        }
986        else if (name.equals("classification")) {
987          this.classification = new CodeableConcept();
988          return this.classification;
989        }
990        else if (name.equals("subtype")) {
991          return addSubtype();
992        }
993        else if (name.equals("source")) {
994          return addSource();
995        }
996        else
997          return super.addChild(name);
998      }
999
1000      public SubstanceReferenceInformationClassificationComponent copy() {
1001        SubstanceReferenceInformationClassificationComponent dst = new SubstanceReferenceInformationClassificationComponent();
1002        copyValues(dst);
1003        return dst;
1004      }
1005
1006      public void copyValues(SubstanceReferenceInformationClassificationComponent dst) {
1007        super.copyValues(dst);
1008        dst.domain = domain == null ? null : domain.copy();
1009        dst.classification = classification == null ? null : classification.copy();
1010        if (subtype != null) {
1011          dst.subtype = new ArrayList<CodeableConcept>();
1012          for (CodeableConcept i : subtype)
1013            dst.subtype.add(i.copy());
1014        };
1015        if (source != null) {
1016          dst.source = new ArrayList<Reference>();
1017          for (Reference i : source)
1018            dst.source.add(i.copy());
1019        };
1020      }
1021
1022      @Override
1023      public boolean equalsDeep(Base other_) {
1024        if (!super.equalsDeep(other_))
1025          return false;
1026        if (!(other_ instanceof SubstanceReferenceInformationClassificationComponent))
1027          return false;
1028        SubstanceReferenceInformationClassificationComponent o = (SubstanceReferenceInformationClassificationComponent) other_;
1029        return compareDeep(domain, o.domain, true) && compareDeep(classification, o.classification, true)
1030           && compareDeep(subtype, o.subtype, true) && compareDeep(source, o.source, true);
1031      }
1032
1033      @Override
1034      public boolean equalsShallow(Base other_) {
1035        if (!super.equalsShallow(other_))
1036          return false;
1037        if (!(other_ instanceof SubstanceReferenceInformationClassificationComponent))
1038          return false;
1039        SubstanceReferenceInformationClassificationComponent o = (SubstanceReferenceInformationClassificationComponent) other_;
1040        return true;
1041      }
1042
1043      public boolean isEmpty() {
1044        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(domain, classification, subtype
1045          , source);
1046      }
1047
1048  public String fhirType() {
1049    return "SubstanceReferenceInformation.classification";
1050
1051  }
1052
1053  }
1054
1055    @Block()
1056    public static class SubstanceReferenceInformationTargetComponent extends BackboneElement implements IBaseBackboneElement {
1057        /**
1058         * Todo.
1059         */
1060        @Child(name = "target", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=true)
1061        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1062        protected Identifier target;
1063
1064        /**
1065         * Todo.
1066         */
1067        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
1068        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1069        protected CodeableConcept type;
1070
1071        /**
1072         * Todo.
1073         */
1074        @Child(name = "interaction", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=true)
1075        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1076        protected CodeableConcept interaction;
1077
1078        /**
1079         * Todo.
1080         */
1081        @Child(name = "organism", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=true)
1082        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1083        protected CodeableConcept organism;
1084
1085        /**
1086         * Todo.
1087         */
1088        @Child(name = "organismType", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
1089        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1090        protected CodeableConcept organismType;
1091
1092        /**
1093         * Todo.
1094         */
1095        @Child(name = "amount", type = {Quantity.class, Range.class, StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1096        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1097        protected Type amount;
1098
1099        /**
1100         * Todo.
1101         */
1102        @Child(name = "amountType", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
1103        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1104        protected CodeableConcept amountType;
1105
1106        /**
1107         * Todo.
1108         */
1109        @Child(name = "source", type = {DocumentReference.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1110        @Description(shortDefinition="Todo", formalDefinition="Todo." )
1111        protected List<Reference> source;
1112        /**
1113         * The actual objects that are the target of the reference (Todo.)
1114         */
1115        protected List<DocumentReference> sourceTarget;
1116
1117
1118        private static final long serialVersionUID = -1682270197L;
1119
1120    /**
1121     * Constructor
1122     */
1123      public SubstanceReferenceInformationTargetComponent() {
1124        super();
1125      }
1126
1127        /**
1128         * @return {@link #target} (Todo.)
1129         */
1130        public Identifier getTarget() { 
1131          if (this.target == null)
1132            if (Configuration.errorOnAutoCreate())
1133              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.target");
1134            else if (Configuration.doAutoCreate())
1135              this.target = new Identifier(); // cc
1136          return this.target;
1137        }
1138
1139        public boolean hasTarget() { 
1140          return this.target != null && !this.target.isEmpty();
1141        }
1142
1143        /**
1144         * @param value {@link #target} (Todo.)
1145         */
1146        public SubstanceReferenceInformationTargetComponent setTarget(Identifier value) { 
1147          this.target = value;
1148          return this;
1149        }
1150
1151        /**
1152         * @return {@link #type} (Todo.)
1153         */
1154        public CodeableConcept getType() { 
1155          if (this.type == null)
1156            if (Configuration.errorOnAutoCreate())
1157              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.type");
1158            else if (Configuration.doAutoCreate())
1159              this.type = new CodeableConcept(); // cc
1160          return this.type;
1161        }
1162
1163        public boolean hasType() { 
1164          return this.type != null && !this.type.isEmpty();
1165        }
1166
1167        /**
1168         * @param value {@link #type} (Todo.)
1169         */
1170        public SubstanceReferenceInformationTargetComponent setType(CodeableConcept value) { 
1171          this.type = value;
1172          return this;
1173        }
1174
1175        /**
1176         * @return {@link #interaction} (Todo.)
1177         */
1178        public CodeableConcept getInteraction() { 
1179          if (this.interaction == null)
1180            if (Configuration.errorOnAutoCreate())
1181              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.interaction");
1182            else if (Configuration.doAutoCreate())
1183              this.interaction = new CodeableConcept(); // cc
1184          return this.interaction;
1185        }
1186
1187        public boolean hasInteraction() { 
1188          return this.interaction != null && !this.interaction.isEmpty();
1189        }
1190
1191        /**
1192         * @param value {@link #interaction} (Todo.)
1193         */
1194        public SubstanceReferenceInformationTargetComponent setInteraction(CodeableConcept value) { 
1195          this.interaction = value;
1196          return this;
1197        }
1198
1199        /**
1200         * @return {@link #organism} (Todo.)
1201         */
1202        public CodeableConcept getOrganism() { 
1203          if (this.organism == null)
1204            if (Configuration.errorOnAutoCreate())
1205              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.organism");
1206            else if (Configuration.doAutoCreate())
1207              this.organism = new CodeableConcept(); // cc
1208          return this.organism;
1209        }
1210
1211        public boolean hasOrganism() { 
1212          return this.organism != null && !this.organism.isEmpty();
1213        }
1214
1215        /**
1216         * @param value {@link #organism} (Todo.)
1217         */
1218        public SubstanceReferenceInformationTargetComponent setOrganism(CodeableConcept value) { 
1219          this.organism = value;
1220          return this;
1221        }
1222
1223        /**
1224         * @return {@link #organismType} (Todo.)
1225         */
1226        public CodeableConcept getOrganismType() { 
1227          if (this.organismType == null)
1228            if (Configuration.errorOnAutoCreate())
1229              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.organismType");
1230            else if (Configuration.doAutoCreate())
1231              this.organismType = new CodeableConcept(); // cc
1232          return this.organismType;
1233        }
1234
1235        public boolean hasOrganismType() { 
1236          return this.organismType != null && !this.organismType.isEmpty();
1237        }
1238
1239        /**
1240         * @param value {@link #organismType} (Todo.)
1241         */
1242        public SubstanceReferenceInformationTargetComponent setOrganismType(CodeableConcept value) { 
1243          this.organismType = value;
1244          return this;
1245        }
1246
1247        /**
1248         * @return {@link #amount} (Todo.)
1249         */
1250        public Type getAmount() { 
1251          return this.amount;
1252        }
1253
1254        /**
1255         * @return {@link #amount} (Todo.)
1256         */
1257        public Quantity getAmountQuantity() throws FHIRException { 
1258          if (this.amount == null)
1259            this.amount = new Quantity();
1260          if (!(this.amount instanceof Quantity))
1261            throw new FHIRException("Type mismatch: the type Quantity was expected, but "+this.amount.getClass().getName()+" was encountered");
1262          return (Quantity) this.amount;
1263        }
1264
1265        public boolean hasAmountQuantity() { 
1266          return this != null && this.amount instanceof Quantity;
1267        }
1268
1269        /**
1270         * @return {@link #amount} (Todo.)
1271         */
1272        public Range getAmountRange() throws FHIRException { 
1273          if (this.amount == null)
1274            this.amount = new Range();
1275          if (!(this.amount instanceof Range))
1276            throw new FHIRException("Type mismatch: the type Range was expected, but "+this.amount.getClass().getName()+" was encountered");
1277          return (Range) this.amount;
1278        }
1279
1280        public boolean hasAmountRange() { 
1281          return this != null && this.amount instanceof Range;
1282        }
1283
1284        /**
1285         * @return {@link #amount} (Todo.)
1286         */
1287        public StringType getAmountStringType() throws FHIRException { 
1288          if (this.amount == null)
1289            this.amount = new StringType();
1290          if (!(this.amount instanceof StringType))
1291            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.amount.getClass().getName()+" was encountered");
1292          return (StringType) this.amount;
1293        }
1294
1295        public boolean hasAmountStringType() { 
1296          return this != null && this.amount instanceof StringType;
1297        }
1298
1299        public boolean hasAmount() { 
1300          return this.amount != null && !this.amount.isEmpty();
1301        }
1302
1303        /**
1304         * @param value {@link #amount} (Todo.)
1305         */
1306        public SubstanceReferenceInformationTargetComponent setAmount(Type value) { 
1307          if (value != null && !(value instanceof Quantity || value instanceof Range || value instanceof StringType))
1308            throw new Error("Not the right type for SubstanceReferenceInformation.target.amount[x]: "+value.fhirType());
1309          this.amount = value;
1310          return this;
1311        }
1312
1313        /**
1314         * @return {@link #amountType} (Todo.)
1315         */
1316        public CodeableConcept getAmountType() { 
1317          if (this.amountType == null)
1318            if (Configuration.errorOnAutoCreate())
1319              throw new Error("Attempt to auto-create SubstanceReferenceInformationTargetComponent.amountType");
1320            else if (Configuration.doAutoCreate())
1321              this.amountType = new CodeableConcept(); // cc
1322          return this.amountType;
1323        }
1324
1325        public boolean hasAmountType() { 
1326          return this.amountType != null && !this.amountType.isEmpty();
1327        }
1328
1329        /**
1330         * @param value {@link #amountType} (Todo.)
1331         */
1332        public SubstanceReferenceInformationTargetComponent setAmountType(CodeableConcept value) { 
1333          this.amountType = value;
1334          return this;
1335        }
1336
1337        /**
1338         * @return {@link #source} (Todo.)
1339         */
1340        public List<Reference> getSource() { 
1341          if (this.source == null)
1342            this.source = new ArrayList<Reference>();
1343          return this.source;
1344        }
1345
1346        /**
1347         * @return Returns a reference to <code>this</code> for easy method chaining
1348         */
1349        public SubstanceReferenceInformationTargetComponent setSource(List<Reference> theSource) { 
1350          this.source = theSource;
1351          return this;
1352        }
1353
1354        public boolean hasSource() { 
1355          if (this.source == null)
1356            return false;
1357          for (Reference item : this.source)
1358            if (!item.isEmpty())
1359              return true;
1360          return false;
1361        }
1362
1363        public Reference addSource() { //3
1364          Reference t = new Reference();
1365          if (this.source == null)
1366            this.source = new ArrayList<Reference>();
1367          this.source.add(t);
1368          return t;
1369        }
1370
1371        public SubstanceReferenceInformationTargetComponent addSource(Reference t) { //3
1372          if (t == null)
1373            return this;
1374          if (this.source == null)
1375            this.source = new ArrayList<Reference>();
1376          this.source.add(t);
1377          return this;
1378        }
1379
1380        /**
1381         * @return The first repetition of repeating field {@link #source}, creating it if it does not already exist
1382         */
1383        public Reference getSourceFirstRep() { 
1384          if (getSource().isEmpty()) {
1385            addSource();
1386          }
1387          return getSource().get(0);
1388        }
1389
1390        /**
1391         * @deprecated Use Reference#setResource(IBaseResource) instead
1392         */
1393        @Deprecated
1394        public List<DocumentReference> getSourceTarget() { 
1395          if (this.sourceTarget == null)
1396            this.sourceTarget = new ArrayList<DocumentReference>();
1397          return this.sourceTarget;
1398        }
1399
1400        /**
1401         * @deprecated Use Reference#setResource(IBaseResource) instead
1402         */
1403        @Deprecated
1404        public DocumentReference addSourceTarget() { 
1405          DocumentReference r = new DocumentReference();
1406          if (this.sourceTarget == null)
1407            this.sourceTarget = new ArrayList<DocumentReference>();
1408          this.sourceTarget.add(r);
1409          return r;
1410        }
1411
1412        protected void listChildren(List<Property> children) {
1413          super.listChildren(children);
1414          children.add(new Property("target", "Identifier", "Todo.", 0, 1, target));
1415          children.add(new Property("type", "CodeableConcept", "Todo.", 0, 1, type));
1416          children.add(new Property("interaction", "CodeableConcept", "Todo.", 0, 1, interaction));
1417          children.add(new Property("organism", "CodeableConcept", "Todo.", 0, 1, organism));
1418          children.add(new Property("organismType", "CodeableConcept", "Todo.", 0, 1, organismType));
1419          children.add(new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount));
1420          children.add(new Property("amountType", "CodeableConcept", "Todo.", 0, 1, amountType));
1421          children.add(new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source));
1422        }
1423
1424        @Override
1425        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1426          switch (_hash) {
1427          case -880905839: /*target*/  return new Property("target", "Identifier", "Todo.", 0, 1, target);
1428          case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Todo.", 0, 1, type);
1429          case 1844104722: /*interaction*/  return new Property("interaction", "CodeableConcept", "Todo.", 0, 1, interaction);
1430          case 1316389074: /*organism*/  return new Property("organism", "CodeableConcept", "Todo.", 0, 1, organism);
1431          case 988662572: /*organismType*/  return new Property("organismType", "CodeableConcept", "Todo.", 0, 1, organismType);
1432          case 646780200: /*amount[x]*/  return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount);
1433          case -1413853096: /*amount*/  return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount);
1434          case 1664303363: /*amountQuantity*/  return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount);
1435          case -1223462971: /*amountRange*/  return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount);
1436          case 773651081: /*amountString*/  return new Property("amount[x]", "Quantity|Range|string", "Todo.", 0, 1, amount);
1437          case -1424857166: /*amountType*/  return new Property("amountType", "CodeableConcept", "Todo.", 0, 1, amountType);
1438          case -896505829: /*source*/  return new Property("source", "Reference(DocumentReference)", "Todo.", 0, java.lang.Integer.MAX_VALUE, source);
1439          default: return super.getNamedProperty(_hash, _name, _checkValid);
1440          }
1441
1442        }
1443
1444      @Override
1445      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1446        switch (hash) {
1447        case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Identifier
1448        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1449        case 1844104722: /*interaction*/ return this.interaction == null ? new Base[0] : new Base[] {this.interaction}; // CodeableConcept
1450        case 1316389074: /*organism*/ return this.organism == null ? new Base[0] : new Base[] {this.organism}; // CodeableConcept
1451        case 988662572: /*organismType*/ return this.organismType == null ? new Base[0] : new Base[] {this.organismType}; // CodeableConcept
1452        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Type
1453        case -1424857166: /*amountType*/ return this.amountType == null ? new Base[0] : new Base[] {this.amountType}; // CodeableConcept
1454        case -896505829: /*source*/ return this.source == null ? new Base[0] : this.source.toArray(new Base[this.source.size()]); // Reference
1455        default: return super.getProperty(hash, name, checkValid);
1456        }
1457
1458      }
1459
1460      @Override
1461      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1462        switch (hash) {
1463        case -880905839: // target
1464          this.target = castToIdentifier(value); // Identifier
1465          return value;
1466        case 3575610: // type
1467          this.type = castToCodeableConcept(value); // CodeableConcept
1468          return value;
1469        case 1844104722: // interaction
1470          this.interaction = castToCodeableConcept(value); // CodeableConcept
1471          return value;
1472        case 1316389074: // organism
1473          this.organism = castToCodeableConcept(value); // CodeableConcept
1474          return value;
1475        case 988662572: // organismType
1476          this.organismType = castToCodeableConcept(value); // CodeableConcept
1477          return value;
1478        case -1413853096: // amount
1479          this.amount = castToType(value); // Type
1480          return value;
1481        case -1424857166: // amountType
1482          this.amountType = castToCodeableConcept(value); // CodeableConcept
1483          return value;
1484        case -896505829: // source
1485          this.getSource().add(castToReference(value)); // Reference
1486          return value;
1487        default: return super.setProperty(hash, name, value);
1488        }
1489
1490      }
1491
1492      @Override
1493      public Base setProperty(String name, Base value) throws FHIRException {
1494        if (name.equals("target")) {
1495          this.target = castToIdentifier(value); // Identifier
1496        } else if (name.equals("type")) {
1497          this.type = castToCodeableConcept(value); // CodeableConcept
1498        } else if (name.equals("interaction")) {
1499          this.interaction = castToCodeableConcept(value); // CodeableConcept
1500        } else if (name.equals("organism")) {
1501          this.organism = castToCodeableConcept(value); // CodeableConcept
1502        } else if (name.equals("organismType")) {
1503          this.organismType = castToCodeableConcept(value); // CodeableConcept
1504        } else if (name.equals("amount[x]")) {
1505          this.amount = castToType(value); // Type
1506        } else if (name.equals("amountType")) {
1507          this.amountType = castToCodeableConcept(value); // CodeableConcept
1508        } else if (name.equals("source")) {
1509          this.getSource().add(castToReference(value));
1510        } else
1511          return super.setProperty(name, value);
1512        return value;
1513      }
1514
1515      @Override
1516      public Base makeProperty(int hash, String name) throws FHIRException {
1517        switch (hash) {
1518        case -880905839:  return getTarget(); 
1519        case 3575610:  return getType(); 
1520        case 1844104722:  return getInteraction(); 
1521        case 1316389074:  return getOrganism(); 
1522        case 988662572:  return getOrganismType(); 
1523        case 646780200:  return getAmount(); 
1524        case -1413853096:  return getAmount(); 
1525        case -1424857166:  return getAmountType(); 
1526        case -896505829:  return addSource(); 
1527        default: return super.makeProperty(hash, name);
1528        }
1529
1530      }
1531
1532      @Override
1533      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1534        switch (hash) {
1535        case -880905839: /*target*/ return new String[] {"Identifier"};
1536        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
1537        case 1844104722: /*interaction*/ return new String[] {"CodeableConcept"};
1538        case 1316389074: /*organism*/ return new String[] {"CodeableConcept"};
1539        case 988662572: /*organismType*/ return new String[] {"CodeableConcept"};
1540        case -1413853096: /*amount*/ return new String[] {"Quantity", "Range", "string"};
1541        case -1424857166: /*amountType*/ return new String[] {"CodeableConcept"};
1542        case -896505829: /*source*/ return new String[] {"Reference"};
1543        default: return super.getTypesForProperty(hash, name);
1544        }
1545
1546      }
1547
1548      @Override
1549      public Base addChild(String name) throws FHIRException {
1550        if (name.equals("target")) {
1551          this.target = new Identifier();
1552          return this.target;
1553        }
1554        else if (name.equals("type")) {
1555          this.type = new CodeableConcept();
1556          return this.type;
1557        }
1558        else if (name.equals("interaction")) {
1559          this.interaction = new CodeableConcept();
1560          return this.interaction;
1561        }
1562        else if (name.equals("organism")) {
1563          this.organism = new CodeableConcept();
1564          return this.organism;
1565        }
1566        else if (name.equals("organismType")) {
1567          this.organismType = new CodeableConcept();
1568          return this.organismType;
1569        }
1570        else if (name.equals("amountQuantity")) {
1571          this.amount = new Quantity();
1572          return this.amount;
1573        }
1574        else if (name.equals("amountRange")) {
1575          this.amount = new Range();
1576          return this.amount;
1577        }
1578        else if (name.equals("amountString")) {
1579          this.amount = new StringType();
1580          return this.amount;
1581        }
1582        else if (name.equals("amountType")) {
1583          this.amountType = new CodeableConcept();
1584          return this.amountType;
1585        }
1586        else if (name.equals("source")) {
1587          return addSource();
1588        }
1589        else
1590          return super.addChild(name);
1591      }
1592
1593      public SubstanceReferenceInformationTargetComponent copy() {
1594        SubstanceReferenceInformationTargetComponent dst = new SubstanceReferenceInformationTargetComponent();
1595        copyValues(dst);
1596        return dst;
1597      }
1598
1599      public void copyValues(SubstanceReferenceInformationTargetComponent dst) {
1600        super.copyValues(dst);
1601        dst.target = target == null ? null : target.copy();
1602        dst.type = type == null ? null : type.copy();
1603        dst.interaction = interaction == null ? null : interaction.copy();
1604        dst.organism = organism == null ? null : organism.copy();
1605        dst.organismType = organismType == null ? null : organismType.copy();
1606        dst.amount = amount == null ? null : amount.copy();
1607        dst.amountType = amountType == null ? null : amountType.copy();
1608        if (source != null) {
1609          dst.source = new ArrayList<Reference>();
1610          for (Reference i : source)
1611            dst.source.add(i.copy());
1612        };
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        return dst;
2085      }
2086
2087      public void copyValues(SubstanceReferenceInformation dst) {
2088        super.copyValues(dst);
2089        dst.comment = comment == null ? null : comment.copy();
2090        if (gene != null) {
2091          dst.gene = new ArrayList<SubstanceReferenceInformationGeneComponent>();
2092          for (SubstanceReferenceInformationGeneComponent i : gene)
2093            dst.gene.add(i.copy());
2094        };
2095        if (geneElement != null) {
2096          dst.geneElement = new ArrayList<SubstanceReferenceInformationGeneElementComponent>();
2097          for (SubstanceReferenceInformationGeneElementComponent i : geneElement)
2098            dst.geneElement.add(i.copy());
2099        };
2100        if (classification != null) {
2101          dst.classification = new ArrayList<SubstanceReferenceInformationClassificationComponent>();
2102          for (SubstanceReferenceInformationClassificationComponent i : classification)
2103            dst.classification.add(i.copy());
2104        };
2105        if (target != null) {
2106          dst.target = new ArrayList<SubstanceReferenceInformationTargetComponent>();
2107          for (SubstanceReferenceInformationTargetComponent i : target)
2108            dst.target.add(i.copy());
2109        };
2110      }
2111
2112      protected SubstanceReferenceInformation typedCopy() {
2113        return copy();
2114      }
2115
2116      @Override
2117      public boolean equalsDeep(Base other_) {
2118        if (!super.equalsDeep(other_))
2119          return false;
2120        if (!(other_ instanceof SubstanceReferenceInformation))
2121          return false;
2122        SubstanceReferenceInformation o = (SubstanceReferenceInformation) other_;
2123        return compareDeep(comment, o.comment, true) && compareDeep(gene, o.gene, true) && compareDeep(geneElement, o.geneElement, true)
2124           && compareDeep(classification, o.classification, true) && compareDeep(target, o.target, true);
2125      }
2126
2127      @Override
2128      public boolean equalsShallow(Base other_) {
2129        if (!super.equalsShallow(other_))
2130          return false;
2131        if (!(other_ instanceof SubstanceReferenceInformation))
2132          return false;
2133        SubstanceReferenceInformation o = (SubstanceReferenceInformation) other_;
2134        return compareValues(comment, o.comment, true);
2135      }
2136
2137      public boolean isEmpty() {
2138        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(comment, gene, geneElement
2139          , classification, target);
2140      }
2141
2142  @Override
2143  public ResourceType getResourceType() {
2144    return ResourceType.SubstanceReferenceInformation;
2145   }
2146
2147
2148}