Table of Contents

Class ReactiveCollection<TKey, TIdentity, TState>

Namespace
SodaFlow.Collections
Assembly
SodaFlow.Core.Collections.dll

An ordered collection of items with keys. The collection that you make is one of these, and so is each view from it. Thus, Filter and SortBy accept one and return one, as Where accepts an IEnumerable and returns one.

[PublicAPI]
public abstract class ReactiveCollection<TKey, TIdentity, TState> where TKey : notnull where TIdentity : notnull

Type Parameters

TKey

The type of the keys.

TIdentity

The type of the immutable part of an item.

TState

The type of the mutable part of an item.

Inheritance
ReactiveCollection<TKey, TIdentity, TState>
Inherited Members
Extension Methods

Remarks

A view answers for itself. Its keys are its own, its changes are its own, and its snapshot and its cells for one item hold its content and nothing more. A key that its criteria removed is not in it. No member here goes back to the collection of the view, as no member of an IEnumerable goes back to its source sequence.

This is a class and not an interface, and code out of this assembly cannot subclass it. Cell and Stream have the same agreement. There is one implementation of a reactive collection and one implementation of a view. No code replaces them with a replacement or a mock. A concrete class lets the language wrappers use the internal members that are necessary for them, with no cast that can fail.

No member here changes a value. The construction of a collection sets the code that can change it, from the edit streams that it receives. The stage that makes a view sets the code that can change that view.

The cells for one item are not on this class. Each one answers with an optional value, and each language has a different optional type: Maybe in C# and option in F#. Thus, each wrapper declares its own cells above the internal members below.

Properties

ItemChangesStream

The change to the items of this collection: the keys that an edit added, removed, or changed, with the new state of each one.

KeyChangesStream

The change to those keys: the keys that entered, the keys that left, the keys that moved, and their new positions. They are operations to apply in sequence.

KeysCell

This collection's keys, in order.

ShapeCell

The immutable part of each item in this collection. It changes only at a change of the members.

SnapshotCell

What this collection holds, at one logical version.

Methods

Create(Func<TIdentity, TKey>, Cell<IEnumerable<Item<TIdentity, TState>>>, params Stream<CollectionEdit<TKey, TIdentity, TState>>[])

Defines a collection from its initial contents and each stream that edits it. There is no imperative entry point. This construction sets the code that can change the collection, and a reader finds all of it in one position.

Create(Func<TIdentity, TKey>, IEnumerable<Item<TIdentity, TState>>, params Stream<CollectionEdit<TKey, TIdentity, TState>>[])

Defines a collection from its initial contents and each stream that edits it. There is no imperative entry point. This construction sets the code that can change the collection, and a reader finds all of it in one position.

Create(Func<TIdentity, TKey>, IEqualityComparer<TKey>, Cell<IEnumerable<Item<TIdentity, TState>>>, params Stream<CollectionEdit<TKey, TIdentity, TState>>[])

Defines a collection from its initial contents and each stream that edits it. There is no imperative entry point. This construction sets the code that can change the collection, and a reader finds all of it in one position.

Create(Func<TIdentity, TKey>, IEqualityComparer<TKey>, IEnumerable<Item<TIdentity, TState>>, params Stream<CollectionEdit<TKey, TIdentity, TState>>[])

Defines a collection from its initial contents and each stream that edits it. There is no imperative entry point. This construction sets the code that can change the collection, and a reader finds all of it in one position.