| 1 | package net.bmahe.genetics4j.extras.evolutionlisteners; | |
| 2 | ||
| 3 | import java.util.Optional; | |
| 4 | ||
| 5 | import org.immutables.value.Value; | |
| 6 | ||
| 7 | import net.bmahe.genetics4j.core.Genotype; | |
| 8 | ||
| 9 | @Value.Immutable | |
| 10 | public interface EvolutionStep<T extends Comparable<T>, U> { | |
| 11 | ||
| 12 | @Value.Parameter | |
| 13 | Optional<U> context(); | |
| 14 | ||
| 15 | @Value.Parameter | |
| 16 | long generation(); | |
| 17 | ||
| 18 | @Value.Parameter | |
| 19 | int individualIndex(); | |
| 20 | ||
| 21 | @Value.Parameter | |
| 22 | Genotype individual(); | |
| 23 | ||
| 24 | @Value.Parameter | |
| 25 | T fitness(); | |
| 26 | ||
| 27 | @Value.Parameter | |
| 28 | boolean isDone(); | |
| 29 | ||
| 30 | public static class Builder<T extends Comparable<T>, U> extends ImmutableEvolutionStep.Builder<T, U> { | |
| 31 | } | |
| 32 | ||
| 33 | public static <T extends Comparable<T>, U> EvolutionStep<T, U> of(final Optional<U> context, final long generation, | |
| 34 | final int individualIndex, final Genotype individual, final T fitness, final boolean isDone) { | |
| 35 | ||
| 36 |
2
1. of : replaced return value with null for net/bmahe/genetics4j/extras/evolutionlisteners/EvolutionStep::of → NO_COVERAGE 2. of : removed call to net/bmahe/genetics4j/extras/evolutionlisteners/ImmutableEvolutionStep::of → KILLED |
return ImmutableEvolutionStep.of(context, generation, individualIndex, individual, fitness, isDone); |
| 37 | } | |
| 38 | ||
| 39 | } | |
Mutations | ||
| 36 |
1.1 2.2 |