![]() |
Synthia
Generic and flexible data structure generator
|
Signals that a picker can shrink the sequence of values it has produced since its last reset.
Note that this is different from shrinking a particular value, which corresponds to the Shrinkable interface.
A call to shrink(Picker, float) is expected to return a picker producing a finite subsequence of that produced by the original picker so far. For example, if calls to pick() on a picker has returned the numbers 3, 1, 4, 1, 5, a call to shrink at this point will produce a picker that can output any subsequence of [3, 1, 4, 1, 5]. Successive calls to {shrink} may produce different picker instances returning different sub-sequences. This is controlled by the Picker<Float> passed to the method. Similar to Shrinkable
| <T> | The type of the objects to return |
Definition at line 47 of file SequenceShrinkable.java.

Public Member Functions | |
| SequenceShrinkable< T > | shrink (Picker< Float > d, float magnitude) |
| Shrinks a picker. More... | |
| List< T > | getSequence () |
| Gets the sequence of values that the picker has produced so far. More... | |
Public Member Functions inherited from ca.uqac.lif.synthia.Bounded< T > | |
| boolean | isDone () |
| Signals if the picker enumerates all values from a set. More... | |
Public Member Functions inherited from ca.uqac.lif.synthia.Picker< T > | |
| void | reset () |
| Puts the picker back into its initial state. More... | |
| T | pick () |
| Picks an object. More... | |
| Picker< T > | duplicate (boolean with_state) |
| Creates a copy of the picker. More... | |
| List<T> ca.uqac.lif.synthia.SequenceShrinkable< T >.getSequence | ( | ) |
Gets the sequence of values that the picker has produced so far.
Implemented in ca.uqac.lif.synthia.sequence.Playback< T >, and ca.uqac.lif.synthia.sequence.Record< T >.
| SequenceShrinkable<T> ca.uqac.lif.synthia.SequenceShrinkable< T >.shrink | ( | Picker< Float > | d, |
| float | magnitude | ||
| ) |
Shrinks a picker.
The method has two arguments: a source of randomness and a magnitude parameter. A picker may use the magnitude to determine how "aggressive" is the shrinking process. A value of 1 is expected to produce a picker with the broadest set, and may return any subsequence of its past values. Lower values (all the way down to 0) instruct the picker to exclude further elements, and typically to only produce sub-sequences that are relatively "much smaller" than the reference.
| d | A source of randomness. Some pickers must make choices when producing shrunk sequences, and this parameter is used as an external source for these choices. |
| magnitude | A magnitude parameter, which must be between 0 and 1. |
Implemented in ca.uqac.lif.synthia.sequence.Playback< T >, and ca.uqac.lif.synthia.sequence.Record< T >.