Class ChangesSimplifier
- Namespace
- Foundation.Data.Doublets.Cli
- Assembly
- Foundation.Data.Doublets.Cli.dll
public static class ChangesSimplifier
- Inheritance
-
ChangesSimplifier
- Inherited Members
Methods
SimplifyChanges(IEnumerable<(Link<uint> Before, Link<uint> After)>)
Reduces the raw (before, after) steps a store reports to one change per link address: from its state before the query to its state after it.
public static IEnumerable<(Link<uint> Before, Link<uint> After)> SimplifyChanges(IEnumerable<(Link<uint> Before, Link<uint> After)> changes)
Parameters
changesIEnumerable<(Link<uint> Before, Link<uint> After)>
Returns
- IEnumerable<(Link<uint> Before, Link<uint> After)>
Remarks
The store reports every step it takes — a link is emptied to (i: 0 0) before it is deleted and created as (i: 0 0) before it is set — and the null link (0: 0 0) stands for "no link", before a creation and after a deletion. The steps of one address form a chain, so its net change is the before of its first step and the after of its last: a link created and deleted again within the query is not reported, and a link that ends where it started is reported unchanged, like a link the query only matched. The changes are ordered by their after state, so deletions come first; changes with equal after states keep the order of their first step.