jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdue...@apache.org
Subject svn commit: r1161169 - in /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat: FilterIterator.java SizedIterator.java
Date Wed, 24 Aug 2011 15:50:00 GMT
Author: mduerig
Date: Wed Aug 24 15:49:59 2011
New Revision: 1161169

URL: http://svn.apache.org/viewvc?rev=1161169&view=rev
Log:
 JCR-3062 Move FilterIterator and SizedIterator from package flat to package iterator
 - add dummy sub classes for backward compatibility

Added:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/FilterIterator.java
      - copied, changed from r1161128, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FilterIterator.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/SizedIterator.java
      - copied, changed from r1161128, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/SizedIterator.java

Copied: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/FilterIterator.java
(from r1161128, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FilterIterator.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/FilterIterator.java?p2=jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/FilterIterator.java&p1=jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FilterIterator.java&r1=1161128&r2=1161169&rev=1161169&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/FilterIterator.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/FilterIterator.java
Wed Aug 24 15:49:59 2011
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.jackrabbit.commons.iterator;
+package org.apache.jackrabbit.commons.flat;
 
 import org.apache.jackrabbit.commons.predicate.Predicate;
 
@@ -24,53 +24,18 @@ import java.util.NoSuchElementException;
 /**
  * Iterator filtering out items which do not match a given predicate.
  * @param <T>
+ * @deprecated use {@link org.apache.jackrabbit.commons.iterator.FilterIterator}
  */
-public class FilterIterator<T> implements Iterator<T> {
-    private final Iterator<T> iterator;
-    private final Predicate predicate;
-
-    private T next = null;
+public class FilterIterator<T> extends org.apache.jackrabbit.commons.iterator.FilterIterator<T>
{
 
     /**
      * Create a new filtered iterator based on the given <code>iterator</code>.
      *
      * @param iterator  iterator to filter
-     * @param predicate  only item matching this predicate are included
-     */
-    public FilterIterator(Iterator<T> iterator, Predicate predicate) {
-        super();
-        this.iterator = iterator;
-        this.predicate = predicate;
-    }
-
-    public boolean hasNext() {
-        while (next == null && iterator.hasNext()) {
-            T e = iterator.next();
-            if (predicate.evaluate(e)) {
-                next = e;
-            }
-        }
-
-        return next != null;
-    }
-
-    public T next() {
-        if (hasNext()) {
-            T e = next;
-            next = null;
-            return e;
-        }
-        else {
-            throw new NoSuchElementException();
-        }
-    }
-
-    /**
-     * @throws  UnsupportedOperationException always
-     * @see java.util.Iterator#remove()
+     * @param predicate only item matching this predicate are included
      */
-    public void remove() {
-        throw new UnsupportedOperationException();
+    public FilterIterator(Iterator<T> tIterator, Predicate predicate) {
+        super(tIterator, predicate);
     }
 
 }

Copied: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/SizedIterator.java
(from r1161128, jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/SizedIterator.java)
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/SizedIterator.java?p2=jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/SizedIterator.java&p1=jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/SizedIterator.java&r1=1161128&r2=1161169&rev=1161169&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/SizedIterator.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/flat/SizedIterator.java
Wed Aug 24 15:49:59 2011
@@ -14,22 +14,16 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.jackrabbit.commons.iterator;
+package org.apache.jackrabbit.commons.flat;
 
 import java.util.Iterator;
 
 /**
- * <code>SizedIterator</code> extends {@link Iterator} with a
+ * <code>SizedIterator</code> extends {@link java.util.Iterator} with a
  * <code>getSize</code> method.
  *
  * @param <T> the type of elements of this iterator
+ * @deprecated use {@link org.apache.jackrabbit.commons.iterator.SizedIterator}
  */
-public interface SizedIterator<T> extends Iterator<T> {
-
-    /**
-     * The number of elements of this iterator or -1 if not known.
-     *
-     * @return number of elements.
-     */
-    long getSize();
+public interface SizedIterator<T> extends org.apache.jackrabbit.commons.iterator.SizedIterator<T>
{
 }



Mime
View raw message