org.apache.excalibur.event.impl
Class ThresholdEnqueuePredicate

java.lang.Object
  extended byorg.apache.excalibur.event.impl.ThresholdEnqueuePredicate
All Implemented Interfaces:
org.apache.excalibur.event.EnqueuePredicate

public final class ThresholdEnqueuePredicate
extends java.lang.Object
implements org.apache.excalibur.event.EnqueuePredicate

The ThresholdEnqueuePredicate limits the elements that can be enqueued based on the size of the Queue.

Author:
Avalon Development Team

Constructor Summary
ThresholdEnqueuePredicate(int limit)
          Create a new ThresholdEnqueuePredicate with the supplied limit.
 
Method Summary
 boolean accept(java.lang.Object[] elements, org.apache.excalibur.event.Sink modifyingSink)
          Returns true if the Sink size + the number of elements is less than the threshold.
 boolean accept(java.lang.Object element, org.apache.excalibur.event.Sink modifyingSink)
          Returns true if the Sink size + 1 (the element) is less than the threshold.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThresholdEnqueuePredicate

public ThresholdEnqueuePredicate(int limit)
Create a new ThresholdEnqueuePredicate with the supplied limit.

Parameters:
limit - A number greater than zero
Method Detail

accept

public boolean accept(java.lang.Object element,
                      org.apache.excalibur.event.Sink modifyingSink)
Returns true if the Sink size + 1 (the element) is less than the threshold.

Specified by:
accept in interface org.apache.excalibur.event.EnqueuePredicate

accept

public boolean accept(java.lang.Object[] elements,
                      org.apache.excalibur.event.Sink modifyingSink)
Returns true if the Sink size + the number of elements is less than the threshold.

Specified by:
accept in interface org.apache.excalibur.event.EnqueuePredicate


Copyright © {inceptionYear}-2007 Apache Software Foundation. All Rights Reserved.