org.jutil.event
Interface ApplicabilityNotifier

All Superinterfaces:
Notifier
All Known Implementing Classes:
TypeApplicabilityNotifier

public interface ApplicabilityNotifier
extends Notifier

Instances of this type add the posibility for users to ask whether the instance is applicable to a given listener/event combination.

The ChainNotifier chains instances of this type. It uses isApplicable(EventListener, EventObject) to decide whether or not to use a particular applicability notifier to notify a particular listener with a particular event.

The actual preconditions of the method Notifier.notifyEventListener(EventListener, EventObject) may be stronger than this method. isApplicable(EventListener, EventObject) should only test just enough to determine whether or not the intance can deal with this listener/event combination in the context of the listener/event combinations that actually will be offered to it. E.g., if we know for sure that the event argument will never be null, this method does not have to return false if it is called with an actual null argument, although the model method does. More specifically, there does not have to be code to check this. The specification is written this way in the interest of performance.

Typically, the method checks the type of the listener. {@link TypeApplicabilityNotifier is a subclass that offers support for this.

 ...
  /**
   * also
   *   public behavior
   *     pre listener != null;
   *     post \result == listener instanceof EventNameListener;

Version:
$Revision: 1.3 $
Author:
Jan Dockx

Field Summary
static java.lang.String CVS_REVISION
           
 
Method Summary
 boolean isApplicable(java.util.EventListener listener, java.util.EventObject event)
          public behavior
pre listener != null;
post \result <== isValidListener(listener) && isValidEvent(event);
 
Methods inherited from interface org.jutil.event.Notifier
notifyEventListener
 

Field Detail

CVS_REVISION

public static final java.lang.String CVS_REVISION
Method Detail

isApplicable

public boolean isApplicable(java.util.EventListener listener,
                            java.util.EventObject event)
public behavior
pre listener != null;
post \result <== isValidListener(listener) && isValidEvent(event);

If a listener or event is valid, then this must return true. The implication in the formal specification means that the model methods can be stronger than the implementation of this method. This method only needs to test things which cannot be proven.