class DifferencingModule extends DemetraModule implements IDifferencingModule, IPreprocessingModule {

    @Override
    public ProcessingResult process(ModellingContext context) {
        try {
            // correct data for estimated outliers...
            DataBlock res;
            if (context.estimation != null) {
                int xcount = context.estimation.getRegArima().getXCount();
                int xout = context.description.getOutliers().size();

                res = context.estimation.getCorrectedData(xcount - xout, xcount);
            } else {
                res = new DataBlock(context.description.transformedOriginal());
            }
            SarimaSpecification nspec = context.description.getSpecification();
            // get residuals
            freq = context.description.getFrequency();
            process(res, freq, nspec.getD(), nspec.getBD());
            boolean changed = false;
            if (nspec.getD() != d || nspec.getBD() != bd) {
                changed = true;
                SarimaSpecification cspec = new SarimaSpecification(freq);
                cspec.setD(d);
                cspec.setBD(bd);
                context.description.setSpecification(cspec);
                context.estimation = null;
            }
            if (isMeanCorrection() != context.description.isEstimatedMean()) {
                changed = true;
                context.description.setMean(isMeanCorrection());
                context.estimation = null;
            }
//            addDifferencingInfo(context, d, bd, mean);
            return changed ? ProcessingResult.Changed : ProcessingResult.Unchanged;

        } catch (RuntimeException err) {
            context.description.setAirline(context.hasseas);
            context.estimation = null;
            return ProcessingResult.Failed;
        }
    }

    public  DifferencingModule();

}