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 2017/10/03 18:15:24 UTC

svn commit: r1811020 - in /uima/uv3/uimaj-v3/trunk: uima-docbook-v3-users-guide/src/docbook/uv3.new_extended_apis.xml uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java

Author: schor
Date: Tue Oct  3 18:15:24 2017
New Revision: 1811020

URL: http://svn.apache.org/viewvc?rev=1811020&view=rev
Log:
[UIMA-5603] support iterable in fsiterator

Modified:
    uima/uv3/uimaj-v3/trunk/uima-docbook-v3-users-guide/src/docbook/uv3.new_extended_apis.xml
    uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java

Modified: uima/uv3/uimaj-v3/trunk/uima-docbook-v3-users-guide/src/docbook/uv3.new_extended_apis.xml
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uima-docbook-v3-users-guide/src/docbook/uv3.new_extended_apis.xml?rev=1811020&r1=1811019&r2=1811020&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uima-docbook-v3-users-guide/src/docbook/uv3.new_extended_apis.xml (original)
+++ uima/uv3/uimaj-v3/trunk/uima-docbook-v3-users-guide/src/docbook/uv3.new_extended_apis.xml Tue Oct  3 18:15:24 2017
@@ -299,6 +299,9 @@ public final static String _FeatName_sof
   <section id="uv3.new_extended_apis.other">
     <title>Other changes</title>
     
+    <para>FSIterator interface now implements Iterable, so you can use these in the extended for syntax.
+      For example: <code>for (TOP item : jcas.getAllIndexedFSs(TOP.class)) ... </code></para>
+    
     <para>The TypeSystemMgr Interface has a variation of the <code>commit</code> method, which has a parameter 
       that specifies the class loader to be used when loading JCas class.  This should be used whenever there are
       user-specified JCas classes associated with the type system.  If not specified, it defaults to the class

Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java?rev=1811020&r1=1811019&r2=1811020&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/FSIterator.java Tue Oct  3 18:15:24 2017
@@ -20,6 +20,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;
@@ -70,7 +71,7 @@ import org.apache.uima.cas.impl.LowLevel
  * {@link FSIterator#moveToLast() moveToLast()} in such cases.
  * 
  */
-public interface FSIterator<T extends FeatureStructure> extends ListIterator<T> {
+public interface FSIterator<T extends FeatureStructure> extends ListIterator<T>, Iterable<T>{
 
   /**
    * Check if this iterator is valid.
@@ -311,4 +312,8 @@ public interface FSIterator<T extends Fe
     ((LowLevelIterator<T>)this).ll_remove();
   } 
 
+  @Override
+  default Iterator<T> iterator() {
+    return this;
+  }
 }