| 1 | package net.bmahe.genetics4j.core.spec; | |
| 2 | ||
| 3 | import java.util.Objects; | |
| 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 EAExecutionContexts | |
| 10 | */ | |
| 11 | public class EAExecutionContexts { | |
| 12 | ||
| 13 | private EAExecutionContexts() { | |
| 14 | } | |
| 15 | ||
| 16 | public static <T extends Comparable<T>> Builder<T> standard() { | |
| 17 |
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.builder(); |
| 18 | } | |
| 19 | ||
| 20 | /** | |
| 21 | * Enrich an EAExecutionContext builder based on the knowledge of the fitness function returning a scalar value. | |
| 22 | * <p>This will enrich it with additional implementations for selecting, combining and mutating individuals. | |
| 23 | * | |
| 24 | * @param <T> Type of the fitness measurement | |
| 25 | * @param builder | |
| 26 | * @return Enriched EAExecutionContext builder | |
| 27 | */ | |
| 28 | public static <T extends Number & Comparable<T>> Builder<T> enrichForScalarFitness(final Builder<T> builder) { | |
| 29 | Objects.requireNonNull(builder); | |
| 30 | ||
| 31 |
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( |
| 32 |
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())); |
| 33 |
1
1. enrichForScalarFitness : replaced return value with null for net/bmahe/genetics4j/core/spec/EAExecutionContexts::enrichForScalarFitness → KILLED |
return builder; |
| 34 | } | |
| 35 | ||
| 36 | /** | |
| 37 | * Create an EAExecutionContext builder based on the knowledge of the fitness function returning a scalar value. | |
| 38 | * <p>This will enrich it with additional implementations for selecting, combining and mutating individuals. | |
| 39 | * | |
| 40 | * @param <T> | |
| 41 | * @return | |
| 42 | */ | |
| 43 | public static <T extends Number & Comparable<T>> Builder<T> forScalarFitness() { | |
| 44 | ||
| 45 |
1
1. forScalarFitness : removed call to net/bmahe/genetics4j/core/spec/ImmutableEAExecutionContext::builder → KILLED |
final Builder<T> builder = ImmutableEAExecutionContext.builder(); |
| 46 |
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); |
| 47 | } | |
| 48 | } | |
Mutations | ||
| 17 |
1.1 2.2 |
|
| 31 |
1.1 2.2 |
|
| 32 |
1.1 2.2 3.3 |
|
| 33 |
1.1 |
|
| 45 |
1.1 |
|
| 46 |
1.1 2.2 3.3 |