Class NewValueClassFilterIncludingSubclasses

  extended by org.eclipse.ocl.examples.eventmanager.filters.AbstractEventFilter
      extended by org.eclipse.ocl.examples.eventmanager.filters.ClassFilter
          extended by org.eclipse.ocl.examples.eventmanager.filters.ClassFilterIncludingSubclasses
              extended by org.eclipse.ocl.examples.eventmanager.filters.NewValueClassFilterIncludingSubclasses
All Implemented Interfaces:

public class NewValueClassFilterIncludingSubclasses
extends ClassFilterIncludingSubclasses

Matches an event's Notification.getNewValue() to an EObject.eClass() and all subclasses of this EClass. 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 NewValueClassFilterIncludingSubclassess 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.

Philipp Berger, Axel Uhl

Field Summary
Fields inherited from class org.eclipse.ocl.examples.eventmanager.filters.ClassFilter
Constructor Summary
NewValueClassFilterIncludingSubclasses(org.eclipse.emf.ecore.EClass subClass, boolean negated)
Method Summary
 NewValueClassFilterIncludingSubclasses clone()
 boolean equals(java.lang.Object obj)
 int hashCode()
 boolean matchesFor(org.eclipse.emf.common.notify.Notification event)
          Tests if the incoming Notification matches the intern specification
 java.lang.String toString()
Methods inherited from class org.eclipse.ocl.examples.eventmanager.filters.ClassFilterIncludingSubclasses
Methods inherited from class org.eclipse.ocl.examples.eventmanager.filters.ClassFilter
getFilterCriterion, getWantedClass
Methods inherited from class org.eclipse.ocl.examples.eventmanager.filters.AbstractEventFilter
expandNewAndOldValueCollections, isNegated, setNegated
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait

Constructor Detail


public NewValueClassFilterIncludingSubclasses(org.eclipse.emf.ecore.EClass subClass,
                                              boolean negated)
Method Detail


public boolean equals(java.lang.Object obj)
equals in class ClassFilter


public int hashCode()
hashCode in class ClassFilterIncludingSubclasses


public boolean matchesFor(org.eclipse.emf.common.notify.Notification event)
Description copied from interface: EventFilter
Tests if the incoming Notification matches the intern specification

Specified by:
matchesFor in interface EventFilter
matchesFor in class ClassFilter
event - the Notification to control
whether the given Notification matches the intern specification


public java.lang.String toString()
toString in class ClassFilterIncludingSubclasses


public NewValueClassFilterIncludingSubclasses clone()
Specified by:
clone in interface EventFilter
clone in class ClassFilterIncludingSubclasses