IntOrderCrossoverHandler.java

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

Mutations

23

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

32

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

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

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

4.4
Location : canHandle
Killed by : none
negated conditional → TIMED_OUT

5.5
Location : canHandle
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:evolveWithBitChromosome()]
replaced boolean return with true for net/bmahe/genetics4j/core/combination/ordercrossover/IntOrderCrossoverHandler::canHandle → KILLED

6.6
Location : canHandle
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:evolveWithBitChromosome()]
Substituted 0 with 1 → KILLED

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

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

9.9
Location : canHandle
Killed by : none
removed conditional - replaced equality check with false → SURVIVED Covering tests

43

1.1
Location : resolve
Killed by : none
removed call to net/bmahe/genetics4j/core/combination/ordercrossover/IntChromosomeOrderCrossover::<init> → NO_COVERAGE

2.2
Location : resolve
Killed by : none
replaced return value with null for net/bmahe/genetics4j/core/combination/ordercrossover/IntOrderCrossoverHandler::resolve → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.25.7 support