class SimpleStepFunctionCompressor implements StepFunctionCompressor<T> {

    @Override public StepFunction<T> compress(StepFunction<T> function) {
        double[] arguments = function.getX();
        T[] values = function.getY();

        if (arguments.length >= minSizeToBeCompressed) {
            List<StepFunctionPoint> points = new ArrayList<>();

            for (int i = 0; i < arguments.length; i++)
                points.add(new StepFunctionPoint(arguments[i], values[i]));

            points = compress(points);

            double[] resX = new double[points.size()];
            T[] resY = Arrays.copyOf(values, points.size());

            for (int i = 0; i < points.size(); i++) {
                StepFunctionPoint pnt = points.get(i);
                resX[i] = pnt.x;
                resY[i] = pnt.y;
            }

            return new StepFunction<>(resX, resY);
        }

        return function;
    }

    public  SimpleStepFunctionCompressor();
    public  SimpleStepFunctionCompressor(int minSizeToBeCompressed, double minImpurityIncreaseForRecord,
        double minImpurityDecreaseForRecord);

}