org.eclipse.ocl.examples.eventmanager.filters
Class NewValueClassFilter

java.lang.Object
  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.NewValueClassFilter
All Implemented Interfaces:
EventFilter

public class NewValueClassFilter
extends ClassFilter

Matches an event's Notification.getNewValue() to an EObject.eClass(). 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.

Author:
Philipp Berger, Axel Uhl

Field Summary
 
Fields inherited from class org.eclipse.ocl.examples.eventmanager.filters.ClassFilter
wantedClass
 
Constructor Summary
NewValueClassFilter(org.eclipse.emf.ecore.EClass subClass, boolean negated)
           
 
Method Summary
 NewValueClassFilter 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.ClassFilter
getFilterCriterion, getWantedClass, matches
 
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

NewValueClassFilter

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

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class ClassFilter

matchesFor

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
Overrides:
matchesFor in class ClassFilter
Parameters:
event - the Notification to control
Returns:
whether the given Notification matches the intern specification

toString

public java.lang.String toString()
Overrides:
toString in class ClassFilter

clone

public NewValueClassFilter clone()
Specified by:
clone in interface EventFilter
Overrides:
clone in class ClassFilter