package com.example.jmacro.wjdr.base;

/**
 * 屏幕区域
 */
public class ScreenRect {

    private int left;
    private int top;
    private int right;
    private int bottom;

    /**
     * 相似度
     */
    private double similar;

    public ScreenRect() {
    }

    public ScreenRect(int left, int top, int right, int bottom) {
        this.left = left;
        this.top = top;
        this.right = right;
        this.bottom = bottom;
    }

    public ScreenRect(int left, int top, int right, int bottom, double similar) {
        this.left = left;
        this.top = top;
        this.right = right;
        this.bottom = bottom;
        this.similar = similar;
    }

    public int getLeft() {
        return left;
    }

    public void setLeft(int left) {
        this.left = left;
    }

    public int getTop() {
        return top;
    }

    public void setTop(int top) {
        this.top = top;
    }

    public int getRight() {
        return right;
    }

    public void setRight(int right) {
        this.right = right;
    }

    public int getBottom() {
        return bottom;
    }

    public void setBottom(int bottom) {
        this.bottom = bottom;
    }

    public int getWidth() {
        return this.right - this.left;
    }

    public int getHeight() {
        return this.bottom - this.top;
    }

    public int[] getCenter() {
        return new int[]{(left + right) / 2, (top + bottom) / 2};
    }

    @Override
    public String toString() {
        return "ScreenRect{" +
                "left=" + left +
                ", top=" + top +
                ", right=" + right +
                ", bottom=" + bottom +
                '}';
    }
}
