예제 #1
0
        public static void AddStepper(string eventName, MethodStep method, IList collection, int passes = 1)
        {
            var stepper = new EventStepper(method, null, collection, passes);

            stepper.onComplete = () => Event.Remove(eventName, stepper.Step);
            Event.Add(eventName, stepper.Step).SetPermanent();
        }
예제 #2
0
        public static void AddStepper(string eventName, MethodStep method, IList collection, int passes = 1, bool inline = false)
        {
            var stepper = new Stepper(method, null, collection, passes, inline);

            stepper.onEnd = () => Events.Remove(eventName, stepper.Step);
            Events.Add(eventName, stepper.Step).SetPermanent();
        }
예제 #3
0
 public EventStepper(MethodStep method, Method onComplete, IList collection, int passCount = 1)
 {
     this.method     = method;
     this.collection = collection;
     this.passes     = passCount;
     this.onComplete = onComplete ?? this.onComplete;
     EventStepper.instances.AddNew(this);
 }
예제 #4
0
        public static IEnumerable <Type> ThreadedWhere <Type>(this IEnumerable <Type> source, Func <Type, bool> method)
        {
            MethodStep <Type, Type> Where = (response, value) => {
                response.skip = !method(value);
                return(value);
            };

            return(Worker.Create(source.ToList(), Where).Build().result.SelectMany(x => x));
        }
예제 #5
0
 public Stepper(MethodStep onStep, Method onEnd, IList collection, int passCount = 1, bool inline = false)
 {
     this.onStep     = onStep;
     this.collection = collection;
     this.passes     = passCount;
     this.onEnd      = onEnd ?? this.onEnd;
     this.inline     = inline;
     Stepper.instances.AddNew(this);
 }
예제 #6
0
 public static Worker <Value, Output> Create <Output, Value>(List <Value> collection, MethodStep <Value, Output> onStep)
 {
     return(new Worker <Value, Output>(collection).OnStep(onStep));
 }
예제 #7
0
 public static WorkerDictionary <Key, Value> OnStep <Key, Value>(this WorkerDictionary <Key, Value> current, MethodStep <Key> method)
 {
     current.onStepKey = method;
     return(current);
 }
예제 #8
0
 public static Worker <Value, Output> OnStep <Value, Output>(this Worker <Value, Output> current, MethodStep <Value, Output> method)
 {
     current.onStep = method;
     return(current);
 }
예제 #9
0
        public static IEnumerable <Output> ThreadedSelect <Type, Output>(this IEnumerable <Type> source, Func <Type, Output> method)
        {
            MethodStep <Type, Output> Select = (response, value) => method(value);

            return(Worker.Create(source.ToList(), Select).Build().result.SelectMany(x => x));
        }