PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Rhino.Etl.Tests/Aggregation/RowCount.cs

http://github.com/ayende/rhino-etl
C# | 22 lines | 15 code | 2 blank | 5 comment | 2 complexity | 464baa8e91aba690acb58d176f8a03fd MD5 | raw file
 1namespace Rhino.Etl.Tests.Aggregation
 2{
 3    using Core;
 4    using Rhino.Etl.Core.Operations;
 5
 6    public class RowCount : AbstractAggregationOperation
 7    {
 8        /// <summary>
 9        /// Accumulate the current row to the current aggregation
10        /// </summary>
11        /// <param name="row">The row.</param>
12        /// <param name="aggregate">The aggregate.</param>
13        protected override void Accumulate(Row row, Row aggregate)
14        {
15            if (aggregate["count"] == null)
16                aggregate["count"] = 0;
17
18            int count = (int)aggregate["count"];
19            aggregate["count"] = count + 1;
20        }
21    }
22}