View Javadoc

1   package org.sourceforge.jemm.client.events;
2   
3   /**
4    * A Contextual tracker of thread execution.
5    * 
6    * @see EntityContext
7    * @see LockContext
8    * @see MethodContext
9    * @author Paul
10   *
11   */
12  public interface Context {
13  	/**
14  	 * Adds to the context a thread.
15  	 * 
16  	 * If the same thread is entered more than once then an equal
17  	 * number of removes is required to actually remove it.
18  	 * 
19  	 * @param thread The thread that is 
20  	 */
21  	void add(Thread thread);
22  	
23  	/**
24  	 * Adds to the context the current thread.
25  	 * 
26  	 * @see Context#add(Thread)
27  	 */
28  	void add();
29  	
30  	/**
31  	 * Returns true if the thread has previously been added to the context
32  	 * otherwise false.
33  	 * 
34  	 * @param t The thread to look for
35  	 * @return True if thread has been added, false otherwise
36  	 */
37  	boolean has(Thread t);
38  	
39  	/**
40  	 * Calls has with the Thread.currentThread().
41  	 * 
42  	 * @See #has(Thread)
43  	 * @return True if the current thread thread has been added, false otherwise
44  	 */
45  	boolean has();
46  	
47  	/**
48  	 * Removes the thread from the context.
49  	 * 
50  	 * Only removes the thread if the number of calls to remove
51  	 * is the same as the number of times the thread was added.
52  	 * 
53  	 * @param t The thread to remove
54  	 */
55  	void remove(Thread t);
56  	
57  	/**
58  	 * Removes the current thread
59  	 * 
60  	 * @see #remove(Thread)
61  	 */
62  	void remove();
63  }