PageRenderTime 303ms CodeModel.GetById 140ms app.highlight 2ms RepoModel.GetById 159ms app.codeStats 0ms

/Rhino.Etl.Core/Operations/BranchingOperation.cs

http://github.com/ayende/rhino-etl
C# | 40 lines | 25 code | 6 blank | 9 comment | 2 complexity | 12c75e32b84f305c7c9a01efdd49ac63 MD5 | raw file
 1using System.Linq;
 2using Rhino.Etl.Core.Enumerables;
 3
 4namespace Rhino.Etl.Core.Operations
 5{
 6    using System.Collections.Generic;
 7
 8    /// <summary>
 9    /// Branch the current pipeline flow into all its inputs
10    /// </summary>
11    public class BranchingOperation : AbstractBranchingOperation
12    {
13        /// <summary>
14        /// Executes this operation, sending the input of this operation
15        /// to all its child operations
16        /// </summary>
17        /// <param name="rows">The rows.</param>
18        /// <returns></returns>
19        public override IEnumerable<Row> Execute(IEnumerable<Row> rows)
20        {
21            var copiedRows = new CachingEnumerable<Row>(rows);
22
23            foreach (IOperation operation in Operations)
24            {
25                var cloned = copiedRows.Select(r => r.Clone());
26
27                IEnumerable<Row> enumerable = operation.Execute(cloned);
28
29                if(enumerable==null)
30                    continue;
31
32                IEnumerator<Row> enumerator = enumerable.GetEnumerator();
33#pragma warning disable 642
34                while (enumerator.MoveNext()) ;
35#pragma warning restore 642
36            }
37            yield break;
38        }
39    }
40}