Synthia
Generic and flexible data structure generator
SequenceShrinkable.java
Go to the documentation of this file.
1
/*
2
Synthia, a data structure generator
3
Copyright (C) 2019-2021 Laboratoire d'informatique formelle
4
Université du Québec à Chicoutimi, Canada
5
6
This program is free software: you can redistribute it and/or modify
7
it under the terms of the GNU Lesser General Public License as published
8
by the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU Lesser General Public License for more details.
15
16
You should have received a copy of the GNU Lesser General Public License
17
along with this program. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
package
ca.uqac.lif.synthia;
20
21
import
java.util.List;
22
23
/**
24
* Signals that a picker can shrink the sequence of values it has produced
25
* since its last reset. Note that this is different from shrinking a
26
* particular <em>value</em>, which corresponds to the {@link Shrinkable}
27
* interface.
28
* <p>
29
* A call to {@link #shrink(Picker, float)} is expected to return a picker
30
* producing a <em>finite</em> subsequence of that produced by the original
31
* picker so far. For example, if calls to {@link #pick()} on a picker has
32
* returned the numbers 3, 1, 4, 1, 5, a call to {@link #shrink(Picker, float)
33
* shrink} at this point will produce a picker that can output any
34
* subsequence of [3, 1, 4, 1, 5]. Successive calls to {@link
35
* #shrink(Picker, float) shrink} may produce different picker instances
36
* returning different sub-sequences. This is controlled by the
37
* <tt>Picker<Float></tt> passed to the method.
38
* <p>
39
* Similar to {@link Shrinkable}
40
*
41
* @author Sylvain Hallé
42
*
43
* @param <T> The type of the objects to return
44
* @see Shrinkable
45
* @ingroup API
46
*/
47
public
interface
SequenceShrinkable
<T>
extends
Bounded
<T>
48
{
49
/**
50
* Shrinks a picker. The method has two arguments: a source of randomness
51
* and a magnitude parameter.
52
* A picker may use the magnitude to determine how "aggressive" is the
53
* shrinking process. A value of 1 is expected to produce a picker with
54
* the broadest set, and may return any subsequence of its past values.
55
* Lower values (all the way down to 0) instruct
56
* the picker to exclude further elements, and typically to only produce
57
* sub-sequences that are relatively "much smaller" than the reference.
58
*
59
* @param d A source of randomness. Some pickers must make choices when
60
* producing shrunk sequences, and this parameter is used as an external
61
* source for these choices.
62
* @param magnitude A magnitude parameter, which must be between 0 and 1.
63
* @return The returned picker instance. This object may be of a different
64
* class from the object on which the method is called.
65
*/
66
public
SequenceShrinkable<T>
shrink
(
Picker<Float>
d,
float
magnitude);
67
68
/**
69
* Gets the sequence of values that the picker has produced so far.
70
* @return The sequence of values
71
*/
72
public
List<T>
getSequence
();
73
}
ca.uqac.lif.synthia.Picker< Float >
ca.uqac.lif.synthia.SequenceShrinkable
Signals that a picker can shrink the sequence of values it has produced since its last reset.
Definition:
SequenceShrinkable.java:47
ca.uqac.lif.synthia.Bounded
Interface used to signal that a picker enumerates all values from a set.
Definition:
Bounded.java:26
ca.uqac.lif.synthia.SequenceShrinkable.shrink
SequenceShrinkable< T > shrink(Picker< Float > d, float magnitude)
Shrinks a picker.
ca.uqac.lif.synthia.SequenceShrinkable.getSequence
List< T > getSequence()
Gets the sequence of values that the picker has produced so far.
Source
Core
src
ca
uqac
lif
synthia
SequenceShrinkable.java
Generated by
1.8.17