Class RecursiveGenerator<T>
- Namespace
- Hegel
- Assembly
- Hegel.dll
Draws recursive structures: a base case, extended by a function a bounded number of times.
public sealed class RecursiveGenerator<T> : PrintableGenerator<T>
Type Parameters
T
- Inheritance
-
Generator<T>RecursiveGenerator<T>
- Inherited Members
Fields
DefaultMaxDepth
The depth a recursive draw may reach unless MaxDepth(int) says otherwise.
public const int DefaultMaxDepth = 32
Field Value
DefaultMaxLeaves
The number of leaves a recursive draw may have unless MaxLeaves(int) says otherwise.
public const int DefaultMaxLeaves = 100
Field Value
Properties
Label
The span label the engine files this generator's draws under. Defaults to a label derived from the class's full name.
public override ulong Label { get; }
Property Value
Methods
DoDraw(TestCase)
Draw one value. Called inside a span labelled Label: draw from another generator through DrawSilent<T>(Generator<T>), which opens its span, rather than by calling its hook.
protected override T DoDraw(TestCase tc)
Parameters
tcTestCase
Returns
- T
DoDrawAndPrint(TestCase, Printer)
Draw one value, printing it to printer (which may be Noop).
Draw its parts through DrawAndPrint<T>(Generator<T>, Printer).
protected override T DoDrawAndPrint(TestCase tc, Printer printer)
Parameters
Returns
- T
MaxDepth(int)
Recurse at most maxDepth levels.
public RecursiveGenerator<T> MaxDepth(int maxDepth)
Parameters
maxDepthint
Returns
MaxLeaves(int)
Draw at most maxLeaves base cases.
public RecursiveGenerator<T> MaxLeaves(int maxLeaves)
Parameters
maxLeavesint