| 1 | package net.bmahe.genetics4j.core.spec.chromosome; | |
| 2 | ||
| 3 | import java.util.Objects; | |
| 4 | ||
| 5 | import org.apache.commons.lang3.Validate; | |
| 6 | import org.immutables.value.Value; | |
| 7 | ||
| 8 | import net.bmahe.genetics4j.core.spec.statistics.distributions.Distribution; | |
| 9 | import net.bmahe.genetics4j.core.spec.statistics.distributions.UniformDistribution; | |
| 10 | ||
| 11 | @Value.Immutable | |
| 12 | public abstract class FloatChromosomeSpec implements ChromosomeSpec { | |
| 13 | ||
| 14 | @Value.Parameter | |
| 15 | public abstract int size(); | |
| 16 | ||
| 17 | @Value.Parameter | |
| 18 | public abstract float minValue(); | |
| 19 | ||
| 20 | @Value.Parameter | |
| 21 | public abstract float maxValue(); | |
| 22 | ||
| 23 | @Value.Default | |
| 24 | public Distribution distribution() { | |
| 25 |
2
1. distribution : removed call to net/bmahe/genetics4j/core/spec/statistics/distributions/UniformDistribution::build → KILLED 2. distribution : replaced return value with null for net/bmahe/genetics4j/core/spec/chromosome/FloatChromosomeSpec::distribution → KILLED |
return UniformDistribution.build(); |
| 26 | } | |
| 27 | ||
| 28 | @Value.Check | |
| 29 | protected void check() { | |
| 30 | Validate.isTrue(size() > 0); | |
| 31 | Validate.isTrue(minValue() <= maxValue()); | |
| 32 | } | |
| 33 | ||
| 34 | public static class Builder extends ImmutableFloatChromosomeSpec.Builder { | |
| 35 | } | |
| 36 | ||
| 37 | /** | |
| 38 | * Construct a new immutable {@code FloatChromosomeSpec} instance. | |
| 39 | * | |
| 40 | * @param size The value for the {@code size} attribute | |
| 41 | * @param minValue The value for the {@code minValue} attribute | |
| 42 | * @param maxValue The value for the {@code maxValue} attribute | |
| 43 | * @return An immutable FloatChromosomeSpec instance | |
| 44 | */ | |
| 45 | ||
| 46 | public static FloatChromosomeSpec of(final int size, final float minValue, final float maxValue) { | |
| 47 |
2
1. of : replaced return value with null for net/bmahe/genetics4j/core/spec/chromosome/FloatChromosomeSpec::of → KILLED 2. of : removed call to net/bmahe/genetics4j/core/spec/chromosome/ImmutableFloatChromosomeSpec::of → KILLED |
return ImmutableFloatChromosomeSpec.of(size, minValue, maxValue); |
| 48 | } | |
| 49 | ||
| 50 | public static FloatChromosomeSpec of(final int size, final float minValue, final float maxValue, | |
| 51 | final Distribution distribution) { | |
| 52 | Objects.requireNonNull(distribution); | |
| 53 | ||
| 54 |
1
1. of : removed call to net/bmahe/genetics4j/core/spec/chromosome/ImmutableFloatChromosomeSpec$Builder::<init> → NO_COVERAGE |
final var floatChromosomeSpecBuilder = new ImmutableFloatChromosomeSpec.Builder(); |
| 55 | ||
| 56 |
7
1. of : removed call to net/bmahe/genetics4j/core/spec/chromosome/FloatChromosomeSpec$Builder::distribution → NO_COVERAGE 2. of : removed call to net/bmahe/genetics4j/core/spec/chromosome/FloatChromosomeSpec$Builder::maxValue → NO_COVERAGE 3. of : removed call to net/bmahe/genetics4j/core/spec/chromosome/FloatChromosomeSpec$Builder::minValue → NO_COVERAGE 4. of : removed call to net/bmahe/genetics4j/core/spec/chromosome/ImmutableFloatChromosomeSpec$Builder::size → NO_COVERAGE 5. of : replaced call to net/bmahe/genetics4j/core/spec/chromosome/FloatChromosomeSpec$Builder::minValue with receiver → NO_COVERAGE 6. of : replaced call to net/bmahe/genetics4j/core/spec/chromosome/FloatChromosomeSpec$Builder::maxValue with receiver → NO_COVERAGE 7. of : replaced call to net/bmahe/genetics4j/core/spec/chromosome/FloatChromosomeSpec$Builder::distribution with receiver → NO_COVERAGE |
floatChromosomeSpecBuilder.size(size).minValue(minValue).maxValue(maxValue).distribution(distribution); |
| 57 | ||
| 58 |
2
1. of : removed call to net/bmahe/genetics4j/core/spec/chromosome/ImmutableFloatChromosomeSpec$Builder::build → NO_COVERAGE 2. of : replaced return value with null for net/bmahe/genetics4j/core/spec/chromosome/FloatChromosomeSpec::of → NO_COVERAGE |
return floatChromosomeSpecBuilder.build(); |
| 59 | } | |
| 60 | } | |
Mutations | ||
| 25 |
1.1 2.2 |
|
| 47 |
1.1 2.2 |
|
| 54 |
1.1 |
|
| 56 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 |
|
| 58 |
1.1 2.2 |