JCas cas = stream.getJCas();
DebugRuleMatch drm = null;
if (match.matchedCompletely()) {
drm = new DebugMatchedRuleMatch(cas);
} else {
drm = new DebugFailedRuleMatch(cas);
}
drm.setMatched(match.matchedCompletely());
if (match instanceof RuleMatch) {
ComposedRuleElementMatch rootMatch = ((RuleMatch) match).getRootMatch();
setInnerMatches(stream, addToIndex, cas, drm, rootMatch);