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