com.espertech.esper.epl.enummethod.eval.EnumEvalOrderByAscDescEvents Maven / Gradle / Ivy
package com.espertech.esper.epl.enummethod.eval;
import com.espertech.esper.client.EventBean;
import com.espertech.esper.epl.expression.ExprEvaluator;
import com.espertech.esper.epl.expression.ExprEvaluatorContext;
import java.util.*;
public class EnumEvalOrderByAscDescEvents extends EnumEvalBase implements EnumEval {
private final boolean descending;
public EnumEvalOrderByAscDescEvents(ExprEvaluator innerExpression, int streamCountIncoming, boolean descending) {
super(innerExpression, streamCountIncoming);
this.descending = descending;
}
public Object evaluateEnumMethod(Collection target, boolean isNewData, ExprEvaluatorContext context) {
TreeMap sort = new TreeMap();
boolean hasColl = false;
Collection beans = (Collection) target;
for (EventBean next : beans) {
eventsLambda[streamNumLambda] = next;
Comparable comparable = (Comparable) innerExpression.evaluate(eventsLambda, isNewData, context);
Object entry = sort.get(comparable);
if (entry == null) {
sort.put(comparable, next);
continue;
}
if (entry instanceof Collection) {
((Collection) entry).add(next);
continue;
}
Deque
© 2015 - 2025 Weber Informatics LLC | Privacy Policy