use of org.dmg.pmml.SimpleSetPredicateDocument.SimpleSetPredicate.BooleanOperator.Enum in project knime-core by knime.
the class TreeModelPMMLTranslator method setValuesFromPMMLSimpleSetPredicate.
private static void setValuesFromPMMLSimpleSetPredicate(final SimpleSetPredicate to, final PMMLSimpleSetPredicate from) {
to.setField(from.getSplitAttribute());
final Enum operator;
final PMMLSetOperator setOp = from.getSetOperator();
switch(setOp) {
case IS_IN:
operator = SimpleSetPredicate.BooleanOperator.IS_IN;
break;
case IS_NOT_IN:
operator = SimpleSetPredicate.BooleanOperator.IS_NOT_IN;
break;
default:
throw new IllegalStateException("Unknown set operator \"" + setOp + "\".");
}
to.setBooleanOperator(operator);
final Set<String> values = from.getValues();
ArrayType array = to.addNewArray();
array.setN(BigInteger.valueOf(values.size()));
org.w3c.dom.Node arrayNode = array.getDomNode();
arrayNode.appendChild(arrayNode.getOwnerDocument().createTextNode(setToWhitspaceSeparatedString(values)));
final org.dmg.pmml.ArrayType.Type.Enum type;
final PMMLArrayType arrayType = from.getArrayType();
switch(arrayType) {
case INT:
type = ArrayType.Type.INT;
break;
case REAL:
type = ArrayType.Type.REAL;
break;
case STRING:
type = ArrayType.Type.STRING;
break;
default:
throw new IllegalStateException("Unknown array type \"" + arrayType + "\".");
}
array.setType(type);
}
use of org.dmg.pmml.SimpleSetPredicateDocument.SimpleSetPredicate.BooleanOperator.Enum in project knime-core by knime.
the class ConditionExporter method setValuesFromPMMLSimpleSetPredicate.
private void setValuesFromPMMLSimpleSetPredicate(final SimpleSetPredicate to, final PMMLSimpleSetPredicate from) {
to.setField(m_derivedFieldMapper.getDerivedFieldName(from.getSplitAttribute()));
final Enum operator;
final PMMLSetOperator setOp = from.getSetOperator();
switch(setOp) {
case IS_IN:
operator = SimpleSetPredicate.BooleanOperator.IS_IN;
break;
case IS_NOT_IN:
operator = SimpleSetPredicate.BooleanOperator.IS_NOT_IN;
break;
default:
throw new IllegalStateException("Unknown set operator \"" + setOp + "\".");
}
to.setBooleanOperator(operator);
final Set<String> values = from.getValues();
ArrayType array = to.addNewArray();
array.setN(BigInteger.valueOf(values.size()));
org.w3c.dom.Node arrayNode = array.getDomNode();
arrayNode.appendChild(arrayNode.getOwnerDocument().createTextNode(setToWhitspaceSeparatedString(values)));
final org.dmg.pmml.ArrayType.Type.Enum type;
final PMMLArrayType arrayType = from.getArrayType();
switch(arrayType) {
case INT:
type = ArrayType.Type.INT;
break;
case REAL:
type = ArrayType.Type.REAL;
break;
case STRING:
type = ArrayType.Type.STRING;
break;
default:
throw new IllegalStateException("Unknown array type \"" + arrayType + "\".");
}
array.setType(type);
}
Aggregations