return result;
}
private Rule nextRule(boolean justApplied) {
Rule next;
if (justApplied) {
lastRule = rule;
}
int lastRuleIndex = rules.indexOf(rule);
if (++lastRuleIndex < rules.size()) {
next = rules.get(lastRuleIndex);
} else if (lastRule == null) { // no more rule and no rule matched
return null;
} else {
next = rules.get(0);
}
next.reset();
if (rule.equals(lastRule) && !justApplied) {
return null;
} else {
return next;