@Test public void buildConstraintsString() { KiePMMLFieldOperatorValue kiePMMLFieldOperatorValue = getKiePMMLFieldOperatorValueWithName(); String expected = "value < 35 surrogate value > 85"; String retrieved = kiePMMLFieldOperatorValue.buildConstraintsString(); assertEquals(expected, retrieved); kiePMMLFieldOperatorValue = getKiePMMLFieldOperatorValueWithoutName(); expected = "value < 35 surrogate value > 85"; retrieved = kiePMMLFieldOperatorValue.buildConstraintsString(); assertEquals(expected, retrieved); }
protected String buildConstraintsString() { String operatorString = operator != null ? operator.getCustomOperator() : ""; return kiePMMLOperatorValues.stream().map(KiePMMLOperatorValue::getConstraintsAsString).collect(Collectors.joining(" " + operatorString + " ")); }
KiePMMLFieldOperatorValue { protected String buildConstraintsString() { String operatorString = operator != null ? operator.getCustomOperator() : ""; return kiePMMLOperatorValues.stream().map(KiePMMLOperatorValue::getConstraintsAsString).collect(Collectors.joining(" " + operatorString + " ")); } }
KiePMMLFieldOperatorValue { protected String buildConstraintsString() { String operatorString = operator != null ? operator.getCustomOperator() : ""; return kiePMMLOperatorValues.stream().map(KiePMMLOperatorValue::getConstraintsAsString).collect(Collectors.joining(" " + operatorString + " ")); } KiePMMLFieldOperatorValue(final String name, final BOOLEAN_OPERATOR operator, final List<KiePMMLOperatorValue> kiePMMLOperatorValues, final List<KiePMMLFieldOperatorValue> nestedKiePMMLFieldOperatorValues); }
KiePMMLFieldOperatorValue { protected String buildConstraintsString() { String operatorString = operator != null ? operator.getCustomOperator() : ""; return kiePMMLOperatorValues.stream().map(KiePMMLOperatorValue::getConstraintsAsString).collect(Collectors.joining(" " + operatorString + " ")); } KiePMMLFieldOperatorValue(final String name, final BOOLEAN_OPERATOR operator, final List<KiePMMLOperatorValue> kiePMMLOperatorValues, final List<KiePMMLFieldOperatorValue> nestedKiePMMLFieldOperatorValues); String getName(); BOOLEAN_OPERATOR getOperator(); String getConstraintsAsString(); List<KiePMMLFieldOperatorValue> getNestedKiePMMLFieldOperatorValues(); List<KiePMMLOperatorValue> getKiePMMLOperatorValues(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); }
KiePMMLFieldOperatorValue { protected String buildConstraintsString() { String operatorString = operator != null ? operator.getCustomOperator() : ""; return kiePMMLOperatorValues.stream().map(KiePMMLOperatorValue::getConstraintsAsString).collect(Collectors.joining(" " + operatorString + " ")); } KiePMMLFieldOperatorValue(final String name, final BOOLEAN_OPERATOR operator, final List<KiePMMLOperatorValue> kiePMMLOperatorValues, final List<KiePMMLFieldOperatorValue> nestedKiePMMLFieldOperatorValues); String getName(); BOOLEAN_OPERATOR getOperator(); String getConstraintsAsString(); List<KiePMMLFieldOperatorValue> getNestedKiePMMLFieldOperatorValues(); List<KiePMMLOperatorValue> getKiePMMLOperatorValues(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static final String NO_FIELD_CONSTRAINT_PATTERN; static final String FIELD_CONSTRAINT_PATTERN; }