xxl.cursors
Interface Cursor

All Known Implementing Classes:
AbstractCursor, Aggregator, ArrayCursor, BufferedCursor, DecoratorCursor, Dropper, EmptyCursor, Enumerator, Grouper, IteratorCursor, Mapper, PeekIteratorCursor, Repeater, ReplacementSelection, Skipper, Taker, HashGrouper, Sequentializer, EnumerationCursor, Merger, ResultSetCursor

public abstract interface Cursor
extends PeekIterator

This interface extends the interface PeekIterator. Additional functionality are: update(), close() and reset(). General contract: If an Exception is thrown by a Cursor consequent calls to methods are not guarantied to produce correct results.


Method Summary
 void close()
          Closes the Cursor.
 boolean hasNext()
          Returns true if the iteration has more elements.
 java.lang.Object next()
          Returns the next element in the iteration.
 java.lang.Object peek()
          Shows the next element in the iteration without removing it.
 void remove()
          Removes from the underlying collection the last element returned by the iterator (optional operation).
 void reset()
          Resets the Cursor to its initial state.
 boolean supportsPeek()
          Returns true if the peek operation is supported by this PeekIterator.
 void update(java.lang.Object object)
          Replaces the object that was returned by the last call to next() or peek().
 

Method Detail

close

public void close()
Closes the Cursor. Signals the cursor to cleanup resources, close files, etc. After a call to close() calls to methods like next() or peek() are not guarantied to yield proper results.

hasNext

public boolean hasNext()
Returns true if the iteration has more elements.
Specified by:
hasNext in interface PeekIterator
Returns:
true if the iterator has more elements

next

public java.lang.Object next()
                      throws java.util.NoSuchElementException
Returns the next element in the iteration.
Specified by:
next in interface PeekIterator
Returns:
the next element in the iteration
Throws:
java.util.NoSuchElementException - iteration has no more elements

peek

public java.lang.Object peek()
                      throws java.util.NoSuchElementException,
                             java.lang.UnsupportedOperationException
Shows the next element in the iteration without removing it.
Specified by:
peek in interface PeekIterator
Returns:
the next element in the iteration
Throws:
java.util.NoSuchElementException - iteration has no more elements
java.lang.UnsupportedOperationException - if the peek operation is not supported by this PeekIterator

remove

public void remove()
            throws java.lang.IllegalStateException,
                   java.lang.UnsupportedOperationException
Removes from the underlying collection the last element returned by the iterator (optional operation).
Specified by:
remove in interface PeekIterator
Throws:
java.lang.IllegalStateException - if the next method has not yet been called, or the remove method has already been called after the last call to the next method.
java.lang.UnsupportedOperationException - if the remove operation is not supported by this PeekIterator.

reset

public void reset()
           throws java.lang.UnsupportedOperationException
Resets the Cursor to its initial state.

supportsPeek

public boolean supportsPeek()
Returns true if the peek operation is supported by this PeekIterator.
Specified by:
supportsPeek in interface PeekIterator
Returns:
true if the peek operation is supported by this PeekIterator.

update

public void update(java.lang.Object object)
            throws java.lang.IllegalStateException,
                   java.lang.UnsupportedOperationException
Replaces the object that was returned by the last call to next() or peek(). This operation must not be called after a call to hasNext(). It should follow a call to next() or peek().
Parameters:
object - the object that replaces the object returned by the last call to next() or peek()