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