Show / Hide Table of Contents

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.

Inheritance
object
TopNAggregator
Implements
IParallelAwareAggregator
IEntryAggregator
IPartialResultAggregator
IPortableObject
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Tangosol.Util.Aggregator
Assembly: Coherence.dll
Syntax
public class TopNAggregator : IParallelAwareAggregator, IEntryAggregator, IPartialResultAggregator, IPortableObject

Constructors

TopNAggregator()

Default constructor.

Declaration
public TopNAggregator()

TopNAggregator(IValueExtractor, IComparer, int)

Construct a TopNAggregator that will aggregate the top extracted values, as determined by the specified comparator.

Declaration
public TopNAggregator(IValueExtractor extractor, IComparer comparer, int cResults)
Parameters
Type Name Description
IValueExtractor extractor

The extractor.

IComparer comparer

The comparer for extracted values.

int cResults

The maximum number of results to return.

Properties

Comparer

The IComparer used by this aggregator.

Declaration
protected IComparer Comparer { get; set; }
Property Value
Type Description
IComparer

Extractor

The ValueExtractor used by this aggregator.

Declaration
protected IValueExtractor Extractor { get; set; }
Property Value
Type Description
IValueExtractor

IsParallel

True iff this aggregator is to be used in parallel.

Declaration
protected bool IsParallel { get; set; }
Property Value
Type Description
bool

ParallelAggregator

Get an aggregator that can take the place of this aggregator in situations in which the IInvocableCache can aggregate in parallel.

Declaration
public virtual IEntryAggregator ParallelAggregator { get; }
Property Value
Type Description
IEntryAggregator

The aggregator that will be run in parallel.

Results

The maximum number of results to include in the aggregation result.

Declaration
protected int Results { get; set; }
Property Value
Type Description
int

Methods

AddToResult(ICollection, PartialResult)

Add the specified values to the result if they are within the top-N.

Declaration
protected void AddToResult(ICollection values, TopNAggregator.PartialResult result)
Parameters
Type Name Description
ICollection values

The collection of values to add.

TopNAggregator.PartialResult result

The result.

Aggregate(ICollection)

Process a set of IInvocableCacheEntry objects in order to produce an aggregated result.

Declaration
public virtual object Aggregate(ICollection entries)
Parameters
Type Name Description
ICollection entries

A collection of read-only IInvocableCacheEntry objects to aggregate.

Returns
Type Description
object

The aggregated result from processing the entries.

AggregatePartialResults(ICollection)

Aggregate the results of the parallel aggregations, producing a partial result logically representing the partial aggregation. The returned partial result will be further {@link ParallelAwareAggregator#aggregateResults aggregated} to produce the final result.

Declaration
public virtual object AggregatePartialResults(ICollection colPartialResults)
Parameters
Type Name Description
ICollection colPartialResults

The partial results to agregate.

Returns
Type Description
object

An aggregattion of the collection of partial results.

AggregateResults(ICollection)

Aggregate the results of the parallel aggregations.

Declaration
public virtual object AggregateResults(ICollection results)
Parameters
Type Name Description
ICollection results

Results to aggregate.

Returns
Type Description
object

The aggregation of the parallel aggregation results.

FinalizeResult(PartialResult)

Finalize the partial aggregation result.

Declaration
protected object[] FinalizeResult(TopNAggregator.PartialResult result)
Parameters
Type Name Description
TopNAggregator.PartialResult result

The final aggregation result.

Returns
Type Description
object[]

The finalized partial aggregation result.

ReadExternal(IPofReader)

Restore the contents of a user type instance by reading its state using the specified IPofReader object.

Declaration
public virtual void ReadExternal(IPofReader reader)
Parameters
Type Name Description
IPofReader reader

The IPofReader from which to read the object's state.

Exceptions
Type Condition
IOException

If an I/O error occurs.

WriteExternal(IPofWriter)

Save the contents of a POF user type instance by writing its state using the specified IPofWriter object.

Declaration
public virtual void WriteExternal(IPofWriter writer)
Parameters
Type Name Description
IPofWriter writer

The IPofWriter to which to write the object's state.

Exceptions
Type Condition
IOException

If an I/O error occurs.

Implements

IParallelAwareAggregator
IEntryAggregator
IPartialResultAggregator
IPortableObject
In this article
Back to top Copyright © 2000, 2024, Oracle and/or its affiliates.