<commit_before>﻿using System;

namespace Ganss.Excel
{
    /// <summary>
    /// Abstract class action invoker
    /// </summary>
    public class ActionInvoker
    {
        /// <summary>
        /// Invoke from an unspecified <paramref name="obj"/> type
        /// </summary>
        /// <param name="obj">mapping instance class</param>
        /// <param name="index">index in the collection</param>
        public virtual void Invoke(object obj, int index) =>
            throw new NotImplementedException();

        /// <summary>
        /// <see cref="ActionInvokerImpl{T}"/> factory
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="AfterMappingAction"></param>
        /// <returns></returns>
        public static ActionInvoker CreateInstance<T>(Action<T, int> AfterMappingAction)
        {
            // instanciate concrete generic invoker
            var invokerType = typeof(ActionInvokerImpl<>);
            Type[] tType = { typeof(T) };
            Type constructed = invokerType.MakeGenericType(tType);
            object invokerInstance = Activator.CreateInstance(constructed, AfterMappingAction);
            return (ActionInvoker)invokerInstance;
        }
    }

    /// <summary>
    /// Generic form <see cref="ActionInvoker"/> 
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ActionInvokerImpl<T> : ActionInvoker
        where T : class
    {
        /// <summary>
        /// ref to the mapping action.
        /// </summary>
        internal Action<T, int> mappingAction;

        /// <summary>
        /// Ctor
        /// </summary><commit_msg>Fix typo<commit_after>﻿using System;

namespace Ganss.Excel
{
    /// <summary>
    /// Abstract class action invoker
    /// </summary>
    public class ActionInvoker
    {
        /// <summary>
        /// Invoke from an unspecified <paramref name="obj"/> type
        /// </summary>
        /// <param name="obj">mapping instance class</param>
        /// <param name="index">index in the collection</param>
        public virtual void Invoke(object obj, int index) =>
            throw new NotImplementedException();

        /// <summary>
        /// <see cref="ActionInvokerImpl{T}"/> factory
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="mappingAction"></param>
        /// <returns></returns>
        public static ActionInvoker CreateInstance<T>(Action<T, int> mappingAction)
        {
            // instanciate concrete generic invoker
            var invokerType = typeof(ActionInvokerImpl<>);
            Type[] tType = { typeof(T) };
            Type constructed = invokerType.MakeGenericType(tType);
            object invokerInstance = Activator.CreateInstance(constructed, mappingAction);
            return (ActionInvoker)invokerInstance;
        }
    }

    /// <summary>
    /// Generic form <see cref="ActionInvoker"/> 
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ActionInvokerImpl<T> : ActionInvoker
        where T : class
    {
        /// <summary>
        /// ref to the mapping action.
        /// </summary>
        internal Action<T, int> mappingAction;

        /// <summary>
        /// Ctor
        /// </summary>
{'fraction_non_alphanumeric': 0.14242053789731052, 'fraction_numerical': 0.0, 'mean_word_length': 1.9275491949910555, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 69, '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': '6172810', 'n_tokens_mistral': 865, 'n_tokens_neox': 850, 'n_words': 210}