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