MultiChromosomeCombinations.java

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

Mutations

21

1.1
Location : <init>
Killed by : none
Removed assignment to member variable randomGenerator → NO_COVERAGE

22

1.1
Location : <init>
Killed by : none
Removed assignment to member variable chromosomeCombinators → NO_COVERAGE

29

1.1
Location : combine
Killed by : none
removed call to java/util/List::size → NO_COVERAGE

2.2
Location : combine
Killed by : none
replaced call to java/util/random/RandomGenerator::nextInt with argument → NO_COVERAGE

3.3
Location : combine
Killed by : none
removed call to java/util/random/RandomGenerator::nextInt → NO_COVERAGE

30

1.1
Location : combine
Killed by : none
removed call to java/util/List::get → NO_COVERAGE

32

1.1
Location : combine
Killed by : none
replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/multicombinations/MultiChromosomeCombinations::combine → NO_COVERAGE

33

1.1
Location : combine
Killed by : none
removed call to net/bmahe/genetics4j/core/combination/ChromosomeCombinator::combine → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.25.7 support