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