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

/Rhino.Etl.Dsl/Macros/AccumulateMacro.cs

http://github.com/ayende/rhino-etl
C# | 39 lines | 23 code | 5 blank | 11 comment | 0 complexity | 5c03373922a09817e9f35c3d43979449 MD5 | raw file
 1namespace Rhino.Etl.Dsl.Macros
 2{
 3    using Boo.Lang.Compiler.Ast;
 4    using Core;
 5    using Rhino.Etl.Core.Operations;
 6
 7    /// <summary>
 8    /// Generate the <see cref="AbstractAggregationOperation.Accumulate"/> method
 9    /// </summary>
10    public class AccumulateMacro : AbstractChildMacro
11    {
12        /// <summary>
13        /// Initializes a new instance of the <see cref="AccumulateMacro"/> class.
14        /// </summary>
15        public AccumulateMacro()
16            : base("aggregate")
17        {
18        }
19
20        /// <summary>
21        /// Perform the actual expansion of the macro
22        /// </summary>
23        /// <param name="macro">The macro.</param>
24        /// <returns></returns>
25        protected override Statement DoExpand(MacroStatement macro)
26        {
27            Method accumulate = new Method("Accumulate");
28            accumulate.Modifiers = TypeMemberModifiers.Override;
29            accumulate.Parameters.Add(new ParameterDeclaration("row",CodeBuilder.CreateTypeReference(typeof(Row))));
30            accumulate.Parameters.Add(new ParameterDeclaration("aggregate", CodeBuilder.CreateTypeReference(typeof(Row))));
31
32            accumulate.Body = macro.Body;
33
34            ParentMethods.Add(accumulate);
35
36            return null;
37        }
38    }
39}