Пример #1
0
        public static object Calculate <T>(IEnumerable <T> source, Func <T, object> selector)
        {
            var summator = new SumAggregator <object>(new IdentityAccessor());

            foreach (var i in source.Select(selector))
            {
                summator.Step(i, null);
            }
            return(summator.Finish());
        }
Пример #2
0
 public AvgAggregator(IAccessor <T> accessor)
     : base(accessor)
 {
     _counter  = new CountAggregator <T>(accessor, true);
     _summator = new SumAggregator <T>(accessor);
 }
 public AvgAggregator(IAccessor <T> accessor, Aggregator <T> counter)
     : base(accessor)
 {
     _counter  = counter;
     _summator = new SumAggregator <T>(accessor);
 }
Пример #4
0
 public RemoteAvgAggregator(IAccessor <T> accessor)
     : base(accessor)
 {
     _countAggregator = new SumAggregator <T>(accessor);
     _valueAggregator = new SumAggregator <T>(accessor);
 }