com.fofx.observething 1.1.0 → 1.1.1-dev.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Runtime/{Operators/IInitializationOperationsProvider.cs → IInitializationOperationsProvider.cs} +1 -1
- package/Runtime/{IObservable.cs → Observables/IObservable.cs} +13 -9
- package/Runtime/{Implementations/ObservableBase.cs → Observables/Observable.cs} +6 -19
- package/Runtime/{Implementations → Observables}/ObservableCollection.cs +6 -15
- package/Runtime/{Implementations → Observables}/ObservableDictionary.cs +7 -18
- package/Runtime/{Implementations/Observable.cs → Observables/ObservableEventStream.cs} +11 -3
- package/Runtime/{Implementations → Observables}/ObservableList.cs +3 -13
- package/Runtime/{Implementations → Observables}/ObservableSet.cs +6 -15
- package/Runtime/{Implementations → Observables}/ObservableValue.cs +4 -11
- package/Runtime/Observables.meta +1 -1
- package/Runtime/ObservationDefaults.cs +10 -0
- package/Runtime/ObservationDefaults.cs.meta +2 -0
- package/Runtime/Observers.cs +51 -64
- package/Runtime/Operators/BatchOperator.cs +52 -51
- package/Runtime/Operators/BatchOperator.cs.meta +1 -1
- package/Runtime/{Observables/CastObservable.cs → Operators/CastOperator.cs} +10 -10
- package/Runtime/{Observables/CombineObservable.cs → Operators/CombineOperator.cs} +10 -10
- package/Runtime/{Observables/CombineValueObservable.cs → Operators/CombineValueOperator.cs} +12 -12
- package/Runtime/{Observables/ConcatObservable.cs → Operators/ConcatOperator.cs} +2 -2
- package/Runtime/{Observables/ContainsObservable.cs → Operators/ContainsOperator.cs} +2 -2
- package/Runtime/Operators/ContainsOperator.cs.meta +2 -0
- package/Runtime/{Observables/CountObservable.cs → Operators/CountOperator.cs} +2 -2
- package/Runtime/{Observables/DistinctObservable.cs → Operators/DistinctOperator.cs} +2 -2
- package/Runtime/Operators/{CollectionOperator.cs → Factories/CollectionOperatorFactory.cs} +2 -9
- package/Runtime/Operators/{DictionaryOperator.cs → Factories/DictionaryOperatorFactory.cs} +2 -9
- package/Runtime/Operators/{ObservableOperator.cs → Factories/EventStreamOperatorFactory.cs} +17 -10
- package/Runtime/Operators/{ListOperator.cs → Factories/ListOperatorFactory.cs} +2 -9
- package/Runtime/Operators/{Operator.cs → Factories/OperatorFactory.cs} +8 -8
- package/Runtime/Operators/{SetOperator.cs → Factories/SetOperatorFactory.cs} +2 -9
- package/Runtime/Operators/{ValueOperator.cs → Factories/ValueOperator.cs} +2 -9
- package/Runtime/{Implementations.meta → Operators/Factories.meta} +1 -1
- package/Runtime/{Observables/FirstObservable.cs → Operators/FirstOperator.cs} +2 -2
- package/Runtime/{Observables/IndexOfObservable.cs → Operators/IndexOfOperator.cs} +2 -2
- package/Runtime/Operators/OperationStreamOperator.cs +212 -0
- package/Runtime/{Observables.cs → Operators/Operators.cs} +105 -73
- package/Runtime/{Observables/OrderByObservable.cs → Operators/OrderByOperator.cs} +2 -2
- package/Runtime/{Observables/SelectCollectionObservable.cs → Operators/SelectCollectionOperator.cs} +2 -2
- package/Runtime/{Observables/SelectListObservable.cs → Operators/SelectListOperator.cs} +2 -2
- package/Runtime/{Observables/SelectManyObservable.cs → Operators/SelectManyOperator.cs} +2 -2
- package/Runtime/{Observables/SkipWhileObservable.cs → Operators/SkipWhileOperator.cs} +2 -2
- package/Runtime/{Observables/ThenObservable.cs → Operators/ThenOperator.cs} +2 -2
- package/Runtime/{Observables/ToDictionaryObservable.cs → Operators/ToDictionaryOperator.cs} +3 -3
- package/Runtime/{Observables/TrackObservable.cs → Operators/TrackOperator.cs} +2 -2
- package/Runtime/{Observables/UnwrapCollectionObservable.cs → Operators/UnwrapCollectionOperator.cs} +2 -2
- package/Runtime/{Observables/UnwrapListObservable.cs → Operators/UnwrapListOperator.cs} +2 -2
- package/Runtime/{Observables/UnwrapValueObservable.cs → Operators/UnwrapValueOperator.cs} +2 -2
- package/Runtime/{Observables/WhereObservable.cs → Operators/WhereOperator.cs} +2 -2
- package/Runtime/{Observables/WithPreviousObservable.cs → Operators/WithPreviousOperator.cs} +2 -2
- package/Tests/CollectionObservableTests.cs +1 -1
- package/Tests/DictionaryObservableTests.cs +1 -1
- package/Tests/ListObservableTests.cs +1 -1
- package/Tests/ObservationContextTests.cs +109 -83
- package/Tests/ValueObservableTests.cs +1 -1
- package/package.json +5 -4
- package/Runtime/Observables/BatchObservable.cs +0 -72
- package/Runtime/Observables/BatchObservable.cs.meta +0 -2
- package/Runtime/Observables/ContainsObservable.cs.meta +0 -2
- package/Runtime/Observables/OperationStreamObservable.cs +0 -194
- /package/Runtime/{Operators/IInitializationOperationsProvider.cs.meta → IInitializationOperationsProvider.cs.meta} +0 -0
- /package/Runtime/{IObservable.cs.meta → Observables/IObservable.cs.meta} +0 -0
- /package/Runtime/{Implementations/ObservableBase.cs.meta → Observables/Observable.cs.meta} +0 -0
- /package/Runtime/{Implementations → Observables}/ObservableCollection.cs.meta +0 -0
- /package/Runtime/{Implementations → Observables}/ObservableDictionary.cs.meta +0 -0
- /package/Runtime/{Implementations/Observable.cs.meta → Observables/ObservableEventStream.cs.meta} +0 -0
- /package/Runtime/{Implementations → Observables}/ObservableList.cs.meta +0 -0
- /package/Runtime/{Implementations → Observables}/ObservableSet.cs.meta +0 -0
- /package/Runtime/{Implementations → Observables}/ObservableValue.cs.meta +0 -0
- /package/Runtime/{Observables/CastObservable.cs.meta → Operators/CastOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/CombineObservable.cs.meta → Operators/CombineOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/CombineValueObservable.cs.meta → Operators/CombineValueOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/ConcatObservable.cs.meta → Operators/ConcatOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/CountObservable.cs.meta → Operators/CountOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/DistinctObservable.cs.meta → Operators/DistinctOperator.cs.meta} +0 -0
- /package/Runtime/Operators/{CollectionOperator.cs.meta → Factories/CollectionOperatorFactory.cs.meta} +0 -0
- /package/Runtime/Operators/{DictionaryOperator.cs.meta → Factories/DictionaryOperatorFactory.cs.meta} +0 -0
- /package/Runtime/Operators/{ObservableOperator.cs.meta → Factories/EventStreamOperatorFactory.cs.meta} +0 -0
- /package/Runtime/Operators/{ListOperator.cs.meta → Factories/ListOperatorFactory.cs.meta} +0 -0
- /package/Runtime/Operators/{Operator.cs.meta → Factories/OperatorFactory.cs.meta} +0 -0
- /package/Runtime/Operators/{SetOperator.cs.meta → Factories/SetOperatorFactory.cs.meta} +0 -0
- /package/Runtime/Operators/{ValueOperator.cs.meta → Factories/ValueOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/FirstObservable.cs.meta → Operators/FirstOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/IndexOfObservable.cs.meta → Operators/IndexOfOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/OperationStreamObservable.cs.meta → Operators/OperationStreamOperator.cs.meta} +0 -0
- /package/Runtime/{Observables.cs.meta → Operators/Operators.cs.meta} +0 -0
- /package/Runtime/{Observables/OrderByObservable.cs.meta → Operators/OrderByOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/SelectCollectionObservable.cs.meta → Operators/SelectCollectionOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/SelectListObservable.cs.meta → Operators/SelectListOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/SelectManyObservable.cs.meta → Operators/SelectManyOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/SelectValueObservable.cs → Operators/SelectValueOperator.cs} +0 -0
- /package/Runtime/{Observables/SelectValueObservable.cs.meta → Operators/SelectValueOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/SkipWhileObservable.cs.meta → Operators/SkipWhileOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/ThenObservable.cs.meta → Operators/ThenOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/ToDictionaryObservable.cs.meta → Operators/ToDictionaryOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/TrackObservable.cs.meta → Operators/TrackOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/UnwrapCollectionObservable.cs.meta → Operators/UnwrapCollectionOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/UnwrapListObservable.cs.meta → Operators/UnwrapListOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/UnwrapValueObservable.cs.meta → Operators/UnwrapValueOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/WhereObservable.cs.meta → Operators/WhereOperator.cs.meta} +0 -0
- /package/Runtime/{Observables/WithPreviousObservable.cs.meta → Operators/WithPreviousOperator.cs.meta} +0 -0
|
@@ -3,97 +3,132 @@ using System.Collections.Generic;
|
|
|
3
3
|
|
|
4
4
|
namespace ObserveThing
|
|
5
5
|
{
|
|
6
|
-
public static class
|
|
6
|
+
public static class Operators
|
|
7
7
|
{
|
|
8
8
|
public static IValueObservable<T> ObservableCast<T>(this IValueObservable source)
|
|
9
|
-
=> new
|
|
9
|
+
=> new ValueOperatorFactory<T>(source.context, operand => new CastValueOperator<T>(source, operand));
|
|
10
10
|
|
|
11
11
|
public static ICollectionObservable<T> ObservableCast<T>(this ICollectionObservable source)
|
|
12
|
-
=> new
|
|
12
|
+
=> new CollectionOperatorFactory<T>(source.context, operand => new CastCollectionOperator<T>(source, operand));
|
|
13
13
|
|
|
14
14
|
public static IListObservable<T> ObservableCast<T>(this IListObservable source)
|
|
15
|
-
=> new
|
|
15
|
+
=> new ListOperatorFactory<T>(source.context, operand => new CastListOperator<T>(source, operand));
|
|
16
16
|
|
|
17
17
|
public static ISetObservable<T> ObservableCast<T>(this ISetObservable source)
|
|
18
|
-
=> new
|
|
18
|
+
=> new SetOperatorFactory<T>(source.context, operand => new CastSetOperator<T>(source, operand));
|
|
19
19
|
|
|
20
20
|
public static IDictionaryObservable<TKey, TValue> ObservableCast<TKey, TValue>(this IDictionaryObservable source)
|
|
21
|
-
=> new
|
|
21
|
+
=> new DictionaryOperatorFactory<TKey, TValue>(source.context, operand => new CastDictionaryOperator<TKey, TValue>(source, operand));
|
|
22
22
|
|
|
23
|
-
public static
|
|
24
|
-
=> new
|
|
23
|
+
public static IEventStreamObservable<TOperation> ObservableEventStream<T, TOperation>(this IValueObservable<T> source, Func<T, TOperation> constructOperation)
|
|
24
|
+
=> new EventStreamOperatorFactory<TOperation>(source.context, operand => new ValueEventStreamOperator<T, TOperation>(source, constructOperation, operand));
|
|
25
25
|
|
|
26
|
-
public static
|
|
27
|
-
=>
|
|
26
|
+
public static IEventStreamObservable<ValueOp<T>> ObservableEventStream<T>(this IValueObservable<T> source)
|
|
27
|
+
=> source.ObservableEventStream(x => new ValueOp<T>() { source = source, value = x });
|
|
28
28
|
|
|
29
|
-
public static
|
|
30
|
-
=> new
|
|
29
|
+
public static IEventStreamObservable<TOperation> ObservableEventStream<T, TOperation>(this ICollectionObservable<T> source, Func<uint, T, TOperation> constructAddOperation, Func<uint, T, TOperation> constructRemoveOperation)
|
|
30
|
+
=> new EventStreamOperatorFactory<TOperation>(source.context, operand => new CollectionEventStreamOperator<T, TOperation>(source, constructAddOperation, constructRemoveOperation, operand));
|
|
31
31
|
|
|
32
|
-
public static
|
|
33
|
-
=> new
|
|
32
|
+
public static IEventStreamObservable<CollectionOp<T>> ObservableEventStream<T>(this ICollectionObservable<T> source)
|
|
33
|
+
=> new EventStreamOperatorFactory<CollectionOp<T>>(source.context, operand => new CollectionEventStreamOperator<T, CollectionOp<T>>(
|
|
34
|
+
source,
|
|
35
|
+
(id, element) => new() { source = source, elementId = id, element = element, isRemove = false },
|
|
36
|
+
(id, element) => new() { source = source, elementId = id, element = element, isRemove = true },
|
|
37
|
+
operand
|
|
38
|
+
));
|
|
34
39
|
|
|
35
|
-
public static
|
|
36
|
-
=> new
|
|
40
|
+
public static IEventStreamObservable<TOperation> ObservableEventStream<T, TOperation>(this IListObservable<T> source, Func<uint, int, T, TOperation> constructAddOperation, Func<uint, int, T, TOperation> constructRemoveOperation)
|
|
41
|
+
=> new EventStreamOperatorFactory<TOperation>(source.context, operand => new ListEventStreamOperator<T, TOperation>(source, constructAddOperation, constructRemoveOperation, operand));
|
|
37
42
|
|
|
38
|
-
public static
|
|
39
|
-
=> source.
|
|
43
|
+
public static IEventStreamObservable<ListOp<T>> ObservableEventStream<T>(this IListObservable<T> source)
|
|
44
|
+
=> new EventStreamOperatorFactory<ListOp<T>>(source.context, operand => new ListEventStreamOperator<T, ListOp<T>>(
|
|
45
|
+
source,
|
|
46
|
+
(id, index, element) => new() { source = source, elementId = id, index = index, element = element, isRemove = false },
|
|
47
|
+
(id, index, element) => new() { source = source, elementId = id, index = index, element = element, isRemove = true },
|
|
48
|
+
operand
|
|
49
|
+
));
|
|
40
50
|
|
|
41
|
-
public static
|
|
42
|
-
=> source.
|
|
51
|
+
public static IEventStreamObservable<TOperation> ObservableEventStream<TKey, TValue, TOperation>(this IDictionaryObservable<TKey, TValue> source, Func<uint, KeyValuePair<TKey, TValue>, TOperation> constructAddOperation, Func<uint, KeyValuePair<TKey, TValue>, TOperation> constructRemoveOperation)
|
|
52
|
+
=> new EventStreamOperatorFactory<TOperation>(source.context, operand => new DictionaryEventStreamOperator<TKey, TValue, TOperation>(source, constructAddOperation, constructRemoveOperation, operand));
|
|
43
53
|
|
|
44
|
-
public static
|
|
45
|
-
=> source.
|
|
54
|
+
public static IEventStreamObservable<DictionaryOp<TKey, TValue>> ObservableEventStream<TKey, TValue>(this IDictionaryObservable<TKey, TValue> source)
|
|
55
|
+
=> new EventStreamOperatorFactory<DictionaryOp<TKey, TValue>>(source.context, operand => new DictionaryEventStreamOperator<TKey, TValue, DictionaryOp<TKey, TValue>>(
|
|
56
|
+
source,
|
|
57
|
+
(id, kvp) => new() { source = source, elementId = id, key = kvp.Key, value = kvp.Value, isRemove = false },
|
|
58
|
+
(id, kvp) => new() { source = source, elementId = id, key = kvp.Key, value = kvp.Value, isRemove = true },
|
|
59
|
+
operand
|
|
60
|
+
));
|
|
46
61
|
|
|
47
|
-
public static
|
|
48
|
-
=> source.
|
|
62
|
+
public static IEventStreamObservable<TOperation> ObservableEventStream<T, TOperation>(this ISetObservable<T> source, Func<uint, T, TOperation> constructAddOperation, Func<uint, T, TOperation> constructRemoveOperation)
|
|
63
|
+
=> new EventStreamOperatorFactory<TOperation>(source.context, operand => new SetEventStreamOperator<T, TOperation>(source, constructAddOperation, constructRemoveOperation, operand));
|
|
49
64
|
|
|
50
|
-
public static
|
|
51
|
-
=> source.
|
|
65
|
+
public static IEventStreamObservable<SetOp<T>> ObservableEventStream<T>(this ISetObservable<T> source)
|
|
66
|
+
=> new EventStreamOperatorFactory<SetOp<T>>(source.context, operand => new SetEventStreamOperator<T, SetOp<T>>(
|
|
67
|
+
source,
|
|
68
|
+
(id, element) => new() { source = source, elementId = id, element = element, isRemove = false },
|
|
69
|
+
(id, element) => new() { source = source, elementId = id, element = element, isRemove = true },
|
|
70
|
+
operand
|
|
71
|
+
));
|
|
52
72
|
|
|
53
|
-
public static
|
|
54
|
-
=>
|
|
73
|
+
public static IEventStreamObservable<IReadOnlyList<ValueOp<T>>> ObservableBatch<T>(this IValueObservable<T> source)
|
|
74
|
+
=> source.ObservableEventStream().ObservableBatch();
|
|
55
75
|
|
|
56
|
-
public static
|
|
57
|
-
=>
|
|
76
|
+
public static IEventStreamObservable<IReadOnlyList<CollectionOp<T>>> ObservableBatch<T>(this ICollectionObservable<T> source)
|
|
77
|
+
=> source.ObservableEventStream().ObservableBatch();
|
|
58
78
|
|
|
59
|
-
public static
|
|
60
|
-
=>
|
|
79
|
+
public static IEventStreamObservable<IReadOnlyList<ListOp<T>>> ObservableBatch<T>(this IListObservable<T> source)
|
|
80
|
+
=> source.ObservableEventStream().ObservableBatch();
|
|
61
81
|
|
|
62
|
-
public static
|
|
63
|
-
=>
|
|
82
|
+
public static IEventStreamObservable<IReadOnlyList<DictionaryOp<TKey, TValue>>> ObservableBatch<TKey, TValue>(this IDictionaryObservable<TKey, TValue> source)
|
|
83
|
+
=> source.ObservableEventStream().ObservableBatch();
|
|
84
|
+
|
|
85
|
+
public static IEventStreamObservable<IReadOnlyList<SetOp<T>>> ObservableBatch<T>(this ISetObservable<T> source)
|
|
86
|
+
=> source.ObservableEventStream().ObservableBatch();
|
|
87
|
+
|
|
88
|
+
public static IEventStreamObservable<IReadOnlyList<T>> ObservableBatch<T>(this IEventStreamObservable<T> source)
|
|
89
|
+
=> new EventStreamOperatorFactory<IReadOnlyList<T>>(source.context, operand => new BatchOperator<T>(source, operand));
|
|
90
|
+
|
|
91
|
+
public static IEventStreamObservable<T> ObservableCombine<T>(this ISetObservable<IEventStreamObservable<T>> source, bool disposeOnSourceEmpty = true)
|
|
92
|
+
=> new EventStreamOperatorFactory<T>(source.context, operand => new CombineOperator<T>(source, operand, disposeOnSourceEmpty));
|
|
93
|
+
|
|
94
|
+
public static IEventStreamObservable<T> ObservableCombine<T>(params IEventStreamObservable<T>[] observables)
|
|
95
|
+
=> new ObservableSet<IEventStreamObservable<T>>(observables[0].context, observables).ObservableCombine(disposeOnSourceEmpty: true);
|
|
96
|
+
|
|
97
|
+
public static IEventStreamObservable<T> ObservableCombine<T>(bool disposeOnSourceEmpty, params IEventStreamObservable<T>[] observables)
|
|
98
|
+
=> new ObservableSet<IEventStreamObservable<T>>(observables[0].context, observables).ObservableCombine(disposeOnSourceEmpty: disposeOnSourceEmpty);
|
|
64
99
|
|
|
65
100
|
public static IValueObservable<T> ObservableThen<T>(this IValueObservable<T> source, IValueObserver<T> thenObserver)
|
|
66
|
-
=> new
|
|
101
|
+
=> new ValueOperatorFactory<T>(source.context, operand => new ThenValueOperator<T>(source, thenObserver, operand));
|
|
67
102
|
|
|
68
103
|
public static IValueObservable<T> ObservableThen<T>(this IValueObservable<T> source, Action<T> onNext = default, Action onDispose = default, Action<Exception> onError = default)
|
|
69
104
|
=> source.ObservableThen(new ValueObserver<T>(onNext, onDispose, onError));
|
|
70
105
|
|
|
71
106
|
public static ICollectionObservable<T> ObservableThen<T>(this ICollectionObservable<T> source, ICollectionObserver<T> thenObserver)
|
|
72
|
-
=> new
|
|
107
|
+
=> new CollectionOperatorFactory<T>(source.context, operand => new ThenCollectionObservable<T>(source, thenObserver, operand));
|
|
73
108
|
|
|
74
109
|
public static ICollectionObservable<T> ObservableThen<T>(this ICollectionObservable<T> source, Action<T> onAdd = default, Action<T> onRemove = default, Action onDispose = default, Action<Exception> onError = default)
|
|
75
110
|
=> source.ObservableThen(new CollectionObserver<T>((id, x) => onAdd?.Invoke(x), (id, x) => onRemove?.Invoke(x), onDispose, onError));
|
|
76
111
|
|
|
77
112
|
public static IListObservable<T> ObservableThen<T>(this IListObservable<T> source, IListObserver<T> thenObserver)
|
|
78
|
-
=> new
|
|
113
|
+
=> new ListOperatorFactory<T>(source.context, operand => new ThenListObservable<T>(source, thenObserver, operand));
|
|
79
114
|
|
|
80
115
|
public static IListObservable<T> ObservableThen<T>(this IListObservable<T> source, Action<int, T> onAdd = default, Action<int, T> onRemove = default, Action onDispose = default, Action<Exception> onError = default)
|
|
81
116
|
=> source.ObservableThen(new ListObserver<T>((id, index, x) => onAdd?.Invoke(index, x), (id, index, x) => onRemove?.Invoke(index, x), onDispose, onError));
|
|
82
117
|
|
|
83
118
|
public static ISetObservable<T> ObservableThen<T>(this ISetObservable<T> source, ISetObserver<T> thenObserver)
|
|
84
|
-
=> new
|
|
119
|
+
=> new SetOperatorFactory<T>(source.context, operand => new ThenSetObservable<T>(source, thenObserver, operand));
|
|
85
120
|
|
|
86
121
|
public static ISetObservable<T> ObservableThen<T>(this ISetObservable<T> source, Action<T> onAdd = default, Action<T> onRemove = default, Action onDispose = default, Action<Exception> onError = default)
|
|
87
122
|
=> source.ObservableThen(new SetObserver<T>((id, x) => onAdd?.Invoke(x), (id, x) => onRemove?.Invoke(x), onDispose, onError));
|
|
88
123
|
|
|
89
124
|
public static IDictionaryObservable<TKey, TValue> ObservableThen<TKey, TValue>(this IDictionaryObservable<TKey, TValue> source, IDictionaryObserver<TKey, TValue> thenObserver)
|
|
90
|
-
=> new
|
|
125
|
+
=> new DictionaryOperatorFactory<TKey, TValue>(source.context, operand => new ThenDictionaryObservable<TKey, TValue>(source, thenObserver, operand));
|
|
91
126
|
|
|
92
127
|
public static IDictionaryObservable<TKey, TValue> ObservableThen<TKey, TValue>(this IDictionaryObservable<TKey, TValue> source, Action<KeyValuePair<TKey, TValue>> onAdd = default, Action<KeyValuePair<TKey, TValue>> onRemove = default, Action onDispose = default, Action<Exception> onError = default)
|
|
93
128
|
=> source.ObservableThen(new DictionaryObserver<TKey, TValue>((id, x) => onAdd?.Invoke(x), (id, x) => onRemove?.Invoke(x), onDispose, onError));
|
|
94
129
|
|
|
95
130
|
public static IValueObservable<(T1, T2)> ObservableCombineValues<T1, T2>(IValueObservable<T1> source1, IValueObservable<T2> source2)
|
|
96
|
-
=> new
|
|
131
|
+
=> new ValueOperatorFactory<(T1, T2)>(source1.context, operand => new CombineValueOperator<T1, T2>(source1, source2, operand));
|
|
97
132
|
|
|
98
133
|
public static IValueObservable<TResult> ObservableCombineValues<T1, T2, TResult>(IValueObservable<T1> source1, IValueObservable<T2> source2, Func<T1, T2, IValueObservable<TResult>> select)
|
|
99
134
|
=> ObservableCombineValues(source1, source2).ObservableSelect(x => select(x.Item1, x.Item2));
|
|
@@ -102,7 +137,7 @@ namespace ObserveThing
|
|
|
102
137
|
=> ObservableCombineValues(source1, source2).ObservableSelect(x => select(x.Item1, x.Item2));
|
|
103
138
|
|
|
104
139
|
public static IValueObservable<(T1, T2, T3)> ObservableCombineValues<T1, T2, T3>(IValueObservable<T1> source1, IValueObservable<T2> source2, IValueObservable<T3> source3)
|
|
105
|
-
=> new
|
|
140
|
+
=> new ValueOperatorFactory<(T1, T2, T3)>(source1.context, operand => new CombineValueOperator<T1, T2, T3>(source1, source2, source3, operand));
|
|
106
141
|
|
|
107
142
|
public static IValueObservable<TResult> ObservableCombineValues<T1, T2, T3, TResult>(IValueObservable<T1> source1, IValueObservable<T2> source2, IValueObservable<T3> source3, Func<T1, T2, T3, IValueObservable<TResult>> select)
|
|
108
143
|
=> ObservableCombineValues(source1, source2, source3).ObservableSelect(x => select(x.Item1, x.Item2, x.Item3));
|
|
@@ -111,7 +146,7 @@ namespace ObserveThing
|
|
|
111
146
|
=> ObservableCombineValues(source1, source2, source3).ObservableSelect(x => select(x.Item1, x.Item2, x.Item3));
|
|
112
147
|
|
|
113
148
|
public static IValueObservable<(T1, T2, T3, T4)> ObservableCombineValues<T1, T2, T3, T4>(IValueObservable<T1> source1, IValueObservable<T2> source2, IValueObservable<T3> source3, IValueObservable<T4> source4)
|
|
114
|
-
=> new
|
|
149
|
+
=> new ValueOperatorFactory<(T1, T2, T3, T4)>(source1.context, operand => new CombineValueOperator<T1, T2, T3, T4>(source1, source2, source3, source4, operand));
|
|
115
150
|
|
|
116
151
|
public static IValueObservable<TResult> ObservableCombineValues<T1, T2, T3, T4, TResult>(IValueObservable<T1> source1, IValueObservable<T2> source2, IValueObservable<T3> source3, IValueObservable<T4> source4, Func<T1, T2, T3, T4, IValueObservable<TResult>> select)
|
|
117
152
|
=> ObservableCombineValues(source1, source2, source3, source4).ObservableSelect(x => select(x.Item1, x.Item2, x.Item3, x.Item4));
|
|
@@ -120,7 +155,7 @@ namespace ObserveThing
|
|
|
120
155
|
=> ObservableCombineValues(source1, source2, source3, source4).ObservableSelect(x => select(x.Item1, x.Item2, x.Item3, x.Item4));
|
|
121
156
|
|
|
122
157
|
public static IValueObservable<(T1, T2, T3, T4, T5)> ObservableCombineValues<T1, T2, T3, T4, T5>(IValueObservable<T1> source1, IValueObservable<T2> source2, IValueObservable<T3> source3, IValueObservable<T4> source4, IValueObservable<T5> source5)
|
|
123
|
-
=> new
|
|
158
|
+
=> new ValueOperatorFactory<(T1, T2, T3, T4, T5)>(source1.context, operand => new CombineValueOperator<T1, T2, T3, T4, T5>(source1, source2, source3, source4, source5, operand));
|
|
124
159
|
|
|
125
160
|
public static IValueObservable<TResult> ObservableCombineValues<T1, T2, T3, T4, T5, TResult>(IValueObservable<T1> source1, IValueObservable<T2> source2, IValueObservable<T3> source3, IValueObservable<T4> source4, IValueObservable<T5> source5, Func<T1, T2, T3, T4, T5, IValueObservable<TResult>> select)
|
|
126
161
|
=> ObservableCombineValues(source1, source2, source3, source4, source5).ObservableSelect(x => select(x.Item1, x.Item2, x.Item3, x.Item4, x.Item5));
|
|
@@ -129,7 +164,7 @@ namespace ObserveThing
|
|
|
129
164
|
=> ObservableCombineValues(source1, source2, source3, source4, source5).ObservableSelect(x => select(x.Item1, x.Item2, x.Item3, x.Item4, x.Item5));
|
|
130
165
|
|
|
131
166
|
public static IValueObservable<(T1, T2, T3, T4, T5, T6)> ObservableCombineValues<T1, T2, T3, T4, T5, T6>(IValueObservable<T1> source1, IValueObservable<T2> source2, IValueObservable<T3> source3, IValueObservable<T4> source4, IValueObservable<T5> source5, IValueObservable<T6> source6)
|
|
132
|
-
=> new
|
|
167
|
+
=> new ValueOperatorFactory<(T1, T2, T3, T4, T5, T6)>(source1.context, operand => new CombineValueOperator<T1, T2, T3, T4, T5, T6>(source1, source2, source3, source4, source5, source6, operand));
|
|
133
168
|
|
|
134
169
|
public static IValueObservable<TResult> ObservableCombineValues<T1, T2, T3, T4, T5, T6, TResult>(IValueObservable<T1> source1, IValueObservable<T2> source2, IValueObservable<T3> source3, IValueObservable<T4> source4, IValueObservable<T5> source5, IValueObservable<T6> source6, Func<T1, T2, T3, T4, T5, T6, IValueObservable<TResult>> select)
|
|
135
170
|
=> ObservableCombineValues(source1, source2, source3, source4, source5, source6).ObservableSelect(x => select(x.Item1, x.Item2, x.Item3, x.Item4, x.Item5, x.Item6));
|
|
@@ -138,7 +173,7 @@ namespace ObserveThing
|
|
|
138
173
|
=> ObservableCombineValues(source1, source2, source3, source4, source5, source6).ObservableSelect(x => select(x.Item1, x.Item2, x.Item3, x.Item4, x.Item5, x.Item6));
|
|
139
174
|
|
|
140
175
|
public static IValueObservable<(T1, T2, T3, T4, T5, T6, T7)> ObservableCombineValues<T1, T2, T3, T4, T5, T6, T7>(IValueObservable<T1> source1, IValueObservable<T2> source2, IValueObservable<T3> source3, IValueObservable<T4> source4, IValueObservable<T5> source5, IValueObservable<T6> source6, IValueObservable<T7> source7)
|
|
141
|
-
=> new
|
|
176
|
+
=> new ValueOperatorFactory<(T1, T2, T3, T4, T5, T6, T7)>(source1.context, operand => new CombineValueOperator<T1, T2, T3, T4, T5, T6, T7>(source1, source2, source3, source4, source5, source6, source7, operand));
|
|
142
177
|
|
|
143
178
|
public static IValueObservable<TResult> ObservableCombineValues<T1, T2, T3, T4, T5, T6, T7, TResult>(IValueObservable<T1> source1, IValueObservable<T2> source2, IValueObservable<T3> source3, IValueObservable<T4> source4, IValueObservable<T5> source5, IValueObservable<T6> source6, IValueObservable<T7> source7, Func<T1, T2, T3, T4, T5, T6, T7, IValueObservable<TResult>> select)
|
|
144
179
|
=> ObservableCombineValues(source1, source2, source3, source4, source5, source6, source7).ObservableSelect(x => select(x.Item1, x.Item2, x.Item3, x.Item4, x.Item5, x.Item6, x.Item7));
|
|
@@ -147,70 +182,70 @@ namespace ObserveThing
|
|
|
147
182
|
=> ObservableCombineValues(source1, source2, source3, source4, source5, source6, source7).ObservableSelect(x => select(x.Item1, x.Item2, x.Item3, x.Item4, x.Item5, x.Item6, x.Item7));
|
|
148
183
|
|
|
149
184
|
public static IValueObservable<T> ObservableUnwrap<T>(this IValueObservable<IValueObservable<T>> source)
|
|
150
|
-
=> new
|
|
185
|
+
=> new ValueOperatorFactory<T>(source.context, operand => new UnwrapValueOperator<T>(source, operand));
|
|
151
186
|
|
|
152
187
|
public static IValueObservable<U> ObservableSelect<T, U>(this IValueObservable<T> source, Func<T, U> select)
|
|
153
|
-
=> new
|
|
188
|
+
=> new ValueOperatorFactory<U>(source.context, operand => new SelectValueOperator<T, U>(source, select, operand));
|
|
154
189
|
|
|
155
190
|
public static IValueObservable<U> ObservableSelect<T, U>(this IValueObservable<T> source, Func<T, IValueObservable<U>> select)
|
|
156
191
|
=> source.ObservableSelect<T, IValueObservable<U>>(select).ObservableUnwrap();
|
|
157
192
|
|
|
158
193
|
public static IValueObservable<(T current, T previous)> ObservableWithPrevious<T>(this IValueObservable<T> source)
|
|
159
|
-
=> new
|
|
194
|
+
=> new ValueOperatorFactory<(T current, T previous)>(source.context, operand => new WithPreviousOperator<T>(source, operand));
|
|
160
195
|
|
|
161
196
|
public static IValueObservable<T> ObservableSkipWhile<T>(this IValueObservable<T> source, Func<bool> skipWhile)
|
|
162
|
-
=> new
|
|
197
|
+
=> new ValueOperatorFactory<T>(source.context, operand => new SkipWhileOperator<T>(source, skipWhile, operand));
|
|
163
198
|
|
|
164
199
|
public static ICollectionObservable<T> ObservableUnwrap<T>(this ICollectionObservable<IValueObservable<T>> source)
|
|
165
|
-
=> new
|
|
200
|
+
=> new CollectionOperatorFactory<T>(source.context, operand => new UnwrapCollectionOperator<T>(source, operand));
|
|
166
201
|
|
|
167
202
|
public static ICollectionObservable<U> ObservableSelect<T, U>(this ICollectionObservable<T> source, Func<T, IValueObservable<U>> select)
|
|
168
203
|
=> source.ObservableSelect<T, IValueObservable<U>>(select).ObservableUnwrap();
|
|
169
204
|
|
|
170
205
|
public static ICollectionObservable<U> ObservableSelect<T, U>(this ICollectionObservable<T> source, Func<T, U> select)
|
|
171
|
-
=> new
|
|
206
|
+
=> new CollectionOperatorFactory<U>(source.context, operand => new SelectCollectionOperator<T, U>(source, select, operand));
|
|
172
207
|
|
|
173
208
|
public static ISetObservable<T> ObservableDistinct<T>(this ICollectionObservable<T> source)
|
|
174
|
-
=> new
|
|
209
|
+
=> new SetOperatorFactory<T>(source.context, operand => new DistinctOperator<T>(source, operand));
|
|
175
210
|
|
|
176
211
|
public static ICollectionObservable<T> ObservableWhere<T>(this ICollectionObservable<T> source, Func<T, bool> where)
|
|
177
212
|
=> source.ObservableWhere(x => new ObservableValue<bool>(source.context, where(x)));
|
|
178
213
|
|
|
179
214
|
public static ICollectionObservable<T> ObservableWhere<T>(this ICollectionObservable<T> source, Func<T, IValueObservable<bool>> where)
|
|
180
|
-
=> new
|
|
215
|
+
=> new CollectionOperatorFactory<T>(source.context, operand => new WhereOperator<T>(source, where, operand));
|
|
181
216
|
|
|
182
217
|
public static ICollectionObservable<T> ObservableConcat<T>(this ICollectionObservable<T> source1, IEnumerable<T> source2)
|
|
183
218
|
=> source1.ObservableConcat((ICollectionObservable<T>)new ObservableCollection<T>(source1.context, source2));
|
|
184
219
|
|
|
185
220
|
public static ICollectionObservable<T> ObservableConcat<T>(this ICollectionObservable<T> source1, ICollectionObservable<T> source2)
|
|
186
|
-
=> new
|
|
221
|
+
=> new CollectionOperatorFactory<T>(source1.context, operand => new ConcatOperator<T>(source1, source2, operand));
|
|
187
222
|
|
|
188
223
|
public static ICollectionObservable<U> ObservableSelectMany<T, U>(this ICollectionObservable<T> source, Func<T, IEnumerable<U>> selectMany)
|
|
189
224
|
=> source.ObservableSelectMany(x => (ICollectionObservable<U>)new ObservableCollection<U>(source.context, selectMany(x)));
|
|
190
225
|
|
|
191
226
|
public static ICollectionObservable<U> ObservableSelectMany<T, U>(this ICollectionObservable<T> source, Func<T, ICollectionObservable<U>> selectMany)
|
|
192
|
-
=> new
|
|
227
|
+
=> new CollectionOperatorFactory<U>(source.context, operand => new SelectManyOperator<T, U>(source, selectMany, operand));
|
|
193
228
|
|
|
194
229
|
public static IListObservable<T> ObservableOrderBy<T, U>(this ICollectionObservable<T> source, Func<T, U> orderBy)
|
|
195
230
|
=> source.ObservableOrderBy<T, U>(x => new ObservableValue<U>(source.context, orderBy(x)));
|
|
196
231
|
|
|
197
232
|
public static IListObservable<T> ObservableOrderBy<T, U>(this ICollectionObservable<T> source, Func<T, IValueObservable<U>> orderBy)
|
|
198
|
-
=> new
|
|
233
|
+
=> new ListOperatorFactory<T>(source.context, operand => new OrderByOperator<T, U>(source, orderBy, false, operand));
|
|
199
234
|
|
|
200
235
|
public static IListObservable<T> ObservableOrderByDescending<T, U>(this ICollectionObservable<T> source, Func<T, U> orderBy)
|
|
201
236
|
=> source.ObservableOrderByDescending<T, U>(x => new ObservableValue<U>(source.context, orderBy(x)));
|
|
202
237
|
|
|
203
238
|
public static IListObservable<T> ObservableOrderByDescending<T, U>(this ICollectionObservable<T> source, Func<T, IValueObservable<U>> orderBy)
|
|
204
|
-
=> new
|
|
239
|
+
=> new ListOperatorFactory<T>(source.context, operand => new OrderByOperator<T, U>(source, orderBy, true, operand));
|
|
205
240
|
|
|
206
241
|
public static IValueObservable<int> ObservableCount<T>(this ICollectionObservable<T> source)
|
|
207
|
-
=> new
|
|
242
|
+
=> new ValueOperatorFactory<int>(source.context, operand => new CountOperator<T>(source, operand));
|
|
208
243
|
|
|
209
244
|
public static IValueObservable<bool> ObservableContains<T>(this ICollectionObservable<T> source, T contains)
|
|
210
245
|
=> source.ObservableContains(new ObservableValue<T>(source.context, contains));
|
|
211
246
|
|
|
212
247
|
public static IValueObservable<bool> ObservableContains<T>(this ICollectionObservable<T> source, IValueObservable<T> contains)
|
|
213
|
-
=> new
|
|
248
|
+
=> new ValueOperatorFactory<bool>(source.context, operand => new ContainsOperator<T>(source, contains, operand));
|
|
214
249
|
|
|
215
250
|
public static IValueObservable<T> ObservableFirstOrDefault<T>(this ICollectionObservable<T> source, Func<T, bool> validate)
|
|
216
251
|
=> source.ObservableFirstOrDefault(x => new ObservableValue<bool>(source.context, validate(x)));
|
|
@@ -222,22 +257,22 @@ namespace ObserveThing
|
|
|
222
257
|
=> source.ObservableFirst(x => new ObservableValue<bool>(source.context, validate(x)));
|
|
223
258
|
|
|
224
259
|
public static IValueObservable<(bool found, T value)> ObservableFirst<T>(this ICollectionObservable<T> source, Func<T, IValueObservable<bool>> validate)
|
|
225
|
-
=> new
|
|
260
|
+
=> new ValueOperatorFactory<(bool found, T value)>(source.context, operand => new FirstOperator<T>(source, validate, operand));
|
|
226
261
|
|
|
227
262
|
public static IValueObservable<(bool keyPresent, TValue value)> ObservableTrack<TKey, TValue>(this IDictionaryObservable<TKey, TValue> source, TKey key)
|
|
228
263
|
=> source.ObservableTrack(new ObservableValue<TKey>(source.context, key));
|
|
229
264
|
|
|
230
265
|
public static IValueObservable<(bool keyPresent, TValue value)> ObservableTrack<TKey, TValue>(this IDictionaryObservable<TKey, TValue> source, IValueObservable<TKey> key)
|
|
231
|
-
=> new
|
|
266
|
+
=> new ValueOperatorFactory<(bool keyPresent, TValue value)>(source.context, operand => new TrackOperator<TKey, TValue>(source, key, operand));
|
|
232
267
|
|
|
233
268
|
public static ICollectionObservable<TValue> ObservableTrack<TKey, TValue>(this IDictionaryObservable<TKey, TValue> source, ICollectionObservable<TKey> keys)
|
|
234
269
|
=> keys.ObservableSelect(x => source.ObservableTrack(x)).ObservableWhere(x => x.keyPresent).ObservableSelect(((bool keyPresent, TValue value) x) => x.value);
|
|
235
270
|
|
|
236
271
|
public static IListObservable<T> ObservableUnwrap<T>(this IListObservable<IValueObservable<T>> source)
|
|
237
|
-
=> new
|
|
272
|
+
=> new ListOperatorFactory<T>(source.context, operand => new UnwrapListOperator<T>(source, operand));
|
|
238
273
|
|
|
239
274
|
public static IListObservable<U> ObservableSelect<T, U>(this IListObservable<T> source, Func<T, U> select)
|
|
240
|
-
=> new
|
|
275
|
+
=> new ListOperatorFactory<U>(source.context, operand => new SelectListOperator<T, U>(source, select, operand));
|
|
241
276
|
|
|
242
277
|
public static IListObservable<U> ObservableSelect<T, U>(this IListObservable<T> source, Func<T, IValueObservable<U>> select)
|
|
243
278
|
=> source.ObservableSelect<T, IValueObservable<U>>(select).ObservableUnwrap();
|
|
@@ -246,19 +281,19 @@ namespace ObserveThing
|
|
|
246
281
|
=> source.ObservableIndexOf(new ObservableValue<T>(source.context, value));
|
|
247
282
|
|
|
248
283
|
public static IValueObservable<(bool found, int index)> ObservableIndexOf<T>(this IListObservable<T> source, IValueObservable<T> value)
|
|
249
|
-
=> new
|
|
284
|
+
=> new ValueOperatorFactory<(bool found, int index)>(source.context, operand => new IndexOfOperator<T>(source, value, operand));
|
|
250
285
|
|
|
251
286
|
public static IDictionaryObservable<TKey, TValue> ObservableToDictionary<T, TKey, TValue>(this ICollectionObservable<T> source, Func<T, IValueObservable<TKey>> selectKey, Func<T, IValueObservable<TValue>> selectValue)
|
|
252
|
-
=> new
|
|
287
|
+
=> new DictionaryOperatorFactory<TKey, TValue>(source.context, operand => new ToDictionaryOperator<T, TKey, TValue>(source, selectKey, selectValue, operand));
|
|
253
288
|
|
|
254
289
|
public static IDictionaryObservable<TKey, TValue> ObservableToDictionary<T, TKey, TValue>(this ICollectionObservable<T> source, Func<T, TKey> selectKey, Func<T, IValueObservable<TValue>> selectValue)
|
|
255
|
-
=> new
|
|
290
|
+
=> new DictionaryOperatorFactory<TKey, TValue>(source.context, operand => new ToDictionaryOperator<T, TKey, TValue>(source, x => new ObservableValue<TKey>(source.context, selectKey(x)), selectValue, operand));
|
|
256
291
|
|
|
257
292
|
public static IDictionaryObservable<TKey, TValue> ObservableToDictionary<T, TKey, TValue>(this ICollectionObservable<T> source, Func<T, IValueObservable<TKey>> selectKey, Func<T, TValue> selectValue)
|
|
258
|
-
=> new
|
|
293
|
+
=> new DictionaryOperatorFactory<TKey, TValue>(source.context, operand => new ToDictionaryOperator<T, TKey, TValue>(source, selectKey, x => new ObservableValue<TValue>(source.context, selectValue(x)), operand));
|
|
259
294
|
|
|
260
295
|
public static IDictionaryObservable<TKey, TValue> ObservableToDictionary<T, TKey, TValue>(this ICollectionObservable<T> source, Func<T, TKey> selectKey, Func<T, TValue> selectValue)
|
|
261
|
-
=> new
|
|
296
|
+
=> new DictionaryOperatorFactory<TKey, TValue>(source.context, operand => new ToDictionaryOperator<T, TKey, TValue>(source, x => new ObservableValue<TKey>(source.context, selectKey(x)), x => new ObservableValue<TValue>(source.context, selectValue(x)), operand));
|
|
262
297
|
|
|
263
298
|
public static IValueObservable<T> AsObservable<T>(this IValueObservable<T> observable)
|
|
264
299
|
=> observable;
|
|
@@ -282,8 +317,8 @@ namespace ObserveThing
|
|
|
282
317
|
return result;
|
|
283
318
|
}
|
|
284
319
|
|
|
285
|
-
public static IDisposable Subscribe<T>(this
|
|
286
|
-
=> source.Subscribe(new
|
|
320
|
+
public static IDisposable Subscribe<T>(this IEventStreamObservable<T> source, Action<T> onNext = default, Action<Exception> onError = default, Action onDispose = default, bool immediate = default, uint? priority = default)
|
|
321
|
+
=> source.Subscribe(new EventStreamObserver<T>(onNext, onDispose, onError), immediate, priority);
|
|
287
322
|
|
|
288
323
|
public static IDisposable Subscribe(this IValueObservable source, Action<object> onNext = default, Action<Exception> onError = default, Action onDispose = default, bool immediate = default, uint? priority = default)
|
|
289
324
|
=> source.Subscribe(new ValueObserver(onNext, onDispose, onError), immediate, priority);
|
|
@@ -291,9 +326,6 @@ namespace ObserveThing
|
|
|
291
326
|
public static IDisposable Subscribe<T>(this IValueObservable<T> source, Action<T> onNext = default, Action<Exception> onError = default, Action onDispose = default, bool immediate = default, uint? priority = default)
|
|
292
327
|
=> source.Subscribe(new ValueObserver<T>(onNext, onDispose, onError), immediate, priority);
|
|
293
328
|
|
|
294
|
-
public static IDisposable Subscribe<T>(this IObservable<BatchOp<T>> source, Action<IReadOnlyList<T>> onNext = default, Action<Exception> onError = default, Action onDispose = default, bool immediate = default, uint? priority = default) where T : IOperation
|
|
295
|
-
=> source.Subscribe(new Observer<BatchOp<T>>(onNext: x => onNext?.Invoke(x.operations), onDispose, onError), immediate, priority);
|
|
296
|
-
|
|
297
329
|
public static IDisposable Subscribe(this IDictionaryObservable source, Action<KeyValuePair<object, object>> onAdd = default, Action<KeyValuePair<object, object>> onRemove = default, Action<Exception> onError = default, Action onDispose = default, bool immediate = default, uint? priority = default)
|
|
298
330
|
=> source.Subscribe(new DictionaryObserver(
|
|
299
331
|
onAdd: onAdd == null ? null : (_, kvp) => onAdd?.Invoke(kvp),
|
|
@@ -4,7 +4,7 @@ using System.Linq;
|
|
|
4
4
|
|
|
5
5
|
namespace ObserveThing
|
|
6
6
|
{
|
|
7
|
-
public class
|
|
7
|
+
public class OrderByOperator<T, U> : IDisposable
|
|
8
8
|
{
|
|
9
9
|
private ObservableList<T> _operand;
|
|
10
10
|
private Func<T, IValueObservable<U>> _orderBy;
|
|
@@ -21,7 +21,7 @@ namespace ObserveThing
|
|
|
21
21
|
public IDisposable subscription;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
public
|
|
24
|
+
public OrderByOperator(ICollectionObservable<T> source, Func<T, IValueObservable<U>> orderBy, bool descending, ObservableList<T> operand)
|
|
25
25
|
{
|
|
26
26
|
_orderBy = orderBy;
|
|
27
27
|
_compare = descending ? DescendingCompare : AscendingCompare;
|
package/Runtime/{Observables/SelectCollectionObservable.cs → Operators/SelectCollectionOperator.cs}
RENAMED
|
@@ -2,12 +2,12 @@ using System;
|
|
|
2
2
|
|
|
3
3
|
namespace ObserveThing
|
|
4
4
|
{
|
|
5
|
-
public class
|
|
5
|
+
public class SelectCollectionOperator<T, U> : IDisposable
|
|
6
6
|
{
|
|
7
7
|
private ObservableCollection<U> _operand;
|
|
8
8
|
private IDisposable _subscriptions;
|
|
9
9
|
|
|
10
|
-
public
|
|
10
|
+
public SelectCollectionOperator(ICollectionObservable<T> source, Func<T, U> select, ObservableCollection<U> operand)
|
|
11
11
|
{
|
|
12
12
|
_operand = operand;
|
|
13
13
|
_subscriptions = source.SubscribeWithId(
|
|
@@ -2,12 +2,12 @@ using System;
|
|
|
2
2
|
|
|
3
3
|
namespace ObserveThing
|
|
4
4
|
{
|
|
5
|
-
public class
|
|
5
|
+
public class SelectListOperator<T, U> : IDisposable
|
|
6
6
|
{
|
|
7
7
|
private ObservableList<U> _operand;
|
|
8
8
|
private IDisposable _subscriptions;
|
|
9
9
|
|
|
10
|
-
public
|
|
10
|
+
public SelectListOperator(IListObservable<T> source, Func<T, U> select, ObservableList<U> operand)
|
|
11
11
|
{
|
|
12
12
|
_operand = operand;
|
|
13
13
|
_subscriptions = source.Subscribe(
|
|
@@ -4,7 +4,7 @@ using System.Linq;
|
|
|
4
4
|
|
|
5
5
|
namespace ObserveThing
|
|
6
6
|
{
|
|
7
|
-
public class
|
|
7
|
+
public class SelectManyOperator<T, U> : IDisposable
|
|
8
8
|
{
|
|
9
9
|
private class ElementData
|
|
10
10
|
{
|
|
@@ -18,7 +18,7 @@ namespace ObserveThing
|
|
|
18
18
|
private CollectionIdProvider _idProvider;
|
|
19
19
|
private IDisposable _subscriptions;
|
|
20
20
|
|
|
21
|
-
public
|
|
21
|
+
public SelectManyOperator(ICollectionObservable<T> source, Func<T, ICollectionObservable<U>> select, ObservableCollection<U> operand)
|
|
22
22
|
{
|
|
23
23
|
_select = select;
|
|
24
24
|
_operand = operand;
|
|
@@ -2,12 +2,12 @@ using System;
|
|
|
2
2
|
|
|
3
3
|
namespace ObserveThing
|
|
4
4
|
{
|
|
5
|
-
public class
|
|
5
|
+
public class SkipWhileOperator<T> : IDisposable
|
|
6
6
|
{
|
|
7
7
|
private ObservableValue<T> _operand;
|
|
8
8
|
private IDisposable _subscriptions;
|
|
9
9
|
|
|
10
|
-
public
|
|
10
|
+
public SkipWhileOperator(IValueObservable<T> source, Func<bool> skipWhile, ObservableValue<T> operand)
|
|
11
11
|
{
|
|
12
12
|
_operand = operand;
|
|
13
13
|
_subscriptions = source.Subscribe(
|
|
@@ -2,14 +2,14 @@ using System;
|
|
|
2
2
|
|
|
3
3
|
namespace ObserveThing
|
|
4
4
|
{
|
|
5
|
-
public class
|
|
5
|
+
public class ThenValueOperator<T> : IDisposable
|
|
6
6
|
{
|
|
7
7
|
private IValueObservable<T> _source;
|
|
8
8
|
private IValueObserver<T> _then;
|
|
9
9
|
private ObservableValue<T> _operand;
|
|
10
10
|
private IDisposable _subscriptions;
|
|
11
11
|
|
|
12
|
-
public
|
|
12
|
+
public ThenValueOperator(IValueObservable<T> source, IValueObserver<T> then, ObservableValue<T> operand)
|
|
13
13
|
{
|
|
14
14
|
_source = source;
|
|
15
15
|
_then = then;
|
|
@@ -3,16 +3,16 @@ using System.Collections.Generic;
|
|
|
3
3
|
|
|
4
4
|
namespace ObserveThing
|
|
5
5
|
{
|
|
6
|
-
public class
|
|
6
|
+
public class ToDictionaryOperator<T, TKey, TValue> : IDisposable
|
|
7
7
|
{
|
|
8
8
|
private IDisposable _subscription;
|
|
9
9
|
private ObservableDictionary<TKey, TValue> _operand;
|
|
10
10
|
|
|
11
|
-
public
|
|
11
|
+
public ToDictionaryOperator(ICollectionObservable<T> source, Func<T, IValueObservable<TKey>> selectKey, Func<T, IValueObservable<TValue>> selectValue, ObservableDictionary<TKey, TValue> operand)
|
|
12
12
|
{
|
|
13
13
|
_operand = operand;
|
|
14
14
|
_subscription = source.ObservableSelect(
|
|
15
|
-
x =>
|
|
15
|
+
x => Operators.ObservableCombineValues(
|
|
16
16
|
selectKey(x),
|
|
17
17
|
selectValue(x),
|
|
18
18
|
(key, value) => new KeyValuePair<TKey, TValue>(key, value)
|
|
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|
|
3
3
|
|
|
4
4
|
namespace ObserveThing
|
|
5
5
|
{
|
|
6
|
-
public class
|
|
6
|
+
public class TrackOperator<TKey, TValue> : IDisposable
|
|
7
7
|
{
|
|
8
8
|
private ObservableValue<(bool keyPresent, TValue value)> _operand;
|
|
9
9
|
private Dictionary<TKey, TValue> _dict = new Dictionary<TKey, TValue>();
|
|
@@ -12,7 +12,7 @@ namespace ObserveThing
|
|
|
12
12
|
|
|
13
13
|
private IDisposable _subscriptions;
|
|
14
14
|
|
|
15
|
-
public
|
|
15
|
+
public TrackOperator(IDictionaryObservable<TKey, TValue> source, IValueObservable<TKey> key, ObservableValue<(bool keyPresent, TValue value)> operand)
|
|
16
16
|
{
|
|
17
17
|
_operand = operand;
|
|
18
18
|
_subscriptions = new ComposedDisposable(
|
package/Runtime/{Observables/UnwrapCollectionObservable.cs → Operators/UnwrapCollectionOperator.cs}
RENAMED
|
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|
|
3
3
|
|
|
4
4
|
namespace ObserveThing
|
|
5
5
|
{
|
|
6
|
-
public class
|
|
6
|
+
public class UnwrapCollectionOperator<T> : IDisposable
|
|
7
7
|
{
|
|
8
8
|
private ObservableCollection<T> _operand;
|
|
9
9
|
private Dictionary<uint, EntryData> _dataById = new Dictionary<uint, EntryData>();
|
|
@@ -15,7 +15,7 @@ namespace ObserveThing
|
|
|
15
15
|
public bool initialized;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
public
|
|
18
|
+
public UnwrapCollectionOperator(ICollectionObservable<IValueObservable<T>> source, ObservableCollection<T> operand)
|
|
19
19
|
{
|
|
20
20
|
_operand = operand;
|
|
21
21
|
_subscriptions = source.Subscribe(new CollectionObserver<IValueObservable<T>>(
|
|
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|
|
3
3
|
|
|
4
4
|
namespace ObserveThing
|
|
5
5
|
{
|
|
6
|
-
public class
|
|
6
|
+
public class UnwrapListOperator<T> : IDisposable
|
|
7
7
|
{
|
|
8
8
|
private ObservableList<T> _operand;
|
|
9
9
|
private List<EntryData> _data = new List<EntryData>();
|
|
@@ -15,7 +15,7 @@ namespace ObserveThing
|
|
|
15
15
|
public bool initialized;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
public
|
|
18
|
+
public UnwrapListOperator(IListObservable<IValueObservable<T>> source, ObservableList<T> operand)
|
|
19
19
|
{
|
|
20
20
|
_operand = operand;
|
|
21
21
|
_subscriptions = source.Subscribe(
|
|
@@ -2,14 +2,14 @@ using System;
|
|
|
2
2
|
|
|
3
3
|
namespace ObserveThing
|
|
4
4
|
{
|
|
5
|
-
public class
|
|
5
|
+
public class UnwrapValueOperator<T> : IDisposable
|
|
6
6
|
{
|
|
7
7
|
private ObservableValue<T> _operand;
|
|
8
8
|
private ValueObserver<T> _nestedObserver;
|
|
9
9
|
private IDisposable _nestedSubscription;
|
|
10
10
|
private IDisposable _subscriptions;
|
|
11
11
|
|
|
12
|
-
public
|
|
12
|
+
public UnwrapValueOperator(IValueObservable<IValueObservable<T>> source, ObservableValue<T> operand)
|
|
13
13
|
{
|
|
14
14
|
_operand = operand;
|
|
15
15
|
|