RegExpRuleMatch rerm = (RegExpRuleMatch) match;
Map<Integer, List<AnnotationFS>> map = rerm.getMap();
Set<Entry<Integer, List<AnnotationFS>>> entrySet = map.entrySet();
List<DebugRuleElementMatches> ruleElementMatches = new ArrayList<DebugRuleElementMatches>();
for (Entry<Integer, List<AnnotationFS>> entry : entrySet) {
DebugRuleElementMatches drems = new DebugRuleElementMatches(cas);
RegExpRule rule = rerm.getRule();
Integer key = entry.getKey();
List<AnnotationFS> value = entry.getValue();
drems.setElement(verbalizer.verbalize(rule));
List<DebugRuleElementMatch> remList = new ArrayList<DebugRuleElementMatch>();
if (value != null) {
for (AnnotationFS each : value) {
DebugRuleElementMatch drem = new DebugRuleElementMatch(cas);
DebugEvaluatedCondition base = new DebugEvaluatedCondition(cas);
base.setValue(true);
String baseString = "Group " + key;
base.setElement(baseString);
drem.setBaseCondition(base);
drem.setBegin(each.getBegin());
drem.setEnd(each.getEnd());
if (addToIndex) {
drem.addToIndexes();
}
remList.add(drem);
}
}
drems.setMatches(UIMAUtils.toFSArray(cas, remList));
if (addToIndex) {
drems.addToIndexes();
}
ruleElementMatches.add(drems);
}
drm.setElements(UIMAUtils.toFSArray(cas, ruleElementMatches));