 |
Synthia
Generic and flexible data structure generator
|
Go to the documentation of this file.
19 package ca.uqac.lif.synthia.test;
21 import java.util.ArrayList;
22 import java.util.List;
86 @SuppressWarnings(
"unchecked")
90 for (
int start_cnt = 0; start_cnt <
MAX_STARTS; start_cnt++)
92 List<T> shrunk =
new ArrayList<T>();
94 boolean found =
false;
125 boolean new_found =
false;
126 for (
float magnitude = 0.25f; !new_found && magnitude <= 1; magnitude += 0.25f)
147 if (!(o instanceof Comparable))
153 if (!shrunk.isEmpty())
155 Comparable<T> new_o = (Comparable<T>) shrunk.get(shrunk.size() - 1);
156 if (best ==
null || new_o.compareTo(best) < 0)
160 best = shrunk.get(shrunk.size() - 1);
Interface signaling that a picker can be shrunk.
Shrinkable< T > shrink(T o, Picker< Float > d, float m)
Shrinks a picker.
static final transient RandomFloat instance
A public static instance of RandomFloat.
static final int MAX_CYCLES
Pickers that produce pseudo-random objects such as numbers.
List< T > getIterations()
static final int MAX_TRIES
Assert(Shrinkable< T > input, Picker< Float > decision)
Picks a floating point number uniformly in an interval.
An exception to throw when a picker can't pick an other element.
Picker< Float > m_decision
An exception to throw to prevent the pick method of a PickIf picker from falling into an infinite loo...
static final int MAX_STARTS
Assert(Shrinkable< T > input)