Class Location

java.lang.Object
io.jenetics.jpx.format.Location

public final class Location extends Object
Aggregation of the three location components: latitude, longitude and elevation.
Since:
1.4
Version:
2.2
See Also:
  • Method Details

    • latitude

      Return the latitude of this location.
      Returns:
      the latitude of this location, or Optional.empty() if not available
    • longitude

      Return the longitude of this location.
      Returns:
      the longitude of this location, or Optional.empty() if not available
    • elevation

      Return the elevation of this location.
      Returns:
      the elevation of this location, or Optional.empty() if not available
    • toPoint

      public Optional<Point> toPoint()
      Return a new Point from this location. If the latitude() or the longitude() is not given, Optional.empty() is returned
      Returns:
      a new Point if the latitude and longitude is given, Optional.empty() otherwise
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • of

      public static Location of(Point point)
      Create a new location form the given GPS point.
      Parameters:
      point - the GPS point
      Returns:
      a new location form the given GPS point
      Throws:
      NullPointerException - if the given point is null
    • of

      public static Location of(Latitude latitude, Longitude longitude, Length elevation)
      Create a new location object from the given latitude, longitude and elevation.
      Parameters:
      latitude - the latitude of the location, maybe null
      longitude - the longitude of the location, maybe null
      elevation - the elevation if the location, maybe null
      Returns:
      a new location object from the given input data
    • of

      public static Location of(Latitude latitude, Longitude longitude)
      Create a new location object from the given latitude and longitude.
      Parameters:
      latitude - the latitude of the location, maybe null
      longitude - the longitude of the location, maybe null
      Returns:
      a new location object from the given input data
    • of

      public static Location of(Latitude latitude)
      Create a new location object from the given latitude.
      Parameters:
      latitude - the latitude of the location, maybe null
      Returns:
      a new location object from the given input data
    • of

      public static Location of(Longitude longitude)
      Create a new location object from the given longitude.
      Parameters:
      longitude - the longitude of the location, maybe null
      Returns:
      a new location object from the given input data
    • of

      public static Location of(Length elevation)
      Create a new location object from the given elevation.
      Parameters:
      elevation - the elevation of the location, maybe null
      Returns:
      a new location object from the given input data