 |
Synthia
Generic and flexible data structure generator
|
Go to the documentation of this file.
19 package ca.uqac.lif.synthia.relative;
21 import java.util.ArrayList;
22 import java.util.List;
24 import ca.
uqac.
lif.petitpoucet.NodeFactory;
27 import ca.
uqac.
lif.petitpoucet.function.ExplanationQueryable;
39 public class PickIf<T>
extends Mutator<T> implements ExplanationQueryable
88 private boolean canChoose(T element)
114 super.copyInto(m, with_state);
131 int iteration_counter = 0;
133 while (!canChoose(picked_value))
189 PartNode root = f.getPartNode(p,
this);
196 for (
int i = 1; i < index; i++)
201 root.addChild(f.getPartNode(new_p,
m_picker));
PickIf(Picker<? extends T > picker, int max_iteration)
Constructor who takes a m_maxIteration value.
PickIf(Picker<? extends T > picker)
Constructor with default m_maxIteration value.
Picker<? extends T > m_picker
The underlying picker producing the values to transform.
static Part replaceOutIndexBy(Part from, int index)
Given an arbitrary designator, replaces the first occurrence of NthOutput by an instance of NthInput ...
Miscellaneous pickers performing various functions.
void reset()
Puts the picker back into its initial state.
PartNode getExplanationForOutput(int index, Part p, NodeFactory f)
Objects related to the explanation of results produced by pickers.
Returns object from a picker satisfying a condition.
boolean checkIfInfiniteLoop(int iteration_counter)
Protected method to check if the instance of the class detects that the while loop of the pick() meth...
A picker that applies a transformation ("mutation") on the value produced by another picker.
boolean select(T element)
Method to evaluate if an element is satisfying a condition.
void copyInto(PickIf< T > m, boolean with_state)
int m_maxIteration
The maximal number of iteration that the while loop of the pick() method can do.
An exception to throw to prevent the pick method of a PickIf picker from falling into an infinite loo...
PickIf< T > duplicate(boolean with_state)
Creates a copy of the picker.
T pick()
Method to pick the first object generated by the picker who satisfies the condition.
Picker< T > duplicate(boolean with_state)
Creates a copy of the picker.
void reset()
Puts the picker back into its initial state.
List< Integer > m_rejected
A list keeping track of the number of rejected elements between each output element.
A Part pointing to the n-th output produced by a picker since its last call to reset().