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