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(Objects.equals(FieldValues.MISSING_VALUE, 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);
}
}