EdgeRecombinationCrossoverHandler.java

1
package net.bmahe.genetics4j.core.combination.erx;
2
3
import java.util.random.RandomGenerator;
4
5
import org.apache.commons.lang3.Validate;
6
7
import net.bmahe.genetics4j.core.combination.ChromosomeCombinator;
8
import net.bmahe.genetics4j.core.combination.ChromosomeCombinatorHandler;
9
import net.bmahe.genetics4j.core.combination.ChromosomeCombinatorResolver;
10
import net.bmahe.genetics4j.core.spec.chromosome.ChromosomeSpec;
11
import net.bmahe.genetics4j.core.spec.chromosome.IntChromosomeSpec;
12
import net.bmahe.genetics4j.core.spec.combination.CombinationPolicy;
13
import net.bmahe.genetics4j.core.spec.combination.EdgeRecombinationCrossover;
14
15
public class EdgeRecombinationCrossoverHandler<T extends Comparable<T>> implements ChromosomeCombinatorHandler<T> {
16
17
	private final RandomGenerator randomGenerator;
18
19
	public EdgeRecombinationCrossoverHandler(final RandomGenerator _randomGenerator) {
20
		Validate.notNull(_randomGenerator);
21
22 1 1. <init> : Removed assignment to member variable randomGenerator → SURVIVED
		this.randomGenerator = _randomGenerator;
23
	}
24
25
	@Override
26
	public boolean canHandle(final ChromosomeCombinatorResolver<T> chromosomeCombinatorResolver,
27
			final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) {
28
		Validate.notNull(combinationPolicy);
29
		Validate.notNull(chromosome);
30
31 9 1. canHandle : negated conditional → NO_COVERAGE
2. canHandle : removed conditional - replaced equality check with false → NO_COVERAGE
3. canHandle : removed conditional - replaced equality check with true → NO_COVERAGE
4. canHandle : Substituted 1 with 0 → NO_COVERAGE
5. canHandle : removed conditional - replaced equality check with false → NO_COVERAGE
6. canHandle : removed conditional - replaced equality check with true → NO_COVERAGE
7. canHandle : Substituted 0 with 1 → NO_COVERAGE
8. canHandle : negated conditional → NO_COVERAGE
9. canHandle : replaced boolean return with true for net/bmahe/genetics4j/core/combination/erx/EdgeRecombinationCrossoverHandler::canHandle → NO_COVERAGE
		return combinationPolicy instanceof EdgeRecombinationCrossover && chromosome instanceof IntChromosomeSpec;
32
	}
33
34
	@Override
35
	public ChromosomeCombinator<T> resolve(final ChromosomeCombinatorResolver<T> chromosomeCombinatorResolver,
36
			final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) {
37
		Validate.notNull(chromosomeCombinatorResolver);
38
		Validate.notNull(combinationPolicy);
39
		Validate.notNull(chromosome);
40
		Validate.isTrue(canHandle(chromosomeCombinatorResolver, combinationPolicy, chromosome));
41
42 2 1. resolve : replaced return value with null for net/bmahe/genetics4j/core/combination/erx/EdgeRecombinationCrossoverHandler::resolve → NO_COVERAGE
2. resolve : removed call to net/bmahe/genetics4j/core/combination/erx/IntEdgeRecombinationCrossover::<init> → NO_COVERAGE
		return new IntEdgeRecombinationCrossover<T>(randomGenerator);
43
	}
44
}

Mutations

22

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

31

1.1
Location : canHandle
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : canHandle
Killed by : none
removed conditional - replaced equality check with false → NO_COVERAGE

3.3
Location : canHandle
Killed by : none
removed conditional - replaced equality check with true → NO_COVERAGE

4.4
Location : canHandle
Killed by : none
Substituted 1 with 0 → NO_COVERAGE

5.5
Location : canHandle
Killed by : none
removed conditional - replaced equality check with false → NO_COVERAGE

6.6
Location : canHandle
Killed by : none
removed conditional - replaced equality check with true → NO_COVERAGE

7.7
Location : canHandle
Killed by : none
Substituted 0 with 1 → NO_COVERAGE

8.8
Location : canHandle
Killed by : none
negated conditional → NO_COVERAGE

9.9
Location : canHandle
Killed by : none
replaced boolean return with true for net/bmahe/genetics4j/core/combination/erx/EdgeRecombinationCrossoverHandler::canHandle → NO_COVERAGE

42

1.1
Location : resolve
Killed by : none
replaced return value with null for net/bmahe/genetics4j/core/combination/erx/EdgeRecombinationCrossoverHandler::resolve → NO_COVERAGE

2.2
Location : resolve
Killed by : none
removed call to net/bmahe/genetics4j/core/combination/erx/IntEdgeRecombinationCrossover::<init> → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.19.6