Method Slice
- Namespace
- SodaFlow.Collections
- Assembly
- SodaFlow.Collections.dll
Slice<TKey, TIdentity, TState>(ReactiveCollection<TKey, TIdentity, TState>, int, int)
limit keys of the upstream that start at
offset, which are a page of the order and the filter
above this stage.
public static ReactiveCollection<TKey, TIdentity, TState> Slice<TKey, TIdentity, TState>(this ReactiveCollection<TKey, TIdentity, TState> upstream, int offset, int limit) where TKey : notnull where TIdentity : notnull
Parameters
upstreamReactiveCollection<TKey, TIdentity, TState>The collection or view to window.
offsetintThe number of keys before the start of the window.
limitintHow many keys to keep.
Returns
- ReactiveCollection<TKey, TIdentity, TState>
A view of that window.
Type Parameters
TKeyThe type of the keys.
TIdentityThe type of the immutable part of an item.
TStateThe type of the mutable part of an item.
Remarks
There is no Skip for a pair with Take, for this cause. A
window with the two ends has a limit, thus this stage stays O(limit)
for each transaction. A skip alone gives a view whose size follows the
collection. A page also needs the two ends.
Slice<TKey, TIdentity, TState>(ReactiveCollection<TKey, TIdentity, TState>, Cell<int>, Cell<int>)
A page of the upstream where each end can change. Send a new offset to move to a different page.
public static ReactiveCollection<TKey, TIdentity, TState> Slice<TKey, TIdentity, TState>(this ReactiveCollection<TKey, TIdentity, TState> upstream, Cell<int> offsetCell, Cell<int> limitCell) where TKey : notnull where TIdentity : notnull
Parameters
upstreamReactiveCollection<TKey, TIdentity, TState>The collection or view to window.
offsetCellCell<int>The number of keys before the start of the window.
limitCellCell<int>How many keys to keep.
Returns
- ReactiveCollection<TKey, TIdentity, TState>
A view of that window.
Type Parameters
TKeyThe type of the keys.
TIdentityThe type of the immutable part of an item.
TStateThe type of the mutable part of an item.