KiePMMLScorecardModelCharacteristicASTFactory { protected void declareRuleFromCharacteristic(final Characteristic characteristic, final String parentPath, final List<KiePMMLDroolsRule> rules, final String statusToSet, final boolean isLastCharacteristic) { logger.trace("declareRuleFromCharacteristic {} {}", characteristic, parentPath); String currentRule = String.format(PATH_PATTERN, parentPath, characteristic.getName()); final List<Attribute> attributes = characteristic.getAttributes(); for (int i = 0; i < attributes.size(); i++) { declareRuleFromAttribute(attributes.get(i), currentRule, i, rules, statusToSet, characteristic.getReasonCode(), characteristic.getBaselineScore(), isLastCharacteristic); } } private  KiePMMLScorecardModelCharacteristicASTFactory(final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final List<KiePMMLOutputField> outputFields, final DATA_TYPE targetType); static KiePMMLScorecardModelCharacteristicASTFactory factory(final Map<String, KiePMMLOriginalTypeGeneratedType> fieldTypeMap, final List<KiePMMLOutputField> outputFields, final DATA_TYPE targetType); KiePMMLScorecardModelCharacteristicASTFactory withReasonCodes(Number baselineScore, REASONCODE_ALGORITHM reasonCodeAlgorithm); List<KiePMMLDroolsRule> declareRulesFromCharacteristics(final Characteristics characteristics, final String parentPath, Number initialScore);  }
@Test public void declareRuleFromCharacteristicNotLastCharacteristic() { Characteristic characteristic = getCharacteristic(); final String parentPath = "parent_path"; final List<KiePMMLDroolsRule> rules = new ArrayList<>(); final String statusToSet = "status_to_set"; final boolean isLastCharacteristic = false; String[] expectedConstraints = {"value <= 5.0", "value >= 5.0 && value < 12.0"}; int[] expectedOperatorValuesSizes = {1, 2}; getKiePMMLScorecardModelCharacteristicASTFactory() .declareRuleFromCharacteristic(characteristic, parentPath, rules, statusToSet, isLastCharacteristic); assertEquals(characteristic.getAttributes().size(), rules.size()); for (int i = 0; i < rules.size(); i++) { commonValidateRule(rules.get(i), characteristic.getAttributes().get(i), statusToSet, parentPath + "_AgeScore", i, isLastCharacteristic, 1, null, BOOLEAN_OPERATOR.AND, expectedConstraints[i], expectedOperatorValuesSizes[i] ); } }