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

Detailed Description

Transforms an object from a picker by selecting a mutator and applying it to an object.

Concretely, this picker is instantiated by providing two things:

  1. An arbitrary Picker producing the objects of type T to transform
  2. Another picker providing a Mutator for objects of type T

On each call to pick(), an object and a mutator are obtained, and the mutator is applied to the object. The resulting "mutated" object is then returned.

As with any other picker, both sources are arbitrary. For example, one could use a Choice picker to provide a randomly-selected mutation from a set of choices to apply to each object.

Parameters
<T>The type of the objects transformed by this picker

Definition at line 44 of file Mutate.java.

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

Public Member Functions

 Mutate (Picker<? extends T > picker, Picker< Mutator< T >> mutations)
 
pick ()
 Picks an object. More...
 
Picker< T > duplicate (boolean with_state)
 Creates a copy of the picker. 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...
 
void reset ()
 Puts the picker back into its initial state. More...
 
PartNode getExplanation (Part p)
 
PartNode getExplanation (Part p, NodeFactory f)
 

Protected Attributes

Picker< Mutator< T > > m_mutations
 Mutates input objects. More...
 
- 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

◆ Mutate()

ca.uqac.lif.synthia.util.Mutate< T >.Mutate ( Picker<? extends T >  picker,
Picker< Mutator< T >>  mutations 
)

Definition at line 51 of file Mutate.java.

Member Function Documentation

◆ duplicate()

Picker<T> ca.uqac.lif.synthia.util.Mutate< 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 66 of file Mutate.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 58 of file Mutate.java.

Member Data Documentation

◆ m_mutations

Picker<Mutator<T> > ca.uqac.lif.synthia.util.Mutate< T >.m_mutations
protected

Mutates input objects.

Definition at line 49 of file Mutate.java.


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