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