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