01: /* GraphSpy.java */
02: package org.quilt.cl;
03:
04: import org.apache.bcel.generic.*;
05: import org.quilt.graph.*;
06:
07: /**
08: * Makes the control flow graph available to a wider audience.
09: * Used in testing.
10: *
11: * @author <a href="jddixon@users.sourceforge.net">Jim Dixon</a>
12: */
13:
14: public class GraphSpy implements GraphXformer {
15:
16: private static String name;
17:
18: public static ControlFlowGraph theGraph = null;
19:
20: public GraphSpy() {
21: }
22:
23: public static ControlFlowGraph getTheGraph() {
24: return theGraph;
25: }
26:
27: // INTERFACE GRAPHXFORMER ///////////////////////////////////
28: public void xform(final ClassGen cg, final MethodGen method,
29: ControlFlowGraph cfg) {
30: // System.out.println(
31: // "==================\n"
32: // + "Hello from " + name
33: // + "\n==================" );
34: theGraph = cfg;
35: }
36:
37: public static String getName() {
38: return name;
39: }
40:
41: public static void setName(String s) {
42: name = s;
43: }
44: }
|