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