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