com.amazon.carbonado.cursor
Class DifferenceCursor<S>

java.lang.Object
  extended by com.amazon.carbonado.cursor.AbstractCursor<S>
      extended by com.amazon.carbonado.cursor.DifferenceCursor<S>
All Implemented Interfaces:
Cursor<S>

public class DifferenceCursor<S>
extends AbstractCursor<S>

Wraps two Cursors and performs an asymmetric set difference operation.

Both cursors must return results in the same order. Ordering is preserved by the difference.

Author:
Brian S O'Neill
See Also:
UnionCursor, IntersectionCursor, SymmetricDifferenceCursor

Constructor Summary
DifferenceCursor(Cursor<S> left, Cursor<S> right, Comparator<S> order)
           
 
Method Summary
 void close()
          Call close to release any resources being held by this cursor.
 boolean hasNext()
          Returns true if this cursor has more elements.
 S next()
          Returns the next element from this cursor.
 
Methods inherited from class com.amazon.carbonado.cursor.AbstractCursor
copyInto, copyInto, skipNext, toList, toList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DifferenceCursor

public DifferenceCursor(Cursor<S> left,
                        Cursor<S> right,
                        Comparator<S> order)
Parameters:
left - cursor to wrap
right - cursor to wrap whose results are completely discarded
order - describes sort ordering of wrapped cursors, which must be a total ordering
Method Detail

close

public void close()
           throws FetchException
Description copied from interface: Cursor
Call close to release any resources being held by this cursor. Further operations on this cursor will behave as if there are no results.

Throws:
FetchException

hasNext

public boolean hasNext()
                throws FetchException
Description copied from interface: Cursor
Returns true if this cursor has more elements. In other words, returns true if next would return an element rather than throwing an exception.

Throws:
FetchException - if storage layer throws an exception

next

public S next()
       throws FetchException
Description copied from interface: Cursor
Returns the next element from this cursor. This method may be called repeatedly to iterate through the results.

Throws:
FetchException - if storage layer throws an exception


Copyright © 2006-2009 Amazon Technologies, Inc.. All Rights Reserved.