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

java.lang.Object
  extended by com.espertech.esper.epl.agg.access.AggregationStateSortedImpl
All Implemented Interfaces:
AggregationState, AggregationStateSorted, AggregationStateWithSize
Direct Known Subclasses:
AggregationStateSortedJoin

public class AggregationStateSortedImpl
extends java.lang.Object
implements AggregationStateWithSize, AggregationStateSorted

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


Field Summary
protected  int size
           
protected  java.util.TreeMap<java.lang.Object,java.lang.Object> sorted
           
protected  AggregationStateSortedSpec spec
           
 
Constructor Summary
AggregationStateSortedImpl(AggregationStateSortedSpec spec)
          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.
protected  boolean dereferenceEvent(EventBean theEvent)
           
protected static java.lang.Object getComparable(ExprEvaluator[] criteria, EventBean[] eventsPerStream, boolean istream, ExprEvaluatorContext exprEvaluatorContext)
           
 EventBean getFirstValue()
          Returns the first (oldest) value entered.
 EventBean getLastValue()
          Returns the newest (last) value entered.
 java.util.Iterator<EventBean> getReverseIterator()
           
 java.util.Iterator<EventBean> iterator()
          Returns all events for the group.
protected  boolean referenceEvent(EventBean theEvent)
           
 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

spec

protected final AggregationStateSortedSpec spec

sorted

protected final java.util.TreeMap<java.lang.Object,java.lang.Object> sorted

size

protected int size
Constructor Detail

AggregationStateSortedImpl

public AggregationStateSortedImpl(AggregationStateSortedSpec spec)
Ctor.

Parameters:
spec - aggregation spec
Method Detail

clear

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

Specified by:
clear in interface AggregationState

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

referenceEvent

protected boolean referenceEvent(EventBean theEvent)

dereferenceEvent

protected boolean dereferenceEvent(EventBean theEvent)

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

getFirstValue

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

Specified by:
getFirstValue in interface AggregationStateSorted
Returns:
first value

getLastValue

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

Specified by:
getLastValue in interface AggregationStateSorted
Returns:
last value

iterator

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

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

getReverseIterator

public java.util.Iterator<EventBean> getReverseIterator()
Specified by:
getReverseIterator in interface AggregationStateSorted

collectionReadOnly

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

Specified by:
collectionReadOnly in interface AggregationStateSorted
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 AggregationStateSorted
Specified by:
size in interface AggregationStateWithSize
Returns:
number of events

getComparable

protected static java.lang.Object getComparable(ExprEvaluator[] criteria,
                                                EventBean[] eventsPerStream,
                                                boolean istream,
                                                ExprEvaluatorContext exprEvaluatorContext)

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