Skip to content

Commit 572ddba

Browse files
committed
Rename Pagination to Virtualise and alphabetize list partial members
Renames ObservableListEx.Pagination.cs to ObservableListEx.Virtualise.cs for closer parity with the cache equivalent (ObservableCacheEx.VirtualiseAndPage.cs). Sorts members alphabetically within each new partial file; overloads of the same name preserve their original declaration order.
1 parent 2401dab commit 572ddba

3 files changed

Lines changed: 94 additions & 94 deletions

File tree

src/DynamicData/List/ObservableListEx.Combinators.cs

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,65 @@ public static IObservable<IChangeSet<T>> And<T>(this IObservableList<IObservable
9595
public static IObservable<IChangeSet<T>> And<T>(this IObservableList<ISourceList<T>> sources)
9696
where T : notnull => sources.Combine(CombineOperator.And);
9797

98+
private static IObservable<IChangeSet<T>> Combine<T>(this ICollection<IObservable<IChangeSet<T>>> sources, CombineOperator type)
99+
where T : notnull
100+
{
101+
sources.ThrowArgumentNullExceptionIfNull(nameof(sources));
102+
103+
return new Combiner<T>(sources, type).Run();
104+
}
105+
106+
private static IObservable<IChangeSet<T>> Combine<T>(this IObservable<IChangeSet<T>> source, CombineOperator type, params IObservable<IChangeSet<T>>[] others)
107+
where T : notnull
108+
{
109+
source.ThrowArgumentNullExceptionIfNull(nameof(source));
110+
others.ThrowArgumentNullExceptionIfNull(nameof(others));
111+
112+
if (others.Length == 0)
113+
{
114+
throw new ArgumentException("Must be at least one item to combine with", nameof(others));
115+
}
116+
117+
var items = source.EnumerateOne().Union(others).ToList();
118+
return new Combiner<T>(items, type).Run();
119+
}
120+
121+
private static IObservable<IChangeSet<T>> Combine<T>(this IObservableList<ISourceList<T>> sources, CombineOperator type)
122+
where T : notnull
123+
{
124+
sources.ThrowArgumentNullExceptionIfNull(nameof(sources));
125+
126+
return Observable.Create<IChangeSet<T>>(
127+
observer =>
128+
{
129+
var changesSetList = sources.Connect().Transform(s => s.Connect()).AsObservableList();
130+
var subscriber = changesSetList.Combine(type).SubscribeSafe(observer);
131+
return new CompositeDisposable(changesSetList, subscriber);
132+
});
133+
}
134+
135+
private static IObservable<IChangeSet<T>> Combine<T>(this IObservableList<IObservableList<T>> sources, CombineOperator type)
136+
where T : notnull
137+
{
138+
sources.ThrowArgumentNullExceptionIfNull(nameof(sources));
139+
140+
return Observable.Create<IChangeSet<T>>(
141+
observer =>
142+
{
143+
var changesSetList = sources.Connect().Transform(s => s.Connect()).AsObservableList();
144+
var subscriber = changesSetList.Combine(type).SubscribeSafe(observer);
145+
return new CompositeDisposable(changesSetList, subscriber);
146+
});
147+
}
148+
149+
private static IObservable<IChangeSet<T>> Combine<T>(this IObservableList<IObservable<IChangeSet<T>>> sources, CombineOperator type)
150+
where T : notnull
151+
{
152+
sources.ThrowArgumentNullExceptionIfNull(nameof(sources));
153+
154+
return new DynamicCombiner<T>(sources, type).Run();
155+
}
156+
98157
/// <summary>
99158
/// Applies a logical set-difference (Except) between the source and other streams.
100159
/// Items present in the first source but not in any of the <paramref name="others"/> are included in the result.
@@ -293,63 +352,4 @@ public static IObservable<IChangeSet<T>> Xor<T>(this IObservableList<IObservable
293352
/// </summary>
294353
public static IObservable<IChangeSet<T>> Xor<T>(this IObservableList<ISourceList<T>> sources)
295354
where T : notnull => sources.Combine(CombineOperator.Xor);
296-
297-
private static IObservable<IChangeSet<T>> Combine<T>(this ICollection<IObservable<IChangeSet<T>>> sources, CombineOperator type)
298-
where T : notnull
299-
{
300-
sources.ThrowArgumentNullExceptionIfNull(nameof(sources));
301-
302-
return new Combiner<T>(sources, type).Run();
303-
}
304-
305-
private static IObservable<IChangeSet<T>> Combine<T>(this IObservable<IChangeSet<T>> source, CombineOperator type, params IObservable<IChangeSet<T>>[] others)
306-
where T : notnull
307-
{
308-
source.ThrowArgumentNullExceptionIfNull(nameof(source));
309-
others.ThrowArgumentNullExceptionIfNull(nameof(others));
310-
311-
if (others.Length == 0)
312-
{
313-
throw new ArgumentException("Must be at least one item to combine with", nameof(others));
314-
}
315-
316-
var items = source.EnumerateOne().Union(others).ToList();
317-
return new Combiner<T>(items, type).Run();
318-
}
319-
320-
private static IObservable<IChangeSet<T>> Combine<T>(this IObservableList<ISourceList<T>> sources, CombineOperator type)
321-
where T : notnull
322-
{
323-
sources.ThrowArgumentNullExceptionIfNull(nameof(sources));
324-
325-
return Observable.Create<IChangeSet<T>>(
326-
observer =>
327-
{
328-
var changesSetList = sources.Connect().Transform(s => s.Connect()).AsObservableList();
329-
var subscriber = changesSetList.Combine(type).SubscribeSafe(observer);
330-
return new CompositeDisposable(changesSetList, subscriber);
331-
});
332-
}
333-
334-
private static IObservable<IChangeSet<T>> Combine<T>(this IObservableList<IObservableList<T>> sources, CombineOperator type)
335-
where T : notnull
336-
{
337-
sources.ThrowArgumentNullExceptionIfNull(nameof(sources));
338-
339-
return Observable.Create<IChangeSet<T>>(
340-
observer =>
341-
{
342-
var changesSetList = sources.Connect().Transform(s => s.Connect()).AsObservableList();
343-
var subscriber = changesSetList.Combine(type).SubscribeSafe(observer);
344-
return new CompositeDisposable(changesSetList, subscriber);
345-
});
346-
}
347-
348-
private static IObservable<IChangeSet<T>> Combine<T>(this IObservableList<IObservable<IChangeSet<T>>> sources, CombineOperator type)
349-
where T : notnull
350-
{
351-
sources.ThrowArgumentNullExceptionIfNull(nameof(sources));
352-
353-
return new DynamicCombiner<T>(sources, type).Run();
354-
}
355355
}

src/DynamicData/List/ObservableListEx.Merge.cs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,40 +23,6 @@ namespace DynamicData;
2323
/// </summary>
2424
public static partial class ObservableListEx
2525
{
26-
/// <summary>
27-
/// Subscribes to a per-item observable for each item in the source and merges all emissions into a single <see cref="IObservable{TDestination}"/> stream.
28-
/// This is NOT a changeset operator: it returns a flat observable of values.
29-
/// </summary>
30-
/// <typeparam name="T">The type of items in the source list.</typeparam>
31-
/// <typeparam name="TDestination">The type of values emitted by per-item observables.</typeparam>
32-
/// <param name="source">The source <see cref="IObservable{IChangeSet{T}}"/> whose items each produce an observable.</param>
33-
/// <param name="observableSelector">A <see cref="Func{T, TResult}"/> function that returns an observable for each source item.</param>
34-
/// <returns>An observable that emits values from all per-item observables, merged together.</returns>
35-
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="observableSelector"/> is <see langword="null"/>.</exception>
36-
/// <remarks>
37-
/// <list type="table">
38-
/// <listheader><term>Event (source)</term><description>Subscription behavior</description></listheader>
39-
/// <item><term><b>Add</b>/<b>AddRange</b></term><description>Subscribes to the per-item observable. Emissions are merged into the output.</description></item>
40-
/// <item><term><b>Replace</b></term><description>Old subscription disposed, new subscription created for the replacement item.</description></item>
41-
/// <item><term><b>Remove</b>/<b>RemoveRange</b>/<b>Clear</b></term><description>Subscription disposed.</description></item>
42-
/// <item><term><b>Refresh</b>/<b>Moved</b></term><description>No effect on subscriptions.</description></item>
43-
/// <item><term>OnCompleted (source)</term><description>Completes only after the source and all active inner observables have completed.</description></item>
44-
/// </list>
45-
/// </remarks>
46-
/// <seealso cref="SubscribeMany{T}(IObservable{IChangeSet{T}}, Func{T, IDisposable})"/>
47-
/// <seealso cref="MergeManyChangeSets{TObject, TDestination}(IObservable{IChangeSet{TObject}}, Func{TObject, IObservable{IChangeSet{TDestination}}}, IEqualityComparer{TDestination}?)"/>
48-
/// <seealso cref="WhenPropertyChanged{TObject, TValue}(IObservable{IChangeSet{TObject}}, Expression{Func{TObject, TValue}}, bool)"/>
49-
/// <seealso cref="ObservableCacheEx.MergeMany{TObject, TKey, TDestination}(IObservable{IChangeSet{TObject, TKey}}, Func{TObject, IObservable{TDestination}})"/>
50-
public static IObservable<TDestination> MergeMany<T, TDestination>(this IObservable<IChangeSet<T>> source, Func<T, IObservable<TDestination>> observableSelector)
51-
where T : notnull
52-
{
53-
source.ThrowArgumentNullExceptionIfNull(nameof(source));
54-
55-
observableSelector.ThrowArgumentNullExceptionIfNull(nameof(observableSelector));
56-
57-
return new MergeMany<T, TDestination>(source, observableSelector).Run();
58-
}
59-
6026
/// <inheritdoc cref="MergeChangeSets{TObject}(IEnumerable{IObservable{IChangeSet{TObject}}}, IEqualityComparer{TObject}?, IScheduler?, bool)"/>
6127
/// <summary>
6228
/// Merges multiple list changeset streams from an observable-of-observables into a single unified changeset stream.
@@ -249,6 +215,40 @@ public static IObservable<IChangeSet<TObject, TKey>> MergeChangeSets<TObject, TK
249215
return source.MergeManyChangeSets(static src => src, equalityComparer, comparer);
250216
}
251217

218+
/// <summary>
219+
/// Subscribes to a per-item observable for each item in the source and merges all emissions into a single <see cref="IObservable{TDestination}"/> stream.
220+
/// This is NOT a changeset operator: it returns a flat observable of values.
221+
/// </summary>
222+
/// <typeparam name="T">The type of items in the source list.</typeparam>
223+
/// <typeparam name="TDestination">The type of values emitted by per-item observables.</typeparam>
224+
/// <param name="source">The source <see cref="IObservable{IChangeSet{T}}"/> whose items each produce an observable.</param>
225+
/// <param name="observableSelector">A <see cref="Func{T, TResult}"/> function that returns an observable for each source item.</param>
226+
/// <returns>An observable that emits values from all per-item observables, merged together.</returns>
227+
/// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="observableSelector"/> is <see langword="null"/>.</exception>
228+
/// <remarks>
229+
/// <list type="table">
230+
/// <listheader><term>Event (source)</term><description>Subscription behavior</description></listheader>
231+
/// <item><term><b>Add</b>/<b>AddRange</b></term><description>Subscribes to the per-item observable. Emissions are merged into the output.</description></item>
232+
/// <item><term><b>Replace</b></term><description>Old subscription disposed, new subscription created for the replacement item.</description></item>
233+
/// <item><term><b>Remove</b>/<b>RemoveRange</b>/<b>Clear</b></term><description>Subscription disposed.</description></item>
234+
/// <item><term><b>Refresh</b>/<b>Moved</b></term><description>No effect on subscriptions.</description></item>
235+
/// <item><term>OnCompleted (source)</term><description>Completes only after the source and all active inner observables have completed.</description></item>
236+
/// </list>
237+
/// </remarks>
238+
/// <seealso cref="SubscribeMany{T}(IObservable{IChangeSet{T}}, Func{T, IDisposable})"/>
239+
/// <seealso cref="MergeManyChangeSets{TObject, TDestination}(IObservable{IChangeSet{TObject}}, Func{TObject, IObservable{IChangeSet{TDestination}}}, IEqualityComparer{TDestination}?)"/>
240+
/// <seealso cref="WhenPropertyChanged{TObject, TValue}(IObservable{IChangeSet{TObject}}, Expression{Func{TObject, TValue}}, bool)"/>
241+
/// <seealso cref="ObservableCacheEx.MergeMany{TObject, TKey, TDestination}(IObservable{IChangeSet{TObject, TKey}}, Func{TObject, IObservable{TDestination}})"/>
242+
public static IObservable<TDestination> MergeMany<T, TDestination>(this IObservable<IChangeSet<T>> source, Func<T, IObservable<TDestination>> observableSelector)
243+
where T : notnull
244+
{
245+
source.ThrowArgumentNullExceptionIfNull(nameof(source));
246+
247+
observableSelector.ThrowArgumentNullExceptionIfNull(nameof(observableSelector));
248+
249+
return new MergeMany<T, TDestination>(source, observableSelector).Run();
250+
}
251+
252252
/// <summary>
253253
/// Transforms each source item into a child list changeset stream using <paramref name="observableSelector"/>,
254254
/// then merges all child streams into a single flat list changeset stream. Parent item removal cleans up all associated children.

src/DynamicData/List/ObservableListEx.Pagination.cs renamed to src/DynamicData/List/ObservableListEx.Virtualise.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
namespace DynamicData;
2020

2121
/// <summary>
22-
/// ObservableList extensions for Page and Virtualise.
22+
/// ObservableList extensions for Virtualise and Page.
2323
/// </summary>
2424
public static partial class ObservableListEx
2525
{

0 commit comments

Comments
 (0)