MultiChromosomeCombinations.java

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
Location : <init>
Killed by : none
Removed assignment to member variable randomGenerator → NO_COVERAGE

23

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

30

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

31

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

33

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

34

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.19.6