class InferenceRulesEngine extends AbstractRulesEngine {

    private static final Logger LOGGER = LoggerFactory.getLogger(InferenceRulesEngine.class);

    private final DefaultRulesEngine delegate;

    /**
     * Create a new inference rules engine with default parameters.
     */
    public InferenceRulesEngine() {
        this(new RulesEngineParameters());
    }

    /**
     * Create a new inference rules engine.
     *
     * @param parameters of the engine
     */
    public InferenceRulesEngine(RulesEngineParameters parameters) {
        super(parameters);
        delegate = new DefaultRulesEngine(parameters);
    }

    @Override
    public void fire(Rules rules, Facts facts) {<FILL_FUNCTION_BODY>}

    private Set<Rule> selectCandidates(Rules rules, Facts facts) {
        Set<Rule> candidates = new TreeSet<>();
        for (Rule rule : rules) {
            if (rule.evaluate(facts)) {
                candidates.add(rule);
            }
        }
        return candidates;
    }

    @Override
    public Map<Rule, Boolean> check(Rules rules, Facts facts) {
        Objects.requireNonNull(rules, "Rules must not be null");
        Objects.requireNonNull(facts, "Facts must not be null");
        return delegate.check(rules, facts);
    }

    /**
     * Register a rule listener.
     * @param ruleListener to register
     */
    public void registerRuleListener(RuleListener ruleListener) {
        super.registerRuleListener(ruleListener);
        delegate.registerRuleListener(ruleListener);
    }

    /**
     * Register a list of rule listener.
     * @param ruleListeners to register
     */
    public void registerRuleListeners(List<RuleListener> ruleListeners) {
        super.registerRuleListeners(ruleListeners);
        delegate.registerRuleListeners(ruleListeners);
    }

    /**
     * Register a rules engine listener.
     * @param rulesEngineListener to register
     */
    public void registerRulesEngineListener(RulesEngineListener rulesEngineListener) {
        super.registerRulesEngineListener(rulesEngineListener);
        delegate.registerRulesEngineListener(rulesEngineListener);
    }

    /**
     * Register a list of rules engine listener.
     * @param rulesEngineListeners to register
     */
    public void registerRulesEngineListeners(List<RulesEngineListener> rulesEngineListeners) {
        super.registerRulesEngineListeners(rulesEngineListeners);
        delegate.registerRulesEngineListeners(rulesEngineListeners);
    }
}

        Objects.requireNonNull(rules, "Rules must not be null");
        Objects.requireNonNull(facts, "Facts must not be null");
        Set<Rule> selectedRules;
        do {
            LOGGER.debug("Selecting candidate rules based on the following facts: {}", facts);
            selectedRules = selectCandidates(rules, facts);
            if (!selectedRules.isEmpty()) {
                delegate.fire(new Rules(selectedRules), facts);
            } else {
                LOGGER.debug("No candidate rules found for facts: {}", facts);
            }
        } while (!selectedRules.isEmpty());
    
<methods>public org.jeasy.rules.api.RulesEngineParameters getParameters() ,public List<org.jeasy.rules.api.RuleListener> getRuleListeners() ,public List<org.jeasy.rules.api.RulesEngineListener> getRulesEngineListeners() ,public void registerRuleListener(org.jeasy.rules.api.RuleListener) ,public void registerRuleListeners(List<org.jeasy.rules.api.RuleListener>) ,public void registerRulesEngineListener(org.jeasy.rules.api.RulesEngineListener) ,public void registerRulesEngineListeners(List<org.jeasy.rules.api.RulesEngineListener>) <variables>org.jeasy.rules.api.RulesEngineParameters parameters,List<org.jeasy.rules.api.RuleListener> ruleListeners,List<org.jeasy.rules.api.RulesEngineListener> rulesEngineListeners