Record Class Bounds

java.lang.Object
java.lang.Record
net.amygdalum.allotropy.fluent.elements.Bounds

public record Bounds(int left, int top, int right, int bottom) extends Record
  • Constructor Details

    • Bounds

      public Bounds(int left, int top, int right, int bottom)
      Creates an instance of a Bounds record class.
      Parameters:
      left - the value for the left record component
      top - the value for the top record component
      right - the value for the right record component
      bottom - the value for the bottom record component
  • Method Details

    • from

      public static Bounds from(Object object)
    • bound

      public double bound(CardinalDirection direction)
    • center

      public double center(Dimension dimension)
    • bottomLeft

      public Point bottomLeft()
    • bottomRight

      public Point bottomRight()
    • topLeft

      public Point topLeft()
    • topRight

      public Point topRight()
    • width

      public int width()
    • height

      public int height()
    • size

      public int size(Dimension dimension)
    • contains

      public boolean contains(Point p)
    • 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 '=='.
      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.
    • left

      public int left()
      Returns the value of the left record component.
      Returns:
      the value of the left record component
    • top

      public int top()
      Returns the value of the top record component.
      Returns:
      the value of the top record component
    • right

      public int right()
      Returns the value of the right record component.
      Returns:
      the value of the right record component
    • bottom

      public int bottom()
      Returns the value of the bottom record component.
      Returns:
      the value of the bottom record component