KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quilt > cl > GraphSpy


1 /* GraphSpy.java */
2 package org.quilt.cl;
3
4 import org.apache.bcel.generic.*;
5 import org.quilt.graph.*;
6
7 /**
8  * Makes the control flow graph available to a wider audience.
9  * 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 JavaDoc name;
17     
18     public static ControlFlowGraph theGraph = null;
19     
20     public GraphSpy () { }
21
22     public static ControlFlowGraph getTheGraph() {
23         return theGraph;
24     }
25     // INTERFACE GRAPHXFORMER ///////////////////////////////////
26
public void xform (final ClassGen cg, final MethodGen method,
27                                                 ControlFlowGraph cfg) {
28 // System.out.println(
29
// "==================\n"
30
// + "Hello from " + name
31
// + "\n==================" );
32
theGraph = cfg;
33     }
34     public static String JavaDoc getName() {
35         return name;
36     }
37     public static void setName (String JavaDoc s) {
38         name = s;
39     }
40 }
41
Popular Tags