|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tangosol.util.Base
com.tangosol.util.BitHelper
com.tangosol.util.ExternalizableHelper
com.tangosol.util.aggregator.GroupAggregator
public class GroupAggregator
The GroupAggregator provides an ability to split a subset of entries in an
InvocableMap into a collection of non-intersecting subsets and then
aggregate them separately and independently. The splitting (grouping) is
performed using the results of the underlying ValueExtractor in such a way
that two entries will belong to the same group if and only if the result of
the corresponding extract
call produces the
same value or tuple (list of values). After the entries are split into the
groups, the underlying aggregator is applied separately to each group. The
result of the aggregation by the GroupAggregator is a Map that has distinct
values (or tuples) as keys and results of the individual aggregation as
values. Additionally, those results could be further reduced using an
optional Filter object.
DistinctValues
aggregator, which returns back a list of distinct values (tuples) without
performing any additional aggregation work.
Unlike many other concrete EntryAggregator implementations that are
constructed directly, instances of GroupAggregator should only be created
using one of the factory methods:
createInstance(extractor, aggregator)
,
createInstance(extractor, aggregator, filter)
,
createInstance(sMethod, aggregator)
createInstance(sMethod, aggregator, filter)
Nested Class Summary | |
---|---|
static class |
GroupAggregator.Parallel
Parallel implementation of the GroupAggregator. |
Field Summary | |
---|---|
protected InvocableMap.EntryAggregator |
m_aggregator
The underlying EntryAggregator. |
protected ValueExtractor |
m_extractor
The underlying ValueExtractor. |
protected Filter |
m_filter
The Filter object representing the "having" clause of this "group by" aggregator. |
Constructor Summary | |
---|---|
|
GroupAggregator()
Default constructor (necessary for the ExternalizableLite interface). |
protected |
GroupAggregator(ValueExtractor extractor,
InvocableMap.EntryAggregator aggregator,
Filter filter)
Construct a GroupAggregator based on a specified ValueExtractor and underlying EntryAggregator. |
Method Summary | |
---|---|
Object |
aggregate(Set setEntries)
Process a set of InvocableMap Entry objects using the underlying extractor to split the entries into non-intersecting (distinct) groups and then apply the underlying aggregator separately to each group. |
static GroupAggregator |
createInstance(String sMethod,
InvocableMap.EntryAggregator aggregator)
Create an instance of GroupAggregator based on a specified method name(s) and an EntryAggregator . |
static GroupAggregator |
createInstance(String sMethod,
InvocableMap.EntryAggregator aggregator,
Filter filter)
Create an instance of GroupAggregator based on a specified method name(s), an EntryAggregator and a result evaluation filter. |
static GroupAggregator |
createInstance(ValueExtractor extractor,
InvocableMap.EntryAggregator aggregator)
Create an instance of GroupAggregator based on a specified extractor and an EntryAggregator . |
static GroupAggregator |
createInstance(ValueExtractor extractor,
InvocableMap.EntryAggregator aggregator,
Filter filter)
Create an instance of GroupAggregator based on a specified extractor and an EntryAggregator and a result evaluation filter. |
boolean |
equals(Object o)
Compare the GroupAggregator with another object to determine equality. |
InvocableMap.EntryAggregator |
getAggregator()
Obtain the underlying EntryAggregator. |
ValueExtractor |
getExtractor()
Obtain the underlying ValueExtractor. |
int |
hashCode()
Determine a hash value for the GroupAggregator object according to the general Object.hashCode() contract. |
void |
readExternal(DataInput in)
Restore the contents of this object by loading the object's state from the passed DataInput object. |
void |
readExternal(PofReader in)
Restore the contents of a user type instance by reading its state using the specified PofReader object. |
String |
toString()
Return a human-readable description for this GroupAggregator. |
void |
writeExternal(DataOutput out)
Save the contents of this object by storing the object's state into the passed DataOutput object. |
void |
writeExternal(PofWriter out)
Save the contents of a POF user type instance by writing its state using the specified PofWriter object. |
Methods inherited from class com.tangosol.util.BitHelper |
---|
countBits, countBits, countBits, indexOfLSB, indexOfLSB, indexOfLSB, indexOfMSB, indexOfMSB, indexOfMSB, toBitString, toBitString, toBitString |
Field Detail |
---|
protected ValueExtractor m_extractor
protected InvocableMap.EntryAggregator m_aggregator
protected Filter m_filter
Constructor Detail |
---|
public GroupAggregator()
protected GroupAggregator(ValueExtractor extractor, InvocableMap.EntryAggregator aggregator, Filter filter)
extractor
- a ValueExtractor object that is used to split
InvocableMap entries into non-itersecting subsets;
may not be nullaggregator
- an EntryAggregator object; may not be nullfilter
- an optional Filter object used to filter out
results of individual group aggregation resultsMethod Detail |
---|
public Object aggregate(Set setEntries)
aggregate
in interface InvocableMap.EntryAggregator
setEntries
- a Set of read-only InvocableMap Entry objects to
aggregate
public void readExternal(DataInput in) throws IOException
readExternal
in interface ExternalizableLite
in
- the DataInput stream to read data from in order to restore
the state of this object
IOException
- if an I/O exception occurs
NotActiveException
- if the object is not in its initial
state, and therefore cannot be deserialized intopublic void writeExternal(DataOutput out) throws IOException
writeExternal
in interface ExternalizableLite
out
- the DataOutput stream to write the state of this object to
IOException
- if an I/O exception occurspublic void readExternal(PofReader in) throws IOException
readExternal
in interface PortableObject
in
- the PofReader from which to read the object's state
IOException
- if an I/O error occurspublic void writeExternal(PofWriter out) throws IOException
writeExternal
in interface PortableObject
out
- the PofWriter to which to write the object's state
IOException
- if an I/O error occurspublic ValueExtractor getExtractor()
public InvocableMap.EntryAggregator getAggregator()
public boolean equals(Object o)
public int hashCode()
Object.hashCode()
contract.
public String toString()
public static GroupAggregator createInstance(String sMethod, InvocableMap.EntryAggregator aggregator)
EntryAggregator
.
ParallelAwareAggregator
, then a parallel-aware instance of the
GroupAggregator will be created. Otherwise, the resulting
GroupAggregator will not be parallel-aware and could be ill-suited for
aggregations run against large partitioned caches.
sMethod
- a method name or a comma-delimited sequence of names
that results in a ReflectionExtractor
or a MultiExtractor
that will be used to
split InvocableMap entries into distinct groupsaggregator
- an underlying EntryAggregatorpublic static GroupAggregator createInstance(String sMethod, InvocableMap.EntryAggregator aggregator, Filter filter)
EntryAggregator
and a result evaluation filter.
ParallelAwareAggregator
, then a parallel-aware instance of the
GroupAggregator will be created. Otherwise, the resulting
GroupAggregator will not be parallel-aware and could be ill-suited for
aggregations run against large partitioned caches.
sMethod
- a method name or a comma-delimited sequence of names
that results in a ReflectionExtractor
or a MultiExtractor
that will be used to
split InvocableMap entries into distinct groupsaggregator
- an underlying EntryAggregatorfilter
- an optional Filter object that will be used to
evaluate results of each individual group
aggregationpublic static GroupAggregator createInstance(ValueExtractor extractor, InvocableMap.EntryAggregator aggregator)
EntryAggregator
.
ParallelAwareAggregator
, then a parallel-aware instance of the
GroupAggregator will be created. Otherwise, the resulting
GroupAggregator will not be parallel-aware and could be ill-suited for
aggregations run against large partitioned caches.
extractor
- a ValueExtractor that will be used to split a set of
InvocableMap entries into distinct groupsaggregator
- an underlying EntryAggregatorpublic static GroupAggregator createInstance(ValueExtractor extractor, InvocableMap.EntryAggregator aggregator, Filter filter)
EntryAggregator
and a result evaluation filter.
ParallelAwareAggregator
, then a parallel-aware instance of the
GroupAggregator will be created. Otherwise, the resulting
GroupAggregator will not be parallel-aware and could be ill-suited for
aggregations run against large partitioned caches.
extractor
- a ValueExtractor that will be used to split a set of
InvocableMap entries into distinct groupsaggregator
- an underlying EntryAggregatorfilter
- an optional Filter object used to filter out results
of individual group aggregation results
|
CoherenceTM v3.3 Copyright© 2000-2007 by Oracle Corporation |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |