|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ocl.examples.eventmanager.framework.RegistrationManagerTableBased
public class RegistrationManagerTableBased
The RegistrationManager
is responsible for storing the listeners and their registrations and for computing the set
of affected listeners for a certain event.
The RegistrationManager
has knowledge about several things:
EventFilterTables
init()
method which is implemented in the subclass
com.RegistrationManagerTableBased.tc.moin.repository.events.framework.SessionRegistrationManager
because originally there also were other
subtypes of RegistrationManager
(e.g. the GlobalRegistrationManager). RegistrationManager
to fill the EventFilterTables
with new registrations
and to compute all listeners that are registered to a certain event. The knowledge of the registrations that belong to a
listener is primary for performance improvement at deregistration time. The
EventFilterTables
provide registrations for an event in
one context. When an event is being fired, the RegistrationManager
will know which EventFilterTables
to ask and can collect all registrations from all affected EventFilterTables
. The RegistrationManager
has the overview and can merge these candidates into a consolidated set of registrations. Afterwards these Registrations are
converted into listeners that will have to be notified.
Field Summary | |
---|---|
protected TableForEventFilter |
eventTypeFilterTable
|
protected java.util.Set<TableForEventFilter> |
tablesWithNegatedRegistrations
|
Constructor Summary | |
---|---|
RegistrationManagerTableBased()
|
Method Summary | |
---|---|
protected void |
addTableForEventType(TableForEventFilter table,
java.lang.Integer eventType)
This method fills the tablesByEventType member with the passed parameters. |
protected void |
createAllTables(int size)
|
protected java.util.Set<org.eclipse.ocl.examples.eventmanager.framework.Registration>[] |
createRegistrationSetArray()
Creates an array that has length 2^ so that any combination of
bit mask used as value in filterTypeToBitMask can be used as index into such an array. |
void |
deregister(org.eclipse.emf.common.notify.Adapter listener)
Removes all registrations that belong to the passed listener from all EventFilterTables . |
void |
deregister(java.lang.ref.Reference<? extends org.eclipse.emf.common.notify.Adapter> listenerRef)
|
static int |
getDepth(LogicalOperationFilterImpl filter)
Computes the depth of the subtree. |
static OrFilter |
getDisjunctiveNormalForm(LogicalOperationFilterImpl filter)
Transforms the (sub-)tree into disjunctive normal form. |
java.util.Collection<java.lang.ref.WeakReference<? extends org.eclipse.emf.common.notify.Adapter>> |
getListenersFor(org.eclipse.emf.common.notify.Notification event)
This method returns a Collection of Adapter s that were registered for the passed event. |
protected java.util.Collection<TableForEventFilter> |
getTablesForBitSet(int bitSet)
When passing a bit set as returned by getBitSet(Collection) , returns the collection
of filter tables identified by this bit set. |
protected void |
init()
The implementation of the init() method initialises the members above. |
boolean |
isListenerRegistered(org.eclipse.emf.common.notify.Adapter listener)
|
int |
redundantFilters()
Mostly for debugging and analysis. |
void |
register(EventFilter filterTree,
java.lang.ref.WeakReference<? extends org.eclipse.emf.common.notify.Adapter> listener,
ListenerTypeEnum listenerType)
registers a listener with the passed filter expression. |
protected void |
registerTable(TableForEventFilter table,
int posInAllTables)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected TableForEventFilter eventTypeFilterTable
protected java.util.Set<TableForEventFilter> tablesWithNegatedRegistrations
Constructor Detail |
---|
public RegistrationManagerTableBased()
Method Detail |
---|
protected void init()
init()
method initialises the members above.
Performs the "configuration" of the RegistrationManager.
protected void createAllTables(int size)
public void register(EventFilter filterTree, java.lang.ref.WeakReference<? extends org.eclipse.emf.common.notify.Adapter> listener, ListenerTypeEnum listenerType)
RegistrationHandle
is
intended to be used as handle for deregistration puposes.
filter
- the filter expression (may also be a tree)listener
- the listener to registerpublic void deregister(org.eclipse.emf.common.notify.Adapter listener)
EventFilterTables
. The listener will not
receive any events any more. This method is synchronized because there must be no changes to the FilterTables while they
are working.
listener
- the listener to deregisterpublic void deregister(java.lang.ref.Reference<? extends org.eclipse.emf.common.notify.Adapter> listenerRef)
public java.util.Collection<java.lang.ref.WeakReference<? extends org.eclipse.emf.common.notify.Adapter>> getListenersFor(org.eclipse.emf.common.notify.Notification event)
Collection
of Adapter
s that were registered for the passed event.
event
-
public boolean isListenerRegistered(org.eclipse.emf.common.notify.Adapter listener)
listener
-
protected void addTableForEventType(TableForEventFilter table, java.lang.Integer eventType)
tablesByEventType
member with the passed parameters. It is only used in the
init()
method of subclasses.
table
- eventType
- public static OrFilter getDisjunctiveNormalForm(LogicalOperationFilterImpl filter)
Object.clone()
before registering to the EventFramework or invoking this method.
public static int getDepth(LogicalOperationFilterImpl filter)
public java.lang.String toString()
toString
in class java.lang.Object
protected java.util.Set<org.eclipse.ocl.examples.eventmanager.framework.Registration>[] createRegistrationSetArray()
2^filterTypeToBitMask
.size()
so that any combination of
bit mask used as value in filterTypeToBitMask
can be used as index into such an array.
protected void registerTable(TableForEventFilter table, int posInAllTables)
protected java.util.Collection<TableForEventFilter> getTablesForBitSet(int bitSet)
getBitSet(Collection)
, returns the collection
of filter tables identified by this bit set.
public int redundantFilters()
AndFilter
s to be stored in the Registration
s.
Scans through all Registration
objects known by this event manager and determines how many overlapping
distinct registrations with equal AndFilter
there are. This is a prerequisite to judging how much
of a performance improvement we may gain if we try to collate registrations with equal filters.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |