org.eclipse.emf.transaction.impl
Class FilterManager

java.lang.Object
  extended by org.eclipse.emf.transaction.impl.FilterManager

public final class FilterManager
extends Object

An object that manages the filtering of notifications. This class can implement optimizations to reduce the effort of filtering notification lists for listeners that have similar filters.


Method Summary
static FilterManager getInstance()
          Obtains the singleton instance of this class.
 List<Notification> select(List<Notification> notifications, NotificationFilter filter)
          Selects the notifications in the given list that match the specified filter.
 List<Notification> select(List<Notification> notifications, NotificationFilter filter, ArrayList<Notification> cache)
          Selects the notifications in the given list that match the specified filter.
 List<Notification> selectUnbatched(List<Notification> notification, NotificationFilter filter)
          Selects the notifications in the given singleton list of an unbatched notification that match the specified filter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static FilterManager getInstance()
Obtains the singleton instance of this class.

Returns:
the singleton instance

select

public List<Notification> select(List<Notification> notifications,
                                 NotificationFilter filter,
                                 ArrayList<Notification> cache)
Selects the notifications in the given list that match the specified filter.

For unbatched notifications, it is better to use the selectUnbatched(List, NotificationFilter) method.

Parameters:
notifications - a list of notifications to select from
filter - a notification filter
cache - A cache list that is precisely the same size as the notifications list but is used and reused as a scratch pad. Its purpose is to cut down the number of objects created and garbage collected while propagating filtered events to a group of listeners. Note that it will be repeatedly cleared and populated each time it is given to this method.
Returns:
the notifications that match the filter
See Also:
selectUnbatched(List, NotificationFilter)

select

public List<Notification> select(List<Notification> notifications,
                                 NotificationFilter filter)
Selects the notifications in the given list that match the specified filter.

For unbatched notifications, it is better to use the selectUnbatched(List, NotificationFilter) method.

Parameters:
notifications - a list of notifications to select from
filter - a notification filter
Returns:
the notifications that match the filter
See Also:
selectUnbatched(List, NotificationFilter)

selectUnbatched

public List<Notification> selectUnbatched(List<Notification> notification,
                                          NotificationFilter filter)
Selects the notifications in the given singleton list of an unbatched notification that match the specified filter. The result is, thus, either an empty list or the original list back again.

This method is more efficient for processing unbatched notifications than is the select(List, NotificationFilter) method.

Parameters:
notification - a singleton list containing the unbatched notification
filter - a notification filter
Returns:
the original list or an empty list, according to the filter
See Also:
select(List, NotificationFilter)

Copyright 2002, 2007 IBM Corporation and others.
All Rights Reserved.