Class GeoBase

  • All Implemented Interfaces:
    LatLon
    Direct Known Subclasses:
    Place

    public class GeoBase
    extends java.lang.Object
    implements LatLon
    An intermediary between the simple LatLon and other conceptual classes: Place, Country, etc.
    Author:
    Marc C. Ubaldino, MITRE, ubaldino at mitre dot org
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String key
      identifier ID
      protected double latitude  
      protected double longitude  
      java.lang.String name
      any name associated with this place
    • Constructor Summary

      Constructors 
      Constructor Description
      GeoBase()
      Creates an empty GeoBase location object
      GeoBase​(double lat, double lon)  
      GeoBase​(java.lang.String placeId, java.lang.String nm)
      Creates a new instance of GeoBase
    • Method Summary

      Modifier and Type Method Description
      java.lang.String getGeohash()  
      java.lang.String getKey()  
      double getLatitude()  
      double getLongitude()  
      java.lang.String getName()  
      java.lang.String getNamenorm()  
      boolean hasCoordinate()
      Convenience method for checking if lat/lon was set to other than 0,0 (default)
      void setGeohash​(java.lang.String gh)
      Set and get Geohash -- this is delegated to caller as core processing need not have a geohash generated when lat/lon is set.
      void setKey​(java.lang.String k)
      legacy nomenclature.
      void setLatitude​(double lat)  
      void setLatLon​(LatLon geo)
      Convenience method
      void setLongitude​(double lon)  
      void setName​(java.lang.String nm)  
      java.lang.String toString()
      Generic label -- anything more sophisticated needs attention E.g.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • key

        protected java.lang.String key
        identifier ID
      • name

        public java.lang.String name
        any name associated with this place
      • latitude

        protected double latitude
      • longitude

        protected double longitude
    • Constructor Detail

      • GeoBase

        public GeoBase()
        Creates an empty GeoBase location object
      • GeoBase

        public GeoBase​(java.lang.String placeId,
                       java.lang.String nm)
        Creates a new instance of GeoBase
        Parameters:
        placeId - place Id
        nm - place name
      • GeoBase

        public GeoBase​(double lat,
                       double lon)
    • Method Detail

      • getKey

        public java.lang.String getKey()
        Returns:
        place id
      • setKey

        public void setKey​(java.lang.String k)
        legacy nomenclature. Place ID is better.
        Parameters:
        k - place Id
      • setName

        public final void setName​(java.lang.String nm)
        Parameters:
        nm - name for this location
      • getName

        public java.lang.String getName()
        Returns:
        name of location
      • getNamenorm

        public java.lang.String getNamenorm()
      • toString

        public java.lang.String toString()
        Generic label -- anything more sophisticated needs attention E.g. to use Key + Name or just Key for a label would be very specific
        Overrides:
        toString in class java.lang.Object
        Returns:
        string repr of the location
      • getLatitude

        public double getLatitude()
        Specified by:
        getLatitude in interface LatLon
        Returns:
        lat in degrees
      • setLatitude

        public void setLatitude​(double lat)
        Specified by:
        setLatitude in interface LatLon
        Parameters:
        lat - in degrees
      • getLongitude

        public double getLongitude()
        Specified by:
        getLongitude in interface LatLon
        Returns:
        longitude in degrees
      • setLongitude

        public void setLongitude​(double lon)
        Specified by:
        setLongitude in interface LatLon
        Parameters:
        lon - in degrees
      • setGeohash

        public void setGeohash​(java.lang.String gh)
        Set and get Geohash -- this is delegated to caller as core processing need not have a geohash generated when lat/lon is set.
        Parameters:
        gh - geohash
      • getGeohash

        public java.lang.String getGeohash()
        Returns:
        geohash
      • setLatLon

        public void setLatLon​(LatLon geo)
        Convenience method
        Parameters:
        geo - lat/lon pair
      • hasCoordinate

        public boolean hasCoordinate()
        Convenience method for checking if lat/lon was set to other than 0,0 (default)
        Returns:
        true if instance has non-zero coordinates.