@Test public void evaluateBooleanSimplePredicate(){ FieldName flag = FieldName.create("flag"); SimplePredicate simplePredicate = new SimplePredicate(flag, SimplePredicate.Operator.EQUAL, "true"); assertEquals(Boolean.TRUE, evaluate(simplePredicate, flag, true)); assertEquals(Boolean.FALSE, evaluate(simplePredicate, flag, false)); simplePredicate.setOperator(SimplePredicate.Operator.NOT_EQUAL); assertEquals(Boolean.FALSE, evaluate(simplePredicate, flag, true)); assertEquals(Boolean.TRUE, evaluate(simplePredicate, flag, false)); simplePredicate.setValue("0.5"); simplePredicate.setOperator(SimplePredicate.Operator.LESS_OR_EQUAL); assertEquals(Boolean.FALSE, evaluate(simplePredicate, flag, true)); assertEquals(Boolean.TRUE, evaluate(simplePredicate, flag, false)); simplePredicate.setOperator(SimplePredicate.Operator.GREATER_THAN); assertEquals(Boolean.TRUE, evaluate(simplePredicate, flag, true)); assertEquals(Boolean.FALSE, evaluate(simplePredicate, flag, false)); }
static public Boolean evaluate(Predicate predicate, EvaluationContext context){ try { return evaluatePredicate(predicate, context); } catch(PMMLException pe){ throw pe.ensureContext(predicate); } }
PredicateUtil { static public Boolean evaluate(Predicate predicate, EvaluationContext context){ try { return evaluatePredicate(predicate, context); } catch(PMMLException pe){ throw pe.ensureContext(predicate); } } }
PredicateUtil { static public Boolean evaluate(Predicate predicate, EvaluationContext context){ try { return evaluatePredicate(predicate, context); } catch(PMMLException pe){ throw pe.ensureContext(predicate); } } private  PredicateUtil(); }
PredicateUtil { static public Boolean evaluate(Predicate predicate, EvaluationContext context){ try { return evaluatePredicate(predicate, context); } catch(PMMLException pe){ throw pe.ensureContext(predicate); } } private  PredicateUtil(); static Predicate ensurePredicate(E hasPredicate); static Boolean evaluatePredicateContainer(E hasPredicate, EvaluationContext context); static Boolean evaluate(Predicate predicate, EvaluationContext context); static Boolean evaluateSimplePredicate(SimplePredicate simplePredicate, EvaluationContext context); static Boolean evaluateSimpleSetPredicate(SimpleSetPredicate simpleSetPredicate, EvaluationContext context); static Boolean evaluateCompoundPredicate(CompoundPredicate compoundPredicate, EvaluationContext context); static CompoundPredicateResult evaluateCompoundPredicateInternal(CompoundPredicate compoundPredicate, EvaluationContext context); static Boolean evaluateTrue(True truePredicate); static Boolean evaluateFalse(False falsePredicate); static Boolean evaluateJavaPredicate(JavaPredicate javaPredicate, EvaluationContext context); static Boolean binaryAnd(Boolean left, Boolean right); static Boolean binaryOr(Boolean left, Boolean right); static Boolean binaryXor(Boolean left, Boolean right); }
PredicateUtil { static public Boolean evaluate(Predicate predicate, EvaluationContext context){ try { return evaluatePredicate(predicate, context); } catch(PMMLException pe){ throw pe.ensureContext(predicate); } } private  PredicateUtil(); static Predicate ensurePredicate(E hasPredicate); static Boolean evaluatePredicateContainer(E hasPredicate, EvaluationContext context); static Boolean evaluate(Predicate predicate, EvaluationContext context); static Boolean evaluateSimplePredicate(SimplePredicate simplePredicate, EvaluationContext context); static Boolean evaluateSimpleSetPredicate(SimpleSetPredicate simpleSetPredicate, EvaluationContext context); static Boolean evaluateCompoundPredicate(CompoundPredicate compoundPredicate, EvaluationContext context); static CompoundPredicateResult evaluateCompoundPredicateInternal(CompoundPredicate compoundPredicate, EvaluationContext context); static Boolean evaluateTrue(True truePredicate); static Boolean evaluateFalse(False falsePredicate); static Boolean evaluateJavaPredicate(JavaPredicate javaPredicate, EvaluationContext context); static Boolean binaryAnd(Boolean left, Boolean right); static Boolean binaryOr(Boolean left, Boolean right); static Boolean binaryXor(Boolean left, Boolean right);  }