Search in sources :

Example 1 with GenericOutcome

use of org.knime.base.node.rules.engine.Rule.Outcome.GenericOutcome in project knime-core by knime.

the class StreamingUtil method checkExpressions.

private static boolean checkExpressions(final Rule rule, final Predicate<Expression> check) {
    if (!rule.getCondition().isEnabled()) {
        // comment
        return true;
    }
    if (rule instanceof GenericRule) {
        final GenericRule gr = (GenericRule) rule;
        final Condition condition = gr.getCondition();
        if (condition instanceof GenericCondition) {
            final GenericCondition gc = (GenericCondition) condition;
            final Expression ce = gc.getExpression();
            final Outcome outcome = gr.getOutcome();
            if (outcome instanceof GenericOutcome) {
                final GenericOutcome go = (GenericOutcome) outcome;
                final Expression oe = go.getExpression();
                return check.test(oe) && check.test(ce);
            } else {
                return false;
            }
        } else {
            return false;
        }
    } else {
        return false;
    }
}
Also used : GenericCondition(org.knime.base.node.rules.engine.Condition.GenericCondition) GenericRule(org.knime.base.node.rules.engine.Rule.GenericRule) Outcome(org.knime.base.node.rules.engine.Rule.Outcome) GenericOutcome(org.knime.base.node.rules.engine.Rule.Outcome.GenericOutcome) GenericOutcome(org.knime.base.node.rules.engine.Rule.Outcome.GenericOutcome) GenericCondition(org.knime.base.node.rules.engine.Condition.GenericCondition)

Aggregations

GenericCondition (org.knime.base.node.rules.engine.Condition.GenericCondition)1 GenericRule (org.knime.base.node.rules.engine.Rule.GenericRule)1 Outcome (org.knime.base.node.rules.engine.Rule.Outcome)1 GenericOutcome (org.knime.base.node.rules.engine.Rule.Outcome.GenericOutcome)1