1
|
|
package net.bmahe.genetics4j.gp.utils; |
2
|
|
|
3
|
|
import java.util.List; |
4
|
|
|
5
|
|
import org.apache.commons.lang3.Validate; |
6
|
|
|
7
|
|
import net.bmahe.genetics4j.core.chromosomes.TreeChromosome; |
8
|
|
import net.bmahe.genetics4j.core.chromosomes.TreeNode; |
9
|
|
import net.bmahe.genetics4j.gp.Operation; |
10
|
|
|
11
|
|
public class ProgramUtils { |
12
|
|
|
13
|
|
private ProgramUtils() { |
14
|
|
} |
15
|
|
|
16
|
|
public static Object execute(final TreeChromosome<Operation<?>> treeChromosome, final Object[] input) { |
17
|
|
Validate.notNull(treeChromosome); |
18
|
|
|
19
|
1
1. execute : removed call to net/bmahe/genetics4j/core/chromosomes/TreeChromosome::getRoot → KILLED
|
final TreeNode<Operation<?>> root = treeChromosome.getRoot(); |
20
|
|
|
21
|
2
1. execute : removed call to net/bmahe/genetics4j/gp/utils/ProgramUtils::execute → KILLED
2. execute : replaced return value with null for net/bmahe/genetics4j/gp/utils/ProgramUtils::execute → KILLED
|
return execute(root, input); |
22
|
|
} |
23
|
|
|
24
|
|
public static Object execute(final TreeNode<Operation<?>> node, final Object[] input) { |
25
|
|
Validate.notNull(node); |
26
|
|
|
27
|
1
1. execute : removed call to net/bmahe/genetics4j/core/chromosomes/TreeNode::getData → KILLED
|
final Operation operation = node.getData(); |
28
|
1
1. execute : removed call to net/bmahe/genetics4j/core/chromosomes/TreeNode::getChildren → KILLED
|
final List<TreeNode<Operation<?>>> children = node.getChildren(); |
29
|
|
|
30
|
4
1. execute : removed conditional - replaced equality check with true → SURVIVED
2. execute : removed call to java/util/List::stream → KILLED
3. execute : removed conditional - replaced equality check with false → KILLED
4. execute : negated conditional → KILLED
|
final Object[] parameters = children != null ? children.stream() |
31
|
4
1. execute : replaced call to java/util/stream/Stream::map with receiver → KILLED
2. lambda$execute$0 : removed call to net/bmahe/genetics4j/gp/utils/ProgramUtils::execute → KILLED
3. execute : removed call to java/util/stream/Stream::map → KILLED
4. lambda$execute$0 : replaced return value with null for net/bmahe/genetics4j/gp/utils/ProgramUtils::lambda$execute$0 → KILLED
|
.map(child -> execute(child, input)) |
32
|
2
1. execute : Substituted 0 with 1 → NO_COVERAGE
2. execute : removed call to java/util/stream/Stream::toArray → KILLED
|
.toArray() : new Object[] {}; |
33
|
|
|
34
|
2
1. execute : replaced return value with null for net/bmahe/genetics4j/gp/utils/ProgramUtils::execute → KILLED
2. execute : removed call to net/bmahe/genetics4j/gp/Operation::apply → KILLED
|
return operation.apply(input, parameters); |
35
|
|
} |
36
|
|
|
37
|
|
} |
| | Mutations |
19 |
|
1.1 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:simpleTerminal()] removed call to net/bmahe/genetics4j/core/chromosomes/TreeChromosome::getRoot → KILLED
|
21 |
|
1.1 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:simpleTerminal()] removed call to net/bmahe/genetics4j/gp/utils/ProgramUtils::execute → KILLED
2.2 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:simpleTerminal()] replaced return value with null for net/bmahe/genetics4j/gp/utils/ProgramUtils::execute → KILLED
|
27 |
|
1.1 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:simpleTerminal()] removed call to net/bmahe/genetics4j/core/chromosomes/TreeNode::getData → KILLED
|
28 |
|
1.1 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:complexTest()] removed call to net/bmahe/genetics4j/core/chromosomes/TreeNode::getChildren → KILLED
|
30 |
|
1.1 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:simpleTerminal()] removed call to java/util/List::stream → KILLED
2.2 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:complexTest()] removed conditional - replaced equality check with false → KILLED
3.3 Location : execute Killed by : none removed conditional - replaced equality check with true → SURVIVED
Covering tests
Covered by tests:
- net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:simpleTerminal()]
- net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:complexTest()]
- net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:checkInput()]
4.4 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:complexTest()] negated conditional → KILLED
|
31 |
|
1.1 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:complexTest()] replaced call to java/util/stream/Stream::map with receiver → KILLED
2.2 Location : lambda$execute$0 Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:complexTest()] removed call to net/bmahe/genetics4j/gp/utils/ProgramUtils::execute → KILLED
3.3 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:simpleTerminal()] removed call to java/util/stream/Stream::map → KILLED
4.4 Location : lambda$execute$0 Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:complexTest()] replaced return value with null for net/bmahe/genetics4j/gp/utils/ProgramUtils::lambda$execute$0 → KILLED
|
32 |
|
1.1 Location : execute Killed by : none Substituted 0 with 1 → NO_COVERAGE
2.2 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:complexTest()] removed call to java/util/stream/Stream::toArray → KILLED
|
34 |
|
1.1 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:simpleTerminal()] replaced return value with null for net/bmahe/genetics4j/gp/utils/ProgramUtils::execute → KILLED
2.2 Location : execute Killed by : net.bmahe.genetics4j.gp.utils.ProgramUtilsTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.gp.utils.ProgramUtilsTest]/[method:simpleTerminal()] removed call to net/bmahe/genetics4j/gp/Operation::apply → KILLED
|