public class TopCountAggregator<T> :
IAggregator<T, TopCountCache<T>>
{
public string Identity
{
get;
set;
}
public IAggregationResult<T, TopCountCache<T>>
Evaluate(IAggregationResult<T, TopCountCache<T>> oldResult,
IAggregateable aggregateable,
IEnumerable items)
{
var result = new TopCountResult<T>();
foreach (var item in items)
{
var value = (T)aggregateable.GetValue(item);
result.Cache.AddCount(value);
}
return result;
}
public IAggregationResult
Evaluate(IAggregationResult oldResult,
IAggregateable aggregateable,
IEnumerable items)
{
return this.Evaluate((oldResult as TopCountResult<T>),
aggregateable, items);
}
public IAggregationResult<T, TopCountCache<T>>
Evaluate(IAggregationResult<T, TopCountCache<T>> oldResult,
T value)
{
throw new NotImplementedException();
}
public IAggregationResult
Evaluate(IAggregationResult oldResult, object value)
{
throw new NotImplementedException();
}
}