com.espertech.esper.epl.agg.access
Class AggregationStateImpl

java.lang.Object
  extended by com.espertech.esper.epl.agg.access.AggregationStateImpl
All Implemented Interfaces:
AggregationState, AggregationStateLinear, AggregationStateWithSize

public class AggregationStateImpl
extends java.lang.Object
implements AggregationStateWithSize, AggregationStateLinear

Implementation of access function for single-stream (not joins).


Field Summary
protected  java.util.ArrayList<EventBean> events
           
protected  int streamId
           
 
Constructor Summary
AggregationStateImpl(int streamId)
          Ctor.
 
Method Summary
 void applyEnter(EventBean[] eventsPerStream, ExprEvaluatorContext exprEvaluatorContext)
          Enter an event.
 void applyLeave(EventBean[] eventsPerStream, ExprEvaluatorContext exprEvaluatorContext)
          Remove an event.
 void clear()
          Clear all events in the group.
 java.util.Collection<EventBean> collectionReadOnly()
          Returns all events for the group.
 EventBean getFirstNthValue(int index)
          Counting from the first element to the last, returns the oldest (first) value entered for index zero and the n-th oldest value for index N.
 EventBean getFirstValue()
          Returns the first (oldest) value entered.
 EventBean getLastNthValue(int index)
          Counting from the last element to the first, returns the newest (last) value entered for index zero and the n-th newest value for index N.
 EventBean getLastValue()
          Returns the newest (last) value entered.
 java.util.Iterator<EventBean> iterator()
          Returns all events for the group.
 int size()
          Must return the number of events currently held, if applicable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

streamId

protected int streamId

events

protected java.util.ArrayList<EventBean> events
Constructor Detail

AggregationStateImpl

public AggregationStateImpl(int streamId)
Ctor.

Parameters:
streamId - stream id
Method Detail

clear

public void clear()
Description copied from interface: AggregationState
Clear all events in the group.

Specified by:
clear in interface AggregationState

applyLeave

public void applyLeave(EventBean[] eventsPerStream,
                       ExprEvaluatorContext exprEvaluatorContext)
Description copied from interface: AggregationState
Remove an event.

Specified by:
applyLeave in interface AggregationState
Parameters:
eventsPerStream - all events in all streams, typically implementations pick the relevant stream's events to remove
exprEvaluatorContext - expression eval context

applyEnter

public void applyEnter(EventBean[] eventsPerStream,
                       ExprEvaluatorContext exprEvaluatorContext)
Description copied from interface: AggregationState
Enter an event.

Specified by:
applyEnter in interface AggregationState
Parameters:
eventsPerStream - all events in all streams, typically implementations pick the relevant stream's events to add
exprEvaluatorContext - expression eval context

getFirstNthValue

public EventBean getFirstNthValue(int index)
Description copied from interface: AggregationStateLinear
Counting from the first element to the last, returns the oldest (first) value entered for index zero and the n-th oldest value for index N.

Specified by:
getFirstNthValue in interface AggregationStateLinear
Parameters:
index - index
Returns:
last value

getLastNthValue

public EventBean getLastNthValue(int index)
Description copied from interface: AggregationStateLinear
Counting from the last element to the first, returns the newest (last) value entered for index zero and the n-th newest value for index N.

Specified by:
getLastNthValue in interface AggregationStateLinear
Parameters:
index - index
Returns:
last value

getFirstValue

public EventBean getFirstValue()
Description copied from interface: AggregationStateLinear
Returns the first (oldest) value entered.

Specified by:
getFirstValue in interface AggregationStateLinear
Returns:
first value

getLastValue

public EventBean getLastValue()
Description copied from interface: AggregationStateLinear
Returns the newest (last) value entered.

Specified by:
getLastValue in interface AggregationStateLinear
Returns:
last value

iterator

public java.util.Iterator<EventBean> iterator()
Description copied from interface: AggregationStateLinear
Returns all events for the group.

Specified by:
iterator in interface AggregationStateLinear
Returns:
group event iterator

collectionReadOnly

public java.util.Collection<EventBean> collectionReadOnly()
Description copied from interface: AggregationStateLinear
Returns all events for the group.

Specified by:
collectionReadOnly in interface AggregationStateLinear
Returns:
group event iterator

size

public int size()
Description copied from interface: AggregationStateWithSize
Must return the number of events currently held, if applicable. Return -1 if not applicable.

Specified by:
size in interface AggregationStateLinear
Specified by:
size in interface AggregationStateWithSize
Returns:
number of events

© 2006-2015 EsperTech Inc.
All rights reserved.
Visit us at espertech.com