DoubleTournamentSelectionPolicyHandler.java

1
package net.bmahe.genetics4j.gp.selection;
2
3
import java.util.Objects;
4
import java.util.random.RandomGenerator;
5
6
import org.apache.commons.lang3.Validate;
7
8
import net.bmahe.genetics4j.core.selection.SelectionPolicyHandler;
9
import net.bmahe.genetics4j.core.selection.SelectionPolicyHandlerResolver;
10
import net.bmahe.genetics4j.core.selection.Selector;
11
import net.bmahe.genetics4j.core.spec.AbstractEAConfiguration;
12
import net.bmahe.genetics4j.core.spec.AbstractEAExecutionContext;
13
import net.bmahe.genetics4j.core.spec.selection.SelectionPolicy;
14
import net.bmahe.genetics4j.gp.spec.selection.DoubleTournament;
15
16
public class DoubleTournamentSelectionPolicyHandler<T extends Comparable<T>> implements SelectionPolicyHandler<T> {
17
	private final RandomGenerator randomGenerator;
18
19
	public DoubleTournamentSelectionPolicyHandler(final RandomGenerator _randomGenerator) {
20
		Objects.requireNonNull(_randomGenerator);
21
22 1 1. <init> : Removed assignment to member variable randomGenerator → KILLED
		this.randomGenerator = _randomGenerator;
23
	}
24
25
	@Override
26
	public boolean canHandle(final SelectionPolicy selectionPolicy) {
27
		Objects.requireNonNull(selectionPolicy);
28
29 2 1. canHandle : replaced boolean return with true for net/bmahe/genetics4j/gp/selection/DoubleTournamentSelectionPolicyHandler::canHandle → KILLED
2. canHandle : replaced boolean return with false for net/bmahe/genetics4j/gp/selection/DoubleTournamentSelectionPolicyHandler::canHandle → KILLED
		return selectionPolicy instanceof DoubleTournament;
30
	}
31
32
	@Override
33
	public Selector<T> resolve(final AbstractEAExecutionContext<T> eaExecutionContext,
34
			final AbstractEAConfiguration<T> eaConfiguration,
35
			final SelectionPolicyHandlerResolver<T> selectionPolicyHandlerResolver,
36
			final SelectionPolicy selectionPolicy) {
37
		Objects.requireNonNull(selectionPolicy);
38
		Validate.isInstanceOf(DoubleTournament.class, selectionPolicy);
39
40 2 1. resolve : removed call to net/bmahe/genetics4j/gp/selection/DoubleTournamentSelector::<init> → KILLED
2. resolve : replaced return value with null for net/bmahe/genetics4j/gp/selection/DoubleTournamentSelectionPolicyHandler::resolve → KILLED
		return new DoubleTournamentSelector<T>(selectionPolicy, randomGenerator);
41
	}
42
}

Mutations

22

1.1
Location : <init>
Killed by : net.bmahe.genetics4j.gp.selection.DoubleTournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.selection.DoubleTournamentSelectionPolicyHandlerTest]/[method:selectMaximize()]
Removed assignment to member variable randomGenerator → KILLED

29

1.1
Location : canHandle
Killed by : net.bmahe.genetics4j.gp.selection.DoubleTournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.selection.DoubleTournamentSelectionPolicyHandlerTest]/[method:canHandle()]
replaced boolean return with true for net/bmahe/genetics4j/gp/selection/DoubleTournamentSelectionPolicyHandler::canHandle → KILLED

2.2
Location : canHandle
Killed by : net.bmahe.genetics4j.gp.selection.DoubleTournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.selection.DoubleTournamentSelectionPolicyHandlerTest]/[method:canHandle()]
replaced boolean return with false for net/bmahe/genetics4j/gp/selection/DoubleTournamentSelectionPolicyHandler::canHandle → KILLED

40

1.1
Location : resolve
Killed by : net.bmahe.genetics4j.gp.selection.DoubleTournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.selection.DoubleTournamentSelectionPolicyHandlerTest]/[method:selectMaximize()]
removed call to net/bmahe/genetics4j/gp/selection/DoubleTournamentSelector::<init> → KILLED

2.2
Location : resolve
Killed by : net.bmahe.genetics4j.gp.selection.DoubleTournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.selection.DoubleTournamentSelectionPolicyHandlerTest]/[method:selectMaximize()]
replaced return value with null for net/bmahe/genetics4j/gp/selection/DoubleTournamentSelectionPolicyHandler::resolve → KILLED

Active mutators

Tests examined


Report generated by PIT 1.20.3