public class SortedCursor<S> extends AbstractCursor<S>
Constructor and Description |
---|
SortedCursor(Cursor<S> cursor,
SortBuffer<S> buffer,
java.lang.Class<S> type,
java.lang.String... orderProperties) |
SortedCursor(Cursor<S> cursor,
SortBuffer<S> buffer,
java.util.Comparator<S> handled,
java.util.Comparator<S> finisher) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Call close to release any resources being held by this cursor.
|
java.util.Comparator<S> |
comparator()
Returns a comparator representing the effective sort order of this cursor.
|
static <S> java.util.Comparator<S> |
createComparator(java.lang.Class<S> type,
java.lang.String... orderProperties)
Convenience method to create a comparator which orders storables by the
given order-by properties.
|
static <S extends Storable> |
createComparator(java.util.List<OrderedProperty<S>> properties)
Convenience method to create a comparator which orders storables by the
given properties.
|
static <S extends Storable> |
createComparator(OrderedProperty<S>... properties)
Convenience method to create a comparator which orders storables by the
given properties.
|
boolean |
hasNext()
Returns true if this cursor has more elements.
|
S |
next()
Returns the next element from this cursor.
|
int |
skipNext(int amount)
Skips forward by the specified amount of elements, returning the actual
amount skipped.
|
copyInto, copyInto, toList, toList
public SortedCursor(Cursor<S> cursor, SortBuffer<S> buffer, java.util.Comparator<S> handled, java.util.Comparator<S> finisher)
cursor
- cursor to wrapbuffer
- required buffer to hold resultshandled
- optional comparator which represents how the results are
already sortedfinisher
- required comparator which finishes the sortpublic SortedCursor(Cursor<S> cursor, SortBuffer<S> buffer, java.lang.Class<S> type, java.lang.String... orderProperties)
cursor
- cursor to wrapbuffer
- required buffer to hold resultstype
- type of storable to create cursor fororderProperties
- list of properties to order byjava.lang.IllegalArgumentException
- if any property is null or not a member
of storable typepublic static <S> java.util.Comparator<S> createComparator(java.lang.Class<S> type, java.lang.String... orderProperties)
type
- type of storable to create comparator fororderProperties
- list of properties to order byjava.lang.IllegalArgumentException
- if any property is null or not a member
of storable typepublic static <S extends Storable> java.util.Comparator<S> createComparator(OrderedProperty<S>... properties)
properties
- list of properties to order byjava.lang.IllegalArgumentException
- if no properties or if any property is nullpublic static <S extends Storable> java.util.Comparator<S> createComparator(java.util.List<OrderedProperty<S>> properties)
properties
- list of properties to order byjava.lang.IllegalArgumentException
- if no properties or if any property is nullpublic java.util.Comparator<S> comparator()
public void close() throws FetchException
Cursor
FetchException
public boolean hasNext() throws FetchException
Cursor
next
would return an element rather than throwing
an exception.FetchException
- if storage layer throws an exceptionpublic S next() throws FetchException
Cursor
FetchException
- if storage layer throws an exceptionpublic int skipNext(int amount) throws FetchException
Cursor
skipNext
in interface Cursor<S>
skipNext
in class AbstractCursor<S>
amount
- maximum amount of elements to skipFetchException
- if storage layer throws an exceptionCopyright © 2006-2013 Amazon Technologies, Inc.. All Rights Reserved.