001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 13, 2022 17:53+1100 for FHIR vcurrent
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * Record details about an anatomical structure.  This resource may be used when a coded concept does not provide the necessary detail needed for the use case.
052 */
053@ResourceDef(name="BodyStructure", profile="http://hl7.org/fhir/StructureDefinition/BodyStructure")
054public class BodyStructure extends DomainResource {
055
056    @Block()
057    public static class BodyStructureIncludedStructureComponent extends BackboneElement implements IBaseBackboneElement {
058        /**
059         * Code that represents the included structure.
060         */
061        @Child(name = "structure", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
062        @Description(shortDefinition="Code that represents the included structure", formalDefinition="Code that represents the included structure." )
063        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
064        protected CodeableConcept structure;
065
066        /**
067         * Code that represents the included structure laterality.
068         */
069        @Child(name = "laterality", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
070        @Description(shortDefinition="Code that represents the included structure laterality", formalDefinition="Code that represents the included structure laterality." )
071        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-relative-location")
072        protected CodeableConcept laterality;
073
074        /**
075         * Code that represents the included structure qualifier.
076         */
077        @Child(name = "qualifier", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
078        @Description(shortDefinition="Code that represents the included structure qualifier", formalDefinition="Code that represents the included structure qualifier." )
079        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-relative-location")
080        protected List<CodeableConcept> qualifier;
081
082        private static final long serialVersionUID = -2036673377L;
083
084    /**
085     * Constructor
086     */
087      public BodyStructureIncludedStructureComponent() {
088        super();
089      }
090
091    /**
092     * Constructor
093     */
094      public BodyStructureIncludedStructureComponent(CodeableConcept structure) {
095        super();
096        this.setStructure(structure);
097      }
098
099        /**
100         * @return {@link #structure} (Code that represents the included structure.)
101         */
102        public CodeableConcept getStructure() { 
103          if (this.structure == null)
104            if (Configuration.errorOnAutoCreate())
105              throw new Error("Attempt to auto-create BodyStructureIncludedStructureComponent.structure");
106            else if (Configuration.doAutoCreate())
107              this.structure = new CodeableConcept(); // cc
108          return this.structure;
109        }
110
111        public boolean hasStructure() { 
112          return this.structure != null && !this.structure.isEmpty();
113        }
114
115        /**
116         * @param value {@link #structure} (Code that represents the included structure.)
117         */
118        public BodyStructureIncludedStructureComponent setStructure(CodeableConcept value) { 
119          this.structure = value;
120          return this;
121        }
122
123        /**
124         * @return {@link #laterality} (Code that represents the included structure laterality.)
125         */
126        public CodeableConcept getLaterality() { 
127          if (this.laterality == null)
128            if (Configuration.errorOnAutoCreate())
129              throw new Error("Attempt to auto-create BodyStructureIncludedStructureComponent.laterality");
130            else if (Configuration.doAutoCreate())
131              this.laterality = new CodeableConcept(); // cc
132          return this.laterality;
133        }
134
135        public boolean hasLaterality() { 
136          return this.laterality != null && !this.laterality.isEmpty();
137        }
138
139        /**
140         * @param value {@link #laterality} (Code that represents the included structure laterality.)
141         */
142        public BodyStructureIncludedStructureComponent setLaterality(CodeableConcept value) { 
143          this.laterality = value;
144          return this;
145        }
146
147        /**
148         * @return {@link #qualifier} (Code that represents the included structure qualifier.)
149         */
150        public List<CodeableConcept> getQualifier() { 
151          if (this.qualifier == null)
152            this.qualifier = new ArrayList<CodeableConcept>();
153          return this.qualifier;
154        }
155
156        /**
157         * @return Returns a reference to <code>this</code> for easy method chaining
158         */
159        public BodyStructureIncludedStructureComponent setQualifier(List<CodeableConcept> theQualifier) { 
160          this.qualifier = theQualifier;
161          return this;
162        }
163
164        public boolean hasQualifier() { 
165          if (this.qualifier == null)
166            return false;
167          for (CodeableConcept item : this.qualifier)
168            if (!item.isEmpty())
169              return true;
170          return false;
171        }
172
173        public CodeableConcept addQualifier() { //3
174          CodeableConcept t = new CodeableConcept();
175          if (this.qualifier == null)
176            this.qualifier = new ArrayList<CodeableConcept>();
177          this.qualifier.add(t);
178          return t;
179        }
180
181        public BodyStructureIncludedStructureComponent addQualifier(CodeableConcept t) { //3
182          if (t == null)
183            return this;
184          if (this.qualifier == null)
185            this.qualifier = new ArrayList<CodeableConcept>();
186          this.qualifier.add(t);
187          return this;
188        }
189
190        /**
191         * @return The first repetition of repeating field {@link #qualifier}, creating it if it does not already exist {3}
192         */
193        public CodeableConcept getQualifierFirstRep() { 
194          if (getQualifier().isEmpty()) {
195            addQualifier();
196          }
197          return getQualifier().get(0);
198        }
199
200        protected void listChildren(List<Property> children) {
201          super.listChildren(children);
202          children.add(new Property("structure", "CodeableConcept", "Code that represents the included structure.", 0, 1, structure));
203          children.add(new Property("laterality", "CodeableConcept", "Code that represents the included structure laterality.", 0, 1, laterality));
204          children.add(new Property("qualifier", "CodeableConcept", "Code that represents the included structure qualifier.", 0, java.lang.Integer.MAX_VALUE, qualifier));
205        }
206
207        @Override
208        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
209          switch (_hash) {
210          case 144518515: /*structure*/  return new Property("structure", "CodeableConcept", "Code that represents the included structure.", 0, 1, structure);
211          case -170291817: /*laterality*/  return new Property("laterality", "CodeableConcept", "Code that represents the included structure laterality.", 0, 1, laterality);
212          case -1247940438: /*qualifier*/  return new Property("qualifier", "CodeableConcept", "Code that represents the included structure qualifier.", 0, java.lang.Integer.MAX_VALUE, qualifier);
213          default: return super.getNamedProperty(_hash, _name, _checkValid);
214          }
215
216        }
217
218      @Override
219      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
220        switch (hash) {
221        case 144518515: /*structure*/ return this.structure == null ? new Base[0] : new Base[] {this.structure}; // CodeableConcept
222        case -170291817: /*laterality*/ return this.laterality == null ? new Base[0] : new Base[] {this.laterality}; // CodeableConcept
223        case -1247940438: /*qualifier*/ return this.qualifier == null ? new Base[0] : this.qualifier.toArray(new Base[this.qualifier.size()]); // CodeableConcept
224        default: return super.getProperty(hash, name, checkValid);
225        }
226
227      }
228
229      @Override
230      public Base setProperty(int hash, String name, Base value) throws FHIRException {
231        switch (hash) {
232        case 144518515: // structure
233          this.structure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
234          return value;
235        case -170291817: // laterality
236          this.laterality = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
237          return value;
238        case -1247940438: // qualifier
239          this.getQualifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
240          return value;
241        default: return super.setProperty(hash, name, value);
242        }
243
244      }
245
246      @Override
247      public Base setProperty(String name, Base value) throws FHIRException {
248        if (name.equals("structure")) {
249          this.structure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
250        } else if (name.equals("laterality")) {
251          this.laterality = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
252        } else if (name.equals("qualifier")) {
253          this.getQualifier().add(TypeConvertor.castToCodeableConcept(value));
254        } else
255          return super.setProperty(name, value);
256        return value;
257      }
258
259      @Override
260      public Base makeProperty(int hash, String name) throws FHIRException {
261        switch (hash) {
262        case 144518515:  return getStructure();
263        case -170291817:  return getLaterality();
264        case -1247940438:  return addQualifier(); 
265        default: return super.makeProperty(hash, name);
266        }
267
268      }
269
270      @Override
271      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
272        switch (hash) {
273        case 144518515: /*structure*/ return new String[] {"CodeableConcept"};
274        case -170291817: /*laterality*/ return new String[] {"CodeableConcept"};
275        case -1247940438: /*qualifier*/ return new String[] {"CodeableConcept"};
276        default: return super.getTypesForProperty(hash, name);
277        }
278
279      }
280
281      @Override
282      public Base addChild(String name) throws FHIRException {
283        if (name.equals("structure")) {
284          this.structure = new CodeableConcept();
285          return this.structure;
286        }
287        else if (name.equals("laterality")) {
288          this.laterality = new CodeableConcept();
289          return this.laterality;
290        }
291        else if (name.equals("qualifier")) {
292          return addQualifier();
293        }
294        else
295          return super.addChild(name);
296      }
297
298      public BodyStructureIncludedStructureComponent copy() {
299        BodyStructureIncludedStructureComponent dst = new BodyStructureIncludedStructureComponent();
300        copyValues(dst);
301        return dst;
302      }
303
304      public void copyValues(BodyStructureIncludedStructureComponent dst) {
305        super.copyValues(dst);
306        dst.structure = structure == null ? null : structure.copy();
307        dst.laterality = laterality == null ? null : laterality.copy();
308        if (qualifier != null) {
309          dst.qualifier = new ArrayList<CodeableConcept>();
310          for (CodeableConcept i : qualifier)
311            dst.qualifier.add(i.copy());
312        };
313      }
314
315      @Override
316      public boolean equalsDeep(Base other_) {
317        if (!super.equalsDeep(other_))
318          return false;
319        if (!(other_ instanceof BodyStructureIncludedStructureComponent))
320          return false;
321        BodyStructureIncludedStructureComponent o = (BodyStructureIncludedStructureComponent) other_;
322        return compareDeep(structure, o.structure, true) && compareDeep(laterality, o.laterality, true)
323           && compareDeep(qualifier, o.qualifier, true);
324      }
325
326      @Override
327      public boolean equalsShallow(Base other_) {
328        if (!super.equalsShallow(other_))
329          return false;
330        if (!(other_ instanceof BodyStructureIncludedStructureComponent))
331          return false;
332        BodyStructureIncludedStructureComponent o = (BodyStructureIncludedStructureComponent) other_;
333        return true;
334      }
335
336      public boolean isEmpty() {
337        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(structure, laterality, qualifier
338          );
339      }
340
341  public String fhirType() {
342    return "BodyStructure.includedStructure";
343
344  }
345
346  }
347
348    @Block()
349    public static class BodyStructureExcludedStructureComponent extends BackboneElement implements IBaseBackboneElement {
350        /**
351         * Code that represents the excluded structure.
352         */
353        @Child(name = "structure", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=true)
354        @Description(shortDefinition="Code that represents the excluded structure", formalDefinition="Code that represents the excluded structure." )
355        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/body-site")
356        protected CodeableConcept structure;
357
358        /**
359         * Code that represents the excluded structure laterality.
360         */
361        @Child(name = "laterality", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
362        @Description(shortDefinition="Code that represents the excluded structure laterality", formalDefinition="Code that represents the excluded structure laterality." )
363        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-relative-location")
364        protected CodeableConcept laterality;
365
366        /**
367         * Code that represents the excluded structure qualifier.
368         */
369        @Child(name = "qualifier", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
370        @Description(shortDefinition="Code that represents the excluded structure qualifier", formalDefinition="Code that represents the excluded structure qualifier." )
371        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-relative-location")
372        protected List<CodeableConcept> qualifier;
373
374        private static final long serialVersionUID = -2036673377L;
375
376    /**
377     * Constructor
378     */
379      public BodyStructureExcludedStructureComponent() {
380        super();
381      }
382
383    /**
384     * Constructor
385     */
386      public BodyStructureExcludedStructureComponent(CodeableConcept structure) {
387        super();
388        this.setStructure(structure);
389      }
390
391        /**
392         * @return {@link #structure} (Code that represents the excluded structure.)
393         */
394        public CodeableConcept getStructure() { 
395          if (this.structure == null)
396            if (Configuration.errorOnAutoCreate())
397              throw new Error("Attempt to auto-create BodyStructureExcludedStructureComponent.structure");
398            else if (Configuration.doAutoCreate())
399              this.structure = new CodeableConcept(); // cc
400          return this.structure;
401        }
402
403        public boolean hasStructure() { 
404          return this.structure != null && !this.structure.isEmpty();
405        }
406
407        /**
408         * @param value {@link #structure} (Code that represents the excluded structure.)
409         */
410        public BodyStructureExcludedStructureComponent setStructure(CodeableConcept value) { 
411          this.structure = value;
412          return this;
413        }
414
415        /**
416         * @return {@link #laterality} (Code that represents the excluded structure laterality.)
417         */
418        public CodeableConcept getLaterality() { 
419          if (this.laterality == null)
420            if (Configuration.errorOnAutoCreate())
421              throw new Error("Attempt to auto-create BodyStructureExcludedStructureComponent.laterality");
422            else if (Configuration.doAutoCreate())
423              this.laterality = new CodeableConcept(); // cc
424          return this.laterality;
425        }
426
427        public boolean hasLaterality() { 
428          return this.laterality != null && !this.laterality.isEmpty();
429        }
430
431        /**
432         * @param value {@link #laterality} (Code that represents the excluded structure laterality.)
433         */
434        public BodyStructureExcludedStructureComponent setLaterality(CodeableConcept value) { 
435          this.laterality = value;
436          return this;
437        }
438
439        /**
440         * @return {@link #qualifier} (Code that represents the excluded structure qualifier.)
441         */
442        public List<CodeableConcept> getQualifier() { 
443          if (this.qualifier == null)
444            this.qualifier = new ArrayList<CodeableConcept>();
445          return this.qualifier;
446        }
447
448        /**
449         * @return Returns a reference to <code>this</code> for easy method chaining
450         */
451        public BodyStructureExcludedStructureComponent setQualifier(List<CodeableConcept> theQualifier) { 
452          this.qualifier = theQualifier;
453          return this;
454        }
455
456        public boolean hasQualifier() { 
457          if (this.qualifier == null)
458            return false;
459          for (CodeableConcept item : this.qualifier)
460            if (!item.isEmpty())
461              return true;
462          return false;
463        }
464
465        public CodeableConcept addQualifier() { //3
466          CodeableConcept t = new CodeableConcept();
467          if (this.qualifier == null)
468            this.qualifier = new ArrayList<CodeableConcept>();
469          this.qualifier.add(t);
470          return t;
471        }
472
473        public BodyStructureExcludedStructureComponent addQualifier(CodeableConcept t) { //3
474          if (t == null)
475            return this;
476          if (this.qualifier == null)
477            this.qualifier = new ArrayList<CodeableConcept>();
478          this.qualifier.add(t);
479          return this;
480        }
481
482        /**
483         * @return The first repetition of repeating field {@link #qualifier}, creating it if it does not already exist {3}
484         */
485        public CodeableConcept getQualifierFirstRep() { 
486          if (getQualifier().isEmpty()) {
487            addQualifier();
488          }
489          return getQualifier().get(0);
490        }
491
492        protected void listChildren(List<Property> children) {
493          super.listChildren(children);
494          children.add(new Property("structure", "CodeableConcept", "Code that represents the excluded structure.", 0, 1, structure));
495          children.add(new Property("laterality", "CodeableConcept", "Code that represents the excluded structure laterality.", 0, 1, laterality));
496          children.add(new Property("qualifier", "CodeableConcept", "Code that represents the excluded structure qualifier.", 0, java.lang.Integer.MAX_VALUE, qualifier));
497        }
498
499        @Override
500        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
501          switch (_hash) {
502          case 144518515: /*structure*/  return new Property("structure", "CodeableConcept", "Code that represents the excluded structure.", 0, 1, structure);
503          case -170291817: /*laterality*/  return new Property("laterality", "CodeableConcept", "Code that represents the excluded structure laterality.", 0, 1, laterality);
504          case -1247940438: /*qualifier*/  return new Property("qualifier", "CodeableConcept", "Code that represents the excluded structure qualifier.", 0, java.lang.Integer.MAX_VALUE, qualifier);
505          default: return super.getNamedProperty(_hash, _name, _checkValid);
506          }
507
508        }
509
510      @Override
511      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
512        switch (hash) {
513        case 144518515: /*structure*/ return this.structure == null ? new Base[0] : new Base[] {this.structure}; // CodeableConcept
514        case -170291817: /*laterality*/ return this.laterality == null ? new Base[0] : new Base[] {this.laterality}; // CodeableConcept
515        case -1247940438: /*qualifier*/ return this.qualifier == null ? new Base[0] : this.qualifier.toArray(new Base[this.qualifier.size()]); // CodeableConcept
516        default: return super.getProperty(hash, name, checkValid);
517        }
518
519      }
520
521      @Override
522      public Base setProperty(int hash, String name, Base value) throws FHIRException {
523        switch (hash) {
524        case 144518515: // structure
525          this.structure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
526          return value;
527        case -170291817: // laterality
528          this.laterality = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
529          return value;
530        case -1247940438: // qualifier
531          this.getQualifier().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
532          return value;
533        default: return super.setProperty(hash, name, value);
534        }
535
536      }
537
538      @Override
539      public Base setProperty(String name, Base value) throws FHIRException {
540        if (name.equals("structure")) {
541          this.structure = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
542        } else if (name.equals("laterality")) {
543          this.laterality = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
544        } else if (name.equals("qualifier")) {
545          this.getQualifier().add(TypeConvertor.castToCodeableConcept(value));
546        } else
547          return super.setProperty(name, value);
548        return value;
549      }
550
551      @Override
552      public Base makeProperty(int hash, String name) throws FHIRException {
553        switch (hash) {
554        case 144518515:  return getStructure();
555        case -170291817:  return getLaterality();
556        case -1247940438:  return addQualifier(); 
557        default: return super.makeProperty(hash, name);
558        }
559
560      }
561
562      @Override
563      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
564        switch (hash) {
565        case 144518515: /*structure*/ return new String[] {"CodeableConcept"};
566        case -170291817: /*laterality*/ return new String[] {"CodeableConcept"};
567        case -1247940438: /*qualifier*/ return new String[] {"CodeableConcept"};
568        default: return super.getTypesForProperty(hash, name);
569        }
570
571      }
572
573      @Override
574      public Base addChild(String name) throws FHIRException {
575        if (name.equals("structure")) {
576          this.structure = new CodeableConcept();
577          return this.structure;
578        }
579        else if (name.equals("laterality")) {
580          this.laterality = new CodeableConcept();
581          return this.laterality;
582        }
583        else if (name.equals("qualifier")) {
584          return addQualifier();
585        }
586        else
587          return super.addChild(name);
588      }
589
590      public BodyStructureExcludedStructureComponent copy() {
591        BodyStructureExcludedStructureComponent dst = new BodyStructureExcludedStructureComponent();
592        copyValues(dst);
593        return dst;
594      }
595
596      public void copyValues(BodyStructureExcludedStructureComponent dst) {
597        super.copyValues(dst);
598        dst.structure = structure == null ? null : structure.copy();
599        dst.laterality = laterality == null ? null : laterality.copy();
600        if (qualifier != null) {
601          dst.qualifier = new ArrayList<CodeableConcept>();
602          for (CodeableConcept i : qualifier)
603            dst.qualifier.add(i.copy());
604        };
605      }
606
607      @Override
608      public boolean equalsDeep(Base other_) {
609        if (!super.equalsDeep(other_))
610          return false;
611        if (!(other_ instanceof BodyStructureExcludedStructureComponent))
612          return false;
613        BodyStructureExcludedStructureComponent o = (BodyStructureExcludedStructureComponent) other_;
614        return compareDeep(structure, o.structure, true) && compareDeep(laterality, o.laterality, true)
615           && compareDeep(qualifier, o.qualifier, true);
616      }
617
618      @Override
619      public boolean equalsShallow(Base other_) {
620        if (!super.equalsShallow(other_))
621          return false;
622        if (!(other_ instanceof BodyStructureExcludedStructureComponent))
623          return false;
624        BodyStructureExcludedStructureComponent o = (BodyStructureExcludedStructureComponent) other_;
625        return true;
626      }
627
628      public boolean isEmpty() {
629        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(structure, laterality, qualifier
630          );
631      }
632
633  public String fhirType() {
634    return "BodyStructure.excludedStructure";
635
636  }
637
638  }
639
640    /**
641     * Identifier for this instance of the anatomical structure.
642     */
643    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
644    @Description(shortDefinition="Bodystructure identifier", formalDefinition="Identifier for this instance of the anatomical structure." )
645    protected List<Identifier> identifier;
646
647    /**
648     * Whether this body site is in active use.
649     */
650    @Child(name = "active", type = {BooleanType.class}, order=1, min=0, max=1, modifier=true, summary=true)
651    @Description(shortDefinition="Whether this record is in active use", formalDefinition="Whether this body site is in active use." )
652    protected BooleanType active;
653
654    /**
655     * The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.
656     */
657    @Child(name = "morphology", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
658    @Description(shortDefinition="Kind of Structure", formalDefinition="The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies." )
659    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/bodystructure-code")
660    protected CodeableConcept morphology;
661
662    /**
663     * The anatomical location(s) or region(s) of the specimen, lesion, or body structure.
664     */
665    @Child(name = "includedStructure", type = {}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
666    @Description(shortDefinition="Included anatomic location(s)", formalDefinition="The anatomical location(s) or region(s) of the specimen, lesion, or body structure." )
667    protected List<BodyStructureIncludedStructureComponent> includedStructure;
668
669    /**
670     * The anatomical location(s) or region(s) not occupied or represented by the specimen, lesion, or body structure.
671     */
672    @Child(name = "excludedStructure", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
673    @Description(shortDefinition="Excluded anatomic locations(s)", formalDefinition="The anatomical location(s) or region(s) not occupied or represented by the specimen, lesion, or body structure." )
674    protected List<BodyStructureExcludedStructureComponent> excludedStructure;
675
676    /**
677     * A summary, characterization or explanation of the body structure.
678     */
679    @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
680    @Description(shortDefinition="Text description", formalDefinition="A summary, characterization or explanation of the body structure." )
681    protected StringType description;
682
683    /**
684     * Image or images used to identify a location.
685     */
686    @Child(name = "image", type = {Attachment.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
687    @Description(shortDefinition="Attached images", formalDefinition="Image or images used to identify a location." )
688    protected List<Attachment> image;
689
690    /**
691     * The person to which the body site belongs.
692     */
693    @Child(name = "patient", type = {Patient.class}, order=7, min=1, max=1, modifier=false, summary=true)
694    @Description(shortDefinition="Who this is about", formalDefinition="The person to which the body site belongs." )
695    protected Reference patient;
696
697    private static final long serialVersionUID = 1630541250L;
698
699  /**
700   * Constructor
701   */
702    public BodyStructure() {
703      super();
704    }
705
706  /**
707   * Constructor
708   */
709    public BodyStructure(BodyStructureIncludedStructureComponent includedStructure, Reference patient) {
710      super();
711      this.addIncludedStructure(includedStructure);
712      this.setPatient(patient);
713    }
714
715    /**
716     * @return {@link #identifier} (Identifier for this instance of the anatomical structure.)
717     */
718    public List<Identifier> getIdentifier() { 
719      if (this.identifier == null)
720        this.identifier = new ArrayList<Identifier>();
721      return this.identifier;
722    }
723
724    /**
725     * @return Returns a reference to <code>this</code> for easy method chaining
726     */
727    public BodyStructure setIdentifier(List<Identifier> theIdentifier) { 
728      this.identifier = theIdentifier;
729      return this;
730    }
731
732    public boolean hasIdentifier() { 
733      if (this.identifier == null)
734        return false;
735      for (Identifier item : this.identifier)
736        if (!item.isEmpty())
737          return true;
738      return false;
739    }
740
741    public Identifier addIdentifier() { //3
742      Identifier t = new Identifier();
743      if (this.identifier == null)
744        this.identifier = new ArrayList<Identifier>();
745      this.identifier.add(t);
746      return t;
747    }
748
749    public BodyStructure addIdentifier(Identifier t) { //3
750      if (t == null)
751        return this;
752      if (this.identifier == null)
753        this.identifier = new ArrayList<Identifier>();
754      this.identifier.add(t);
755      return this;
756    }
757
758    /**
759     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
760     */
761    public Identifier getIdentifierFirstRep() { 
762      if (getIdentifier().isEmpty()) {
763        addIdentifier();
764      }
765      return getIdentifier().get(0);
766    }
767
768    /**
769     * @return {@link #active} (Whether this body site is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
770     */
771    public BooleanType getActiveElement() { 
772      if (this.active == null)
773        if (Configuration.errorOnAutoCreate())
774          throw new Error("Attempt to auto-create BodyStructure.active");
775        else if (Configuration.doAutoCreate())
776          this.active = new BooleanType(); // bb
777      return this.active;
778    }
779
780    public boolean hasActiveElement() { 
781      return this.active != null && !this.active.isEmpty();
782    }
783
784    public boolean hasActive() { 
785      return this.active != null && !this.active.isEmpty();
786    }
787
788    /**
789     * @param value {@link #active} (Whether this body site is in active use.). This is the underlying object with id, value and extensions. The accessor "getActive" gives direct access to the value
790     */
791    public BodyStructure setActiveElement(BooleanType value) { 
792      this.active = value;
793      return this;
794    }
795
796    /**
797     * @return Whether this body site is in active use.
798     */
799    public boolean getActive() { 
800      return this.active == null || this.active.isEmpty() ? false : this.active.getValue();
801    }
802
803    /**
804     * @param value Whether this body site is in active use.
805     */
806    public BodyStructure setActive(boolean value) { 
807        if (this.active == null)
808          this.active = new BooleanType();
809        this.active.setValue(value);
810      return this;
811    }
812
813    /**
814     * @return {@link #morphology} (The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.)
815     */
816    public CodeableConcept getMorphology() { 
817      if (this.morphology == null)
818        if (Configuration.errorOnAutoCreate())
819          throw new Error("Attempt to auto-create BodyStructure.morphology");
820        else if (Configuration.doAutoCreate())
821          this.morphology = new CodeableConcept(); // cc
822      return this.morphology;
823    }
824
825    public boolean hasMorphology() { 
826      return this.morphology != null && !this.morphology.isEmpty();
827    }
828
829    /**
830     * @param value {@link #morphology} (The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.)
831     */
832    public BodyStructure setMorphology(CodeableConcept value) { 
833      this.morphology = value;
834      return this;
835    }
836
837    /**
838     * @return {@link #includedStructure} (The anatomical location(s) or region(s) of the specimen, lesion, or body structure.)
839     */
840    public List<BodyStructureIncludedStructureComponent> getIncludedStructure() { 
841      if (this.includedStructure == null)
842        this.includedStructure = new ArrayList<BodyStructureIncludedStructureComponent>();
843      return this.includedStructure;
844    }
845
846    /**
847     * @return Returns a reference to <code>this</code> for easy method chaining
848     */
849    public BodyStructure setIncludedStructure(List<BodyStructureIncludedStructureComponent> theIncludedStructure) { 
850      this.includedStructure = theIncludedStructure;
851      return this;
852    }
853
854    public boolean hasIncludedStructure() { 
855      if (this.includedStructure == null)
856        return false;
857      for (BodyStructureIncludedStructureComponent item : this.includedStructure)
858        if (!item.isEmpty())
859          return true;
860      return false;
861    }
862
863    public BodyStructureIncludedStructureComponent addIncludedStructure() { //3
864      BodyStructureIncludedStructureComponent t = new BodyStructureIncludedStructureComponent();
865      if (this.includedStructure == null)
866        this.includedStructure = new ArrayList<BodyStructureIncludedStructureComponent>();
867      this.includedStructure.add(t);
868      return t;
869    }
870
871    public BodyStructure addIncludedStructure(BodyStructureIncludedStructureComponent t) { //3
872      if (t == null)
873        return this;
874      if (this.includedStructure == null)
875        this.includedStructure = new ArrayList<BodyStructureIncludedStructureComponent>();
876      this.includedStructure.add(t);
877      return this;
878    }
879
880    /**
881     * @return The first repetition of repeating field {@link #includedStructure}, creating it if it does not already exist {3}
882     */
883    public BodyStructureIncludedStructureComponent getIncludedStructureFirstRep() { 
884      if (getIncludedStructure().isEmpty()) {
885        addIncludedStructure();
886      }
887      return getIncludedStructure().get(0);
888    }
889
890    /**
891     * @return {@link #excludedStructure} (The anatomical location(s) or region(s) not occupied or represented by the specimen, lesion, or body structure.)
892     */
893    public List<BodyStructureExcludedStructureComponent> getExcludedStructure() { 
894      if (this.excludedStructure == null)
895        this.excludedStructure = new ArrayList<BodyStructureExcludedStructureComponent>();
896      return this.excludedStructure;
897    }
898
899    /**
900     * @return Returns a reference to <code>this</code> for easy method chaining
901     */
902    public BodyStructure setExcludedStructure(List<BodyStructureExcludedStructureComponent> theExcludedStructure) { 
903      this.excludedStructure = theExcludedStructure;
904      return this;
905    }
906
907    public boolean hasExcludedStructure() { 
908      if (this.excludedStructure == null)
909        return false;
910      for (BodyStructureExcludedStructureComponent item : this.excludedStructure)
911        if (!item.isEmpty())
912          return true;
913      return false;
914    }
915
916    public BodyStructureExcludedStructureComponent addExcludedStructure() { //3
917      BodyStructureExcludedStructureComponent t = new BodyStructureExcludedStructureComponent();
918      if (this.excludedStructure == null)
919        this.excludedStructure = new ArrayList<BodyStructureExcludedStructureComponent>();
920      this.excludedStructure.add(t);
921      return t;
922    }
923
924    public BodyStructure addExcludedStructure(BodyStructureExcludedStructureComponent t) { //3
925      if (t == null)
926        return this;
927      if (this.excludedStructure == null)
928        this.excludedStructure = new ArrayList<BodyStructureExcludedStructureComponent>();
929      this.excludedStructure.add(t);
930      return this;
931    }
932
933    /**
934     * @return The first repetition of repeating field {@link #excludedStructure}, creating it if it does not already exist {3}
935     */
936    public BodyStructureExcludedStructureComponent getExcludedStructureFirstRep() { 
937      if (getExcludedStructure().isEmpty()) {
938        addExcludedStructure();
939      }
940      return getExcludedStructure().get(0);
941    }
942
943    /**
944     * @return {@link #description} (A summary, characterization or explanation of the body structure.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
945     */
946    public StringType getDescriptionElement() { 
947      if (this.description == null)
948        if (Configuration.errorOnAutoCreate())
949          throw new Error("Attempt to auto-create BodyStructure.description");
950        else if (Configuration.doAutoCreate())
951          this.description = new StringType(); // bb
952      return this.description;
953    }
954
955    public boolean hasDescriptionElement() { 
956      return this.description != null && !this.description.isEmpty();
957    }
958
959    public boolean hasDescription() { 
960      return this.description != null && !this.description.isEmpty();
961    }
962
963    /**
964     * @param value {@link #description} (A summary, characterization or explanation of the body structure.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
965     */
966    public BodyStructure setDescriptionElement(StringType value) { 
967      this.description = value;
968      return this;
969    }
970
971    /**
972     * @return A summary, characterization or explanation of the body structure.
973     */
974    public String getDescription() { 
975      return this.description == null ? null : this.description.getValue();
976    }
977
978    /**
979     * @param value A summary, characterization or explanation of the body structure.
980     */
981    public BodyStructure setDescription(String value) { 
982      if (Utilities.noString(value))
983        this.description = null;
984      else {
985        if (this.description == null)
986          this.description = new StringType();
987        this.description.setValue(value);
988      }
989      return this;
990    }
991
992    /**
993     * @return {@link #image} (Image or images used to identify a location.)
994     */
995    public List<Attachment> getImage() { 
996      if (this.image == null)
997        this.image = new ArrayList<Attachment>();
998      return this.image;
999    }
1000
1001    /**
1002     * @return Returns a reference to <code>this</code> for easy method chaining
1003     */
1004    public BodyStructure setImage(List<Attachment> theImage) { 
1005      this.image = theImage;
1006      return this;
1007    }
1008
1009    public boolean hasImage() { 
1010      if (this.image == null)
1011        return false;
1012      for (Attachment item : this.image)
1013        if (!item.isEmpty())
1014          return true;
1015      return false;
1016    }
1017
1018    public Attachment addImage() { //3
1019      Attachment t = new Attachment();
1020      if (this.image == null)
1021        this.image = new ArrayList<Attachment>();
1022      this.image.add(t);
1023      return t;
1024    }
1025
1026    public BodyStructure addImage(Attachment t) { //3
1027      if (t == null)
1028        return this;
1029      if (this.image == null)
1030        this.image = new ArrayList<Attachment>();
1031      this.image.add(t);
1032      return this;
1033    }
1034
1035    /**
1036     * @return The first repetition of repeating field {@link #image}, creating it if it does not already exist {3}
1037     */
1038    public Attachment getImageFirstRep() { 
1039      if (getImage().isEmpty()) {
1040        addImage();
1041      }
1042      return getImage().get(0);
1043    }
1044
1045    /**
1046     * @return {@link #patient} (The person to which the body site belongs.)
1047     */
1048    public Reference getPatient() { 
1049      if (this.patient == null)
1050        if (Configuration.errorOnAutoCreate())
1051          throw new Error("Attempt to auto-create BodyStructure.patient");
1052        else if (Configuration.doAutoCreate())
1053          this.patient = new Reference(); // cc
1054      return this.patient;
1055    }
1056
1057    public boolean hasPatient() { 
1058      return this.patient != null && !this.patient.isEmpty();
1059    }
1060
1061    /**
1062     * @param value {@link #patient} (The person to which the body site belongs.)
1063     */
1064    public BodyStructure setPatient(Reference value) { 
1065      this.patient = value;
1066      return this;
1067    }
1068
1069      protected void listChildren(List<Property> children) {
1070        super.listChildren(children);
1071        children.add(new Property("identifier", "Identifier", "Identifier for this instance of the anatomical structure.", 0, java.lang.Integer.MAX_VALUE, identifier));
1072        children.add(new Property("active", "boolean", "Whether this body site is in active use.", 0, 1, active));
1073        children.add(new Property("morphology", "CodeableConcept", "The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.", 0, 1, morphology));
1074        children.add(new Property("includedStructure", "", "The anatomical location(s) or region(s) of the specimen, lesion, or body structure.", 0, java.lang.Integer.MAX_VALUE, includedStructure));
1075        children.add(new Property("excludedStructure", "", "The anatomical location(s) or region(s) not occupied or represented by the specimen, lesion, or body structure.", 0, java.lang.Integer.MAX_VALUE, excludedStructure));
1076        children.add(new Property("description", "string", "A summary, characterization or explanation of the body structure.", 0, 1, description));
1077        children.add(new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image));
1078        children.add(new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, 1, patient));
1079      }
1080
1081      @Override
1082      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1083        switch (_hash) {
1084        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier for this instance of the anatomical structure.", 0, java.lang.Integer.MAX_VALUE, identifier);
1085        case -1422950650: /*active*/  return new Property("active", "boolean", "Whether this body site is in active use.", 0, 1, active);
1086        case 1807231644: /*morphology*/  return new Property("morphology", "CodeableConcept", "The kind of structure being represented by the body structure at `BodyStructure.location`.  This can define both normal and abnormal morphologies.", 0, 1, morphology);
1087        case -1174069225: /*includedStructure*/  return new Property("includedStructure", "", "The anatomical location(s) or region(s) of the specimen, lesion, or body structure.", 0, java.lang.Integer.MAX_VALUE, includedStructure);
1088        case 1192252105: /*excludedStructure*/  return new Property("excludedStructure", "", "The anatomical location(s) or region(s) not occupied or represented by the specimen, lesion, or body structure.", 0, java.lang.Integer.MAX_VALUE, excludedStructure);
1089        case -1724546052: /*description*/  return new Property("description", "string", "A summary, characterization or explanation of the body structure.", 0, 1, description);
1090        case 100313435: /*image*/  return new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image);
1091        case -791418107: /*patient*/  return new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, 1, patient);
1092        default: return super.getNamedProperty(_hash, _name, _checkValid);
1093        }
1094
1095      }
1096
1097      @Override
1098      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1099        switch (hash) {
1100        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1101        case -1422950650: /*active*/ return this.active == null ? new Base[0] : new Base[] {this.active}; // BooleanType
1102        case 1807231644: /*morphology*/ return this.morphology == null ? new Base[0] : new Base[] {this.morphology}; // CodeableConcept
1103        case -1174069225: /*includedStructure*/ return this.includedStructure == null ? new Base[0] : this.includedStructure.toArray(new Base[this.includedStructure.size()]); // BodyStructureIncludedStructureComponent
1104        case 1192252105: /*excludedStructure*/ return this.excludedStructure == null ? new Base[0] : this.excludedStructure.toArray(new Base[this.excludedStructure.size()]); // BodyStructureExcludedStructureComponent
1105        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1106        case 100313435: /*image*/ return this.image == null ? new Base[0] : this.image.toArray(new Base[this.image.size()]); // Attachment
1107        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
1108        default: return super.getProperty(hash, name, checkValid);
1109        }
1110
1111      }
1112
1113      @Override
1114      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1115        switch (hash) {
1116        case -1618432855: // identifier
1117          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1118          return value;
1119        case -1422950650: // active
1120          this.active = TypeConvertor.castToBoolean(value); // BooleanType
1121          return value;
1122        case 1807231644: // morphology
1123          this.morphology = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1124          return value;
1125        case -1174069225: // includedStructure
1126          this.getIncludedStructure().add((BodyStructureIncludedStructureComponent) value); // BodyStructureIncludedStructureComponent
1127          return value;
1128        case 1192252105: // excludedStructure
1129          this.getExcludedStructure().add((BodyStructureExcludedStructureComponent) value); // BodyStructureExcludedStructureComponent
1130          return value;
1131        case -1724546052: // description
1132          this.description = TypeConvertor.castToString(value); // StringType
1133          return value;
1134        case 100313435: // image
1135          this.getImage().add(TypeConvertor.castToAttachment(value)); // Attachment
1136          return value;
1137        case -791418107: // patient
1138          this.patient = TypeConvertor.castToReference(value); // Reference
1139          return value;
1140        default: return super.setProperty(hash, name, value);
1141        }
1142
1143      }
1144
1145      @Override
1146      public Base setProperty(String name, Base value) throws FHIRException {
1147        if (name.equals("identifier")) {
1148          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1149        } else if (name.equals("active")) {
1150          this.active = TypeConvertor.castToBoolean(value); // BooleanType
1151        } else if (name.equals("morphology")) {
1152          this.morphology = TypeConvertor.castToCodeableConcept(value); // CodeableConcept
1153        } else if (name.equals("includedStructure")) {
1154          this.getIncludedStructure().add((BodyStructureIncludedStructureComponent) value);
1155        } else if (name.equals("excludedStructure")) {
1156          this.getExcludedStructure().add((BodyStructureExcludedStructureComponent) value);
1157        } else if (name.equals("description")) {
1158          this.description = TypeConvertor.castToString(value); // StringType
1159        } else if (name.equals("image")) {
1160          this.getImage().add(TypeConvertor.castToAttachment(value));
1161        } else if (name.equals("patient")) {
1162          this.patient = TypeConvertor.castToReference(value); // Reference
1163        } else
1164          return super.setProperty(name, value);
1165        return value;
1166      }
1167
1168      @Override
1169      public Base makeProperty(int hash, String name) throws FHIRException {
1170        switch (hash) {
1171        case -1618432855:  return addIdentifier(); 
1172        case -1422950650:  return getActiveElement();
1173        case 1807231644:  return getMorphology();
1174        case -1174069225:  return addIncludedStructure(); 
1175        case 1192252105:  return addExcludedStructure(); 
1176        case -1724546052:  return getDescriptionElement();
1177        case 100313435:  return addImage(); 
1178        case -791418107:  return getPatient();
1179        default: return super.makeProperty(hash, name);
1180        }
1181
1182      }
1183
1184      @Override
1185      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1186        switch (hash) {
1187        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1188        case -1422950650: /*active*/ return new String[] {"boolean"};
1189        case 1807231644: /*morphology*/ return new String[] {"CodeableConcept"};
1190        case -1174069225: /*includedStructure*/ return new String[] {};
1191        case 1192252105: /*excludedStructure*/ return new String[] {};
1192        case -1724546052: /*description*/ return new String[] {"string"};
1193        case 100313435: /*image*/ return new String[] {"Attachment"};
1194        case -791418107: /*patient*/ return new String[] {"Reference"};
1195        default: return super.getTypesForProperty(hash, name);
1196        }
1197
1198      }
1199
1200      @Override
1201      public Base addChild(String name) throws FHIRException {
1202        if (name.equals("identifier")) {
1203          return addIdentifier();
1204        }
1205        else if (name.equals("active")) {
1206          throw new FHIRException("Cannot call addChild on a primitive type BodyStructure.active");
1207        }
1208        else if (name.equals("morphology")) {
1209          this.morphology = new CodeableConcept();
1210          return this.morphology;
1211        }
1212        else if (name.equals("includedStructure")) {
1213          return addIncludedStructure();
1214        }
1215        else if (name.equals("excludedStructure")) {
1216          return addExcludedStructure();
1217        }
1218        else if (name.equals("description")) {
1219          throw new FHIRException("Cannot call addChild on a primitive type BodyStructure.description");
1220        }
1221        else if (name.equals("image")) {
1222          return addImage();
1223        }
1224        else if (name.equals("patient")) {
1225          this.patient = new Reference();
1226          return this.patient;
1227        }
1228        else
1229          return super.addChild(name);
1230      }
1231
1232  public String fhirType() {
1233    return "BodyStructure";
1234
1235  }
1236
1237      public BodyStructure copy() {
1238        BodyStructure dst = new BodyStructure();
1239        copyValues(dst);
1240        return dst;
1241      }
1242
1243      public void copyValues(BodyStructure dst) {
1244        super.copyValues(dst);
1245        if (identifier != null) {
1246          dst.identifier = new ArrayList<Identifier>();
1247          for (Identifier i : identifier)
1248            dst.identifier.add(i.copy());
1249        };
1250        dst.active = active == null ? null : active.copy();
1251        dst.morphology = morphology == null ? null : morphology.copy();
1252        if (includedStructure != null) {
1253          dst.includedStructure = new ArrayList<BodyStructureIncludedStructureComponent>();
1254          for (BodyStructureIncludedStructureComponent i : includedStructure)
1255            dst.includedStructure.add(i.copy());
1256        };
1257        if (excludedStructure != null) {
1258          dst.excludedStructure = new ArrayList<BodyStructureExcludedStructureComponent>();
1259          for (BodyStructureExcludedStructureComponent i : excludedStructure)
1260            dst.excludedStructure.add(i.copy());
1261        };
1262        dst.description = description == null ? null : description.copy();
1263        if (image != null) {
1264          dst.image = new ArrayList<Attachment>();
1265          for (Attachment i : image)
1266            dst.image.add(i.copy());
1267        };
1268        dst.patient = patient == null ? null : patient.copy();
1269      }
1270
1271      protected BodyStructure typedCopy() {
1272        return copy();
1273      }
1274
1275      @Override
1276      public boolean equalsDeep(Base other_) {
1277        if (!super.equalsDeep(other_))
1278          return false;
1279        if (!(other_ instanceof BodyStructure))
1280          return false;
1281        BodyStructure o = (BodyStructure) other_;
1282        return compareDeep(identifier, o.identifier, true) && compareDeep(active, o.active, true) && compareDeep(morphology, o.morphology, true)
1283           && compareDeep(includedStructure, o.includedStructure, true) && compareDeep(excludedStructure, o.excludedStructure, true)
1284           && compareDeep(description, o.description, true) && compareDeep(image, o.image, true) && compareDeep(patient, o.patient, true)
1285          ;
1286      }
1287
1288      @Override
1289      public boolean equalsShallow(Base other_) {
1290        if (!super.equalsShallow(other_))
1291          return false;
1292        if (!(other_ instanceof BodyStructure))
1293          return false;
1294        BodyStructure o = (BodyStructure) other_;
1295        return compareValues(active, o.active, true) && compareValues(description, o.description, true);
1296      }
1297
1298      public boolean isEmpty() {
1299        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, active, morphology
1300          , includedStructure, excludedStructure, description, image, patient);
1301      }
1302
1303  @Override
1304  public ResourceType getResourceType() {
1305    return ResourceType.BodyStructure;
1306   }
1307
1308 /**
1309   * Search parameter: <b>excluded_structure</b>
1310   * <p>
1311   * Description: <b>Body site excludedStructure structure</b><br>
1312   * Type: <b>token</b><br>
1313   * Path: <b>BodyStructure.excludedStructure.structure</b><br>
1314   * </p>
1315   */
1316  @SearchParamDefinition(name="excluded_structure", path="BodyStructure.excludedStructure.structure", description="Body site excludedStructure structure", type="token" )
1317  public static final String SP_EXCLUDEDSTRUCTURE = "excluded_structure";
1318 /**
1319   * <b>Fluent Client</b> search parameter constant for <b>excluded_structure</b>
1320   * <p>
1321   * Description: <b>Body site excludedStructure structure</b><br>
1322   * Type: <b>token</b><br>
1323   * Path: <b>BodyStructure.excludedStructure.structure</b><br>
1324   * </p>
1325   */
1326  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EXCLUDEDSTRUCTURE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EXCLUDEDSTRUCTURE);
1327
1328 /**
1329   * Search parameter: <b>identifier</b>
1330   * <p>
1331   * Description: <b>Bodystructure identifier</b><br>
1332   * Type: <b>token</b><br>
1333   * Path: <b>BodyStructure.identifier</b><br>
1334   * </p>
1335   */
1336  @SearchParamDefinition(name="identifier", path="BodyStructure.identifier", description="Bodystructure identifier", type="token" )
1337  public static final String SP_IDENTIFIER = "identifier";
1338 /**
1339   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1340   * <p>
1341   * Description: <b>Bodystructure identifier</b><br>
1342   * Type: <b>token</b><br>
1343   * Path: <b>BodyStructure.identifier</b><br>
1344   * </p>
1345   */
1346  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1347
1348 /**
1349   * Search parameter: <b>included_structure</b>
1350   * <p>
1351   * Description: <b>Body site includedStructure structure</b><br>
1352   * Type: <b>token</b><br>
1353   * Path: <b>BodyStructure.includedStructure.structure</b><br>
1354   * </p>
1355   */
1356  @SearchParamDefinition(name="included_structure", path="BodyStructure.includedStructure.structure", description="Body site includedStructure structure", type="token" )
1357  public static final String SP_INCLUDEDSTRUCTURE = "included_structure";
1358 /**
1359   * <b>Fluent Client</b> search parameter constant for <b>included_structure</b>
1360   * <p>
1361   * Description: <b>Body site includedStructure structure</b><br>
1362   * Type: <b>token</b><br>
1363   * Path: <b>BodyStructure.includedStructure.structure</b><br>
1364   * </p>
1365   */
1366  public static final ca.uhn.fhir.rest.gclient.TokenClientParam INCLUDEDSTRUCTURE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INCLUDEDSTRUCTURE);
1367
1368 /**
1369   * Search parameter: <b>morphology</b>
1370   * <p>
1371   * Description: <b>Kind of Structure</b><br>
1372   * Type: <b>token</b><br>
1373   * Path: <b>BodyStructure.morphology</b><br>
1374   * </p>
1375   */
1376  @SearchParamDefinition(name="morphology", path="BodyStructure.morphology", description="Kind of Structure", type="token" )
1377  public static final String SP_MORPHOLOGY = "morphology";
1378 /**
1379   * <b>Fluent Client</b> search parameter constant for <b>morphology</b>
1380   * <p>
1381   * Description: <b>Kind of Structure</b><br>
1382   * Type: <b>token</b><br>
1383   * Path: <b>BodyStructure.morphology</b><br>
1384   * </p>
1385   */
1386  public static final ca.uhn.fhir.rest.gclient.TokenClientParam MORPHOLOGY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_MORPHOLOGY);
1387
1388 /**
1389   * Search parameter: <b>patient</b>
1390   * <p>
1391   * Description: <b>Who this is about</b><br>
1392   * Type: <b>reference</b><br>
1393   * Path: <b>BodyStructure.patient</b><br>
1394   * </p>
1395   */
1396  @SearchParamDefinition(name="patient", path="BodyStructure.patient", description="Who this is about", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Base FHIR compartment definition for Patient") }, target={Patient.class } )
1397  public static final String SP_PATIENT = "patient";
1398 /**
1399   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
1400   * <p>
1401   * Description: <b>Who this is about</b><br>
1402   * Type: <b>reference</b><br>
1403   * Path: <b>BodyStructure.patient</b><br>
1404   * </p>
1405   */
1406  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
1407
1408/**
1409   * Constant for fluent queries to be used to add include statements. Specifies
1410   * the path value of "<b>BodyStructure:patient</b>".
1411   */
1412  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("BodyStructure:patient").toLocked();
1413
1414
1415}
1416