EAExecutionContexts.java

1
package net.bmahe.genetics4j.core.spec;
2
3
import org.apache.commons.lang3.Validate;
4
5
import net.bmahe.genetics4j.core.selection.RouletteWheelSelectionPolicyHandler;
6
import net.bmahe.genetics4j.core.spec.ImmutableEAExecutionContext.Builder;
7
8
/**
9
 * Defines multiple factory and helper methods to create and manage
10
 * EAExecutionContexts
11
 */
12
public class EAExecutionContexts {
13
14
	private EAExecutionContexts() {
15
	}
16
17
	public static <T extends Comparable<T>> Builder<T> standard() {
18 2 1. standard : removed call to net/bmahe/genetics4j/core/spec/ImmutableEAExecutionContext::builder → NO_COVERAGE
2. standard : replaced return value with null for net/bmahe/genetics4j/core/spec/EAExecutionContexts::standard → NO_COVERAGE
		return ImmutableEAExecutionContext.<T>builder();
19
	}
20
21
	/**
22
	 * Enrich an EAExecutionContext builder based on the knowledge of the fitness
23
	 * function returning a scalar value.
24
	 * <p>
25
	 * This will enrich it with additional implementations for selecting, combining
26
	 * and mutating individuals.
27
	 * 
28
	 * @param <T>     Type of the fitness measurement
29
	 * @param builder
30
	 * @return Enriched EAExecutionContext builder
31
	 */
32
	public static <T extends Number & Comparable<T>> Builder<T> enrichForScalarFitness(final Builder<T> builder) {
33
		Validate.notNull(builder);
34
35 2 1. enrichForScalarFitness : removed call to net/bmahe/genetics4j/core/spec/ImmutableEAExecutionContext$Builder::addSelectionPolicyHandlerFactories → SURVIVED
2. enrichForScalarFitness : replaced call to net/bmahe/genetics4j/core/spec/ImmutableEAExecutionContext$Builder::addSelectionPolicyHandlerFactories with receiver → SURVIVED
		builder.addSelectionPolicyHandlerFactories(
36 3 1. lambda$enrichForScalarFitness$0 : replaced return value with null for net/bmahe/genetics4j/core/spec/EAExecutionContexts::lambda$enrichForScalarFitness$0 → SURVIVED
2. lambda$enrichForScalarFitness$0 : removed call to net/bmahe/genetics4j/core/selection/RouletteWheelSelectionPolicyHandler::<init> → SURVIVED
3. lambda$enrichForScalarFitness$0 : removed call to net/bmahe/genetics4j/core/spec/AbstractEAExecutionContext::randomGenerator → KILLED
				gsd -> new RouletteWheelSelectionPolicyHandler<T>(gsd.randomGenerator()));
37 1 1. enrichForScalarFitness : replaced return value with null for net/bmahe/genetics4j/core/spec/EAExecutionContexts::enrichForScalarFitness → KILLED
		return builder;
38
	}
39
40
	/**
41
	 * Create an EAExecutionContext builder based on the knowledge of the fitness
42
	 * function returning a scalar value.
43
	 * <p>
44
	 * This will enrich it with additional implementations for selecting, combining
45
	 * and mutating individuals.
46
	 * 
47
	 * @param <T>
48
	 * @return
49
	 */
50
	public static <T extends Number & Comparable<T>> Builder<T> forScalarFitness() {
51
52 1 1. forScalarFitness : removed call to net/bmahe/genetics4j/core/spec/ImmutableEAExecutionContext::builder → KILLED
		final Builder<T> builder = ImmutableEAExecutionContext.<T>builder();
53 3 1. forScalarFitness : replaced call to net/bmahe/genetics4j/core/spec/EAExecutionContexts::enrichForScalarFitness with argument → SURVIVED
2. forScalarFitness : removed call to net/bmahe/genetics4j/core/spec/EAExecutionContexts::enrichForScalarFitness → KILLED
3. forScalarFitness : replaced return value with null for net/bmahe/genetics4j/core/spec/EAExecutionContexts::forScalarFitness → KILLED
		return enrichForScalarFitness(builder);
54
	}
55
}

Mutations

18

1.1
Location : standard
Killed by : none
removed call to net/bmahe/genetics4j/core/spec/ImmutableEAExecutionContext::builder → NO_COVERAGE

2.2
Location : standard
Killed by : none
replaced return value with null for net/bmahe/genetics4j/core/spec/EAExecutionContexts::standard → NO_COVERAGE

35

1.1
Location : enrichForScalarFitness
Killed by : none
removed call to net/bmahe/genetics4j/core/spec/ImmutableEAExecutionContext$Builder::addSelectionPolicyHandlerFactories → SURVIVED
Covering tests

2.2
Location : enrichForScalarFitness
Killed by : none
replaced call to net/bmahe/genetics4j/core/spec/ImmutableEAExecutionContext$Builder::addSelectionPolicyHandlerFactories with receiver → SURVIVED Covering tests

36

1.1
Location : lambda$enrichForScalarFitness$0
Killed by : none
replaced return value with null for net/bmahe/genetics4j/core/spec/EAExecutionContexts::lambda$enrichForScalarFitness$0 → SURVIVED
Covering tests

2.2
Location : lambda$enrichForScalarFitness$0
Killed by : net.bmahe.genetics4j.core.replacement.ElitismImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.ElitismImplTest]/[method:ctorNoSurvivorSelector()]
removed call to net/bmahe/genetics4j/core/spec/AbstractEAExecutionContext::randomGenerator → KILLED

3.3
Location : lambda$enrichForScalarFitness$0
Killed by : none
removed call to net/bmahe/genetics4j/core/selection/RouletteWheelSelectionPolicyHandler::<init> → SURVIVED Covering tests

37

1.1
Location : enrichForScalarFitness
Killed by : net.bmahe.genetics4j.core.replacement.ElitismImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.ElitismImplTest]/[method:ctorNoSurvivorSelector()]
replaced return value with null for net/bmahe/genetics4j/core/spec/EAExecutionContexts::enrichForScalarFitness → KILLED

52

1.1
Location : forScalarFitness
Killed by : net.bmahe.genetics4j.core.replacement.ElitismImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.ElitismImplTest]/[method:ctorNoSurvivorSelector()]
removed call to net/bmahe/genetics4j/core/spec/ImmutableEAExecutionContext::builder → KILLED

53

1.1
Location : forScalarFitness
Killed by : net.bmahe.genetics4j.core.replacement.ElitismImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.ElitismImplTest]/[method:ctorNoSurvivorSelector()]
removed call to net/bmahe/genetics4j/core/spec/EAExecutionContexts::enrichForScalarFitness → KILLED

2.2
Location : forScalarFitness
Killed by : none
replaced call to net/bmahe/genetics4j/core/spec/EAExecutionContexts::enrichForScalarFitness with argument → SURVIVED
Covering tests

3.3
Location : forScalarFitness
Killed by : net.bmahe.genetics4j.core.replacement.ElitismImplTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.replacement.ElitismImplTest]/[method:ctorNoSurvivorSelector()]
replaced return value with null for net/bmahe/genetics4j/core/spec/EAExecutionContexts::forScalarFitness → KILLED

Active mutators

Tests examined


Report generated by PIT 1.19.6