MultiPointArithmeticCombinationHandler.java

1
package net.bmahe.genetics4j.core.combination.multipointarithmetic;
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.DoubleChromosomeSpec;
12
import net.bmahe.genetics4j.core.spec.chromosome.FloatChromosomeSpec;
13
import net.bmahe.genetics4j.core.spec.chromosome.IntChromosomeSpec;
14
import net.bmahe.genetics4j.core.spec.combination.CombinationPolicy;
15
import net.bmahe.genetics4j.core.spec.combination.MultiPointArithmetic;
16
17
public class MultiPointArithmeticCombinationHandler<T extends Comparable<T>> implements ChromosomeCombinatorHandler<T> {
18
19
	private final RandomGenerator randomGenerator;
20
21
	public MultiPointArithmeticCombinationHandler(final RandomGenerator _randomGenerator) {
22
		Validate.notNull(_randomGenerator);
23
24 1 1. <init> : Removed assignment to member variable randomGenerator → SURVIVED
		this.randomGenerator = _randomGenerator;
25
	}
26
27
	@Override
28
	public boolean canHandle(final ChromosomeCombinatorResolver<T> chromosomeCombinatorResolver,
29
			final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) {
30
		Validate.notNull(chromosomeCombinatorResolver);
31
		Validate.notNull(combinationPolicy);
32
		Validate.notNull(chromosome);
33
34 15 1. canHandle : removed conditional - replaced equality check with false → NO_COVERAGE
2. canHandle : removed conditional - replaced equality check with true → NO_COVERAGE
3. canHandle : removed conditional - replaced equality check with false → NO_COVERAGE
4. canHandle : removed conditional - replaced equality check with true → NO_COVERAGE
5. canHandle : negated conditional → NO_COVERAGE
6. canHandle : removed conditional - replaced equality check with false → SURVIVED
7. canHandle : removed conditional - replaced equality check with true → NO_COVERAGE
8. canHandle : removed conditional - replaced equality check with false → NO_COVERAGE
9. canHandle : negated conditional → NO_COVERAGE
10. canHandle : negated conditional → NO_COVERAGE
11. canHandle : Substituted 1 with 0 → NO_COVERAGE
12. canHandle : replaced boolean return with true for net/bmahe/genetics4j/core/combination/multipointarithmetic/MultiPointArithmeticCombinationHandler::canHandle → KILLED
13. canHandle : removed conditional - replaced equality check with true → KILLED
14. canHandle : negated conditional → KILLED
15. canHandle : Substituted 0 with 1 → KILLED
		return combinationPolicy instanceof MultiPointArithmetic && (chromosome instanceof IntChromosomeSpec
35
				|| chromosome instanceof DoubleChromosomeSpec || chromosome instanceof FloatChromosomeSpec);
36
	}
37
38
	@Override
39
	public ChromosomeCombinator<T> resolve(final ChromosomeCombinatorResolver<T> chromosomeCombinatorResolver,
40
			final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) {
41
		Validate.notNull(chromosomeCombinatorResolver);
42
		Validate.notNull(combinationPolicy);
43
		Validate.notNull(chromosome);
44
		Validate.isInstanceOf(MultiPointArithmetic.class, combinationPolicy);
45
46 3 1. resolve : removed conditional - replaced equality check with false → NO_COVERAGE
2. resolve : negated conditional → NO_COVERAGE
3. resolve : removed conditional - replaced equality check with true → NO_COVERAGE
		if (chromosome instanceof IntChromosomeSpec) {
47 2 1. resolve : removed call to net/bmahe/genetics4j/core/combination/multipointarithmetic/IntChromosomeMultiPointArithmetic::<init> → NO_COVERAGE
2. resolve : replaced return value with null for net/bmahe/genetics4j/core/combination/multipointarithmetic/MultiPointArithmeticCombinationHandler::resolve → NO_COVERAGE
			return new IntChromosomeMultiPointArithmetic<T>(randomGenerator, (MultiPointArithmetic) combinationPolicy);
48
		}
49
50 3 1. resolve : removed conditional - replaced equality check with true → NO_COVERAGE
2. resolve : removed conditional - replaced equality check with false → NO_COVERAGE
3. resolve : negated conditional → NO_COVERAGE
		if (chromosome instanceof DoubleChromosomeSpec) {
51 2 1. resolve : replaced return value with null for net/bmahe/genetics4j/core/combination/multipointarithmetic/MultiPointArithmeticCombinationHandler::resolve → NO_COVERAGE
2. resolve : removed call to net/bmahe/genetics4j/core/combination/multipointarithmetic/DoubleChromosomeMultiPointArithmetic::<init> → NO_COVERAGE
			return new DoubleChromosomeMultiPointArithmetic<T>(randomGenerator, (MultiPointArithmetic) combinationPolicy);
52
		}
53
54 3 1. resolve : negated conditional → NO_COVERAGE
2. resolve : removed conditional - replaced equality check with true → NO_COVERAGE
3. resolve : removed conditional - replaced equality check with false → NO_COVERAGE
		if (chromosome instanceof FloatChromosomeSpec) {
55 2 1. resolve : replaced return value with null for net/bmahe/genetics4j/core/combination/multipointarithmetic/MultiPointArithmeticCombinationHandler::resolve → NO_COVERAGE
2. resolve : removed call to net/bmahe/genetics4j/core/combination/multipointarithmetic/FloatChromosomeMultiPointArithmetic::<init> → NO_COVERAGE
			return new FloatChromosomeMultiPointArithmetic<T>(randomGenerator, (MultiPointArithmetic) combinationPolicy);
56
		}
57
58 2 1. resolve : removed call to java/lang/IllegalArgumentException::<init> → NO_COVERAGE
2. resolve : removed call to java/lang/String::valueOf → NO_COVERAGE
		throw new IllegalArgumentException("Could not handle chromosome " + chromosome);
59
	}
60
61
}

Mutations

24

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

34

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

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

3.3
Location : canHandle
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testGetterMethods()]
replaced boolean return with true for net/bmahe/genetics4j/core/combination/multipointarithmetic/MultiPointArithmeticCombinationHandler::canHandle → KILLED

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

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

6.6
Location : canHandle
Killed by : net.bmahe.genetics4j.core.mutation.SupersimpleTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.mutation.SupersimpleTest]/[method:simple()]
removed conditional - replaced equality check with true → KILLED

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

8.8
Location : canHandle
Killed by : net.bmahe.genetics4j.core.mutation.SupersimpleTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.mutation.SupersimpleTest]/[method:simple()]
negated conditional → KILLED

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

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

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

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

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

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

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

46

1.1
Location : resolve
Killed by : none
removed conditional - replaced equality check with false → NO_COVERAGE

2.2
Location : resolve
Killed by : none
negated conditional → NO_COVERAGE

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

47

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

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

50

1.1
Location : resolve
Killed by : none
removed conditional - replaced equality check with true → NO_COVERAGE

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

3.3
Location : resolve
Killed by : none
negated conditional → NO_COVERAGE

51

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

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

54

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

2.2
Location : resolve
Killed by : none
removed conditional - replaced equality check with true → NO_COVERAGE

3.3
Location : resolve
Killed by : none
removed conditional - replaced equality check with false → NO_COVERAGE

55

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

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

58

1.1
Location : resolve
Killed by : none
removed call to java/lang/IllegalArgumentException::<init> → NO_COVERAGE

2.2
Location : resolve
Killed by : none
removed call to java/lang/String::valueOf → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.19.6