in ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java [1049:1103]
public boolean isVisible(AnnotationFS annotationFS, boolean ignoreWindow) {
if (annotationFS == null) {
return false;
}
if (annotationFS.getBegin() >= annotationFS.getEnd()) {
return false;
}
AnnotationFS windowAnnotation = filter.getWindowAnnotation();
if (!ignoreWindow && windowAnnotation != null
&& (annotationFS.getBegin() < windowAnnotation.getBegin()
|| annotationFS.getEnd() > windowAnnotation.getEnd())) {
return false;
}
int begin = annotationFS.getBegin();
int end = annotationFS.getEnd();
Set<Type> currentHiddenTypes = filter.getCurrentHiddenTypes();
RutaBasic beginAnchor = getBeginAnchor(begin);
if (beginAnchor != null) {
if (beginAnchor.isEmpty() && emptyIsInvisible) {
return false;
}
for (Type type : currentHiddenTypes) {
boolean partOf = beginAnchor.isPartOf(type);
if (partOf) {
return false;
}
}
}
RutaBasic endAnchor = getEndAnchor(end);
if (endAnchor != null) {
if (endAnchor.isEmpty() && emptyIsInvisible) {
return false;
}
for (Type type : currentHiddenTypes) {
boolean partOf = endAnchor.isPartOf(type);
if (partOf) {
return false;
}
}
}
if (beginAnchor == null && endAnchor == null) {
// missing segmentation in RutaBasics maybe because of temp annotation?
Entry<Integer, RutaBasic> floorEntry = beginAnchors.floorEntry(Integer.valueOf(begin));
Entry<Integer, RutaBasic> ceilingEntry = endAnchors.ceilingEntry(Integer.valueOf(end));
if (floorEntry != null && ceilingEntry != null) {
for (Type type : currentHiddenTypes) {
if (floorEntry.getValue().isPartOf(type) || ceilingEntry.getValue().isPartOf(type)) {
return false;
}
}
}
}
return true;
}