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