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