use of org.dmg.pmml.SimplePredicateDocument.SimplePredicate in project knime-core by knime.
the class PMMLRuleTranslator method setPredicate.
/**
* For an xml {@link CompoundPredicate} ({@code cp}) sets the parameters based on {@code pred}'s properties.
*
* @param cp An xml {@link CompoundPredicate}.
* @param pred The {@link PMMLPredicate} with the rule version subclasses.
*/
private void setPredicate(final CompoundPredicate cp, final PMMLPredicate pred) {
if (pred instanceof PMMLFalsePredicate) {
cp.addNewFalse();
} else if (pred instanceof PMMLTruePredicate) {
cp.addNewTrue();
} else if (pred instanceof PMMLSimplePredicate) {
PMMLSimplePredicate simple = (PMMLSimplePredicate) pred;
SimplePredicate s = cp.addNewSimplePredicate();
s.setField(simple.getSplitAttribute());
setOperator(s, simple);
s.setValue(simple.getThreshold());
} else if (pred instanceof PMMLCompoundPredicate) {
PMMLCompoundPredicate compound = (PMMLCompoundPredicate) pred;
CompoundPredicate c = cp.addNewCompoundPredicate();
setCompound(c, compound);
} else if (pred instanceof PMMLSimpleSetPredicate) {
PMMLSimpleSetPredicate set = (PMMLSimpleSetPredicate) pred;
SimpleSetPredicate ss = cp.addNewSimpleSetPredicate();
setSetPredicate(ss, set);
}
}
Aggregations