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.Immutable |
10
|
|
public abstract class Tournament<T extends Comparable<T>> implements SelectionPolicy { |
11
|
|
|
12
|
|
@Value.Parameter |
13
|
|
public abstract int numCandidates(); |
14
|
|
|
15
|
|
@Value.Default |
16
|
|
public Comparator<Individual<T>> comparator() { |
17
|
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); |
18
|
|
} |
19
|
|
|
20
|
|
/* |
21
|
|
* TODO: Enabling this makes immutables create non-compilable code |
22
|
|
* |
23
|
|
* @Value.Check protected void check() { Validate.isTrue(numCandidates() > 0); } |
24
|
|
*/ |
25
|
|
|
26
|
|
public static class Builder<T extends Comparable<T>> extends ImmutableTournament.Builder<T> { |
27
|
|
} |
28
|
|
|
29
|
|
public static <U extends Comparable<U>> Tournament<U> of(final int numCandidates) { |
30
|
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); |
31
|
|
} |
32
|
|
|
33
|
|
public static <U extends Comparable<U>> Tournament<U> of(final int numCandidates, |
34
|
|
final Comparator<Individual<U>> comparator) { |
35
|
4
1. of : replaced call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::numCandidates with receiver → 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 : replaced return value with null for net/bmahe/genetics4j/core/spec/selection/Tournament::of → KILLED
|
return new Builder<U>().numCandidates(numCandidates) |
36
|
2
1. of : replaced call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::comparator with receiver → KILLED
2. of : removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::comparator → KILLED
|
.comparator(comparator) |
37
|
1
1. of : removed call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::build → KILLED
|
.build(); |
38
|
|
} |
39
|
|
|
40
|
|
} |
| | Mutations |
17 |
|
1.1 Location : comparator Killed by : net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[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.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[method:randomIsRequired()] removed call to java/util/Comparator::comparing → KILLED
|
30 |
|
1.1 Location : of Killed by : net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[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.MultiTournamentsSelectionPolicyHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.selection.MultiTournamentsSelectionPolicyHandlerTest]/[method:randomIsRequired()] removed call to net/bmahe/genetics4j/core/spec/selection/ImmutableTournament::of → KILLED
|
35 |
|
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 call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::numCandidates with receiver → 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()] replaced return value with null for net/bmahe/genetics4j/core/spec/selection/Tournament::of → KILLED
|
36 |
|
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 call to net/bmahe/genetics4j/core/spec/selection/Tournament$Builder::comparator with receiver → 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::comparator → KILLED
|
37 |
|
1.1 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
|