@Test public void populateGetProbabilityMapMethodUnsupported() { UNSUPPORTED_NORMALIZATION_METHODS.forEach(normalizationMethod -> { try { KiePMMLRegressionTableClassificationFactory.populateGetProbabilityMapMethod(normalizationMethod, modelTemplate); fail("Expecting KiePMMLInternalException with normalizationMethod " + normalizationMethod); } catch (Exception e) { assertTrue(e instanceof KiePMMLInternalException); } }); }
static void populateGetProbabilityMapMethod(final RegressionModel.NormalizationMethod normalizationMethod, final ClassOrInterfaceDeclaration tableTemplate) { try { String methodName = String.format("get%sProbabilityMap", normalizationMethod.name()); templateEvaluate = getFromFileName(KIE_PMML_GET_PROBABILITY_MAP_METHOD_TEMPLATE_JAVA); cloneEvaluate = templateEvaluate.clone(); ClassOrInterfaceDeclaration evaluateTemplateClass = cloneEvaluate.getClassByName(KIE_PMML_GET_PROBABILITY_MAP_METHOD_TEMPLATE) .orElseThrow(() -> new RuntimeException(MAIN_CLASS_NOT_FOUND)); final MethodDeclaration toReturn = evaluateTemplateClass.getMethodsByName(methodName).get(0); addMethod(toReturn, tableTemplate, "getProbabilityMap"); } catch (Exception e) { throw new KiePMMLInternalException(e.getMessage()); } }
KiePMMLRegressionTableClassificationFactory { static void populateGetProbabilityMapMethod(final RegressionModel.NormalizationMethod normalizationMethod, final ClassOrInterfaceDeclaration tableTemplate) { try { String methodName = String.format("get%sProbabilityMap", normalizationMethod.name()); templateEvaluate = getFromFileName(KIE_PMML_GET_PROBABILITY_MAP_METHOD_TEMPLATE_JAVA); cloneEvaluate = templateEvaluate.clone(); ClassOrInterfaceDeclaration evaluateTemplateClass = cloneEvaluate.getClassByName(KIE_PMML_GET_PROBABILITY_MAP_METHOD_TEMPLATE) .orElseThrow(() -> new RuntimeException(MAIN_CLASS_NOT_FOUND)); final MethodDeclaration toReturn = evaluateTemplateClass.getMethodsByName(methodName).get(0); addMethod(toReturn, tableTemplate, "getProbabilityMap"); } catch (Exception e) { throw new KiePMMLInternalException(e.getMessage()); } } }
KiePMMLRegressionTableClassificationFactory { static void populateGetProbabilityMapMethod(final RegressionModel.NormalizationMethod normalizationMethod, final ClassOrInterfaceDeclaration tableTemplate) { try { String methodName = String.format("get%sProbabilityMap", normalizationMethod.name()); templateEvaluate = getFromFileName(KIE_PMML_GET_PROBABILITY_MAP_METHOD_TEMPLATE_JAVA); cloneEvaluate = templateEvaluate.clone(); ClassOrInterfaceDeclaration evaluateTemplateClass = cloneEvaluate.getClassByName(KIE_PMML_GET_PROBABILITY_MAP_METHOD_TEMPLATE) .orElseThrow(() -> new RuntimeException(MAIN_CLASS_NOT_FOUND)); final MethodDeclaration toReturn = evaluateTemplateClass.getMethodsByName(methodName).get(0); addMethod(toReturn, tableTemplate, "getProbabilityMap"); } catch (Exception e) { throw new KiePMMLInternalException(e.getMessage()); } } private  KiePMMLRegressionTableClassificationFactory(); }
KiePMMLRegressionTableClassificationFactory { static void populateGetProbabilityMapMethod(final RegressionModel.NormalizationMethod normalizationMethod, final ClassOrInterfaceDeclaration tableTemplate) { try { String methodName = String.format("get%sProbabilityMap", normalizationMethod.name()); templateEvaluate = getFromFileName(KIE_PMML_GET_PROBABILITY_MAP_METHOD_TEMPLATE_JAVA); cloneEvaluate = templateEvaluate.clone(); ClassOrInterfaceDeclaration evaluateTemplateClass = cloneEvaluate.getClassByName(KIE_PMML_GET_PROBABILITY_MAP_METHOD_TEMPLATE) .orElseThrow(() -> new RuntimeException(MAIN_CLASS_NOT_FOUND)); final MethodDeclaration toReturn = evaluateTemplateClass.getMethodsByName(methodName).get(0); addMethod(toReturn, tableTemplate, "getProbabilityMap"); } catch (Exception e) { throw new KiePMMLInternalException(e.getMessage()); } } private  KiePMMLRegressionTableClassificationFactory(); static Map<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName); static Map.Entry<String, String> getRegressionTable(final LinkedHashMap<String, KiePMMLTableSourceCategory> regressionTablesMap, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName); }
KiePMMLRegressionTableClassificationFactory { static void populateGetProbabilityMapMethod(final RegressionModel.NormalizationMethod normalizationMethod, final ClassOrInterfaceDeclaration tableTemplate) { try { String methodName = String.format("get%sProbabilityMap", normalizationMethod.name()); templateEvaluate = getFromFileName(KIE_PMML_GET_PROBABILITY_MAP_METHOD_TEMPLATE_JAVA); cloneEvaluate = templateEvaluate.clone(); ClassOrInterfaceDeclaration evaluateTemplateClass = cloneEvaluate.getClassByName(KIE_PMML_GET_PROBABILITY_MAP_METHOD_TEMPLATE) .orElseThrow(() -> new RuntimeException(MAIN_CLASS_NOT_FOUND)); final MethodDeclaration toReturn = evaluateTemplateClass.getMethodsByName(methodName).get(0); addMethod(toReturn, tableTemplate, "getProbabilityMap"); } catch (Exception e) { throw new KiePMMLInternalException(e.getMessage()); } } private  KiePMMLRegressionTableClassificationFactory(); static Map<String, KiePMMLTableSourceCategory> getRegressionTables(final List<RegressionTable> regressionTables, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName); static Map.Entry<String, String> getRegressionTable(final LinkedHashMap<String, KiePMMLTableSourceCategory> regressionTablesMap, final RegressionModel.NormalizationMethod normalizationMethod, final OpType opType, final List<KiePMMLOutputField> outputFields, final String targetField, final String packageName); static final String KIE_PMML_REGRESSION_TABLE_CLASSIFICATION_TEMPLATE_JAVA; static final String KIE_PMML_REGRESSION_TABLE_CLASSIFICATION_TEMPLATE; }