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