Files
VisualSapfor/src/_VisualDVM/ProjectData/GCOV/GCOV_info.java
2024-10-09 22:21:57 +03:00

29 lines
1.1 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package _VisualDVM.ProjectData.GCOV;
import javafx.util.Pair;
import java.util.LinkedHashMap;
public class GCOV_info {
public long max;
public LinkedHashMap<Integer, Pair<Long, Integer>> line_info = new LinkedHashMap<>();
//номер строки / число ее выполнений / масштаб
public void clear() {
max = 0;
line_info.clear();
}
public void add_line(int num, long count) {
line_info.put(num, new Pair<>(count, 0));
if (max < count) max = count;
}
//пределим минимум и максимум. оба должны быть >0. + определим интервал
public void setup() {
//определям процент по отношению к максимуму
for (int i : line_info.keySet()) {
Pair<Long, Integer> p = line_info.get(i);
int proportion = (max > 0) ? ((int) (((double) p.getKey() / max) * 100)) : 0;
if (proportion < 1) proportion = 1;
line_info.replace(i, new Pair<>(p.getKey(), proportion));
}
}
}