in ConfigurableFeatureExtractor/src/main/java/org/apache/uima/tools/cfe/CommonFeatureMatcher.java [399:470]
void processFeatureAnnotationWindow (JCas jcas,
Annotation enclosing,
AnnotationMatchedValue trg_mv,
TargetAnnotationDescriptor tad,
FeatureObjectMatcher fom,
Collection<AnnotationMatchedValue> allowedAnnotations,
int windowflags,
int windowsize,
boolean advance_right)
throws IllegalArgumentException,
SecurityException,
NoSuchElementException,
ClassNotFoundException,
IllegalAccessException,
NoSuchFieldException,
InvocationTargetException
{
int bl = Integer.MAX_VALUE, bu = -Integer.MAX_VALUE, el = Integer.MAX_VALUE, eu = -Integer.MAX_VALUE;
if (CONSTANT_ANYENCLOSED == (windowflags & CONSTANT_ANYENCLOSED)) {
bl = bu = enclosing.getBegin();
el = eu = enclosing.getEnd();
}
else {
Annotation trg = (Annotation)trg_mv.m_matchedObject;
if (0 != (windowflags & CONSTANT_LEFTLEFT)) {
bl = Math.min(bl, enclosing.getBegin());
bu = Math.max(bu, trg.getBegin());
el = Math.min(el, enclosing.getBegin());
eu = Math.max(eu, trg.getBegin());
}
if (0 != (windowflags & CONSTANT_LEFTINSIDE)) {
bl = Math.min(bl, enclosing.getBegin());
bu = Math.max(bu, trg.getBegin());
el = Math.min(el, trg.getBegin());
eu = Math.max(eu, trg.getEnd());
}
if (0 != (windowflags & CONSTANT_LEFTRIGHT)) {
bl = Math.min(bl, enclosing.getBegin());
bu = Math.max(bu, trg.getBegin());
el = Math.min(el, trg.getEnd());
eu = Math.max(eu, enclosing.getEnd());
}
if (0 != (windowflags & CONSTANT_INSIDEINSIDE)) {
bl = Math.min(bl, trg.getBegin());
bu = Math.max(bu, trg.getEnd());
el = Math.min(el, trg.getBegin());
eu = Math.max(eu, trg.getEnd());
}
if (0 != (windowflags & CONSTANT_INSIDERIGHT)) {
bl = Math.min(bl, trg.getBegin());
bu = Math.max(bu, trg.getEnd());
el = Math.min(el, trg.getEnd());
eu = Math.max(eu, enclosing.getEnd());
}
if (0 != (windowflags & CONSTANT_RIGHTRIGHT)) {
bl = Math.min(bl, trg.getEnd());
bu = Math.max(bu, enclosing.getEnd());
el = Math.min(el, trg.getEnd());
eu = Math.max(eu, enclosing.getEnd());
}
if (Integer.MAX_VALUE == bl) {
throw new IllegalArgumentException("Invalid windowflags: " + windowflags);
}
if ((bl == el) && (bu == eu)) {
bu = bl;
el = eu;
}
}
processFeatureAnnotationWindow(jcas, enclosing, trg_mv, tad, fom, allowedAnnotations,
bl, bu, el, eu, windowsize, advance_right);
}