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