001package org.hl7.fhir.r5.model;
002
003
004/*
005 * #%L
006 * org.hl7.fhir.r5
007 * %%
008 * Copyright (C) 2014 - 2019 Health Level 7
009 * %%
010 * Licensed under the Apache License, Version 2.0 (the \"License\");
011 * you may not use this file except in compliance with the License.
012 * You may obtain a copy of the License at
013 * 
014 *      http://www.apache.org/licenses/LICENSE-2.0
015 * 
016 * Unless required by applicable law or agreed to in writing, software
017 * distributed under the License is distributed on an \"AS IS\" BASIS,
018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019 * See the License for the specific language governing permissions and
020 * limitations under the License.
021 * #L%
022 */
023
024/*
025  Copyright (c) 2011+, HL7, Inc.
026  All rights reserved.
027  
028  Redistribution and use in source and binary forms, with or without modification, \
029  are permitted provided that the following conditions are met:
030  
031   * Redistributions of source code must retain the above copyright notice, this \
032     list of conditions and the following disclaimer.
033   * Redistributions in binary form must reproduce the above copyright notice, \
034     this list of conditions and the following disclaimer in the documentation \
035     and/or other materials provided with the distribution.
036   * Neither the name of HL7 nor the names of its contributors may be used to 
037     endorse or promote products derived from this software without specific 
038     prior written permission.
039  
040  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
041  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
042  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
043  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
044  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
045  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
046  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
047  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
048  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
049  POSSIBILITY OF SUCH DAMAGE.
050  */
051
052// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
053
054import java.util.ArrayList;
055import java.util.Date;
056import java.util.List;
057import org.hl7.fhir.utilities.Utilities;
058import org.hl7.fhir.r5.model.Enumerations.*;
059import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
060import org.hl7.fhir.exceptions.FHIRException;
061import org.hl7.fhir.instance.model.api.ICompositeType;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069
070/**
071 * A SubstanceProtein is defined as a single unit of a linear amino acid sequence, or a combination of subunits that are either covalently linked or have a defined invariant stoichiometric relationship. This includes all synthetic, recombinant and purified SubstanceProteins of defined sequence, whether the use is therapeutic or prophylactic. This set of elements will be used to describe albumins, coagulation factors, cytokines, growth factors, peptide/SubstanceProtein hormones, enzymes, toxins, toxoids, recombinant vaccines, and immunomodulators.
072 */
073@ResourceDef(name="SubstanceProtein", profile="http://hl7.org/fhir/StructureDefinition/SubstanceProtein")
074public class SubstanceProtein extends DomainResource {
075
076    @Block()
077    public static class SubstanceProteinSubunitComponent extends BackboneElement implements IBaseBackboneElement {
078        /**
079         * Index of primary sequences of amino acids linked through peptide bonds in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts.
080         */
081        @Child(name = "subunit", type = {IntegerType.class}, order=1, min=0, max=1, modifier=false, summary=true)
082        @Description(shortDefinition="Index of primary sequences of amino acids linked through peptide bonds 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 primary sequences of amino acids linked through peptide bonds in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts." )
083        protected IntegerType subunit;
084
085        /**
086         * The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.
087         */
088        @Child(name = "sequence", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
089        @Description(shortDefinition="The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence", formalDefinition="The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence." )
090        protected StringType sequence;
091
092        /**
093         * Length of linear sequences of amino acids contained in the subunit.
094         */
095        @Child(name = "length", type = {IntegerType.class}, order=3, min=0, max=1, modifier=false, summary=true)
096        @Description(shortDefinition="Length of linear sequences of amino acids contained in the subunit", formalDefinition="Length of linear sequences of amino acids contained in the subunit." )
097        protected IntegerType length;
098
099        /**
100         * The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.
101         */
102        @Child(name = "sequenceAttachment", type = {Attachment.class}, order=4, min=0, max=1, modifier=false, summary=true)
103        @Description(shortDefinition="The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence", formalDefinition="The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence." )
104        protected Attachment sequenceAttachment;
105
106        /**
107         * Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.
108         */
109        @Child(name = "nTerminalModificationId", type = {Identifier.class}, order=5, min=0, max=1, modifier=false, summary=true)
110        @Description(shortDefinition="Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID", formalDefinition="Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID." )
111        protected Identifier nTerminalModificationId;
112
113        /**
114         * The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified.
115         */
116        @Child(name = "nTerminalModification", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
117        @Description(shortDefinition="The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified", formalDefinition="The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified." )
118        protected StringType nTerminalModification;
119
120        /**
121         * Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.
122         */
123        @Child(name = "cTerminalModificationId", type = {Identifier.class}, order=7, min=0, max=1, modifier=false, summary=true)
124        @Description(shortDefinition="Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID", formalDefinition="Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID." )
125        protected Identifier cTerminalModificationId;
126
127        /**
128         * The modification at the C-terminal shall be specified.
129         */
130        @Child(name = "cTerminalModification", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
131        @Description(shortDefinition="The modification at the C-terminal shall be specified", formalDefinition="The modification at the C-terminal shall be specified." )
132        protected StringType cTerminalModification;
133
134        private static final long serialVersionUID = 99973841L;
135
136    /**
137     * Constructor
138     */
139      public SubstanceProteinSubunitComponent() {
140        super();
141      }
142
143        /**
144         * @return {@link #subunit} (Index of primary sequences of amino acids linked through peptide bonds in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts.). This is the underlying object with id, value and extensions. The accessor "getSubunit" gives direct access to the value
145         */
146        public IntegerType getSubunitElement() { 
147          if (this.subunit == null)
148            if (Configuration.errorOnAutoCreate())
149              throw new Error("Attempt to auto-create SubstanceProteinSubunitComponent.subunit");
150            else if (Configuration.doAutoCreate())
151              this.subunit = new IntegerType(); // bb
152          return this.subunit;
153        }
154
155        public boolean hasSubunitElement() { 
156          return this.subunit != null && !this.subunit.isEmpty();
157        }
158
159        public boolean hasSubunit() { 
160          return this.subunit != null && !this.subunit.isEmpty();
161        }
162
163        /**
164         * @param value {@link #subunit} (Index of primary sequences of amino acids linked through peptide bonds in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts.). This is the underlying object with id, value and extensions. The accessor "getSubunit" gives direct access to the value
165         */
166        public SubstanceProteinSubunitComponent setSubunitElement(IntegerType value) { 
167          this.subunit = value;
168          return this;
169        }
170
171        /**
172         * @return Index of primary sequences of amino acids linked through peptide bonds in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts.
173         */
174        public int getSubunit() { 
175          return this.subunit == null || this.subunit.isEmpty() ? 0 : this.subunit.getValue();
176        }
177
178        /**
179         * @param value Index of primary sequences of amino acids linked through peptide bonds in order of decreasing length. Sequences of the same length will be ordered by molecular weight. Subunits that have identical sequences will be repeated and have sequential subscripts.
180         */
181        public SubstanceProteinSubunitComponent setSubunit(int value) { 
182            if (this.subunit == null)
183              this.subunit = new IntegerType();
184            this.subunit.setValue(value);
185          return this;
186        }
187
188        /**
189         * @return {@link #sequence} (The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
190         */
191        public StringType getSequenceElement() { 
192          if (this.sequence == null)
193            if (Configuration.errorOnAutoCreate())
194              throw new Error("Attempt to auto-create SubstanceProteinSubunitComponent.sequence");
195            else if (Configuration.doAutoCreate())
196              this.sequence = new StringType(); // bb
197          return this.sequence;
198        }
199
200        public boolean hasSequenceElement() { 
201          return this.sequence != null && !this.sequence.isEmpty();
202        }
203
204        public boolean hasSequence() { 
205          return this.sequence != null && !this.sequence.isEmpty();
206        }
207
208        /**
209         * @param value {@link #sequence} (The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
210         */
211        public SubstanceProteinSubunitComponent setSequenceElement(StringType value) { 
212          this.sequence = value;
213          return this;
214        }
215
216        /**
217         * @return The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.
218         */
219        public String getSequence() { 
220          return this.sequence == null ? null : this.sequence.getValue();
221        }
222
223        /**
224         * @param value The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.
225         */
226        public SubstanceProteinSubunitComponent setSequence(String value) { 
227          if (Utilities.noString(value))
228            this.sequence = null;
229          else {
230            if (this.sequence == null)
231              this.sequence = new StringType();
232            this.sequence.setValue(value);
233          }
234          return this;
235        }
236
237        /**
238         * @return {@link #length} (Length of linear sequences of amino acids contained in the subunit.). This is the underlying object with id, value and extensions. The accessor "getLength" gives direct access to the value
239         */
240        public IntegerType getLengthElement() { 
241          if (this.length == null)
242            if (Configuration.errorOnAutoCreate())
243              throw new Error("Attempt to auto-create SubstanceProteinSubunitComponent.length");
244            else if (Configuration.doAutoCreate())
245              this.length = new IntegerType(); // bb
246          return this.length;
247        }
248
249        public boolean hasLengthElement() { 
250          return this.length != null && !this.length.isEmpty();
251        }
252
253        public boolean hasLength() { 
254          return this.length != null && !this.length.isEmpty();
255        }
256
257        /**
258         * @param value {@link #length} (Length of linear sequences of amino acids contained in the subunit.). This is the underlying object with id, value and extensions. The accessor "getLength" gives direct access to the value
259         */
260        public SubstanceProteinSubunitComponent setLengthElement(IntegerType value) { 
261          this.length = value;
262          return this;
263        }
264
265        /**
266         * @return Length of linear sequences of amino acids contained in the subunit.
267         */
268        public int getLength() { 
269          return this.length == null || this.length.isEmpty() ? 0 : this.length.getValue();
270        }
271
272        /**
273         * @param value Length of linear sequences of amino acids contained in the subunit.
274         */
275        public SubstanceProteinSubunitComponent setLength(int value) { 
276            if (this.length == null)
277              this.length = new IntegerType();
278            this.length.setValue(value);
279          return this;
280        }
281
282        /**
283         * @return {@link #sequenceAttachment} (The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.)
284         */
285        public Attachment getSequenceAttachment() { 
286          if (this.sequenceAttachment == null)
287            if (Configuration.errorOnAutoCreate())
288              throw new Error("Attempt to auto-create SubstanceProteinSubunitComponent.sequenceAttachment");
289            else if (Configuration.doAutoCreate())
290              this.sequenceAttachment = new Attachment(); // cc
291          return this.sequenceAttachment;
292        }
293
294        public boolean hasSequenceAttachment() { 
295          return this.sequenceAttachment != null && !this.sequenceAttachment.isEmpty();
296        }
297
298        /**
299         * @param value {@link #sequenceAttachment} (The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.)
300         */
301        public SubstanceProteinSubunitComponent setSequenceAttachment(Attachment value) { 
302          this.sequenceAttachment = value;
303          return this;
304        }
305
306        /**
307         * @return {@link #nTerminalModificationId} (Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.)
308         */
309        public Identifier getNTerminalModificationId() { 
310          if (this.nTerminalModificationId == null)
311            if (Configuration.errorOnAutoCreate())
312              throw new Error("Attempt to auto-create SubstanceProteinSubunitComponent.nTerminalModificationId");
313            else if (Configuration.doAutoCreate())
314              this.nTerminalModificationId = new Identifier(); // cc
315          return this.nTerminalModificationId;
316        }
317
318        public boolean hasNTerminalModificationId() { 
319          return this.nTerminalModificationId != null && !this.nTerminalModificationId.isEmpty();
320        }
321
322        /**
323         * @param value {@link #nTerminalModificationId} (Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.)
324         */
325        public SubstanceProteinSubunitComponent setNTerminalModificationId(Identifier value) { 
326          this.nTerminalModificationId = value;
327          return this;
328        }
329
330        /**
331         * @return {@link #nTerminalModification} (The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified.). This is the underlying object with id, value and extensions. The accessor "getNTerminalModification" gives direct access to the value
332         */
333        public StringType getNTerminalModificationElement() { 
334          if (this.nTerminalModification == null)
335            if (Configuration.errorOnAutoCreate())
336              throw new Error("Attempt to auto-create SubstanceProteinSubunitComponent.nTerminalModification");
337            else if (Configuration.doAutoCreate())
338              this.nTerminalModification = new StringType(); // bb
339          return this.nTerminalModification;
340        }
341
342        public boolean hasNTerminalModificationElement() { 
343          return this.nTerminalModification != null && !this.nTerminalModification.isEmpty();
344        }
345
346        public boolean hasNTerminalModification() { 
347          return this.nTerminalModification != null && !this.nTerminalModification.isEmpty();
348        }
349
350        /**
351         * @param value {@link #nTerminalModification} (The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified.). This is the underlying object with id, value and extensions. The accessor "getNTerminalModification" gives direct access to the value
352         */
353        public SubstanceProteinSubunitComponent setNTerminalModificationElement(StringType value) { 
354          this.nTerminalModification = value;
355          return this;
356        }
357
358        /**
359         * @return The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified.
360         */
361        public String getNTerminalModification() { 
362          return this.nTerminalModification == null ? null : this.nTerminalModification.getValue();
363        }
364
365        /**
366         * @param value The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified.
367         */
368        public SubstanceProteinSubunitComponent setNTerminalModification(String value) { 
369          if (Utilities.noString(value))
370            this.nTerminalModification = null;
371          else {
372            if (this.nTerminalModification == null)
373              this.nTerminalModification = new StringType();
374            this.nTerminalModification.setValue(value);
375          }
376          return this;
377        }
378
379        /**
380         * @return {@link #cTerminalModificationId} (Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.)
381         */
382        public Identifier getCTerminalModificationId() { 
383          if (this.cTerminalModificationId == null)
384            if (Configuration.errorOnAutoCreate())
385              throw new Error("Attempt to auto-create SubstanceProteinSubunitComponent.cTerminalModificationId");
386            else if (Configuration.doAutoCreate())
387              this.cTerminalModificationId = new Identifier(); // cc
388          return this.cTerminalModificationId;
389        }
390
391        public boolean hasCTerminalModificationId() { 
392          return this.cTerminalModificationId != null && !this.cTerminalModificationId.isEmpty();
393        }
394
395        /**
396         * @param value {@link #cTerminalModificationId} (Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.)
397         */
398        public SubstanceProteinSubunitComponent setCTerminalModificationId(Identifier value) { 
399          this.cTerminalModificationId = value;
400          return this;
401        }
402
403        /**
404         * @return {@link #cTerminalModification} (The modification at the C-terminal shall be specified.). This is the underlying object with id, value and extensions. The accessor "getCTerminalModification" gives direct access to the value
405         */
406        public StringType getCTerminalModificationElement() { 
407          if (this.cTerminalModification == null)
408            if (Configuration.errorOnAutoCreate())
409              throw new Error("Attempt to auto-create SubstanceProteinSubunitComponent.cTerminalModification");
410            else if (Configuration.doAutoCreate())
411              this.cTerminalModification = new StringType(); // bb
412          return this.cTerminalModification;
413        }
414
415        public boolean hasCTerminalModificationElement() { 
416          return this.cTerminalModification != null && !this.cTerminalModification.isEmpty();
417        }
418
419        public boolean hasCTerminalModification() { 
420          return this.cTerminalModification != null && !this.cTerminalModification.isEmpty();
421        }
422
423        /**
424         * @param value {@link #cTerminalModification} (The modification at the C-terminal shall be specified.). This is the underlying object with id, value and extensions. The accessor "getCTerminalModification" gives direct access to the value
425         */
426        public SubstanceProteinSubunitComponent setCTerminalModificationElement(StringType value) { 
427          this.cTerminalModification = value;
428          return this;
429        }
430
431        /**
432         * @return The modification at the C-terminal shall be specified.
433         */
434        public String getCTerminalModification() { 
435          return this.cTerminalModification == null ? null : this.cTerminalModification.getValue();
436        }
437
438        /**
439         * @param value The modification at the C-terminal shall be specified.
440         */
441        public SubstanceProteinSubunitComponent setCTerminalModification(String value) { 
442          if (Utilities.noString(value))
443            this.cTerminalModification = null;
444          else {
445            if (this.cTerminalModification == null)
446              this.cTerminalModification = new StringType();
447            this.cTerminalModification.setValue(value);
448          }
449          return this;
450        }
451
452        protected void listChildren(List<Property> children) {
453          super.listChildren(children);
454          children.add(new Property("subunit", "integer", "Index of primary sequences of amino acids linked through peptide bonds 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));
455          children.add(new Property("sequence", "string", "The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.", 0, 1, sequence));
456          children.add(new Property("length", "integer", "Length of linear sequences of amino acids contained in the subunit.", 0, 1, length));
457          children.add(new Property("sequenceAttachment", "Attachment", "The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.", 0, 1, sequenceAttachment));
458          children.add(new Property("nTerminalModificationId", "Identifier", "Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.", 0, 1, nTerminalModificationId));
459          children.add(new Property("nTerminalModification", "string", "The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified.", 0, 1, nTerminalModification));
460          children.add(new Property("cTerminalModificationId", "Identifier", "Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.", 0, 1, cTerminalModificationId));
461          children.add(new Property("cTerminalModification", "string", "The modification at the C-terminal shall be specified.", 0, 1, cTerminalModification));
462        }
463
464        @Override
465        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
466          switch (_hash) {
467          case -1867548732: /*subunit*/  return new Property("subunit", "integer", "Index of primary sequences of amino acids linked through peptide bonds 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);
468          case 1349547969: /*sequence*/  return new Property("sequence", "string", "The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.", 0, 1, sequence);
469          case -1106363674: /*length*/  return new Property("length", "integer", "Length of linear sequences of amino acids contained in the subunit.", 0, 1, length);
470          case 364621764: /*sequenceAttachment*/  return new Property("sequenceAttachment", "Attachment", "The sequence information shall be provided enumerating the amino acids from N- to C-terminal end using standard single-letter amino acid codes. Uppercase shall be used for L-amino acids and lowercase for D-amino acids. Transcribed SubstanceProteins will always be described using the translated sequence; for synthetic peptide containing amino acids that are not represented with a single letter code an X should be used within the sequence. The modified amino acids will be distinguished by their position in the sequence.", 0, 1, sequenceAttachment);
471          case -182796415: /*nTerminalModificationId*/  return new Property("nTerminalModificationId", "Identifier", "Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.", 0, 1, nTerminalModificationId);
472          case -1497395258: /*nTerminalModification*/  return new Property("nTerminalModification", "string", "The name of the fragment modified at the N-terminal of the SubstanceProtein shall be specified.", 0, 1, nTerminalModification);
473          case -990303818: /*cTerminalModificationId*/  return new Property("cTerminalModificationId", "Identifier", "Unique identifier for molecular fragment modification based on the ISO 11238 Substance ID.", 0, 1, cTerminalModificationId);
474          case 472711995: /*cTerminalModification*/  return new Property("cTerminalModification", "string", "The modification at the C-terminal shall be specified.", 0, 1, cTerminalModification);
475          default: return super.getNamedProperty(_hash, _name, _checkValid);
476          }
477
478        }
479
480      @Override
481      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
482        switch (hash) {
483        case -1867548732: /*subunit*/ return this.subunit == null ? new Base[0] : new Base[] {this.subunit}; // IntegerType
484        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // StringType
485        case -1106363674: /*length*/ return this.length == null ? new Base[0] : new Base[] {this.length}; // IntegerType
486        case 364621764: /*sequenceAttachment*/ return this.sequenceAttachment == null ? new Base[0] : new Base[] {this.sequenceAttachment}; // Attachment
487        case -182796415: /*nTerminalModificationId*/ return this.nTerminalModificationId == null ? new Base[0] : new Base[] {this.nTerminalModificationId}; // Identifier
488        case -1497395258: /*nTerminalModification*/ return this.nTerminalModification == null ? new Base[0] : new Base[] {this.nTerminalModification}; // StringType
489        case -990303818: /*cTerminalModificationId*/ return this.cTerminalModificationId == null ? new Base[0] : new Base[] {this.cTerminalModificationId}; // Identifier
490        case 472711995: /*cTerminalModification*/ return this.cTerminalModification == null ? new Base[0] : new Base[] {this.cTerminalModification}; // StringType
491        default: return super.getProperty(hash, name, checkValid);
492        }
493
494      }
495
496      @Override
497      public Base setProperty(int hash, String name, Base value) throws FHIRException {
498        switch (hash) {
499        case -1867548732: // subunit
500          this.subunit = TypeConvertor.castToInteger(value); // IntegerType
501          return value;
502        case 1349547969: // sequence
503          this.sequence = TypeConvertor.castToString(value); // StringType
504          return value;
505        case -1106363674: // length
506          this.length = TypeConvertor.castToInteger(value); // IntegerType
507          return value;
508        case 364621764: // sequenceAttachment
509          this.sequenceAttachment = TypeConvertor.castToAttachment(value); // Attachment
510          return value;
511        case -182796415: // nTerminalModificationId
512          this.nTerminalModificationId = TypeConvertor.castToIdentifier(value); // Identifier
513          return value;
514        case -1497395258: // nTerminalModification
515          this.nTerminalModification = TypeConvertor.castToString(value); // StringType
516          return value;
517        case -990303818: // cTerminalModificationId
518          this.cTerminalModificationId = TypeConvertor.castToIdentifier(value); // Identifier
519          return value;
520        case 472711995: // cTerminalModification
521          this.cTerminalModification = TypeConvertor.castToString(value); // StringType
522          return value;
523        default: return super.setProperty(hash, name, value);
524        }
525
526      }
527
528      @Override
529      public Base setProperty(String name, Base value) throws FHIRException {
530        if (name.equals("subunit")) {
531          this.subunit = TypeConvertor.castToInteger(value); // IntegerType
532        } else if (name.equals("sequence")) {
533          this.sequence = TypeConvertor.castToString(value); // StringType
534        } else if (name.equals("length")) {
535          this.length = TypeConvertor.castToInteger(value); // IntegerType
536        } else if (name.equals("sequenceAttachment")) {
537          this.sequenceAttachment = TypeConvertor.castToAttachment(value); // Attachment
538        } else if (name.equals("nTerminalModificationId")) {
539          this.nTerminalModificationId = TypeConvertor.castToIdentifier(value); // Identifier
540        } else if (name.equals("nTerminalModification")) {
541          this.nTerminalModification = TypeConvertor.castToString(value); // StringType
542        } else if (name.equals("cTerminalModificationId")) {
543          this.cTerminalModificationId = TypeConvertor.castToIdentifier(value); // Identifier
544        } else if (name.equals("cTerminalModification")) {
545          this.cTerminalModification = TypeConvertor.castToString(value); // StringType
546        } else
547          return super.setProperty(name, value);
548        return value;
549      }
550
551      @Override
552      public Base makeProperty(int hash, String name) throws FHIRException {
553        switch (hash) {
554        case -1867548732:  return getSubunitElement();
555        case 1349547969:  return getSequenceElement();
556        case -1106363674:  return getLengthElement();
557        case 364621764:  return getSequenceAttachment();
558        case -182796415:  return getNTerminalModificationId();
559        case -1497395258:  return getNTerminalModificationElement();
560        case -990303818:  return getCTerminalModificationId();
561        case 472711995:  return getCTerminalModificationElement();
562        default: return super.makeProperty(hash, name);
563        }
564
565      }
566
567      @Override
568      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
569        switch (hash) {
570        case -1867548732: /*subunit*/ return new String[] {"integer"};
571        case 1349547969: /*sequence*/ return new String[] {"string"};
572        case -1106363674: /*length*/ return new String[] {"integer"};
573        case 364621764: /*sequenceAttachment*/ return new String[] {"Attachment"};
574        case -182796415: /*nTerminalModificationId*/ return new String[] {"Identifier"};
575        case -1497395258: /*nTerminalModification*/ return new String[] {"string"};
576        case -990303818: /*cTerminalModificationId*/ return new String[] {"Identifier"};
577        case 472711995: /*cTerminalModification*/ return new String[] {"string"};
578        default: return super.getTypesForProperty(hash, name);
579        }
580
581      }
582
583      @Override
584      public Base addChild(String name) throws FHIRException {
585        if (name.equals("subunit")) {
586          throw new FHIRException("Cannot call addChild on a primitive type SubstanceProtein.subunit.subunit");
587        }
588        else if (name.equals("sequence")) {
589          throw new FHIRException("Cannot call addChild on a primitive type SubstanceProtein.subunit.sequence");
590        }
591        else if (name.equals("length")) {
592          throw new FHIRException("Cannot call addChild on a primitive type SubstanceProtein.subunit.length");
593        }
594        else if (name.equals("sequenceAttachment")) {
595          this.sequenceAttachment = new Attachment();
596          return this.sequenceAttachment;
597        }
598        else if (name.equals("nTerminalModificationId")) {
599          this.nTerminalModificationId = new Identifier();
600          return this.nTerminalModificationId;
601        }
602        else if (name.equals("nTerminalModification")) {
603          throw new FHIRException("Cannot call addChild on a primitive type SubstanceProtein.subunit.nTerminalModification");
604        }
605        else if (name.equals("cTerminalModificationId")) {
606          this.cTerminalModificationId = new Identifier();
607          return this.cTerminalModificationId;
608        }
609        else if (name.equals("cTerminalModification")) {
610          throw new FHIRException("Cannot call addChild on a primitive type SubstanceProtein.subunit.cTerminalModification");
611        }
612        else
613          return super.addChild(name);
614      }
615
616      public SubstanceProteinSubunitComponent copy() {
617        SubstanceProteinSubunitComponent dst = new SubstanceProteinSubunitComponent();
618        copyValues(dst);
619        return dst;
620      }
621
622      public void copyValues(SubstanceProteinSubunitComponent dst) {
623        super.copyValues(dst);
624        dst.subunit = subunit == null ? null : subunit.copy();
625        dst.sequence = sequence == null ? null : sequence.copy();
626        dst.length = length == null ? null : length.copy();
627        dst.sequenceAttachment = sequenceAttachment == null ? null : sequenceAttachment.copy();
628        dst.nTerminalModificationId = nTerminalModificationId == null ? null : nTerminalModificationId.copy();
629        dst.nTerminalModification = nTerminalModification == null ? null : nTerminalModification.copy();
630        dst.cTerminalModificationId = cTerminalModificationId == null ? null : cTerminalModificationId.copy();
631        dst.cTerminalModification = cTerminalModification == null ? null : cTerminalModification.copy();
632      }
633
634      @Override
635      public boolean equalsDeep(Base other_) {
636        if (!super.equalsDeep(other_))
637          return false;
638        if (!(other_ instanceof SubstanceProteinSubunitComponent))
639          return false;
640        SubstanceProteinSubunitComponent o = (SubstanceProteinSubunitComponent) other_;
641        return compareDeep(subunit, o.subunit, true) && compareDeep(sequence, o.sequence, true) && compareDeep(length, o.length, true)
642           && compareDeep(sequenceAttachment, o.sequenceAttachment, true) && compareDeep(nTerminalModificationId, o.nTerminalModificationId, true)
643           && compareDeep(nTerminalModification, o.nTerminalModification, true) && compareDeep(cTerminalModificationId, o.cTerminalModificationId, true)
644           && compareDeep(cTerminalModification, o.cTerminalModification, true);
645      }
646
647      @Override
648      public boolean equalsShallow(Base other_) {
649        if (!super.equalsShallow(other_))
650          return false;
651        if (!(other_ instanceof SubstanceProteinSubunitComponent))
652          return false;
653        SubstanceProteinSubunitComponent o = (SubstanceProteinSubunitComponent) other_;
654        return compareValues(subunit, o.subunit, true) && compareValues(sequence, o.sequence, true) && compareValues(length, o.length, true)
655           && compareValues(nTerminalModification, o.nTerminalModification, true) && compareValues(cTerminalModification, o.cTerminalModification, true)
656          ;
657      }
658
659      public boolean isEmpty() {
660        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(subunit, sequence, length
661          , sequenceAttachment, nTerminalModificationId, nTerminalModification, cTerminalModificationId
662          , cTerminalModification);
663      }
664
665  public String fhirType() {
666    return "SubstanceProtein.subunit";
667
668  }
669
670  }
671
672    /**
673     * The SubstanceProtein descriptive elements will only be used when a complete or partial amino acid sequence is available or derivable from a nucleic acid sequence.
674     */
675    @Child(name = "sequenceType", type = {CodeableConcept.class}, order=0, min=0, max=1, modifier=false, summary=true)
676    @Description(shortDefinition="The SubstanceProtein descriptive elements will only be used when a complete or partial amino acid sequence is available or derivable from a nucleic acid sequence", formalDefinition="The SubstanceProtein descriptive elements will only be used when a complete or partial amino acid sequence is available or derivable from a nucleic acid sequence." )
677    protected CodeableConcept sequenceType;
678
679    /**
680     * Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable.
681     */
682    @Child(name = "numberOfSubunits", type = {IntegerType.class}, order=1, min=0, max=1, modifier=false, summary=true)
683    @Description(shortDefinition="Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable", formalDefinition="Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable." )
684    protected IntegerType numberOfSubunits;
685
686    /**
687     * The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions.
688     */
689    @Child(name = "disulfideLinkage", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
690    @Description(shortDefinition="The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions", formalDefinition="The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions." )
691    protected List<StringType> disulfideLinkage;
692
693    /**
694     * This subclause refers to the description of each subunit constituting the SubstanceProtein. A subunit is a linear sequence of amino acids linked through peptide bonds. The Subunit information shall be provided when the finished SubstanceProtein is a complex of multiple sequences; subunits are not used to delineate domains within a single sequence. Subunits are listed in order of decreasing length; sequences of the same length will be ordered by decreasing molecular weight; subunits that have identical sequences will be repeated multiple times.
695     */
696    @Child(name = "subunit", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
697    @Description(shortDefinition="This subclause refers to the description of each subunit constituting the SubstanceProtein. A subunit is a linear sequence of amino acids linked through peptide bonds. The Subunit information shall be provided when the finished SubstanceProtein is a complex of multiple sequences; subunits are not used to delineate domains within a single sequence. Subunits are listed in order of decreasing length; sequences of the same length will be ordered by decreasing molecular weight; subunits that have identical sequences will be repeated multiple times", formalDefinition="This subclause refers to the description of each subunit constituting the SubstanceProtein. A subunit is a linear sequence of amino acids linked through peptide bonds. The Subunit information shall be provided when the finished SubstanceProtein is a complex of multiple sequences; subunits are not used to delineate domains within a single sequence. Subunits are listed in order of decreasing length; sequences of the same length will be ordered by decreasing molecular weight; subunits that have identical sequences will be repeated multiple times." )
698    protected List<SubstanceProteinSubunitComponent> subunit;
699
700    private static final long serialVersionUID = 469786856L;
701
702  /**
703   * Constructor
704   */
705    public SubstanceProtein() {
706      super();
707    }
708
709    /**
710     * @return {@link #sequenceType} (The SubstanceProtein descriptive elements will only be used when a complete or partial amino acid sequence is available or derivable from a nucleic acid sequence.)
711     */
712    public CodeableConcept getSequenceType() { 
713      if (this.sequenceType == null)
714        if (Configuration.errorOnAutoCreate())
715          throw new Error("Attempt to auto-create SubstanceProtein.sequenceType");
716        else if (Configuration.doAutoCreate())
717          this.sequenceType = new CodeableConcept(); // cc
718      return this.sequenceType;
719    }
720
721    public boolean hasSequenceType() { 
722      return this.sequenceType != null && !this.sequenceType.isEmpty();
723    }
724
725    /**
726     * @param value {@link #sequenceType} (The SubstanceProtein descriptive elements will only be used when a complete or partial amino acid sequence is available or derivable from a nucleic acid sequence.)
727     */
728    public SubstanceProtein setSequenceType(CodeableConcept value) { 
729      this.sequenceType = value;
730      return this;
731    }
732
733    /**
734     * @return {@link #numberOfSubunits} (Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable.). This is the underlying object with id, value and extensions. The accessor "getNumberOfSubunits" gives direct access to the value
735     */
736    public IntegerType getNumberOfSubunitsElement() { 
737      if (this.numberOfSubunits == null)
738        if (Configuration.errorOnAutoCreate())
739          throw new Error("Attempt to auto-create SubstanceProtein.numberOfSubunits");
740        else if (Configuration.doAutoCreate())
741          this.numberOfSubunits = new IntegerType(); // bb
742      return this.numberOfSubunits;
743    }
744
745    public boolean hasNumberOfSubunitsElement() { 
746      return this.numberOfSubunits != null && !this.numberOfSubunits.isEmpty();
747    }
748
749    public boolean hasNumberOfSubunits() { 
750      return this.numberOfSubunits != null && !this.numberOfSubunits.isEmpty();
751    }
752
753    /**
754     * @param value {@link #numberOfSubunits} (Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable.). This is the underlying object with id, value and extensions. The accessor "getNumberOfSubunits" gives direct access to the value
755     */
756    public SubstanceProtein setNumberOfSubunitsElement(IntegerType value) { 
757      this.numberOfSubunits = value;
758      return this;
759    }
760
761    /**
762     * @return Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable.
763     */
764    public int getNumberOfSubunits() { 
765      return this.numberOfSubunits == null || this.numberOfSubunits.isEmpty() ? 0 : this.numberOfSubunits.getValue();
766    }
767
768    /**
769     * @param value Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable.
770     */
771    public SubstanceProtein setNumberOfSubunits(int value) { 
772        if (this.numberOfSubunits == null)
773          this.numberOfSubunits = new IntegerType();
774        this.numberOfSubunits.setValue(value);
775      return this;
776    }
777
778    /**
779     * @return {@link #disulfideLinkage} (The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions.)
780     */
781    public List<StringType> getDisulfideLinkage() { 
782      if (this.disulfideLinkage == null)
783        this.disulfideLinkage = new ArrayList<StringType>();
784      return this.disulfideLinkage;
785    }
786
787    /**
788     * @return Returns a reference to <code>this</code> for easy method chaining
789     */
790    public SubstanceProtein setDisulfideLinkage(List<StringType> theDisulfideLinkage) { 
791      this.disulfideLinkage = theDisulfideLinkage;
792      return this;
793    }
794
795    public boolean hasDisulfideLinkage() { 
796      if (this.disulfideLinkage == null)
797        return false;
798      for (StringType item : this.disulfideLinkage)
799        if (!item.isEmpty())
800          return true;
801      return false;
802    }
803
804    /**
805     * @return {@link #disulfideLinkage} (The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions.)
806     */
807    public StringType addDisulfideLinkageElement() {//2 
808      StringType t = new StringType();
809      if (this.disulfideLinkage == null)
810        this.disulfideLinkage = new ArrayList<StringType>();
811      this.disulfideLinkage.add(t);
812      return t;
813    }
814
815    /**
816     * @param value {@link #disulfideLinkage} (The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions.)
817     */
818    public SubstanceProtein addDisulfideLinkage(String value) { //1
819      StringType t = new StringType();
820      t.setValue(value);
821      if (this.disulfideLinkage == null)
822        this.disulfideLinkage = new ArrayList<StringType>();
823      this.disulfideLinkage.add(t);
824      return this;
825    }
826
827    /**
828     * @param value {@link #disulfideLinkage} (The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions.)
829     */
830    public boolean hasDisulfideLinkage(String value) { 
831      if (this.disulfideLinkage == null)
832        return false;
833      for (StringType v : this.disulfideLinkage)
834        if (v.getValue().equals(value)) // string
835          return true;
836      return false;
837    }
838
839    /**
840     * @return {@link #subunit} (This subclause refers to the description of each subunit constituting the SubstanceProtein. A subunit is a linear sequence of amino acids linked through peptide bonds. The Subunit information shall be provided when the finished SubstanceProtein is a complex of multiple sequences; subunits are not used to delineate domains within a single sequence. Subunits are listed in order of decreasing length; sequences of the same length will be ordered by decreasing molecular weight; subunits that have identical sequences will be repeated multiple times.)
841     */
842    public List<SubstanceProteinSubunitComponent> getSubunit() { 
843      if (this.subunit == null)
844        this.subunit = new ArrayList<SubstanceProteinSubunitComponent>();
845      return this.subunit;
846    }
847
848    /**
849     * @return Returns a reference to <code>this</code> for easy method chaining
850     */
851    public SubstanceProtein setSubunit(List<SubstanceProteinSubunitComponent> theSubunit) { 
852      this.subunit = theSubunit;
853      return this;
854    }
855
856    public boolean hasSubunit() { 
857      if (this.subunit == null)
858        return false;
859      for (SubstanceProteinSubunitComponent item : this.subunit)
860        if (!item.isEmpty())
861          return true;
862      return false;
863    }
864
865    public SubstanceProteinSubunitComponent addSubunit() { //3
866      SubstanceProteinSubunitComponent t = new SubstanceProteinSubunitComponent();
867      if (this.subunit == null)
868        this.subunit = new ArrayList<SubstanceProteinSubunitComponent>();
869      this.subunit.add(t);
870      return t;
871    }
872
873    public SubstanceProtein addSubunit(SubstanceProteinSubunitComponent t) { //3
874      if (t == null)
875        return this;
876      if (this.subunit == null)
877        this.subunit = new ArrayList<SubstanceProteinSubunitComponent>();
878      this.subunit.add(t);
879      return this;
880    }
881
882    /**
883     * @return The first repetition of repeating field {@link #subunit}, creating it if it does not already exist {3}
884     */
885    public SubstanceProteinSubunitComponent getSubunitFirstRep() { 
886      if (getSubunit().isEmpty()) {
887        addSubunit();
888      }
889      return getSubunit().get(0);
890    }
891
892      protected void listChildren(List<Property> children) {
893        super.listChildren(children);
894        children.add(new Property("sequenceType", "CodeableConcept", "The SubstanceProtein descriptive elements will only be used when a complete or partial amino acid sequence is available or derivable from a nucleic acid sequence.", 0, 1, sequenceType));
895        children.add(new Property("numberOfSubunits", "integer", "Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable.", 0, 1, numberOfSubunits));
896        children.add(new Property("disulfideLinkage", "string", "The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions.", 0, java.lang.Integer.MAX_VALUE, disulfideLinkage));
897        children.add(new Property("subunit", "", "This subclause refers to the description of each subunit constituting the SubstanceProtein. A subunit is a linear sequence of amino acids linked through peptide bonds. The Subunit information shall be provided when the finished SubstanceProtein is a complex of multiple sequences; subunits are not used to delineate domains within a single sequence. Subunits are listed in order of decreasing length; sequences of the same length will be ordered by decreasing molecular weight; subunits that have identical sequences will be repeated multiple times.", 0, java.lang.Integer.MAX_VALUE, subunit));
898      }
899
900      @Override
901      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
902        switch (_hash) {
903        case 807711387: /*sequenceType*/  return new Property("sequenceType", "CodeableConcept", "The SubstanceProtein descriptive elements will only be used when a complete or partial amino acid sequence is available or derivable from a nucleic acid sequence.", 0, 1, sequenceType);
904        case -847111089: /*numberOfSubunits*/  return new Property("numberOfSubunits", "integer", "Number of linear sequences of amino acids linked through peptide bonds. The number of subunits constituting the SubstanceProtein shall be described. It is possible that the number of subunits can be variable.", 0, 1, numberOfSubunits);
905        case -1996102436: /*disulfideLinkage*/  return new Property("disulfideLinkage", "string", "The disulphide bond between two cysteine residues either on the same subunit or on two different subunits shall be described. The position of the disulfide bonds in the SubstanceProtein shall be listed in increasing order of subunit number and position within subunit followed by the abbreviation of the amino acids involved. The disulfide linkage positions shall actually contain the amino acid Cysteine at the respective positions.", 0, java.lang.Integer.MAX_VALUE, disulfideLinkage);
906        case -1867548732: /*subunit*/  return new Property("subunit", "", "This subclause refers to the description of each subunit constituting the SubstanceProtein. A subunit is a linear sequence of amino acids linked through peptide bonds. The Subunit information shall be provided when the finished SubstanceProtein is a complex of multiple sequences; subunits are not used to delineate domains within a single sequence. Subunits are listed in order of decreasing length; sequences of the same length will be ordered by decreasing molecular weight; subunits that have identical sequences will be repeated multiple times.", 0, java.lang.Integer.MAX_VALUE, subunit);
907        default: return super.getNamedProperty(_hash, _name, _checkValid);
908        }
909
910      }
911
912      @Override
913      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
914        switch (hash) {
915        case 807711387: /*sequenceType*/ return this.sequenceType == null ? new Base[0] : new Base[] {this.sequenceType}; // CodeableConcept
916        case -847111089: /*numberOfSubunits*/ return this.numberOfSubunits == null ? new Base[0] : new Base[] {this.numberOfSubunits}; // IntegerType
917        case -1996102436: /*disulfideLinkage*/ return this.disulfideLinkage == null ? new Base[0] : this.disulfideLinkage.toArray(new Base[this.disulfideLinkage.size()]); // StringType
918        case -1867548732: /*subunit*/ return this.subunit == null ? new Base[0] : this.subunit.toArray(new Base[this.subunit.size()]); // SubstanceProteinSubunitComponent
919        default: return super.getProperty(hash, name, checkValid);
920        }
921
922      }
923
924      @Override
925      public Base setProperty(int hash, String name, Base value) throws FHIRException {
926        switch (hash) {
927        case 807711387: // sequenceType
928          this.sequenceType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
929          return value;
930        case -847111089: // numberOfSubunits
931          this.numberOfSubunits = TypeConvertor.castToInteger(value); // IntegerType
932          return value;
933        case -1996102436: // disulfideLinkage
934          this.getDisulfideLinkage().add(TypeConvertor.castToString(value)); // StringType
935          return value;
936        case -1867548732: // subunit
937          this.getSubunit().add((SubstanceProteinSubunitComponent) value); // SubstanceProteinSubunitComponent
938          return value;
939        default: return super.setProperty(hash, name, value);
940        }
941
942      }
943
944      @Override
945      public Base setProperty(String name, Base value) throws FHIRException {
946        if (name.equals("sequenceType")) {
947          this.sequenceType = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
948        } else if (name.equals("numberOfSubunits")) {
949          this.numberOfSubunits = TypeConvertor.castToInteger(value); // IntegerType
950        } else if (name.equals("disulfideLinkage")) {
951          this.getDisulfideLinkage().add(TypeConvertor.castToString(value));
952        } else if (name.equals("subunit")) {
953          this.getSubunit().add((SubstanceProteinSubunitComponent) value);
954        } else
955          return super.setProperty(name, value);
956        return value;
957      }
958
959      @Override
960      public Base makeProperty(int hash, String name) throws FHIRException {
961        switch (hash) {
962        case 807711387:  return getSequenceType();
963        case -847111089:  return getNumberOfSubunitsElement();
964        case -1996102436:  return addDisulfideLinkageElement();
965        case -1867548732:  return addSubunit(); 
966        default: return super.makeProperty(hash, name);
967        }
968
969      }
970
971      @Override
972      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
973        switch (hash) {
974        case 807711387: /*sequenceType*/ return new String[] {"CodeableConcept"};
975        case -847111089: /*numberOfSubunits*/ return new String[] {"integer"};
976        case -1996102436: /*disulfideLinkage*/ return new String[] {"string"};
977        case -1867548732: /*subunit*/ return new String[] {};
978        default: return super.getTypesForProperty(hash, name);
979        }
980
981      }
982
983      @Override
984      public Base addChild(String name) throws FHIRException {
985        if (name.equals("sequenceType")) {
986          this.sequenceType = new CodeableConcept();
987          return this.sequenceType;
988        }
989        else if (name.equals("numberOfSubunits")) {
990          throw new FHIRException("Cannot call addChild on a primitive type SubstanceProtein.numberOfSubunits");
991        }
992        else if (name.equals("disulfideLinkage")) {
993          throw new FHIRException("Cannot call addChild on a primitive type SubstanceProtein.disulfideLinkage");
994        }
995        else if (name.equals("subunit")) {
996          return addSubunit();
997        }
998        else
999          return super.addChild(name);
1000      }
1001
1002  public String fhirType() {
1003    return "SubstanceProtein";
1004
1005  }
1006
1007      public SubstanceProtein copy() {
1008        SubstanceProtein dst = new SubstanceProtein();
1009        copyValues(dst);
1010        return dst;
1011      }
1012
1013      public void copyValues(SubstanceProtein dst) {
1014        super.copyValues(dst);
1015        dst.sequenceType = sequenceType == null ? null : sequenceType.copy();
1016        dst.numberOfSubunits = numberOfSubunits == null ? null : numberOfSubunits.copy();
1017        if (disulfideLinkage != null) {
1018          dst.disulfideLinkage = new ArrayList<StringType>();
1019          for (StringType i : disulfideLinkage)
1020            dst.disulfideLinkage.add(i.copy());
1021        };
1022        if (subunit != null) {
1023          dst.subunit = new ArrayList<SubstanceProteinSubunitComponent>();
1024          for (SubstanceProteinSubunitComponent i : subunit)
1025            dst.subunit.add(i.copy());
1026        };
1027      }
1028
1029      protected SubstanceProtein typedCopy() {
1030        return copy();
1031      }
1032
1033      @Override
1034      public boolean equalsDeep(Base other_) {
1035        if (!super.equalsDeep(other_))
1036          return false;
1037        if (!(other_ instanceof SubstanceProtein))
1038          return false;
1039        SubstanceProtein o = (SubstanceProtein) other_;
1040        return compareDeep(sequenceType, o.sequenceType, true) && compareDeep(numberOfSubunits, o.numberOfSubunits, true)
1041           && compareDeep(disulfideLinkage, o.disulfideLinkage, true) && compareDeep(subunit, o.subunit, true)
1042          ;
1043      }
1044
1045      @Override
1046      public boolean equalsShallow(Base other_) {
1047        if (!super.equalsShallow(other_))
1048          return false;
1049        if (!(other_ instanceof SubstanceProtein))
1050          return false;
1051        SubstanceProtein o = (SubstanceProtein) other_;
1052        return compareValues(numberOfSubunits, o.numberOfSubunits, true) && compareValues(disulfideLinkage, o.disulfideLinkage, true)
1053          ;
1054      }
1055
1056      public boolean isEmpty() {
1057        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequenceType, numberOfSubunits
1058          , disulfideLinkage, subunit);
1059      }
1060
1061  @Override
1062  public ResourceType getResourceType() {
1063    return ResourceType.SubstanceProtein;
1064   }
1065
1066
1067}
1068