1 | package net.bmahe.genetics4j.core.combination.multicombinations; | |
2 | ||
3 | import java.util.List; | |
4 | import java.util.random.RandomGenerator; | |
5 | ||
6 | import org.apache.commons.lang3.Validate; | |
7 | ||
8 | import net.bmahe.genetics4j.core.chromosomes.Chromosome; | |
9 | import net.bmahe.genetics4j.core.combination.ChromosomeCombinator; | |
10 | import net.bmahe.genetics4j.core.spec.AbstractEAConfiguration; | |
11 | ||
12 | public class MultiChromosomeCombinations<T extends Comparable<T>> implements ChromosomeCombinator<T> { | |
13 | ||
14 | private final RandomGenerator randomGenerator; | |
15 | private final List<ChromosomeCombinator<T>> chromosomeCombinators; | |
16 | ||
17 | public MultiChromosomeCombinations(final RandomGenerator _randomGenerator, | |
18 | final List<ChromosomeCombinator<T>> _chromosomeCombinators) { | |
19 | Validate.notNull(_randomGenerator); | |
20 | Validate.notNull(_chromosomeCombinators); | |
21 | ||
22 |
1
1. <init> : Removed assignment to member variable randomGenerator → NO_COVERAGE |
this.randomGenerator = _randomGenerator; |
23 |
1
1. <init> : Removed assignment to member variable chromosomeCombinators → NO_COVERAGE |
this.chromosomeCombinators = _chromosomeCombinators; |
24 | } | |
25 | ||
26 | @Override | |
27 | public List<Chromosome> combine(final AbstractEAConfiguration<T> eaConfiguration, final Chromosome chromosome1, | |
28 | final T firstParentFitness, final Chromosome chromosome2, final T secondParentFitness) { | |
29 | ||
30 |
3
1. combine : removed call to java/util/List::size → NO_COVERAGE 2. combine : replaced call to java/util/random/RandomGenerator::nextInt with argument → NO_COVERAGE 3. combine : removed call to java/util/random/RandomGenerator::nextInt → NO_COVERAGE |
final int chromosomeCombinatorIndex = randomGenerator.nextInt(chromosomeCombinators.size()); |
31 |
1
1. combine : removed call to java/util/List::get → NO_COVERAGE |
final ChromosomeCombinator<T> chromosomeCombinator = chromosomeCombinators.get(chromosomeCombinatorIndex); |
32 | ||
33 |
1
1. combine : replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/multicombinations/MultiChromosomeCombinations::combine → NO_COVERAGE |
return chromosomeCombinator |
34 |
1
1. combine : removed call to net/bmahe/genetics4j/core/combination/ChromosomeCombinator::combine → NO_COVERAGE |
.combine(eaConfiguration, chromosome1, firstParentFitness, chromosome2, secondParentFitness); |
35 | } | |
36 | ||
37 | } | |
Mutations | ||
22 |
1.1 |
|
23 |
1.1 |
|
30 |
1.1 2.2 3.3 |
|
31 |
1.1 |
|
33 |
1.1 |
|
34 |
1.1 |