sofya.ed.semantic
Class EventFilter

java.lang.Object
  extended by sofya.ed.semantic.EventFilter
All Implemented Interfaces:
EventListener
Direct Known Subclasses:
EventSelectionFilter

public abstract class EventFilter
extends java.lang.Object
implements EventListener

Abstract base class for all classes that wish to filter observable events in some way. It is intended that these filters can be registered with the SemanticEventTracer as well as chained together to filter and extract relevant events from the event stream online.

Version:
06/08/2005
Author:
Alex Kinneer

Nested Class Summary
 
Nested classes/interfaces inherited from interface sofya.ed.semantic.EventListener
EventListener.Arguments, EventListener.CallData, EventListener.ExceptionData, EventListener.FieldData, EventListener.MethodData, EventListener.MonitorData, EventListener.NewAllocationData, EventListener.ObjectData, EventListener.ThreadData, EventListener.ThreadStatus
 
Field Summary
protected  int listenerCount
          Number of listeners currently registered.
protected  EventListener[] listeners
          Registered event listeners.
 
Constructor Summary
EventFilter()
           
 
Method Summary
 void addEventListener(EventListener listener)
          Registers a listener for observable events.
protected  void ensureCapacity(int index)
          Ensures that the array of listeners will be large enough to store a listener at a given index.
 void removeEventListener(EventListener listener)
          Unregisters a listener for observable events.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface sofya.ed.semantic.EventListener
callReturnEvent, classPrepareEvent, constructorCallEvent, constructorEnterEvent, constructorExitEvent, exceptionCatchEvent, exceptionThrowEvent, executionStarted, instanceFieldAccessEvent, instanceFieldWriteEvent, interfaceCallEvent, monitorAcquireEvent, monitorContendEvent, monitorPreReleaseEvent, monitorReleaseEvent, newAllocationEvent, staticCallEvent, staticFieldAccessEvent, staticFieldWriteEvent, staticInitializerEnterEvent, staticMethodEnterEvent, staticMethodExitEvent, systemExited, systemStarted, threadDeathEvent, threadStartEvent, virtualCallEvent, virtualMethodEnterEvent, virtualMethodExitEvent
 

Field Detail

listeners

protected EventListener[] listeners
Registered event listeners. An array is used because events are dispatched to all listeners, and this tool will normally observe a large number of events.


listenerCount

protected int listenerCount
Number of listeners currently registered.

Constructor Detail

EventFilter

public EventFilter()
Method Detail

addEventListener

public void addEventListener(EventListener listener)
Registers a listener for observable events.

Parameters:
listener - Object which wishes to receive notifications of events related to observables in the system.

removeEventListener

public void removeEventListener(EventListener listener)
Unregisters a listener for observable events.

Parameters:
listener - Object which no longer wishes to receive notifications of events related to observables in the system.

ensureCapacity

protected void ensureCapacity(int index)
Ensures that the array of listeners will be large enough to store a listener at a given index.

Parameters:
index - Index which must be within the bounds of the array of listeners. If the array is not currently of sufficient size for the given index to be legal, the array will be extended such that it is. Otherwise this method does nothing. Negative values will be ignored.