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