1 | package net.bmahe.genetics4j.core.combination; | |
2 | ||
3 | import java.util.List; | |
4 | ||
5 | import org.apache.commons.lang3.Validate; | |
6 | ||
7 | import net.bmahe.genetics4j.core.chromosomes.Chromosome; | |
8 | import net.bmahe.genetics4j.core.spec.AbstractEAConfiguration; | |
9 | import net.bmahe.genetics4j.core.spec.chromosome.ChromosomeSpec; | |
10 | import net.bmahe.genetics4j.core.spec.combination.CombinationPolicy; | |
11 | import net.bmahe.genetics4j.core.spec.combination.PickFirstParent; | |
12 | ||
13 | public class PickFirstParentHandler<T extends Comparable<T>> implements ChromosomeCombinatorHandler<T> { | |
14 | ||
15 | @Override | |
16 | public boolean canHandle(final ChromosomeCombinatorResolver<T> chromosomeCombinatorResolver, | |
17 | final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) { | |
18 | Validate.notNull(combinationPolicy); | |
19 | ||
20 |
2
1. canHandle : replaced boolean return with true for net/bmahe/genetics4j/core/combination/PickFirstParentHandler::canHandle → NO_COVERAGE 2. canHandle : replaced boolean return with false for net/bmahe/genetics4j/core/combination/PickFirstParentHandler::canHandle → NO_COVERAGE |
return combinationPolicy instanceof PickFirstParent; |
21 | ||
22 | } | |
23 | ||
24 | @Override | |
25 | public ChromosomeCombinator<T> resolve(final ChromosomeCombinatorResolver<T> chromosomeCombinatorResolver, | |
26 | final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) { | |
27 | ||
28 |
2
1. resolve : removed call to net/bmahe/genetics4j/core/combination/PickFirstParentHandler$1::<init> → NO_COVERAGE 2. resolve : replaced return value with null for net/bmahe/genetics4j/core/combination/PickFirstParentHandler::resolve → NO_COVERAGE |
return new ChromosomeCombinator<T>() { |
29 | ||
30 | @Override | |
31 | public List<Chromosome> combine(final AbstractEAConfiguration<T> eaConfiguration, final Chromosome chromosome1, | |
32 | final T firstParentFitness, final Chromosome chromosome2, final T secondParentFitness) { | |
33 | Validate.notNull(chromosome1); | |
34 | ||
35 |
2
1. combine : removed call to java/util/List::of → NO_COVERAGE 2. combine : replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/PickFirstParentHandler$1::combine → NO_COVERAGE |
return List.of(chromosome1); |
36 | } | |
37 | }; | |
38 | } | |
39 | } | |
Mutations | ||
20 |
1.1 2.2 |
|
28 |
1.1 2.2 |
|
35 |
1.1 2.2 |