Java Code Examples for org.dmg.pmml.SimpleSetPredicate#getBooleanOperator()
The following examples show how to use
org.dmg.pmml.SimpleSetPredicate#getBooleanOperator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PredicateInterner.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 5 votes |
@Override public ElementKey createKey(SimpleSetPredicate simpleSetPredicate){ Array array = simpleSetPredicate.getArray(); Object[] content = {simpleSetPredicate.getField(), simpleSetPredicate.getBooleanOperator(), ArrayUtil.getContent(array)}; return new ElementKey(content); }
Example 2
Source File: PredicateUtil.java From jpmml-evaluator with GNU Affero General Public License v3.0 | 5 votes |
static public Boolean evaluateSimpleSetPredicate(SimpleSetPredicate simpleSetPredicate, EvaluationContext context){ FieldName name = simpleSetPredicate.getField(); if(name == null){ throw new MissingAttributeException(simpleSetPredicate, PMMLAttributes.SIMPLESETPREDICATE_FIELD); } SimpleSetPredicate.BooleanOperator booleanOperator = simpleSetPredicate.getBooleanOperator(); if(booleanOperator == null){ throw new MissingAttributeException(simpleSetPredicate, PMMLAttributes.SIMPLESETPREDICATE_BOOLEANOPERATOR); } FieldValue value = context.evaluate(name); if(FieldValueUtil.isMissing(value)){ return null; } Array array = simpleSetPredicate.getArray(); if(array == null){ throw new MissingElementException(simpleSetPredicate, PMMLElements.SIMPLESETPREDICATE_ARRAY); } switch(booleanOperator){ case IS_IN: return value.isIn(simpleSetPredicate); case IS_NOT_IN: return !value.isIn(simpleSetPredicate); default: throw new UnsupportedAttributeException(simpleSetPredicate, booleanOperator); } }