001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Fri, Jul 15, 2022 11:20+1000 for FHIR v5.0.0-snapshot2
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * Representation of a molecular sequence.
052 */
053@ResourceDef(name="MolecularSequence", profile="http://hl7.org/fhir/StructureDefinition/MolecularSequence")
054public class MolecularSequence extends DomainResource {
055
056    public enum OrientationType {
057        /**
058         * Sense orientation of reference sequence.
059         */
060        SENSE, 
061        /**
062         * Antisense orientation of reference sequence.
063         */
064        ANTISENSE, 
065        /**
066         * added to help the parsers with the generic types
067         */
068        NULL;
069        public static OrientationType fromCode(String codeString) throws FHIRException {
070            if (codeString == null || "".equals(codeString))
071                return null;
072        if ("sense".equals(codeString))
073          return SENSE;
074        if ("antisense".equals(codeString))
075          return ANTISENSE;
076        if (Configuration.isAcceptInvalidEnums())
077          return null;
078        else
079          throw new FHIRException("Unknown OrientationType code '"+codeString+"'");
080        }
081        public String toCode() {
082          switch (this) {
083            case SENSE: return "sense";
084            case ANTISENSE: return "antisense";
085            case NULL: return null;
086            default: return "?";
087          }
088        }
089        public String getSystem() {
090          switch (this) {
091            case SENSE: return "http://hl7.org/fhir/orientation-type";
092            case ANTISENSE: return "http://hl7.org/fhir/orientation-type";
093            case NULL: return null;
094            default: return "?";
095          }
096        }
097        public String getDefinition() {
098          switch (this) {
099            case SENSE: return "Sense orientation of reference sequence.";
100            case ANTISENSE: return "Antisense orientation of reference sequence.";
101            case NULL: return null;
102            default: return "?";
103          }
104        }
105        public String getDisplay() {
106          switch (this) {
107            case SENSE: return "Sense orientation of referenceSeq";
108            case ANTISENSE: return "Antisense orientation of referenceSeq";
109            case NULL: return null;
110            default: return "?";
111          }
112        }
113    }
114
115  public static class OrientationTypeEnumFactory implements EnumFactory<OrientationType> {
116    public OrientationType fromCode(String codeString) throws IllegalArgumentException {
117      if (codeString == null || "".equals(codeString))
118            if (codeString == null || "".equals(codeString))
119                return null;
120        if ("sense".equals(codeString))
121          return OrientationType.SENSE;
122        if ("antisense".equals(codeString))
123          return OrientationType.ANTISENSE;
124        throw new IllegalArgumentException("Unknown OrientationType code '"+codeString+"'");
125        }
126        public Enumeration<OrientationType> fromType(Base code) throws FHIRException {
127          if (code == null)
128            return null;
129          if (code.isEmpty())
130            return new Enumeration<OrientationType>(this);
131          String codeString = ((PrimitiveType) code).asStringValue();
132          if (codeString == null || "".equals(codeString))
133            return null;
134        if ("sense".equals(codeString))
135          return new Enumeration<OrientationType>(this, OrientationType.SENSE);
136        if ("antisense".equals(codeString))
137          return new Enumeration<OrientationType>(this, OrientationType.ANTISENSE);
138        throw new FHIRException("Unknown OrientationType code '"+codeString+"'");
139        }
140    public String toCode(OrientationType code) {
141      if (code == OrientationType.SENSE)
142        return "sense";
143      if (code == OrientationType.ANTISENSE)
144        return "antisense";
145      return "?";
146      }
147    public String toSystem(OrientationType code) {
148      return code.getSystem();
149      }
150    }
151
152    public enum SequenceType {
153        /**
154         * Amino acid sequence.
155         */
156        AA, 
157        /**
158         * DNA Sequence.
159         */
160        DNA, 
161        /**
162         * RNA Sequence.
163         */
164        RNA, 
165        /**
166         * added to help the parsers with the generic types
167         */
168        NULL;
169        public static SequenceType fromCode(String codeString) throws FHIRException {
170            if (codeString == null || "".equals(codeString))
171                return null;
172        if ("aa".equals(codeString))
173          return AA;
174        if ("dna".equals(codeString))
175          return DNA;
176        if ("rna".equals(codeString))
177          return RNA;
178        if (Configuration.isAcceptInvalidEnums())
179          return null;
180        else
181          throw new FHIRException("Unknown SequenceType code '"+codeString+"'");
182        }
183        public String toCode() {
184          switch (this) {
185            case AA: return "aa";
186            case DNA: return "dna";
187            case RNA: return "rna";
188            case NULL: return null;
189            default: return "?";
190          }
191        }
192        public String getSystem() {
193          switch (this) {
194            case AA: return "http://hl7.org/fhir/sequence-type";
195            case DNA: return "http://hl7.org/fhir/sequence-type";
196            case RNA: return "http://hl7.org/fhir/sequence-type";
197            case NULL: return null;
198            default: return "?";
199          }
200        }
201        public String getDefinition() {
202          switch (this) {
203            case AA: return "Amino acid sequence.";
204            case DNA: return "DNA Sequence.";
205            case RNA: return "RNA Sequence.";
206            case NULL: return null;
207            default: return "?";
208          }
209        }
210        public String getDisplay() {
211          switch (this) {
212            case AA: return "AA Sequence";
213            case DNA: return "DNA Sequence";
214            case RNA: return "RNA Sequence";
215            case NULL: return null;
216            default: return "?";
217          }
218        }
219    }
220
221  public static class SequenceTypeEnumFactory implements EnumFactory<SequenceType> {
222    public SequenceType fromCode(String codeString) throws IllegalArgumentException {
223      if (codeString == null || "".equals(codeString))
224            if (codeString == null || "".equals(codeString))
225                return null;
226        if ("aa".equals(codeString))
227          return SequenceType.AA;
228        if ("dna".equals(codeString))
229          return SequenceType.DNA;
230        if ("rna".equals(codeString))
231          return SequenceType.RNA;
232        throw new IllegalArgumentException("Unknown SequenceType code '"+codeString+"'");
233        }
234        public Enumeration<SequenceType> fromType(Base code) throws FHIRException {
235          if (code == null)
236            return null;
237          if (code.isEmpty())
238            return new Enumeration<SequenceType>(this);
239          String codeString = ((PrimitiveType) code).asStringValue();
240          if (codeString == null || "".equals(codeString))
241            return null;
242        if ("aa".equals(codeString))
243          return new Enumeration<SequenceType>(this, SequenceType.AA);
244        if ("dna".equals(codeString))
245          return new Enumeration<SequenceType>(this, SequenceType.DNA);
246        if ("rna".equals(codeString))
247          return new Enumeration<SequenceType>(this, SequenceType.RNA);
248        throw new FHIRException("Unknown SequenceType code '"+codeString+"'");
249        }
250    public String toCode(SequenceType code) {
251      if (code == SequenceType.AA)
252        return "aa";
253      if (code == SequenceType.DNA)
254        return "dna";
255      if (code == SequenceType.RNA)
256        return "rna";
257      return "?";
258      }
259    public String toSystem(SequenceType code) {
260      return code.getSystem();
261      }
262    }
263
264    public enum StrandType {
265        /**
266         * Watson strand of reference sequence.
267         */
268        WATSON, 
269        /**
270         * Crick strand of reference sequence.
271         */
272        CRICK, 
273        /**
274         * added to help the parsers with the generic types
275         */
276        NULL;
277        public static StrandType fromCode(String codeString) throws FHIRException {
278            if (codeString == null || "".equals(codeString))
279                return null;
280        if ("watson".equals(codeString))
281          return WATSON;
282        if ("crick".equals(codeString))
283          return CRICK;
284        if (Configuration.isAcceptInvalidEnums())
285          return null;
286        else
287          throw new FHIRException("Unknown StrandType code '"+codeString+"'");
288        }
289        public String toCode() {
290          switch (this) {
291            case WATSON: return "watson";
292            case CRICK: return "crick";
293            case NULL: return null;
294            default: return "?";
295          }
296        }
297        public String getSystem() {
298          switch (this) {
299            case WATSON: return "http://hl7.org/fhir/strand-type";
300            case CRICK: return "http://hl7.org/fhir/strand-type";
301            case NULL: return null;
302            default: return "?";
303          }
304        }
305        public String getDefinition() {
306          switch (this) {
307            case WATSON: return "Watson strand of reference sequence.";
308            case CRICK: return "Crick strand of reference sequence.";
309            case NULL: return null;
310            default: return "?";
311          }
312        }
313        public String getDisplay() {
314          switch (this) {
315            case WATSON: return "Watson strand of referenceSeq";
316            case CRICK: return "Crick strand of referenceSeq";
317            case NULL: return null;
318            default: return "?";
319          }
320        }
321    }
322
323  public static class StrandTypeEnumFactory implements EnumFactory<StrandType> {
324    public StrandType fromCode(String codeString) throws IllegalArgumentException {
325      if (codeString == null || "".equals(codeString))
326            if (codeString == null || "".equals(codeString))
327                return null;
328        if ("watson".equals(codeString))
329          return StrandType.WATSON;
330        if ("crick".equals(codeString))
331          return StrandType.CRICK;
332        throw new IllegalArgumentException("Unknown StrandType code '"+codeString+"'");
333        }
334        public Enumeration<StrandType> fromType(Base code) throws FHIRException {
335          if (code == null)
336            return null;
337          if (code.isEmpty())
338            return new Enumeration<StrandType>(this);
339          String codeString = ((PrimitiveType) code).asStringValue();
340          if (codeString == null || "".equals(codeString))
341            return null;
342        if ("watson".equals(codeString))
343          return new Enumeration<StrandType>(this, StrandType.WATSON);
344        if ("crick".equals(codeString))
345          return new Enumeration<StrandType>(this, StrandType.CRICK);
346        throw new FHIRException("Unknown StrandType code '"+codeString+"'");
347        }
348    public String toCode(StrandType code) {
349      if (code == StrandType.WATSON)
350        return "watson";
351      if (code == StrandType.CRICK)
352        return "crick";
353      return "?";
354      }
355    public String toSystem(StrandType code) {
356      return code.getSystem();
357      }
358    }
359
360    @Block()
361    public static class MolecularSequenceRelativeComponent extends BackboneElement implements IBaseBackboneElement {
362        /**
363         * These are different ways of identifying nucleotides or amino acids within a sequence. Different databases and file types may use different systems. For detail definitions, see https://loinc.org/92822-6/ for more detail.
364         */
365        @Child(name = "coordinateSystem", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
366        @Description(shortDefinition="Ways of identifying nucleotides or amino acids within a sequence", formalDefinition="These are different ways of identifying nucleotides or amino acids within a sequence. Different databases and file types may use different systems. For detail definitions, see https://loinc.org/92822-6/ for more detail." )
367        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://loinc.org/LL5323-2/")
368        protected CodeableConcept coordinateSystem;
369
370        /**
371         * A sequence that is used as a reference to describe variants that are present in a sequence analyzed.
372         */
373        @Child(name = "reference", type = {}, order=2, min=0, max=1, modifier=false, summary=true)
374        @Description(shortDefinition="A sequence used as reference", formalDefinition="A sequence that is used as a reference to describe variants that are present in a sequence analyzed." )
375        protected MolecularSequenceRelativeReferenceComponent reference;
376
377        /**
378         * Changes in sequence from the reference.
379         */
380        @Child(name = "edit", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
381        @Description(shortDefinition="Changes in sequence from the reference", formalDefinition="Changes in sequence from the reference." )
382        protected List<MolecularSequenceRelativeEditComponent> edit;
383
384        private static final long serialVersionUID = 1575876090L;
385
386    /**
387     * Constructor
388     */
389      public MolecularSequenceRelativeComponent() {
390        super();
391      }
392
393    /**
394     * Constructor
395     */
396      public MolecularSequenceRelativeComponent(CodeableConcept coordinateSystem) {
397        super();
398        this.setCoordinateSystem(coordinateSystem);
399      }
400
401        /**
402         * @return {@link #coordinateSystem} (These are different ways of identifying nucleotides or amino acids within a sequence. Different databases and file types may use different systems. For detail definitions, see https://loinc.org/92822-6/ for more detail.)
403         */
404        public CodeableConcept getCoordinateSystem() { 
405          if (this.coordinateSystem == null)
406            if (Configuration.errorOnAutoCreate())
407              throw new Error("Attempt to auto-create MolecularSequenceRelativeComponent.coordinateSystem");
408            else if (Configuration.doAutoCreate())
409              this.coordinateSystem = new CodeableConcept(); // cc
410          return this.coordinateSystem;
411        }
412
413        public boolean hasCoordinateSystem() { 
414          return this.coordinateSystem != null && !this.coordinateSystem.isEmpty();
415        }
416
417        /**
418         * @param value {@link #coordinateSystem} (These are different ways of identifying nucleotides or amino acids within a sequence. Different databases and file types may use different systems. For detail definitions, see https://loinc.org/92822-6/ for more detail.)
419         */
420        public MolecularSequenceRelativeComponent setCoordinateSystem(CodeableConcept value) { 
421          this.coordinateSystem = value;
422          return this;
423        }
424
425        /**
426         * @return {@link #reference} (A sequence that is used as a reference to describe variants that are present in a sequence analyzed.)
427         */
428        public MolecularSequenceRelativeReferenceComponent getReference() { 
429          if (this.reference == null)
430            if (Configuration.errorOnAutoCreate())
431              throw new Error("Attempt to auto-create MolecularSequenceRelativeComponent.reference");
432            else if (Configuration.doAutoCreate())
433              this.reference = new MolecularSequenceRelativeReferenceComponent(); // cc
434          return this.reference;
435        }
436
437        public boolean hasReference() { 
438          return this.reference != null && !this.reference.isEmpty();
439        }
440
441        /**
442         * @param value {@link #reference} (A sequence that is used as a reference to describe variants that are present in a sequence analyzed.)
443         */
444        public MolecularSequenceRelativeComponent setReference(MolecularSequenceRelativeReferenceComponent value) { 
445          this.reference = value;
446          return this;
447        }
448
449        /**
450         * @return {@link #edit} (Changes in sequence from the reference.)
451         */
452        public List<MolecularSequenceRelativeEditComponent> getEdit() { 
453          if (this.edit == null)
454            this.edit = new ArrayList<MolecularSequenceRelativeEditComponent>();
455          return this.edit;
456        }
457
458        /**
459         * @return Returns a reference to <code>this</code> for easy method chaining
460         */
461        public MolecularSequenceRelativeComponent setEdit(List<MolecularSequenceRelativeEditComponent> theEdit) { 
462          this.edit = theEdit;
463          return this;
464        }
465
466        public boolean hasEdit() { 
467          if (this.edit == null)
468            return false;
469          for (MolecularSequenceRelativeEditComponent item : this.edit)
470            if (!item.isEmpty())
471              return true;
472          return false;
473        }
474
475        public MolecularSequenceRelativeEditComponent addEdit() { //3
476          MolecularSequenceRelativeEditComponent t = new MolecularSequenceRelativeEditComponent();
477          if (this.edit == null)
478            this.edit = new ArrayList<MolecularSequenceRelativeEditComponent>();
479          this.edit.add(t);
480          return t;
481        }
482
483        public MolecularSequenceRelativeComponent addEdit(MolecularSequenceRelativeEditComponent t) { //3
484          if (t == null)
485            return this;
486          if (this.edit == null)
487            this.edit = new ArrayList<MolecularSequenceRelativeEditComponent>();
488          this.edit.add(t);
489          return this;
490        }
491
492        /**
493         * @return The first repetition of repeating field {@link #edit}, creating it if it does not already exist {3}
494         */
495        public MolecularSequenceRelativeEditComponent getEditFirstRep() { 
496          if (getEdit().isEmpty()) {
497            addEdit();
498          }
499          return getEdit().get(0);
500        }
501
502        protected void listChildren(List<Property> children) {
503          super.listChildren(children);
504          children.add(new Property("coordinateSystem", "CodeableConcept", "These are different ways of identifying nucleotides or amino acids within a sequence. Different databases and file types may use different systems. For detail definitions, see https://loinc.org/92822-6/ for more detail.", 0, 1, coordinateSystem));
505          children.add(new Property("reference", "", "A sequence that is used as a reference to describe variants that are present in a sequence analyzed.", 0, 1, reference));
506          children.add(new Property("edit", "", "Changes in sequence from the reference.", 0, java.lang.Integer.MAX_VALUE, edit));
507        }
508
509        @Override
510        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
511          switch (_hash) {
512          case 354212295: /*coordinateSystem*/  return new Property("coordinateSystem", "CodeableConcept", "These are different ways of identifying nucleotides or amino acids within a sequence. Different databases and file types may use different systems. For detail definitions, see https://loinc.org/92822-6/ for more detail.", 0, 1, coordinateSystem);
513          case -925155509: /*reference*/  return new Property("reference", "", "A sequence that is used as a reference to describe variants that are present in a sequence analyzed.", 0, 1, reference);
514          case 3108362: /*edit*/  return new Property("edit", "", "Changes in sequence from the reference.", 0, java.lang.Integer.MAX_VALUE, edit);
515          default: return super.getNamedProperty(_hash, _name, _checkValid);
516          }
517
518        }
519
520      @Override
521      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
522        switch (hash) {
523        case 354212295: /*coordinateSystem*/ return this.coordinateSystem == null ? new Base[0] : new Base[] {this.coordinateSystem}; // CodeableConcept
524        case -925155509: /*reference*/ return this.reference == null ? new Base[0] : new Base[] {this.reference}; // MolecularSequenceRelativeReferenceComponent
525        case 3108362: /*edit*/ return this.edit == null ? new Base[0] : this.edit.toArray(new Base[this.edit.size()]); // MolecularSequenceRelativeEditComponent
526        default: return super.getProperty(hash, name, checkValid);
527        }
528
529      }
530
531      @Override
532      public Base setProperty(int hash, String name, Base value) throws FHIRException {
533        switch (hash) {
534        case 354212295: // coordinateSystem
535          this.coordinateSystem = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
536          return value;
537        case -925155509: // reference
538          this.reference = (MolecularSequenceRelativeReferenceComponent) value; // MolecularSequenceRelativeReferenceComponent
539          return value;
540        case 3108362: // edit
541          this.getEdit().add((MolecularSequenceRelativeEditComponent) value); // MolecularSequenceRelativeEditComponent
542          return value;
543        default: return super.setProperty(hash, name, value);
544        }
545
546      }
547
548      @Override
549      public Base setProperty(String name, Base value) throws FHIRException {
550        if (name.equals("coordinateSystem")) {
551          this.coordinateSystem = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
552        } else if (name.equals("reference")) {
553          this.reference = (MolecularSequenceRelativeReferenceComponent) value; // MolecularSequenceRelativeReferenceComponent
554        } else if (name.equals("edit")) {
555          this.getEdit().add((MolecularSequenceRelativeEditComponent) value);
556        } else
557          return super.setProperty(name, value);
558        return value;
559      }
560
561      @Override
562      public Base makeProperty(int hash, String name) throws FHIRException {
563        switch (hash) {
564        case 354212295:  return getCoordinateSystem();
565        case -925155509:  return getReference();
566        case 3108362:  return addEdit(); 
567        default: return super.makeProperty(hash, name);
568        }
569
570      }
571
572      @Override
573      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
574        switch (hash) {
575        case 354212295: /*coordinateSystem*/ return new String[] {"CodeableConcept"};
576        case -925155509: /*reference*/ return new String[] {};
577        case 3108362: /*edit*/ return new String[] {};
578        default: return super.getTypesForProperty(hash, name);
579        }
580
581      }
582
583      @Override
584      public Base addChild(String name) throws FHIRException {
585        if (name.equals("coordinateSystem")) {
586          this.coordinateSystem = new CodeableConcept();
587          return this.coordinateSystem;
588        }
589        else if (name.equals("reference")) {
590          this.reference = new MolecularSequenceRelativeReferenceComponent();
591          return this.reference;
592        }
593        else if (name.equals("edit")) {
594          return addEdit();
595        }
596        else
597          return super.addChild(name);
598      }
599
600      public MolecularSequenceRelativeComponent copy() {
601        MolecularSequenceRelativeComponent dst = new MolecularSequenceRelativeComponent();
602        copyValues(dst);
603        return dst;
604      }
605
606      public void copyValues(MolecularSequenceRelativeComponent dst) {
607        super.copyValues(dst);
608        dst.coordinateSystem = coordinateSystem == null ? null : coordinateSystem.copy();
609        dst.reference = reference == null ? null : reference.copy();
610        if (edit != null) {
611          dst.edit = new ArrayList<MolecularSequenceRelativeEditComponent>();
612          for (MolecularSequenceRelativeEditComponent i : edit)
613            dst.edit.add(i.copy());
614        };
615      }
616
617      @Override
618      public boolean equalsDeep(Base other_) {
619        if (!super.equalsDeep(other_))
620          return false;
621        if (!(other_ instanceof MolecularSequenceRelativeComponent))
622          return false;
623        MolecularSequenceRelativeComponent o = (MolecularSequenceRelativeComponent) other_;
624        return compareDeep(coordinateSystem, o.coordinateSystem, true) && compareDeep(reference, o.reference, true)
625           && compareDeep(edit, o.edit, true);
626      }
627
628      @Override
629      public boolean equalsShallow(Base other_) {
630        if (!super.equalsShallow(other_))
631          return false;
632        if (!(other_ instanceof MolecularSequenceRelativeComponent))
633          return false;
634        MolecularSequenceRelativeComponent o = (MolecularSequenceRelativeComponent) other_;
635        return true;
636      }
637
638      public boolean isEmpty() {
639        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(coordinateSystem, reference
640          , edit);
641      }
642
643  public String fhirType() {
644    return "MolecularSequence.relative";
645
646  }
647
648  }
649
650    @Block()
651    public static class MolecularSequenceRelativeReferenceComponent extends BackboneElement implements IBaseBackboneElement {
652        /**
653         * The reference assembly used for reference, e.g. GRCh38.
654         */
655        @Child(name = "referenceSequenceAssembly", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
656        @Description(shortDefinition="The reference assembly used for reference, e.g. GRCh38", formalDefinition="The reference assembly used for reference, e.g. GRCh38." )
657        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://loinc.org/LL1040-6/")
658        protected CodeableConcept referenceSequenceAssembly;
659
660        /**
661         * Structural unit composed of a nucleic acid molecule which controls its own replication through the interaction of specific proteins at one or more origins of replication ([SO:0000340](http://www.sequenceontology.org/browser/current_svn/term/SO:0000340)).
662         */
663        @Child(name = "chromosome", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
664        @Description(shortDefinition="Chromosome Identifier", formalDefinition="Structural unit composed of a nucleic acid molecule which controls its own replication through the interaction of specific proteins at one or more origins of replication ([SO:0000340](http://www.sequenceontology.org/browser/current_svn/term/SO:0000340))." )
665        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://loinc.org/LL2938-0/")
666        protected CodeableConcept chromosome;
667
668        /**
669         * The reference sequence that represents the starting sequence.
670         */
671        @Child(name = "referenceSequence", type = {CodeableConcept.class, StringType.class, MolecularSequence.class}, order=3, min=0, max=1, modifier=false, summary=true)
672        @Description(shortDefinition="The reference sequence that represents the starting sequence", formalDefinition="The reference sequence that represents the starting sequence." )
673        protected DataType referenceSequence;
674
675        /**
676         * Start position of the window on the reference sequence. This value should honor the rules of the coordinateSystem.
677         */
678        @Child(name = "windowStart", type = {IntegerType.class}, order=4, min=0, max=1, modifier=false, summary=true)
679        @Description(shortDefinition="Start position of the window on the  reference sequence", formalDefinition="Start position of the window on the reference sequence. This value should honor the rules of the coordinateSystem." )
680        protected IntegerType windowStart;
681
682        /**
683         * End position of the window on the reference sequence. This value should honor the rules of the  coordinateSystem.
684         */
685        @Child(name = "windowEnd", type = {IntegerType.class}, order=5, min=0, max=1, modifier=false, summary=true)
686        @Description(shortDefinition="End position of the window on the reference sequence", formalDefinition="End position of the window on the reference sequence. This value should honor the rules of the  coordinateSystem." )
687        protected IntegerType windowEnd;
688
689        /**
690         * A relative reference to a DNA strand based on gene orientation. The strand that contains the open reading frame of the gene is the "sense" strand, and the opposite complementary strand is the "antisense" strand.
691         */
692        @Child(name = "orientation", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
693        @Description(shortDefinition="sense | antisense", formalDefinition="A relative reference to a DNA strand based on gene orientation. The strand that contains the open reading frame of the gene is the \"sense\" strand, and the opposite complementary strand is the \"antisense\" strand." )
694        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/orientation-type")
695        protected Enumeration<OrientationType> orientation;
696
697        /**
698         * An absolute reference to a strand. The Watson strand is the strand whose 5'-end is on the short arm of the chromosome, and the Crick strand as the one whose 5'-end is on the long arm.
699         */
700        @Child(name = "strand", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
701        @Description(shortDefinition="watson | crick", formalDefinition="An absolute reference to a strand. The Watson strand is the strand whose 5'-end is on the short arm of the chromosome, and the Crick strand as the one whose 5'-end is on the long arm." )
702        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/strand-type")
703        protected Enumeration<StrandType> strand;
704
705        private static final long serialVersionUID = -1431377311L;
706
707    /**
708     * Constructor
709     */
710      public MolecularSequenceRelativeReferenceComponent() {
711        super();
712      }
713
714        /**
715         * @return {@link #referenceSequenceAssembly} (The reference assembly used for reference, e.g. GRCh38.)
716         */
717        public CodeableConcept getReferenceSequenceAssembly() { 
718          if (this.referenceSequenceAssembly == null)
719            if (Configuration.errorOnAutoCreate())
720              throw new Error("Attempt to auto-create MolecularSequenceRelativeReferenceComponent.referenceSequenceAssembly");
721            else if (Configuration.doAutoCreate())
722              this.referenceSequenceAssembly = new CodeableConcept(); // cc
723          return this.referenceSequenceAssembly;
724        }
725
726        public boolean hasReferenceSequenceAssembly() { 
727          return this.referenceSequenceAssembly != null && !this.referenceSequenceAssembly.isEmpty();
728        }
729
730        /**
731         * @param value {@link #referenceSequenceAssembly} (The reference assembly used for reference, e.g. GRCh38.)
732         */
733        public MolecularSequenceRelativeReferenceComponent setReferenceSequenceAssembly(CodeableConcept value) { 
734          this.referenceSequenceAssembly = value;
735          return this;
736        }
737
738        /**
739         * @return {@link #chromosome} (Structural unit composed of a nucleic acid molecule which controls its own replication through the interaction of specific proteins at one or more origins of replication ([SO:0000340](http://www.sequenceontology.org/browser/current_svn/term/SO:0000340)).)
740         */
741        public CodeableConcept getChromosome() { 
742          if (this.chromosome == null)
743            if (Configuration.errorOnAutoCreate())
744              throw new Error("Attempt to auto-create MolecularSequenceRelativeReferenceComponent.chromosome");
745            else if (Configuration.doAutoCreate())
746              this.chromosome = new CodeableConcept(); // cc
747          return this.chromosome;
748        }
749
750        public boolean hasChromosome() { 
751          return this.chromosome != null && !this.chromosome.isEmpty();
752        }
753
754        /**
755         * @param value {@link #chromosome} (Structural unit composed of a nucleic acid molecule which controls its own replication through the interaction of specific proteins at one or more origins of replication ([SO:0000340](http://www.sequenceontology.org/browser/current_svn/term/SO:0000340)).)
756         */
757        public MolecularSequenceRelativeReferenceComponent setChromosome(CodeableConcept value) { 
758          this.chromosome = value;
759          return this;
760        }
761
762        /**
763         * @return {@link #referenceSequence} (The reference sequence that represents the starting sequence.)
764         */
765        public DataType getReferenceSequence() { 
766          return this.referenceSequence;
767        }
768
769        /**
770         * @return {@link #referenceSequence} (The reference sequence that represents the starting sequence.)
771         */
772        public CodeableConcept getReferenceSequenceCodeableConcept() throws FHIRException { 
773          if (this.referenceSequence == null)
774            this.referenceSequence = new CodeableConcept();
775          if (!(this.referenceSequence instanceof CodeableConcept))
776            throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.referenceSequence.getClass().getName()+" was encountered");
777          return (CodeableConcept) this.referenceSequence;
778        }
779
780        public boolean hasReferenceSequenceCodeableConcept() { 
781          return this != null && this.referenceSequence instanceof CodeableConcept;
782        }
783
784        /**
785         * @return {@link #referenceSequence} (The reference sequence that represents the starting sequence.)
786         */
787        public StringType getReferenceSequenceStringType() throws FHIRException { 
788          if (this.referenceSequence == null)
789            this.referenceSequence = new StringType();
790          if (!(this.referenceSequence instanceof StringType))
791            throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.referenceSequence.getClass().getName()+" was encountered");
792          return (StringType) this.referenceSequence;
793        }
794
795        public boolean hasReferenceSequenceStringType() { 
796          return this != null && this.referenceSequence instanceof StringType;
797        }
798
799        /**
800         * @return {@link #referenceSequence} (The reference sequence that represents the starting sequence.)
801         */
802        public Reference getReferenceSequenceReference() throws FHIRException { 
803          if (this.referenceSequence == null)
804            this.referenceSequence = new Reference();
805          if (!(this.referenceSequence instanceof Reference))
806            throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.referenceSequence.getClass().getName()+" was encountered");
807          return (Reference) this.referenceSequence;
808        }
809
810        public boolean hasReferenceSequenceReference() { 
811          return this != null && this.referenceSequence instanceof Reference;
812        }
813
814        public boolean hasReferenceSequence() { 
815          return this.referenceSequence != null && !this.referenceSequence.isEmpty();
816        }
817
818        /**
819         * @param value {@link #referenceSequence} (The reference sequence that represents the starting sequence.)
820         */
821        public MolecularSequenceRelativeReferenceComponent setReferenceSequence(DataType value) { 
822          if (value != null && !(value instanceof CodeableConcept || value instanceof StringType || value instanceof Reference))
823            throw new Error("Not the right type for MolecularSequence.relative.reference.referenceSequence[x]: "+value.fhirType());
824          this.referenceSequence = value;
825          return this;
826        }
827
828        /**
829         * @return {@link #windowStart} (Start position of the window on the reference sequence. This value should honor the rules of the coordinateSystem.). This is the underlying object with id, value and extensions. The accessor "getWindowStart" gives direct access to the value
830         */
831        public IntegerType getWindowStartElement() { 
832          if (this.windowStart == null)
833            if (Configuration.errorOnAutoCreate())
834              throw new Error("Attempt to auto-create MolecularSequenceRelativeReferenceComponent.windowStart");
835            else if (Configuration.doAutoCreate())
836              this.windowStart = new IntegerType(); // bb
837          return this.windowStart;
838        }
839
840        public boolean hasWindowStartElement() { 
841          return this.windowStart != null && !this.windowStart.isEmpty();
842        }
843
844        public boolean hasWindowStart() { 
845          return this.windowStart != null && !this.windowStart.isEmpty();
846        }
847
848        /**
849         * @param value {@link #windowStart} (Start position of the window on the reference sequence. This value should honor the rules of the coordinateSystem.). This is the underlying object with id, value and extensions. The accessor "getWindowStart" gives direct access to the value
850         */
851        public MolecularSequenceRelativeReferenceComponent setWindowStartElement(IntegerType value) { 
852          this.windowStart = value;
853          return this;
854        }
855
856        /**
857         * @return Start position of the window on the reference sequence. This value should honor the rules of the coordinateSystem.
858         */
859        public int getWindowStart() { 
860          return this.windowStart == null || this.windowStart.isEmpty() ? 0 : this.windowStart.getValue();
861        }
862
863        /**
864         * @param value Start position of the window on the reference sequence. This value should honor the rules of the coordinateSystem.
865         */
866        public MolecularSequenceRelativeReferenceComponent setWindowStart(int value) { 
867            if (this.windowStart == null)
868              this.windowStart = new IntegerType();
869            this.windowStart.setValue(value);
870          return this;
871        }
872
873        /**
874         * @return {@link #windowEnd} (End position of the window on the reference sequence. This value should honor the rules of the  coordinateSystem.). This is the underlying object with id, value and extensions. The accessor "getWindowEnd" gives direct access to the value
875         */
876        public IntegerType getWindowEndElement() { 
877          if (this.windowEnd == null)
878            if (Configuration.errorOnAutoCreate())
879              throw new Error("Attempt to auto-create MolecularSequenceRelativeReferenceComponent.windowEnd");
880            else if (Configuration.doAutoCreate())
881              this.windowEnd = new IntegerType(); // bb
882          return this.windowEnd;
883        }
884
885        public boolean hasWindowEndElement() { 
886          return this.windowEnd != null && !this.windowEnd.isEmpty();
887        }
888
889        public boolean hasWindowEnd() { 
890          return this.windowEnd != null && !this.windowEnd.isEmpty();
891        }
892
893        /**
894         * @param value {@link #windowEnd} (End position of the window on the reference sequence. This value should honor the rules of the  coordinateSystem.). This is the underlying object with id, value and extensions. The accessor "getWindowEnd" gives direct access to the value
895         */
896        public MolecularSequenceRelativeReferenceComponent setWindowEndElement(IntegerType value) { 
897          this.windowEnd = value;
898          return this;
899        }
900
901        /**
902         * @return End position of the window on the reference sequence. This value should honor the rules of the  coordinateSystem.
903         */
904        public int getWindowEnd() { 
905          return this.windowEnd == null || this.windowEnd.isEmpty() ? 0 : this.windowEnd.getValue();
906        }
907
908        /**
909         * @param value End position of the window on the reference sequence. This value should honor the rules of the  coordinateSystem.
910         */
911        public MolecularSequenceRelativeReferenceComponent setWindowEnd(int value) { 
912            if (this.windowEnd == null)
913              this.windowEnd = new IntegerType();
914            this.windowEnd.setValue(value);
915          return this;
916        }
917
918        /**
919         * @return {@link #orientation} (A relative reference to a DNA strand based on gene orientation. The strand that contains the open reading frame of the gene is the "sense" strand, and the opposite complementary strand is the "antisense" strand.). This is the underlying object with id, value and extensions. The accessor "getOrientation" gives direct access to the value
920         */
921        public Enumeration<OrientationType> getOrientationElement() { 
922          if (this.orientation == null)
923            if (Configuration.errorOnAutoCreate())
924              throw new Error("Attempt to auto-create MolecularSequenceRelativeReferenceComponent.orientation");
925            else if (Configuration.doAutoCreate())
926              this.orientation = new Enumeration<OrientationType>(new OrientationTypeEnumFactory()); // bb
927          return this.orientation;
928        }
929
930        public boolean hasOrientationElement() { 
931          return this.orientation != null && !this.orientation.isEmpty();
932        }
933
934        public boolean hasOrientation() { 
935          return this.orientation != null && !this.orientation.isEmpty();
936        }
937
938        /**
939         * @param value {@link #orientation} (A relative reference to a DNA strand based on gene orientation. The strand that contains the open reading frame of the gene is the "sense" strand, and the opposite complementary strand is the "antisense" strand.). This is the underlying object with id, value and extensions. The accessor "getOrientation" gives direct access to the value
940         */
941        public MolecularSequenceRelativeReferenceComponent setOrientationElement(Enumeration<OrientationType> value) { 
942          this.orientation = value;
943          return this;
944        }
945
946        /**
947         * @return A relative reference to a DNA strand based on gene orientation. The strand that contains the open reading frame of the gene is the "sense" strand, and the opposite complementary strand is the "antisense" strand.
948         */
949        public OrientationType getOrientation() { 
950          return this.orientation == null ? null : this.orientation.getValue();
951        }
952
953        /**
954         * @param value A relative reference to a DNA strand based on gene orientation. The strand that contains the open reading frame of the gene is the "sense" strand, and the opposite complementary strand is the "antisense" strand.
955         */
956        public MolecularSequenceRelativeReferenceComponent setOrientation(OrientationType value) { 
957          if (value == null)
958            this.orientation = null;
959          else {
960            if (this.orientation == null)
961              this.orientation = new Enumeration<OrientationType>(new OrientationTypeEnumFactory());
962            this.orientation.setValue(value);
963          }
964          return this;
965        }
966
967        /**
968         * @return {@link #strand} (An absolute reference to a strand. The Watson strand is the strand whose 5'-end is on the short arm of the chromosome, and the Crick strand as the one whose 5'-end is on the long arm.). This is the underlying object with id, value and extensions. The accessor "getStrand" gives direct access to the value
969         */
970        public Enumeration<StrandType> getStrandElement() { 
971          if (this.strand == null)
972            if (Configuration.errorOnAutoCreate())
973              throw new Error("Attempt to auto-create MolecularSequenceRelativeReferenceComponent.strand");
974            else if (Configuration.doAutoCreate())
975              this.strand = new Enumeration<StrandType>(new StrandTypeEnumFactory()); // bb
976          return this.strand;
977        }
978
979        public boolean hasStrandElement() { 
980          return this.strand != null && !this.strand.isEmpty();
981        }
982
983        public boolean hasStrand() { 
984          return this.strand != null && !this.strand.isEmpty();
985        }
986
987        /**
988         * @param value {@link #strand} (An absolute reference to a strand. The Watson strand is the strand whose 5'-end is on the short arm of the chromosome, and the Crick strand as the one whose 5'-end is on the long arm.). This is the underlying object with id, value and extensions. The accessor "getStrand" gives direct access to the value
989         */
990        public MolecularSequenceRelativeReferenceComponent setStrandElement(Enumeration<StrandType> value) { 
991          this.strand = value;
992          return this;
993        }
994
995        /**
996         * @return An absolute reference to a strand. The Watson strand is the strand whose 5'-end is on the short arm of the chromosome, and the Crick strand as the one whose 5'-end is on the long arm.
997         */
998        public StrandType getStrand() { 
999          return this.strand == null ? null : this.strand.getValue();
1000        }
1001
1002        /**
1003         * @param value An absolute reference to a strand. The Watson strand is the strand whose 5'-end is on the short arm of the chromosome, and the Crick strand as the one whose 5'-end is on the long arm.
1004         */
1005        public MolecularSequenceRelativeReferenceComponent setStrand(StrandType value) { 
1006          if (value == null)
1007            this.strand = null;
1008          else {
1009            if (this.strand == null)
1010              this.strand = new Enumeration<StrandType>(new StrandTypeEnumFactory());
1011            this.strand.setValue(value);
1012          }
1013          return this;
1014        }
1015
1016        protected void listChildren(List<Property> children) {
1017          super.listChildren(children);
1018          children.add(new Property("referenceSequenceAssembly", "CodeableConcept", "The reference assembly used for reference, e.g. GRCh38.", 0, 1, referenceSequenceAssembly));
1019          children.add(new Property("chromosome", "CodeableConcept", "Structural unit composed of a nucleic acid molecule which controls its own replication through the interaction of specific proteins at one or more origins of replication ([SO:0000340](http://www.sequenceontology.org/browser/current_svn/term/SO:0000340)).", 0, 1, chromosome));
1020          children.add(new Property("referenceSequence[x]", "CodeableConcept|string|Reference(MolecularSequence)", "The reference sequence that represents the starting sequence.", 0, 1, referenceSequence));
1021          children.add(new Property("windowStart", "integer", "Start position of the window on the reference sequence. This value should honor the rules of the coordinateSystem.", 0, 1, windowStart));
1022          children.add(new Property("windowEnd", "integer", "End position of the window on the reference sequence. This value should honor the rules of the  coordinateSystem.", 0, 1, windowEnd));
1023          children.add(new Property("orientation", "code", "A relative reference to a DNA strand based on gene orientation. The strand that contains the open reading frame of the gene is the \"sense\" strand, and the opposite complementary strand is the \"antisense\" strand.", 0, 1, orientation));
1024          children.add(new Property("strand", "code", "An absolute reference to a strand. The Watson strand is the strand whose 5'-end is on the short arm of the chromosome, and the Crick strand as the one whose 5'-end is on the long arm.", 0, 1, strand));
1025        }
1026
1027        @Override
1028        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1029          switch (_hash) {
1030          case 1430214194: /*referenceSequenceAssembly*/  return new Property("referenceSequenceAssembly", "CodeableConcept", "The reference assembly used for reference, e.g. GRCh38.", 0, 1, referenceSequenceAssembly);
1031          case -1499470472: /*chromosome*/  return new Property("chromosome", "CodeableConcept", "Structural unit composed of a nucleic acid molecule which controls its own replication through the interaction of specific proteins at one or more origins of replication ([SO:0000340](http://www.sequenceontology.org/browser/current_svn/term/SO:0000340)).", 0, 1, chromosome);
1032          case -596785964: /*referenceSequence[x]*/  return new Property("referenceSequence[x]", "CodeableConcept|string|Reference(MolecularSequence)", "The reference sequence that represents the starting sequence.", 0, 1, referenceSequence);
1033          case 1501798444: /*referenceSequence*/  return new Property("referenceSequence[x]", "CodeableConcept|string|Reference(MolecularSequence)", "The reference sequence that represents the starting sequence.", 0, 1, referenceSequence);
1034          case -1155978795: /*referenceSequenceCodeableConcept*/  return new Property("referenceSequence[x]", "CodeableConcept", "The reference sequence that represents the starting sequence.", 0, 1, referenceSequence);
1035          case 2081954653: /*referenceSequenceString*/  return new Property("referenceSequence[x]", "string", "The reference sequence that represents the starting sequence.", 0, 1, referenceSequence);
1036          case -847433601: /*referenceSequenceReference*/  return new Property("referenceSequence[x]", "Reference(MolecularSequence)", "The reference sequence that represents the starting sequence.", 0, 1, referenceSequence);
1037          case 1903685202: /*windowStart*/  return new Property("windowStart", "integer", "Start position of the window on the reference sequence. This value should honor the rules of the coordinateSystem.", 0, 1, windowStart);
1038          case -217026869: /*windowEnd*/  return new Property("windowEnd", "integer", "End position of the window on the reference sequence. This value should honor the rules of the  coordinateSystem.", 0, 1, windowEnd);
1039          case -1439500848: /*orientation*/  return new Property("orientation", "code", "A relative reference to a DNA strand based on gene orientation. The strand that contains the open reading frame of the gene is the \"sense\" strand, and the opposite complementary strand is the \"antisense\" strand.", 0, 1, orientation);
1040          case -891993594: /*strand*/  return new Property("strand", "code", "An absolute reference to a strand. The Watson strand is the strand whose 5'-end is on the short arm of the chromosome, and the Crick strand as the one whose 5'-end is on the long arm.", 0, 1, strand);
1041          default: return super.getNamedProperty(_hash, _name, _checkValid);
1042          }
1043
1044        }
1045
1046      @Override
1047      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1048        switch (hash) {
1049        case 1430214194: /*referenceSequenceAssembly*/ return this.referenceSequenceAssembly == null ? new Base[0] : new Base[] {this.referenceSequenceAssembly}; // CodeableConcept
1050        case -1499470472: /*chromosome*/ return this.chromosome == null ? new Base[0] : new Base[] {this.chromosome}; // CodeableConcept
1051        case 1501798444: /*referenceSequence*/ return this.referenceSequence == null ? new Base[0] : new Base[] {this.referenceSequence}; // DataType
1052        case 1903685202: /*windowStart*/ return this.windowStart == null ? new Base[0] : new Base[] {this.windowStart}; // IntegerType
1053        case -217026869: /*windowEnd*/ return this.windowEnd == null ? new Base[0] : new Base[] {this.windowEnd}; // IntegerType
1054        case -1439500848: /*orientation*/ return this.orientation == null ? new Base[0] : new Base[] {this.orientation}; // Enumeration<OrientationType>
1055        case -891993594: /*strand*/ return this.strand == null ? new Base[0] : new Base[] {this.strand}; // Enumeration<StrandType>
1056        default: return super.getProperty(hash, name, checkValid);
1057        }
1058
1059      }
1060
1061      @Override
1062      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1063        switch (hash) {
1064        case 1430214194: // referenceSequenceAssembly
1065          this.referenceSequenceAssembly = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1066          return value;
1067        case -1499470472: // chromosome
1068          this.chromosome = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1069          return value;
1070        case 1501798444: // referenceSequence
1071          this.referenceSequence = TypeConvertor.castToType(value); // DataType
1072          return value;
1073        case 1903685202: // windowStart
1074          this.windowStart = TypeConvertor.castToInteger(value); // IntegerType
1075          return value;
1076        case -217026869: // windowEnd
1077          this.windowEnd = TypeConvertor.castToInteger(value); // IntegerType
1078          return value;
1079        case -1439500848: // orientation
1080          value = new OrientationTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1081          this.orientation = (Enumeration) value; // Enumeration<OrientationType>
1082          return value;
1083        case -891993594: // strand
1084          value = new StrandTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1085          this.strand = (Enumeration) value; // Enumeration<StrandType>
1086          return value;
1087        default: return super.setProperty(hash, name, value);
1088        }
1089
1090      }
1091
1092      @Override
1093      public Base setProperty(String name, Base value) throws FHIRException {
1094        if (name.equals("referenceSequenceAssembly")) {
1095          this.referenceSequenceAssembly = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1096        } else if (name.equals("chromosome")) {
1097          this.chromosome = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1098        } else if (name.equals("referenceSequence[x]")) {
1099          this.referenceSequence = TypeConvertor.castToType(value); // DataType
1100        } else if (name.equals("windowStart")) {
1101          this.windowStart = TypeConvertor.castToInteger(value); // IntegerType
1102        } else if (name.equals("windowEnd")) {
1103          this.windowEnd = TypeConvertor.castToInteger(value); // IntegerType
1104        } else if (name.equals("orientation")) {
1105          value = new OrientationTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1106          this.orientation = (Enumeration) value; // Enumeration<OrientationType>
1107        } else if (name.equals("strand")) {
1108          value = new StrandTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
1109          this.strand = (Enumeration) value; // Enumeration<StrandType>
1110        } else
1111          return super.setProperty(name, value);
1112        return value;
1113      }
1114
1115      @Override
1116      public Base makeProperty(int hash, String name) throws FHIRException {
1117        switch (hash) {
1118        case 1430214194:  return getReferenceSequenceAssembly();
1119        case -1499470472:  return getChromosome();
1120        case -596785964:  return getReferenceSequence();
1121        case 1501798444:  return getReferenceSequence();
1122        case 1903685202:  return getWindowStartElement();
1123        case -217026869:  return getWindowEndElement();
1124        case -1439500848:  return getOrientationElement();
1125        case -891993594:  return getStrandElement();
1126        default: return super.makeProperty(hash, name);
1127        }
1128
1129      }
1130
1131      @Override
1132      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1133        switch (hash) {
1134        case 1430214194: /*referenceSequenceAssembly*/ return new String[] {"CodeableConcept"};
1135        case -1499470472: /*chromosome*/ return new String[] {"CodeableConcept"};
1136        case 1501798444: /*referenceSequence*/ return new String[] {"CodeableConcept", "string", "Reference"};
1137        case 1903685202: /*windowStart*/ return new String[] {"integer"};
1138        case -217026869: /*windowEnd*/ return new String[] {"integer"};
1139        case -1439500848: /*orientation*/ return new String[] {"code"};
1140        case -891993594: /*strand*/ return new String[] {"code"};
1141        default: return super.getTypesForProperty(hash, name);
1142        }
1143
1144      }
1145
1146      @Override
1147      public Base addChild(String name) throws FHIRException {
1148        if (name.equals("referenceSequenceAssembly")) {
1149          this.referenceSequenceAssembly = new CodeableConcept();
1150          return this.referenceSequenceAssembly;
1151        }
1152        else if (name.equals("chromosome")) {
1153          this.chromosome = new CodeableConcept();
1154          return this.chromosome;
1155        }
1156        else if (name.equals("referenceSequenceCodeableConcept")) {
1157          this.referenceSequence = new CodeableConcept();
1158          return this.referenceSequence;
1159        }
1160        else if (name.equals("referenceSequenceString")) {
1161          this.referenceSequence = new StringType();
1162          return this.referenceSequence;
1163        }
1164        else if (name.equals("referenceSequenceReference")) {
1165          this.referenceSequence = new Reference();
1166          return this.referenceSequence;
1167        }
1168        else if (name.equals("windowStart")) {
1169          throw new FHIRException("Cannot call addChild on a primitive type MolecularSequence.relative.reference.windowStart");
1170        }
1171        else if (name.equals("windowEnd")) {
1172          throw new FHIRException("Cannot call addChild on a primitive type MolecularSequence.relative.reference.windowEnd");
1173        }
1174        else if (name.equals("orientation")) {
1175          throw new FHIRException("Cannot call addChild on a primitive type MolecularSequence.relative.reference.orientation");
1176        }
1177        else if (name.equals("strand")) {
1178          throw new FHIRException("Cannot call addChild on a primitive type MolecularSequence.relative.reference.strand");
1179        }
1180        else
1181          return super.addChild(name);
1182      }
1183
1184      public MolecularSequenceRelativeReferenceComponent copy() {
1185        MolecularSequenceRelativeReferenceComponent dst = new MolecularSequenceRelativeReferenceComponent();
1186        copyValues(dst);
1187        return dst;
1188      }
1189
1190      public void copyValues(MolecularSequenceRelativeReferenceComponent dst) {
1191        super.copyValues(dst);
1192        dst.referenceSequenceAssembly = referenceSequenceAssembly == null ? null : referenceSequenceAssembly.copy();
1193        dst.chromosome = chromosome == null ? null : chromosome.copy();
1194        dst.referenceSequence = referenceSequence == null ? null : referenceSequence.copy();
1195        dst.windowStart = windowStart == null ? null : windowStart.copy();
1196        dst.windowEnd = windowEnd == null ? null : windowEnd.copy();
1197        dst.orientation = orientation == null ? null : orientation.copy();
1198        dst.strand = strand == null ? null : strand.copy();
1199      }
1200
1201      @Override
1202      public boolean equalsDeep(Base other_) {
1203        if (!super.equalsDeep(other_))
1204          return false;
1205        if (!(other_ instanceof MolecularSequenceRelativeReferenceComponent))
1206          return false;
1207        MolecularSequenceRelativeReferenceComponent o = (MolecularSequenceRelativeReferenceComponent) other_;
1208        return compareDeep(referenceSequenceAssembly, o.referenceSequenceAssembly, true) && compareDeep(chromosome, o.chromosome, true)
1209           && compareDeep(referenceSequence, o.referenceSequence, true) && compareDeep(windowStart, o.windowStart, true)
1210           && compareDeep(windowEnd, o.windowEnd, true) && compareDeep(orientation, o.orientation, true) && compareDeep(strand, o.strand, true)
1211          ;
1212      }
1213
1214      @Override
1215      public boolean equalsShallow(Base other_) {
1216        if (!super.equalsShallow(other_))
1217          return false;
1218        if (!(other_ instanceof MolecularSequenceRelativeReferenceComponent))
1219          return false;
1220        MolecularSequenceRelativeReferenceComponent o = (MolecularSequenceRelativeReferenceComponent) other_;
1221        return compareValues(windowStart, o.windowStart, true) && compareValues(windowEnd, o.windowEnd, true)
1222           && compareValues(orientation, o.orientation, true) && compareValues(strand, o.strand, true);
1223      }
1224
1225      public boolean isEmpty() {
1226        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(referenceSequenceAssembly, chromosome
1227          , referenceSequence, windowStart, windowEnd, orientation, strand);
1228      }
1229
1230  public String fhirType() {
1231    return "MolecularSequence.relative.reference";
1232
1233  }
1234
1235  }
1236
1237    @Block()
1238    public static class MolecularSequenceRelativeEditComponent extends BackboneElement implements IBaseBackboneElement {
1239        /**
1240         * Start position of the edit on the reference sequence. If the coordinate system is either 0-based or 1-based, then start position is inclusive.
1241         */
1242        @Child(name = "start", type = {IntegerType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1243        @Description(shortDefinition="Start position of the edit on the reference sequence", formalDefinition="Start position of the edit on the reference sequence. If the coordinate system is either 0-based or 1-based, then start position is inclusive." )
1244        protected IntegerType start;
1245
1246        /**
1247         * End position of the edit on the reference sequence. If the coordinate system is 0-based then end is exclusive and does not include the last position. If the coordinate system is 1-base, then end is inclusive and includes the last position.
1248         */
1249        @Child(name = "end", type = {IntegerType.class}, order=2, min=0, max=1, modifier=false, summary=true)
1250        @Description(shortDefinition="End position of the edit on the reference sequence", formalDefinition="End position of the edit on the reference sequence. If the coordinate system is 0-based then end is exclusive and does not include the last position. If the coordinate system is 1-base, then end is inclusive and includes the last position." )
1251        protected IntegerType end;
1252
1253        /**
1254         * Allele that was observed. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the observed sequence. When the sequence type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.
1255         */
1256        @Child(name = "observedAllele", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1257        @Description(shortDefinition="Allele that was observed", formalDefinition="Allele that was observed. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the observed sequence. When the sequence type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end." )
1258        protected StringType observedAllele;
1259
1260        /**
1261         * Allele in the reference sequence. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the reference sequence. When the sequence  type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.
1262         */
1263        @Child(name = "referenceAllele", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
1264        @Description(shortDefinition="Allele in the reference sequence", formalDefinition="Allele in the reference sequence. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the reference sequence. When the sequence  type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end." )
1265        protected StringType referenceAllele;
1266
1267        private static final long serialVersionUID = -405313764L;
1268
1269    /**
1270     * Constructor
1271     */
1272      public MolecularSequenceRelativeEditComponent() {
1273        super();
1274      }
1275
1276        /**
1277         * @return {@link #start} (Start position of the edit on the reference sequence. If the coordinate system is either 0-based or 1-based, then start position is inclusive.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
1278         */
1279        public IntegerType getStartElement() { 
1280          if (this.start == null)
1281            if (Configuration.errorOnAutoCreate())
1282              throw new Error("Attempt to auto-create MolecularSequenceRelativeEditComponent.start");
1283            else if (Configuration.doAutoCreate())
1284              this.start = new IntegerType(); // bb
1285          return this.start;
1286        }
1287
1288        public boolean hasStartElement() { 
1289          return this.start != null && !this.start.isEmpty();
1290        }
1291
1292        public boolean hasStart() { 
1293          return this.start != null && !this.start.isEmpty();
1294        }
1295
1296        /**
1297         * @param value {@link #start} (Start position of the edit on the reference sequence. If the coordinate system is either 0-based or 1-based, then start position is inclusive.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
1298         */
1299        public MolecularSequenceRelativeEditComponent setStartElement(IntegerType value) { 
1300          this.start = value;
1301          return this;
1302        }
1303
1304        /**
1305         * @return Start position of the edit on the reference sequence. If the coordinate system is either 0-based or 1-based, then start position is inclusive.
1306         */
1307        public int getStart() { 
1308          return this.start == null || this.start.isEmpty() ? 0 : this.start.getValue();
1309        }
1310
1311        /**
1312         * @param value Start position of the edit on the reference sequence. If the coordinate system is either 0-based or 1-based, then start position is inclusive.
1313         */
1314        public MolecularSequenceRelativeEditComponent setStart(int value) { 
1315            if (this.start == null)
1316              this.start = new IntegerType();
1317            this.start.setValue(value);
1318          return this;
1319        }
1320
1321        /**
1322         * @return {@link #end} (End position of the edit on the reference sequence. If the coordinate system is 0-based then end is exclusive and does not include the last position. If the coordinate system is 1-base, then end is inclusive and includes the last position.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
1323         */
1324        public IntegerType getEndElement() { 
1325          if (this.end == null)
1326            if (Configuration.errorOnAutoCreate())
1327              throw new Error("Attempt to auto-create MolecularSequenceRelativeEditComponent.end");
1328            else if (Configuration.doAutoCreate())
1329              this.end = new IntegerType(); // bb
1330          return this.end;
1331        }
1332
1333        public boolean hasEndElement() { 
1334          return this.end != null && !this.end.isEmpty();
1335        }
1336
1337        public boolean hasEnd() { 
1338          return this.end != null && !this.end.isEmpty();
1339        }
1340
1341        /**
1342         * @param value {@link #end} (End position of the edit on the reference sequence. If the coordinate system is 0-based then end is exclusive and does not include the last position. If the coordinate system is 1-base, then end is inclusive and includes the last position.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
1343         */
1344        public MolecularSequenceRelativeEditComponent setEndElement(IntegerType value) { 
1345          this.end = value;
1346          return this;
1347        }
1348
1349        /**
1350         * @return End position of the edit on the reference sequence. If the coordinate system is 0-based then end is exclusive and does not include the last position. If the coordinate system is 1-base, then end is inclusive and includes the last position.
1351         */
1352        public int getEnd() { 
1353          return this.end == null || this.end.isEmpty() ? 0 : this.end.getValue();
1354        }
1355
1356        /**
1357         * @param value End position of the edit on the reference sequence. If the coordinate system is 0-based then end is exclusive and does not include the last position. If the coordinate system is 1-base, then end is inclusive and includes the last position.
1358         */
1359        public MolecularSequenceRelativeEditComponent setEnd(int value) { 
1360            if (this.end == null)
1361              this.end = new IntegerType();
1362            this.end.setValue(value);
1363          return this;
1364        }
1365
1366        /**
1367         * @return {@link #observedAllele} (Allele that was observed. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the observed sequence. When the sequence type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.). This is the underlying object with id, value and extensions. The accessor "getObservedAllele" gives direct access to the value
1368         */
1369        public StringType getObservedAlleleElement() { 
1370          if (this.observedAllele == null)
1371            if (Configuration.errorOnAutoCreate())
1372              throw new Error("Attempt to auto-create MolecularSequenceRelativeEditComponent.observedAllele");
1373            else if (Configuration.doAutoCreate())
1374              this.observedAllele = new StringType(); // bb
1375          return this.observedAllele;
1376        }
1377
1378        public boolean hasObservedAlleleElement() { 
1379          return this.observedAllele != null && !this.observedAllele.isEmpty();
1380        }
1381
1382        public boolean hasObservedAllele() { 
1383          return this.observedAllele != null && !this.observedAllele.isEmpty();
1384        }
1385
1386        /**
1387         * @param value {@link #observedAllele} (Allele that was observed. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the observed sequence. When the sequence type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.). This is the underlying object with id, value and extensions. The accessor "getObservedAllele" gives direct access to the value
1388         */
1389        public MolecularSequenceRelativeEditComponent setObservedAlleleElement(StringType value) { 
1390          this.observedAllele = value;
1391          return this;
1392        }
1393
1394        /**
1395         * @return Allele that was observed. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the observed sequence. When the sequence type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.
1396         */
1397        public String getObservedAllele() { 
1398          return this.observedAllele == null ? null : this.observedAllele.getValue();
1399        }
1400
1401        /**
1402         * @param value Allele that was observed. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the observed sequence. When the sequence type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.
1403         */
1404        public MolecularSequenceRelativeEditComponent setObservedAllele(String value) { 
1405          if (Utilities.noString(value))
1406            this.observedAllele = null;
1407          else {
1408            if (this.observedAllele == null)
1409              this.observedAllele = new StringType();
1410            this.observedAllele.setValue(value);
1411          }
1412          return this;
1413        }
1414
1415        /**
1416         * @return {@link #referenceAllele} (Allele in the reference sequence. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the reference sequence. When the sequence  type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.). This is the underlying object with id, value and extensions. The accessor "getReferenceAllele" gives direct access to the value
1417         */
1418        public StringType getReferenceAlleleElement() { 
1419          if (this.referenceAllele == null)
1420            if (Configuration.errorOnAutoCreate())
1421              throw new Error("Attempt to auto-create MolecularSequenceRelativeEditComponent.referenceAllele");
1422            else if (Configuration.doAutoCreate())
1423              this.referenceAllele = new StringType(); // bb
1424          return this.referenceAllele;
1425        }
1426
1427        public boolean hasReferenceAlleleElement() { 
1428          return this.referenceAllele != null && !this.referenceAllele.isEmpty();
1429        }
1430
1431        public boolean hasReferenceAllele() { 
1432          return this.referenceAllele != null && !this.referenceAllele.isEmpty();
1433        }
1434
1435        /**
1436         * @param value {@link #referenceAllele} (Allele in the reference sequence. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the reference sequence. When the sequence  type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.). This is the underlying object with id, value and extensions. The accessor "getReferenceAllele" gives direct access to the value
1437         */
1438        public MolecularSequenceRelativeEditComponent setReferenceAlleleElement(StringType value) { 
1439          this.referenceAllele = value;
1440          return this;
1441        }
1442
1443        /**
1444         * @return Allele in the reference sequence. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the reference sequence. When the sequence  type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.
1445         */
1446        public String getReferenceAllele() { 
1447          return this.referenceAllele == null ? null : this.referenceAllele.getValue();
1448        }
1449
1450        /**
1451         * @param value Allele in the reference sequence. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the reference sequence. When the sequence  type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.
1452         */
1453        public MolecularSequenceRelativeEditComponent setReferenceAllele(String value) { 
1454          if (Utilities.noString(value))
1455            this.referenceAllele = null;
1456          else {
1457            if (this.referenceAllele == null)
1458              this.referenceAllele = new StringType();
1459            this.referenceAllele.setValue(value);
1460          }
1461          return this;
1462        }
1463
1464        protected void listChildren(List<Property> children) {
1465          super.listChildren(children);
1466          children.add(new Property("start", "integer", "Start position of the edit on the reference sequence. If the coordinate system is either 0-based or 1-based, then start position is inclusive.", 0, 1, start));
1467          children.add(new Property("end", "integer", "End position of the edit on the reference sequence. If the coordinate system is 0-based then end is exclusive and does not include the last position. If the coordinate system is 1-base, then end is inclusive and includes the last position.", 0, 1, end));
1468          children.add(new Property("observedAllele", "string", "Allele that was observed. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the observed sequence. When the sequence type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.", 0, 1, observedAllele));
1469          children.add(new Property("referenceAllele", "string", "Allele in the reference sequence. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the reference sequence. When the sequence  type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.", 0, 1, referenceAllele));
1470        }
1471
1472        @Override
1473        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1474          switch (_hash) {
1475          case 109757538: /*start*/  return new Property("start", "integer", "Start position of the edit on the reference sequence. If the coordinate system is either 0-based or 1-based, then start position is inclusive.", 0, 1, start);
1476          case 100571: /*end*/  return new Property("end", "integer", "End position of the edit on the reference sequence. If the coordinate system is 0-based then end is exclusive and does not include the last position. If the coordinate system is 1-base, then end is inclusive and includes the last position.", 0, 1, end);
1477          case -1418745787: /*observedAllele*/  return new Property("observedAllele", "string", "Allele that was observed. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the observed sequence. When the sequence type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.", 0, 1, observedAllele);
1478          case 364045960: /*referenceAllele*/  return new Property("referenceAllele", "string", "Allele in the reference sequence. Nucleotide(s)/amino acids from start position of sequence to stop position of sequence on the positive (+) strand of the reference sequence. When the sequence  type is DNA, it should be the sequence on the positive (+) strand. This will lay in the range between variant.start and variant.end.", 0, 1, referenceAllele);
1479          default: return super.getNamedProperty(_hash, _name, _checkValid);
1480          }
1481
1482        }
1483
1484      @Override
1485      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1486        switch (hash) {
1487        case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // IntegerType
1488        case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // IntegerType
1489        case -1418745787: /*observedAllele*/ return this.observedAllele == null ? new Base[0] : new Base[] {this.observedAllele}; // StringType
1490        case 364045960: /*referenceAllele*/ return this.referenceAllele == null ? new Base[0] : new Base[] {this.referenceAllele}; // StringType
1491        default: return super.getProperty(hash, name, checkValid);
1492        }
1493
1494      }
1495
1496      @Override
1497      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1498        switch (hash) {
1499        case 109757538: // start
1500          this.start = TypeConvertor.castToInteger(value); // IntegerType
1501          return value;
1502        case 100571: // end
1503          this.end = TypeConvertor.castToInteger(value); // IntegerType
1504          return value;
1505        case -1418745787: // observedAllele
1506          this.observedAllele = TypeConvertor.castToString(value); // StringType
1507          return value;
1508        case 364045960: // referenceAllele
1509          this.referenceAllele = TypeConvertor.castToString(value); // StringType
1510          return value;
1511        default: return super.setProperty(hash, name, value);
1512        }
1513
1514      }
1515
1516      @Override
1517      public Base setProperty(String name, Base value) throws FHIRException {
1518        if (name.equals("start")) {
1519          this.start = TypeConvertor.castToInteger(value); // IntegerType
1520        } else if (name.equals("end")) {
1521          this.end = TypeConvertor.castToInteger(value); // IntegerType
1522        } else if (name.equals("observedAllele")) {
1523          this.observedAllele = TypeConvertor.castToString(value); // StringType
1524        } else if (name.equals("referenceAllele")) {
1525          this.referenceAllele = TypeConvertor.castToString(value); // StringType
1526        } else
1527          return super.setProperty(name, value);
1528        return value;
1529      }
1530
1531      @Override
1532      public Base makeProperty(int hash, String name) throws FHIRException {
1533        switch (hash) {
1534        case 109757538:  return getStartElement();
1535        case 100571:  return getEndElement();
1536        case -1418745787:  return getObservedAlleleElement();
1537        case 364045960:  return getReferenceAlleleElement();
1538        default: return super.makeProperty(hash, name);
1539        }
1540
1541      }
1542
1543      @Override
1544      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1545        switch (hash) {
1546        case 109757538: /*start*/ return new String[] {"integer"};
1547        case 100571: /*end*/ return new String[] {"integer"};
1548        case -1418745787: /*observedAllele*/ return new String[] {"string"};
1549        case 364045960: /*referenceAllele*/ return new String[] {"string"};
1550        default: return super.getTypesForProperty(hash, name);
1551        }
1552
1553      }
1554
1555      @Override
1556      public Base addChild(String name) throws FHIRException {
1557        if (name.equals("start")) {
1558          throw new FHIRException("Cannot call addChild on a primitive type MolecularSequence.relative.edit.start");
1559        }
1560        else if (name.equals("end")) {
1561          throw new FHIRException("Cannot call addChild on a primitive type MolecularSequence.relative.edit.end");
1562        }
1563        else if (name.equals("observedAllele")) {
1564          throw new FHIRException("Cannot call addChild on a primitive type MolecularSequence.relative.edit.observedAllele");
1565        }
1566        else if (name.equals("referenceAllele")) {
1567          throw new FHIRException("Cannot call addChild on a primitive type MolecularSequence.relative.edit.referenceAllele");
1568        }
1569        else
1570          return super.addChild(name);
1571      }
1572
1573      public MolecularSequenceRelativeEditComponent copy() {
1574        MolecularSequenceRelativeEditComponent dst = new MolecularSequenceRelativeEditComponent();
1575        copyValues(dst);
1576        return dst;
1577      }
1578
1579      public void copyValues(MolecularSequenceRelativeEditComponent dst) {
1580        super.copyValues(dst);
1581        dst.start = start == null ? null : start.copy();
1582        dst.end = end == null ? null : end.copy();
1583        dst.observedAllele = observedAllele == null ? null : observedAllele.copy();
1584        dst.referenceAllele = referenceAllele == null ? null : referenceAllele.copy();
1585      }
1586
1587      @Override
1588      public boolean equalsDeep(Base other_) {
1589        if (!super.equalsDeep(other_))
1590          return false;
1591        if (!(other_ instanceof MolecularSequenceRelativeEditComponent))
1592          return false;
1593        MolecularSequenceRelativeEditComponent o = (MolecularSequenceRelativeEditComponent) other_;
1594        return compareDeep(start, o.start, true) && compareDeep(end, o.end, true) && compareDeep(observedAllele, o.observedAllele, true)
1595           && compareDeep(referenceAllele, o.referenceAllele, true);
1596      }
1597
1598      @Override
1599      public boolean equalsShallow(Base other_) {
1600        if (!super.equalsShallow(other_))
1601          return false;
1602        if (!(other_ instanceof MolecularSequenceRelativeEditComponent))
1603          return false;
1604        MolecularSequenceRelativeEditComponent o = (MolecularSequenceRelativeEditComponent) other_;
1605        return compareValues(start, o.start, true) && compareValues(end, o.end, true) && compareValues(observedAllele, o.observedAllele, true)
1606           && compareValues(referenceAllele, o.referenceAllele, true);
1607      }
1608
1609      public boolean isEmpty() {
1610        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(start, end, observedAllele
1611          , referenceAllele);
1612      }
1613
1614  public String fhirType() {
1615    return "MolecularSequence.relative.edit";
1616
1617  }
1618
1619  }
1620
1621    /**
1622     * A unique identifier for this particular sequence instance.
1623     */
1624    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1625    @Description(shortDefinition="Unique ID for this particular sequence", formalDefinition="A unique identifier for this particular sequence instance." )
1626    protected List<Identifier> identifier;
1627
1628    /**
1629     * Amino Acid Sequence/ DNA Sequence / RNA Sequence.
1630     */
1631    @Child(name = "type", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
1632    @Description(shortDefinition="aa | dna | rna", formalDefinition="Amino Acid Sequence/ DNA Sequence / RNA Sequence." )
1633    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/sequence-type")
1634    protected Enumeration<SequenceType> type;
1635
1636    /**
1637     * Indicates the patient this sequence is associated too.
1638     */
1639    @Child(name = "patient", type = {Patient.class}, order=2, min=0, max=1, modifier=false, summary=true)
1640    @Description(shortDefinition="Patient this sequence is associated too", formalDefinition="Indicates the patient this sequence is associated too." )
1641    protected Reference patient;
1642
1643    /**
1644     * Specimen used for sequencing.
1645     */
1646    @Child(name = "specimen", type = {Specimen.class}, order=3, min=0, max=1, modifier=false, summary=true)
1647    @Description(shortDefinition="Specimen used for sequencing", formalDefinition="Specimen used for sequencing." )
1648    protected Reference specimen;
1649
1650    /**
1651     * The method for sequencing, for example, chip information.
1652     */
1653    @Child(name = "device", type = {Device.class}, order=4, min=0, max=1, modifier=false, summary=true)
1654    @Description(shortDefinition="The method for sequencing", formalDefinition="The method for sequencing, for example, chip information." )
1655    protected Reference device;
1656
1657    /**
1658     * The organization or lab that should be responsible for this result.
1659     */
1660    @Child(name = "performer", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=true)
1661    @Description(shortDefinition="Who should be responsible for test result", formalDefinition="The organization or lab that should be responsible for this result." )
1662    protected Reference performer;
1663
1664    /**
1665     * Sequence that was observed.
1666     */
1667    @Child(name = "literal", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1668    @Description(shortDefinition="Sequence that was observed", formalDefinition="Sequence that was observed." )
1669    protected StringType literal;
1670
1671    /**
1672     * Sequence that was observed as file content. Can be an actual file contents, or referenced by a URL to an external system.
1673     */
1674    @Child(name = "formatted", type = {Attachment.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1675    @Description(shortDefinition="Embedded file or a link (URL) which contains content to represent the sequence", formalDefinition="Sequence that was observed as file content. Can be an actual file contents, or referenced by a URL to an external system." )
1676    protected List<Attachment> formatted;
1677
1678    /**
1679     * A sequence defined relative to another sequence.
1680     */
1681    @Child(name = "relative", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1682    @Description(shortDefinition="A sequence defined relative to another sequence", formalDefinition="A sequence defined relative to another sequence." )
1683    protected List<MolecularSequenceRelativeComponent> relative;
1684
1685    private static final long serialVersionUID = -1388366786L;
1686
1687  /**
1688   * Constructor
1689   */
1690    public MolecularSequence() {
1691      super();
1692    }
1693
1694    /**
1695     * @return {@link #identifier} (A unique identifier for this particular sequence instance.)
1696     */
1697    public List<Identifier> getIdentifier() { 
1698      if (this.identifier == null)
1699        this.identifier = new ArrayList<Identifier>();
1700      return this.identifier;
1701    }
1702
1703    /**
1704     * @return Returns a reference to <code>this</code> for easy method chaining
1705     */
1706    public MolecularSequence setIdentifier(List<Identifier> theIdentifier) { 
1707      this.identifier = theIdentifier;
1708      return this;
1709    }
1710
1711    public boolean hasIdentifier() { 
1712      if (this.identifier == null)
1713        return false;
1714      for (Identifier item : this.identifier)
1715        if (!item.isEmpty())
1716          return true;
1717      return false;
1718    }
1719
1720    public Identifier addIdentifier() { //3
1721      Identifier t = new Identifier();
1722      if (this.identifier == null)
1723        this.identifier = new ArrayList<Identifier>();
1724      this.identifier.add(t);
1725      return t;
1726    }
1727
1728    public MolecularSequence addIdentifier(Identifier t) { //3
1729      if (t == null)
1730        return this;
1731      if (this.identifier == null)
1732        this.identifier = new ArrayList<Identifier>();
1733      this.identifier.add(t);
1734      return this;
1735    }
1736
1737    /**
1738     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
1739     */
1740    public Identifier getIdentifierFirstRep() { 
1741      if (getIdentifier().isEmpty()) {
1742        addIdentifier();
1743      }
1744      return getIdentifier().get(0);
1745    }
1746
1747    /**
1748     * @return {@link #type} (Amino Acid Sequence/ DNA Sequence / RNA Sequence.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1749     */
1750    public Enumeration<SequenceType> getTypeElement() { 
1751      if (this.type == null)
1752        if (Configuration.errorOnAutoCreate())
1753          throw new Error("Attempt to auto-create MolecularSequence.type");
1754        else if (Configuration.doAutoCreate())
1755          this.type = new Enumeration<SequenceType>(new SequenceTypeEnumFactory()); // bb
1756      return this.type;
1757    }
1758
1759    public boolean hasTypeElement() { 
1760      return this.type != null && !this.type.isEmpty();
1761    }
1762
1763    public boolean hasType() { 
1764      return this.type != null && !this.type.isEmpty();
1765    }
1766
1767    /**
1768     * @param value {@link #type} (Amino Acid Sequence/ DNA Sequence / RNA Sequence.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
1769     */
1770    public MolecularSequence setTypeElement(Enumeration<SequenceType> value) { 
1771      this.type = value;
1772      return this;
1773    }
1774
1775    /**
1776     * @return Amino Acid Sequence/ DNA Sequence / RNA Sequence.
1777     */
1778    public SequenceType getType() { 
1779      return this.type == null ? null : this.type.getValue();
1780    }
1781
1782    /**
1783     * @param value Amino Acid Sequence/ DNA Sequence / RNA Sequence.
1784     */
1785    public MolecularSequence setType(SequenceType value) { 
1786      if (value == null)
1787        this.type = null;
1788      else {
1789        if (this.type == null)
1790          this.type = new Enumeration<SequenceType>(new SequenceTypeEnumFactory());
1791        this.type.setValue(value);
1792      }
1793      return this;
1794    }
1795
1796    /**
1797     * @return {@link #patient} (Indicates the patient this sequence is associated too.)
1798     */
1799    public Reference getPatient() { 
1800      if (this.patient == null)
1801        if (Configuration.errorOnAutoCreate())
1802          throw new Error("Attempt to auto-create MolecularSequence.patient");
1803        else if (Configuration.doAutoCreate())
1804          this.patient = new Reference(); // cc
1805      return this.patient;
1806    }
1807
1808    public boolean hasPatient() { 
1809      return this.patient != null && !this.patient.isEmpty();
1810    }
1811
1812    /**
1813     * @param value {@link #patient} (Indicates the patient this sequence is associated too.)
1814     */
1815    public MolecularSequence setPatient(Reference value) { 
1816      this.patient = value;
1817      return this;
1818    }
1819
1820    /**
1821     * @return {@link #specimen} (Specimen used for sequencing.)
1822     */
1823    public Reference getSpecimen() { 
1824      if (this.specimen == null)
1825        if (Configuration.errorOnAutoCreate())
1826          throw new Error("Attempt to auto-create MolecularSequence.specimen");
1827        else if (Configuration.doAutoCreate())
1828          this.specimen = new Reference(); // cc
1829      return this.specimen;
1830    }
1831
1832    public boolean hasSpecimen() { 
1833      return this.specimen != null && !this.specimen.isEmpty();
1834    }
1835
1836    /**
1837     * @param value {@link #specimen} (Specimen used for sequencing.)
1838     */
1839    public MolecularSequence setSpecimen(Reference value) { 
1840      this.specimen = value;
1841      return this;
1842    }
1843
1844    /**
1845     * @return {@link #device} (The method for sequencing, for example, chip information.)
1846     */
1847    public Reference getDevice() { 
1848      if (this.device == null)
1849        if (Configuration.errorOnAutoCreate())
1850          throw new Error("Attempt to auto-create MolecularSequence.device");
1851        else if (Configuration.doAutoCreate())
1852          this.device = new Reference(); // cc
1853      return this.device;
1854    }
1855
1856    public boolean hasDevice() { 
1857      return this.device != null && !this.device.isEmpty();
1858    }
1859
1860    /**
1861     * @param value {@link #device} (The method for sequencing, for example, chip information.)
1862     */
1863    public MolecularSequence setDevice(Reference value) { 
1864      this.device = value;
1865      return this;
1866    }
1867
1868    /**
1869     * @return {@link #performer} (The organization or lab that should be responsible for this result.)
1870     */
1871    public Reference getPerformer() { 
1872      if (this.performer == null)
1873        if (Configuration.errorOnAutoCreate())
1874          throw new Error("Attempt to auto-create MolecularSequence.performer");
1875        else if (Configuration.doAutoCreate())
1876          this.performer = new Reference(); // cc
1877      return this.performer;
1878    }
1879
1880    public boolean hasPerformer() { 
1881      return this.performer != null && !this.performer.isEmpty();
1882    }
1883
1884    /**
1885     * @param value {@link #performer} (The organization or lab that should be responsible for this result.)
1886     */
1887    public MolecularSequence setPerformer(Reference value) { 
1888      this.performer = value;
1889      return this;
1890    }
1891
1892    /**
1893     * @return {@link #literal} (Sequence that was observed.). This is the underlying object with id, value and extensions. The accessor "getLiteral" gives direct access to the value
1894     */
1895    public StringType getLiteralElement() { 
1896      if (this.literal == null)
1897        if (Configuration.errorOnAutoCreate())
1898          throw new Error("Attempt to auto-create MolecularSequence.literal");
1899        else if (Configuration.doAutoCreate())
1900          this.literal = new StringType(); // bb
1901      return this.literal;
1902    }
1903
1904    public boolean hasLiteralElement() { 
1905      return this.literal != null && !this.literal.isEmpty();
1906    }
1907
1908    public boolean hasLiteral() { 
1909      return this.literal != null && !this.literal.isEmpty();
1910    }
1911
1912    /**
1913     * @param value {@link #literal} (Sequence that was observed.). This is the underlying object with id, value and extensions. The accessor "getLiteral" gives direct access to the value
1914     */
1915    public MolecularSequence setLiteralElement(StringType value) { 
1916      this.literal = value;
1917      return this;
1918    }
1919
1920    /**
1921     * @return Sequence that was observed.
1922     */
1923    public String getLiteral() { 
1924      return this.literal == null ? null : this.literal.getValue();
1925    }
1926
1927    /**
1928     * @param value Sequence that was observed.
1929     */
1930    public MolecularSequence setLiteral(String value) { 
1931      if (Utilities.noString(value))
1932        this.literal = null;
1933      else {
1934        if (this.literal == null)
1935          this.literal = new StringType();
1936        this.literal.setValue(value);
1937      }
1938      return this;
1939    }
1940
1941    /**
1942     * @return {@link #formatted} (Sequence that was observed as file content. Can be an actual file contents, or referenced by a URL to an external system.)
1943     */
1944    public List<Attachment> getFormatted() { 
1945      if (this.formatted == null)
1946        this.formatted = new ArrayList<Attachment>();
1947      return this.formatted;
1948    }
1949
1950    /**
1951     * @return Returns a reference to <code>this</code> for easy method chaining
1952     */
1953    public MolecularSequence setFormatted(List<Attachment> theFormatted) { 
1954      this.formatted = theFormatted;
1955      return this;
1956    }
1957
1958    public boolean hasFormatted() { 
1959      if (this.formatted == null)
1960        return false;
1961      for (Attachment item : this.formatted)
1962        if (!item.isEmpty())
1963          return true;
1964      return false;
1965    }
1966
1967    public Attachment addFormatted() { //3
1968      Attachment t = new Attachment();
1969      if (this.formatted == null)
1970        this.formatted = new ArrayList<Attachment>();
1971      this.formatted.add(t);
1972      return t;
1973    }
1974
1975    public MolecularSequence addFormatted(Attachment t) { //3
1976      if (t == null)
1977        return this;
1978      if (this.formatted == null)
1979        this.formatted = new ArrayList<Attachment>();
1980      this.formatted.add(t);
1981      return this;
1982    }
1983
1984    /**
1985     * @return The first repetition of repeating field {@link #formatted}, creating it if it does not already exist {3}
1986     */
1987    public Attachment getFormattedFirstRep() { 
1988      if (getFormatted().isEmpty()) {
1989        addFormatted();
1990      }
1991      return getFormatted().get(0);
1992    }
1993
1994    /**
1995     * @return {@link #relative} (A sequence defined relative to another sequence.)
1996     */
1997    public List<MolecularSequenceRelativeComponent> getRelative() { 
1998      if (this.relative == null)
1999        this.relative = new ArrayList<MolecularSequenceRelativeComponent>();
2000      return this.relative;
2001    }
2002
2003    /**
2004     * @return Returns a reference to <code>this</code> for easy method chaining
2005     */
2006    public MolecularSequence setRelative(List<MolecularSequenceRelativeComponent> theRelative) { 
2007      this.relative = theRelative;
2008      return this;
2009    }
2010
2011    public boolean hasRelative() { 
2012      if (this.relative == null)
2013        return false;
2014      for (MolecularSequenceRelativeComponent item : this.relative)
2015        if (!item.isEmpty())
2016          return true;
2017      return false;
2018    }
2019
2020    public MolecularSequenceRelativeComponent addRelative() { //3
2021      MolecularSequenceRelativeComponent t = new MolecularSequenceRelativeComponent();
2022      if (this.relative == null)
2023        this.relative = new ArrayList<MolecularSequenceRelativeComponent>();
2024      this.relative.add(t);
2025      return t;
2026    }
2027
2028    public MolecularSequence addRelative(MolecularSequenceRelativeComponent t) { //3
2029      if (t == null)
2030        return this;
2031      if (this.relative == null)
2032        this.relative = new ArrayList<MolecularSequenceRelativeComponent>();
2033      this.relative.add(t);
2034      return this;
2035    }
2036
2037    /**
2038     * @return The first repetition of repeating field {@link #relative}, creating it if it does not already exist {3}
2039     */
2040    public MolecularSequenceRelativeComponent getRelativeFirstRep() { 
2041      if (getRelative().isEmpty()) {
2042        addRelative();
2043      }
2044      return getRelative().get(0);
2045    }
2046
2047      protected void listChildren(List<Property> children) {
2048        super.listChildren(children);
2049        children.add(new Property("identifier", "Identifier", "A unique identifier for this particular sequence instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
2050        children.add(new Property("type", "code", "Amino Acid Sequence/ DNA Sequence / RNA Sequence.", 0, 1, type));
2051        children.add(new Property("patient", "Reference(Patient)", "Indicates the patient this sequence is associated too.", 0, 1, patient));
2052        children.add(new Property("specimen", "Reference(Specimen)", "Specimen used for sequencing.", 0, 1, specimen));
2053        children.add(new Property("device", "Reference(Device)", "The method for sequencing, for example, chip information.", 0, 1, device));
2054        children.add(new Property("performer", "Reference(Organization)", "The organization or lab that should be responsible for this result.", 0, 1, performer));
2055        children.add(new Property("literal", "string", "Sequence that was observed.", 0, 1, literal));
2056        children.add(new Property("formatted", "Attachment", "Sequence that was observed as file content. Can be an actual file contents, or referenced by a URL to an external system.", 0, java.lang.Integer.MAX_VALUE, formatted));
2057        children.add(new Property("relative", "", "A sequence defined relative to another sequence.", 0, java.lang.Integer.MAX_VALUE, relative));
2058      }
2059
2060      @Override
2061      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2062        switch (_hash) {
2063        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "A unique identifier for this particular sequence instance.", 0, java.lang.Integer.MAX_VALUE, identifier);
2064        case 3575610: /*type*/  return new Property("type", "code", "Amino Acid Sequence/ DNA Sequence / RNA Sequence.", 0, 1, type);
2065        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "Indicates the patient this sequence is associated too.", 0, 1, patient);
2066        case -2132868344: /*specimen*/  return new Property("specimen", "Reference(Specimen)", "Specimen used for sequencing.", 0, 1, specimen);
2067        case -1335157162: /*device*/  return new Property("device", "Reference(Device)", "The method for sequencing, for example, chip information.", 0, 1, device);
2068        case 481140686: /*performer*/  return new Property("performer", "Reference(Organization)", "The organization or lab that should be responsible for this result.", 0, 1, performer);
2069        case 182460591: /*literal*/  return new Property("literal", "string", "Sequence that was observed.", 0, 1, literal);
2070        case 1811591356: /*formatted*/  return new Property("formatted", "Attachment", "Sequence that was observed as file content. Can be an actual file contents, or referenced by a URL to an external system.", 0, java.lang.Integer.MAX_VALUE, formatted);
2071        case -554435892: /*relative*/  return new Property("relative", "", "A sequence defined relative to another sequence.", 0, java.lang.Integer.MAX_VALUE, relative);
2072        default: return super.getNamedProperty(_hash, _name, _checkValid);
2073        }
2074
2075      }
2076
2077      @Override
2078      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2079        switch (hash) {
2080        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2081        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration<SequenceType>
2082        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
2083        case -2132868344: /*specimen*/ return this.specimen == null ? new Base[0] : new Base[] {this.specimen}; // Reference
2084        case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // Reference
2085        case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference
2086        case 182460591: /*literal*/ return this.literal == null ? new Base[0] : new Base[] {this.literal}; // StringType
2087        case 1811591356: /*formatted*/ return this.formatted == null ? new Base[0] : this.formatted.toArray(new Base[this.formatted.size()]); // Attachment
2088        case -554435892: /*relative*/ return this.relative == null ? new Base[0] : this.relative.toArray(new Base[this.relative.size()]); // MolecularSequenceRelativeComponent
2089        default: return super.getProperty(hash, name, checkValid);
2090        }
2091
2092      }
2093
2094      @Override
2095      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2096        switch (hash) {
2097        case -1618432855: // identifier
2098          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
2099          return value;
2100        case 3575610: // type
2101          value = new SequenceTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
2102          this.type = (Enumeration) value; // Enumeration<SequenceType>
2103          return value;
2104        case -791418107: // patient
2105          this.patient = TypeConvertor.castToReference(value); // Reference
2106          return value;
2107        case -2132868344: // specimen
2108          this.specimen = TypeConvertor.castToReference(value); // Reference
2109          return value;
2110        case -1335157162: // device
2111          this.device = TypeConvertor.castToReference(value); // Reference
2112          return value;
2113        case 481140686: // performer
2114          this.performer = TypeConvertor.castToReference(value); // Reference
2115          return value;
2116        case 182460591: // literal
2117          this.literal = TypeConvertor.castToString(value); // StringType
2118          return value;
2119        case 1811591356: // formatted
2120          this.getFormatted().add(TypeConvertor.castToAttachment(value)); // Attachment
2121          return value;
2122        case -554435892: // relative
2123          this.getRelative().add((MolecularSequenceRelativeComponent) value); // MolecularSequenceRelativeComponent
2124          return value;
2125        default: return super.setProperty(hash, name, value);
2126        }
2127
2128      }
2129
2130      @Override
2131      public Base setProperty(String name, Base value) throws FHIRException {
2132        if (name.equals("identifier")) {
2133          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
2134        } else if (name.equals("type")) {
2135          value = new SequenceTypeEnumFactory().fromType(TypeConvertor.castToCode(value));
2136          this.type = (Enumeration) value; // Enumeration<SequenceType>
2137        } else if (name.equals("patient")) {
2138          this.patient = TypeConvertor.castToReference(value); // Reference
2139        } else if (name.equals("specimen")) {
2140          this.specimen = TypeConvertor.castToReference(value); // Reference
2141        } else if (name.equals("device")) {
2142          this.device = TypeConvertor.castToReference(value); // Reference
2143        } else if (name.equals("performer")) {
2144          this.performer = TypeConvertor.castToReference(value); // Reference
2145        } else if (name.equals("literal")) {
2146          this.literal = TypeConvertor.castToString(value); // StringType
2147        } else if (name.equals("formatted")) {
2148          this.getFormatted().add(TypeConvertor.castToAttachment(value));
2149        } else if (name.equals("relative")) {
2150          this.getRelative().add((MolecularSequenceRelativeComponent) value);
2151        } else
2152          return super.setProperty(name, value);
2153        return value;
2154      }
2155
2156      @Override
2157      public Base makeProperty(int hash, String name) throws FHIRException {
2158        switch (hash) {
2159        case -1618432855:  return addIdentifier(); 
2160        case 3575610:  return getTypeElement();
2161        case -791418107:  return getPatient();
2162        case -2132868344:  return getSpecimen();
2163        case -1335157162:  return getDevice();
2164        case 481140686:  return getPerformer();
2165        case 182460591:  return getLiteralElement();
2166        case 1811591356:  return addFormatted(); 
2167        case -554435892:  return addRelative(); 
2168        default: return super.makeProperty(hash, name);
2169        }
2170
2171      }
2172
2173      @Override
2174      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2175        switch (hash) {
2176        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2177        case 3575610: /*type*/ return new String[] {"code"};
2178        case -791418107: /*patient*/ return new String[] {"Reference"};
2179        case -2132868344: /*specimen*/ return new String[] {"Reference"};
2180        case -1335157162: /*device*/ return new String[] {"Reference"};
2181        case 481140686: /*performer*/ return new String[] {"Reference"};
2182        case 182460591: /*literal*/ return new String[] {"string"};
2183        case 1811591356: /*formatted*/ return new String[] {"Attachment"};
2184        case -554435892: /*relative*/ return new String[] {};
2185        default: return super.getTypesForProperty(hash, name);
2186        }
2187
2188      }
2189
2190      @Override
2191      public Base addChild(String name) throws FHIRException {
2192        if (name.equals("identifier")) {
2193          return addIdentifier();
2194        }
2195        else if (name.equals("type")) {
2196          throw new FHIRException("Cannot call addChild on a primitive type MolecularSequence.type");
2197        }
2198        else if (name.equals("patient")) {
2199          this.patient = new Reference();
2200          return this.patient;
2201        }
2202        else if (name.equals("specimen")) {
2203          this.specimen = new Reference();
2204          return this.specimen;
2205        }
2206        else if (name.equals("device")) {
2207          this.device = new Reference();
2208          return this.device;
2209        }
2210        else if (name.equals("performer")) {
2211          this.performer = new Reference();
2212          return this.performer;
2213        }
2214        else if (name.equals("literal")) {
2215          throw new FHIRException("Cannot call addChild on a primitive type MolecularSequence.literal");
2216        }
2217        else if (name.equals("formatted")) {
2218          return addFormatted();
2219        }
2220        else if (name.equals("relative")) {
2221          return addRelative();
2222        }
2223        else
2224          return super.addChild(name);
2225      }
2226
2227  public String fhirType() {
2228    return "MolecularSequence";
2229
2230  }
2231
2232      public MolecularSequence copy() {
2233        MolecularSequence dst = new MolecularSequence();
2234        copyValues(dst);
2235        return dst;
2236      }
2237
2238      public void copyValues(MolecularSequence dst) {
2239        super.copyValues(dst);
2240        if (identifier != null) {
2241          dst.identifier = new ArrayList<Identifier>();
2242          for (Identifier i : identifier)
2243            dst.identifier.add(i.copy());
2244        };
2245        dst.type = type == null ? null : type.copy();
2246        dst.patient = patient == null ? null : patient.copy();
2247        dst.specimen = specimen == null ? null : specimen.copy();
2248        dst.device = device == null ? null : device.copy();
2249        dst.performer = performer == null ? null : performer.copy();
2250        dst.literal = literal == null ? null : literal.copy();
2251        if (formatted != null) {
2252          dst.formatted = new ArrayList<Attachment>();
2253          for (Attachment i : formatted)
2254            dst.formatted.add(i.copy());
2255        };
2256        if (relative != null) {
2257          dst.relative = new ArrayList<MolecularSequenceRelativeComponent>();
2258          for (MolecularSequenceRelativeComponent i : relative)
2259            dst.relative.add(i.copy());
2260        };
2261      }
2262
2263      protected MolecularSequence typedCopy() {
2264        return copy();
2265      }
2266
2267      @Override
2268      public boolean equalsDeep(Base other_) {
2269        if (!super.equalsDeep(other_))
2270          return false;
2271        if (!(other_ instanceof MolecularSequence))
2272          return false;
2273        MolecularSequence o = (MolecularSequence) other_;
2274        return compareDeep(identifier, o.identifier, true) && compareDeep(type, o.type, true) && compareDeep(patient, o.patient, true)
2275           && compareDeep(specimen, o.specimen, true) && compareDeep(device, o.device, true) && compareDeep(performer, o.performer, true)
2276           && compareDeep(literal, o.literal, true) && compareDeep(formatted, o.formatted, true) && compareDeep(relative, o.relative, true)
2277          ;
2278      }
2279
2280      @Override
2281      public boolean equalsShallow(Base other_) {
2282        if (!super.equalsShallow(other_))
2283          return false;
2284        if (!(other_ instanceof MolecularSequence))
2285          return false;
2286        MolecularSequence o = (MolecularSequence) other_;
2287        return compareValues(type, o.type, true) && compareValues(literal, o.literal, true);
2288      }
2289
2290      public boolean isEmpty() {
2291        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, type, patient
2292          , specimen, device, performer, literal, formatted, relative);
2293      }
2294
2295  @Override
2296  public ResourceType getResourceType() {
2297    return ResourceType.MolecularSequence;
2298   }
2299
2300 /**
2301   * Search parameter: <b>identifier</b>
2302   * <p>
2303   * Description: <b>The unique identity for a particular sequence</b><br>
2304   * Type: <b>token</b><br>
2305   * Path: <b>MolecularSequence.identifier</b><br>
2306   * </p>
2307   */
2308  @SearchParamDefinition(name="identifier", path="MolecularSequence.identifier", description="The unique identity for a particular sequence", type="token" )
2309  public static final String SP_IDENTIFIER = "identifier";
2310 /**
2311   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2312   * <p>
2313   * Description: <b>The unique identity for a particular sequence</b><br>
2314   * Type: <b>token</b><br>
2315   * Path: <b>MolecularSequence.identifier</b><br>
2316   * </p>
2317   */
2318  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2319
2320 /**
2321   * Search parameter: <b>patient</b>
2322   * <p>
2323   * Description: <b>The subject that the sequence is about</b><br>
2324   * Type: <b>reference</b><br>
2325   * Path: <b>MolecularSequence.patient</b><br>
2326   * </p>
2327   */
2328  @SearchParamDefinition(name="patient", path="MolecularSequence.patient", description="The subject that the sequence is about", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Patient.class } )
2329  public static final String SP_PATIENT = "patient";
2330 /**
2331   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
2332   * <p>
2333   * Description: <b>The subject that the sequence is about</b><br>
2334   * Type: <b>reference</b><br>
2335   * Path: <b>MolecularSequence.patient</b><br>
2336   * </p>
2337   */
2338  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
2339
2340/**
2341   * Constant for fluent queries to be used to add include statements. Specifies
2342   * the path value of "<b>MolecularSequence:patient</b>".
2343   */
2344  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MolecularSequence:patient").toLocked();
2345
2346 /**
2347   * Search parameter: <b>type</b>
2348   * <p>
2349   * Description: <b>Amino Acid Sequence/ DNA Sequence / RNA Sequence</b><br>
2350   * Type: <b>token</b><br>
2351   * Path: <b>MolecularSequence.type</b><br>
2352   * </p>
2353   */
2354  @SearchParamDefinition(name="type", path="MolecularSequence.type", description="Amino Acid Sequence/ DNA Sequence / RNA Sequence", type="token" )
2355  public static final String SP_TYPE = "type";
2356 /**
2357   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2358   * <p>
2359   * Description: <b>Amino Acid Sequence/ DNA Sequence / RNA Sequence</b><br>
2360   * Type: <b>token</b><br>
2361   * Path: <b>MolecularSequence.type</b><br>
2362   * </p>
2363   */
2364  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2365
2366
2367}
2368