예제 #1
0
 public JoiningReducer(
     SplittingAsyncReducer <TReduction> splitter,
     IAsyncReducer <TReduction, TResult> next)
 {
     Splitter = splitter;
     Next     = next;
 }
예제 #2
0
 public AsyncReducer(
     Catching <TInput, TResult, TException> transducer,
     IAsyncReducer <TReduction, TResult> next) : base(next)
 {
     success     = transducer.Success.Apply(next);
     exceptional = transducer.Exceptional.Apply(next);
 }
예제 #3
0
 public SplittingAsyncReducer(
     IList <TransducerSwitch <TInput, TResult> > transducers,
     IAsyncReducer <TReduction, TResult> next)
 {
     Reducers = transducers
                .Select(tSwitch =>
                        new AsyncReducerOption(
                            tSwitch.Test,
                            tSwitch.Transducer.Apply(new JoiningReducer(this, next))))
                .ToList();
     Next = next;
 }
예제 #4
0
        public static async Task <Terminator <TReduction> > ReduceAsync <TInput, TReduction>(
            this IEnumerable <TInput> input,
            TReduction reduction,
            IAsyncReducer <TReduction, TInput> reducer)
        {
            var terminator = Terminator.Reduction(reduction);

            foreach (var value in input)
            {
                terminator = await reducer.InvokeAsync(terminator.Value, value).ConfigureAwait(false);

                if (terminator.IsTerminated)
                {
                    return(terminator);
                }
            }

            return(await reducer.CompleteAsync(terminator.Value).ConfigureAwait(false));
        }
예제 #5
0
 public IAsyncReducer <TReduction, TInput> Apply <TReduction>(IAsyncReducer <TReduction, TInput> next) =>
 new AsyncPrimary <TReduction>(Operation, next);
예제 #6
0
 public AsyncReducerOption(Predicate <TInput> test, IAsyncReducer <TReduction, TInput> reducer)
 {
     Test         = test;
     IsTerminated = false;
     Reducer      = reducer;
 }
예제 #7
0
 public IAsyncReducer <TReduction, TInput> Apply <TReduction>(IAsyncReducer <TReduction, TResult> next) =>
 new AsyncReducer <TReduction>(this, next);
예제 #8
0
 protected DefaultCompletionAsyncReducer(IAsyncReducer <TReduction, TForward> next) : base(next)
 {
 }
예제 #9
0
 public AsyncReducer(
     Func <TInput, TResult> mappingFunction,
     IAsyncReducer <TReduction, TResult> reducer) : base(reducer)
 {
     MappingFunction = mappingFunction;
 }
예제 #10
0
 public IAsyncReducer <TReduction, TInput> Apply <TReduction>(IAsyncReducer <TReduction, TInput> next) =>
 new AsyncReducer <TReduction>(Test, next);
예제 #11
0
 public IAsyncReducer <TReduction, TInput> Apply <TReduction>(IAsyncReducer <TReduction, TResult> next) =>
 Async.Apply(next);
예제 #12
0
 public IAsyncReducer <TReduction, int> Apply <TReduction>(IAsyncReducer <TReduction, GuessingGameResult> next)
 {
     throw new NotImplementedException();
 }
예제 #13
0
 public AsyncTail(
     IAsyncReducer <TReduction, TInput> primary,
     IAsyncReducer <TReduction, TInput> next) : base(next)
 {
     Loop = primary;
 }
예제 #14
0
 public AsyncPrimary(
     ITransducer <TInput, TInput> operation,
     IAsyncReducer <TReduction, TInput> next)
 {
     Next = operation.Apply(new AsyncTail <TReduction>(this, next));
 }
예제 #15
0
 public IAsyncReducer <TReduction, T> Apply <TReduction>(IAsyncReducer <TReduction, T> next) =>
 new AsyncReducer <TReduction>(this, next);
예제 #16
0
 public AsyncReducer(
     BaseAccumulationTransducer <T> transducer,
     IAsyncReducer <TReduction, T> next) : base(next)
 {
     Transducer = transducer;
 }
예제 #17
0
 public IAsyncReducer <TReduction, T> Apply <TReduction>(IAsyncReducer <TReduction, IList <T> > next) =>
 new AsyncReducer <TReduction>(Window, next);
예제 #18
0
 public AsyncReducer(
     int windowSize,
     IAsyncReducer <TReduction, IList <T> > next) : base(next)
 {
     Container = new WindowContainer(windowSize);
 }
예제 #19
0
 public IAsyncReducer <TReduction, TInput> Apply <TReduction>(IAsyncReducer <TReduction, TResult> next) =>
 new SplittingAsyncReducer <TReduction>(Transducers, next);
예제 #20
0
 public IAsyncReducer <TReduction, TInput> Apply <TReduction>(IAsyncReducer <TReduction, TResult> next)
 {
     throw new NotImplementedException();
 }
예제 #21
0
 public IAsyncReducer <TReduction, TInput> Apply <TReduction>(IAsyncReducer <TReduction, TResult> next) =>
 Left.Apply(Right.Apply(next));
예제 #22
0
 public IAsyncReducer <TReduction, Task <TInput> > Apply <TReduction>(IAsyncReducer <TReduction, TInput> next) =>
 new Reducer <TReduction>(next);
예제 #23
0
 public AsyncReducer(
     Predicate <TInput> test,
     IAsyncReducer <TReduction, TInput> next) : base(next)
 {
     Test = test;
 }
예제 #24
0
 public Reducer(IAsyncReducer <TReduction, TInput> next) : base(next)
 {
 }
예제 #25
0
 public IAsyncReducer <TReduction, T> Apply <TReduction>(IAsyncReducer <TReduction, T> next) => next;
예제 #26
0
 public AsyncReducer(Predicate <T> test, IAsyncReducer <Reduction, T> next) : base(next)
 {
     Test = test;
 }
예제 #27
0
 public IAsyncReducer <TReduction, TInput> Apply <TReduction>(IAsyncReducer <TReduction, TResult> next) =>
 new AsyncReducer <TReduction>(MappingFunction, next);
예제 #28
0
 protected BaseAsyncReducer(IAsyncReducer <TReduction, TForward> next)
 {
     Next = next;
 }