ChromosomeCombinatorResolver.java

1
package net.bmahe.genetics4j.core.combination;
2
3
import java.util.List;
4
import java.util.Objects;
5
6
import net.bmahe.genetics4j.core.spec.AbstractEAExecutionContext;
7
import net.bmahe.genetics4j.core.spec.chromosome.ChromosomeSpec;
8
import net.bmahe.genetics4j.core.spec.combination.CombinationPolicy;
9
10
public class ChromosomeCombinatorResolver<T extends Comparable<T>> {
11
12
	private final AbstractEAExecutionContext<T> eaExecutionContext;
13
	private final List<ChromosomeCombinatorHandler<T>> chromosomeCombinatorHandlers;
14
15
	public ChromosomeCombinatorResolver(final AbstractEAExecutionContext<T> _eaExecutionContext) {
16
		Objects.requireNonNull(_eaExecutionContext);
17
18 1 1. <init> : Removed assignment to member variable eaExecutionContext → KILLED
		this.eaExecutionContext = _eaExecutionContext;
19 2 1. <init> : removed call to net/bmahe/genetics4j/core/spec/AbstractEAExecutionContext::chromosomeCombinatorHandlers → KILLED
2. <init> : Removed assignment to member variable chromosomeCombinatorHandlers → KILLED
		this.chromosomeCombinatorHandlers = eaExecutionContext.chromosomeCombinatorHandlers();
20
	}
21
22
	public boolean canHandle(final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) {
23
		Objects.requireNonNull(combinationPolicy);
24
		Objects.requireNonNull(chromosome);
25
26 7 1. canHandle : removed call to java/util/stream/Stream::anyMatch → NO_COVERAGE
2. lambda$canHandle$0 : removed call to net/bmahe/genetics4j/core/combination/ChromosomeCombinatorHandler::canHandle → NO_COVERAGE
3. canHandle : removed call to java/util/List::stream → NO_COVERAGE
4. canHandle : replaced boolean return with false for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::canHandle → NO_COVERAGE
5. lambda$canHandle$0 : replaced boolean return with true for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::lambda$canHandle$0 → NO_COVERAGE
6. lambda$canHandle$0 : replaced boolean return with false for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::lambda$canHandle$0 → NO_COVERAGE
7. canHandle : replaced boolean return with true for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::canHandle → NO_COVERAGE
		return chromosomeCombinatorHandlers.stream().anyMatch(cch -> cch.canHandle(this, combinationPolicy, chromosome));
27
28
	}
29
30
	public ChromosomeCombinator<T> resolve(final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) {
31
		Objects.requireNonNull(combinationPolicy);
32
		Objects.requireNonNull(chromosome);
33
34 2 1. resolve : replaced return value with null for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::resolve → KILLED
2. resolve : removed call to java/util/List::stream → KILLED
		return chromosomeCombinatorHandlers.stream()
35 9 1. lambda$resolve$0 : negated conditional → KILLED
2. resolve : removed call to java/util/stream/Stream::dropWhile → KILLED
3. lambda$resolve$0 : removed conditional - replaced equality check with true → KILLED
4. lambda$resolve$0 : removed call to net/bmahe/genetics4j/core/combination/ChromosomeCombinatorHandler::canHandle → KILLED
5. lambda$resolve$0 : replaced boolean return with true for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::lambda$resolve$0 → KILLED
6. lambda$resolve$0 : removed conditional - replaced equality check with false → KILLED
7. resolve : replaced call to java/util/stream/Stream::dropWhile with receiver → KILLED
8. lambda$resolve$0 : Substituted 1 with 0 → KILLED
9. lambda$resolve$0 : Substituted 0 with 1 → KILLED
				.dropWhile(cch -> cch.canHandle(this, combinationPolicy, chromosome) == false)
36 1 1. resolve : removed call to java/util/stream/Stream::findFirst → KILLED
				.findFirst()
37 4 1. lambda$resolve$1 : replaced return value with null for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::lambda$resolve$1 → KILLED
2. resolve : replaced call to java/util/Optional::map with receiver → KILLED
3. lambda$resolve$1 : removed call to net/bmahe/genetics4j/core/combination/ChromosomeCombinatorHandler::resolve → KILLED
4. resolve : removed call to java/util/Optional::map → KILLED
				.map(cch -> cch.resolve(this, combinationPolicy, chromosome))
38 1 1. resolve : removed call to java/util/Optional::orElseThrow → KILLED
				.orElseThrow(
39 4 1. lambda$resolve$2 : removed call to java/lang/IllegalStateException::<init> → NO_COVERAGE
2. lambda$resolve$2 : removed call to java/lang/String::valueOf → NO_COVERAGE
3. lambda$resolve$2 : removed call to java/lang/String::valueOf → NO_COVERAGE
4. lambda$resolve$2 : replaced return value with null for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::lambda$resolve$2 → NO_COVERAGE
						() -> new IllegalStateException(
40
								"Could not find suitable chromosome combination policy handler for policy " + combinationPolicy
41
										+ " and chromosome " + chromosome));
42
	}
43
}

Mutations

18

1.1
Location : <init>
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
Removed assignment to member variable eaExecutionContext → KILLED

19

1.1
Location : <init>
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
removed call to net/bmahe/genetics4j/core/spec/AbstractEAExecutionContext::chromosomeCombinatorHandlers → KILLED

2.2
Location : <init>
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
Removed assignment to member variable chromosomeCombinatorHandlers → KILLED

26

1.1
Location : canHandle
Killed by : none
removed call to java/util/stream/Stream::anyMatch → NO_COVERAGE

2.2
Location : lambda$canHandle$0
Killed by : none
removed call to net/bmahe/genetics4j/core/combination/ChromosomeCombinatorHandler::canHandle → NO_COVERAGE

3.3
Location : canHandle
Killed by : none
removed call to java/util/List::stream → NO_COVERAGE

4.4
Location : canHandle
Killed by : none
replaced boolean return with false for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::canHandle → NO_COVERAGE

5.5
Location : lambda$canHandle$0
Killed by : none
replaced boolean return with true for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::lambda$canHandle$0 → NO_COVERAGE

6.6
Location : lambda$canHandle$0
Killed by : none
replaced boolean return with false for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::lambda$canHandle$0 → NO_COVERAGE

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

34

1.1
Location : resolve
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:evolveWithIntChromosome()]
replaced return value with null for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::resolve → KILLED

2.2
Location : resolve
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
removed call to java/util/List::stream → KILLED

35

1.1
Location : lambda$resolve$0
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
negated conditional → KILLED

2.2
Location : resolve
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
removed call to java/util/stream/Stream::dropWhile → KILLED

3.3
Location : lambda$resolve$0
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
removed conditional - replaced equality check with true → KILLED

4.4
Location : lambda$resolve$0
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
removed call to net/bmahe/genetics4j/core/combination/ChromosomeCombinatorHandler::canHandle → KILLED

5.5
Location : lambda$resolve$0
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
replaced boolean return with true for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::lambda$resolve$0 → KILLED

6.6
Location : lambda$resolve$0
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
removed conditional - replaced equality check with false → KILLED

7.7
Location : resolve
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
replaced call to java/util/stream/Stream::dropWhile with receiver → KILLED

8.8
Location : lambda$resolve$0
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
Substituted 1 with 0 → KILLED

9.9
Location : lambda$resolve$0
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
Substituted 0 with 1 → KILLED

36

1.1
Location : resolve
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
removed call to java/util/stream/Stream::findFirst → KILLED

37

1.1
Location : lambda$resolve$1
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
replaced return value with null for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::lambda$resolve$1 → KILLED

2.2
Location : resolve
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
replaced call to java/util/Optional::map with receiver → KILLED

3.3
Location : lambda$resolve$1
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
removed call to net/bmahe/genetics4j/core/combination/ChromosomeCombinatorHandler::resolve → KILLED

4.4
Location : resolve
Killed by : net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.evaluation.FitnessEvaluatorVirtualThreadTest]/[method:virtualThreadFactory()]
removed call to java/util/Optional::map → KILLED

38

1.1
Location : resolve
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:evolveWithIntChromosome()]
removed call to java/util/Optional::orElseThrow → KILLED

39

1.1
Location : lambda$resolve$2
Killed by : none
removed call to java/lang/IllegalStateException::<init> → NO_COVERAGE

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

3.3
Location : lambda$resolve$2
Killed by : none
removed call to java/lang/String::valueOf → NO_COVERAGE

4.4
Location : lambda$resolve$2
Killed by : none
replaced return value with null for net/bmahe/genetics4j/core/combination/ChromosomeCombinatorResolver::lambda$resolve$2 → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.25.7 support