| 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 |
package smetana.core.debug; |
| 36 |
|
| 37 |
import java.util.ArrayList; |
| 38 |
import java.util.Collection; |
| 39 |
import java.util.HashMap; |
| 40 |
import java.util.HashSet; |
| 41 |
import java.util.LinkedHashSet; |
| 42 |
import java.util.List; |
| 43 |
import java.util.Map; |
| 44 |
import java.util.Set; |
| 45 |
|
| 46 |
public class Debug { |
| 47 |
|
| 48 |
private final Map<String, String> methodNames = new HashMap<String, String>(); |
| 49 |
private final Collection<String> called = new LinkedHashSet<String>(); |
| 50 |
|
| 51 |
public void entering(String signature, String methodName) { |
| 52 |
methodNames.put(signature, methodName); |
| 53 |
if (called.contains(signature) == false) { |
| 54 |
called.add(signature); |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
public void leaving(String signature, String methodName) { |
| 59 |
} |
| 60 |
|
| 61 |
public void reset() { |
| 62 |
methodNames.clear(); |
| 63 |
called.clear(); |
| 64 |
} |
| 65 |
|
| 66 |
public void printMe() { |
| 67 |
System.err.println("methodNames=" + methodNames.size()); |
| 68 |
System.err.println("called=" + called.size()); |
| 69 |
final List<String> called2 = new ArrayList<String>(called); |
| 70 |
for (int i = 0; i < called.size(); i++) { |
| 71 |
System.err.println("n " + i + " " + methodNames.get(called2.get(i)) + " " + called2.get(i)); |
| 72 |
} |
| 73 |
final Set<String> called3 = new HashSet<String>(called); |
| 74 |
for (String s : called3) { |
| 75 |
System.err.println("p " + s); |
| 76 |
} |
| 77 |
} |
| 78 |
|
| 79 |
} |