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

Detailed Description

Mutator that receives a list and selects two elements to be swapped.

Parameters
<T>The type of elements in the list

Definition at line 34 of file Swap.java.

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

Public Member Functions

 Swap (Picker<? extends List< T >> picker, Picker< Float > position1, Picker< Float > position2)
 Creates a new instance of swap. More...
 
List< T > pick ()
 Picks an object. More...
 
Swap< 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< Float > m_position1
 A picker used to select the position of the first element. More...
 
Picker< Float > m_position2
 A picker used to select the position of the second element. 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

◆ Swap()

ca.uqac.lif.synthia.collection.Swap< T >.Swap ( Picker<? extends List< T >>  picker,
Picker< Float >  position1,
Picker< Float >  position2 
)

Creates a new instance of swap.

Parameters
pickerThe underlying picker producing the lists to transform
position1A picker used to select the position of the first element
position2A picker used to select the position of the second element

Definition at line 52 of file Swap.java.

Member Function Documentation

◆ duplicate()

Swap<T> ca.uqac.lif.synthia.collection.Swap< 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 73 of file Swap.java.

◆ pick()

List<T> ca.uqac.lif.synthia.collection.Swap< T >.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 60 of file Swap.java.

Member Data Documentation

◆ m_position1

Picker<Float> ca.uqac.lif.synthia.collection.Swap< T >.m_position1
protected

A picker used to select the position of the first element.

Definition at line 39 of file Swap.java.

◆ m_position2

Picker<Float> ca.uqac.lif.synthia.collection.Swap< T >.m_position2
protected

A picker used to select the position of the second element.

Definition at line 44 of file Swap.java.


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