1 package junit.quilt.cover.state;
2
3 import java.net.*;
4
5 import junit.quilt.framework.*;
6 import java.util.*;
7
8 /***
9 * A simple registry for all the State Machines that are created. Useful
10 * for reporting purposes. This
11 * will need to be made thread aware, possibly using ThreadLocal inheritance.
12 * Now we are using a multimap, it would be nice to move to a tree data
13 * structure in order to ease with reporting. Maybe a swing treemodel.
14 *
15 *
16 *
17 * @author <a href="mailto:markpollack@users.sourceforge.net">Mark Pollack</a>
18 * @author <a href="mailto:dpeugh@users.sourceforge.net">David Dixon-Peugh</a>
19 * @version @VERSION@
20 */
21
22 public class StateMachineRegistry
23 extends QuiltRegistry
24 {
25
26 // private static StateMachineRegistry fInstance = new StateMachineRegistry();
27 private String levels[] = {"Instrument", "Class", "Method"};
28
29 public StateMachineRegistry () {
30 super( "StateMachine Instrumentation");
31 setLevels( levels );
32 }
33
34 public ClassLoader newInstClassLoader( String packages[],
35 URL path[],
36 ClassLoader parent) {
37 return new SMClassLoader(packages, path, parent, this)/index.html">> new SMClassLoader(packages, path, parent, this);
38 }
39
40 /***
41 * Store under a name a state machine.
42 *
43 * @param classname Class Name.
44 * @param methodname Method name.
45 * @param sm a <code>StateMachine</code> value
46 */
47 public void bind(String className, String methodName, SimpleStateMachine sm) {
48 String args[] = new String[2];
49 args[0] = className;
50 args[1] = methodName;
51 registerCollector( args, sm );
52 }
53
54
55 /***
56 * Lookup a StateMachine given the class and method.
57 *
58 * @param name a <code>String</code> value
59 * @return a <code>StateMachine</code> value
60 */
61 public SimpleStateMachine lookup(String className, String methodName)
62 {
63 String args[] = new String[2];
64 args[0] = className;
65 args[1] = methodName;
66 return (SimpleStateMachine)get(args);
67 }
68
69 /***
70 * Singleton access method.
71 *
72 * @return a <code>StateMachineRegistry</code> value
73 */
74 // public static StateMachineRegistry getInstance() {
75 // return fInstance;
76 // }
77 }// StateMachineRegistry
This page was automatically generated by Maven