ChromosomeResolverUtils.java

1
package net.bmahe.genetics4j.core.util;
2
3
import java.util.List;
4
5
import org.apache.commons.lang3.Validate;
6
7
import net.bmahe.genetics4j.core.chromosomes.Chromosome;
8
import net.bmahe.genetics4j.core.mutation.chromosome.ChromosomeMutationHandler;
9
import net.bmahe.genetics4j.core.spec.AbstractEAConfiguration;
10
import net.bmahe.genetics4j.core.spec.AbstractEAExecutionContext;
11
import net.bmahe.genetics4j.core.spec.chromosome.ChromosomeSpec;
12
import net.bmahe.genetics4j.core.spec.mutation.MutationPolicy;
13
14
public class ChromosomeResolverUtils {
15
16
	public static <T extends Comparable<T>> ChromosomeMutationHandler<? extends Chromosome> findMatchingChromosomeMutationPolicyHandler(
17
			final AbstractEAExecutionContext<T> eaExecutionContext, final MutationPolicy mutationPolicy,
18
			final ChromosomeSpec chromosomeSpec) {
19
		Validate.notNull(eaExecutionContext);
20
		Validate.notNull(mutationPolicy);
21
		Validate.notNull(chromosomeSpec);
22
23
		final List<ChromosomeMutationHandler<? extends Chromosome>> chromosomeMutationPolicyHandlers = eaExecutionContext
24 1 1. findMatchingChromosomeMutationPolicyHandler : removed call to net/bmahe/genetics4j/core/spec/AbstractEAExecutionContext::chromosomeMutationPolicyHandlers → KILLED
				.chromosomeMutationPolicyHandlers();
25
26 2 1. findMatchingChromosomeMutationPolicyHandler : removed call to java/util/List::stream → KILLED
2. findMatchingChromosomeMutationPolicyHandler : replaced return value with null for net/bmahe/genetics4j/core/util/ChromosomeResolverUtils::findMatchingChromosomeMutationPolicyHandler → KILLED
		return chromosomeMutationPolicyHandlers.stream()
27 9 1. lambda$findMatchingChromosomeMutationPolicyHandler$0 : negated conditional → KILLED
2. findMatchingChromosomeMutationPolicyHandler : removed call to java/util/stream/Stream::dropWhile → KILLED
3. lambda$findMatchingChromosomeMutationPolicyHandler$0 : replaced boolean return with true for net/bmahe/genetics4j/core/util/ChromosomeResolverUtils::lambda$findMatchingChromosomeMutationPolicyHandler$0 → KILLED
4. lambda$findMatchingChromosomeMutationPolicyHandler$0 : Substituted 0 with 1 → KILLED
5. lambda$findMatchingChromosomeMutationPolicyHandler$0 : Substituted 1 with 0 → KILLED
6. findMatchingChromosomeMutationPolicyHandler : replaced call to java/util/stream/Stream::dropWhile with receiver → KILLED
7. lambda$findMatchingChromosomeMutationPolicyHandler$0 : removed conditional - replaced equality check with false → KILLED
8. lambda$findMatchingChromosomeMutationPolicyHandler$0 : removed call to net/bmahe/genetics4j/core/mutation/chromosome/ChromosomeMutationHandler::canHandle → KILLED
9. lambda$findMatchingChromosomeMutationPolicyHandler$0 : removed conditional - replaced equality check with true → KILLED
				.dropWhile((sph) -> sph.canHandle(mutationPolicy, chromosomeSpec) == false)
28 1 1. findMatchingChromosomeMutationPolicyHandler : removed call to java/util/stream/Stream::findFirst → KILLED
				.findFirst()
29 1 1. findMatchingChromosomeMutationPolicyHandler : removed call to java/util/Optional::orElseThrow → KILLED
				.orElseThrow(
30 4 1. lambda$findMatchingChromosomeMutationPolicyHandler$1 : removed call to java/lang/String::valueOf → NO_COVERAGE
2. lambda$findMatchingChromosomeMutationPolicyHandler$1 : removed call to java/lang/String::valueOf → NO_COVERAGE
3. lambda$findMatchingChromosomeMutationPolicyHandler$1 : removed call to java/lang/IllegalStateException::<init> → NO_COVERAGE
4. lambda$findMatchingChromosomeMutationPolicyHandler$1 : replaced return value with null for net/bmahe/genetics4j/core/util/ChromosomeResolverUtils::lambda$findMatchingChromosomeMutationPolicyHandler$1 → NO_COVERAGE
						() -> new IllegalStateException(
31
								"Could not find suitable chromosome mutation policy handler for policy: " + mutationPolicy
32
										+ " and chromosome spec: " + chromosomeSpec));
33
	}
34
35
	public static <T extends Comparable<T>> ChromosomeMutationHandler<? extends Chromosome>[] resolveChromosomeMutationHandlers(
36
			final AbstractEAExecutionContext<T> eaExecutionContext, final AbstractEAConfiguration<T> eaConfiguration,
37
			final MutationPolicy mutationPolicy) {
38
		Validate.notNull(eaExecutionContext);
39
		Validate.notNull(eaConfiguration);
40
		Validate.notNull(mutationPolicy);
41
42
		final ChromosomeMutationHandler<? extends Chromosome>[] chromosomePolicyHandlers = new ChromosomeMutationHandler[eaConfiguration
43 1 1. resolveChromosomeMutationHandlers : removed call to net/bmahe/genetics4j/core/spec/AbstractEAConfiguration::chromosomeSpecs → KILLED
				.chromosomeSpecs()
44 1 1. resolveChromosomeMutationHandlers : removed call to java/util/List::size → KILLED
				.size()];
45 1 1. resolveChromosomeMutationHandlers : removed call to net/bmahe/genetics4j/core/spec/AbstractEAConfiguration::chromosomeSpecs → KILLED
		final List<ChromosomeSpec> chromosomeSpecs = eaConfiguration.chromosomeSpecs();
46 6 1. resolveChromosomeMutationHandlers : negated conditional → KILLED
2. resolveChromosomeMutationHandlers : removed call to java/util/List::size → KILLED
3. resolveChromosomeMutationHandlers : changed conditional boundary → KILLED
4. resolveChromosomeMutationHandlers : removed conditional - replaced comparison check with false → KILLED
5. resolveChromosomeMutationHandlers : Substituted 0 with 1 → KILLED
6. resolveChromosomeMutationHandlers : removed conditional - replaced comparison check with true → KILLED
		for (int i = 0; i < chromosomeSpecs.size(); i++) {
47 1 1. resolveChromosomeMutationHandlers : removed call to java/util/List::get → KILLED
			final ChromosomeSpec chromosomeSpec = chromosomeSpecs.get(i);
48 1 1. resolveChromosomeMutationHandlers : removed call to net/bmahe/genetics4j/core/util/ChromosomeResolverUtils::findMatchingChromosomeMutationPolicyHandler → KILLED
			chromosomePolicyHandlers[i] = findMatchingChromosomeMutationPolicyHandler(
49
					eaExecutionContext,
50
						mutationPolicy,
51
						chromosomeSpec);
52
		}
53
54 1 1. resolveChromosomeMutationHandlers : replaced return value with null for net/bmahe/genetics4j/core/util/ChromosomeResolverUtils::resolveChromosomeMutationHandlers → KILLED
		return chromosomePolicyHandlers;
55
	}
56
}

Mutations

24

1.1
Location : findMatchingChromosomeMutationPolicyHandler
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
removed call to net/bmahe/genetics4j/core/spec/AbstractEAExecutionContext::chromosomeMutationPolicyHandlers → KILLED

26

1.1
Location : findMatchingChromosomeMutationPolicyHandler
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
removed call to java/util/List::stream → KILLED

2.2
Location : findMatchingChromosomeMutationPolicyHandler
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()]
replaced return value with null for net/bmahe/genetics4j/core/util/ChromosomeResolverUtils::findMatchingChromosomeMutationPolicyHandler → KILLED

27

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

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

3.3
Location : lambda$findMatchingChromosomeMutationPolicyHandler$0
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
replaced boolean return with true for net/bmahe/genetics4j/core/util/ChromosomeResolverUtils::lambda$findMatchingChromosomeMutationPolicyHandler$0 → KILLED

4.4
Location : lambda$findMatchingChromosomeMutationPolicyHandler$0
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
Substituted 0 with 1 → KILLED

5.5
Location : lambda$findMatchingChromosomeMutationPolicyHandler$0
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()]
Substituted 1 with 0 → KILLED

6.6
Location : findMatchingChromosomeMutationPolicyHandler
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()]
replaced call to java/util/stream/Stream::dropWhile with receiver → KILLED

7.7
Location : lambda$findMatchingChromosomeMutationPolicyHandler$0
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()]
removed conditional - replaced equality check with false → KILLED

8.8
Location : lambda$findMatchingChromosomeMutationPolicyHandler$0
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
removed call to net/bmahe/genetics4j/core/mutation/chromosome/ChromosomeMutationHandler::canHandle → KILLED

9.9
Location : lambda$findMatchingChromosomeMutationPolicyHandler$0
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
removed conditional - replaced equality check with true → KILLED

28

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

29

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

30

1.1
Location : lambda$findMatchingChromosomeMutationPolicyHandler$1
Killed by : none
removed call to java/lang/String::valueOf → NO_COVERAGE

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

3.3
Location : lambda$findMatchingChromosomeMutationPolicyHandler$1
Killed by : none
removed call to java/lang/IllegalStateException::<init> → NO_COVERAGE

4.4
Location : lambda$findMatchingChromosomeMutationPolicyHandler$1
Killed by : none
replaced return value with null for net/bmahe/genetics4j/core/util/ChromosomeResolverUtils::lambda$findMatchingChromosomeMutationPolicyHandler$1 → NO_COVERAGE

43

1.1
Location : resolveChromosomeMutationHandlers
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
removed call to net/bmahe/genetics4j/core/spec/AbstractEAConfiguration::chromosomeSpecs → KILLED

44

1.1
Location : resolveChromosomeMutationHandlers
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
removed call to java/util/List::size → KILLED

45

1.1
Location : resolveChromosomeMutationHandlers
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
removed call to net/bmahe/genetics4j/core/spec/AbstractEAConfiguration::chromosomeSpecs → KILLED

46

1.1
Location : resolveChromosomeMutationHandlers
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()]
negated conditional → KILLED

2.2
Location : resolveChromosomeMutationHandlers
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()]
removed call to java/util/List::size → KILLED

3.3
Location : resolveChromosomeMutationHandlers
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
changed conditional boundary → KILLED

4.4
Location : resolveChromosomeMutationHandlers
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()]
removed conditional - replaced comparison check with false → KILLED

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

6.6
Location : resolveChromosomeMutationHandlers
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
removed conditional - replaced comparison check with true → KILLED

47

1.1
Location : resolveChromosomeMutationHandlers
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
removed call to java/util/List::get → KILLED

48

1.1
Location : resolveChromosomeMutationHandlers
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testEvolveWithIntChromosome()]
removed call to net/bmahe/genetics4j/core/util/ChromosomeResolverUtils::findMatchingChromosomeMutationPolicyHandler → KILLED

54

1.1
Location : resolveChromosomeMutationHandlers
Killed by : net.bmahe.genetics4j.core.EASystemTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.EASystemTest]/[method:testSystemConstruction()]
replaced return value with null for net/bmahe/genetics4j/core/util/ChromosomeResolverUtils::resolveChromosomeMutationHandlers → KILLED

Active mutators

Tests examined


Report generated by PIT 1.20.3