<commit_before>﻿namespace King.Service
{
    using Azure.Data;
    using Data;
    using System;
    using System.Collections.Generic;
    using System.Threading.Tasks;

    public delegate Task<bool> QueueActivity<T>(T data);

    public class ActionProcessor<T> : IProcessor<T>
    {
        private readonly QueueActivity<T> action;

        public ActionProcessor(QueueActivity<T> action)
        {
            if (null == action)
            {
                throw new ArgumentNullException();
            }

            this.action = action;
        }

        public Task<bool> Process(T data)
        {
            var handle = this.action;
            if (null != handle)
            {
                return handle(data);
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
    }

    public class QueueAction<T> : QueueSetup<T>
    {
        public virtual QueueActivity<T> Action
        {
            get;
            set;
        }

        public override Func<IProcessor<T>> Processor
        {
            get
            {
                return () => { return new ActionProcessor<T>(this.Action); };
            }
        }
    }

    public class QueueProcessor<Y, T> : QueueSetup<T>
        where Y : IProcessor<T>, new()
    {
        public override Func<IProcessor<T>> Processor
        {
            get
            {
                return () => { return new Y(); };
            }
        }
    }

    public class HappyProcessor : IProcessor<object>
    {
        public Task<bool> Process(object data)
        {
            throw new NotImplementedException();
        }
    }

    public class TaskFactory
    {
        public IEnumerable<IRunnable> ALlTasks()
        {
            var df = new DequeueFactory("");

            //SHARD Queue; sender and reciever needs to be setup.

            var qp = new QueueProcessor<HappyProcessor, object>() //Easiest to test.
            {
                Priority = QueuePriority.High,
                Name = "ProcessorInline"
            };

            var qa = new QueueAction<object>()
            {
                Priority = QueuePriority.High,
                Name = "MethodPassed",
                Action = async (obj) => { return await Task.FromResult<bool>(true); },
            };

            var qs = new QueueSetup<object>()
            {
                Name = "FlexPassed",
                Priority = QueuePriority.High,
                Processor = () => { return  new ActionProcessor<object>(async (obj) => { return await Task.FromResult<bool>(true); }); },
            };
            
            return df.Tasks(qa);
        }

        public void Inline()
        {
            new ActionProcessor<object>(async (obj) => { return await Task.FromResult<bool>(true); } );
        }
        
        public IProcessor<T> Create<T>(QueueActivity<T> action)
        {
            return new ActionProcessor<T>(action);
        }
    }
}<commit_msg>removal of useless test code<commit_after>﻿namespace King.Service
{
    using Azure.Data;
    using Data;
    using System;
    using System.Collections.Generic;
    using System.Threading.Tasks;

    public delegate Task<bool> QueueActivity<T>(T data);

    public class ActionProcessor<T> : IProcessor<T>
    {
        private readonly QueueActivity<T> action;

        public ActionProcessor(QueueActivity<T> action)
        {
            if (null == action)
            {
                throw new ArgumentNullException();
            }

            this.action = action;
        }

        public Task<bool> Process(T data)
        {
            var handle = this.action;
            if (null != handle)
            {
                return handle(data);
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
    }

    public class QueueAction<T> : QueueSetup<T>
    {
        public virtual QueueActivity<T> Action
        {
            get;
            set;
        }

        public override Func<IProcessor<T>> Processor
        {
            get
            {
                return () => { return new ActionProcessor<T>(this.Action); };
            }
        }
    }

    public class QueueProcessor<Y, T> : QueueSetup<T>
        where Y : IProcessor<T>, new()
    {
        public override Func<IProcessor<T>> Processor
        {
            get
            {
                return () => { return new Y(); };
            }
        }
    }

    public class HappyProcessor : IProcessor<object>
    {
        public Task<bool> Process(object data)
        {
            throw new NotImplementedException();
        }
    }

    public class TaskFactory
    {
        public IEnumerable<IRunnable> ALlTasks()
        {
            var df = new DequeueFactory("");

            //SHARD Queue; sender and reciever needs to be setup.

            var qp = new QueueProcessor<HappyProcessor, object>() //Easiest to test.
            {
                Priority = QueuePriority.High,
                Name = "ProcessorInline"
            };

            var qa = new QueueAction<object>()
            {
                Priority = QueuePriority.High,
                Name = "MethodPassed",
                Action = async (obj) => { return await Task.FromResult<bool>(true); },
            };

            var qs = new QueueSetup<object>()
            {
                Name = "FlexPassed",
                Priority = QueuePriority.High,
                Processor = () => { return  new ActionProcessor<object>(async (obj) => { return await Task.FromResult<bool>(true); }); },
            };
            
            return df.Tasks(new[] { qp, qa, qs });
        }
    }
}
{'fraction_non_alphanumeric': 0.09907874152616027, 'fraction_numerical': 0.0, 'mean_word_length': 1.3767038413878563, 'pattern_counts': {'":': 0, '<': 63, '<?xml version=': 0, '>': 74, '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': '5082357', 'n_tokens_mistral': 1533, 'n_tokens_neox': 1462, 'n_words': 349}