private static void collectFiredRules( ListMultimap<String, SimpleRule> firedRules, Rule rule, EvaluationContext context) { Predicate predicate = rule.getPredicate(); if (predicate == null) { throw new InvalidFeatureException(rule); } Boolean status = PredicateUtil.evaluate(predicate, context); if (status == null || !status.booleanValue()) { return; } // End if if (rule instanceof SimpleRule) { SimpleRule simpleRule = (SimpleRule) rule; firedRules.put(simpleRule.getScore(), simpleRule); } else if (rule instanceof CompoundRule) { CompoundRule compoundRule = (CompoundRule) rule; List<Rule> childRules = compoundRule.getRules(); for (Rule childRule : childRules) { collectFiredRules(firedRules, childRule, context); } } }
private static Boolean parseBoolean(String value) { return Boolean.valueOf(value); }