1
|
|
package net.bmahe.genetics4j.neat.mutation.chromosome; |
2
|
|
|
3
|
|
import java.util.List; |
4
|
|
import java.util.random.RandomGenerator; |
5
|
|
|
6
|
|
import org.apache.commons.lang3.Validate; |
7
|
|
|
8
|
|
import net.bmahe.genetics4j.neat.Connection; |
9
|
|
import net.bmahe.genetics4j.neat.chromosomes.NeatChromosome; |
10
|
|
import net.bmahe.genetics4j.neat.spec.mutation.SwitchStateMutation; |
11
|
|
|
12
|
|
public class NeatChromosomeSwitchStateHandler |
13
|
|
extends AbstractNeatChromosomeConnectionMutationHandler<SwitchStateMutation> |
14
|
|
{ |
15
|
|
public NeatChromosomeSwitchStateHandler(final RandomGenerator _randomGenerator) { |
16
|
|
super(SwitchStateMutation.class, _randomGenerator); |
17
|
|
} |
18
|
|
|
19
|
|
@Override |
20
|
|
protected List<Connection> mutateConnection(final SwitchStateMutation switchStateMutation, |
21
|
|
final NeatChromosome neatChromosome, final Connection oldConnection, final int i) { |
22
|
|
Validate.notNull(switchStateMutation); |
23
|
|
Validate.notNull(neatChromosome); |
24
|
|
Validate.notNull(oldConnection); |
25
|
|
|
26
|
1
1. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection::builder → KILLED
|
final var connectionBuilder = Connection.builder() |
27
|
2
1. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection$Builder::from → KILLED
2. mutateConnection : replaced call to net/bmahe/genetics4j/neat/Connection$Builder::from with receiver → KILLED
|
.from(oldConnection); |
28
|
8
1. mutateConnection : replaced call to net/bmahe/genetics4j/neat/Connection$Builder::isEnabled with receiver → KILLED
2. mutateConnection : removed conditional - replaced equality check with true → KILLED
3. mutateConnection : removed conditional - replaced equality check with false → KILLED
4. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection::isEnabled → KILLED
5. mutateConnection : negated conditional → KILLED
6. mutateConnection : Substituted 0 with 1 → KILLED
7. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection$Builder::isEnabled → KILLED
8. mutateConnection : Substituted 1 with 0 → KILLED
|
connectionBuilder.isEnabled(!oldConnection.isEnabled()); |
29
|
3
1. mutateConnection : replaced return value with Collections.emptyList for net/bmahe/genetics4j/neat/mutation/chromosome/NeatChromosomeSwitchStateHandler::mutateConnection → KILLED
2. mutateConnection : removed call to java/util/List::of → KILLED
3. mutateConnection : removed call to net/bmahe/genetics4j/neat/Connection$Builder::build → KILLED
|
return List.of(connectionBuilder.build()); |
30
|
|
} |
31
|
|
} |
| | Mutations |
26 |
|
1.1 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] removed call to net/bmahe/genetics4j/neat/Connection::builder → KILLED
|
27 |
|
1.1 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] removed call to net/bmahe/genetics4j/neat/Connection$Builder::from → KILLED
2.2 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] replaced call to net/bmahe/genetics4j/neat/Connection$Builder::from with receiver → KILLED
|
28 |
|
1.1 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] replaced call to net/bmahe/genetics4j/neat/Connection$Builder::isEnabled with receiver → KILLED
2.2 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] removed conditional - replaced equality check with true → KILLED
3.3 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] removed conditional - replaced equality check with false → KILLED
4.4 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] removed call to net/bmahe/genetics4j/neat/Connection::isEnabled → KILLED
5.5 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] negated conditional → KILLED
6.6 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] Substituted 0 with 1 → KILLED
7.7 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] removed call to net/bmahe/genetics4j/neat/Connection$Builder::isEnabled → KILLED
8.8 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] Substituted 1 with 0 → KILLED
|
29 |
|
1.1 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] replaced return value with Collections.emptyList for net/bmahe/genetics4j/neat/mutation/chromosome/NeatChromosomeSwitchStateHandler::mutateConnection → KILLED
2.2 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] removed call to java/util/List::of → KILLED
3.3 Location : mutateConnection Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.NeatChromosomeSwitchStateHandlerTest]/[method:mutateConnection()] removed call to net/bmahe/genetics4j/neat/Connection$Builder::build → KILLED
|