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 → NO_COVERAGE
2. canHandle : replaced boolean return with false for net/bmahe/genetics4j/core/combination/PickFirstParentHandler::canHandle → NO_COVERAGE
		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> → NO_COVERAGE
2. resolve : replaced return value with null for net/bmahe/genetics4j/core/combination/PickFirstParentHandler::resolve → NO_COVERAGE
		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 → NO_COVERAGE
2. combine : replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/PickFirstParentHandler$1::combine → NO_COVERAGE
				return List.of(chromosome1);
35
			}
36
		};
37
	}
38
}

Mutations

19

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

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

27

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

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

34

1.1
Location : combine
Killed by : none
removed call to java/util/List::of → NO_COVERAGE

2.2
Location : combine
Killed by : none
replaced return value with Collections.emptyList for net/bmahe/genetics4j/core/combination/PickFirstParentHandler$1::combine → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.25.7 support