@Override public int matchNext(StackFrameList trace, int matchFrom) { if (matchFrom > 0) { // assume that match have been found already return -1; } for (int i = matchFrom; i < trace.depth(); ++i) { if (matcher.evaluate(trace.frameAt(i))) { return i; } } return -1; }
@Override public boolean evaluate(ThreadSnapshot snapshot) { int n = -1; while (true) { int m = matcher.matchNext(snapshot.stackTrace(), n + 1); if (m < 0) { break; } n = m; } if (n >= 0) { StackFrameList remained = snapshot.stackTrace(); remained = remained.fragment(0, n); return tailFilter.evaluate(new ThreadSnapProxy(snapshot, remained)); } else { return false; } }
private StackFrameList mask(StackFrameList stackTrace) { if (maskingRules.isEmpty()) { return stackTrace; } else { StackFrame[] frames = stackTrace.toArray(); for (int i = 0; i != frames.length; ++i) { frames[i] = mask(frames[i]); } return new StackFrameArray(frames); } }