Tournament.java

1
package net.bmahe.genetics4j.core.spec.selection;
2
3
import java.util.Comparator;
4
5
import org.immutables.value.Value;
6
7
import net.bmahe.genetics4j.core.Individual;
8
9
@Value.Style(overshadowImplementation = true)
10
@Value.Immutable
11
public abstract class Tournament<T extends Comparable<T>> implements SelectionPolicy {
12
13
	@Value.Parameter
14
	public abstract int numCandidates();
15
16
	@Value.Default
17
	public Comparator<Individual<T>> comparator() {
18 2 1. comparator : replaced return value with null for net/bmahe/genetics4j/core/spec/selection/Tournament::comparator → KILLED
2. comparator : removed call to java/util/Comparator::comparing → KILLED
		return Comparator.comparing(Individual::fitness);
19
	}
20
21
	/*
22
	 * TODO: Enabling this makes immutables create non-compilable code
23
	 * 
24
	 * @Value.Check
25
	 * protected void check() {
26
	 * Validate.isTrue(numCandidates() > 0);
27
	 * }
28
	 */
29
30
	public static class Builder<T extends Comparable<T>> extends ImmutableTournament.Builder<T> {
31
	}
32
33
	public static <U extends Comparable<U>> Tournament<U> of(final int numCandidates) {
34 2 1. of : replaced return value with null for net/bmahe/genetics4j/core/spec/selection/Tournament::of → KILLED
2. of : removed call to net/bmahe/genetics4j/core/spec/selection/ImmutableTournament::of → KILLED
		return ImmutableTournament.of(numCandidates);
35
	}
36
37
	public static <U extends Comparable<U>> Tournament<U> of(final int numCandidates,
38
			final Comparator<Individual<U>> comparator) {
39 7 1. of : replaced return value with null for net/bmahe/genetics4j/core/spec/selection/Tournament::of → KILLED
2. of : replaced call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::numCandidates with receiver → KILLED
3. of : replaced call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::comparator with receiver → KILLED
4. of : removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::numCandidates → KILLED
5. of : removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::build → KILLED
6. of : removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::comparator → KILLED
7. of : removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::<init> → KILLED
		return new Builder<U>().numCandidates(numCandidates).comparator(comparator).build();
40
	}
41
42
}

Mutations

18

1.1
Location : comparator
Killed by : net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest]/[method:randomIsRequired()]
replaced return value with null for net/bmahe/genetics4j/core/spec/selection/Tournament::comparator → KILLED

2.2
Location : comparator
Killed by : net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest]/[method:randomIsRequired()]
removed call to java/util/Comparator::comparing → KILLED

34

1.1
Location : of
Killed by : net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest]/[method:randomIsRequired()]
replaced return value with null for net/bmahe/genetics4j/core/spec/selection/Tournament::of → KILLED

2.2
Location : of
Killed by : net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.TournamentSelectionPolicyHandlerTest]/[method:randomIsRequired()]
removed call to net/bmahe/genetics4j/core/spec/selection/ImmutableTournament::of → KILLED

39

1.1
Location : of
Killed by : net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[method:selectMaxThenMin()]
replaced return value with null for net/bmahe/genetics4j/core/spec/selection/Tournament::of → KILLED

2.2
Location : of
Killed by : net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[method:selectMaxThenMin()]
replaced call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::numCandidates with receiver → KILLED

3.3
Location : of
Killed by : net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[method:selectMaxThenMin()]
replaced call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::comparator with receiver → KILLED

4.4
Location : of
Killed by : net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[method:selectMaxThenMin()]
removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::numCandidates → KILLED

5.5
Location : of
Killed by : net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[method:selectMaxThenMin()]
removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::build → KILLED

6.6
Location : of
Killed by : net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[method:selectMaxThenMin()]
removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::comparator → KILLED

7.7
Location : of
Killed by : net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[method:selectMaxThenMin()]
removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::<init> → KILLED

Active mutators

Tests examined


Report generated by PIT 1.19.6