@Test public void declareConstraintIn() { List<Object> values = Arrays.asList("-5", "0.5", "1", "10"); String patternType = "INPUT1"; KiePMMLDescrLhsFactory.factory(lhsBuilder).declareConstraintIn(patternType, values); final List<BaseDescr> descrs = lhsBuilder.getDescr().getDescrs(); assertNotNull(descrs); assertEquals(1, descrs.size()); assertTrue(descrs.get(0) instanceof PatternDescr); PatternDescr patternDescr = (PatternDescr) descrs.get(0); assertEquals(patternType, patternDescr.getObjectType()); assertNull(patternDescr.getIdentifier()); assertTrue(patternDescr.getConstraint() instanceof AndDescr); AndDescr andDescr = (AndDescr) patternDescr.getConstraint(); assertEquals(1, andDescr.getDescrs().size()); assertTrue(andDescr.getDescrs().get(0) instanceof ExprConstraintDescr); ExprConstraintDescr exprConstraintDescr = (ExprConstraintDescr) andDescr.getDescrs().get(0); assertFalse(exprConstraintDescr.isNegated()); assertEquals(ExprConstraintDescr.Type.NAMED, exprConstraintDescr.getType()); String expected = "value in (-5, 0.5, 1, 10)"; assertEquals(expected, exprConstraintDescr.getExpression()); }
protected void declareConstraintIn(final String patternType, final List<Object> values) { String constraints = getInNotInConstraint(values); builder.pattern(patternType).constraint(constraints); }
KiePMMLDescrLhsFactory { protected void declareConstraintIn(final String patternType, final List<Object> values) { String constraints = getInNotInConstraint(values); builder.pattern(patternType).constraint(constraints); } }
KiePMMLDescrLhsFactory { protected void declareConstraintIn(final String patternType, final List<Object> values) { String constraints = getInNotInConstraint(values); builder.pattern(patternType).constraint(constraints); } private  KiePMMLDescrLhsFactory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); }
KiePMMLDescrLhsFactory { protected void declareConstraintIn(final String patternType, final List<Object> values) { String constraints = getInNotInConstraint(values); builder.pattern(patternType).constraint(constraints); } private  KiePMMLDescrLhsFactory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); static KiePMMLDescrLhsFactory factory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); void declareLhs(final KiePMMLDroolsRule rule); }
KiePMMLDescrLhsFactory { protected void declareConstraintIn(final String patternType, final List<Object> values) { String constraints = getInNotInConstraint(values); builder.pattern(patternType).constraint(constraints); } private  KiePMMLDescrLhsFactory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); static KiePMMLDescrLhsFactory factory(final CEDescrBuilder<RuleDescrBuilder, AndDescr> builder); void declareLhs(final KiePMMLDroolsRule rule);  }