1 | package net.bmahe.genetics4j.core.util; | |
2 | ||
3 | import java.util.Comparator; | |
4 | ||
5 | import org.apache.commons.lang3.Validate; | |
6 | ||
7 | import net.bmahe.genetics4j.core.Individual; | |
8 | import net.bmahe.genetics4j.core.spec.AbstractEAConfiguration; | |
9 | ||
10 | public class IndividualUtils { | |
11 | ||
12 | private IndividualUtils() { | |
13 | } | |
14 | ||
15 | public static <T extends Comparable<T>> Comparator<Individual<T>> fitnessBasedComparator( | |
16 | final AbstractEAConfiguration<T> eaConfiguration) { | |
17 | Validate.notNull(eaConfiguration); | |
18 | ||
19 |
1
1. fitnessBasedComparator : removed call to java/util/Comparator::comparing → KILLED |
final Comparator<Individual<T>> individualComparator = Comparator.comparing(Individual<T>::fitness); |
20 | ||
21 |
7
1. fitnessBasedComparator : removed call to java/lang/MatchException::<init> → NO_COVERAGE 2. fitnessBasedComparator : Changed switch default to be first case → KILLED 3. fitnessBasedComparator : removed call to net/bmahe/genetics4j/core/spec/AbstractEAConfiguration::optimization → KILLED 4. fitnessBasedComparator : RemoveSwitch 1 (case value 2) → KILLED 5. fitnessBasedComparator : RemoveSwitch 0 (case value 1) → KILLED 6. fitnessBasedComparator : replaced return value with null for net/bmahe/genetics4j/core/util/IndividualUtils::fitnessBasedComparator → KILLED 7. fitnessBasedComparator : removed call to net/bmahe/genetics4j/core/spec/Optimization::ordinal → KILLED |
return switch (eaConfiguration.optimization()) { |
22 | case MAXIMIZE -> individualComparator; | |
23 |
2
1. fitnessBasedComparator : removed call to java/util/Comparator::reversed → KILLED 2. fitnessBasedComparator : replaced call to java/util/Comparator::reversed with receiver → KILLED |
case MINIMIZE -> individualComparator.reversed(); |
24 | }; | |
25 | } | |
26 | } | |
Mutations | ||
19 |
1.1 |
|
21 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 |
|
23 |
1.1 2.2 |