summaryrefslogtreecommitdiffstats
path: root/src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java')
-rw-r--r--src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java b/src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java
index 95321e5..20af427 100644
--- a/src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java
+++ b/src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java
@@ -1,6 +1,7 @@
package org.jetbrains.java.decompiler.main.collectors;
import java.util.HashMap;
+import java.util.Map.Entry;
import java.util.Set;
public class BytecodeMappingTracer {
@@ -16,14 +17,20 @@ public class BytecodeMappingTracer {
current_sourceline = initial_source_line;
}
- public void incrementSourceLine() {
+ public void incrementCurrentSourceLine() {
current_sourceline++;
}
- public void incrementSourceLine(int number_lines) {
+ public void incrementCurrentSourceLine(int number_lines) {
current_sourceline += number_lines;
}
+ public void shiftSourceLines(int shift) {
+ for(Entry<Integer, Integer> entry : mapping.entrySet()) {
+ entry.setValue(entry.getValue() + shift);
+ }
+ }
+
public void addMapping(int bytecode_offset) {
if(!mapping.containsKey(bytecode_offset)) {
mapping.put(bytecode_offset, current_sourceline);
@@ -38,15 +45,25 @@ public class BytecodeMappingTracer {
}
}
+ public void addTracer(BytecodeMappingTracer tracer) {
+ if(tracer != null) {
+ for(Entry<Integer, Integer> entry : tracer.mapping.entrySet()) {
+ if(!mapping.containsKey(entry.getKey())) {
+ mapping.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+ }
+
public HashMap<Integer, Integer> getMapping() {
return mapping;
}
- public int getCurrentSourceline() {
+ public int getCurrentSourceLine() {
return current_sourceline;
}
- public void setCurrentSourceline(int current_sourceline) {
+ public void setCurrentSourceLine(int current_sourceline) {
this.current_sourceline = current_sourceline;
}