Record Class BoundingBox

java.lang.Object
java.lang.Record
slash.navigation.common.BoundingBox

public record BoundingBox(NavigationPosition northEast, NavigationPosition southWest) extends Record
An area defined by the north east and south west NavigationPositions.
Author:
Christian Pesch
  • Constructor Details

    • BoundingBox

      public BoundingBox(Double longitudeNorthEast, Double latitudeNorthEast, Double longitudeSouthWest, Double latitudeSouthWest)
    • BoundingBox

      public BoundingBox(NavigationPosition northEast, NavigationPosition southWest)
      Creates an instance of a BoundingBox record class.
      Parameters:
      northEast - the value for the northEast record component
      southWest - the value for the southWest record component
  • Method Details

    • asBoundingBox

      public static BoundingBox asBoundingBox(List<? extends NavigationPosition> positions)
    • getSouthEast

      public NavigationPosition getSouthEast()
    • getNorthWest

      public NavigationPosition getNorthWest()
    • getSquareSize

      public double getSquareSize()
    • contains

      public boolean contains(NavigationPosition position)
    • contains

      public boolean contains(BoundingBox other)
    • intersect

      public BoundingBox intersect(BoundingBox other)
    • getCenter

      public NavigationPosition getCenter()
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • northEast

      public NavigationPosition northEast()
      Returns the value of the northEast record component.
      Returns:
      the value of the northEast record component
    • southWest

      public NavigationPosition southWest()
      Returns the value of the southWest record component.
      Returns:
      the value of the southWest record component