Exemplo n.º 1
0
  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);
      }
    }
  }
Exemplo n.º 2
0
 /** Returns <code>true</code> if this cluster is the {@link #OTHER_TOPICS} cluster. */
 public boolean isOtherTopics() {
   final Boolean otherTopics = getAttribute(OTHER_TOPICS);
   return otherTopics != null && otherTopics.booleanValue();
 }