1 | package com.adventofcode.day14 | |
2 | ||
3 |
1
1. getInput : replaced return value with Collections.emptyList for com/adventofcode/day14/MaskPrograms::getInput → NO_COVERAGE |
class MaskPrograms(val input: Collection<String>) { |
4 | ||
5 | ||
6 | fun getMemory(): Long { | |
7 | var memory = mutableMapOf<Long, Long>() | |
8 | val data = input.iterator() | |
9 | var blockData = arrayListOf<Pair<Long, Long>>() | |
10 | ||
11 | var line = "" | |
12 | var currentBitmask = "" | |
13 | ||
14 |
1
1. getMemory : negated conditional → KILLED |
while (data.hasNext()) { |
15 | line = data.next() | |
16 | when (line.substring(0,3)) { | |
17 | "mem" -> blockData.add( | |
18 | line.substringBefore(" =").substringAfter("[").dropLast(1).toLong() to | |
19 | line.substringAfter("= ").toLong() | |
20 | ) | |
21 | else -> | |
22 |
1
1. getMemory : negated conditional → KILLED |
if (line.startsWith("mask = ")) { |
23 |
2
1. getMemory : changed conditional boundary → SURVIVED 2. getMemory : negated conditional → KILLED |
if (blockData.size > 0) { |
24 |
1
1. getMemory : removed call to java/util/Map::putAll → KILLED |
memory.putAll(MaskProgram(currentBitmask, *blockData.toTypedArray()).getMemory()) |
25 | blockData = arrayListOf() | |
26 | } | |
27 | currentBitmask = line.split("= ").last() | |
28 | } | |
29 | } | |
30 | } | |
31 |
2
1. getMemory : changed conditional boundary → SURVIVED 2. getMemory : negated conditional → KILLED |
if (blockData.size > 0) { |
32 |
1
1. getMemory : removed call to java/util/Map::putAll → KILLED |
memory.putAll(MaskProgram(currentBitmask, *blockData.toTypedArray()).getMemory()) |
33 | } | |
34 | ||
35 |
1
1. getMemory : replaced long return with 0 for com/adventofcode/day14/MaskPrograms::getMemory → KILLED |
return memory.values.sum() |
36 | ||
37 | } | |
38 | ||
39 | ||
40 | ||
41 | fun getMemoryV2(): Long { | |
42 | var memory = mutableMapOf<Long, Long>() | |
43 | val data = input.iterator() | |
44 | var blockData = arrayListOf<Pair<Long, Long>>() | |
45 | ||
46 | var line = "" | |
47 | var currentBitmask = "" | |
48 | ||
49 |
1
1. getMemoryV2 : negated conditional → KILLED |
while (data.hasNext()) { |
50 | line = data.next() | |
51 | when (line.substring(0,3)) { | |
52 | "mem" -> blockData.add( | |
53 | line.substringBefore(" =").substringAfter("[").dropLast(1).toLong() to | |
54 | line.substringAfter("= ").toLong() | |
55 | ) | |
56 | else -> | |
57 |
1
1. getMemoryV2 : negated conditional → KILLED |
if (line.startsWith("mask = ")) { |
58 |
2
1. getMemoryV2 : changed conditional boundary → SURVIVED 2. getMemoryV2 : negated conditional → KILLED |
if (blockData.size > 0) { |
59 |
1
1. getMemoryV2 : removed call to java/util/Map::putAll → KILLED |
memory.putAll(MaskProgram(currentBitmask, *blockData.toTypedArray()).getMemoryV2()) |
60 | blockData = arrayListOf() | |
61 | } | |
62 | currentBitmask = line.split("= ").last() | |
63 | } | |
64 | } | |
65 | } | |
66 |
2
1. getMemoryV2 : changed conditional boundary → SURVIVED 2. getMemoryV2 : negated conditional → KILLED |
if (blockData.size > 0) { |
67 |
1
1. getMemoryV2 : removed call to java/util/Map::putAll → KILLED |
memory.putAll(MaskProgram(currentBitmask, *blockData.toTypedArray()).getMemoryV2()) |
68 | } | |
69 | ||
70 |
1
1. getMemoryV2 : replaced long return with 0 for com/adventofcode/day14/MaskPrograms::getMemoryV2 → KILLED |
return memory.values.sum() |
71 | ||
72 | } | |
73 | ||
74 | ||
75 | } | |
Mutations | ||
3 |
1.1 |
|
14 |
1.1 |
|
22 |
1.1 |
|
23 |
1.1 2.2 |
|
24 |
1.1 |
|
31 |
1.1 2.2 |
|
32 |
1.1 |
|
35 |
1.1 |
|
49 |
1.1 |
|
57 |
1.1 |
|
58 |
1.1 2.2 |
|
59 |
1.1 |
|
66 |
1.1 2.2 |
|
67 |
1.1 |
|
70 |
1.1 |
|
78 |
1.1 |
|
80 |
1.1 |
|
82 |
1.1 |
|
84 |
1.1 |