Tournament.java

1
package net.bmahe.genetics4j.core.spec.selection;
2
3
import java.util.Comparator;
4
5
import org.apache.commons.lang3.Validate;
6
import org.immutables.value.Value;
7
8
import net.bmahe.genetics4j.core.Individual;
9
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 : removed call to java/util/Comparator::comparing → KILLED
2. comparator : replaced return value with null for net/bmahe/genetics4j/core/spec/selection/Tournament::comparator → KILLED
		return Comparator.comparing(Individual::fitness);
19
	}
20
21
	public static class Builder<T extends Comparable<T>> extends ImmutableTournament.Builder<T> {
22
		@Override
23
		public Tournament<T> build() {
24 1 1. build : removed call to net/bmahe/genetics4j/core/spec/selection/ImmutableTournament$Builder::build → KILLED
			final Tournament<T> instance = super.build();
25
			Validate.isTrue(instance.numCandidates() > 0, "Number of candidates must be positive");
26 1 1. build : replaced return value with null for net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::build → KILLED
			return instance;
27
		}
28
	}
29
30
	public static <U extends Comparable<U>> Tournament<U> of(final int numCandidates) {
31
		Validate.isTrue(numCandidates > 0, "Number of candidates must be positive");
32 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);
33
	}
34
35
	public static <U extends Comparable<U>> Tournament<U> of(final int numCandidates,
36
			final Comparator<Individual<U>> comparator) {
37
		Validate.isTrue(numCandidates > 0, "Number of candidates must be positive");
38 7 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/Tournament$Builder::numCandidates → KILLED
3. of : removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::<init> → KILLED
4. of : removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::build → KILLED
5. of : removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::comparator → KILLED
6. of : replaced call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::numCandidates with receiver → KILLED
7. of : replaced call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::comparator with receiver → KILLED
		return new Builder<U>().numCandidates(numCandidates).comparator(comparator).build();
39
	}
40
41
}

Mutations

18

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

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

24

1.1
Location : build
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/ImmutableTournament$Builder::build → KILLED

26

1.1
Location : build
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$Builder::build → KILLED

32

1.1
Location : of
Killed by : net.bmahe.genetics4j.core.selection.SelectAllPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.SelectAllPolicyHandlerTest]/[method:canHandleRequiresSelectionPolicy()]
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.SelectAllPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.SelectAllPolicyHandlerTest]/[method:canHandleRequiresSelectionPolicy()]
removed call to net/bmahe/genetics4j/core/spec/selection/ImmutableTournament::of → KILLED

38

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()]
removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::numCandidates → 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()]
removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::<init> → 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::build → 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::comparator → 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()]
replaced call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::numCandidates with receiver → 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()]
replaced call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::comparator with receiver → KILLED

Active mutators

Tests examined


Report generated by PIT 1.25.7 support