|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.amazon.carbonado.cursor.AbstractCursor<G>
com.amazon.carbonado.cursor.GroupedCursor<S,G>
S - source type, can be anythingG - aggregate type, can be anythingpublic abstract class GroupedCursor<S,G>
Abstract cursor for aggregation and finding distinct data. The source cursor must be ordered in some fashion by the grouping properties. The arrangement of properties must match, but it does not matter if they are ascending or descending.
SortedCursor| Constructor Summary | |
|---|---|
protected |
GroupedCursor(Cursor<S> cursor,
Class<S> type,
String... groupProperties)
Create a GroupedCursor using properties to define the group comparator. |
protected |
GroupedCursor(Cursor<S> cursor,
Comparator<S> groupComparator)
Create a GroupedCursor with an existing group comparator. |
| Method Summary | |
|---|---|
protected abstract void |
addToGroup(S groupMember)
This method is called when more entries are found for the current group. |
protected abstract void |
beginGroup(S groupLeader)
This method is called for the first entry in a group. |
void |
close()
Call close to release any resources being held by this cursor. |
Comparator<S> |
comparator()
Returns the comparator used to identify group boundaries. |
protected abstract G |
finishGroup()
This method is called when a group is finished, and it can return an aggregate. |
boolean |
hasNext()
Returns true if this cursor has more elements. |
G |
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 |
|---|
protected GroupedCursor(Cursor<S> cursor,
Comparator<S> groupComparator)
cursor - source of elements which must be ordered properlygroupComparator - comparator which defines ordering of source cursor
protected GroupedCursor(Cursor<S> cursor,
Class<S> type,
String... groupProperties)
cursor - source of elements which must be ordered properlytype - type of storable to create cursor forgroupProperties - list of properties to group by
IllegalArgumentException - if any property is null or not a member
of storable type| Method Detail |
|---|
public Comparator<S> comparator()
protected abstract void beginGroup(S groupLeader)
throws FetchException
groupLeader - first entry in group
FetchException
protected abstract void addToGroup(S groupMember)
throws FetchException
groupMember - additional entry in group
FetchException
protected abstract G finishGroup()
throws FetchException
FetchException
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 G next()
throws FetchException
Cursor
FetchException - if storage layer throws an exception
public int skipNext(int amount)
throws FetchException
Cursor
skipNext in interface Cursor<G>skipNext in class AbstractCursor<G>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 | |||||||||