seda.sandStorm.core
Class QueueThresholdPredicate

java.lang.Object
  extended by seda.sandStorm.core.QueueThresholdPredicate
All Implemented Interfaces:
EnqueuePredicateIF

public class QueueThresholdPredicate
extends java.lang.Object
implements EnqueuePredicateIF

This enqueue predicate implements a simple threshold for the size of the queue.


Field Summary
private static boolean DEBUG
           
private  SinkIF thesink
           
private  int threshold
           
 
Constructor Summary
QueueThresholdPredicate(SinkIF sink, int threshold)
          Create a new QueueThresholdPredicate for the given sink and threshold.
 
Method Summary
 boolean accept(QueueElementIF qel)
          Returns true if the given element can be accepted into the queue.
 int getThreshold()
          Return the current queue threshold.
 void setThreshold(int threshold)
          Set the current queue threshold.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

thesink

private SinkIF thesink

threshold

private int threshold
Constructor Detail

QueueThresholdPredicate

public QueueThresholdPredicate(SinkIF sink,
                               int threshold)
Create a new QueueThresholdPredicate for the given sink and threshold. A threshold of -1 indicates no threshold.

Method Detail

accept

public boolean accept(QueueElementIF qel)
Returns true if the given element can be accepted into the queue.

Specified by:
accept in interface EnqueuePredicateIF
Parameters:
qel - The QueueElementIF to enqueue
Returns:
True if the sink accepts the element; false otherwise.

getThreshold

public int getThreshold()
Return the current queue threshold.


setThreshold

public void setThreshold(int threshold)
Set the current queue threshold. A queue threshold of -1 indicates an infinite threshold.