edu.uci.isr.yancees.filter
Class AbstractFilterManager

java.lang.Object
  extended by edu.uci.isr.yancees.filter.AbstractFilterManager
All Implemented Interfaces:
FilterManagerInterface
Direct Known Subclasses:
InputFilterManager, OutputFilterManager

public abstract class AbstractFilterManager
extends java.lang.Object
implements FilterManagerInterface

This class manages the current instances of services, special plug-ins that can be shared by all other plugins.


Nested Class Summary
 class AbstractFilterManager.ResponseCollectorFilter
          This "dummy" filter only collects the event posted to it by the chain of responsibilty of filters It is used to collect the resultant event generated by the multiple filtering performed in this class.
 
Constructor Summary
AbstractFilterManager()
          Constructor
 
Method Summary
 void addFilter(FilterInterface filter)
          Add a filter to the end of a list and register it under a name
 EventInterface[] filterEvent(EventInterface evt)
          Passes the even throught the chain of responsibility and returnes the event which is produced by the last filter of the chain.
 EventInterface[] filterEventList(EventInterface[] evtList)
          Filters a set of events
 FilterInterface getFilterAt(int i)
           
 FilterInterface getFilterByName(java.lang.String name)
           
 FilterInterface[] getFilters()
           
 int getNumberOfFilters()
           
 void insertFilterAt(FilterInterface filter, int i)
          Insters a filter in the provided position in the filters stream
 void removeFilterAt(int i)
          Remove the element at provided position from filters streams
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractFilterManager

public AbstractFilterManager()
Constructor

Method Detail

getNumberOfFilters

public int getNumberOfFilters()
Returns:
the number of filters installed.

getFilterByName

public FilterInterface getFilterByName(java.lang.String name)
Specified by:
getFilterByName in interface FilterManagerInterface
Parameters:
name - is the unique name of the filter
Returns:
the filter registered under the unique name

getFilters

public FilterInterface[] getFilters()
Specified by:
getFilters in interface FilterManagerInterface
Returns:
the list of all the filters, in the order they are installed

addFilter

public void addFilter(FilterInterface filter)
Add a filter to the end of a list and register it under a name

Specified by:
addFilter in interface FilterManagerInterface
Parameters:
filter - is the filter to be inserted after all current filters
name - is the name of the filter

getFilterAt

public FilterInterface getFilterAt(int i)
Specified by:
getFilterAt in interface FilterManagerInterface
Parameters:
i - is the position of the filter to be returned
Returns:
the filter at the provided position

insertFilterAt

public void insertFilterAt(FilterInterface filter,
                           int i)
Insters a filter in the provided position in the filters stream

Specified by:
insertFilterAt in interface FilterManagerInterface
Parameters:
filter - is the filter to be inserted
i - is the position to insert the filter

removeFilterAt

public void removeFilterAt(int i)
Remove the element at provided position from filters streams

Specified by:
removeFilterAt in interface FilterManagerInterface
Parameters:
i - is the position of the filter to be removed

filterEvent

public EventInterface[] filterEvent(EventInterface evt)
Passes the even throught the chain of responsibility and returnes the event which is produced by the last filter of the chain. For such, it registers a temporary filter at the end of the stream to colelct this response.

Specified by:
filterEvent in interface FilterManagerInterface
Returns:
the event generated throught the filtering process
See Also:
yancees.filter.FilterManagerInterface#filterEvent(yancees.core.EventInterface)

filterEventList

public EventInterface[] filterEventList(EventInterface[] evtList)
Filters a set of events

Specified by:
filterEventList in interface FilterManagerInterface
Returns:
the event generated throught the filtering process
See Also:
yancees.filter.FilterManagerInterface#filterEventList(yancees.core.EventInterface[])