| 1 | package net.bmahe.genetics4j.core.spec.selection; | |
| 2 | ||
| 3 | import java.util.Comparator; | |
| 4 | ||
| 5 | import org.apache.commons.lang3.Validate; | |
| 6 | import org.immutables.value.Value; | |
| 7 | ||
| 8 | import net.bmahe.genetics4j.core.Individual; | |
| 9 | ||
| 10 | @Value.Style(overshadowImplementation = true) | |
| 11 | @Value.Immutable | |
| 12 | public interface ProportionalTournament<T extends Comparable<T>> extends SelectionPolicy { | |
| 13 | ||
| 14 | @Value.Parameter | |
| 15 | int numCandidates(); | |
| 16 | ||
| 17 | @Value.Parameter | |
| 18 | double proportionFirst(); | |
| 19 | ||
| 20 | @Value.Parameter | |
| 21 | Comparator<Individual<T>> firstComparator(); | |
| 22 | ||
| 23 | @Value.Parameter | |
| 24 | Comparator<Individual<T>> secondComparator(); | |
| 25 | ||
| 26 | @Value.Check | |
| 27 | default void check() { | |
| 28 | Validate.inclusiveBetween(0.0, 1.0, proportionFirst()); | |
| 29 | } | |
| 30 | ||
| 31 | public static <T extends Comparable<T>> ProportionalTournament<T> of(int numCandidates, double proportionFirst, | |
| 32 | Comparator<Individual<T>> firstComparator, Comparator<Individual<T>> secondComparator) { | |
| 33 |
2
1. of : replaced return value with null for net/bmahe/genetics4j/core/spec/selection/ProportionalTournament::of → KILLED 2. of : removed call to net/bmahe/genetics4j/core/spec/selection/ImmutableProportionalTournament::of → KILLED |
return ImmutableProportionalTournament.of(numCandidates, proportionFirst, firstComparator, secondComparator); |
| 34 | } | |
| 35 | ||
| 36 | } | |
Mutations | ||
| 33 |
1.1 2.2 |