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