DoubleTournamentSelectionPolicyHandler.java

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

Mutations

18

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

25

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

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

36

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

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

Active mutators

Tests examined


Report generated by PIT 1.19.6