public static Streamable <TSource> CardinalityEstimate <TSource, TValue>(this Streamable <TSource> source, Func <TSource, TValue> selector, double stdError) { var streamable = new CardinalityEstimateImpl <TSource, TValue>(selector, stdError); source.Subscribe(streamable); return(streamable); }
public static Streamable <IEnumerable <T> > Buffer <T>(this Streamable <T> source, int bufferSize) { var streamable = new BufferImpl <T>(bufferSize); source.Subscribe(streamable); return(streamable); }
public static Streamable <TResult> Select <TSource, TResult>(this Streamable <TSource> source, Func <TSource, TResult> selector) { var streamable = new SelectImpl <TSource, TResult>(selector); source.Subscribe(streamable); return(streamable); }
public static Streamable <T> Max <T>(this Streamable <IEnumerable <T> > source) where T : IComparable <T> { var streamable = new MaxEnumerableImpl <T>(); source.Subscribe(streamable); return(streamable); }
public static Streamable <T> Min <T>(this Streamable <T> source) where T : IComparable <T> { var streamable = new MinImpl <T>(); source.Subscribe(streamable); return(streamable); }
/// <summary> /// Merges two IEnumerable collections based on given key. /// </summary> /// <remarks> /// Streamable collections cannot be merge directly. As the collections are pushed based we do not know when can we start comparing the elements. /// First we need to aggrate a stream them into a buffer. Once we decide that both buffers are ready we can pass them to the MergeOnKey observerable. /// </remarks> /// <typeparam name="T1">Element type of the first collection.</typeparam> /// <typeparam name="T2">Element type of the second collection.</typeparam> /// <typeparam name="TKey">Element type where the stream elements are compared.</typeparam> /// <typeparam name="TResult">Result element.</typeparam> /// <param name="source"></param> /// <param name="keySelector1"></param> /// <param name="keySelector2"></param> /// <param name="mergeFunc"></param> /// <returns></returns> public static Streamable <TResult> MergeOnKey <T1, T2, TKey, TResult>( this Streamable <IEnumerable <T1>, IEnumerable <T2> > source, Func <T1, TKey> keySelector1, Func <T2, TKey> keySelector2, Func <T1, T2, TResult> mergeFunc) where TKey : IComparable <TKey> { var streamable = new MergeOnKeyImpl <T1, T2, TKey, TResult>(keySelector1, keySelector2, mergeFunc); source.Subscribe(streamable.Observed); return(streamable); }
/// <summary> /// Brings two observerable streams into two buffers. /// Once any of the buffers reaches given capacity, both buffers are published as collections. /// </summary> /// <typeparam name="T1">Element type of the first Streamable stream.</typeparam> /// <typeparam name="T2">Element type of the second Streamable stream.</typeparam> /// <param name="source1"></param> /// <param name="source2"></param> /// <param name="bufferSize"></param> /// <returns></returns> public static Streamable <IEnumerable <T1>, IEnumerable <T2> > CombineIntoBuffer <T1, T2>(Streamable <T1> source1, Streamable <T2> source2, int bufferSize) { var streamable = new CombineIntoBufferImpl <T1, T2>(bufferSize); source1.Subscribe(streamable.Observed1); source2.Subscribe(streamable.Observed2); return(streamable); }
public static void Consume <T>(this Streamable <T> source, Action <T> action) { var streamable = new ConsumeImpl <T>(action); source.Subscribe(streamable); }