Namespace Mangrove.MetricSetTransformers.Utilities
This namespace contains various helper and base classes which are useful in modifying expression and table trees. There is no business logic here, only boilerplate which makes modification logic easier to implement.
Classes
ChangeDag<TNode, TIdentifier, TVisitor>
Generic base class for logic around modifying immutable nodes in a directed acyclic graph, propagating any changes up the dependency tree. This allows "change X" logic to be shared across Expression and Table classes.
ChangeExpressions
General purpose "base visitor" for operations which potentially replace one expression by another.
ChangeTables
Base ITableVisitor which handles the logic of "check if any parents have changed and replace the table accordingly", and lets you provide only the simple logic of: "replace a table of type T with ...".
FluentChangeExpressions
Create an instance of ChangeExpressions (see that class's docstring for more info) with the provided "change E" override methods. For methods not provided, a no-op will be used.
FluentChangeTables
Create an instance of ChangeTables (see that class's docstring for more info) with the provided "change T" override methods. For methods not provided, a no-op will be used.
ReplaceExpressionParentsViaMapping
ReplaceExpressionsUsingVisitor
Given an Expression visitor, visit all MetricsPlan expressions, take closure of the result and make a new MetricsPlan from it.
ReplaceTableParentsViaMapping
ReplaceTablesUsingVisitor
The analogue of ReplaceExpressionsUsingVisitor but for Table visitors. Applies the IGenericTableVisitor<T> to all Table nodes in a MetricsPlan, and uses the resulting "Table replacement map" to modify Expression nodes as needed.