/// <summary> /// Add first split stage to this pipeline /// </summary> /// <typeparam name="TSource">Input type</typeparam> /// <typeparam name="TResult">Result type</typeparam> /// <param name="source">Source collection</param> /// <param name="workers">Number of Workers</param> /// <param name="queueSize">Size of result buffer</param> /// <param name="filter"></param> /// <param name="onBegin"></param> /// <param name="onFinish"></param> /// <param name="onInterval"></param> /// <param name="onInnerInterval"></param> /// <returns></returns> public PipeLineManyStage <TSource, TResult> InitSelectMany <TSource, TResult>( IEnumerable <TSource> source, int workers, int queueSize, Func <TSource, IEnumerable <TResult> > filter, OnBeginEventHandler onBegin = null, OnFinishEventHandler onFinish = null, OnIntervalEventHandler onInterval = null, OnInnerIntervalEventHandler onInnerInterval = null) { var s = new BlockingCollection <TSource>(); foreach (var item in source) { s.Add(item, token); } s.CompleteAdding(); var rt = new PipeLineManyStage <TSource, TResult>(s, workers, queueSize, filter, onBegin, onFinish, onInterval, onInnerInterval); // first stage stages.Add(rt); return(rt); }
public PipeLineStageBase <TResult, TNextResult> ThenSelectMany <TNextResult>( int workers, int queueSize, Func <TResult, IEnumerable <TNextResult> > filter, OnBeginEventHandler onBegin = null, OnFinishEventHandler onFinish = null, OnIntervalEventHandler onInterval = null, OnInnerIntervalEventHandler onInnerInterval = null ) { var rt = new PipeLineManyStage <TResult, TNextResult>(Results, workers, queueSize, filter, onBegin, onFinish, onInterval, onInnerInterval); Next = rt; return(rt); }