net.esper.eql.view
Class OutputConditionTime

java.lang.Object
  extended by net.esper.eql.view.OutputConditionTime
All Implemented Interfaces:
OutputCondition

public final class OutputConditionTime
extends java.lang.Object
implements OutputCondition

Output condition that is satisfied at the end of every time interval of a given length.


Constructor Summary
OutputConditionTime(double secIntervalSize, ViewServiceContext context, OutputCallback outputCallback)
          Constructor.
 
Method Summary
protected static long computeWaitMSec(long current, long reference, long interval)
          Given a current time and a reference time and an interval size, compute the amount of milliseconds till the next interval.
 long getMsecIntervalSize()
          Returns the interval size in milliseconds.
 java.lang.String toString()
           
 void updateOutputCondition(int newEventsCount, int oldEventsCount)
          Update the output condition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OutputConditionTime

public OutputConditionTime(double secIntervalSize,
                           ViewServiceContext context,
                           OutputCallback outputCallback)
Constructor.

Parameters:
secIntervalSize - is the number of seconds to batch events for.
context - is the view context for time scheduling
outputCallback - is the callback to make once the condition is satisfied
Method Detail

getMsecIntervalSize

public final long getMsecIntervalSize()
Returns the interval size in milliseconds.

Returns:
batch size

updateOutputCondition

public final void updateOutputCondition(int newEventsCount,
                                        int oldEventsCount)
Description copied from interface: OutputCondition
Update the output condition.

Specified by:
updateOutputCondition in interface OutputCondition
Parameters:
newEventsCount - - number of new events incoming
oldEventsCount - - number of old events incoming

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

computeWaitMSec

protected static long computeWaitMSec(long current,
                                      long reference,
                                      long interval)
Given a current time and a reference time and an interval size, compute the amount of milliseconds till the next interval.

Parameters:
current - is the current time
reference - is the reference point
interval - is the interval size
Returns:
milliseconds after current time that marks the end of the current interval