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 Sun, May 6, 2018 17:51-0400 for FHIR v3.4.0
033
034import java.util.*;
035
036import java.math.*;
037import org.hl7.fhir.utilities.Utilities;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046/**
047 * Details and position information for a physical place where services are provided and resources and participants may be stored, found, contained, or accommodated.
048 */
049@ResourceDef(name="Location", profile="http://hl7.org/fhir/Profile/Location")
050public class Location extends DomainResource {
051
052    public enum LocationStatus {
053        /**
054         * The location is operational.
055         */
056        ACTIVE, 
057        /**
058         * The location is temporarily closed.
059         */
060        SUSPENDED, 
061        /**
062         * The location is no longer used.
063         */
064        INACTIVE, 
065        /**
066         * added to help the parsers with the generic types
067         */
068        NULL;
069        public static LocationStatus fromCode(String codeString) throws FHIRException {
070            if (codeString == null || "".equals(codeString))
071                return null;
072        if ("active".equals(codeString))
073          return ACTIVE;
074        if ("suspended".equals(codeString))
075          return SUSPENDED;
076        if ("inactive".equals(codeString))
077          return INACTIVE;
078        if (Configuration.isAcceptInvalidEnums())
079          return null;
080        else
081          throw new FHIRException("Unknown LocationStatus code '"+codeString+"'");
082        }
083        public String toCode() {
084          switch (this) {
085            case ACTIVE: return "active";
086            case SUSPENDED: return "suspended";
087            case INACTIVE: return "inactive";
088            default: return "?";
089          }
090        }
091        public String getSystem() {
092          switch (this) {
093            case ACTIVE: return "http://hl7.org/fhir/location-status";
094            case SUSPENDED: return "http://hl7.org/fhir/location-status";
095            case INACTIVE: return "http://hl7.org/fhir/location-status";
096            default: return "?";
097          }
098        }
099        public String getDefinition() {
100          switch (this) {
101            case ACTIVE: return "The location is operational.";
102            case SUSPENDED: return "The location is temporarily closed.";
103            case INACTIVE: return "The location is no longer used.";
104            default: return "?";
105          }
106        }
107        public String getDisplay() {
108          switch (this) {
109            case ACTIVE: return "Active";
110            case SUSPENDED: return "Suspended";
111            case INACTIVE: return "Inactive";
112            default: return "?";
113          }
114        }
115    }
116
117  public static class LocationStatusEnumFactory implements EnumFactory<LocationStatus> {
118    public LocationStatus fromCode(String codeString) throws IllegalArgumentException {
119      if (codeString == null || "".equals(codeString))
120            if (codeString == null || "".equals(codeString))
121                return null;
122        if ("active".equals(codeString))
123          return LocationStatus.ACTIVE;
124        if ("suspended".equals(codeString))
125          return LocationStatus.SUSPENDED;
126        if ("inactive".equals(codeString))
127          return LocationStatus.INACTIVE;
128        throw new IllegalArgumentException("Unknown LocationStatus code '"+codeString+"'");
129        }
130        public Enumeration<LocationStatus> fromType(Base code) throws FHIRException {
131          if (code == null)
132            return null;
133          if (code.isEmpty())
134            return new Enumeration<LocationStatus>(this);
135          String codeString = ((PrimitiveType) code).asStringValue();
136          if (codeString == null || "".equals(codeString))
137            return null;
138        if ("active".equals(codeString))
139          return new Enumeration<LocationStatus>(this, LocationStatus.ACTIVE);
140        if ("suspended".equals(codeString))
141          return new Enumeration<LocationStatus>(this, LocationStatus.SUSPENDED);
142        if ("inactive".equals(codeString))
143          return new Enumeration<LocationStatus>(this, LocationStatus.INACTIVE);
144        throw new FHIRException("Unknown LocationStatus code '"+codeString+"'");
145        }
146    public String toCode(LocationStatus code) {
147      if (code == LocationStatus.ACTIVE)
148        return "active";
149      if (code == LocationStatus.SUSPENDED)
150        return "suspended";
151      if (code == LocationStatus.INACTIVE)
152        return "inactive";
153      return "?";
154      }
155    public String toSystem(LocationStatus code) {
156      return code.getSystem();
157      }
158    }
159
160    public enum LocationMode {
161        /**
162         * The Location resource represents a specific instance of a location (e.g. Operating Theatre 1A).
163         */
164        INSTANCE, 
165        /**
166         * The Location represents a class of locations (e.g. Any Operating Theatre) although this class of locations could be constrained within a specific boundary (such as organization, or parent location, address etc.).
167         */
168        KIND, 
169        /**
170         * added to help the parsers with the generic types
171         */
172        NULL;
173        public static LocationMode fromCode(String codeString) throws FHIRException {
174            if (codeString == null || "".equals(codeString))
175                return null;
176        if ("instance".equals(codeString))
177          return INSTANCE;
178        if ("kind".equals(codeString))
179          return KIND;
180        if (Configuration.isAcceptInvalidEnums())
181          return null;
182        else
183          throw new FHIRException("Unknown LocationMode code '"+codeString+"'");
184        }
185        public String toCode() {
186          switch (this) {
187            case INSTANCE: return "instance";
188            case KIND: return "kind";
189            default: return "?";
190          }
191        }
192        public String getSystem() {
193          switch (this) {
194            case INSTANCE: return "http://hl7.org/fhir/location-mode";
195            case KIND: return "http://hl7.org/fhir/location-mode";
196            default: return "?";
197          }
198        }
199        public String getDefinition() {
200          switch (this) {
201            case INSTANCE: return "The Location resource represents a specific instance of a location (e.g. Operating Theatre 1A).";
202            case KIND: return "The Location represents a class of locations (e.g. Any Operating Theatre) although this class of locations could be constrained within a specific boundary (such as organization, or parent location, address etc.).";
203            default: return "?";
204          }
205        }
206        public String getDisplay() {
207          switch (this) {
208            case INSTANCE: return "Instance";
209            case KIND: return "Kind";
210            default: return "?";
211          }
212        }
213    }
214
215  public static class LocationModeEnumFactory implements EnumFactory<LocationMode> {
216    public LocationMode fromCode(String codeString) throws IllegalArgumentException {
217      if (codeString == null || "".equals(codeString))
218            if (codeString == null || "".equals(codeString))
219                return null;
220        if ("instance".equals(codeString))
221          return LocationMode.INSTANCE;
222        if ("kind".equals(codeString))
223          return LocationMode.KIND;
224        throw new IllegalArgumentException("Unknown LocationMode code '"+codeString+"'");
225        }
226        public Enumeration<LocationMode> fromType(Base code) throws FHIRException {
227          if (code == null)
228            return null;
229          if (code.isEmpty())
230            return new Enumeration<LocationMode>(this);
231          String codeString = ((PrimitiveType) code).asStringValue();
232          if (codeString == null || "".equals(codeString))
233            return null;
234        if ("instance".equals(codeString))
235          return new Enumeration<LocationMode>(this, LocationMode.INSTANCE);
236        if ("kind".equals(codeString))
237          return new Enumeration<LocationMode>(this, LocationMode.KIND);
238        throw new FHIRException("Unknown LocationMode code '"+codeString+"'");
239        }
240    public String toCode(LocationMode code) {
241      if (code == LocationMode.INSTANCE)
242        return "instance";
243      if (code == LocationMode.KIND)
244        return "kind";
245      return "?";
246      }
247    public String toSystem(LocationMode code) {
248      return code.getSystem();
249      }
250    }
251
252    public enum DaysOfWeek {
253        /**
254         * Monday
255         */
256        MON, 
257        /**
258         * Tuesday
259         */
260        TUE, 
261        /**
262         * Wednesday
263         */
264        WED, 
265        /**
266         * Thursday
267         */
268        THU, 
269        /**
270         * Friday
271         */
272        FRI, 
273        /**
274         * Saturday
275         */
276        SAT, 
277        /**
278         * Sunday
279         */
280        SUN, 
281        /**
282         * added to help the parsers with the generic types
283         */
284        NULL;
285        public static DaysOfWeek fromCode(String codeString) throws FHIRException {
286            if (codeString == null || "".equals(codeString))
287                return null;
288        if ("mon".equals(codeString))
289          return MON;
290        if ("tue".equals(codeString))
291          return TUE;
292        if ("wed".equals(codeString))
293          return WED;
294        if ("thu".equals(codeString))
295          return THU;
296        if ("fri".equals(codeString))
297          return FRI;
298        if ("sat".equals(codeString))
299          return SAT;
300        if ("sun".equals(codeString))
301          return SUN;
302        if (Configuration.isAcceptInvalidEnums())
303          return null;
304        else
305          throw new FHIRException("Unknown DaysOfWeek code '"+codeString+"'");
306        }
307        public String toCode() {
308          switch (this) {
309            case MON: return "mon";
310            case TUE: return "tue";
311            case WED: return "wed";
312            case THU: return "thu";
313            case FRI: return "fri";
314            case SAT: return "sat";
315            case SUN: return "sun";
316            default: return "?";
317          }
318        }
319        public String getSystem() {
320          switch (this) {
321            case MON: return "http://hl7.org/fhir/days-of-week";
322            case TUE: return "http://hl7.org/fhir/days-of-week";
323            case WED: return "http://hl7.org/fhir/days-of-week";
324            case THU: return "http://hl7.org/fhir/days-of-week";
325            case FRI: return "http://hl7.org/fhir/days-of-week";
326            case SAT: return "http://hl7.org/fhir/days-of-week";
327            case SUN: return "http://hl7.org/fhir/days-of-week";
328            default: return "?";
329          }
330        }
331        public String getDefinition() {
332          switch (this) {
333            case MON: return "Monday";
334            case TUE: return "Tuesday";
335            case WED: return "Wednesday";
336            case THU: return "Thursday";
337            case FRI: return "Friday";
338            case SAT: return "Saturday";
339            case SUN: return "Sunday";
340            default: return "?";
341          }
342        }
343        public String getDisplay() {
344          switch (this) {
345            case MON: return "Monday";
346            case TUE: return "Tuesday";
347            case WED: return "Wednesday";
348            case THU: return "Thursday";
349            case FRI: return "Friday";
350            case SAT: return "Saturday";
351            case SUN: return "Sunday";
352            default: return "?";
353          }
354        }
355    }
356
357  public static class DaysOfWeekEnumFactory implements EnumFactory<DaysOfWeek> {
358    public DaysOfWeek fromCode(String codeString) throws IllegalArgumentException {
359      if (codeString == null || "".equals(codeString))
360            if (codeString == null || "".equals(codeString))
361                return null;
362        if ("mon".equals(codeString))
363          return DaysOfWeek.MON;
364        if ("tue".equals(codeString))
365          return DaysOfWeek.TUE;
366        if ("wed".equals(codeString))
367          return DaysOfWeek.WED;
368        if ("thu".equals(codeString))
369          return DaysOfWeek.THU;
370        if ("fri".equals(codeString))
371          return DaysOfWeek.FRI;
372        if ("sat".equals(codeString))
373          return DaysOfWeek.SAT;
374        if ("sun".equals(codeString))
375          return DaysOfWeek.SUN;
376        throw new IllegalArgumentException("Unknown DaysOfWeek code '"+codeString+"'");
377        }
378        public Enumeration<DaysOfWeek> fromType(Base code) throws FHIRException {
379          if (code == null)
380            return null;
381          if (code.isEmpty())
382            return new Enumeration<DaysOfWeek>(this);
383          String codeString = ((PrimitiveType) code).asStringValue();
384          if (codeString == null || "".equals(codeString))
385            return null;
386        if ("mon".equals(codeString))
387          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.MON);
388        if ("tue".equals(codeString))
389          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.TUE);
390        if ("wed".equals(codeString))
391          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.WED);
392        if ("thu".equals(codeString))
393          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.THU);
394        if ("fri".equals(codeString))
395          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.FRI);
396        if ("sat".equals(codeString))
397          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.SAT);
398        if ("sun".equals(codeString))
399          return new Enumeration<DaysOfWeek>(this, DaysOfWeek.SUN);
400        throw new FHIRException("Unknown DaysOfWeek code '"+codeString+"'");
401        }
402    public String toCode(DaysOfWeek code) {
403      if (code == DaysOfWeek.MON)
404        return "mon";
405      if (code == DaysOfWeek.TUE)
406        return "tue";
407      if (code == DaysOfWeek.WED)
408        return "wed";
409      if (code == DaysOfWeek.THU)
410        return "thu";
411      if (code == DaysOfWeek.FRI)
412        return "fri";
413      if (code == DaysOfWeek.SAT)
414        return "sat";
415      if (code == DaysOfWeek.SUN)
416        return "sun";
417      return "?";
418      }
419    public String toSystem(DaysOfWeek code) {
420      return code.getSystem();
421      }
422    }
423
424    @Block()
425    public static class LocationPositionComponent extends BackboneElement implements IBaseBackboneElement {
426        /**
427         * Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).
428         */
429        @Child(name = "longitude", type = {DecimalType.class}, order=1, min=1, max=1, modifier=false, summary=false)
430        @Description(shortDefinition="Longitude with WGS84 datum", formalDefinition="Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below)." )
431        protected DecimalType longitude;
432
433        /**
434         * Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).
435         */
436        @Child(name = "latitude", type = {DecimalType.class}, order=2, min=1, max=1, modifier=false, summary=false)
437        @Description(shortDefinition="Latitude with WGS84 datum", formalDefinition="Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below)." )
438        protected DecimalType latitude;
439
440        /**
441         * Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).
442         */
443        @Child(name = "altitude", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=false)
444        @Description(shortDefinition="Altitude with WGS84 datum", formalDefinition="Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below)." )
445        protected DecimalType altitude;
446
447        private static final long serialVersionUID = -74276134L;
448
449    /**
450     * Constructor
451     */
452      public LocationPositionComponent() {
453        super();
454      }
455
456    /**
457     * Constructor
458     */
459      public LocationPositionComponent(DecimalType longitude, DecimalType latitude) {
460        super();
461        this.longitude = longitude;
462        this.latitude = latitude;
463      }
464
465        /**
466         * @return {@link #longitude} (Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getLongitude" gives direct access to the value
467         */
468        public DecimalType getLongitudeElement() { 
469          if (this.longitude == null)
470            if (Configuration.errorOnAutoCreate())
471              throw new Error("Attempt to auto-create LocationPositionComponent.longitude");
472            else if (Configuration.doAutoCreate())
473              this.longitude = new DecimalType(); // bb
474          return this.longitude;
475        }
476
477        public boolean hasLongitudeElement() { 
478          return this.longitude != null && !this.longitude.isEmpty();
479        }
480
481        public boolean hasLongitude() { 
482          return this.longitude != null && !this.longitude.isEmpty();
483        }
484
485        /**
486         * @param value {@link #longitude} (Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getLongitude" gives direct access to the value
487         */
488        public LocationPositionComponent setLongitudeElement(DecimalType value) { 
489          this.longitude = value;
490          return this;
491        }
492
493        /**
494         * @return Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).
495         */
496        public BigDecimal getLongitude() { 
497          return this.longitude == null ? null : this.longitude.getValue();
498        }
499
500        /**
501         * @param value Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).
502         */
503        public LocationPositionComponent setLongitude(BigDecimal value) { 
504            if (this.longitude == null)
505              this.longitude = new DecimalType();
506            this.longitude.setValue(value);
507          return this;
508        }
509
510        /**
511         * @param value Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).
512         */
513        public LocationPositionComponent setLongitude(long value) { 
514              this.longitude = new DecimalType();
515            this.longitude.setValue(value);
516          return this;
517        }
518
519        /**
520         * @param value Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).
521         */
522        public LocationPositionComponent setLongitude(double value) { 
523              this.longitude = new DecimalType();
524            this.longitude.setValue(value);
525          return this;
526        }
527
528        /**
529         * @return {@link #latitude} (Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getLatitude" gives direct access to the value
530         */
531        public DecimalType getLatitudeElement() { 
532          if (this.latitude == null)
533            if (Configuration.errorOnAutoCreate())
534              throw new Error("Attempt to auto-create LocationPositionComponent.latitude");
535            else if (Configuration.doAutoCreate())
536              this.latitude = new DecimalType(); // bb
537          return this.latitude;
538        }
539
540        public boolean hasLatitudeElement() { 
541          return this.latitude != null && !this.latitude.isEmpty();
542        }
543
544        public boolean hasLatitude() { 
545          return this.latitude != null && !this.latitude.isEmpty();
546        }
547
548        /**
549         * @param value {@link #latitude} (Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getLatitude" gives direct access to the value
550         */
551        public LocationPositionComponent setLatitudeElement(DecimalType value) { 
552          this.latitude = value;
553          return this;
554        }
555
556        /**
557         * @return Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).
558         */
559        public BigDecimal getLatitude() { 
560          return this.latitude == null ? null : this.latitude.getValue();
561        }
562
563        /**
564         * @param value Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).
565         */
566        public LocationPositionComponent setLatitude(BigDecimal value) { 
567            if (this.latitude == null)
568              this.latitude = new DecimalType();
569            this.latitude.setValue(value);
570          return this;
571        }
572
573        /**
574         * @param value Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).
575         */
576        public LocationPositionComponent setLatitude(long value) { 
577              this.latitude = new DecimalType();
578            this.latitude.setValue(value);
579          return this;
580        }
581
582        /**
583         * @param value Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).
584         */
585        public LocationPositionComponent setLatitude(double value) { 
586              this.latitude = new DecimalType();
587            this.latitude.setValue(value);
588          return this;
589        }
590
591        /**
592         * @return {@link #altitude} (Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getAltitude" gives direct access to the value
593         */
594        public DecimalType getAltitudeElement() { 
595          if (this.altitude == null)
596            if (Configuration.errorOnAutoCreate())
597              throw new Error("Attempt to auto-create LocationPositionComponent.altitude");
598            else if (Configuration.doAutoCreate())
599              this.altitude = new DecimalType(); // bb
600          return this.altitude;
601        }
602
603        public boolean hasAltitudeElement() { 
604          return this.altitude != null && !this.altitude.isEmpty();
605        }
606
607        public boolean hasAltitude() { 
608          return this.altitude != null && !this.altitude.isEmpty();
609        }
610
611        /**
612         * @param value {@link #altitude} (Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getAltitude" gives direct access to the value
613         */
614        public LocationPositionComponent setAltitudeElement(DecimalType value) { 
615          this.altitude = value;
616          return this;
617        }
618
619        /**
620         * @return Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).
621         */
622        public BigDecimal getAltitude() { 
623          return this.altitude == null ? null : this.altitude.getValue();
624        }
625
626        /**
627         * @param value Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).
628         */
629        public LocationPositionComponent setAltitude(BigDecimal value) { 
630          if (value == null)
631            this.altitude = null;
632          else {
633            if (this.altitude == null)
634              this.altitude = new DecimalType();
635            this.altitude.setValue(value);
636          }
637          return this;
638        }
639
640        /**
641         * @param value Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).
642         */
643        public LocationPositionComponent setAltitude(long value) { 
644              this.altitude = new DecimalType();
645            this.altitude.setValue(value);
646          return this;
647        }
648
649        /**
650         * @param value Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).
651         */
652        public LocationPositionComponent setAltitude(double value) { 
653              this.altitude = new DecimalType();
654            this.altitude.setValue(value);
655          return this;
656        }
657
658        protected void listChildren(List<Property> children) {
659          super.listChildren(children);
660          children.add(new Property("longitude", "decimal", "Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).", 0, 1, longitude));
661          children.add(new Property("latitude", "decimal", "Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).", 0, 1, latitude));
662          children.add(new Property("altitude", "decimal", "Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).", 0, 1, altitude));
663        }
664
665        @Override
666        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
667          switch (_hash) {
668          case 137365935: /*longitude*/  return new Property("longitude", "decimal", "Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).", 0, 1, longitude);
669          case -1439978388: /*latitude*/  return new Property("latitude", "decimal", "Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).", 0, 1, latitude);
670          case 2036550306: /*altitude*/  return new Property("altitude", "decimal", "Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).", 0, 1, altitude);
671          default: return super.getNamedProperty(_hash, _name, _checkValid);
672          }
673
674        }
675
676      @Override
677      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
678        switch (hash) {
679        case 137365935: /*longitude*/ return this.longitude == null ? new Base[0] : new Base[] {this.longitude}; // DecimalType
680        case -1439978388: /*latitude*/ return this.latitude == null ? new Base[0] : new Base[] {this.latitude}; // DecimalType
681        case 2036550306: /*altitude*/ return this.altitude == null ? new Base[0] : new Base[] {this.altitude}; // DecimalType
682        default: return super.getProperty(hash, name, checkValid);
683        }
684
685      }
686
687      @Override
688      public Base setProperty(int hash, String name, Base value) throws FHIRException {
689        switch (hash) {
690        case 137365935: // longitude
691          this.longitude = castToDecimal(value); // DecimalType
692          return value;
693        case -1439978388: // latitude
694          this.latitude = castToDecimal(value); // DecimalType
695          return value;
696        case 2036550306: // altitude
697          this.altitude = castToDecimal(value); // DecimalType
698          return value;
699        default: return super.setProperty(hash, name, value);
700        }
701
702      }
703
704      @Override
705      public Base setProperty(String name, Base value) throws FHIRException {
706        if (name.equals("longitude")) {
707          this.longitude = castToDecimal(value); // DecimalType
708        } else if (name.equals("latitude")) {
709          this.latitude = castToDecimal(value); // DecimalType
710        } else if (name.equals("altitude")) {
711          this.altitude = castToDecimal(value); // DecimalType
712        } else
713          return super.setProperty(name, value);
714        return value;
715      }
716
717      @Override
718      public Base makeProperty(int hash, String name) throws FHIRException {
719        switch (hash) {
720        case 137365935:  return getLongitudeElement();
721        case -1439978388:  return getLatitudeElement();
722        case 2036550306:  return getAltitudeElement();
723        default: return super.makeProperty(hash, name);
724        }
725
726      }
727
728      @Override
729      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
730        switch (hash) {
731        case 137365935: /*longitude*/ return new String[] {"decimal"};
732        case -1439978388: /*latitude*/ return new String[] {"decimal"};
733        case 2036550306: /*altitude*/ return new String[] {"decimal"};
734        default: return super.getTypesForProperty(hash, name);
735        }
736
737      }
738
739      @Override
740      public Base addChild(String name) throws FHIRException {
741        if (name.equals("longitude")) {
742          throw new FHIRException("Cannot call addChild on a primitive type Location.longitude");
743        }
744        else if (name.equals("latitude")) {
745          throw new FHIRException("Cannot call addChild on a primitive type Location.latitude");
746        }
747        else if (name.equals("altitude")) {
748          throw new FHIRException("Cannot call addChild on a primitive type Location.altitude");
749        }
750        else
751          return super.addChild(name);
752      }
753
754      public LocationPositionComponent copy() {
755        LocationPositionComponent dst = new LocationPositionComponent();
756        copyValues(dst);
757        dst.longitude = longitude == null ? null : longitude.copy();
758        dst.latitude = latitude == null ? null : latitude.copy();
759        dst.altitude = altitude == null ? null : altitude.copy();
760        return dst;
761      }
762
763      @Override
764      public boolean equalsDeep(Base other_) {
765        if (!super.equalsDeep(other_))
766          return false;
767        if (!(other_ instanceof LocationPositionComponent))
768          return false;
769        LocationPositionComponent o = (LocationPositionComponent) other_;
770        return compareDeep(longitude, o.longitude, true) && compareDeep(latitude, o.latitude, true) && compareDeep(altitude, o.altitude, true)
771          ;
772      }
773
774      @Override
775      public boolean equalsShallow(Base other_) {
776        if (!super.equalsShallow(other_))
777          return false;
778        if (!(other_ instanceof LocationPositionComponent))
779          return false;
780        LocationPositionComponent o = (LocationPositionComponent) other_;
781        return compareValues(longitude, o.longitude, true) && compareValues(latitude, o.latitude, true) && compareValues(altitude, o.altitude, true)
782          ;
783      }
784
785      public boolean isEmpty() {
786        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(longitude, latitude, altitude
787          );
788      }
789
790  public String fhirType() {
791    return "Location.position";
792
793  }
794
795  }
796
797    @Block()
798    public static class LocationHoursOfOperationComponent extends BackboneElement implements IBaseBackboneElement {
799        /**
800         * Indicates which days of the week are available between the start and end Times.
801         */
802        @Child(name = "daysOfWeek", type = {CodeType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
803        @Description(shortDefinition="mon | tue | wed | thu | fri | sat | sun", formalDefinition="Indicates which days of the week are available between the start and end Times." )
804        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/days-of-week")
805        protected List<Enumeration<DaysOfWeek>> daysOfWeek;
806
807        /**
808         * The Location is open all day.
809         */
810        @Child(name = "allDay", type = {BooleanType.class}, order=2, min=0, max=1, modifier=false, summary=false)
811        @Description(shortDefinition="The Location is open all day", formalDefinition="The Location is open all day." )
812        protected BooleanType allDay;
813
814        /**
815         * Time that the Location opens.
816         */
817        @Child(name = "openingTime", type = {TimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
818        @Description(shortDefinition="Time that the Location opens", formalDefinition="Time that the Location opens." )
819        protected TimeType openingTime;
820
821        /**
822         * Time that the Location closes.
823         */
824        @Child(name = "closingTime", type = {TimeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
825        @Description(shortDefinition="Time that the Location closes", formalDefinition="Time that the Location closes." )
826        protected TimeType closingTime;
827
828        private static final long serialVersionUID = -932551849L;
829
830    /**
831     * Constructor
832     */
833      public LocationHoursOfOperationComponent() {
834        super();
835      }
836
837        /**
838         * @return {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
839         */
840        public List<Enumeration<DaysOfWeek>> getDaysOfWeek() { 
841          if (this.daysOfWeek == null)
842            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
843          return this.daysOfWeek;
844        }
845
846        /**
847         * @return Returns a reference to <code>this</code> for easy method chaining
848         */
849        public LocationHoursOfOperationComponent setDaysOfWeek(List<Enumeration<DaysOfWeek>> theDaysOfWeek) { 
850          this.daysOfWeek = theDaysOfWeek;
851          return this;
852        }
853
854        public boolean hasDaysOfWeek() { 
855          if (this.daysOfWeek == null)
856            return false;
857          for (Enumeration<DaysOfWeek> item : this.daysOfWeek)
858            if (!item.isEmpty())
859              return true;
860          return false;
861        }
862
863        /**
864         * @return {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
865         */
866        public Enumeration<DaysOfWeek> addDaysOfWeekElement() {//2 
867          Enumeration<DaysOfWeek> t = new Enumeration<DaysOfWeek>(new DaysOfWeekEnumFactory());
868          if (this.daysOfWeek == null)
869            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
870          this.daysOfWeek.add(t);
871          return t;
872        }
873
874        /**
875         * @param value {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
876         */
877        public LocationHoursOfOperationComponent addDaysOfWeek(DaysOfWeek value) { //1
878          Enumeration<DaysOfWeek> t = new Enumeration<DaysOfWeek>(new DaysOfWeekEnumFactory());
879          t.setValue(value);
880          if (this.daysOfWeek == null)
881            this.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
882          this.daysOfWeek.add(t);
883          return this;
884        }
885
886        /**
887         * @param value {@link #daysOfWeek} (Indicates which days of the week are available between the start and end Times.)
888         */
889        public boolean hasDaysOfWeek(DaysOfWeek value) { 
890          if (this.daysOfWeek == null)
891            return false;
892          for (Enumeration<DaysOfWeek> v : this.daysOfWeek)
893            if (v.getValue().equals(value)) // code
894              return true;
895          return false;
896        }
897
898        /**
899         * @return {@link #allDay} (The Location is open all day.). This is the underlying object with id, value and extensions. The accessor "getAllDay" gives direct access to the value
900         */
901        public BooleanType getAllDayElement() { 
902          if (this.allDay == null)
903            if (Configuration.errorOnAutoCreate())
904              throw new Error("Attempt to auto-create LocationHoursOfOperationComponent.allDay");
905            else if (Configuration.doAutoCreate())
906              this.allDay = new BooleanType(); // bb
907          return this.allDay;
908        }
909
910        public boolean hasAllDayElement() { 
911          return this.allDay != null && !this.allDay.isEmpty();
912        }
913
914        public boolean hasAllDay() { 
915          return this.allDay != null && !this.allDay.isEmpty();
916        }
917
918        /**
919         * @param value {@link #allDay} (The Location is open all day.). This is the underlying object with id, value and extensions. The accessor "getAllDay" gives direct access to the value
920         */
921        public LocationHoursOfOperationComponent setAllDayElement(BooleanType value) { 
922          this.allDay = value;
923          return this;
924        }
925
926        /**
927         * @return The Location is open all day.
928         */
929        public boolean getAllDay() { 
930          return this.allDay == null || this.allDay.isEmpty() ? false : this.allDay.getValue();
931        }
932
933        /**
934         * @param value The Location is open all day.
935         */
936        public LocationHoursOfOperationComponent setAllDay(boolean value) { 
937            if (this.allDay == null)
938              this.allDay = new BooleanType();
939            this.allDay.setValue(value);
940          return this;
941        }
942
943        /**
944         * @return {@link #openingTime} (Time that the Location opens.). This is the underlying object with id, value and extensions. The accessor "getOpeningTime" gives direct access to the value
945         */
946        public TimeType getOpeningTimeElement() { 
947          if (this.openingTime == null)
948            if (Configuration.errorOnAutoCreate())
949              throw new Error("Attempt to auto-create LocationHoursOfOperationComponent.openingTime");
950            else if (Configuration.doAutoCreate())
951              this.openingTime = new TimeType(); // bb
952          return this.openingTime;
953        }
954
955        public boolean hasOpeningTimeElement() { 
956          return this.openingTime != null && !this.openingTime.isEmpty();
957        }
958
959        public boolean hasOpeningTime() { 
960          return this.openingTime != null && !this.openingTime.isEmpty();
961        }
962
963        /**
964         * @param value {@link #openingTime} (Time that the Location opens.). This is the underlying object with id, value and extensions. The accessor "getOpeningTime" gives direct access to the value
965         */
966        public LocationHoursOfOperationComponent setOpeningTimeElement(TimeType value) { 
967          this.openingTime = value;
968          return this;
969        }
970
971        /**
972         * @return Time that the Location opens.
973         */
974        public String getOpeningTime() { 
975          return this.openingTime == null ? null : this.openingTime.getValue();
976        }
977
978        /**
979         * @param value Time that the Location opens.
980         */
981        public LocationHoursOfOperationComponent setOpeningTime(String value) { 
982          if (value == null)
983            this.openingTime = null;
984          else {
985            if (this.openingTime == null)
986              this.openingTime = new TimeType();
987            this.openingTime.setValue(value);
988          }
989          return this;
990        }
991
992        /**
993         * @return {@link #closingTime} (Time that the Location closes.). This is the underlying object with id, value and extensions. The accessor "getClosingTime" gives direct access to the value
994         */
995        public TimeType getClosingTimeElement() { 
996          if (this.closingTime == null)
997            if (Configuration.errorOnAutoCreate())
998              throw new Error("Attempt to auto-create LocationHoursOfOperationComponent.closingTime");
999            else if (Configuration.doAutoCreate())
1000              this.closingTime = new TimeType(); // bb
1001          return this.closingTime;
1002        }
1003
1004        public boolean hasClosingTimeElement() { 
1005          return this.closingTime != null && !this.closingTime.isEmpty();
1006        }
1007
1008        public boolean hasClosingTime() { 
1009          return this.closingTime != null && !this.closingTime.isEmpty();
1010        }
1011
1012        /**
1013         * @param value {@link #closingTime} (Time that the Location closes.). This is the underlying object with id, value and extensions. The accessor "getClosingTime" gives direct access to the value
1014         */
1015        public LocationHoursOfOperationComponent setClosingTimeElement(TimeType value) { 
1016          this.closingTime = value;
1017          return this;
1018        }
1019
1020        /**
1021         * @return Time that the Location closes.
1022         */
1023        public String getClosingTime() { 
1024          return this.closingTime == null ? null : this.closingTime.getValue();
1025        }
1026
1027        /**
1028         * @param value Time that the Location closes.
1029         */
1030        public LocationHoursOfOperationComponent setClosingTime(String value) { 
1031          if (value == null)
1032            this.closingTime = null;
1033          else {
1034            if (this.closingTime == null)
1035              this.closingTime = new TimeType();
1036            this.closingTime.setValue(value);
1037          }
1038          return this;
1039        }
1040
1041        protected void listChildren(List<Property> children) {
1042          super.listChildren(children);
1043          children.add(new Property("daysOfWeek", "code", "Indicates which days of the week are available between the start and end Times.", 0, java.lang.Integer.MAX_VALUE, daysOfWeek));
1044          children.add(new Property("allDay", "boolean", "The Location is open all day.", 0, 1, allDay));
1045          children.add(new Property("openingTime", "time", "Time that the Location opens.", 0, 1, openingTime));
1046          children.add(new Property("closingTime", "time", "Time that the Location closes.", 0, 1, closingTime));
1047        }
1048
1049        @Override
1050        public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1051          switch (_hash) {
1052          case 68050338: /*daysOfWeek*/  return new Property("daysOfWeek", "code", "Indicates which days of the week are available between the start and end Times.", 0, java.lang.Integer.MAX_VALUE, daysOfWeek);
1053          case -1414913477: /*allDay*/  return new Property("allDay", "boolean", "The Location is open all day.", 0, 1, allDay);
1054          case 84062277: /*openingTime*/  return new Property("openingTime", "time", "Time that the Location opens.", 0, 1, openingTime);
1055          case 188137762: /*closingTime*/  return new Property("closingTime", "time", "Time that the Location closes.", 0, 1, closingTime);
1056          default: return super.getNamedProperty(_hash, _name, _checkValid);
1057          }
1058
1059        }
1060
1061      @Override
1062      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1063        switch (hash) {
1064        case 68050338: /*daysOfWeek*/ return this.daysOfWeek == null ? new Base[0] : this.daysOfWeek.toArray(new Base[this.daysOfWeek.size()]); // Enumeration<DaysOfWeek>
1065        case -1414913477: /*allDay*/ return this.allDay == null ? new Base[0] : new Base[] {this.allDay}; // BooleanType
1066        case 84062277: /*openingTime*/ return this.openingTime == null ? new Base[0] : new Base[] {this.openingTime}; // TimeType
1067        case 188137762: /*closingTime*/ return this.closingTime == null ? new Base[0] : new Base[] {this.closingTime}; // TimeType
1068        default: return super.getProperty(hash, name, checkValid);
1069        }
1070
1071      }
1072
1073      @Override
1074      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1075        switch (hash) {
1076        case 68050338: // daysOfWeek
1077          value = new DaysOfWeekEnumFactory().fromType(castToCode(value));
1078          this.getDaysOfWeek().add((Enumeration) value); // Enumeration<DaysOfWeek>
1079          return value;
1080        case -1414913477: // allDay
1081          this.allDay = castToBoolean(value); // BooleanType
1082          return value;
1083        case 84062277: // openingTime
1084          this.openingTime = castToTime(value); // TimeType
1085          return value;
1086        case 188137762: // closingTime
1087          this.closingTime = castToTime(value); // TimeType
1088          return value;
1089        default: return super.setProperty(hash, name, value);
1090        }
1091
1092      }
1093
1094      @Override
1095      public Base setProperty(String name, Base value) throws FHIRException {
1096        if (name.equals("daysOfWeek")) {
1097          value = new DaysOfWeekEnumFactory().fromType(castToCode(value));
1098          this.getDaysOfWeek().add((Enumeration) value);
1099        } else if (name.equals("allDay")) {
1100          this.allDay = castToBoolean(value); // BooleanType
1101        } else if (name.equals("openingTime")) {
1102          this.openingTime = castToTime(value); // TimeType
1103        } else if (name.equals("closingTime")) {
1104          this.closingTime = castToTime(value); // TimeType
1105        } else
1106          return super.setProperty(name, value);
1107        return value;
1108      }
1109
1110      @Override
1111      public Base makeProperty(int hash, String name) throws FHIRException {
1112        switch (hash) {
1113        case 68050338:  return addDaysOfWeekElement();
1114        case -1414913477:  return getAllDayElement();
1115        case 84062277:  return getOpeningTimeElement();
1116        case 188137762:  return getClosingTimeElement();
1117        default: return super.makeProperty(hash, name);
1118        }
1119
1120      }
1121
1122      @Override
1123      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1124        switch (hash) {
1125        case 68050338: /*daysOfWeek*/ return new String[] {"code"};
1126        case -1414913477: /*allDay*/ return new String[] {"boolean"};
1127        case 84062277: /*openingTime*/ return new String[] {"time"};
1128        case 188137762: /*closingTime*/ return new String[] {"time"};
1129        default: return super.getTypesForProperty(hash, name);
1130        }
1131
1132      }
1133
1134      @Override
1135      public Base addChild(String name) throws FHIRException {
1136        if (name.equals("daysOfWeek")) {
1137          throw new FHIRException("Cannot call addChild on a primitive type Location.daysOfWeek");
1138        }
1139        else if (name.equals("allDay")) {
1140          throw new FHIRException("Cannot call addChild on a primitive type Location.allDay");
1141        }
1142        else if (name.equals("openingTime")) {
1143          throw new FHIRException("Cannot call addChild on a primitive type Location.openingTime");
1144        }
1145        else if (name.equals("closingTime")) {
1146          throw new FHIRException("Cannot call addChild on a primitive type Location.closingTime");
1147        }
1148        else
1149          return super.addChild(name);
1150      }
1151
1152      public LocationHoursOfOperationComponent copy() {
1153        LocationHoursOfOperationComponent dst = new LocationHoursOfOperationComponent();
1154        copyValues(dst);
1155        if (daysOfWeek != null) {
1156          dst.daysOfWeek = new ArrayList<Enumeration<DaysOfWeek>>();
1157          for (Enumeration<DaysOfWeek> i : daysOfWeek)
1158            dst.daysOfWeek.add(i.copy());
1159        };
1160        dst.allDay = allDay == null ? null : allDay.copy();
1161        dst.openingTime = openingTime == null ? null : openingTime.copy();
1162        dst.closingTime = closingTime == null ? null : closingTime.copy();
1163        return dst;
1164      }
1165
1166      @Override
1167      public boolean equalsDeep(Base other_) {
1168        if (!super.equalsDeep(other_))
1169          return false;
1170        if (!(other_ instanceof LocationHoursOfOperationComponent))
1171          return false;
1172        LocationHoursOfOperationComponent o = (LocationHoursOfOperationComponent) other_;
1173        return compareDeep(daysOfWeek, o.daysOfWeek, true) && compareDeep(allDay, o.allDay, true) && compareDeep(openingTime, o.openingTime, true)
1174           && compareDeep(closingTime, o.closingTime, true);
1175      }
1176
1177      @Override
1178      public boolean equalsShallow(Base other_) {
1179        if (!super.equalsShallow(other_))
1180          return false;
1181        if (!(other_ instanceof LocationHoursOfOperationComponent))
1182          return false;
1183        LocationHoursOfOperationComponent o = (LocationHoursOfOperationComponent) other_;
1184        return compareValues(daysOfWeek, o.daysOfWeek, true) && compareValues(allDay, o.allDay, true) && compareValues(openingTime, o.openingTime, true)
1185           && compareValues(closingTime, o.closingTime, true);
1186      }
1187
1188      public boolean isEmpty() {
1189        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(daysOfWeek, allDay, openingTime
1190          , closingTime);
1191      }
1192
1193  public String fhirType() {
1194    return "Location.hoursOfOperation";
1195
1196  }
1197
1198  }
1199
1200    /**
1201     * Unique code or number identifying the location to its users.
1202     */
1203    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1204    @Description(shortDefinition="Unique code or number identifying the location to its users", formalDefinition="Unique code or number identifying the location to its users." )
1205    protected List<Identifier> identifier;
1206
1207    /**
1208     * The status property covers the general availability of the resource, not the current value which may be covered by the operationStatus, or by a schedule/slots if they are configured for the location.
1209     */
1210    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
1211    @Description(shortDefinition="active | suspended | inactive", formalDefinition="The status property covers the general availability of the resource, not the current value which may be covered by the operationStatus, or by a schedule/slots if they are configured for the location." )
1212    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/location-status")
1213    protected Enumeration<LocationStatus> status;
1214
1215    /**
1216     * The Operational status covers operation values most relevant to beds (but can also apply to rooms/units/chair/etc. such as an isolation unit/dialysis chair). This typically covers concepts such as contamination, housekeeping and other activities like maintenance.
1217     */
1218    @Child(name = "operationalStatus", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
1219    @Description(shortDefinition="The Operational status of the location (typically only for a bed/room)", formalDefinition="The Operational status covers operation values most relevant to beds (but can also apply to rooms/units/chair/etc. such as an isolation unit/dialysis chair). This typically covers concepts such as contamination, housekeeping and other activities like maintenance." )
1220    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v2-0116")
1221    protected Coding operationalStatus;
1222
1223    /**
1224     * Name of the location as used by humans. Does not need to be unique.
1225     */
1226    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1227    @Description(shortDefinition="Name of the location as used by humans", formalDefinition="Name of the location as used by humans. Does not need to be unique." )
1228    protected StringType name;
1229
1230    /**
1231     * A list of alternate names that the location is known as or was known as in the past.
1232     */
1233    @Child(name = "alias", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1234    @Description(shortDefinition="A list of alternate names that the location is known as or was known as in the past", formalDefinition="A list of alternate names that the location is known as or was known as in the past." )
1235    protected List<StringType> alias;
1236
1237    /**
1238     * Description of the Location, which helps in finding or referencing the place.
1239     */
1240    @Child(name = "description", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
1241    @Description(shortDefinition="Additional details about the location that could be displayed as further information to identify the location beyond its name", formalDefinition="Description of the Location, which helps in finding or referencing the place." )
1242    protected StringType description;
1243
1244    /**
1245     * Indicates whether a resource instance represents a specific location or a class of locations.
1246     */
1247    @Child(name = "mode", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
1248    @Description(shortDefinition="instance | kind", formalDefinition="Indicates whether a resource instance represents a specific location or a class of locations." )
1249    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/location-mode")
1250    protected Enumeration<LocationMode> mode;
1251
1252    /**
1253     * Indicates the type of function performed at the location.
1254     */
1255    @Child(name = "type", type = {CodeableConcept.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1256    @Description(shortDefinition="Type of function performed", formalDefinition="Indicates the type of function performed at the location." )
1257    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/v3-ServiceDeliveryLocationRoleType")
1258    protected List<CodeableConcept> type;
1259
1260    /**
1261     * The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.
1262     */
1263    @Child(name = "telecom", type = {ContactPoint.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1264    @Description(shortDefinition="Contact details of the location", formalDefinition="The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites." )
1265    protected List<ContactPoint> telecom;
1266
1267    /**
1268     * Physical location.
1269     */
1270    @Child(name = "address", type = {Address.class}, order=9, min=0, max=1, modifier=false, summary=false)
1271    @Description(shortDefinition="Physical location", formalDefinition="Physical location." )
1272    protected Address address;
1273
1274    /**
1275     * Physical form of the location, e.g. building, room, vehicle, road.
1276     */
1277    @Child(name = "physicalType", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=true)
1278    @Description(shortDefinition="Physical form of the location", formalDefinition="Physical form of the location, e.g. building, room, vehicle, road." )
1279    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/location-physical-type")
1280    protected CodeableConcept physicalType;
1281
1282    /**
1283     * The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML).
1284     */
1285    @Child(name = "position", type = {}, order=11, min=0, max=1, modifier=false, summary=false)
1286    @Description(shortDefinition="The absolute geographic location", formalDefinition="The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML)." )
1287    protected LocationPositionComponent position;
1288
1289    /**
1290     * The organization responsible for the provisioning and upkeep of the location.
1291     */
1292    @Child(name = "managingOrganization", type = {Organization.class}, order=12, min=0, max=1, modifier=false, summary=true)
1293    @Description(shortDefinition="Organization responsible for provisioning and upkeep", formalDefinition="The organization responsible for the provisioning and upkeep of the location." )
1294    protected Reference managingOrganization;
1295
1296    /**
1297     * The actual object that is the target of the reference (The organization responsible for the provisioning and upkeep of the location.)
1298     */
1299    protected Organization managingOrganizationTarget;
1300
1301    /**
1302     * Another Location which this Location is physically part of.
1303     */
1304    @Child(name = "partOf", type = {Location.class}, order=13, min=0, max=1, modifier=false, summary=false)
1305    @Description(shortDefinition="Another Location this one is physically part of", formalDefinition="Another Location which this Location is physically part of." )
1306    protected Reference partOf;
1307
1308    /**
1309     * The actual object that is the target of the reference (Another Location which this Location is physically part of.)
1310     */
1311    protected Location partOfTarget;
1312
1313    /**
1314     * What days/times during a week is this location usually open.
1315     */
1316    @Child(name = "hoursOfOperation", type = {}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1317    @Description(shortDefinition="What days/times during a week is this location usually open", formalDefinition="What days/times during a week is this location usually open." )
1318    protected List<LocationHoursOfOperationComponent> hoursOfOperation;
1319
1320    /**
1321     * A description of when the locations opening ours are different to normal, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as detailed in the opening hours Times.
1322     */
1323    @Child(name = "availabilityExceptions", type = {StringType.class}, order=15, min=0, max=1, modifier=false, summary=false)
1324    @Description(shortDefinition="Description of availability exceptions", formalDefinition="A description of when the locations opening ours are different to normal, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as detailed in the opening hours Times." )
1325    protected StringType availabilityExceptions;
1326
1327    /**
1328     * Technical endpoints providing access to services operated for the location.
1329     */
1330    @Child(name = "endpoint", type = {Endpoint.class}, order=16, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1331    @Description(shortDefinition="Technical endpoints providing access to services operated for the location", formalDefinition="Technical endpoints providing access to services operated for the location." )
1332    protected List<Reference> endpoint;
1333    /**
1334     * The actual objects that are the target of the reference (Technical endpoints providing access to services operated for the location.)
1335     */
1336    protected List<Endpoint> endpointTarget;
1337
1338
1339    private static final long serialVersionUID = -2126621333L;
1340
1341  /**
1342   * Constructor
1343   */
1344    public Location() {
1345      super();
1346    }
1347
1348    /**
1349     * @return {@link #identifier} (Unique code or number identifying the location to its users.)
1350     */
1351    public List<Identifier> getIdentifier() { 
1352      if (this.identifier == null)
1353        this.identifier = new ArrayList<Identifier>();
1354      return this.identifier;
1355    }
1356
1357    /**
1358     * @return Returns a reference to <code>this</code> for easy method chaining
1359     */
1360    public Location setIdentifier(List<Identifier> theIdentifier) { 
1361      this.identifier = theIdentifier;
1362      return this;
1363    }
1364
1365    public boolean hasIdentifier() { 
1366      if (this.identifier == null)
1367        return false;
1368      for (Identifier item : this.identifier)
1369        if (!item.isEmpty())
1370          return true;
1371      return false;
1372    }
1373
1374    public Identifier addIdentifier() { //3
1375      Identifier t = new Identifier();
1376      if (this.identifier == null)
1377        this.identifier = new ArrayList<Identifier>();
1378      this.identifier.add(t);
1379      return t;
1380    }
1381
1382    public Location addIdentifier(Identifier t) { //3
1383      if (t == null)
1384        return this;
1385      if (this.identifier == null)
1386        this.identifier = new ArrayList<Identifier>();
1387      this.identifier.add(t);
1388      return this;
1389    }
1390
1391    /**
1392     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
1393     */
1394    public Identifier getIdentifierFirstRep() { 
1395      if (getIdentifier().isEmpty()) {
1396        addIdentifier();
1397      }
1398      return getIdentifier().get(0);
1399    }
1400
1401    /**
1402     * @return {@link #status} (The status property covers the general availability of the resource, not the current value which may be covered by the operationStatus, or by a schedule/slots if they are configured for the location.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1403     */
1404    public Enumeration<LocationStatus> getStatusElement() { 
1405      if (this.status == null)
1406        if (Configuration.errorOnAutoCreate())
1407          throw new Error("Attempt to auto-create Location.status");
1408        else if (Configuration.doAutoCreate())
1409          this.status = new Enumeration<LocationStatus>(new LocationStatusEnumFactory()); // bb
1410      return this.status;
1411    }
1412
1413    public boolean hasStatusElement() { 
1414      return this.status != null && !this.status.isEmpty();
1415    }
1416
1417    public boolean hasStatus() { 
1418      return this.status != null && !this.status.isEmpty();
1419    }
1420
1421    /**
1422     * @param value {@link #status} (The status property covers the general availability of the resource, not the current value which may be covered by the operationStatus, or by a schedule/slots if they are configured for the location.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1423     */
1424    public Location setStatusElement(Enumeration<LocationStatus> value) { 
1425      this.status = value;
1426      return this;
1427    }
1428
1429    /**
1430     * @return The status property covers the general availability of the resource, not the current value which may be covered by the operationStatus, or by a schedule/slots if they are configured for the location.
1431     */
1432    public LocationStatus getStatus() { 
1433      return this.status == null ? null : this.status.getValue();
1434    }
1435
1436    /**
1437     * @param value The status property covers the general availability of the resource, not the current value which may be covered by the operationStatus, or by a schedule/slots if they are configured for the location.
1438     */
1439    public Location setStatus(LocationStatus value) { 
1440      if (value == null)
1441        this.status = null;
1442      else {
1443        if (this.status == null)
1444          this.status = new Enumeration<LocationStatus>(new LocationStatusEnumFactory());
1445        this.status.setValue(value);
1446      }
1447      return this;
1448    }
1449
1450    /**
1451     * @return {@link #operationalStatus} (The Operational status covers operation values most relevant to beds (but can also apply to rooms/units/chair/etc. such as an isolation unit/dialysis chair). This typically covers concepts such as contamination, housekeeping and other activities like maintenance.)
1452     */
1453    public Coding getOperationalStatus() { 
1454      if (this.operationalStatus == null)
1455        if (Configuration.errorOnAutoCreate())
1456          throw new Error("Attempt to auto-create Location.operationalStatus");
1457        else if (Configuration.doAutoCreate())
1458          this.operationalStatus = new Coding(); // cc
1459      return this.operationalStatus;
1460    }
1461
1462    public boolean hasOperationalStatus() { 
1463      return this.operationalStatus != null && !this.operationalStatus.isEmpty();
1464    }
1465
1466    /**
1467     * @param value {@link #operationalStatus} (The Operational status covers operation values most relevant to beds (but can also apply to rooms/units/chair/etc. such as an isolation unit/dialysis chair). This typically covers concepts such as contamination, housekeeping and other activities like maintenance.)
1468     */
1469    public Location setOperationalStatus(Coding value) { 
1470      this.operationalStatus = value;
1471      return this;
1472    }
1473
1474    /**
1475     * @return {@link #name} (Name of the location as used by humans. Does not need to be unique.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1476     */
1477    public StringType getNameElement() { 
1478      if (this.name == null)
1479        if (Configuration.errorOnAutoCreate())
1480          throw new Error("Attempt to auto-create Location.name");
1481        else if (Configuration.doAutoCreate())
1482          this.name = new StringType(); // bb
1483      return this.name;
1484    }
1485
1486    public boolean hasNameElement() { 
1487      return this.name != null && !this.name.isEmpty();
1488    }
1489
1490    public boolean hasName() { 
1491      return this.name != null && !this.name.isEmpty();
1492    }
1493
1494    /**
1495     * @param value {@link #name} (Name of the location as used by humans. Does not need to be unique.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1496     */
1497    public Location setNameElement(StringType value) { 
1498      this.name = value;
1499      return this;
1500    }
1501
1502    /**
1503     * @return Name of the location as used by humans. Does not need to be unique.
1504     */
1505    public String getName() { 
1506      return this.name == null ? null : this.name.getValue();
1507    }
1508
1509    /**
1510     * @param value Name of the location as used by humans. Does not need to be unique.
1511     */
1512    public Location setName(String value) { 
1513      if (Utilities.noString(value))
1514        this.name = null;
1515      else {
1516        if (this.name == null)
1517          this.name = new StringType();
1518        this.name.setValue(value);
1519      }
1520      return this;
1521    }
1522
1523    /**
1524     * @return {@link #alias} (A list of alternate names that the location is known as or was known as in the past.)
1525     */
1526    public List<StringType> getAlias() { 
1527      if (this.alias == null)
1528        this.alias = new ArrayList<StringType>();
1529      return this.alias;
1530    }
1531
1532    /**
1533     * @return Returns a reference to <code>this</code> for easy method chaining
1534     */
1535    public Location setAlias(List<StringType> theAlias) { 
1536      this.alias = theAlias;
1537      return this;
1538    }
1539
1540    public boolean hasAlias() { 
1541      if (this.alias == null)
1542        return false;
1543      for (StringType item : this.alias)
1544        if (!item.isEmpty())
1545          return true;
1546      return false;
1547    }
1548
1549    /**
1550     * @return {@link #alias} (A list of alternate names that the location is known as or was known as in the past.)
1551     */
1552    public StringType addAliasElement() {//2 
1553      StringType t = new StringType();
1554      if (this.alias == null)
1555        this.alias = new ArrayList<StringType>();
1556      this.alias.add(t);
1557      return t;
1558    }
1559
1560    /**
1561     * @param value {@link #alias} (A list of alternate names that the location is known as or was known as in the past.)
1562     */
1563    public Location addAlias(String value) { //1
1564      StringType t = new StringType();
1565      t.setValue(value);
1566      if (this.alias == null)
1567        this.alias = new ArrayList<StringType>();
1568      this.alias.add(t);
1569      return this;
1570    }
1571
1572    /**
1573     * @param value {@link #alias} (A list of alternate names that the location is known as or was known as in the past.)
1574     */
1575    public boolean hasAlias(String value) { 
1576      if (this.alias == null)
1577        return false;
1578      for (StringType v : this.alias)
1579        if (v.getValue().equals(value)) // string
1580          return true;
1581      return false;
1582    }
1583
1584    /**
1585     * @return {@link #description} (Description of the Location, which helps in finding or referencing the place.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1586     */
1587    public StringType getDescriptionElement() { 
1588      if (this.description == null)
1589        if (Configuration.errorOnAutoCreate())
1590          throw new Error("Attempt to auto-create Location.description");
1591        else if (Configuration.doAutoCreate())
1592          this.description = new StringType(); // bb
1593      return this.description;
1594    }
1595
1596    public boolean hasDescriptionElement() { 
1597      return this.description != null && !this.description.isEmpty();
1598    }
1599
1600    public boolean hasDescription() { 
1601      return this.description != null && !this.description.isEmpty();
1602    }
1603
1604    /**
1605     * @param value {@link #description} (Description of the Location, which helps in finding or referencing the place.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1606     */
1607    public Location setDescriptionElement(StringType value) { 
1608      this.description = value;
1609      return this;
1610    }
1611
1612    /**
1613     * @return Description of the Location, which helps in finding or referencing the place.
1614     */
1615    public String getDescription() { 
1616      return this.description == null ? null : this.description.getValue();
1617    }
1618
1619    /**
1620     * @param value Description of the Location, which helps in finding or referencing the place.
1621     */
1622    public Location setDescription(String value) { 
1623      if (Utilities.noString(value))
1624        this.description = null;
1625      else {
1626        if (this.description == null)
1627          this.description = new StringType();
1628        this.description.setValue(value);
1629      }
1630      return this;
1631    }
1632
1633    /**
1634     * @return {@link #mode} (Indicates whether a resource instance represents a specific location or a class of locations.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
1635     */
1636    public Enumeration<LocationMode> getModeElement() { 
1637      if (this.mode == null)
1638        if (Configuration.errorOnAutoCreate())
1639          throw new Error("Attempt to auto-create Location.mode");
1640        else if (Configuration.doAutoCreate())
1641          this.mode = new Enumeration<LocationMode>(new LocationModeEnumFactory()); // bb
1642      return this.mode;
1643    }
1644
1645    public boolean hasModeElement() { 
1646      return this.mode != null && !this.mode.isEmpty();
1647    }
1648
1649    public boolean hasMode() { 
1650      return this.mode != null && !this.mode.isEmpty();
1651    }
1652
1653    /**
1654     * @param value {@link #mode} (Indicates whether a resource instance represents a specific location or a class of locations.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
1655     */
1656    public Location setModeElement(Enumeration<LocationMode> value) { 
1657      this.mode = value;
1658      return this;
1659    }
1660
1661    /**
1662     * @return Indicates whether a resource instance represents a specific location or a class of locations.
1663     */
1664    public LocationMode getMode() { 
1665      return this.mode == null ? null : this.mode.getValue();
1666    }
1667
1668    /**
1669     * @param value Indicates whether a resource instance represents a specific location or a class of locations.
1670     */
1671    public Location setMode(LocationMode value) { 
1672      if (value == null)
1673        this.mode = null;
1674      else {
1675        if (this.mode == null)
1676          this.mode = new Enumeration<LocationMode>(new LocationModeEnumFactory());
1677        this.mode.setValue(value);
1678      }
1679      return this;
1680    }
1681
1682    /**
1683     * @return {@link #type} (Indicates the type of function performed at the location.)
1684     */
1685    public List<CodeableConcept> getType() { 
1686      if (this.type == null)
1687        this.type = new ArrayList<CodeableConcept>();
1688      return this.type;
1689    }
1690
1691    /**
1692     * @return Returns a reference to <code>this</code> for easy method chaining
1693     */
1694    public Location setType(List<CodeableConcept> theType) { 
1695      this.type = theType;
1696      return this;
1697    }
1698
1699    public boolean hasType() { 
1700      if (this.type == null)
1701        return false;
1702      for (CodeableConcept item : this.type)
1703        if (!item.isEmpty())
1704          return true;
1705      return false;
1706    }
1707
1708    public CodeableConcept addType() { //3
1709      CodeableConcept t = new CodeableConcept();
1710      if (this.type == null)
1711        this.type = new ArrayList<CodeableConcept>();
1712      this.type.add(t);
1713      return t;
1714    }
1715
1716    public Location addType(CodeableConcept t) { //3
1717      if (t == null)
1718        return this;
1719      if (this.type == null)
1720        this.type = new ArrayList<CodeableConcept>();
1721      this.type.add(t);
1722      return this;
1723    }
1724
1725    /**
1726     * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
1727     */
1728    public CodeableConcept getTypeFirstRep() { 
1729      if (getType().isEmpty()) {
1730        addType();
1731      }
1732      return getType().get(0);
1733    }
1734
1735    /**
1736     * @return {@link #telecom} (The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.)
1737     */
1738    public List<ContactPoint> getTelecom() { 
1739      if (this.telecom == null)
1740        this.telecom = new ArrayList<ContactPoint>();
1741      return this.telecom;
1742    }
1743
1744    /**
1745     * @return Returns a reference to <code>this</code> for easy method chaining
1746     */
1747    public Location setTelecom(List<ContactPoint> theTelecom) { 
1748      this.telecom = theTelecom;
1749      return this;
1750    }
1751
1752    public boolean hasTelecom() { 
1753      if (this.telecom == null)
1754        return false;
1755      for (ContactPoint item : this.telecom)
1756        if (!item.isEmpty())
1757          return true;
1758      return false;
1759    }
1760
1761    public ContactPoint addTelecom() { //3
1762      ContactPoint t = new ContactPoint();
1763      if (this.telecom == null)
1764        this.telecom = new ArrayList<ContactPoint>();
1765      this.telecom.add(t);
1766      return t;
1767    }
1768
1769    public Location addTelecom(ContactPoint t) { //3
1770      if (t == null)
1771        return this;
1772      if (this.telecom == null)
1773        this.telecom = new ArrayList<ContactPoint>();
1774      this.telecom.add(t);
1775      return this;
1776    }
1777
1778    /**
1779     * @return The first repetition of repeating field {@link #telecom}, creating it if it does not already exist
1780     */
1781    public ContactPoint getTelecomFirstRep() { 
1782      if (getTelecom().isEmpty()) {
1783        addTelecom();
1784      }
1785      return getTelecom().get(0);
1786    }
1787
1788    /**
1789     * @return {@link #address} (Physical location.)
1790     */
1791    public Address getAddress() { 
1792      if (this.address == null)
1793        if (Configuration.errorOnAutoCreate())
1794          throw new Error("Attempt to auto-create Location.address");
1795        else if (Configuration.doAutoCreate())
1796          this.address = new Address(); // cc
1797      return this.address;
1798    }
1799
1800    public boolean hasAddress() { 
1801      return this.address != null && !this.address.isEmpty();
1802    }
1803
1804    /**
1805     * @param value {@link #address} (Physical location.)
1806     */
1807    public Location setAddress(Address value) { 
1808      this.address = value;
1809      return this;
1810    }
1811
1812    /**
1813     * @return {@link #physicalType} (Physical form of the location, e.g. building, room, vehicle, road.)
1814     */
1815    public CodeableConcept getPhysicalType() { 
1816      if (this.physicalType == null)
1817        if (Configuration.errorOnAutoCreate())
1818          throw new Error("Attempt to auto-create Location.physicalType");
1819        else if (Configuration.doAutoCreate())
1820          this.physicalType = new CodeableConcept(); // cc
1821      return this.physicalType;
1822    }
1823
1824    public boolean hasPhysicalType() { 
1825      return this.physicalType != null && !this.physicalType.isEmpty();
1826    }
1827
1828    /**
1829     * @param value {@link #physicalType} (Physical form of the location, e.g. building, room, vehicle, road.)
1830     */
1831    public Location setPhysicalType(CodeableConcept value) { 
1832      this.physicalType = value;
1833      return this;
1834    }
1835
1836    /**
1837     * @return {@link #position} (The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML).)
1838     */
1839    public LocationPositionComponent getPosition() { 
1840      if (this.position == null)
1841        if (Configuration.errorOnAutoCreate())
1842          throw new Error("Attempt to auto-create Location.position");
1843        else if (Configuration.doAutoCreate())
1844          this.position = new LocationPositionComponent(); // cc
1845      return this.position;
1846    }
1847
1848    public boolean hasPosition() { 
1849      return this.position != null && !this.position.isEmpty();
1850    }
1851
1852    /**
1853     * @param value {@link #position} (The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML).)
1854     */
1855    public Location setPosition(LocationPositionComponent value) { 
1856      this.position = value;
1857      return this;
1858    }
1859
1860    /**
1861     * @return {@link #managingOrganization} (The organization responsible for the provisioning and upkeep of the location.)
1862     */
1863    public Reference getManagingOrganization() { 
1864      if (this.managingOrganization == null)
1865        if (Configuration.errorOnAutoCreate())
1866          throw new Error("Attempt to auto-create Location.managingOrganization");
1867        else if (Configuration.doAutoCreate())
1868          this.managingOrganization = new Reference(); // cc
1869      return this.managingOrganization;
1870    }
1871
1872    public boolean hasManagingOrganization() { 
1873      return this.managingOrganization != null && !this.managingOrganization.isEmpty();
1874    }
1875
1876    /**
1877     * @param value {@link #managingOrganization} (The organization responsible for the provisioning and upkeep of the location.)
1878     */
1879    public Location setManagingOrganization(Reference value) { 
1880      this.managingOrganization = value;
1881      return this;
1882    }
1883
1884    /**
1885     * @return {@link #managingOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization responsible for the provisioning and upkeep of the location.)
1886     */
1887    public Organization getManagingOrganizationTarget() { 
1888      if (this.managingOrganizationTarget == null)
1889        if (Configuration.errorOnAutoCreate())
1890          throw new Error("Attempt to auto-create Location.managingOrganization");
1891        else if (Configuration.doAutoCreate())
1892          this.managingOrganizationTarget = new Organization(); // aa
1893      return this.managingOrganizationTarget;
1894    }
1895
1896    /**
1897     * @param value {@link #managingOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization responsible for the provisioning and upkeep of the location.)
1898     */
1899    public Location setManagingOrganizationTarget(Organization value) { 
1900      this.managingOrganizationTarget = value;
1901      return this;
1902    }
1903
1904    /**
1905     * @return {@link #partOf} (Another Location which this Location is physically part of.)
1906     */
1907    public Reference getPartOf() { 
1908      if (this.partOf == null)
1909        if (Configuration.errorOnAutoCreate())
1910          throw new Error("Attempt to auto-create Location.partOf");
1911        else if (Configuration.doAutoCreate())
1912          this.partOf = new Reference(); // cc
1913      return this.partOf;
1914    }
1915
1916    public boolean hasPartOf() { 
1917      return this.partOf != null && !this.partOf.isEmpty();
1918    }
1919
1920    /**
1921     * @param value {@link #partOf} (Another Location which this Location is physically part of.)
1922     */
1923    public Location setPartOf(Reference value) { 
1924      this.partOf = value;
1925      return this;
1926    }
1927
1928    /**
1929     * @return {@link #partOf} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Another Location which this Location is physically part of.)
1930     */
1931    public Location getPartOfTarget() { 
1932      if (this.partOfTarget == null)
1933        if (Configuration.errorOnAutoCreate())
1934          throw new Error("Attempt to auto-create Location.partOf");
1935        else if (Configuration.doAutoCreate())
1936          this.partOfTarget = new Location(); // aa
1937      return this.partOfTarget;
1938    }
1939
1940    /**
1941     * @param value {@link #partOf} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Another Location which this Location is physically part of.)
1942     */
1943    public Location setPartOfTarget(Location value) { 
1944      this.partOfTarget = value;
1945      return this;
1946    }
1947
1948    /**
1949     * @return {@link #hoursOfOperation} (What days/times during a week is this location usually open.)
1950     */
1951    public List<LocationHoursOfOperationComponent> getHoursOfOperation() { 
1952      if (this.hoursOfOperation == null)
1953        this.hoursOfOperation = new ArrayList<LocationHoursOfOperationComponent>();
1954      return this.hoursOfOperation;
1955    }
1956
1957    /**
1958     * @return Returns a reference to <code>this</code> for easy method chaining
1959     */
1960    public Location setHoursOfOperation(List<LocationHoursOfOperationComponent> theHoursOfOperation) { 
1961      this.hoursOfOperation = theHoursOfOperation;
1962      return this;
1963    }
1964
1965    public boolean hasHoursOfOperation() { 
1966      if (this.hoursOfOperation == null)
1967        return false;
1968      for (LocationHoursOfOperationComponent item : this.hoursOfOperation)
1969        if (!item.isEmpty())
1970          return true;
1971      return false;
1972    }
1973
1974    public LocationHoursOfOperationComponent addHoursOfOperation() { //3
1975      LocationHoursOfOperationComponent t = new LocationHoursOfOperationComponent();
1976      if (this.hoursOfOperation == null)
1977        this.hoursOfOperation = new ArrayList<LocationHoursOfOperationComponent>();
1978      this.hoursOfOperation.add(t);
1979      return t;
1980    }
1981
1982    public Location addHoursOfOperation(LocationHoursOfOperationComponent t) { //3
1983      if (t == null)
1984        return this;
1985      if (this.hoursOfOperation == null)
1986        this.hoursOfOperation = new ArrayList<LocationHoursOfOperationComponent>();
1987      this.hoursOfOperation.add(t);
1988      return this;
1989    }
1990
1991    /**
1992     * @return The first repetition of repeating field {@link #hoursOfOperation}, creating it if it does not already exist
1993     */
1994    public LocationHoursOfOperationComponent getHoursOfOperationFirstRep() { 
1995      if (getHoursOfOperation().isEmpty()) {
1996        addHoursOfOperation();
1997      }
1998      return getHoursOfOperation().get(0);
1999    }
2000
2001    /**
2002     * @return {@link #availabilityExceptions} (A description of when the locations opening ours are different to normal, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as detailed in the opening hours Times.). This is the underlying object with id, value and extensions. The accessor "getAvailabilityExceptions" gives direct access to the value
2003     */
2004    public StringType getAvailabilityExceptionsElement() { 
2005      if (this.availabilityExceptions == null)
2006        if (Configuration.errorOnAutoCreate())
2007          throw new Error("Attempt to auto-create Location.availabilityExceptions");
2008        else if (Configuration.doAutoCreate())
2009          this.availabilityExceptions = new StringType(); // bb
2010      return this.availabilityExceptions;
2011    }
2012
2013    public boolean hasAvailabilityExceptionsElement() { 
2014      return this.availabilityExceptions != null && !this.availabilityExceptions.isEmpty();
2015    }
2016
2017    public boolean hasAvailabilityExceptions() { 
2018      return this.availabilityExceptions != null && !this.availabilityExceptions.isEmpty();
2019    }
2020
2021    /**
2022     * @param value {@link #availabilityExceptions} (A description of when the locations opening ours are different to normal, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as detailed in the opening hours Times.). This is the underlying object with id, value and extensions. The accessor "getAvailabilityExceptions" gives direct access to the value
2023     */
2024    public Location setAvailabilityExceptionsElement(StringType value) { 
2025      this.availabilityExceptions = value;
2026      return this;
2027    }
2028
2029    /**
2030     * @return A description of when the locations opening ours are different to normal, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as detailed in the opening hours Times.
2031     */
2032    public String getAvailabilityExceptions() { 
2033      return this.availabilityExceptions == null ? null : this.availabilityExceptions.getValue();
2034    }
2035
2036    /**
2037     * @param value A description of when the locations opening ours are different to normal, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as detailed in the opening hours Times.
2038     */
2039    public Location setAvailabilityExceptions(String value) { 
2040      if (Utilities.noString(value))
2041        this.availabilityExceptions = null;
2042      else {
2043        if (this.availabilityExceptions == null)
2044          this.availabilityExceptions = new StringType();
2045        this.availabilityExceptions.setValue(value);
2046      }
2047      return this;
2048    }
2049
2050    /**
2051     * @return {@link #endpoint} (Technical endpoints providing access to services operated for the location.)
2052     */
2053    public List<Reference> getEndpoint() { 
2054      if (this.endpoint == null)
2055        this.endpoint = new ArrayList<Reference>();
2056      return this.endpoint;
2057    }
2058
2059    /**
2060     * @return Returns a reference to <code>this</code> for easy method chaining
2061     */
2062    public Location setEndpoint(List<Reference> theEndpoint) { 
2063      this.endpoint = theEndpoint;
2064      return this;
2065    }
2066
2067    public boolean hasEndpoint() { 
2068      if (this.endpoint == null)
2069        return false;
2070      for (Reference item : this.endpoint)
2071        if (!item.isEmpty())
2072          return true;
2073      return false;
2074    }
2075
2076    public Reference addEndpoint() { //3
2077      Reference t = new Reference();
2078      if (this.endpoint == null)
2079        this.endpoint = new ArrayList<Reference>();
2080      this.endpoint.add(t);
2081      return t;
2082    }
2083
2084    public Location addEndpoint(Reference t) { //3
2085      if (t == null)
2086        return this;
2087      if (this.endpoint == null)
2088        this.endpoint = new ArrayList<Reference>();
2089      this.endpoint.add(t);
2090      return this;
2091    }
2092
2093    /**
2094     * @return The first repetition of repeating field {@link #endpoint}, creating it if it does not already exist
2095     */
2096    public Reference getEndpointFirstRep() { 
2097      if (getEndpoint().isEmpty()) {
2098        addEndpoint();
2099      }
2100      return getEndpoint().get(0);
2101    }
2102
2103    /**
2104     * @deprecated Use Reference#setResource(IBaseResource) instead
2105     */
2106    @Deprecated
2107    public List<Endpoint> getEndpointTarget() { 
2108      if (this.endpointTarget == null)
2109        this.endpointTarget = new ArrayList<Endpoint>();
2110      return this.endpointTarget;
2111    }
2112
2113    /**
2114     * @deprecated Use Reference#setResource(IBaseResource) instead
2115     */
2116    @Deprecated
2117    public Endpoint addEndpointTarget() { 
2118      Endpoint r = new Endpoint();
2119      if (this.endpointTarget == null)
2120        this.endpointTarget = new ArrayList<Endpoint>();
2121      this.endpointTarget.add(r);
2122      return r;
2123    }
2124
2125      protected void listChildren(List<Property> children) {
2126        super.listChildren(children);
2127        children.add(new Property("identifier", "Identifier", "Unique code or number identifying the location to its users.", 0, java.lang.Integer.MAX_VALUE, identifier));
2128        children.add(new Property("status", "code", "The status property covers the general availability of the resource, not the current value which may be covered by the operationStatus, or by a schedule/slots if they are configured for the location.", 0, 1, status));
2129        children.add(new Property("operationalStatus", "Coding", "The Operational status covers operation values most relevant to beds (but can also apply to rooms/units/chair/etc. such as an isolation unit/dialysis chair). This typically covers concepts such as contamination, housekeeping and other activities like maintenance.", 0, 1, operationalStatus));
2130        children.add(new Property("name", "string", "Name of the location as used by humans. Does not need to be unique.", 0, 1, name));
2131        children.add(new Property("alias", "string", "A list of alternate names that the location is known as or was known as in the past.", 0, java.lang.Integer.MAX_VALUE, alias));
2132        children.add(new Property("description", "string", "Description of the Location, which helps in finding or referencing the place.", 0, 1, description));
2133        children.add(new Property("mode", "code", "Indicates whether a resource instance represents a specific location or a class of locations.", 0, 1, mode));
2134        children.add(new Property("type", "CodeableConcept", "Indicates the type of function performed at the location.", 0, java.lang.Integer.MAX_VALUE, type));
2135        children.add(new Property("telecom", "ContactPoint", "The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.", 0, java.lang.Integer.MAX_VALUE, telecom));
2136        children.add(new Property("address", "Address", "Physical location.", 0, 1, address));
2137        children.add(new Property("physicalType", "CodeableConcept", "Physical form of the location, e.g. building, room, vehicle, road.", 0, 1, physicalType));
2138        children.add(new Property("position", "", "The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML).", 0, 1, position));
2139        children.add(new Property("managingOrganization", "Reference(Organization)", "The organization responsible for the provisioning and upkeep of the location.", 0, 1, managingOrganization));
2140        children.add(new Property("partOf", "Reference(Location)", "Another Location which this Location is physically part of.", 0, 1, partOf));
2141        children.add(new Property("hoursOfOperation", "", "What days/times during a week is this location usually open.", 0, java.lang.Integer.MAX_VALUE, hoursOfOperation));
2142        children.add(new Property("availabilityExceptions", "string", "A description of when the locations opening ours are different to normal, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as detailed in the opening hours Times.", 0, 1, availabilityExceptions));
2143        children.add(new Property("endpoint", "Reference(Endpoint)", "Technical endpoints providing access to services operated for the location.", 0, java.lang.Integer.MAX_VALUE, endpoint));
2144      }
2145
2146      @Override
2147      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2148        switch (_hash) {
2149        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Unique code or number identifying the location to its users.", 0, java.lang.Integer.MAX_VALUE, identifier);
2150        case -892481550: /*status*/  return new Property("status", "code", "The status property covers the general availability of the resource, not the current value which may be covered by the operationStatus, or by a schedule/slots if they are configured for the location.", 0, 1, status);
2151        case -2103166364: /*operationalStatus*/  return new Property("operationalStatus", "Coding", "The Operational status covers operation values most relevant to beds (but can also apply to rooms/units/chair/etc. such as an isolation unit/dialysis chair). This typically covers concepts such as contamination, housekeeping and other activities like maintenance.", 0, 1, operationalStatus);
2152        case 3373707: /*name*/  return new Property("name", "string", "Name of the location as used by humans. Does not need to be unique.", 0, 1, name);
2153        case 92902992: /*alias*/  return new Property("alias", "string", "A list of alternate names that the location is known as or was known as in the past.", 0, java.lang.Integer.MAX_VALUE, alias);
2154        case -1724546052: /*description*/  return new Property("description", "string", "Description of the Location, which helps in finding or referencing the place.", 0, 1, description);
2155        case 3357091: /*mode*/  return new Property("mode", "code", "Indicates whether a resource instance represents a specific location or a class of locations.", 0, 1, mode);
2156        case 3575610: /*type*/  return new Property("type", "CodeableConcept", "Indicates the type of function performed at the location.", 0, java.lang.Integer.MAX_VALUE, type);
2157        case -1429363305: /*telecom*/  return new Property("telecom", "ContactPoint", "The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.", 0, java.lang.Integer.MAX_VALUE, telecom);
2158        case -1147692044: /*address*/  return new Property("address", "Address", "Physical location.", 0, 1, address);
2159        case -1474715471: /*physicalType*/  return new Property("physicalType", "CodeableConcept", "Physical form of the location, e.g. building, room, vehicle, road.", 0, 1, physicalType);
2160        case 747804969: /*position*/  return new Property("position", "", "The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML).", 0, 1, position);
2161        case -2058947787: /*managingOrganization*/  return new Property("managingOrganization", "Reference(Organization)", "The organization responsible for the provisioning and upkeep of the location.", 0, 1, managingOrganization);
2162        case -995410646: /*partOf*/  return new Property("partOf", "Reference(Location)", "Another Location which this Location is physically part of.", 0, 1, partOf);
2163        case -1588872511: /*hoursOfOperation*/  return new Property("hoursOfOperation", "", "What days/times during a week is this location usually open.", 0, java.lang.Integer.MAX_VALUE, hoursOfOperation);
2164        case -1149143617: /*availabilityExceptions*/  return new Property("availabilityExceptions", "string", "A description of when the locations opening ours are different to normal, e.g. public holiday availability. Succinctly describing all possible exceptions to normal site availability as detailed in the opening hours Times.", 0, 1, availabilityExceptions);
2165        case 1741102485: /*endpoint*/  return new Property("endpoint", "Reference(Endpoint)", "Technical endpoints providing access to services operated for the location.", 0, java.lang.Integer.MAX_VALUE, endpoint);
2166        default: return super.getNamedProperty(_hash, _name, _checkValid);
2167        }
2168
2169      }
2170
2171      @Override
2172      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2173        switch (hash) {
2174        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
2175        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<LocationStatus>
2176        case -2103166364: /*operationalStatus*/ return this.operationalStatus == null ? new Base[0] : new Base[] {this.operationalStatus}; // Coding
2177        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2178        case 92902992: /*alias*/ return this.alias == null ? new Base[0] : this.alias.toArray(new Base[this.alias.size()]); // StringType
2179        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
2180        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<LocationMode>
2181        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // CodeableConcept
2182        case -1429363305: /*telecom*/ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
2183        case -1147692044: /*address*/ return this.address == null ? new Base[0] : new Base[] {this.address}; // Address
2184        case -1474715471: /*physicalType*/ return this.physicalType == null ? new Base[0] : new Base[] {this.physicalType}; // CodeableConcept
2185        case 747804969: /*position*/ return this.position == null ? new Base[0] : new Base[] {this.position}; // LocationPositionComponent
2186        case -2058947787: /*managingOrganization*/ return this.managingOrganization == null ? new Base[0] : new Base[] {this.managingOrganization}; // Reference
2187        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : new Base[] {this.partOf}; // Reference
2188        case -1588872511: /*hoursOfOperation*/ return this.hoursOfOperation == null ? new Base[0] : this.hoursOfOperation.toArray(new Base[this.hoursOfOperation.size()]); // LocationHoursOfOperationComponent
2189        case -1149143617: /*availabilityExceptions*/ return this.availabilityExceptions == null ? new Base[0] : new Base[] {this.availabilityExceptions}; // StringType
2190        case 1741102485: /*endpoint*/ return this.endpoint == null ? new Base[0] : this.endpoint.toArray(new Base[this.endpoint.size()]); // Reference
2191        default: return super.getProperty(hash, name, checkValid);
2192        }
2193
2194      }
2195
2196      @Override
2197      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2198        switch (hash) {
2199        case -1618432855: // identifier
2200          this.getIdentifier().add(castToIdentifier(value)); // Identifier
2201          return value;
2202        case -892481550: // status
2203          value = new LocationStatusEnumFactory().fromType(castToCode(value));
2204          this.status = (Enumeration) value; // Enumeration<LocationStatus>
2205          return value;
2206        case -2103166364: // operationalStatus
2207          this.operationalStatus = castToCoding(value); // Coding
2208          return value;
2209        case 3373707: // name
2210          this.name = castToString(value); // StringType
2211          return value;
2212        case 92902992: // alias
2213          this.getAlias().add(castToString(value)); // StringType
2214          return value;
2215        case -1724546052: // description
2216          this.description = castToString(value); // StringType
2217          return value;
2218        case 3357091: // mode
2219          value = new LocationModeEnumFactory().fromType(castToCode(value));
2220          this.mode = (Enumeration) value; // Enumeration<LocationMode>
2221          return value;
2222        case 3575610: // type
2223          this.getType().add(castToCodeableConcept(value)); // CodeableConcept
2224          return value;
2225        case -1429363305: // telecom
2226          this.getTelecom().add(castToContactPoint(value)); // ContactPoint
2227          return value;
2228        case -1147692044: // address
2229          this.address = castToAddress(value); // Address
2230          return value;
2231        case -1474715471: // physicalType
2232          this.physicalType = castToCodeableConcept(value); // CodeableConcept
2233          return value;
2234        case 747804969: // position
2235          this.position = (LocationPositionComponent) value; // LocationPositionComponent
2236          return value;
2237        case -2058947787: // managingOrganization
2238          this.managingOrganization = castToReference(value); // Reference
2239          return value;
2240        case -995410646: // partOf
2241          this.partOf = castToReference(value); // Reference
2242          return value;
2243        case -1588872511: // hoursOfOperation
2244          this.getHoursOfOperation().add((LocationHoursOfOperationComponent) value); // LocationHoursOfOperationComponent
2245          return value;
2246        case -1149143617: // availabilityExceptions
2247          this.availabilityExceptions = castToString(value); // StringType
2248          return value;
2249        case 1741102485: // endpoint
2250          this.getEndpoint().add(castToReference(value)); // Reference
2251          return value;
2252        default: return super.setProperty(hash, name, value);
2253        }
2254
2255      }
2256
2257      @Override
2258      public Base setProperty(String name, Base value) throws FHIRException {
2259        if (name.equals("identifier")) {
2260          this.getIdentifier().add(castToIdentifier(value));
2261        } else if (name.equals("status")) {
2262          value = new LocationStatusEnumFactory().fromType(castToCode(value));
2263          this.status = (Enumeration) value; // Enumeration<LocationStatus>
2264        } else if (name.equals("operationalStatus")) {
2265          this.operationalStatus = castToCoding(value); // Coding
2266        } else if (name.equals("name")) {
2267          this.name = castToString(value); // StringType
2268        } else if (name.equals("alias")) {
2269          this.getAlias().add(castToString(value));
2270        } else if (name.equals("description")) {
2271          this.description = castToString(value); // StringType
2272        } else if (name.equals("mode")) {
2273          value = new LocationModeEnumFactory().fromType(castToCode(value));
2274          this.mode = (Enumeration) value; // Enumeration<LocationMode>
2275        } else if (name.equals("type")) {
2276          this.getType().add(castToCodeableConcept(value));
2277        } else if (name.equals("telecom")) {
2278          this.getTelecom().add(castToContactPoint(value));
2279        } else if (name.equals("address")) {
2280          this.address = castToAddress(value); // Address
2281        } else if (name.equals("physicalType")) {
2282          this.physicalType = castToCodeableConcept(value); // CodeableConcept
2283        } else if (name.equals("position")) {
2284          this.position = (LocationPositionComponent) value; // LocationPositionComponent
2285        } else if (name.equals("managingOrganization")) {
2286          this.managingOrganization = castToReference(value); // Reference
2287        } else if (name.equals("partOf")) {
2288          this.partOf = castToReference(value); // Reference
2289        } else if (name.equals("hoursOfOperation")) {
2290          this.getHoursOfOperation().add((LocationHoursOfOperationComponent) value);
2291        } else if (name.equals("availabilityExceptions")) {
2292          this.availabilityExceptions = castToString(value); // StringType
2293        } else if (name.equals("endpoint")) {
2294          this.getEndpoint().add(castToReference(value));
2295        } else
2296          return super.setProperty(name, value);
2297        return value;
2298      }
2299
2300      @Override
2301      public Base makeProperty(int hash, String name) throws FHIRException {
2302        switch (hash) {
2303        case -1618432855:  return addIdentifier(); 
2304        case -892481550:  return getStatusElement();
2305        case -2103166364:  return getOperationalStatus(); 
2306        case 3373707:  return getNameElement();
2307        case 92902992:  return addAliasElement();
2308        case -1724546052:  return getDescriptionElement();
2309        case 3357091:  return getModeElement();
2310        case 3575610:  return addType(); 
2311        case -1429363305:  return addTelecom(); 
2312        case -1147692044:  return getAddress(); 
2313        case -1474715471:  return getPhysicalType(); 
2314        case 747804969:  return getPosition(); 
2315        case -2058947787:  return getManagingOrganization(); 
2316        case -995410646:  return getPartOf(); 
2317        case -1588872511:  return addHoursOfOperation(); 
2318        case -1149143617:  return getAvailabilityExceptionsElement();
2319        case 1741102485:  return addEndpoint(); 
2320        default: return super.makeProperty(hash, name);
2321        }
2322
2323      }
2324
2325      @Override
2326      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2327        switch (hash) {
2328        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2329        case -892481550: /*status*/ return new String[] {"code"};
2330        case -2103166364: /*operationalStatus*/ return new String[] {"Coding"};
2331        case 3373707: /*name*/ return new String[] {"string"};
2332        case 92902992: /*alias*/ return new String[] {"string"};
2333        case -1724546052: /*description*/ return new String[] {"string"};
2334        case 3357091: /*mode*/ return new String[] {"code"};
2335        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
2336        case -1429363305: /*telecom*/ return new String[] {"ContactPoint"};
2337        case -1147692044: /*address*/ return new String[] {"Address"};
2338        case -1474715471: /*physicalType*/ return new String[] {"CodeableConcept"};
2339        case 747804969: /*position*/ return new String[] {};
2340        case -2058947787: /*managingOrganization*/ return new String[] {"Reference"};
2341        case -995410646: /*partOf*/ return new String[] {"Reference"};
2342        case -1588872511: /*hoursOfOperation*/ return new String[] {};
2343        case -1149143617: /*availabilityExceptions*/ return new String[] {"string"};
2344        case 1741102485: /*endpoint*/ return new String[] {"Reference"};
2345        default: return super.getTypesForProperty(hash, name);
2346        }
2347
2348      }
2349
2350      @Override
2351      public Base addChild(String name) throws FHIRException {
2352        if (name.equals("identifier")) {
2353          return addIdentifier();
2354        }
2355        else if (name.equals("status")) {
2356          throw new FHIRException("Cannot call addChild on a primitive type Location.status");
2357        }
2358        else if (name.equals("operationalStatus")) {
2359          this.operationalStatus = new Coding();
2360          return this.operationalStatus;
2361        }
2362        else if (name.equals("name")) {
2363          throw new FHIRException("Cannot call addChild on a primitive type Location.name");
2364        }
2365        else if (name.equals("alias")) {
2366          throw new FHIRException("Cannot call addChild on a primitive type Location.alias");
2367        }
2368        else if (name.equals("description")) {
2369          throw new FHIRException("Cannot call addChild on a primitive type Location.description");
2370        }
2371        else if (name.equals("mode")) {
2372          throw new FHIRException("Cannot call addChild on a primitive type Location.mode");
2373        }
2374        else if (name.equals("type")) {
2375          return addType();
2376        }
2377        else if (name.equals("telecom")) {
2378          return addTelecom();
2379        }
2380        else if (name.equals("address")) {
2381          this.address = new Address();
2382          return this.address;
2383        }
2384        else if (name.equals("physicalType")) {
2385          this.physicalType = new CodeableConcept();
2386          return this.physicalType;
2387        }
2388        else if (name.equals("position")) {
2389          this.position = new LocationPositionComponent();
2390          return this.position;
2391        }
2392        else if (name.equals("managingOrganization")) {
2393          this.managingOrganization = new Reference();
2394          return this.managingOrganization;
2395        }
2396        else if (name.equals("partOf")) {
2397          this.partOf = new Reference();
2398          return this.partOf;
2399        }
2400        else if (name.equals("hoursOfOperation")) {
2401          return addHoursOfOperation();
2402        }
2403        else if (name.equals("availabilityExceptions")) {
2404          throw new FHIRException("Cannot call addChild on a primitive type Location.availabilityExceptions");
2405        }
2406        else if (name.equals("endpoint")) {
2407          return addEndpoint();
2408        }
2409        else
2410          return super.addChild(name);
2411      }
2412
2413  public String fhirType() {
2414    return "Location";
2415
2416  }
2417
2418      public Location copy() {
2419        Location dst = new Location();
2420        copyValues(dst);
2421        if (identifier != null) {
2422          dst.identifier = new ArrayList<Identifier>();
2423          for (Identifier i : identifier)
2424            dst.identifier.add(i.copy());
2425        };
2426        dst.status = status == null ? null : status.copy();
2427        dst.operationalStatus = operationalStatus == null ? null : operationalStatus.copy();
2428        dst.name = name == null ? null : name.copy();
2429        if (alias != null) {
2430          dst.alias = new ArrayList<StringType>();
2431          for (StringType i : alias)
2432            dst.alias.add(i.copy());
2433        };
2434        dst.description = description == null ? null : description.copy();
2435        dst.mode = mode == null ? null : mode.copy();
2436        if (type != null) {
2437          dst.type = new ArrayList<CodeableConcept>();
2438          for (CodeableConcept i : type)
2439            dst.type.add(i.copy());
2440        };
2441        if (telecom != null) {
2442          dst.telecom = new ArrayList<ContactPoint>();
2443          for (ContactPoint i : telecom)
2444            dst.telecom.add(i.copy());
2445        };
2446        dst.address = address == null ? null : address.copy();
2447        dst.physicalType = physicalType == null ? null : physicalType.copy();
2448        dst.position = position == null ? null : position.copy();
2449        dst.managingOrganization = managingOrganization == null ? null : managingOrganization.copy();
2450        dst.partOf = partOf == null ? null : partOf.copy();
2451        if (hoursOfOperation != null) {
2452          dst.hoursOfOperation = new ArrayList<LocationHoursOfOperationComponent>();
2453          for (LocationHoursOfOperationComponent i : hoursOfOperation)
2454            dst.hoursOfOperation.add(i.copy());
2455        };
2456        dst.availabilityExceptions = availabilityExceptions == null ? null : availabilityExceptions.copy();
2457        if (endpoint != null) {
2458          dst.endpoint = new ArrayList<Reference>();
2459          for (Reference i : endpoint)
2460            dst.endpoint.add(i.copy());
2461        };
2462        return dst;
2463      }
2464
2465      protected Location typedCopy() {
2466        return copy();
2467      }
2468
2469      @Override
2470      public boolean equalsDeep(Base other_) {
2471        if (!super.equalsDeep(other_))
2472          return false;
2473        if (!(other_ instanceof Location))
2474          return false;
2475        Location o = (Location) other_;
2476        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(operationalStatus, o.operationalStatus, true)
2477           && compareDeep(name, o.name, true) && compareDeep(alias, o.alias, true) && compareDeep(description, o.description, true)
2478           && compareDeep(mode, o.mode, true) && compareDeep(type, o.type, true) && compareDeep(telecom, o.telecom, true)
2479           && compareDeep(address, o.address, true) && compareDeep(physicalType, o.physicalType, true) && compareDeep(position, o.position, true)
2480           && compareDeep(managingOrganization, o.managingOrganization, true) && compareDeep(partOf, o.partOf, true)
2481           && compareDeep(hoursOfOperation, o.hoursOfOperation, true) && compareDeep(availabilityExceptions, o.availabilityExceptions, true)
2482           && compareDeep(endpoint, o.endpoint, true);
2483      }
2484
2485      @Override
2486      public boolean equalsShallow(Base other_) {
2487        if (!super.equalsShallow(other_))
2488          return false;
2489        if (!(other_ instanceof Location))
2490          return false;
2491        Location o = (Location) other_;
2492        return compareValues(status, o.status, true) && compareValues(name, o.name, true) && compareValues(alias, o.alias, true)
2493           && compareValues(description, o.description, true) && compareValues(mode, o.mode, true) && compareValues(availabilityExceptions, o.availabilityExceptions, true)
2494          ;
2495      }
2496
2497      public boolean isEmpty() {
2498        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, operationalStatus
2499          , name, alias, description, mode, type, telecom, address, physicalType, position
2500          , managingOrganization, partOf, hoursOfOperation, availabilityExceptions, endpoint
2501          );
2502      }
2503
2504  @Override
2505  public ResourceType getResourceType() {
2506    return ResourceType.Location;
2507   }
2508
2509 /**
2510   * Search parameter: <b>identifier</b>
2511   * <p>
2512   * Description: <b>An identifier for the location</b><br>
2513   * Type: <b>token</b><br>
2514   * Path: <b>Location.identifier</b><br>
2515   * </p>
2516   */
2517  @SearchParamDefinition(name="identifier", path="Location.identifier", description="An identifier for the location", type="token" )
2518  public static final String SP_IDENTIFIER = "identifier";
2519 /**
2520   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2521   * <p>
2522   * Description: <b>An identifier for the location</b><br>
2523   * Type: <b>token</b><br>
2524   * Path: <b>Location.identifier</b><br>
2525   * </p>
2526   */
2527  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2528
2529 /**
2530   * Search parameter: <b>partof</b>
2531   * <p>
2532   * Description: <b>A location of which this location is a part</b><br>
2533   * Type: <b>reference</b><br>
2534   * Path: <b>Location.partOf</b><br>
2535   * </p>
2536   */
2537  @SearchParamDefinition(name="partof", path="Location.partOf", description="A location of which this location is a part", type="reference", target={Location.class } )
2538  public static final String SP_PARTOF = "partof";
2539 /**
2540   * <b>Fluent Client</b> search parameter constant for <b>partof</b>
2541   * <p>
2542   * Description: <b>A location of which this location is a part</b><br>
2543   * Type: <b>reference</b><br>
2544   * Path: <b>Location.partOf</b><br>
2545   * </p>
2546   */
2547  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTOF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARTOF);
2548
2549/**
2550   * Constant for fluent queries to be used to add include statements. Specifies
2551   * the path value of "<b>Location:partof</b>".
2552   */
2553  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTOF = new ca.uhn.fhir.model.api.Include("Location:partof").toLocked();
2554
2555 /**
2556   * Search parameter: <b>near-distance</b>
2557   * <p>
2558   * Description: <b>A distance quantity to limit the near search to locations within a specific distance
2559
2560Requires the near parameter to also be included</b><br>
2561   * Type: <b>quantity</b><br>
2562   * Path: <b>Location.position</b><br>
2563   * </p>
2564   */
2565  @SearchParamDefinition(name="near-distance", path="Location.position", description="A distance quantity to limit the near search to locations within a specific distance\n\nRequires the near parameter to also be included", type="quantity" )
2566  public static final String SP_NEAR_DISTANCE = "near-distance";
2567 /**
2568   * <b>Fluent Client</b> search parameter constant for <b>near-distance</b>
2569   * <p>
2570   * Description: <b>A distance quantity to limit the near search to locations within a specific distance
2571
2572Requires the near parameter to also be included</b><br>
2573   * Type: <b>quantity</b><br>
2574   * Path: <b>Location.position</b><br>
2575   * </p>
2576   */
2577  public static final ca.uhn.fhir.rest.gclient.QuantityClientParam NEAR_DISTANCE = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_NEAR_DISTANCE);
2578
2579 /**
2580   * Search parameter: <b>address</b>
2581   * <p>
2582   * Description: <b>A (part of the) address of the location</b><br>
2583   * Type: <b>string</b><br>
2584   * Path: <b>Location.address</b><br>
2585   * </p>
2586   */
2587  @SearchParamDefinition(name="address", path="Location.address", description="A (part of the) address of the location", type="string" )
2588  public static final String SP_ADDRESS = "address";
2589 /**
2590   * <b>Fluent Client</b> search parameter constant for <b>address</b>
2591   * <p>
2592   * Description: <b>A (part of the) address of the location</b><br>
2593   * Type: <b>string</b><br>
2594   * Path: <b>Location.address</b><br>
2595   * </p>
2596   */
2597  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS);
2598
2599 /**
2600   * Search parameter: <b>address-state</b>
2601   * <p>
2602   * Description: <b>A state specified in an address</b><br>
2603   * Type: <b>string</b><br>
2604   * Path: <b>Location.address.state</b><br>
2605   * </p>
2606   */
2607  @SearchParamDefinition(name="address-state", path="Location.address.state", description="A state specified in an address", type="string" )
2608  public static final String SP_ADDRESS_STATE = "address-state";
2609 /**
2610   * <b>Fluent Client</b> search parameter constant for <b>address-state</b>
2611   * <p>
2612   * Description: <b>A state specified in an address</b><br>
2613   * Type: <b>string</b><br>
2614   * Path: <b>Location.address.state</b><br>
2615   * </p>
2616   */
2617  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_STATE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_STATE);
2618
2619 /**
2620   * Search parameter: <b>operational-status</b>
2621   * <p>
2622   * Description: <b>Searches for locations (typically bed/room) that have an operational status (e.g. contaminated, housekeeping)</b><br>
2623   * Type: <b>token</b><br>
2624   * Path: <b>Location.operationalStatus</b><br>
2625   * </p>
2626   */
2627  @SearchParamDefinition(name="operational-status", path="Location.operationalStatus", description="Searches for locations (typically bed/room) that have an operational status (e.g. contaminated, housekeeping)", type="token" )
2628  public static final String SP_OPERATIONAL_STATUS = "operational-status";
2629 /**
2630   * <b>Fluent Client</b> search parameter constant for <b>operational-status</b>
2631   * <p>
2632   * Description: <b>Searches for locations (typically bed/room) that have an operational status (e.g. contaminated, housekeeping)</b><br>
2633   * Type: <b>token</b><br>
2634   * Path: <b>Location.operationalStatus</b><br>
2635   * </p>
2636   */
2637  public static final ca.uhn.fhir.rest.gclient.TokenClientParam OPERATIONAL_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_OPERATIONAL_STATUS);
2638
2639 /**
2640   * Search parameter: <b>type</b>
2641   * <p>
2642   * Description: <b>A code for the type of location</b><br>
2643   * Type: <b>token</b><br>
2644   * Path: <b>Location.type</b><br>
2645   * </p>
2646   */
2647  @SearchParamDefinition(name="type", path="Location.type", description="A code for the type of location", type="token" )
2648  public static final String SP_TYPE = "type";
2649 /**
2650   * <b>Fluent Client</b> search parameter constant for <b>type</b>
2651   * <p>
2652   * Description: <b>A code for the type of location</b><br>
2653   * Type: <b>token</b><br>
2654   * Path: <b>Location.type</b><br>
2655   * </p>
2656   */
2657  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
2658
2659 /**
2660   * Search parameter: <b>address-postalcode</b>
2661   * <p>
2662   * Description: <b>A postal code specified in an address</b><br>
2663   * Type: <b>string</b><br>
2664   * Path: <b>Location.address.postalCode</b><br>
2665   * </p>
2666   */
2667  @SearchParamDefinition(name="address-postalcode", path="Location.address.postalCode", description="A postal code specified in an address", type="string" )
2668  public static final String SP_ADDRESS_POSTALCODE = "address-postalcode";
2669 /**
2670   * <b>Fluent Client</b> search parameter constant for <b>address-postalcode</b>
2671   * <p>
2672   * Description: <b>A postal code specified in an address</b><br>
2673   * Type: <b>string</b><br>
2674   * Path: <b>Location.address.postalCode</b><br>
2675   * </p>
2676   */
2677  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_POSTALCODE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_POSTALCODE);
2678
2679 /**
2680   * Search parameter: <b>address-country</b>
2681   * <p>
2682   * Description: <b>A country specified in an address</b><br>
2683   * Type: <b>string</b><br>
2684   * Path: <b>Location.address.country</b><br>
2685   * </p>
2686   */
2687  @SearchParamDefinition(name="address-country", path="Location.address.country", description="A country specified in an address", type="string" )
2688  public static final String SP_ADDRESS_COUNTRY = "address-country";
2689 /**
2690   * <b>Fluent Client</b> search parameter constant for <b>address-country</b>
2691   * <p>
2692   * Description: <b>A country specified in an address</b><br>
2693   * Type: <b>string</b><br>
2694   * Path: <b>Location.address.country</b><br>
2695   * </p>
2696   */
2697  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_COUNTRY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_COUNTRY);
2698
2699 /**
2700   * Search parameter: <b>endpoint</b>
2701   * <p>
2702   * Description: <b>Technical endpoints providing access to services operated for the location</b><br>
2703   * Type: <b>reference</b><br>
2704   * Path: <b>Location.endpoint</b><br>
2705   * </p>
2706   */
2707  @SearchParamDefinition(name="endpoint", path="Location.endpoint", description="Technical endpoints providing access to services operated for the location", type="reference", target={Endpoint.class } )
2708  public static final String SP_ENDPOINT = "endpoint";
2709 /**
2710   * <b>Fluent Client</b> search parameter constant for <b>endpoint</b>
2711   * <p>
2712   * Description: <b>Technical endpoints providing access to services operated for the location</b><br>
2713   * Type: <b>reference</b><br>
2714   * Path: <b>Location.endpoint</b><br>
2715   * </p>
2716   */
2717  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENDPOINT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENDPOINT);
2718
2719/**
2720   * Constant for fluent queries to be used to add include statements. Specifies
2721   * the path value of "<b>Location:endpoint</b>".
2722   */
2723  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENDPOINT = new ca.uhn.fhir.model.api.Include("Location:endpoint").toLocked();
2724
2725 /**
2726   * Search parameter: <b>organization</b>
2727   * <p>
2728   * Description: <b>Searches for locations that are managed by the provided organization</b><br>
2729   * Type: <b>reference</b><br>
2730   * Path: <b>Location.managingOrganization</b><br>
2731   * </p>
2732   */
2733  @SearchParamDefinition(name="organization", path="Location.managingOrganization", description="Searches for locations that are managed by the provided organization", type="reference", target={Organization.class } )
2734  public static final String SP_ORGANIZATION = "organization";
2735 /**
2736   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
2737   * <p>
2738   * Description: <b>Searches for locations that are managed by the provided organization</b><br>
2739   * Type: <b>reference</b><br>
2740   * Path: <b>Location.managingOrganization</b><br>
2741   * </p>
2742   */
2743  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
2744
2745/**
2746   * Constant for fluent queries to be used to add include statements. Specifies
2747   * the path value of "<b>Location:organization</b>".
2748   */
2749  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("Location:organization").toLocked();
2750
2751 /**
2752   * Search parameter: <b>name</b>
2753   * <p>
2754   * Description: <b>A portion of the location's name or alias</b><br>
2755   * Type: <b>string</b><br>
2756   * Path: <b>Location.name, Location.alias</b><br>
2757   * </p>
2758   */
2759  @SearchParamDefinition(name="name", path="Location.name | Location.alias", description="A portion of the location's name or alias", type="string" )
2760  public static final String SP_NAME = "name";
2761 /**
2762   * <b>Fluent Client</b> search parameter constant for <b>name</b>
2763   * <p>
2764   * Description: <b>A portion of the location's name or alias</b><br>
2765   * Type: <b>string</b><br>
2766   * Path: <b>Location.name, Location.alias</b><br>
2767   * </p>
2768   */
2769  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
2770
2771 /**
2772   * Search parameter: <b>address-use</b>
2773   * <p>
2774   * Description: <b>A use code specified in an address</b><br>
2775   * Type: <b>token</b><br>
2776   * Path: <b>Location.address.use</b><br>
2777   * </p>
2778   */
2779  @SearchParamDefinition(name="address-use", path="Location.address.use", description="A use code specified in an address", type="token" )
2780  public static final String SP_ADDRESS_USE = "address-use";
2781 /**
2782   * <b>Fluent Client</b> search parameter constant for <b>address-use</b>
2783   * <p>
2784   * Description: <b>A use code specified in an address</b><br>
2785   * Type: <b>token</b><br>
2786   * Path: <b>Location.address.use</b><br>
2787   * </p>
2788   */
2789  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDRESS_USE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDRESS_USE);
2790
2791 /**
2792   * Search parameter: <b>near</b>
2793   * <p>
2794   * Description: <b>The coordinates expressed as [latitude]:[longitude] (using the WGS84 datum, see notes) to find locations near to (servers may search using a square rather than a circle for efficiency)
2795
2796Requires the near-distance parameter to be provided also</b><br>
2797   * Type: <b>token</b><br>
2798   * Path: <b>Location.position</b><br>
2799   * </p>
2800   */
2801  @SearchParamDefinition(name="near", path="Location.position", description="The coordinates expressed as [latitude]:[longitude] (using the WGS84 datum, see notes) to find locations near to (servers may search using a square rather than a circle for efficiency)\n\nRequires the near-distance parameter to be provided also", type="token" )
2802  public static final String SP_NEAR = "near";
2803 /**
2804   * <b>Fluent Client</b> search parameter constant for <b>near</b>
2805   * <p>
2806   * Description: <b>The coordinates expressed as [latitude]:[longitude] (using the WGS84 datum, see notes) to find locations near to (servers may search using a square rather than a circle for efficiency)
2807
2808Requires the near-distance parameter to be provided also</b><br>
2809   * Type: <b>token</b><br>
2810   * Path: <b>Location.position</b><br>
2811   * </p>
2812   */
2813  public static final ca.uhn.fhir.rest.gclient.TokenClientParam NEAR = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_NEAR);
2814
2815 /**
2816   * Search parameter: <b>address-city</b>
2817   * <p>
2818   * Description: <b>A city specified in an address</b><br>
2819   * Type: <b>string</b><br>
2820   * Path: <b>Location.address.city</b><br>
2821   * </p>
2822   */
2823  @SearchParamDefinition(name="address-city", path="Location.address.city", description="A city specified in an address", type="string" )
2824  public static final String SP_ADDRESS_CITY = "address-city";
2825 /**
2826   * <b>Fluent Client</b> search parameter constant for <b>address-city</b>
2827   * <p>
2828   * Description: <b>A city specified in an address</b><br>
2829   * Type: <b>string</b><br>
2830   * Path: <b>Location.address.city</b><br>
2831   * </p>
2832   */
2833  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_CITY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_CITY);
2834
2835 /**
2836   * Search parameter: <b>status</b>
2837   * <p>
2838   * Description: <b>Searches for locations with a specific kind of status</b><br>
2839   * Type: <b>token</b><br>
2840   * Path: <b>Location.status</b><br>
2841   * </p>
2842   */
2843  @SearchParamDefinition(name="status", path="Location.status", description="Searches for locations with a specific kind of status", type="token" )
2844  public static final String SP_STATUS = "status";
2845 /**
2846   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2847   * <p>
2848   * Description: <b>Searches for locations with a specific kind of status</b><br>
2849   * Type: <b>token</b><br>
2850   * Path: <b>Location.status</b><br>
2851   * </p>
2852   */
2853  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2854
2855
2856}
2857