You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2016/10/13 15:43:29 UTC

svn commit: r1764710 - /uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java

Author: schor
Date: Thu Oct 13 15:43:28 2016
New Revision: 1764710

URL: http://svn.apache.org/viewvc?rev=1764710&view=rev
Log:
[UIMA-5115] make FSIterator impl Java ListIterator

Modified:
    uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java

Modified: uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java
URL: http://svn.apache.org/viewvc/uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java?rev=1764710&r1=1764709&r2=1764710&view=diff
==============================================================================
--- uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java (original)
+++ uima/uimaj/branches/experiment-v3-jcas/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java Thu Oct 13 15:43:28 2016
@@ -21,6 +21,7 @@ package org.apache.uima.cas;
 
 import java.util.ConcurrentModificationException;
 import java.util.Iterator;
+import java.util.ListIterator;
 import java.util.NoSuchElementException;
 import java.util.Spliterator;
 import java.util.Spliterators;
@@ -71,7 +72,7 @@ import org.apache.uima.cas.impl.LowLevel
  * 
  * 
  */
-public interface FSIterator<T extends FeatureStructure> extends Iterator<T> {
+public interface FSIterator<T extends FeatureStructure> extends ListIterator<T> {
 
   /**
    * Check if this iterator is valid.
@@ -206,9 +207,45 @@ public interface FSIterator<T extends Fe
   default void remove() {
     throw new UnsupportedOperationException();
   } 
+  
+  @Override
+  default boolean hasPrevious() {
+    return isValid();
+  }
+
+  @Override
+  default T previous() {
+    T result = get();
+    moveToPrevious();
+    return result;
 
+  }
+
+  @Override
+  default int nextIndex() {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  default int previousIndex() {
+    throw new UnsupportedOperationException();
+  }
+
+  @Override
+  default void set(T e) {
+    throw new UnsupportedOperationException();
+    
+  }
+
+  @Override
+  default void add(T e) {
+    throw new UnsupportedOperationException();
+    
+  }
+  
   /**
-   * 
+   * Don't use this directly, use select()... spliterator instead where possible.
+   * Otherwise, insure the FSIterator instance can support sized/subsized.
    * @return a split iterator for this iterator, which has the following characteristics
    *   DISTINCT, SIZED, SUBSIZED
    *   
@@ -226,4 +263,6 @@ public interface FSIterator<T extends Fe
   default Stream<T> asStream() {
     return StreamSupport.stream(spliterator(),  false);
   }
+
+  
 }