|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.amazon.carbonado.cursor.AbstractCursor<S>
com.amazon.carbonado.cursor.SortedCursor<S>
public class SortedCursor<S>
Wraps another Cursor and ensures the results are sorted. If the elements in the source cursor are already partially sorted, a handled comparator can be passed in which specifies the partial ordering. Elements are then processed in smaller chunks rather than sorting the entire set. The handled comparator can represent ascending or descending order of source elements.
| Constructor Summary | |
|---|---|
SortedCursor(Cursor<S> cursor,
SortBuffer<S> buffer,
Class<S> type,
String... orderProperties)
|
|
SortedCursor(Cursor<S> cursor,
SortBuffer<S> buffer,
Comparator<S> handled,
Comparator<S> finisher)
|
|
| Method Summary | ||
|---|---|---|
void |
close()
Call close to release any resources being held by this cursor. |
|
Comparator<S> |
comparator()
Returns a comparator representing the effective sort order of this cursor. |
|
static
|
createComparator(Class<S> type,
String... orderProperties)
Convenience method to create a comparator which orders storables by the given order-by properties. |
|
static
|
createComparator(List<OrderedProperty<S>> properties)
Convenience method to create a comparator which orders storables by the given properties. |
|
static
|
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. |
|
| Methods inherited from class com.amazon.carbonado.cursor.AbstractCursor |
|---|
copyInto, copyInto, toList, toList |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SortedCursor(Cursor<S> cursor,
SortBuffer<S> buffer,
Comparator<S> handled,
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 sort
public SortedCursor(Cursor<S> cursor,
SortBuffer<S> buffer,
Class<S> type,
String... orderProperties)
cursor - cursor to wrapbuffer - required buffer to hold resultstype - type of storable to create cursor fororderProperties - list of properties to order by
IllegalArgumentException - if any property is null or not a member
of storable type| Method Detail |
|---|
public static <S> Comparator<S> createComparator(Class<S> type,
String... orderProperties)
type - type of storable to create comparator fororderProperties - list of properties to order by
IllegalArgumentException - if any property is null or not a member
of storable typepublic static <S extends Storable> Comparator<S> createComparator(OrderedProperty<S>... properties)
properties - list of properties to order by
IllegalArgumentException - if no properties or if any property is nullpublic static <S extends Storable> Comparator<S> createComparator(List<OrderedProperty<S>> properties)
properties - list of properties to order by
IllegalArgumentException - if no properties or if any property is nullpublic Comparator<S> comparator()
public void close()
throws FetchException
Cursor
FetchException
public boolean hasNext()
throws FetchException
Cursornext would return an element rather than throwing
an exception.
FetchException - if storage layer throws an exception
public S next()
throws FetchException
Cursor
FetchException - if storage layer throws an exception
public int skipNext(int amount)
throws FetchException
Cursor
skipNext in interface Cursor<S>skipNext in class AbstractCursor<S>amount - maximum amount of elements to skip
FetchException - if storage layer throws an exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||