Author: pkluegl
Date: Tue Jan 14 09:46:03 2014
New Revision: 1557996

URL: http://svn.apache.org/r1557996
Log:
UIMA-3539
- moved to Java 1.6, uncommented java 5 methods
- updated parent-pom version

Modified:
    uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java
    
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlVisitor.java
    uima/ruta/trunk/ruta-parent/pom.xml

Modified: 
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java
URL: 
http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java?rev=1557996&r1=1557995&r2=1557996&view=diff
==============================================================================
--- 
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java 
(original)
+++ 
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/RutaStream.java 
Tue Jan 14 09:46:03 2014
@@ -24,6 +24,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Map.Entry;
 import java.util.NoSuchElementException;
 import java.util.Set;
 import java.util.TreeMap;
@@ -158,10 +159,7 @@ public class RutaStream extends FSIterat
         anchors.add(a.getEnd());
       }
       if (anchors.size() == 1) {
-        // for Java 6:
-        // Integer first = anchors.pollFirst();
-        Integer first = anchors.first();
-        anchors.remove(first);
+        Integer first = anchors.pollFirst();
         RutaBasic newTMB = new RutaBasic(getJCas(), first, first);
         newTMB.setLowMemoryProfile(lowMemoryProfile);
         beginAnchors.put(first, newTMB);
@@ -170,10 +168,7 @@ public class RutaStream extends FSIterat
         cas.addFsToIndexes(newTMB);
       } else {
         while (anchors.size() >= 2) {
-          // for Java 6:
-          // Integer first = anchors.pollFirst();
-          Integer first = anchors.first();
-          anchors.remove(first);
+          Integer first = anchors.pollFirst();
           Integer second = anchors.first();
           RutaBasic newTMB = new RutaBasic(getJCas(), first, second);
           newTMB.setLowMemoryProfile(lowMemoryProfile);
@@ -253,18 +248,14 @@ public class RutaStream extends FSIterat
   }
 
   private boolean checkAnchor(int anchor) {
-    // was for Java 6:
-    // Entry<Integer, RutaBasic> floorEntry = endAnchors.floorEntry(anchor);
-    // Entry<Integer, RutaBasic> ceilingEntry = 
endAnchors.ceilingEntry(anchor);
-    // if (floorEntry != null && ceilingEntry != null) {
-    // RutaBasic floor = floorEntry.getValue();
-    // RutaBasic ceiling = ceilingEntry.getValue();
-    RutaBasic floor = getFloor(endAnchors, anchor);
-    if (floor == null) {
-      floor = getFloor(beginAnchors, anchor);
-    }
-    RutaBasic ceiling = getCeiling(endAnchors, anchor);
-    if (floor != null && ceiling != null) {
+    Entry<Integer, RutaBasic> floorEntry = endAnchors.floorEntry(anchor);
+    if (floorEntry == null) {
+      floorEntry = beginAnchors.floorEntry(anchor);
+    }
+    Entry<Integer, RutaBasic> ceilingEntry = endAnchors.ceilingEntry(anchor);
+    if (floorEntry != null && ceilingEntry != null) {
+      RutaBasic floor = floorEntry.getValue();
+      RutaBasic ceiling = ceilingEntry.getValue();
       RutaBasic toSplit = null;
       if (floor.getEnd() > anchor) {
         toSplit = floor;
@@ -513,29 +504,13 @@ public class RutaStream extends FSIterat
       result.add(beginAnchor);
       return result;
     }
-    // was Java 6:
-    // RutaBasic endAnchor = getEndAnchor(windowAnnotation.getEnd());
-    // NavigableSet<RutaBasic> subSet = basics.subSet(beginAnchor, true, 
endAnchor, true);
-
+    RutaBasic endAnchor = getEndAnchor(windowAnnotation.getEnd());
     Collection<RutaBasic> subSet = null;
     if (windowAnnotation.getEnd() == cas.getDocumentAnnotation().getEnd()
             && windowAnnotation.getBegin() == 0) {
       subSet = basics;
-    } else if (windowAnnotation.getEnd() == 
cas.getDocumentAnnotation().getEnd()) {
-      subSet = basics.tailSet(beginAnchor);
     } else {
-      RutaBasic endAnchor1 = getCeiling(endAnchors, windowAnnotation.getEnd() 
+ 1);
-      if (endAnchor1 != null) {
-        subSet = basics.subSet(beginAnchor, endAnchor1);
-      } else {
-        // hotfix for limited window stream with a window on the complete 
document
-        subSet = new LinkedList<RutaBasic>();
-        RutaBasic floor = getFloor(endAnchors, windowAnnotation.getEnd());
-        Collection<RutaBasic> subSetHead = basics.subSet(beginAnchor, floor);
-        RutaBasic endAnchorTail = endAnchors.get(windowAnnotation.getEnd());
-        subSet.addAll(subSetHead);
-        subSet.add(endAnchorTail);
-      }
+      subSet = basics.subSet(beginAnchor, true, endAnchor, true);
     }
     return subSet;
   }
@@ -785,14 +760,14 @@ public class RutaStream extends FSIterat
     RutaBasic beginAnchor = getBeginAnchor(begin);
     for (Type type : currentHiddenTypes) {
       boolean partOf = beginAnchor.isPartOf(type);
-      if(partOf) {
+      if (partOf) {
         return false;
       }
     }
     RutaBasic endAnchor = getEndAnchor(end);
     for (Type type : currentHiddenTypes) {
       boolean partOf = endAnchor.isPartOf(type);
-      if(partOf) {
+      if (partOf) {
         return false;
       }
     }

Modified: 
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlVisitor.java
URL: 
http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlVisitor.java?rev=1557996&r1=1557995&r2=1557996&view=diff
==============================================================================
--- 
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlVisitor.java
 (original)
+++ 
uima/ruta/trunk/ruta-core/src/main/java/org/apache/uima/ruta/engine/HtmlVisitor.java
 Tue Jan 14 09:46:03 2014
@@ -98,10 +98,6 @@ public class HtmlVisitor extends NodeVis
     AnnotationFS found = null;
     for (int i = annotationStack.size() - 1; i >= 0; i--) {
       AnnotationFS each = (AnnotationFS) annotationStack.get(i);
-      // // Java 6:
-      // Iterator<AnnotationFS> descendingIterator = 
annotationStack.descendingIterator();
-      // while (descendingIterator.hasNext()) {
-      // AnnotationFS each = (AnnotationFS) descendingIterator.next();
       Feature nameFeature = each.getType().getFeatureByBaseName("name");
       String eachName = each.getStringValue(nameFeature);
       if (name.equals(eachName)) {

Modified: uima/ruta/trunk/ruta-parent/pom.xml
URL: 
http://svn.apache.org/viewvc/uima/ruta/trunk/ruta-parent/pom.xml?rev=1557996&r1=1557995&r2=1557996&view=diff
==============================================================================
--- uima/ruta/trunk/ruta-parent/pom.xml (original)
+++ uima/ruta/trunk/ruta-parent/pom.xml Tue Jan 14 09:46:03 2014
@@ -24,7 +24,7 @@
   <parent>
     <groupId>org.apache.uima</groupId>
     <artifactId>parent-pom</artifactId>
-    <version>6</version>
+    <version>8</version>
     <relativePath />
   </parent>
 
@@ -148,6 +148,14 @@ Creative Commons Attribution 3.0 License
           <artifactId>uima-build-helper-maven-plugin</artifactId>
           <version>7</version>
         </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <configuration>
+            <source>1.6</source>
+            <target>1.6</target>
+          </configuration>
+        </plugin>
       </plugins>
     </pluginManagement>
   <plugins>


Reply via email to