Record Class Rect
java.lang.Object
java.lang.Record
dev.boze.api.gui.util.Rect
An axis-aligned rectangle in GUI-scaled pixels.
-
Constructor Summary
ConstructorsConstructorDescriptionRect(double x, double y, double width, double height) Creates an instance of aRectrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoublebottom()doublecenterX()doublecenterY()booleancontains(double px, double py) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleheight()Returns the value of theheightrecord component.doubleright()final StringtoString()Returns a string representation of this record class.doublewidth()Returns the value of thewidthrecord component.doublex()Returns the value of thexrecord component.doubley()Returns the value of theyrecord component.
-
Constructor Details
-
Rect
public Rect(double x, double y, double width, double height) Creates an instance of aRectrecord class.- Parameters:
x- the value for thexrecord componenty- the value for theyrecord componentwidth- the value for thewidthrecord componentheight- the value for theheightrecord component
-
-
Method Details
-
contains
public boolean contains(double px, double py) -
right
public double right() -
bottom
public double bottom() -
centerX
public double centerX() -
centerY
public double centerY() -
toString
-
hashCode
-
equals
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 thecomparemethod from their corresponding wrapper classes. -
x
public double x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public double y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-
width
public double width()Returns the value of thewidthrecord component.- Returns:
- the value of the
widthrecord component
-
height
public double height()Returns the value of theheightrecord component.- Returns:
- the value of the
heightrecord component
-