boolean isFirstSlot = slotIndex == 0;
for (int ei = 0; ei < examples.size(); ei++) {
boolean isFirstExample = ei == 0;
TextRulerExample e = examples.get(ei);
// get stuff between slot slotIndex and slotIndex+1
TextRulerAnnotation slotAnnotation = e.getAnnotations()[slotIndex];
TextRulerAnnotation prevSlotAnnotation;
if (!isFirstSlot)
prevSlotAnnotation = e.getAnnotations()[slotIndex - 1];
else {
if (!isFirstExample)
prevSlotAnnotation = examples.get(ei - 1).getAnnotations()[slotNames.length - 1];
else
prevSlotAnnotation = null;
}
List<AnnotationFS> theTokens;
if (prevSlotAnnotation == null)
theTokens = TextRulerToolkit.getAnnotationsBeforePosition(cas, slotAnnotation.getBegin(),
0, TextRulerToolkit.getFilterSetWithSlotNames(slotNames, filterSet), tokenType);
else
theTokens = TextRulerToolkit.getAnnotationsWithinBounds(cas, prevSlotAnnotation.getEnd(),
slotAnnotation.getBegin(), TextRulerToolkit.getFilterSetWithSlotNames(slotNames,
filterSet), tokenType);
TextRulerRulePattern thePattern = new TextRulerRulePattern();
for (AnnotationFS afs : theTokens)
thePattern.add(new WienRuleItem(new TextRulerAnnotation(afs, doc), true));
if (thePattern.size() > 0)
result.add(thePattern);
}
return result;
}