summaryrefslogtreecommitdiffstats
path: root/src/org/jetbrains/java/decompiler/main/collectors/BytecodeMappingTracer.java
blob: 2b60f7e0de7bbc2c577ddcdf50569e8ffdf8f5b2 (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
package org.jetbrains.java.decompiler.main.collectors;

import java.util.HashMap;

public class BytecodeMappingTracer {

  private int current_sourceline;
  
  // bytecode offset, source line
  private HashMap<Integer, Integer> mapping;
  
  public void incrementSourceLine() {
    current_sourceline++;
  }
  
  public void addMapping(int bytecode_offset) {
    if(!mapping.containsKey(bytecode_offset)) {
      mapping.put(bytecode_offset, current_sourceline);
    }
  }

  public HashMap<Integer, Integer> getMapping() {
    return mapping;
  }  
  
}