public static List<ILexLocation> getSourceLocations(File file) { List<ILexLocation> locations = new Vector<ILexLocation>(); synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getExecutable() && l.getFile().equals(file)) { locations.add(l); } } } return locations; }
public Map<Integer, List<ILexLocation>> getMissLocations(File file) { Map<Integer, List<ILexLocation>> map = new HashMap<Integer, List<ILexLocation>>(); synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getExecutable() && l.getHits() == 0 && l.getFile().equals(file)) { List<ILexLocation> list = map.get(l.getStartLine()); if (list == null) { list = new Vector<ILexLocation>(); map.put(l.getStartLine(), list); } list.add(l); } } } return map; }
public long getSpanCalls(ILexNameToken name) { // The assumption is that the first executable location in // the span for the name is hit as many time as the span is called. ILexLocation span = null; synchronized (nameSpans) { span = nameSpans.get(name); } synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getExecutable() && l.within(span)) { return l.getHits(); } } } return 0; }
public static long getSpanCalls(ILexNameToken name) { // The assumption is that the first executable location in // the span for the name is hit as many time as the span is called. ILexLocation span = null; synchronized (nameSpans) { span = nameSpans.get(name); } synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getExecutable() && l.within(span)) { return l.getHits(); } } } return 0; }
public float getHitPercent(File file) { int hits = 0; int misses = 0; synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getFile().equals(file) && l.getExecutable()) { if (l.getHits() > 0) { hits++; } else { misses++; } } } } int sum = hits + misses; return sum == 0 ? 0 : (float) (1000 * hits / sum) / 10; // NN.N% }
public Map<Integer, List<ILexLocation>> getHitLocations(File file) { Map<Integer, List<ILexLocation>> map = new HashMap<Integer, List<ILexLocation>>(); synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getExecutable() && l.getHits() > 0 && l.getFile().equals(file)) { List<ILexLocation> list = map.get(l.getStartLine()); if (list == null) { list = new Vector<ILexLocation>(); map.put(l.getStartLine(), list); } list.add(l); } } } return map; }
public static float getHitPercent(File file) { int hits = 0; int misses = 0; synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getFile().equals(file) && l.getExecutable()) { if (l.getHits() > 0) { hits++; } else { misses++; } } } } int sum = hits + misses; return sum == 0 ? 0 : (float) (1000 * hits / sum) / 10; // NN.N% }
public static Map<Integer, List<ILexLocation>> getHitLocations(File file) { Map<Integer, List<ILexLocation>> map = new HashMap<Integer, List<ILexLocation>>(); synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getExecutable() && l.getHits() > 0 && l.getFile().equals(file)) { List<ILexLocation> list = map.get(l.getStartLine()); if (list == null) { list = new Vector<ILexLocation>(); map.put(l.getStartLine(), list); } list.add(l); } } } return map; }
public static Map<Integer, List<ILexLocation>> getMissLocations(File file) { Map<Integer, List<ILexLocation>> map = new HashMap<Integer, List<ILexLocation>>(); synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getExecutable() && l.getHits() == 0 && l.getFile().equals(file)) { List<ILexLocation> list = map.get(l.getStartLine()); if (list == null) { list = new Vector<ILexLocation>(); map.put(l.getStartLine(), list); } list.add(l); } } } return map; }
public static List<Integer> getSourceList(File file) { List<Integer> lines = new Vector<Integer>(); int last = 0; synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getExecutable() && l.getStartLine() != last && l.getFile().equals(file)) { lines.add(l.getStartLine()); last = l.getStartLine(); } } } return lines; }
public static float getSpanPercent(ILexNameToken name) { int hits = 0; int misses = 0; ILexLocation span = null; synchronized (nameSpans) { span = nameSpans.get(name); } synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getExecutable() && l.within(span)) { if (l.getHits() > 0) { hits++; } else { misses++; } } } } int sum = hits + misses; return sum == 0 ? 0 : (float) (1000 * hits / sum) / 10; // NN.N% }
public float getSpanPercent(ILexNameToken name) { int hits = 0; int misses = 0; ILexLocation span = null; synchronized (nameSpans) { span = nameSpans.get(name); } synchronized (allLocations) { for (ILexLocation l : allLocations) { if (l.getExecutable() && l.within(span)) { if (l.getHits() > 0) { hits++; } else { misses++; } } } } int sum = hits + misses; return sum == 0 ? 0 : (float) (1000 * hits / sum) / 10; // NN.N% }