<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace NRules.RuleModel.Builders
{
    /// <summary>
    /// Builder to compose a group of rule actions.
    /// </summary>
    public class ActionGroupBuilder : RuleElementBuilder, IBuilder<ActionGroupElement>
    {
        private readonly List<ActionElement> _actions = new List<ActionElement>();

        internal ActionGroupBuilder(SymbolTable scope) : base(scope)
        {
        }

        /// <summary>
        /// Adds a rule action to the group.
        /// </summary>
        /// <param name="expression">Rule action expression.</param>
        public void Action(LambdaExpression expression)
        {
            if (expression.Parameters.Count == 0 ||
                expression.Parameters.First().Type != typeof(IContext))
            {
                throw new ArgumentException(
                    string.Format("Action expression must have {0} as its first parameter", typeof(IContext)));
            }
            IEnumerable<ParameterExpression> parameters = expression.Parameters.Skip(1);
            IEnumerable<Declaration> declarations = parameters.Select(p => Scope.Lookup(p.Name, p.Type));
            var actionElement = new ActionElement(declarations, expression);
            _actions.Add(actionElement);
        }

        public ActionGroupElement Build()
        {
            var actionGroup = new ActionGroupElement(_actions);
            return actionGroup;
        }
    }<commit_msg>Fix build method visibility<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace NRules.RuleModel.Builders
{
    /// <summary>
    /// Builder to compose a group of rule actions.
    /// </summary>
    public class ActionGroupBuilder : RuleElementBuilder, IBuilder<ActionGroupElement>
    {
        private readonly List<ActionElement> _actions = new List<ActionElement>();

        internal ActionGroupBuilder(SymbolTable scope) : base(scope)
        {
        }

        /// <summary>
        /// Adds a rule action to the group.
        /// </summary>
        /// <param name="expression">Rule action expression.</param>
        public void Action(LambdaExpression expression)
        {
            if (expression.Parameters.Count == 0 ||
                expression.Parameters.First().Type != typeof(IContext))
            {
                throw new ArgumentException(
                    string.Format("Action expression must have {0} as its first parameter", typeof(IContext)));
            }
            IEnumerable<ParameterExpression> parameters = expression.Parameters.Skip(1);
            IEnumerable<Declaration> declarations = parameters.Select(p => Scope.Lookup(p.Name, p.Type));
            var actionElement = new ActionElement(declarations, expression);
            _actions.Add(actionElement);
        }

        ActionGroupElement IBuilder<ActionGroupElement>.Build()
        {
            var actionGroup = new ActionGroupElement(_actions);
            return actionGroup;
        }
    }
{'fraction_non_alphanumeric': 0.10096153846153846, 'fraction_numerical': 0.0019230769230769232, 'mean_word_length': 2.320212765957447, 'pattern_counts': {'":': 0, '<': 26, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3869478', 'n_tokens_mistral': 748, 'n_tokens_neox': 732, 'n_words': 188}