Synthia
Generic and flexible data structure generator
ca.uqac.lif.synthia.Shrinkable< T > Interface Template Reference

Detailed Description

Interface signaling that a picker can be shrunk.

In the context, shrinking means that given an element e, the picker produces a new picker instance producing only values that are "smaller" than e.

The interface defines two versions of shrink: the first takes only a reference object, while the second also accepts a source of randomness and a "magnitude" parameter.

Author
Sylvain Hallé
Parameters
<T>The type of the objects to return
See also
SequenceShrinkable

Definition at line 36 of file Shrinkable.java.

Inheritance diagram for ca.uqac.lif.synthia.Shrinkable< T >:

Public Member Functions

Shrinkable< T > shrink (T o, Picker< Float > d, float m)
 Shrinks a picker. More...
 
Shrinkable< T > shrink (T o)
 Shrinks a picker with default parameters. More...
 
- Public Member Functions inherited from ca.uqac.lif.synthia.Picker< T >
void reset ()
 Puts the picker back into its initial state. More...
 
pick ()
 Picks an object. More...
 
Picker< T > duplicate (boolean with_state)
 Creates a copy of the picker. More...
 

Member Function Documentation

◆ shrink() [1/2]

Shrinkable<T> ca.uqac.lif.synthia.Shrinkable< T >.shrink ( o)

Shrinks a picker with default parameters.

For any picker p that implements the Shrinkable interface, a call to p.shrink(o) should be the same as a call to p.shrink(o, RandomFloat.instance, 1).

Parameters
oThe reference object. The picker must guarantee that the returned picker instance only produces objects that are smaller than o, according to an implicit ordering relation that is specific to each object type and each picker.
Returns
The returned picker instance. This object may be of a different class from the object on which the method is called.
See also
#shrink(Object, Picker, float)

Implemented in ca.uqac.lif.synthia.util.Choice< T >, ca.uqac.lif.synthia.sequence.Playback< T >, ca.uqac.lif.synthia.util.Freeze< T >, ca.uqac.lif.synthia.util.Constant< T >, ca.uqac.lif.synthia.enumerative.Bound< T >, ca.uqac.lif.synthia.relative.PickSmallerComparable< T >, and ca.uqac.lif.synthia.util.NothingPicker< T >.

◆ shrink() [2/2]

Shrinkable<T> ca.uqac.lif.synthia.Shrinkable< T >.shrink ( o,
Picker< Float >  d,
float  m 
)

Shrinks a picker.

The method adds two arguments with respect to shrink(Object): 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 all possible objects that are smaller than the reference. Lower values (all the way down to 0) instruct the picker to exclude further objects, and typically to only produce objects that are relatively "much smaller" than the reference.

Parameters
oThe reference object. The picker must guarantee that the returned picker instance only produces objects that are smaller than o, according to an implicit ordering relation that is specific to each object type and each picker.
dA source of randomness. Some pickers must make choices when producing shrunk objects, and this parameter is used as an external source for these choices.
mA magnitude parameter, which must be between 0 and 1.
Returns
The returned picker instance. This object may be of a different class from the object on which the method is called.

Implemented in ca.uqac.lif.synthia.util.Choice< T >, ca.uqac.lif.synthia.sequence.Playback< T >, ca.uqac.lif.synthia.util.Freeze< T >, ca.uqac.lif.synthia.util.Constant< T >, ca.uqac.lif.synthia.enumerative.Bound< T >, ca.uqac.lif.synthia.relative.PickSmallerComparable< T >, and ca.uqac.lif.synthia.util.NothingPicker< T >.


The documentation for this interface was generated from the following file: