|
1
|
|
package net.bmahe.genetics4j.neat.spec; |
|
2
|
|
|
|
3
|
|
import java.util.List; |
|
4
|
|
import java.util.Objects; |
|
5
|
|
|
|
6
|
|
/** |
|
7
|
|
* Node layout with explicitly declared, ordered input and output IDs. |
|
8
|
|
* |
|
9
|
|
* <p>The constructor defensively copies both lists. IDs must be unique, non-negative, disjoint between inputs and |
|
10
|
|
* outputs, and outside the configured hidden-node range. |
|
11
|
|
*/ |
|
12
|
|
public class ExplicitNeatNodeLayout implements NeatNodeLayout { |
|
13
|
|
|
|
14
|
|
private final List<Integer> inputNodeIds; |
|
15
|
|
private final List<Integer> outputNodeIds; |
|
16
|
|
private final long hiddenNodeIdStartInclusive; |
|
17
|
|
private final long hiddenNodeIdEndExclusive; |
|
18
|
|
|
|
19
|
|
/** |
|
20
|
|
* Creates an explicit node layout. |
|
21
|
|
* |
|
22
|
|
* @param _inputNodeIds input IDs in vector order |
|
23
|
|
* @param _outputNodeIds output IDs in vector order |
|
24
|
|
* @param _hiddenNodeIdStartInclusive inclusive hidden-node range start |
|
25
|
|
* @param _hiddenNodeIdEndExclusive exclusive hidden-node range end |
|
26
|
|
* @throws NullPointerException if either external-ID list or one of its elements is {@code null} |
|
27
|
|
* @throws IllegalArgumentException if the external IDs or hidden-node range are invalid |
|
28
|
|
*/ |
|
29
|
|
public ExplicitNeatNodeLayout(final List<Integer> _inputNodeIds, |
|
30
|
|
final List<Integer> _outputNodeIds, |
|
31
|
|
final long _hiddenNodeIdStartInclusive, |
|
32
|
|
final long _hiddenNodeIdEndExclusive) { |
|
33
|
2
1. <init> : removed call to java/util/List::copyOf → KILLED
2. <init> : Removed assignment to member variable inputNodeIds → KILLED
|
inputNodeIds = List.copyOf(_inputNodeIds); |
|
34
|
2
1. <init> : removed call to java/util/List::copyOf → KILLED
2. <init> : Removed assignment to member variable outputNodeIds → KILLED
|
outputNodeIds = List.copyOf(_outputNodeIds); |
|
35
|
|
NeatNodeLayoutValidation |
|
36
|
1
1. <init> : removed call to net/bmahe/genetics4j/neat/spec/NeatNodeLayoutValidation::validate → KILLED
|
.validate(inputNodeIds, outputNodeIds, _hiddenNodeIdStartInclusive, _hiddenNodeIdEndExclusive); |
|
37
|
1
1. <init> : Removed assignment to member variable hiddenNodeIdStartInclusive → KILLED
|
hiddenNodeIdStartInclusive = _hiddenNodeIdStartInclusive; |
|
38
|
1
1. <init> : Removed assignment to member variable hiddenNodeIdEndExclusive → KILLED
|
hiddenNodeIdEndExclusive = _hiddenNodeIdEndExclusive; |
|
39
|
|
} |
|
40
|
|
|
|
41
|
|
@Override |
|
42
|
|
public List<Integer> inputNodeIds() { |
|
43
|
1
1. inputNodeIds : replaced return value with Collections.emptyList for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::inputNodeIds → KILLED
|
return inputNodeIds; |
|
44
|
|
} |
|
45
|
|
|
|
46
|
|
@Override |
|
47
|
|
public List<Integer> outputNodeIds() { |
|
48
|
1
1. outputNodeIds : replaced return value with Collections.emptyList for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::outputNodeIds → KILLED
|
return outputNodeIds; |
|
49
|
|
} |
|
50
|
|
|
|
51
|
|
@Override |
|
52
|
|
public long hiddenNodeIdStartInclusive() { |
|
53
|
1
1. hiddenNodeIdStartInclusive : replaced long return with 0 for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::hiddenNodeIdStartInclusive → KILLED
|
return hiddenNodeIdStartInclusive; |
|
54
|
|
} |
|
55
|
|
|
|
56
|
|
@Override |
|
57
|
|
public long hiddenNodeIdEndExclusive() { |
|
58
|
1
1. hiddenNodeIdEndExclusive : replaced long return with 0 for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::hiddenNodeIdEndExclusive → KILLED
|
return hiddenNodeIdEndExclusive; |
|
59
|
|
} |
|
60
|
|
|
|
61
|
|
@Override |
|
62
|
|
public int hashCode() { |
|
63
|
|
return Objects.hash(hiddenNodeIdEndExclusive, hiddenNodeIdStartInclusive, inputNodeIds, outputNodeIds); |
|
64
|
|
} |
|
65
|
|
|
|
66
|
|
@Override |
|
67
|
|
public boolean equals(final Object obj) { |
|
68
|
2
1. equals : removed conditional - replaced equality check with true → SURVIVED
2. equals : negated conditional → SURVIVED
|
if (this == obj) { |
|
69
|
2
1. equals : Substituted 1 with 0 → KILLED
2. equals : replaced boolean return with false for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::equals → KILLED
|
return true; |
|
70
|
|
} |
|
71
|
3
1. equals : negated conditional → NO_COVERAGE
2. equals : removed conditional - replaced equality check with true → NO_COVERAGE
3. equals : removed conditional - replaced equality check with false → NO_COVERAGE
|
if (obj instanceof ExplicitNeatNodeLayout other) { |
|
72
|
7
1. equals : negated conditional → NO_COVERAGE
2. equals : negated conditional → NO_COVERAGE
3. equals : replaced boolean return with true for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::equals → NO_COVERAGE
4. equals : removed conditional - replaced equality check with true → NO_COVERAGE
5. equals : removed conditional - replaced equality check with false → NO_COVERAGE
6. equals : removed conditional - replaced equality check with true → NO_COVERAGE
7. equals : removed conditional - replaced equality check with false → NO_COVERAGE
|
return hiddenNodeIdEndExclusive == other.hiddenNodeIdEndExclusive |
|
73
|
|
&& hiddenNodeIdStartInclusive == other.hiddenNodeIdStartInclusive |
|
74
|
10
1. equals : Substituted 0 with 1 → NO_COVERAGE
2. equals : Substituted 1 with 0 → NO_COVERAGE
3. equals : negated conditional → NO_COVERAGE
4. equals : negated conditional → NO_COVERAGE
5. equals : removed call to java/util/List::equals → NO_COVERAGE
6. equals : removed conditional - replaced equality check with false → NO_COVERAGE
7. equals : removed conditional - replaced equality check with true → NO_COVERAGE
8. equals : removed conditional - replaced equality check with true → NO_COVERAGE
9. equals : removed conditional - replaced equality check with false → NO_COVERAGE
10. equals : removed call to java/util/List::equals → NO_COVERAGE
|
&& inputNodeIds.equals(other.inputNodeIds) && outputNodeIds.equals(other.outputNodeIds); |
|
75
|
|
} |
|
76
|
2
1. equals : Substituted 0 with 1 → NO_COVERAGE
2. equals : replaced boolean return with true for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::equals → NO_COVERAGE
|
return false; |
|
77
|
|
} |
|
78
|
|
|
|
79
|
|
@Override |
|
80
|
|
public String toString() { |
|
81
|
3
1. toString : replaced return value with "" for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::toString → NO_COVERAGE
2. toString : removed call to java/lang/String::valueOf → NO_COVERAGE
3. toString : removed call to java/lang/String::valueOf → NO_COVERAGE
|
return "ExplicitNeatNodeLayout [inputNodeIds=" + inputNodeIds + ", outputNodeIds=" + outputNodeIds |
|
82
|
|
+ ", hiddenNodeIdStartInclusive=" + hiddenNodeIdStartInclusive + ", hiddenNodeIdEndExclusive=" |
|
83
|
|
+ hiddenNodeIdEndExclusive + "]"; |
|
84
|
|
} |
|
85
|
|
} |
| | Mutations |
| 33 |
|
1.1 Location : <init> Killed by : net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest]/[method:preservesExplicitNodeDeclarationOrder()] removed call to java/util/List::copyOf → KILLED
2.2 Location : <init> Killed by : net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest]/[method:preservesExplicitNodeDeclarationOrder()] Removed assignment to member variable inputNodeIds → KILLED
|
| 34 |
|
1.1 Location : <init> Killed by : net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest]/[method:preservesExplicitNodeDeclarationOrder()] removed call to java/util/List::copyOf → KILLED
2.2 Location : <init> Killed by : net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest]/[method:preservesExplicitNodeDeclarationOrder()] Removed assignment to member variable outputNodeIds → KILLED
|
| 36 |
|
1.1 Location : <init> Killed by : net.bmahe.genetics4j.neat.spec.NeatNodeLayoutTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.spec.NeatNodeLayoutTest]/[method:rejectsInvalidExternalIdsAndRanges()] removed call to net/bmahe/genetics4j/neat/spec/NeatNodeLayoutValidation::validate → KILLED
|
| 37 |
|
1.1 Location : <init> Killed by : net.bmahe.genetics4j.neat.spec.NeatNodeLayoutTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.spec.NeatNodeLayoutTest]/[method:compatibilityIsSemanticAcrossImplementations()] Removed assignment to member variable hiddenNodeIdStartInclusive → KILLED
|
| 38 |
|
1.1 Location : <init> Killed by : net.bmahe.genetics4j.neat.spec.NeatNodeLayoutTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.spec.NeatNodeLayoutTest]/[method:compatibilityIsSemanticAcrossImplementations()] Removed assignment to member variable hiddenNodeIdEndExclusive → KILLED
|
| 43 |
|
1.1 Location : inputNodeIds Killed by : net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest]/[method:preservesExplicitNodeDeclarationOrder()] replaced return value with Collections.emptyList for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::inputNodeIds → KILLED
|
| 48 |
|
1.1 Location : outputNodeIds Killed by : net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.chromosomes.NeatChromosomeTest]/[method:preservesExplicitNodeDeclarationOrder()] replaced return value with Collections.emptyList for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::outputNodeIds → KILLED
|
| 53 |
|
1.1 Location : hiddenNodeIdStartInclusive Killed by : net.bmahe.genetics4j.neat.spec.NeatNodeLayoutTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.spec.NeatNodeLayoutTest]/[method:compatibilityIsSemanticAcrossImplementations()] replaced long return with 0 for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::hiddenNodeIdStartInclusive → KILLED
|
| 58 |
|
1.1 Location : hiddenNodeIdEndExclusive Killed by : net.bmahe.genetics4j.neat.spec.NeatNodeLayoutTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.spec.NeatNodeLayoutTest]/[method:compatibilityIsSemanticAcrossImplementations()] replaced long return with 0 for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::hiddenNodeIdEndExclusive → KILLED
|
| 68 |
|
1.1 Location : equals Killed by : none removed conditional - replaced equality check with true → SURVIVED
Covering tests
Covered by tests:
- net.bmahe.genetics4j.neat.mutation.chromosome.SparseStructuralMutationTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.SparseStructuralMutationTest]/[method:addConnectionSamplesOnlyDeclaredNodes()]
- net.bmahe.genetics4j.neat.SparseNodeLayoutIntegrationTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.SparseNodeLayoutIntegrationTest]/[method:factoriesPreserveSparseOrderedIds()]
2.2 Location : equals Killed by : none negated conditional → SURVIVED
Covering tests
Covered by tests:
- net.bmahe.genetics4j.neat.mutation.chromosome.SparseStructuralMutationTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.SparseStructuralMutationTest]/[method:addConnectionSamplesOnlyDeclaredNodes()]
- net.bmahe.genetics4j.neat.SparseNodeLayoutIntegrationTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.SparseNodeLayoutIntegrationTest]/[method:factoriesPreserveSparseOrderedIds()]
|
| 69 |
|
1.1 Location : equals Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.SparseStructuralMutationTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.SparseStructuralMutationTest]/[method:addConnectionSamplesOnlyDeclaredNodes()] Substituted 1 with 0 → KILLED
2.2 Location : equals Killed by : net.bmahe.genetics4j.neat.mutation.chromosome.SparseStructuralMutationTest.[engine:junit-jupiter]/[class:net.bmahe.genetics4j.neat.mutation.chromosome.SparseStructuralMutationTest]/[method:addConnectionSamplesOnlyDeclaredNodes()] replaced boolean return with false for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::equals → KILLED
|
| 71 |
|
1.1 Location : equals Killed by : none negated conditional → NO_COVERAGE
2.2 Location : equals Killed by : none removed conditional - replaced equality check with true → NO_COVERAGE
3.3 Location : equals Killed by : none removed conditional - replaced equality check with false → NO_COVERAGE
|
| 72 |
|
1.1 Location : equals Killed by : none negated conditional → NO_COVERAGE
2.2 Location : equals Killed by : none negated conditional → NO_COVERAGE
3.3 Location : equals Killed by : none replaced boolean return with true for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::equals → NO_COVERAGE
4.4 Location : equals Killed by : none removed conditional - replaced equality check with true → NO_COVERAGE
5.5 Location : equals Killed by : none removed conditional - replaced equality check with false → NO_COVERAGE
6.6 Location : equals Killed by : none removed conditional - replaced equality check with true → NO_COVERAGE
7.7 Location : equals Killed by : none removed conditional - replaced equality check with false → NO_COVERAGE
|
| 74 |
|
1.1 Location : equals Killed by : none Substituted 0 with 1 → NO_COVERAGE
2.2 Location : equals Killed by : none Substituted 1 with 0 → NO_COVERAGE
3.3 Location : equals Killed by : none negated conditional → NO_COVERAGE
4.4 Location : equals Killed by : none negated conditional → NO_COVERAGE
5.5 Location : equals Killed by : none removed call to java/util/List::equals → NO_COVERAGE
6.6 Location : equals Killed by : none removed conditional - replaced equality check with false → NO_COVERAGE
7.7 Location : equals Killed by : none removed conditional - replaced equality check with true → NO_COVERAGE
8.8 Location : equals Killed by : none removed conditional - replaced equality check with true → NO_COVERAGE
9.9 Location : equals Killed by : none removed conditional - replaced equality check with false → NO_COVERAGE
10.10 Location : equals Killed by : none removed call to java/util/List::equals → NO_COVERAGE
|
| 76 |
|
1.1 Location : equals Killed by : none Substituted 0 with 1 → NO_COVERAGE
2.2 Location : equals Killed by : none replaced boolean return with true for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::equals → NO_COVERAGE
|
| 81 |
|
1.1 Location : toString Killed by : none replaced return value with "" for net/bmahe/genetics4j/neat/spec/ExplicitNeatNodeLayout::toString → NO_COVERAGE
2.2 Location : toString Killed by : none removed call to java/lang/String::valueOf → NO_COVERAGE
3.3 Location : toString Killed by : none removed call to java/lang/String::valueOf → NO_COVERAGE
|