class KiePMMLRegressionTableRegressionFactory {

    public static Map.Entry<String, String> getRegressionTable(final RegressionTable regressionTable,
                                                               final RegressionModel.NormalizationMethod normalizationMethod,
                                                               final List<KiePMMLOutputField> outputFields,
                                                               final String targetField,
                                                               final String packageName) {
        logger.trace("getRegressionTable {}", regressionTable);
        String className = "KiePMMLRegressionTableRegression" + classArity.addAndGet(1);
        CompilationUnit cloneCU = JavaParserUtils.getKiePMMLModelCompilationUnit(className, packageName,
                                                                                 KIE_PMML_REGRESSION_TABLE_REGRESSION_TEMPLATE_JAVA, KIE_PMML_REGRESSION_TABLE_REGRESSION_TEMPLATE);
        ClassOrInterfaceDeclaration tableTemplate = cloneCU.getClassByName(className)
                .orElseThrow(() -> new KiePMMLException(MAIN_CLASS_NOT_FOUND + ": " + className));
        final ConstructorDeclaration constructorDeclaration =
                tableTemplate.getDefaultConstructor().orElseThrow(() -> new KiePMMLInternalException(String.format(MISSING_DEFAULT_CONSTRUCTOR, tableTemplate.getName())));
        setConstructor(regressionTable, constructorDeclaration, tableTemplate.getName(), targetField);
        final Map<String, MethodDeclaration> numericPredictorsMap =
                addNumericPredictors(regressionTable.getNumericPredictors(), tableTemplate);
        final Map<String, MethodDeclaration> categoricalPredictorsMap =
                addCategoricalPredictors(regressionTable.getCategoricalPredictors(), tableTemplate);
        final Map<String, MethodDeclaration> predictorTermsMap =
                addPredictorTerms(regressionTable.getPredictorTerms(), tableTemplate);
        final BlockStmt body = constructorDeclaration.getBody();
        addMapPopulation(numericPredictorsMap, body, "numericFunctionMap");
        addMapPopulation(categoricalPredictorsMap, body, "categoricalFunctionMap");
        addMapPopulation(predictorTermsMap, body, "predictorTermsFunctionMap");
        populateGetTargetCategory(tableTemplate, regressionTable.getTargetCategory());
        populateUpdateResult(tableTemplate, normalizationMethod);
        populateOutputFieldsMap(tableTemplate, outputFields);
        return new AbstractMap.SimpleEntry<>(getFullClassName(cloneCU), cloneCU.toString());
    }

    private  KiePMMLRegressionTableRegressionFactory();

}