Interface Coordinate

All Known Implementing Classes:
CartesianCoordinate, GeoCoordinate

public interface Coordinate
This interface represents a generic 2D coordinate. Implementations of this interface should provide methods to get the two components of the coordinate and calculate distances.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    The axes of a 2D coordinate system.
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    distanceTo(double firstComponent, double secondComponent)
    Calculates the distance to another point specified by its components.
    double
    Calculates the distance to another Coordinate object.
    default double
    Gets the coordinate component based on the specified Axis.
    double
    Examples for the first component are latitude or X coordinate.
    double
    Examples for the first component are longitude or Y coordinate.
  • Method Details

    • getFirstComponent

      double getFirstComponent()
      Examples for the first component are latitude or X coordinate.
      Returns:
      the first component of the 2D-coordinate
    • getSecondComponent

      double getSecondComponent()
      Examples for the first component are longitude or Y coordinate.
      Returns:
      the second component of the 2D-coordinate
    • distanceTo

      double distanceTo(Coordinate other)
      Calculates the distance to another Coordinate object.

      Note: Implementations may raise an IllegalArgumentException if the other Coordinate object is not of the same type.

    • distanceTo

      double distanceTo(double firstComponent, double secondComponent)
      Calculates the distance to another point specified by its components.
    • getComponent

      default double getComponent(Coordinate.Axis axis)
      Gets the coordinate component based on the specified Axis.