TournamentNSGA2SelectionPolicyHandler.java

1
package net.bmahe.genetics4j.moo.nsga2.impl;
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.moo.nsga2.spec.TournamentNSGA2Selection;
15
16
public class TournamentNSGA2SelectionPolicyHandler<T extends Comparable<T>> implements SelectionPolicyHandler<T> {
17
18
	private final RandomGenerator randomGenerator;
19
20
	public TournamentNSGA2SelectionPolicyHandler(final RandomGenerator _randomGenerator) {
21
		Objects.requireNonNull(_randomGenerator);
22
23 1 1. <init> : Removed assignment to member variable randomGenerator → KILLED
		this.randomGenerator = _randomGenerator;
24
	}
25
26
	@Override
27
	public boolean canHandle(final SelectionPolicy selectionPolicy) {
28
		Objects.requireNonNull(selectionPolicy);
29 2 1. canHandle : replaced boolean return with true for net/bmahe/genetics4j/moo/nsga2/impl/TournamentNSGA2SelectionPolicyHandler::canHandle → KILLED
2. canHandle : replaced boolean return with false for net/bmahe/genetics4j/moo/nsga2/impl/TournamentNSGA2SelectionPolicyHandler::canHandle → KILLED
		return selectionPolicy instanceof TournamentNSGA2Selection<?>;
30
	}
31
32
	@Override
33
	public Selector<T> resolve(final AbstractEAExecutionContext<T> EASystemDescriptor,
34
			final AbstractEAConfiguration<T> eaConfiguration,
35
			final SelectionPolicyHandlerResolver<T> selectionPolicyHandlerResolver,
36
			final SelectionPolicy selectionPolicy) {
37
		Objects.requireNonNull(EASystemDescriptor);
38
		Objects.requireNonNull(eaConfiguration);
39
		Objects.requireNonNull(selectionPolicyHandlerResolver);
40
		Objects.requireNonNull(selectionPolicy);
41
		Validate.isInstanceOf(TournamentNSGA2Selection.class, selectionPolicy);
42
43
		final TournamentNSGA2Selection<T> tournamentNsga2Spec = (TournamentNSGA2Selection<T>) selectionPolicy;
44
45 2 1. resolve : replaced return value with null for net/bmahe/genetics4j/moo/nsga2/impl/TournamentNSGA2SelectionPolicyHandler::resolve → KILLED
2. resolve : removed call to net/bmahe/genetics4j/moo/nsga2/impl/TournamentNSGA2Selector::<init> → KILLED
		return new TournamentNSGA2Selector<>(randomGenerator, tournamentNsga2Spec);
46
	}
47
}

Mutations

23

1.1
Location : <init>
Killed by : net.bmahe.genetics4j.moo.nsga2.impl.TournamentNSGA2SelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.moo.nsga2.impl.TournamentNSGA2SelectionPolicyHandlerTest]/[method:resolve()]
Removed assignment to member variable randomGenerator → KILLED

29

1.1
Location : canHandle
Killed by : net.bmahe.genetics4j.moo.nsga2.impl.TournamentNSGA2SelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.moo.nsga2.impl.TournamentNSGA2SelectionPolicyHandlerTest]/[method:canHandle()]
replaced boolean return with true for net/bmahe/genetics4j/moo/nsga2/impl/TournamentNSGA2SelectionPolicyHandler::canHandle → KILLED

2.2
Location : canHandle
Killed by : net.bmahe.genetics4j.moo.nsga2.impl.TournamentNSGA2SelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.moo.nsga2.impl.TournamentNSGA2SelectionPolicyHandlerTest]/[method:canHandle()]
replaced boolean return with false for net/bmahe/genetics4j/moo/nsga2/impl/TournamentNSGA2SelectionPolicyHandler::canHandle → KILLED

45

1.1
Location : resolve
Killed by : net.bmahe.genetics4j.moo.nsga2.impl.TournamentNSGA2SelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.moo.nsga2.impl.TournamentNSGA2SelectionPolicyHandlerTest]/[method:resolve()]
replaced return value with null for net/bmahe/genetics4j/moo/nsga2/impl/TournamentNSGA2SelectionPolicyHandler::resolve → KILLED

2.2
Location : resolve
Killed by : net.bmahe.genetics4j.moo.nsga2.impl.TournamentNSGA2SelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.moo.nsga2.impl.TournamentNSGA2SelectionPolicyHandlerTest]/[method:resolve()]
removed call to net/bmahe/genetics4j/moo/nsga2/impl/TournamentNSGA2Selector::<init> → KILLED

Active mutators

Tests examined


Report generated by PIT 1.25.7 support