jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r543808 - /jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/
Date Sat, 02 Jun 2007 23:24:45 GMT
Author: jukka
Date: Sat Jun  2 16:24:44 2007
New Revision: 543808

URL: http://svn.apache.org/viewvc?view=rev&rev=543808
Log:
JCR-97: Use spaces instead of tabs in o.a.j.commons.iterator

Modified:
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventListenerIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeTypeIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/PropertyIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorDecorator.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RowIteratorAdapter.java
    jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/VersionIteratorAdapter.java

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventIteratorAdapter.java?view=diff&rev=543808&r1=543807&r2=543808
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventIteratorAdapter.java
Sat Jun  2 16:24:44 2007
@@ -29,45 +29,45 @@
  * into {@link EventIterator}s. 
  */
 public class EventIteratorAdapter extends RangeIteratorDecorator
-		implements EventIterator {
+        implements EventIterator {
 
-	/**
-	 * Creates an adapter for the given {@link RangeIterator}.
-	 *
-	 * @param iterator iterator of {@link Event}s
-	 */
-	public EventIteratorAdapter(RangeIterator iterator) {
-		super(iterator);
-	}
+    /**
+     * Creates an adapter for the given {@link RangeIterator}.
+     *
+     * @param iterator iterator of {@link Event}s
+     */
+    public EventIteratorAdapter(RangeIterator iterator) {
+        super(iterator);
+    }
 
-	/**
-	 * Creates an adapter for the given {@link Iterator}.
-	 *
-	 * @param iterator iterator of {@link Event}s.
-	 */
-	public EventIteratorAdapter(Iterator iterator) {
-		super(new RangeIteratorAdapter(iterator));
-	}
+    /**
+     * Creates an adapter for the given {@link Iterator}.
+     *
+     * @param iterator iterator of {@link Event}s.
+     */
+    public EventIteratorAdapter(Iterator iterator) {
+        super(new RangeIteratorAdapter(iterator));
+    }
 
-	/**
-	 * Creates an iterator for the given collection.
-	 *
-	 * @param collection collection of {@link Event}s
-	 */
-	public EventIteratorAdapter(Collection collection) {
-		super(new RangeIteratorAdapter(collection));
-	}
+    /**
+     * Creates an iterator for the given collection.
+     *
+     * @param collection collection of {@link Event}s
+     */
+    public EventIteratorAdapter(Collection collection) {
+        super(new RangeIteratorAdapter(collection));
+    }
 
-	//-------------------------------------------------------< EventIterator >
+    //-------------------------------------------------------< EventIterator >
 
-	/**
-	 * Returns the next event.
-	 *
-	 * @return next event
-	 * @throws NoSuchElementException if there is no next event
-	 */
-	public Event nextEvent() throws NoSuchElementException {
-		return (Event) next();
-	}
+    /**
+     * Returns the next event.
+     *
+     * @return next event
+     * @throws NoSuchElementException if there is no next event
+     */
+    public Event nextEvent() throws NoSuchElementException {
+        return (Event) next();
+    }
 
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventListenerIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventListenerIteratorAdapter.java?view=diff&rev=543808&r1=543807&r2=543808
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventListenerIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/EventListenerIteratorAdapter.java
Sat Jun  2 16:24:44 2007
@@ -29,45 +29,45 @@
  * into {@link EventListenerIterator}s. 
  */
 public class EventListenerIteratorAdapter extends RangeIteratorDecorator
-		implements EventListenerIterator {
+        implements EventListenerIterator {
 
-	/**
-	 * Creates an adapter for the given {@link RangeIterator}.
-	 *
-	 * @param iterator iterator of {@link EventListener}s
-	 */
-	public EventListenerIteratorAdapter(RangeIterator iterator) {
-		super(iterator);
-	}
+    /**
+     * Creates an adapter for the given {@link RangeIterator}.
+     *
+     * @param iterator iterator of {@link EventListener}s
+     */
+    public EventListenerIteratorAdapter(RangeIterator iterator) {
+        super(iterator);
+    }
 
-	/**
-	 * Creates an adapter for the given {@link Iterator}.
-	 *
-	 * @param iterator iterator of {@link EventListener}s
-	 */
-	public EventListenerIteratorAdapter(Iterator iterator) {
-		super(new RangeIteratorAdapter(iterator));
-	}
+    /**
+     * Creates an adapter for the given {@link Iterator}.
+     *
+     * @param iterator iterator of {@link EventListener}s
+     */
+    public EventListenerIteratorAdapter(Iterator iterator) {
+        super(new RangeIteratorAdapter(iterator));
+    }
 
-	/**
-	 * Creates an iterator for the given collection.
-	 *
-	 * @param collection collection of {@link EventListener}s
-	 */
-	public EventListenerIteratorAdapter(Collection collection) {
-		super(new RangeIteratorAdapter(collection));
-	}
+    /**
+     * Creates an iterator for the given collection.
+     *
+     * @param collection collection of {@link EventListener}s
+     */
+    public EventListenerIteratorAdapter(Collection collection) {
+        super(new RangeIteratorAdapter(collection));
+    }
 
-	//-----------------------------------------------< EventListenerIterator >
+    //-----------------------------------------------< EventListenerIterator >
 
-	/**
-	 * Returns the next event listener.
-	 *
-	 * @return next event listener
-	 * @throws NoSuchElementException if there is no next event listener
-	 */
-	public EventListener nextEventListener() {
-		return (EventListener) next();
-	}
+    /**
+     * Returns the next event listener.
+     *
+     * @return next event listener
+     * @throws NoSuchElementException if there is no next event listener
+     */
+    public EventListener nextEventListener() {
+        return (EventListener) next();
+    }
 
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeIteratorAdapter.java?view=diff&rev=543808&r1=543807&r2=543808
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeIteratorAdapter.java
Sat Jun  2 16:24:44 2007
@@ -29,45 +29,45 @@
  * into {@link NodeIterator}s. 
  */
 public class NodeIteratorAdapter extends RangeIteratorDecorator
-		implements NodeIterator {
+        implements NodeIterator {
 
-	/**
-	 * Creates an adapter for the given {@link RangeIterator}.
-	 *
-	 * @param iterator iterator of {@link Node}s
-	 */
-	public NodeIteratorAdapter(RangeIterator iterator) {
-		super(iterator);
-	}
+    /**
+     * Creates an adapter for the given {@link RangeIterator}.
+     *
+     * @param iterator iterator of {@link Node}s
+     */
+    public NodeIteratorAdapter(RangeIterator iterator) {
+        super(iterator);
+    }
 
-	/**
-	 * Creates an adapter for the given {@link Iterator}.
-	 *
-	 * @param iterator iterator of {@link Node}s
-	 */
-	public NodeIteratorAdapter(Iterator iterator) {
-		super(new RangeIteratorAdapter(iterator));
-	}
+    /**
+     * Creates an adapter for the given {@link Iterator}.
+     *
+     * @param iterator iterator of {@link Node}s
+     */
+    public NodeIteratorAdapter(Iterator iterator) {
+        super(new RangeIteratorAdapter(iterator));
+    }
 
-	/**
-	 * Creates an iterator for the given collection.
-	 *
-	 * @param collection collection of {@link Node}s
-	 */
-	public NodeIteratorAdapter(Collection collection) {
-		super(new RangeIteratorAdapter(collection));
-	}
+    /**
+     * Creates an iterator for the given collection.
+     *
+     * @param collection collection of {@link Node}s
+     */
+    public NodeIteratorAdapter(Collection collection) {
+        super(new RangeIteratorAdapter(collection));
+    }
 
-	//--------------------------------------------------------< NodeIterator >
+    //--------------------------------------------------------< NodeIterator >
 
-	/**
-	 * Returns the next node.
-	 *
-	 * @return next node
-	 * @throws NoSuchElementException if there is no next node
-	 */
-	public Node nextNode() throws NoSuchElementException {
-		return (Node) next();
-	}
+    /**
+     * Returns the next node.
+     *
+     * @return next node
+     * @throws NoSuchElementException if there is no next node
+     */
+    public Node nextNode() throws NoSuchElementException {
+        return (Node) next();
+    }
 
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeTypeIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeTypeIteratorAdapter.java?view=diff&rev=543808&r1=543807&r2=543808
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeTypeIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/NodeTypeIteratorAdapter.java
Sat Jun  2 16:24:44 2007
@@ -29,45 +29,45 @@
  * into {@link NodeTypeIterator}s. 
  */
 public class NodeTypeIteratorAdapter extends RangeIteratorDecorator
-		implements NodeTypeIterator {
+        implements NodeTypeIterator {
 
-	/**
-	 * Creates an adapter for the given {@link RangeIterator}.
-	 *
-	 * @param iterator iterator of {@link NodeType}s
-	 */
-	public NodeTypeIteratorAdapter(RangeIterator iterator) {
-		super(iterator);
-	}
+    /**
+     * Creates an adapter for the given {@link RangeIterator}.
+     *
+     * @param iterator iterator of {@link NodeType}s
+     */
+    public NodeTypeIteratorAdapter(RangeIterator iterator) {
+        super(iterator);
+    }
 
-	/**
-	 * Creates an adapter for the given {@link Iterator}.
-	 *
-	 * @param iterator iterator of {@link NodeType}s
-	 */
-	public NodeTypeIteratorAdapter(Iterator iterator) {
-		super(new RangeIteratorAdapter(iterator));
-	}
+    /**
+     * Creates an adapter for the given {@link Iterator}.
+     *
+     * @param iterator iterator of {@link NodeType}s
+     */
+    public NodeTypeIteratorAdapter(Iterator iterator) {
+        super(new RangeIteratorAdapter(iterator));
+    }
 
-	/**
-	 * Creates an iterator for the given collection.
-	 *
-	 * @param collection collection of {@link NodeType}s
-	 */
-	public NodeTypeIteratorAdapter(Collection collection) {
-		super(new RangeIteratorAdapter(collection));
-	}
+    /**
+     * Creates an iterator for the given collection.
+     *
+     * @param collection collection of {@link NodeType}s
+     */
+    public NodeTypeIteratorAdapter(Collection collection) {
+        super(new RangeIteratorAdapter(collection));
+    }
 
-	//----------------------------------------------------< NodeTypeIterator >
+    //----------------------------------------------------< NodeTypeIterator >
 
-	/**
-	 * Returns the next node type.
-	 *
-	 * @return next node type
-	 * @throws NoSuchElementException if there is no next node type
-	 */
-	public NodeType nextNodeType() throws NoSuchElementException {
-		return (NodeType) next();
-	}
+    /**
+     * Returns the next node type.
+     *
+     * @return next node type
+     * @throws NoSuchElementException if there is no next node type
+     */
+    public NodeType nextNodeType() throws NoSuchElementException {
+        return (NodeType) next();
+    }
 
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/PropertyIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/PropertyIteratorAdapter.java?view=diff&rev=543808&r1=543807&r2=543808
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/PropertyIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/PropertyIteratorAdapter.java
Sat Jun  2 16:24:44 2007
@@ -29,45 +29,45 @@
  * into {@link PropertyIterator}s. 
  */
 public class PropertyIteratorAdapter extends RangeIteratorDecorator
-		implements PropertyIterator {
+        implements PropertyIterator {
 
-	/**
-	 * Creates an adapter for the given {@link RangeIterator}.
-	 *
-	 * @param iterator iterator of {@link Property} instances
-	 */
-	public PropertyIteratorAdapter(RangeIterator iterator) {
-		super(iterator);
-	}
+    /**
+     * Creates an adapter for the given {@link RangeIterator}.
+     *
+     * @param iterator iterator of {@link Property} instances
+     */
+    public PropertyIteratorAdapter(RangeIterator iterator) {
+        super(iterator);
+    }
 
-	/**
-	 * Creates an adapter for the given {@link Iterator}.
-	 *
-	 * @param iterator iterator of {@link Property} instances
-	 */
-	public PropertyIteratorAdapter(Iterator iterator) {
-		super(new RangeIteratorAdapter(iterator));
-	}
+    /**
+     * Creates an adapter for the given {@link Iterator}.
+     *
+     * @param iterator iterator of {@link Property} instances
+     */
+    public PropertyIteratorAdapter(Iterator iterator) {
+        super(new RangeIteratorAdapter(iterator));
+    }
 
-	/**
-	 * Creates an iterator for the given collection.
-	 *
-	 * @param collection collection of {@link Property} instances
-	 */
-	public PropertyIteratorAdapter(Collection collection) {
-		super(new RangeIteratorAdapter(collection));
-	}
+    /**
+     * Creates an iterator for the given collection.
+     *
+     * @param collection collection of {@link Property} instances
+     */
+    public PropertyIteratorAdapter(Collection collection) {
+        super(new RangeIteratorAdapter(collection));
+    }
 
-	//----------------------------------------------------< PropertyIterator >
+    //----------------------------------------------------< PropertyIterator >
 
-	/**
-	 * Returns the next property.
-	 *
-	 * @return next property
-	 * @throws NoSuchElementException if there is no next property
-	 */
-	public Property nextProperty() {
-		return (Property) next();
-	}
+    /**
+     * Returns the next property.
+     *
+     * @return next property
+     * @throws NoSuchElementException if there is no next property
+     */
+    public Property nextProperty() {
+        return (Property) next();
+    }
 
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter.java?view=diff&rev=543808&r1=543807&r2=543808
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorAdapter.java
Sat Jun  2 16:24:44 2007
@@ -29,144 +29,144 @@
  */
 public class RangeIteratorAdapter implements RangeIterator {
 
-	/**
-	 * The adapted iterator instance.
-	 */
-	private final Iterator iterator;
-
-	/**
-	 * Number of elements in the adapted iterator, or -1 if unknown.
-	 */
-	private long size;
-
-	/**
-	 * Current position of the iterator.
-	 */
-	private long position;
-
-	/**
-	 * Creates an adapter for the given iterator of the given size.
-	 *
-	 * @param iterator adapted iterator
-	 * @param size size of the iterator, or -1 if unknown
-	 */
-	public RangeIteratorAdapter(Iterator iterator, long size) {
-		this.iterator = iterator;
-		this.size = size;
-		this.position = 0;
-	}
-
-	/**
-	 * Creates an adapter for the given iterator of unknown size.
-	 *
-	 * @param iterator adapted iterator
-	 */
-	public RangeIteratorAdapter(Iterator iterator) {
-		this(iterator, -1);
-	}
-
-	/**
-	 * Creates a {@link RangeIterator} for the given collection.
-	 *
-	 * @param collection the collection to iterate
-	 */
-	public RangeIteratorAdapter(Collection collection) {
-		this(collection.iterator(), collection.size());
-	}
-
-	//-------------------------------------------------------< RangeIterator >
-
-	/**
-	 * Returns the current position of the iterator.
-	 *
-	 * @return iterator position
-	 */
-	public long getPosition() {
-		return position;
-	}
-
-	/**
-	 * Returns the size of the iterator.
-	 *
-	 * @return iterator size, or -1 if unknown
-	 */
-	public long getSize() {
-		return size;
-	}
-
-	/**
-	 * Skips the given number of elements.
-	 *
-	 * @param n number of elements to skip
-	 * @throws IllegalArgumentException if n is negative
-	 * @throws NoSuchElementException if skipped past the last element
-	 */
-	public void skip(long n)
-			throws IllegalArgumentException, NoSuchElementException {
-		if (n < 0) {
-			throw new IllegalArgumentException("skip(" + n + ")");
-		}
-		for (long i = 0; i < n; i++) {
-			next();
-		}
-	}
-
-	//------------------------------------------------------------< Iterator >
-
-	/**
-	 * Checks if this iterator has more elements. If there are no more
-	 * elements and the size of the iterator is unknown, then the size is
-	 * set to the current position. 
-	 *
-	 * @return <code>true</code> if this iterator has more elements,
-	 *         <code>false</code> otherwise
-	 */
-	public boolean hasNext() {
-		if (iterator.hasNext()) {
-			return true;
-		} else {
-			if (size == -1) {
-				size = position;
-			}
-			return false;
-		}
-	}
-
-	/**
-	 * Returns the next element in this iterator and advances the iterator
-	 * position. If there are no more elements and the size of the iterator
-	 * is unknown, then the size is set to the current position.
-	 *
-	 * @return next element
-	 * @throws NoSuchElementException if there are no more elements
-	 */
-	public Object next() throws NoSuchElementException {
-		try {
-			Object next = iterator.next();
-			position++;
-			return next;
-		} catch (NoSuchElementException e) {
-			if (size == -1) {
-				size = position;
-			}
-			throw e;
-		}
-	}
-
-	/**
-	 * Removes the previously retrieved element. Decreases the current
-	 * position and size of this iterator.
-	 *
-	 * @throws UnsupportedOperationException if removes are not permitted
-	 * @throws IllegalStateException if there is no previous element to remove
-	 */
-	public void remove()
-			throws UnsupportedOperationException, IllegalStateException {
-		iterator.remove();
-		position--;
-		if (size != -1) {
-			size--;
-		}
-	}
+    /**
+     * The adapted iterator instance.
+     */
+    private final Iterator iterator;
+
+    /**
+     * Number of elements in the adapted iterator, or -1 if unknown.
+     */
+    private long size;
+
+    /**
+     * Current position of the iterator.
+     */
+    private long position;
+
+    /**
+     * Creates an adapter for the given iterator of the given size.
+     *
+     * @param iterator adapted iterator
+     * @param size size of the iterator, or -1 if unknown
+     */
+    public RangeIteratorAdapter(Iterator iterator, long size) {
+        this.iterator = iterator;
+        this.size = size;
+        this.position = 0;
+    }
+
+    /**
+     * Creates an adapter for the given iterator of unknown size.
+     *
+     * @param iterator adapted iterator
+     */
+    public RangeIteratorAdapter(Iterator iterator) {
+        this(iterator, -1);
+    }
+
+    /**
+     * Creates a {@link RangeIterator} for the given collection.
+     *
+     * @param collection the collection to iterate
+     */
+    public RangeIteratorAdapter(Collection collection) {
+        this(collection.iterator(), collection.size());
+    }
+
+    //-------------------------------------------------------< RangeIterator >
+
+    /**
+     * Returns the current position of the iterator.
+     *
+     * @return iterator position
+     */
+    public long getPosition() {
+        return position;
+    }
+
+    /**
+     * Returns the size of the iterator.
+     *
+     * @return iterator size, or -1 if unknown
+     */
+    public long getSize() {
+        return size;
+    }
+
+    /**
+     * Skips the given number of elements.
+     *
+     * @param n number of elements to skip
+     * @throws IllegalArgumentException if n is negative
+     * @throws NoSuchElementException if skipped past the last element
+     */
+    public void skip(long n)
+    throws IllegalArgumentException, NoSuchElementException {
+        if (n < 0) {
+            throw new IllegalArgumentException("skip(" + n + ")");
+        }
+        for (long i = 0; i < n; i++) {
+            next();
+        }
+    }
+
+    //------------------------------------------------------------< Iterator >
+
+    /**
+     * Checks if this iterator has more elements. If there are no more
+     * elements and the size of the iterator is unknown, then the size is
+     * set to the current position. 
+     *
+     * @return <code>true</code> if this iterator has more elements,
+     *         <code>false</code> otherwise
+     */
+    public boolean hasNext() {
+        if (iterator.hasNext()) {
+            return true;
+        } else {
+            if (size == -1) {
+                size = position;
+            }
+            return false;
+        }
+    }
+
+    /**
+     * Returns the next element in this iterator and advances the iterator
+     * position. If there are no more elements and the size of the iterator
+     * is unknown, then the size is set to the current position.
+     *
+     * @return next element
+     * @throws NoSuchElementException if there are no more elements
+     */
+    public Object next() throws NoSuchElementException {
+        try {
+            Object next = iterator.next();
+            position++;
+            return next;
+        } catch (NoSuchElementException e) {
+            if (size == -1) {
+                size = position;
+            }
+            throw e;
+        }
+    }
+
+    /**
+     * Removes the previously retrieved element. Decreases the current
+     * position and size of this iterator.
+     *
+     * @throws UnsupportedOperationException if removes are not permitted
+     * @throws IllegalStateException if there is no previous element to remove
+     */
+    public void remove()
+    throws UnsupportedOperationException, IllegalStateException {
+        iterator.remove();
+        position--;
+        if (size != -1) {
+            size--;
+        }
+    }
 
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorDecorator.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorDecorator.java?view=diff&rev=543808&r1=543807&r2=543808
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorDecorator.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RangeIteratorDecorator.java
Sat Jun  2 16:24:44 2007
@@ -25,81 +25,81 @@
  */
 public class RangeIteratorDecorator implements RangeIterator {
 
-	/**
-	 * The decorated iterator.
-	 */
-	private final RangeIterator iterator;
-
-	/**
-	 * Creates a decorated iterator. Protected since this class is only
-	 * useful when subclassed.
-	 *
-	 * @param iterator the iterator to be decorated
-	 */
-	protected RangeIteratorDecorator(RangeIterator iterator) {
-		this.iterator = iterator;
-	}
-
-	//-------------------------------------------------------< RangeIterator >
-
-	/**
-	 * Delegated to the underlying iterator.
-	 *
-	 * @return iterator position
-	 */
-	public long getPosition() {
-		return iterator.getPosition();
-	}
-
-	/**
-	 * Delegated to the underlying iterator.
-	 *
-	 * @return iterator size
-	 */
-	public long getSize() {
-		return iterator.getSize();
-	}
-
-	/**
-	 * Delegated to the underlying iterator.
-	 *
-	 * @param n number of elements to skip
-	 * @throws NoSuchElementException if skipped past the last element
-	 */
-	public void skip(long n) throws NoSuchElementException {
-		iterator.skip(n);
-	}
-
-	//------------------------------------------------------------< Iterator >
-
-	/**
-	 * Delegated to the underlying iterator.
-	 *
-	 * @return <code>true</code> if the iterator has more elements,
-	 *         <code>false</code> otherwise
-	 */
-	public boolean hasNext() {
-		return iterator.hasNext();
-	}
-
-	/**
-	 * Delegated to the underlying iterator.
-	 *
-	 * @return next element
-	 * @throws NoSuchElementException if there are no more elements
-	 */
-	public Object next() throws NoSuchElementException {
-		return iterator.next();
-	}
-
-	/**
-	 * Delegated to the underlying iterator.
-	 *
-	 * @throws UnsupportedOperationException if the operation is not supported
-	 * @throws IllegalStateException if there is no element to be removed
-	 */
-	public void remove()
-			throws UnsupportedOperationException, IllegalStateException {
-		iterator.remove();
-	}
+    /**
+     * The decorated iterator.
+     */
+    private final RangeIterator iterator;
+
+    /**
+     * Creates a decorated iterator. Protected since this class is only
+     * useful when subclassed.
+     *
+     * @param iterator the iterator to be decorated
+     */
+    protected RangeIteratorDecorator(RangeIterator iterator) {
+        this.iterator = iterator;
+    }
+
+    //-------------------------------------------------------< RangeIterator >
+
+    /**
+     * Delegated to the underlying iterator.
+     *
+     * @return iterator position
+     */
+    public long getPosition() {
+        return iterator.getPosition();
+    }
+
+    /**
+     * Delegated to the underlying iterator.
+     *
+     * @return iterator size
+     */
+    public long getSize() {
+        return iterator.getSize();
+    }
+
+    /**
+     * Delegated to the underlying iterator.
+     *
+     * @param n number of elements to skip
+     * @throws NoSuchElementException if skipped past the last element
+     */
+    public void skip(long n) throws NoSuchElementException {
+        iterator.skip(n);
+    }
+
+    //------------------------------------------------------------< Iterator >
+
+    /**
+     * Delegated to the underlying iterator.
+     *
+     * @return <code>true</code> if the iterator has more elements,
+     *         <code>false</code> otherwise
+     */
+    public boolean hasNext() {
+        return iterator.hasNext();
+    }
+
+    /**
+     * Delegated to the underlying iterator.
+     *
+     * @return next element
+     * @throws NoSuchElementException if there are no more elements
+     */
+    public Object next() throws NoSuchElementException {
+        return iterator.next();
+    }
+
+    /**
+     * Delegated to the underlying iterator.
+     *
+     * @throws UnsupportedOperationException if the operation is not supported
+     * @throws IllegalStateException if there is no element to be removed
+     */
+    public void remove()
+    throws UnsupportedOperationException, IllegalStateException {
+        iterator.remove();
+    }
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RowIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RowIteratorAdapter.java?view=diff&rev=543808&r1=543807&r2=543808
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RowIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/RowIteratorAdapter.java
Sat Jun  2 16:24:44 2007
@@ -29,45 +29,45 @@
  * into {@link RowIterator}s. 
  */
 public class RowIteratorAdapter extends RangeIteratorDecorator
-		implements RowIterator {
+        implements RowIterator {
 
-	/**
-	 * Creates an adapter for the given {@link RangeIterator}.
-	 *
-	 * @param iterator iterator of {@link Row}s
-	 */
-	public RowIteratorAdapter(RangeIterator iterator) {
-		super(iterator);
-	}
+    /**
+     * Creates an adapter for the given {@link RangeIterator}.
+     *
+     * @param iterator iterator of {@link Row}s
+     */
+    public RowIteratorAdapter(RangeIterator iterator) {
+        super(iterator);
+    }
 
-	/**
-	 * Creates an adapter for the given {@link Iterator}.
-	 *
-	 * @param iterator iterator of {@link Row}s
-	 */
-	public RowIteratorAdapter(Iterator iterator) {
-		super(new RangeIteratorAdapter(iterator));
-	}
+    /**
+     * Creates an adapter for the given {@link Iterator}.
+     *
+     * @param iterator iterator of {@link Row}s
+     */
+    public RowIteratorAdapter(Iterator iterator) {
+        super(new RangeIteratorAdapter(iterator));
+    }
 
-	/**
-	 * Creates an iterator for the given collection.
-	 *
-	 * @param collection collection of {@link Row}s
-	 */
-	public RowIteratorAdapter(Collection collection) {
-		super(new RangeIteratorAdapter(collection));
-	}
+    /**
+     * Creates an iterator for the given collection.
+     *
+     * @param collection collection of {@link Row}s
+     */
+    public RowIteratorAdapter(Collection collection) {
+        super(new RangeIteratorAdapter(collection));
+    }
 
-	//---------------------------------------------------------< RowIterator >
+    //---------------------------------------------------------< RowIterator >
 
-	/**
-	 * Returns the next row.
-	 *
-	 * @return next row
-	 * @throws NoSuchElementException if there is no next row
-	 */
-	public Row nextRow() {
-		return (Row) next();
-	}
+    /**
+     * Returns the next row.
+     *
+     * @return next row
+     * @throws NoSuchElementException if there is no next row
+     */
+    public Row nextRow() {
+        return (Row) next();
+    }
 
 }

Modified: jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/VersionIteratorAdapter.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/VersionIteratorAdapter.java?view=diff&rev=543808&r1=543807&r2=543808
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/VersionIteratorAdapter.java
(original)
+++ jackrabbit/trunk/jackrabbit-jcr-commons/src/main/java/org/apache/jackrabbit/commons/iterator/VersionIteratorAdapter.java
Sat Jun  2 16:24:44 2007
@@ -29,45 +29,45 @@
  * into {@link VersionIterator}s. 
  */
 public class VersionIteratorAdapter extends RangeIteratorDecorator
-		implements VersionIterator {
+        implements VersionIterator {
 
-	/**
-	 * Creates an adapter for the given {@link RangeIterator}.
-	 *
-	 * @param iterator iterator of {@link Version}s
-	 */
-	public VersionIteratorAdapter(RangeIterator iterator) {
-		super(iterator);
-	}
+    /**
+     * Creates an adapter for the given {@link RangeIterator}.
+     *
+     * @param iterator iterator of {@link Version}s
+     */
+    public VersionIteratorAdapter(RangeIterator iterator) {
+        super(iterator);
+    }
 
-	/**
-	 * Creates an adapter for the given {@link Iterator}.
-	 *
-	 * @param iterator iterator of {@link Version}s
-	 */
-	public VersionIteratorAdapter(Iterator iterator) {
-		super(new RangeIteratorAdapter(iterator));
-	}
+    /**
+     * Creates an adapter for the given {@link Iterator}.
+     *
+     * @param iterator iterator of {@link Version}s
+     */
+    public VersionIteratorAdapter(Iterator iterator) {
+        super(new RangeIteratorAdapter(iterator));
+    }
 
-	/**
-	 * Creates an iterator for the given collection.
-	 *
-	 * @param collection collection of {@link Version}s
-	 */
-	public VersionIteratorAdapter(Collection collection) {
-		super(new RangeIteratorAdapter(collection));
-	}
+    /**
+     * Creates an iterator for the given collection.
+     *
+     * @param collection collection of {@link Version}s
+     */
+    public VersionIteratorAdapter(Collection collection) {
+        super(new RangeIteratorAdapter(collection));
+    }
 
-	//-----------------------------------------------------< VersionIterator >
+    //-----------------------------------------------------< VersionIterator >
 
-	/**
-	 * Returns the next version.
-	 *
-	 * @return next version
-	 * @throws NoSuchElementException if there is no next version
-	 */
-	public Version nextVersion() {
-		return (Version) next();
-	}
+    /**
+     * Returns the next version.
+     *
+     * @return next version
+     * @throws NoSuchElementException if there is no next version
+     */
+    public Version nextVersion() {
+        return (Version) next();
+    }
 
 }



Mime
View raw message