org.sourceforge.jemm.client.events
Class SimpleContext

java.lang.Object
  extended by org.sourceforge.jemm.client.events.SimpleContext
All Implemented Interfaces:
Context
Direct Known Subclasses:
EntityContext, LockContext, MethodContext

public class SimpleContext
extends java.lang.Object
implements Context

A basic Context implementation that counts the number of thread add and removes. This class is thread safe.

Author:
Paul

Constructor Summary
SimpleContext()
           
 
Method Summary
 void add()
          Adds to the context the current thread.
 void add(java.lang.Thread thread)
          Adds to the context a thread.
 boolean has()
          Calls has with the Thread.currentThread().
 boolean has(java.lang.Thread t)
          Returns true if the thread has previously been added to the context otherwise false.
 boolean hasAny()
           
 void remove()
          Removes the current thread
 void remove(java.lang.Thread t)
          Removes the thread from the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleContext

public SimpleContext()
Method Detail

add

public void add(java.lang.Thread thread)
Description copied from interface: Context
Adds to the context a thread. If the same thread is entered more than once then an equal number of removes is required to actually remove it.

Specified by:
add in interface Context
Parameters:
thread - The thread that is

add

public void add()
Description copied from interface: Context
Adds to the context the current thread.

Specified by:
add in interface Context
See Also:
Context.add(Thread)

has

public boolean has(java.lang.Thread t)
Description copied from interface: Context
Returns true if the thread has previously been added to the context otherwise false.

Specified by:
has in interface Context
Parameters:
t - The thread to look for
Returns:
True if thread has been added, false otherwise

hasAny

public boolean hasAny()

has

public boolean has()
Description copied from interface: Context
Calls has with the Thread.currentThread().

Specified by:
has in interface Context
Returns:
True if the current thread thread has been added, false otherwise

remove

public void remove(java.lang.Thread t)
Description copied from interface: Context
Removes the thread from the context. Only removes the thread if the number of calls to remove is the same as the number of times the thread was added.

Specified by:
remove in interface Context
Parameters:
t - The thread to remove

remove

public void remove()
Description copied from interface: Context
Removes the current thread

Specified by:
remove in interface Context
See Also:
Context.remove(Thread)


Copyright © 2009. All Rights Reserved.