easy-rules icon indicating copy to clipboard operation
easy-rules copied to clipboard

DefaultRulesEngine it's too redundant in simple scenarios.

Open wellCh4n opened this issue 4 years ago • 0 comments

Why not add a simple engine, just execute conditions and actions. eg:

public void fire(Rules rules, Facts facts) {
    if (!rules.isEmpty()) {
        for (Rule rule : rules) {

            boolean evaluationResult;
            try {
                evaluationResult = rule.evaluate(facts);
                if (evaluationResult) {
                    rule.execute(facts);
                    if (this.parameters.isSkipOnFirstAppliedRule()) {
                        break;
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
}

wellCh4n avatar Feb 26 '21 10:02 wellCh4n