Pool inspection
What a generator's declared constraints leave of a value set you supplied yourself — the values still drawable, and the ones refused, each naming the constraint that refused it.
sealed class
DeclaredConstraint
A constraint as the caller declared it, in the form a reader recognizes from the diagnostics — WithMinLength(2), Numeric(), Except(...). It is what a PoolRejection names to say why a supplied value never draws, so the reason travels as a value that can be compared and filtered rather than as text that would have to be parsed back (ADR-0042).
public sealed class DeclaredConstraint- Implements
IEquatable<DeclaredConstraint>
Properties
string Arguments { get; } | The arguments the declaring generator rendered, or ... when it could not render them. |
|---|---|
string Name { get; } | The declaring method's name, such as WithMinLength. |
Methods
string ToString() | Returns the constraint as the caller spelled it. Total by construction: the text was built when the constraint was declared, so quoting one cannot fail. |
|---|---|
bool Equals(DeclaredConstraint? other) | |
bool Equals(object? obj) | |
int GetHashCode() |
interface
IPoolInspection<T>
What a generator's declared constraints left of a caller-supplied value set: the values still drawable, and the ones the constraints refuse together with the constraint that refuses each. It answers the question a narrowed catalogue leaves open — widen the invariant, or fix the catalogue? — and it is reached by an explicit cast, never from the fluent surface (ADR-0067).
public interface IPoolInspection<T>Properties
bool IsPooled { get; } | Whether a value set is in force — false for a generator that builds its value rather than picking it from supplied values, which has a pool neither to keep nor to reject from. |
|---|
Methods
IReadOnlyList<T?> GetSurvivors() | The supplied values that satisfy every declared constraint — the exact domain a draw picks from, in the order they were supplied, with duplicates already collapsed. Empty when IsPooled is false; never empty otherwise, since a value set left with nothing is refused at declaration. |
|---|---|
IReadOnlyList<PoolRejection<T?>> GetRejections() | The supplied values no draw can ever yield, each with the declared constraints that refuse it. Empty when IsPooled is false, and empty when every supplied value survived — which is what a catalogue in step with its invariants looks like. |
sealed class
PoolRejection<T>
One value a caller supplied to a generator's pool that the declared constraints refuse, together with the constraints that refuse it. It is what tells the two repairs apart when part of a catalogue never draws: the value points at the catalogue, the constraints point at the invariant (ADR-0067).
public sealed class PoolRejection<T>- Implements
IEquatable<PoolRejection<T>>
Properties
IReadOnlyList<DeclaredConstraint> RejectedBy { get; } | The declared constraints this value fails, in a stable order. |
|---|---|
T? Value { get; } | The value the caller supplied, which the generator can never draw as constrained. |
Methods
string ToString() | Renders the rejection for a reader: the value, then the constraints that refuse it. |
|---|---|
bool Equals(PoolRejection<T?>? other) | |
bool Equals(object? obj) | |
int GetHashCode() |