Synthia
Generic and flexible data structure generator
ca.uqac.lif.synthia.enumerative.Bound< T > Class Template Reference

Detailed Description

Return the value picked by a picker a defined number of times.

Definition at line 34 of file Bound.java.

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

Public Member Functions

 Bound (Picker<? extends T > source, Picker< Integer > length)
 
 Bound (Picker< T > source, int length)
 
void reset ()
 Puts the picker back into its initial state. More...
 
pick ()
 Picks an object. More...
 
Bound< T > duplicate (boolean with_state)
 Creates a copy of the picker. More...
 
boolean isDone ()
 Signals if the picker enumerates all values from a set. More...
 
Shrinkable< T > shrink (T o, Picker< Float > decision, 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.util.Mutator< T >
 Mutator (Picker<? extends T > picker)
 Creates a new instance of mutator. More...
 
Mutator< T > setPicker (Picker<? extends T > picker)
 Sets the picker producing the values to transform. More...
 
PartNode getExplanation (Part p)
 
PartNode getExplanation (Part p, NodeFactory f)
 

Protected Attributes

Picker< Integer > m_length
 
int m_chosenLength
 
int m_currentLength
 
- Protected Attributes inherited from ca.uqac.lif.synthia.util.Mutator< T >
Picker<? extends T > m_picker
 The underlying picker producing the values to transform. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ca.uqac.lif.synthia.util.Mutator< T >
PartNode getExplanationForOutput (int output_index, Part p, NodeFactory f)
 
void copyInto (Mutator< T > m, boolean with_state)
 

Constructor & Destructor Documentation

◆ Bound() [1/2]

ca.uqac.lif.synthia.enumerative.Bound< T >.Bound ( Picker<? extends T >  source,
Picker< Integer >  length 
)

Definition at line 42 of file Bound.java.

◆ Bound() [2/2]

ca.uqac.lif.synthia.enumerative.Bound< T >.Bound ( Picker< T >  source,
int  length 
)

Definition at line 50 of file Bound.java.

Member Function Documentation

◆ duplicate()

Bound<T> ca.uqac.lif.synthia.enumerative.Bound< T >.duplicate ( boolean  with_state)

Creates a copy of the picker.

Parameters
with_stateIf set to false, the returned copy is set to the class' initial state (i.e. same thing as calling the picker's constructor). If set to true, the returned copy is put into the same internal state as the object it is copied from.
Returns
The copy of the picker

Implements ca.uqac.lif.synthia.Picker< T >.

Definition at line 75 of file Bound.java.

◆ isDone()

boolean ca.uqac.lif.synthia.enumerative.Bound< T >.isDone ( )

Signals if the picker enumerates all values from a set.

Returns
true if the picker enumerates all the values and false if it's not the case.

Implements ca.uqac.lif.synthia.Bounded< T >.

Definition at line 87 of file Bound.java.

◆ pick()

Picks an object.

Typically, this method is expected to return non-null objects; a null return value is used to signal that no more objects will be produced. That is, once this method returns null, it should normally return null on all subsequent calls.

Returns
The object

Implements ca.uqac.lif.synthia.Picker< T >.

Definition at line 64 of file Bound.java.

◆ reset()

Puts the picker back into its initial state.

This means that the sequence of calls to pick() will produce the same values as when the object was instantiated.

Reimplemented from ca.uqac.lif.synthia.util.Mutator< T >.

Definition at line 56 of file Bound.java.

◆ shrink() [1/2]

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)

Implements ca.uqac.lif.synthia.Shrinkable< T >.

Definition at line 104 of file Bound.java.

◆ shrink() [2/2]

Shrinkable<T> ca.uqac.lif.synthia.enumerative.Bound< 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.

Implements ca.uqac.lif.synthia.Shrinkable< T >.

Definition at line 94 of file Bound.java.

Member Data Documentation

◆ m_chosenLength

int ca.uqac.lif.synthia.enumerative.Bound< T >.m_chosenLength
protected

Definition at line 38 of file Bound.java.

◆ m_currentLength

int ca.uqac.lif.synthia.enumerative.Bound< T >.m_currentLength
protected

Definition at line 40 of file Bound.java.

◆ m_length

Picker<Integer> ca.uqac.lif.synthia.enumerative.Bound< T >.m_length
protected

Definition at line 36 of file Bound.java.


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