class CheckLast {

    public boolean check(TsData data) {

        clear();
        if (!testSeries(data)) {
            return false;
        }
        ModellingContext context = new ModellingContext();
        model_ = preprocessor_.process(data.drop(0, nback_), context);
        if (model_ == null) {
            return false;
        }

        info_ = context.information;
        TsVariableList vars = model_.description.buildRegressionVariables();
        TsDomain fdomain = new TsDomain(model_.description.getSeriesDomain().getEnd(), nback_);
        List<DataBlock> x = vars.all().data(fdomain);

        forecasts_ = new Forecasts();

        RegArimaEstimation<SarimaModel> estimation
                = new RegArimaEstimation<>(model_.estimation.getRegArima(), model_.estimation.getLikelihood());

        try {
            forecasts_.calcForecast(estimation, x, nback_, model_.description.getArimaComponent().getFreeParametersCount());
        } catch (RuntimeException err) {
            return false;
        }

        y_ = data.fittoDomain(fdomain);
        fy_ = y_.clone();
        ofcasts_ = new TsData(fdomain);
        for (int i = 0; i < ofcasts_.getLength(); ++i) {
            ofcasts_.set(i, forecasts_.forecast(i));
        }
        model_.backTransform(ofcasts_, true, true);

        List<ITsDataTransformation> transformations = model_.description.transformations();
        for (ITsDataTransformation tr : transformations) {
            tr.transform(fy_, null);
        }

        return true;
    }

    public  CheckLast(IPreprocessor preprocessor);

}