contains method

bool contains(
  1. int x,
  2. int y
)

Checks if the given point (x, y) is contained within this rectangle.

x The x-coordinate of the point to check. y The y-coordinate of the point to check. Returns true if the point is inside the rectangle, false otherwise.

Implementation

bool contains(final int x, final int y) {
  return x >= left && x < right && y >= top && y < bottom;
}