Rectangle

Inheritance: java.lang.Object

public class Rectangle

Represents rectangle.

Constructors

Constructor Description
Rectangle()
Rectangle(float x, float y, float width, float height) Initializes a new instance of the Rectangle class.
Rectangle(Rectangle rectangle) Initializes a new instance of Rectangle class.

Methods

Method Description
opEquality(Rectangle left, Rectangle right) Compares two Rectangle objects.
opInequality(Rectangle left, Rectangle right) Compares two Rectangle objects.
equals(Rectangle obj1, Rectangle obj2)
getX() Gets or sets the x.
setX(float value) Gets or sets the x.
getY() Gets or sets the y.
setY(float value) Gets or sets the y.
getWidth() Gets or sets the width.
setWidth(float value) Gets or sets the width.
getHeight() Gets or sets the height.
setHeight(float value) Gets or sets the height.
equals(Object obj) Determines whether the specified rectangle is equal to the current rectangle.
hashCode() Serves as the default hash function.
toString()

Rectangle()

public Rectangle()

Rectangle(float x, float y, float width, float height)

public Rectangle(float x, float y, float width, float height)

Initializes a new instance of the Rectangle class.

Parameters:

Parameter Type Description
x float The x.
y float The y.
width float The width.
height float The height.

Rectangle(Rectangle rectangle)

public Rectangle(Rectangle rectangle)

Initializes a new instance of Rectangle class.

Parameters:

Parameter Type Description
rectangle Rectangle The rectangle.

opEquality(Rectangle left, Rectangle right)

public static boolean opEquality(Rectangle left, Rectangle right)

Compares two Rectangle objects. The result specifies whether the values of the Rectangle.X, Rectangle.Y, Rectangle.Width and Rectangle.Height properties of the two Rectangle objects are equal.

Parameters:

Parameter Type Description
left Rectangle A Rectangle to compare.
right Rectangle A Rectangle to compare.

Returns: boolean - true if the Rectangle.X, Rectangle.Y, Rectangle.Width and Rectangle.Height values of left and right are equal; otherwise, false.

opInequality(Rectangle left, Rectangle right)

public static boolean opInequality(Rectangle left, Rectangle right)

Compares two Rectangle objects. The result specifies whether the values of the Rectangle.X, Rectangle.Y, Rectangle.Width and Rectangle.Height properties of the two Rectangle objects are not equal.

Parameters:

Parameter Type Description
left Rectangle A Rectangle to compare.
right Rectangle A Rectangle to compare.

Returns: boolean - true if the Rectangle.X, Rectangle.Y, Rectangle.Width and Rectangle.Height values of left and right are not equal; otherwise, false.

equals(Rectangle obj1, Rectangle obj2)

public static boolean equals(Rectangle obj1, Rectangle obj2)

Parameters:

Parameter Type Description
obj1 Rectangle
obj2 Rectangle

Returns: boolean

getX()

public final float getX()

Gets or sets the x.

Value: The x.

Returns: float -

setX(float value)

public final void setX(float value)

Gets or sets the x.

Value: The x.

Parameters:

Parameter Type Description
value float

getY()

public final float getY()

Gets or sets the y.

Value: The y.

Returns: float -

setY(float value)

public final void setY(float value)

Gets or sets the y.

Value: The y.

Parameters:

Parameter Type Description
value float

getWidth()

public final float getWidth()

Gets or sets the width.

Value: The width.

Returns: float -

setWidth(float value)

public final void setWidth(float value)

Gets or sets the width.

Value: The width.

Parameters:

Parameter Type Description
value float

getHeight()

public final float getHeight()

Gets or sets the height.

Value: The height.

Returns: float -

setHeight(float value)

public final void setHeight(float value)

Gets or sets the height.

Value: The height.

Parameters:

Parameter Type Description
value float

equals(Object obj)

public boolean equals(Object obj)

Determines whether the specified rectangle is equal to the current rectangle.

Parameters:

Parameter Type Description
obj java.lang.Object The rectangle to compare with the current rectangle.

Returns: boolean - if the specified rectangle is equal to the current rectangle; otherwise, .

hashCode()

public int hashCode()

Serves as the default hash function.

Returns: int - A hash code for the current rectangle.

toString()

public String toString()

Returns: java.lang.String