SwapMutation.java

1
package net.bmahe.genetics4j.core.spec.mutation;
2
3
import org.apache.commons.lang3.Validate;
4
import org.immutables.value.Value;
5
6
@Value.Immutable
7
public abstract class SwapMutation implements MutationPolicy {
8
9
	@Value.Parameter
10
	public abstract double populationMutationProbability();
11
12
	@Value.Parameter
13
	public abstract int numSwap();
14
15
	@Value.Parameter
16
	public abstract boolean isNumSwapFixed();
17
18
	@Value.Check
19
	protected void check() {
20
		Validate.inclusiveBetween(0.0, 1.0, populationMutationProbability());
21
		Validate.isTrue(numSwap() > 0);
22
	}
23
24
	/**
25
	 * Construct a new immutable {@code SwapMutation} instance.
26
	 * 
27
	 * @param populationMutationProbability The value for the
28
	 *                                      {@code populationMutationProbability}
29
	 *                                      attribute
30
	 * @param numSwap                       The value for the {@code numSwap}
31
	 *                                      attribute
32
	 * @return An immutable SwapMutation instance
33
	 */
34
	public static SwapMutation of(double populationMutationProbability, int numSwap, boolean isNumSwapFixed) {
35 2 1. of : removed call to net/bmahe/genetics4j/core/spec/mutation/ImmutableSwapMutation::of → KILLED
2. of : replaced return value with null for net/bmahe/genetics4j/core/spec/mutation/SwapMutation::of → KILLED
		return ImmutableSwapMutation.of(populationMutationProbability, numSwap, isNumSwapFixed);
36
	}
37
}

Mutations

35

1.1
Location : of
Killed by : net.bmahe.genetics4j.core.mutation.SupersimpleTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.mutation.SupersimpleTest]/[method:simple()]
removed call to net/bmahe/genetics4j/core/spec/mutation/ImmutableSwapMutation::of → KILLED

2.2
Location : of
Killed by : net.bmahe.genetics4j.core.mutation.SupersimpleTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.core.mutation.SupersimpleTest]/[method:simple()]
replaced return value with null for net/bmahe/genetics4j/core/spec/mutation/SwapMutation::of → KILLED

Active mutators

Tests examined


Report generated by PIT 1.19.6