blob: 95321e5d7537417167a65d9f45fd59a79cc22c5a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
package org.jetbrains.java.decompiler.main.collectors;
import java.util.HashMap;
import java.util.Set;
public class BytecodeMappingTracer {
private int current_sourceline;
// bytecode offset, source line
private HashMap<Integer, Integer> mapping = new HashMap<Integer, Integer>();
public BytecodeMappingTracer() {}
public BytecodeMappingTracer(int initial_source_line) {
current_sourceline = initial_source_line;
}
public void incrementSourceLine() {
current_sourceline++;
}
public void incrementSourceLine(int number_lines) {
current_sourceline += number_lines;
}
public void addMapping(int bytecode_offset) {
if(!mapping.containsKey(bytecode_offset)) {
mapping.put(bytecode_offset, current_sourceline);
}
}
public void addMapping(Set<Integer> bytecode_offsets) {
if(bytecode_offsets != null) {
for(Integer bytecode_offset : bytecode_offsets) {
addMapping(bytecode_offset);
}
}
}
public HashMap<Integer, Integer> getMapping() {
return mapping;
}
public int getCurrentSourceline() {
return current_sourceline;
}
public void setCurrentSourceline(int current_sourceline) {
this.current_sourceline = current_sourceline;
}
}
|