|
||||||||||
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 EventFilter s. |
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 EventFilter s |
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()
EventManagerFactoryImpl
public EventManager getEventManagerFor(org.eclipse.emf.ecore.resource.ResourceSet set)
EventManagerFactory
EventManager
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 Adapter
s.
getEventManagerFor
in interface EventManagerFactory
set
- if null
, a null
result will be
returned
null
EventManager
if and only
if set!=null
public EventManager createEventManager()
EventManagerFactory
EventManager
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 EventManagerFactory
public EventManager createEventManagerFor(org.eclipse.emf.ecore.resource.ResourceSet set)
EventManagerFactory
EventManager
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 Adapter
s. 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 EventManagerFactory
public EventTypeFilter createEventTypeFilter(int eventType)
EventManagerFactory
Notification
's event type
, such as Notification.ADD
or
Notification.REMOVE
.
EventTypeFilter#EventTypeFilter()
createEventTypeFilter
in interface EventManagerFactory
public NotFilter createNotFilter(EventFilter filter)
EventManagerFactory
filter
does not
match.
createNotFilter
in interface EventManagerFactory
public ClassFilter createClassFilter(org.eclipse.emf.ecore.EClass clazz)
EventManagerFactory
Notification
if the
object that changed
has clazz
as its class
.
createClassFilter
in interface EventManagerFactory
public ClassFilterIncludingSubclasses createClassFilterIncludingSubclasses(org.eclipse.emf.ecore.EClass clazz)
EventManagerFactory
notifier
's class
equals the class passed to this filter's constructor or any
subclasses thereof.
createClassFilterIncludingSubclasses
in interface EventManagerFactory
public StructuralFeatureFilter createStructuralFeatureFilter(org.eclipse.emf.ecore.EStructuralFeature property)
EventManagerFactory
feature
equals feature
.
createStructuralFeatureFilter
in interface EventManagerFactory
public OldValueClassFilterIncludingSubclasses createOldValueClassFilterIncludingSubclasses(org.eclipse.emf.ecore.EClass cls)
EventManagerFactory
Notification.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
OldValueClassFilterIncludingSubclasses
s 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 EventManagerFactory
public OldValueClassFilter createOldValueClassFilter(org.eclipse.emf.ecore.EClass cls)
EventManagerFactory
Notification.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 OldValueClassFilter
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
.
Assume there is an AndFiter
with two OldValueClassFilter
s
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 EventManagerFactory
public NewValueClassFilterIncludingSubclasses createNewValueClassFilterIncludingSubclasses(org.eclipse.emf.ecore.EClass cls)
EventManagerFactory
Notification.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
NewValueClassFilterIncludingSubclasses
s 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 EventManagerFactory
public NewValueClassFilter createNewValueClassFilter(org.eclipse.emf.ecore.EClass cls)
EventManagerFactory
Notification.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 NewValueClassFilter
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
.
Assume there is an AndFiter
with two NewValueClassFilter
s
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 EventManagerFactory
public ContainmentFilter createContainmentFilter()
EventManagerFactory
EReference
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 EventManagerFactory
public AndFilter createAndFilterFor(EventFilter... eventFilters)
EventManagerFactory
AndFilter
for incoming EventFilter
s. The
resulting filter matches a Notification
if and only if the
Notification
is matched by all eventFilters
.
createAndFilterFor
in interface EventManagerFactory
eventFilters
- filter to combine with an and
AndFilter
public OrFilter createOrFilterFor(EventFilter... eventFilters)
EventManagerFactory
OrFilter
for incoming EventFilter
s
createOrFilterFor
in interface EventManagerFactory
eventFilters
- filter to combine with an OR
OrFilter
public EventFilter createFilterForElementInsertionOrDeletion(org.eclipse.emf.ecore.EClass cls)
EventManagerFactory
createFilterForElementInsertionOrDeletion
in interface EventManagerFactory
cls
- class to listen for
public EventFilter createFilterForElementInsertion(org.eclipse.emf.ecore.EClass cls)
EventManagerFactory
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
.
createFilterForElementInsertion
in interface EventManagerFactory
public EventFilter createFilterForEAttribute(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EAttribute referredProperty)
EventManagerFactory
AndFilter
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)
EventManagerFactory
AndFilter
combining a ClassFilter
for
eClass
and a
PropertyFilter
for referredProperty
.
createFilterForEReference
in interface EventManagerFactory
public java.util.Collection<org.eclipse.emf.common.notify.Notification> createNotificationForComposites(org.eclipse.emf.common.notify.Notification event)
EventManagerFactory
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.
In any case, event
is part of the collection returned.
createNotificationForComposites
in interface EventManagerFactory
public void dispose()
EventManagerFactory
dispose
in interface EventManagerFactory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |