public class Handler implements MatchHandler {
private long timeCorrection;
private int totalMatches;
public boolean matchRoot(MatcherContext<?> rootContext) {
rootContext.getMatcher().accept(new DoWithMatcherVisitor(new DoWithMatcherVisitor.Action() {
public void process(Matcher matcher) {
RuleStats ruleStats = (RuleStats) matcher.getTag();
if (ruleStats == null) {
ruleStats = new RuleStats();
matcher.setTag(ruleStats);
} else {
ruleStats.clear();
}
}
}));
totalMatches = 0;
long timeStamp = System.nanoTime() - timeCorrection;
boolean matched = rootContext.runMatcher();
totalNanoTime += System.nanoTime() - timeCorrection - timeStamp;
rootMatcher.accept(new DoWithMatcherVisitor(updateStatsAction));
return matched;
}