Author: pkluegl
Date: Wed Jan 30 15:04:15 2013
New Revision: 1440448

URL: http://svn.apache.org/viewvc?rev=1440448&view=rev
Log:
no jira -  added hotfix for BLOCK windowing with frame annotations that cover 
the complete window

Modified:
    
uima/sandbox/TextMarker/trunk/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java

Modified: 
uima/sandbox/TextMarker/trunk/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java
URL: 
http://svn.apache.org/viewvc/uima/sandbox/TextMarker/trunk/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java?rev=1440448&r1=1440447&r2=1440448&view=diff
==============================================================================
--- 
uima/sandbox/TextMarker/trunk/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java
 (original)
+++ 
uima/sandbox/TextMarker/trunk/uimaj-textmarker/src/main/java/org/apache/uima/textmarker/TextMarkerStream.java
 Wed Jan 30 15:04:15 2013
@@ -487,7 +487,7 @@ public class TextMarkerStream extends FS
     // TextMarkerBasic endAnchor = getEndAnchor(windowAnnotation.getEnd());
     // NavigableSet<TextMarkerBasic> subSet = basics.subSet(beginAnchor, true, 
endAnchor, true);
 
-    SortedSet<TextMarkerBasic> subSet = null;
+    Collection<TextMarkerBasic> subSet = null;
     if (windowAnnotation.getEnd() == cas.getDocumentAnnotation().getEnd()
             && windowAnnotation.getBegin() == 0) {
       subSet = basics;
@@ -495,29 +495,19 @@ public class TextMarkerStream extends FS
       subSet = basics.tailSet(beginAnchor);
     } else {
       TextMarkerBasic endAnchor1 = getCeiling(endAnchors, 
windowAnnotation.getEnd() + 1);
-      subSet = basics.subSet(beginAnchor, endAnchor1);
+      if (endAnchor1 != null) {
+        subSet = basics.subSet(beginAnchor, endAnchor1);
+      } else {
+        // hotfix for limited window stream with a window on the complete 
document
+        subSet = new LinkedList<TextMarkerBasic>();
+        TextMarkerBasic floor = getFloor(endAnchors, 
windowAnnotation.getEnd());
+        Collection<TextMarkerBasic> subSetHead = basics.subSet(beginAnchor, 
floor);
+        TextMarkerBasic endAnchorTail = 
endAnchors.get(windowAnnotation.getEnd());
+        subSet.addAll(subSetHead);
+        subSet.add(endAnchorTail);
+      }
     }
-
     return subSet;
-    // List<TextMarkerBasic> result = new ArrayList<TextMarkerBasic>();
-    // if (windowAnnotation instanceof TextMarkerBasic) {
-    // result.add((TextMarkerBasic) windowAnnotation);
-    // return result;
-    // } else if (windowAnnotation.getBegin() <=
-    // documentAnnotation.getBegin()
-    // && windowAnnotation.getEnd() >= documentAnnotation.getEnd()) {
-    // return basics;
-    // }
-    // TextMarkerFrame frame = new TextMarkerFrame(getJCas(),
-    // windowAnnotation.getBegin(),
-    // windowAnnotation.getEnd());
-    // FSIterator<AnnotationFS> iterator =
-    // cas.getAnnotationIndex(basicType).subiterator(frame);
-    // while (iterator.isValid()) {
-    // result.add((TextMarkerBasic) iterator.get());
-    // iterator.moveToNext();
-    // }
-    // return result;
   }
 
   public TextMarkerBasic getBasicNextTo(boolean before, AnnotationFS 
annotation) {


Reply via email to