edu.uci.isr.yancees.server.plugin.subscription.correlation
Class ObjectBuffer

java.lang.Object
  extended byedu.uci.isr.yancees.server.plugin.subscription.correlation.ObjectBuffer

public class ObjectBuffer
extends java.lang.Object

This class stores the events collected in each incomplete sequence. It represents a partially matched pattern. A pattern may be matched without time bounds, or it can be defined to detect events that all arrive within certain time interval, or it can detect events that come one, after another, with some time interval, in between.


Constructor Summary
ObjectBuffer(int size)
           
ObjectBuffer(int size, long withinInterval, long afterInterval, boolean enforceOrder)
          Sets a buffer which must be filled within some interval, or must receive events, one after another, after some interval, that must have order enforced or not
 
Method Summary
 EventInterface[] getBufferContent()
           
 int getBufferSize()
           
 int getMatchSize()
           
 boolean isEmpty()
           
 boolean isExpired()
          This method checks for the 'WITHIN' clause in the correlation constructs.
 boolean isFull()
          Indicates whether or not all expected events arrived
 boolean objectArrivedForPosition(java.lang.Object element, int position)
          Receives a notification informing the arrival of an event from the specified position in the pattern.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectBuffer

public ObjectBuffer(int size)

ObjectBuffer

public ObjectBuffer(int size,
                    long withinInterval,
                    long afterInterval,
                    boolean enforceOrder)
Sets a buffer which must be filled within some interval, or must receive events, one after another, after some interval, that must have order enforced or not

Parameters:
size - is the expected number of events to expect in this pattern
withinInterval - is the total amount of time withing which all events must arrived
afterInterval - is the minimal time period between each event
Method Detail

getBufferContent

public EventInterface[] getBufferContent()

isFull

public boolean isFull()
Indicates whether or not all expected events arrived

Returns:
true if the buffer is full

isExpired

public boolean isExpired()
This method checks for the 'WITHIN' clause in the correlation constructs.


objectArrivedForPosition

public boolean objectArrivedForPosition(java.lang.Object element,
                                        int position)
Receives a notification informing the arrival of an event from the specified position in the pattern.

Parameters:
position - is the position in the pattern, where it came from
Returns:
ture if the event was accepted and false if not, idicating that the position was taken or the order of arrival was invalid.

isEmpty

public boolean isEmpty()

getBufferSize

public int getBufferSize()
Returns:
the absolute size of the buffer, the total number of events to wait for

getMatchSize

public int getMatchSize()
Returns:
the number of events in the pattern, matched up to now