package com.inspect.infrared.selectArea;

import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

@Setter
@Getter
public abstract class SelectArea {
    private int[] coordinates;
    private int width;
    private int height;

    public SelectArea(int[] coordinates) {
        this.coordinates = coordinates;
    }

    public List<byte[]> scanPixelPoints(List<List<byte[]>> table) {
        List<byte[]> pixelPoints = new ArrayList<>();

        for (int i = 0; i < table.size(); ++i) {
            for (int j = 0; j < table.get(i).size(); ++j) {
                if (this.isIn(i, j)) {
                    pixelPoints.add((byte[]) ((List<?>) table.get(i)).get(j));
                }
            }
        }

        return pixelPoints;
    }

    public abstract boolean isIn(int var1, int var2);
}
