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