PickFirstParentHandler.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.chromosomes.Chromosome;
7
import net.bmahe.genetics4j.core.spec.AbstractEAConfiguration;
8
import net.bmahe.genetics4j.core.spec.chromosome.ChromosomeSpec;
9
import net.bmahe.genetics4j.core.spec.combination.CombinationPolicy;
10
import net.bmahe.genetics4j.core.spec.combination.PickFirstParent;
11
12
public class PickFirstParentHandler<T extends Comparable<T>> implements ChromosomeCombinatorHandler<T> {
13
14
	@Override
15
	public boolean canHandle(final ChromosomeCombinatorResolver<T> chromosomeCombinatorResolver,
16
			final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) {
17
		Objects.requireNonNull(combinationPolicy);
18
19 2 1. canHandle : replaced boolean return with true for net/bmahe/genetics4j/core/combination/PickFirstParentHandler::canHandle → KILLED
2. canHandle : replaced boolean return with false for net/bmahe/genetics4j/core/combination/PickFirstParentHandler::canHandle → KILLED
		return combinationPolicy instanceof PickFirstParent;
20
21
	}
22
23
	@Override
24
	public ChromosomeCombinator<T> resolve(final ChromosomeCombinatorResolver<T> chromosomeCombinatorResolver,
25
			final CombinationPolicy combinationPolicy, final ChromosomeSpec chromosome) {
26
27 2 1. resolve : removed call to net/bmahe/genetics4j/core/combination/PickFirstParentHandler$1::<init> → KILLED
2. resolve : replaced return value with null for net/bmahe/genetics4j/core/combination/PickFirstParentHandler::resolve → KILLED
		return new ChromosomeCombinator<>() {
28
29
			@Override
30
			public List<Chromosome> combine(final AbstractEAConfiguration<T> eaConfiguration, final Chromosome chromosome1,
31
					final T firstParentFitness, final Chromosome chromosome2, final T secondParentFitness) {
32
				Objects.requireNonNull(chromosome1);
33
34 2 1. combine : removed call to java/util/List::of → KILLED
2. combine : replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/PickFirstParentHandler$1::combine → KILLED
				return List.of(chromosome1);
35
			}
36
		};
37
	}
38
}

Mutations

19

1.1
Location : canHandle
Killed by : net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest]/[method:canHandle()]
replaced boolean return with true for net/bmahe/genetics4j/core/combination/PickFirstParentHandler::canHandle → KILLED

2.2
Location : canHandle
Killed by : net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest]/[method:canHandle()]
replaced boolean return with false for net/bmahe/genetics4j/core/combination/PickFirstParentHandler::canHandle → KILLED

27

1.1
Location : resolve
Killed by : net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest]/[method:combineReturnsFirstParent()]
removed call to net/bmahe/genetics4j/core/combination/PickFirstParentHandler$1::<init> → KILLED

2.2
Location : resolve
Killed by : net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest]/[method:combineReturnsFirstParent()]
replaced return value with null for net/bmahe/genetics4j/core/combination/PickFirstParentHandler::resolve → KILLED

34

1.1
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest]/[method:combineReturnsFirstParent()]
removed call to java/util/List::of → KILLED

2.2
Location : combine
Killed by : net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.combination.PickFirstParentHandlerTest]/[method:combineReturnsFirstParent()]
replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/PickFirstParentHandler$1::combine → KILLED

Active mutators

Tests examined


Report generated by PIT 1.25.7 support