package demo;

public class Rectangle {
    private Point origin;
    private int width;
    private int height;

    public Rectangle() {
    }

    public Rectangle(Point origin, int width, int height) {
        this.origin = origin;
        this.width = width;
        this.height = height;
    }

    public boolean hitTest(Point target) {
        boolean hTest = target.getX() >= origin.getX() && target.getX() <= origin.getX() + width;
        boolean vTest = target.getY() >= origin.getY() && target.getY() <= origin.getY() + height;
        return hTest && vTest;
    }

    public Point getOrigin() {
        return origin;
    }

    public void setOrigin(Point origin) {
        this.origin = origin;
    }

    public int getWidth() {
        return width;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    public int getHeight() {
        return height;
    }

    public void setHeight(int height) {
        this.height = height;
    }
}