Debian Codegraph @

src/smetana/core/debug/Debug.java

raw symbols SCIP
1 /* ========================================================================
2 * PlantUML : a free UML diagram generator
3 * ========================================================================
4 *
5 * (C) Copyright 2009-2020, Arnaud Roques
6 *
7 * Project Info: http://plantuml.com
8 *
9 * If you like this project or if you find it useful, you can support us at:
10 *
11 * http://plantuml.com/patreon (only 1$ per month!)
12 * http://plantuml.com/paypal
13 *
14 * This file is part of PlantUML.
15 *
16 * PlantUML is free software; you can redistribute it and/or modify it
17 * under the terms of the GNU General Public License as published by
18 * the Free Software Foundation, either version 3 of the License, or
19 * (at your option) any later version.
20 *
21 * PlantUML distributed in the hope that it will be useful, but
22 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
23 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
24 * License for more details.
25 *
26 * You should have received a copy of the GNU General Public
27 * License along with this library; if not, write to the Free Software
28 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
29 * USA.
30 *
31 *
32 * Original Author: Arnaud Roques
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 }