| 
 | Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
   com.tangosol.util.aggregator.TopNAggregator
com.tangosol.util.aggregator.TopNAggregator
public class TopNAggregator
TopNAggregator is a ParallelAwareAggregator that aggregates the top N extracted values into an array. The extracted values must not be null, but do not need to be unique.
| Nested Class Summary | |
|---|---|
| static class | TopNAggregator.PartialResultThe sorted partial result. | 
| Nested classes/interfaces inherited from interface com.tangosol.util.InvocableMap.ParallelAwareAggregator | 
|---|
| InvocableMap.ParallelAwareAggregator.PartialResultAggregator | 
| Field Summary | |
|---|---|
| protected  java.util.Comparator | m_comparatorThe Comparator used to order the extracted values. | 
| protected  int | m_cResultsThe maximum number of results to include in the aggregation result. | 
| protected  ValueExtractor | m_extractorThe ValueExtractor used by this aggregator. | 
| protected  boolean | m_fParallelTrue iff this aggregator is to be used in parallel. | 
| Constructor Summary | |
|---|---|
| TopNAggregator()Default constructor. | |
| TopNAggregator(ValueExtractor extractor, java.util.Comparator comparator, int cResults)Construct a TopNAggregator that will aggregate the top extracted values, as determined by the specified comparator. | |
| Method Summary | |
|---|---|
| protected  void | addToResult(java.util.Iterator iterValues, TopNAggregator.PartialResult result)Add the specified values to the result if they are within the top-N. | 
|  java.lang.Object | aggregate(java.util.Set setEntries)Process a set of InvocableMap.Entry objects in order to produce an aggregated result. | 
|  java.lang.Object | aggregatePartialResults(java.util.Collection colPartialResults)Aggregate the results of the parallel aggregations, producing a partial result logically representing the partial aggregation. | 
|  java.lang.Object | aggregateResults(java.util.Collection colResults)Aggregate the partial results of the parallel aggregations into a final result. | 
| protected  java.lang.Object[] | finalizeResult(TopNAggregator.PartialResult result)Finalize the partial aggregation result. | 
|  InvocableMap.EntryAggregator | getParallelAggregator()Get an aggregator that can take the place of this aggregator in situations in which the InvocableMap can aggregate in parallel. | 
|  void | readExternal(java.io.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. | 
|  void | writeExternal(java.io.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. | 
| Field Detail | 
|---|
protected boolean m_fParallel
protected ValueExtractor m_extractor
protected java.util.Comparator m_comparator
protected int m_cResults
| Constructor Detail | 
|---|
public TopNAggregator()
public TopNAggregator(ValueExtractor extractor,
                      java.util.Comparator comparator,
                      int cResults)
extractor - the extractorcomparator - the comparator for extracted valuescResults - the maximum number of results to return| Method Detail | 
|---|
public InvocableMap.EntryAggregator getParallelAggregator()
If the returned aggregator is a InvocableMap.ParallelAwareAggregator.PartialResultAggregator, the partial results of the parallel aggregation may be further aggregated where optimal.
getParallelAggregator in interface InvocableMap.ParallelAwareAggregatorpublic java.lang.Object aggregateResults(java.util.Collection colResults)
aggregateResults in interface InvocableMap.ParallelAwareAggregatorcolResults - the parallel aggregation resultspublic java.lang.Object aggregate(java.util.Set setEntries)
aggregate in interface InvocableMap.EntryAggregatorsetEntries - a Set of read-only InvocableMap.Entry objects to aggregatepublic java.lang.Object aggregatePartialResults(java.util.Collection colPartialResults)
aggregated to produce the final result.aggregatePartialResults in interface InvocableMap.ParallelAwareAggregator.PartialResultAggregatorcolPartialResults - the partial results
protected void addToResult(java.util.Iterator iterValues,
                           TopNAggregator.PartialResult result)
iterValues - the iterator of values to addresult - the resultprotected java.lang.Object[] finalizeResult(TopNAggregator.PartialResult result)
result - the partial result
public void readExternal(java.io.DataInput in)
                  throws java.io.IOException
readExternal in interface ExternalizableLitein - the DataInput stream to read data from in order to restore the state of this objectjava.io.IOException - if an I/O exception occursjava.io.NotActiveException - if the object is not in its initial state, and therefore cannot be deserialized into
public void writeExternal(java.io.DataOutput out)
                   throws java.io.IOException
writeExternal in interface ExternalizableLiteout - the DataOutput stream to write the state of this object tojava.io.IOException - if an I/O exception occurs
public void readExternal(PofReader in)
                  throws java.io.IOException
readExternal in interface PortableObjectin - the PofReader from which to read the object's statejava.io.IOException - if an I/O error occurs
public void writeExternal(PofWriter out)
                   throws java.io.IOException
writeExternal in interface PortableObjectout - the PofWriter to which to write the object's statejava.io.IOException - if an I/O error occurs| 
 | Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||