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