|
@@ -241,6 +241,112 @@ namespace System.Reactive.Linq
|
|
|
return s_impl.GroupBy<TSource, TKey, TElement>(source, keySelector, elementSelector, comparer);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function.
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <param name="source">An observable sequence whose elements to group.</param>
|
|
|
+ /// <param name="keySelector">A function to extract the key for each element.</param>
|
|
|
+ /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
|
|
|
+ /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception>
|
|
|
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity"/> is less than 0.</exception>
|
|
|
+ public static IObservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, int capacity)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException("source");
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException("keySelector");
|
|
|
+ if (capacity < 0)
|
|
|
+ throw new ArgumentOutOfRangeException("capacity");
|
|
|
+
|
|
|
+ return s_impl.GroupBy<TSource, TKey>(source, keySelector, capacity);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer.
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <param name="source">An observable sequence whose elements to group.</param>
|
|
|
+ /// <param name="keySelector">A function to extract the key for each element.</param>
|
|
|
+ /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
|
|
|
+ /// <param name="comparer">An equality comparer to compare keys with.</param>
|
|
|
+ /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="comparer"/> is null.</exception>
|
|
|
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity"/> is less than 0.</exception>
|
|
|
+ public static IObservable<IGroupedObservable<TKey, TSource>> GroupBy<TSource, TKey>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, int capacity, IEqualityComparer<TKey> comparer)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException("source");
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException("keySelector");
|
|
|
+ if (capacity < 0)
|
|
|
+ throw new ArgumentOutOfRangeException("capacity");
|
|
|
+ if (comparer == null)
|
|
|
+ throw new ArgumentNullException("comparer");
|
|
|
+
|
|
|
+ return s_impl.GroupBy<TSource, TKey>(source, keySelector, capacity, comparer);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Groups the elements of an observable sequence with the specified initial capacity and selects the resulting elements by using a specified function.
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <param name="source">An observable sequence whose elements to group.</param>
|
|
|
+ /// <param name="keySelector">A function to extract the key for each element.</param>
|
|
|
+ /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
|
|
|
+ /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
|
|
|
+ /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> is null.</exception>
|
|
|
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity"/> is less than 0.</exception>
|
|
|
+ public static IObservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, int capacity)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException("source");
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException("keySelector");
|
|
|
+ if (elementSelector == null)
|
|
|
+ throw new ArgumentNullException("elementSelector");
|
|
|
+ if (capacity < 0)
|
|
|
+ throw new ArgumentOutOfRangeException("capacity");
|
|
|
+
|
|
|
+ return s_impl.GroupBy<TSource, TKey, TElement>(source, keySelector, elementSelector, capacity);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <param name="source">An observable sequence whose elements to group.</param>
|
|
|
+ /// <param name="keySelector">A function to extract the key for each element.</param>
|
|
|
+ /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
|
|
|
+ /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
|
|
|
+ /// <param name="comparer">An equality comparer to compare keys with.</param>
|
|
|
+ /// <returns>A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.</returns>
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> or <paramref name="comparer"/> is null.</exception>
|
|
|
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity"/> is less than 0.</exception>
|
|
|
+ public static IObservable<IGroupedObservable<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, int capacity, IEqualityComparer<TKey> comparer)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException("source");
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException("keySelector");
|
|
|
+ if (elementSelector == null)
|
|
|
+ throw new ArgumentNullException("elementSelector");
|
|
|
+ if (capacity < 0)
|
|
|
+ throw new ArgumentOutOfRangeException("capacity");
|
|
|
+ if (comparer == null)
|
|
|
+ throw new ArgumentNullException("comparer");
|
|
|
+
|
|
|
+ return s_impl.GroupBy<TSource, TKey, TElement>(source, keySelector, elementSelector, capacity, comparer);
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region + GroupByUntil +
|
|
@@ -329,7 +435,7 @@ namespace System.Reactive.Linq
|
|
|
/// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
|
|
|
/// </returns>
|
|
|
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="durationSelector"/> or <paramref name="comparer"/> is null.</exception>
|
|
|
- public static IObservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IObservable<TSource> source, Func<TSource, TKey> keySelector,Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>> durationSelector, IEqualityComparer<TKey> comparer)
|
|
|
+ public static IObservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>> durationSelector, IEqualityComparer<TKey> comparer)
|
|
|
{
|
|
|
if (source == null)
|
|
|
throw new ArgumentNullException("source");
|
|
@@ -371,6 +477,148 @@ namespace System.Reactive.Linq
|
|
|
return s_impl.GroupByUntil<TSource, TKey, TDuration>(source, keySelector, durationSelector);
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer and selects the resulting elements by using a specified function.
|
|
|
+ /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
|
|
|
+ /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
|
|
|
+ /// <param name="source">An observable sequence whose elements to group.</param>
|
|
|
+ /// <param name="keySelector">A function to extract the key for each element.</param>
|
|
|
+ /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
|
|
|
+ /// <param name="durationSelector">A function to signal the expiration of a group.</param>
|
|
|
+ /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
|
|
|
+ /// <param name="comparer">An equality comparer to compare keys with.</param>
|
|
|
+ /// <returns>
|
|
|
+ /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
|
|
|
+ /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encountered.
|
|
|
+ /// </returns>
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> or <paramref name="durationSelector"/> or <paramref name="comparer"/> is null.</exception>
|
|
|
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity"/> is less than 0.</exception>
|
|
|
+ public static IObservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> durationSelector, int capacity, IEqualityComparer<TKey> comparer)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException("source");
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException("keySelector");
|
|
|
+ if (elementSelector == null)
|
|
|
+ throw new ArgumentNullException("elementSelector");
|
|
|
+ if (durationSelector == null)
|
|
|
+ throw new ArgumentNullException("durationSelector");
|
|
|
+ if (capacity < 0)
|
|
|
+ throw new ArgumentOutOfRangeException("capacity");
|
|
|
+ if (comparer == null)
|
|
|
+ throw new ArgumentNullException("comparer");
|
|
|
+
|
|
|
+ return s_impl.GroupByUntil<TSource, TKey, TElement, TDuration>(source, keySelector, elementSelector, durationSelector, capacity, comparer);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and selects the resulting elements by using a specified function.
|
|
|
+ /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
|
|
|
+ /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TElement">The type of the elements within the groups computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
|
|
|
+ /// <param name="source">An observable sequence whose elements to group.</param>
|
|
|
+ /// <param name="keySelector">A function to extract the key for each element.</param>
|
|
|
+ /// <param name="elementSelector">A function to map each source element to an element in an observable group.</param>
|
|
|
+ /// <param name="durationSelector">A function to signal the expiration of a group.</param>
|
|
|
+ /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
|
|
|
+ /// <returns>
|
|
|
+ /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
|
|
|
+ /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
|
|
|
+ /// </returns>
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="elementSelector"/> or <paramref name="durationSelector"/> is null.</exception>
|
|
|
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity"/> is less than 0.</exception>
|
|
|
+ public static IObservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<TSource, TElement> elementSelector, Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> durationSelector, int capacity)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException("source");
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException("keySelector");
|
|
|
+ if (elementSelector == null)
|
|
|
+ throw new ArgumentNullException("elementSelector");
|
|
|
+ if (durationSelector == null)
|
|
|
+ throw new ArgumentNullException("durationSelector");
|
|
|
+ if (capacity < 0)
|
|
|
+ throw new ArgumentOutOfRangeException("capacity");
|
|
|
+
|
|
|
+ return s_impl.GroupByUntil<TSource, TKey, TElement, TDuration>(source, keySelector, elementSelector, durationSelector, capacity);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function and comparer.
|
|
|
+ /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
|
|
|
+ /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
|
|
|
+ /// <param name="source">An observable sequence whose elements to group.</param>
|
|
|
+ /// <param name="keySelector">A function to extract the key for each element.</param>
|
|
|
+ /// <param name="durationSelector">A function to signal the expiration of a group.</param>
|
|
|
+ /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
|
|
|
+ /// <param name="comparer">An equality comparer to compare keys with.</param>
|
|
|
+ /// <returns>
|
|
|
+ /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
|
|
|
+ /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
|
|
|
+ /// </returns>
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="durationSelector"/> or <paramref name="comparer"/> is null.</exception>
|
|
|
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity"/> is less than 0.</exception>
|
|
|
+ public static IObservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>> durationSelector, int capacity, IEqualityComparer<TKey> comparer)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException("source");
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException("keySelector");
|
|
|
+ if (durationSelector == null)
|
|
|
+ throw new ArgumentNullException("durationSelector");
|
|
|
+ if (capacity < 0)
|
|
|
+ throw new ArgumentOutOfRangeException("capacity");
|
|
|
+ if (comparer == null)
|
|
|
+ throw new ArgumentNullException("comparer");
|
|
|
+
|
|
|
+ return s_impl.GroupByUntil<TSource, TKey, TDuration>(source, keySelector, durationSelector, capacity, comparer);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// Groups the elements of an observable sequence with the specified initial capacity according to a specified key selector function.
|
|
|
+ /// A duration selector function is used to control the lifetime of groups. When a group expires, it receives an OnCompleted notification. When a new element with the same
|
|
|
+ /// key value as a reclaimed group occurs, the group will be reborn with a new lifetime request.
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TKey">The type of the grouping key computed for each element in the source sequence.</typeparam>
|
|
|
+ /// <typeparam name="TDuration">The type of the elements in the duration sequences obtained for each group to denote its lifetime.</typeparam>
|
|
|
+ /// <param name="source">An observable sequence whose elements to group.</param>
|
|
|
+ /// <param name="keySelector">A function to extract the key for each element.</param>
|
|
|
+ /// <param name="durationSelector">A function to signal the expiration of a group.</param>
|
|
|
+ /// <param name="capacity">The initial number of elements that the underlying dictionary can contain.</param>
|
|
|
+ /// <returns>
|
|
|
+ /// A sequence of observable groups, each of which corresponds to a unique key value, containing all elements that share that same key value.
|
|
|
+ /// If a group's lifetime expires, a new group with the same key value can be created once an element with such a key value is encoutered.
|
|
|
+ /// </returns>
|
|
|
+ /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> or <paramref name="durationSelector"/> is null.</exception>
|
|
|
+ /// <exception cref="ArgumentOutOfRangeException"><paramref name="capacity"/> is less than 0.</exception>
|
|
|
+ public static IObservable<IGroupedObservable<TKey, TSource>> GroupByUntil<TSource, TKey, TDuration>(this IObservable<TSource> source, Func<TSource, TKey> keySelector, Func<IGroupedObservable<TKey, TSource>, IObservable<TDuration>> durationSelector, int capacity)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException("source");
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException("keySelector");
|
|
|
+ if (durationSelector == null)
|
|
|
+ throw new ArgumentNullException("durationSelector");
|
|
|
+ if (capacity < 0)
|
|
|
+ throw new ArgumentOutOfRangeException("capacity");
|
|
|
+
|
|
|
+ return s_impl.GroupByUntil<TSource, TKey, TDuration>(source, keySelector, durationSelector, capacity);
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region + GroupJoin +
|