api/jar/src/main/java/javax/slee/usage/UsageThresholdFilter.java
public boolean isNotificationEnabled(Notification notification) {
        if (!(notification instanceof UsageNotification)) return false;

        UsageNotification usageNotification = (UsageNotification)notification;
        if (service != null) {
            // SLEE 1.0 comparison
            if (!service.equals(usageNotification.getService())) return false;
            if (!sbb.equals(usageNotification.getSbb())) return false;
        }
        else {
            // SLEE 1.1 comparison
            if (!notificationSource.equals(usageNotification.getNotificationSource())) return false;
        }
        if (!usageNotification.getUsageParameterName().equals(paramName)) return false;

        long current = usageNotification.getValue();
        try {
            return (previous != threshold)
                ? ((previous < threshold && current > threshold) ||  // crossed +ve dir
                   (previous > threshold && current < threshold))    // crossed -ve dir
                : (getDirection(previous, current) == lastDir);      // crossed in last dir
        }
        finally {
            if (previous != current) {
                lastDir = getDirection(previous, current);
                previous = current;
            }
        }
    }
public boolean isNotificationEnabled(Notification notification) {
        if (!(notification instanceof UsageNotification)) return false;

        UsageNotification usageNotification = (UsageNotification)notification;
        if (service != null) {
            // SLEE 1.0 comparison
            if (!service.equals(usageNotification.getService())) return false;
            if (!sbb.equals(usageNotification.getSbb())) return false;
        }
        else {
            // SLEE 1.1 comparison
            if (!notificationSource.equals(usageNotification.getNotificationSource())) return false;
        }
        if (!usageNotification.getUsageParameterName().equals(paramName)) return false;

        long current = usageNotification.getValue();
        try {
            return (previous != threshold)
                ? ((previous < threshold && current > threshold) ||  // crossed +ve dir
                   (previous > threshold && current < threshold))    // crossed -ve dir
                : (getDirection(previous, current) == lastDir);      // crossed in last dir
        }
        finally {
            if (previous != current) {
                lastDir = getDirection(previous, current);
                previous = current;
            }
        }
    }
public boolean isNotificationEnabled ( Notification notification ) { if ( ! ( notification instanceof UsageNotification ) ) return false ; UsageNotification usageNotification = ( UsageNotification ) notification ; if ( service != null ) { // SLEE 1.0 comparison if ( ! service . equals ( usageNotification . getService ( ) ) ) return false ; if ( ! sbb . equals ( usageNotification . getSbb ( ) ) ) return false ; } else { // SLEE 1.1 comparison if ( ! notificationSource . equals ( usageNotification . getNotificationSource ( ) ) ) return false ; } if ( ! usageNotification . getUsageParameterName ( ) . equals ( paramName ) ) return false ; long current = usageNotification . getValue ( ) ; try { return ( previous != threshold ) ? ( ( previous < threshold && current > threshold ) || // crossed +ve dir ( previous > threshold && current < threshold ) ) // crossed -ve dir : ( getDirection ( previous , current ) == lastDir ) ; // crossed in last dir } finally { if ( previous != current ) { lastDir = getDirection ( previous , current ) ; previous = current ; } } }
Determine whether the specified notification should be delivered to notification
listeners using this notification filter.
@param notification the notification to be sent.
@return <code>true</code> if the notification should be delivered to notification
listeners, <code>false</code> otherwise.  This method always returns
<code>false</code> if <code>notification</code> is not an instance of
{@link UsageNotification}.
Determine whether the specified notification should be delivered to notification listeners using this notification filter .