|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.ocl.examples.eventmanager.framework.EventManagerFactoryImpl
public class EventManagerFactoryImpl
The default implementation for the EventManagerFactory interface
Provides a ResourceSet based cache for EventManager instances and uses as implementation the EventManagerTableBased
| Field Summary |
|---|
| Fields inherited from interface org.eclipse.ocl.examples.eventmanager.EventManagerFactory |
|---|
eINSTANCE |
| Constructor Summary | |
|---|---|
EventManagerFactoryImpl()
|
|
| Method Summary | |
|---|---|
AndFilter |
createAndFilterFor(EventFilter... eventFilters)
Creates an AndFilter for incoming EventFilters. |
ClassFilter |
createClassFilter(org.eclipse.emf.ecore.EClass clazz)
Creates a filter that matches a Notification if the
object that changed
has . |
ClassFilterIncludingSubclasses |
createClassFilterIncludingSubclasses(org.eclipse.emf.ecore.EClass clazz)
Creates a filter that matches a notification if its notifier's class equals the class passed to this filter's constructor or any
subclasses thereof. |
ContainmentFilter |
createContainmentFilter()
Creates a filter that matches a notification that indicates a change in containment. |
EventManager |
createEventManager()
Creates a new EventManager that initially does not receive change
notifications from any resource set. |
EventManager |
createEventManagerFor(org.eclipse.emf.ecore.resource.ResourceSet set)
Creates a new EventManager that receives all change notifications
from all notifiers contained directly or indirectly by set. |
EventTypeFilter |
createEventTypeFilter(int eventType)
Filters for a Notification's event type, such as Notification.ADD or
Notification.REMOVE. |
EventFilter |
createFilterForEAttribute(org.eclipse.emf.ecore.EClass eClass,
org.eclipse.emf.ecore.EAttribute referredProperty)
Constructs an AndFilter
combining a ClassFilter for
eClass and an
PropertyFilter
for referredProperty. |
EventFilter |
createFilterForElementInsertion(org.eclipse.emf.ecore.EClass cls)
Creates an event filter that listens for events which indicate that an element of type cls has been added to the event manager's
ResourceSet, either by directly assigning it to the immediate
contents of a resource owned by the
ResourceSet, or by assigning it to the containment reference of
an element that is already part of the ResourceSet, or by adding
a parent in the containment hierarchy to the ResourceSet. |
EventFilter |
createFilterForElementInsertionOrDeletion(org.eclipse.emf.ecore.EClass cls)
Creates a filter tree, which will match if the given class get inserted or deleted by an event |
EventFilter |
createFilterForEReference(org.eclipse.emf.ecore.EClass eClass,
org.eclipse.emf.ecore.EReference referredProperty)
Constructs an AndFilter
combining a ClassFilter for
eClass and a
PropertyFilter
for referredProperty. |
NewValueClassFilter |
createNewValueClassFilter(org.eclipse.emf.ecore.EClass cls)
Creates a filter that matches an event's Notification.getNewValue() class. |
NewValueClassFilterIncludingSubclasses |
createNewValueClassFilterIncludingSubclasses(org.eclipse.emf.ecore.EClass cls)
Creates a filter that matches an event's Notification.getNewValue() class to
clazz and all subclasses thereof. |
NotFilter |
createNotFilter(EventFilter filter)
Creates a filter that matches if and only if filter does not
match. |
java.util.Collection<org.eclipse.emf.common.notify.Notification> |
createNotificationForComposites(org.eclipse.emf.common.notify.Notification event)
If event indicates the setting/adding/removal of/to/from a
containment reference, then it is expanded into a collection of event
notifications that document the creation or, respectively, dismantling of
the entire containment hierarchy. |
OldValueClassFilter |
createOldValueClassFilter(org.eclipse.emf.ecore.EClass cls)
Creates a filter that matches an event's Notification.getOldValue() class against
clazz. |
OldValueClassFilterIncludingSubclasses |
createOldValueClassFilterIncludingSubclasses(org.eclipse.emf.ecore.EClass cls)
Creates an filter that matches an event's Notification.getOldValue() class against
clazz and all subclasses thereof. |
OrFilter |
createOrFilterFor(EventFilter... eventFilters)
Shortcut, to create an OrFilter for incoming EventFilters |
StructuralFeatureFilter |
createStructuralFeatureFilter(org.eclipse.emf.ecore.EStructuralFeature property)
Creates a filter that matches a notification if its feature equals feature. |
void |
dispose()
Ensures that weakly-referenced structures are expunged so that particularly all cleanup threads will terminate. |
EventManager |
getEventManagerFor(org.eclipse.emf.ecore.resource.ResourceSet set)
Creates a new or re-uses an existing EventManager that was
previously created by calling this operation (and not by
EventManagerFactory.createEventManagerFor(ResourceSet)). |
static EventManagerFactory |
init()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public EventManagerFactoryImpl()
| Method Detail |
|---|
public static EventManagerFactory init()
EventManagerFactoryImplpublic EventManager getEventManagerFor(org.eclipse.emf.ecore.resource.ResourceSet set)
EventManagerFactoryEventManager that was
previously created by calling this operation (and not by
EventManagerFactory.createEventManagerFor(ResourceSet)). The event manager receives
all change notifications from all notifiers contained directly or
indirectly by set. Those events matching the filters
provided by listeners in their call to
EventManager.subscribe(EventFilter, org.eclipse.emf.common.notify.Adapter)
will be passed on to those listener Adapters.
getEventManagerFor in interface EventManagerFactoryset - if null, a null result will be
returned
null EventManager if and only
if set!=nullpublic EventManager createEventManager()
EventManagerFactoryEventManager that initially does not receive change
notifications from any resource set. This is useful if you want to be
able to already register adapters with the event manager without knowing
the resource sets from which those adapters later shall receive their
notifications. Well-suited for creating long-lived event managers.
createEventManager in interface EventManagerFactorypublic EventManager createEventManagerFor(org.eclipse.emf.ecore.resource.ResourceSet set)
EventManagerFactoryEventManager that receives all change notifications
from all notifiers contained directly or indirectly by set.
Those events matching the filters provided by listeners in their call to
EventManager.subscribe(EventFilter, org.eclipse.emf.common.notify.Adapter)
will be passed on to those listener Adapters. The event manager
returned will never be returned by
EventManagerFactory.getEventManagerFor(ResourceSet). This is useful if you need to
control which adapters subscribe to the event manager returned.
createEventManagerFor in interface EventManagerFactorypublic EventTypeFilter createEventTypeFilter(int eventType)
EventManagerFactoryNotification's event type, such as Notification.ADD or
Notification.REMOVE.
EventTypeFilter#EventTypeFilter()
createEventTypeFilter in interface EventManagerFactorypublic NotFilter createNotFilter(EventFilter filter)
EventManagerFactoryfilter does not
match.
createNotFilter in interface EventManagerFactorypublic ClassFilter createClassFilter(org.eclipse.emf.ecore.EClass clazz)
EventManagerFactoryNotification if the
object that changed
has clazz as its class.
createClassFilter in interface EventManagerFactorypublic ClassFilterIncludingSubclasses createClassFilterIncludingSubclasses(org.eclipse.emf.ecore.EClass clazz)
EventManagerFactorynotifier's class equals the class passed to this filter's constructor or any
subclasses thereof.
createClassFilterIncludingSubclasses in interface EventManagerFactorypublic StructuralFeatureFilter createStructuralFeatureFilter(org.eclipse.emf.ecore.EStructuralFeature property)
EventManagerFactoryfeature equals feature.
createStructuralFeatureFilter in interface EventManagerFactorypublic OldValueClassFilterIncludingSubclasses createOldValueClassFilterIncludingSubclasses(org.eclipse.emf.ecore.EClass cls)
EventManagerFactoryNotification.getOldValue() class against
clazz and all subclasses thereof. If the new value is a
collection then this filter matches if at least one of the collection's
elements is matched.
When several such filters are combined in an AndFilter, the
AndFilter matches if all of its operand filters match. This does
not require the individual OldValueClassFilterIncludingSubclasses
s to match based on the same element in case the old value happens to be
a collection. For example, assume there are two classes X
and Y with a class Z that has both,
X and Y as its superclasses (multiple
inheritance). Assume there is an AndFiter with two
OldValueClassFilterIncludingSubclassess inside, one matching
X, the other matching Y. If only a single
element is the old value of a Notification, the AndFilter
matches the notification if and only if the old value conforms to both,
X and Y, for example if its type is
Z. However, if there are two elements in the old value
collection of the Notification, one of type X and
the other of type Y, the first
OldValueClassFilterIncludingSubclasses matches because of the
X element, and the second
OldValueClassFilterIncludingSubclasses matches because of the
Y element and hence the AndFilter matches. However,
no single element in the old value collection fulfills both criteria.
createOldValueClassFilterIncludingSubclasses in interface EventManagerFactorypublic OldValueClassFilter createOldValueClassFilter(org.eclipse.emf.ecore.EClass cls)
EventManagerFactoryNotification.getOldValue() class against
clazz. An exact match, not considering any inheritance
relations, is required. If the new
value is a collection, e.g., because several elements were removed from
a many-feature at once, this filter matches if at least one of the
elements' class is matched.
When several such filters are combined in an AndFilter, the
AndFilter matches if all of its operand filters match. This does
not require the individual OldValueClassFilters to match based on
the same element in case the old value happens to be a collection. For
example, assume there are two classes X and Y.
Assume there is an AndFiter with two OldValueClassFilters
inside, one matching X, the other matching Y.
If there are two elements in the old value collection of the
Notification, one of type X and the other of type
Y, the first OldValueClassFilter matches because of
the X element, and the second OldValueClassFilter
matches because of the Y element and hence the
AndFilter matches. However, no single element in the old value
collection fulfills both criteria.
createOldValueClassFilter in interface EventManagerFactorypublic NewValueClassFilterIncludingSubclasses createNewValueClassFilterIncludingSubclasses(org.eclipse.emf.ecore.EClass cls)
EventManagerFactoryNotification.getNewValue() class to
clazz and all subclasses thereof. If the new value is a
collection then this filter matches if at least one of the collection's
elements is matched.
When several such filters are combined in an AndFilter, the
AndFilter matches if all of its operand filters match. This does
not require the individual NewValueClassFilterIncludingSubclasses
s to match based on the same element in case the new value happens to be
a collection. For example, assume there are two classes X
and Y with a class Z that has both,
X and Y as its superclasses (multiple
inheritance). Assume there is an AndFiter with two
NewValueClassFilterIncludingSubclassess inside, one matching
X, the other matching Y. If only a single
element is the new value of a Notification, the AndFilter
matches the notification if and only if the new value conforms to both,
X and Y, for example if its type is
Z. However, if there are two elements in the new value
collection of the Notification, one of type X and
the other of type Y, the first
NewValueClassFilterIncludingSubclasses matches because of the
X element, and the second
NewValueClassFilterIncludingSubclasses matches because of the
Y element and hence the AndFilter matches. However,
no single element in the new value collection fulfills both criteria.
createNewValueClassFilterIncludingSubclasses in interface EventManagerFactorypublic NewValueClassFilter createNewValueClassFilter(org.eclipse.emf.ecore.EClass cls)
EventManagerFactoryNotification.getNewValue() class. An
exact match, not considering any inheritance relations, is required. If
the new value is a collection, e.g.,
because several elements were assigned to a many-feature at once, this
filter matches if at least one of the elements' class is matched.
When several such filters are combined in an AndFilter, the
AndFilter matches if all of its operand filters match. This does
not require the individual NewValueClassFilters to match based on
the same element in case the new value happens to be a collection. For
example, assume there are two classes X and Y.
Assume there is an AndFiter with two NewValueClassFilters
inside, one matching X, the other matching Y.
If there are two elements in the new value collection of the
Notification, one of type X and the other of type
Y, the first NewValueClassFilter matches because of
the X element, and the second NewValueClassFilter
matches because of the Y element and hence the
AndFilter matches. However, no single element in the new value
collection fulfills both criteria.
createNewValueClassFilter in interface EventManagerFactorypublic ContainmentFilter createContainmentFilter()
EventManagerFactoryEReference with its
EReference.isContainer() or EReference.isContainment()
set to true, or it may be a change in the containment of a
Resource in a ResourceSet or of an EObject in a
Resource.
createContainmentFilter in interface EventManagerFactorypublic AndFilter createAndFilterFor(EventFilter... eventFilters)
EventManagerFactoryAndFilter for incoming EventFilters. The
resulting filter matches a Notification if and only if the
Notification is matched by all eventFilters.
createAndFilterFor in interface EventManagerFactoryeventFilters - filter to combine with an and
AndFilterpublic OrFilter createOrFilterFor(EventFilter... eventFilters)
EventManagerFactoryOrFilter for incoming EventFilters
createOrFilterFor in interface EventManagerFactoryeventFilters - filter to combine with an OR
OrFilterpublic EventFilter createFilterForElementInsertionOrDeletion(org.eclipse.emf.ecore.EClass cls)
EventManagerFactory
createFilterForElementInsertionOrDeletion in interface EventManagerFactorycls - class to listen for
public EventFilter createFilterForElementInsertion(org.eclipse.emf.ecore.EClass cls)
EventManagerFactorycls has been added to the event manager's
ResourceSet, either by directly assigning it to the immediate
contents of a resource owned by the
ResourceSet, or by assigning it to the containment reference of
an element that is already part of the ResourceSet, or by adding
a parent in the containment hierarchy to the ResourceSet.
createFilterForElementInsertion in interface EventManagerFactory
public EventFilter createFilterForEAttribute(org.eclipse.emf.ecore.EClass eClass,
org.eclipse.emf.ecore.EAttribute referredProperty)
EventManagerFactoryAndFilter
combining a ClassFilter for
eClass and an
PropertyFilter
for referredProperty.
createFilterForEAttribute in interface EventManagerFactory
public EventFilter createFilterForEReference(org.eclipse.emf.ecore.EClass eClass,
org.eclipse.emf.ecore.EReference referredProperty)
EventManagerFactoryAndFilter
combining a ClassFilter for
eClass and a
PropertyFilter
for referredProperty.
createFilterForEReference in interface EventManagerFactorypublic java.util.Collection<org.eclipse.emf.common.notify.Notification> createNotificationForComposites(org.eclipse.emf.common.notify.Notification event)
EventManagerFactoryevent indicates the setting/adding/removal of/to/from a
containment reference, then it is expanded into a collection of event
notifications that document the creation or, respectively, dismantling of
the entire containment hierarchy.
In any case, event is part of the collection returned.
createNotificationForComposites in interface EventManagerFactorypublic void dispose()
EventManagerFactory
dispose in interface EventManagerFactory
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||