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