com.espertech.esper.epl.join.exec.composite.CompositeIndexQueryKeyed Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of esper Show documentation
Show all versions of esper Show documentation
Complex event processing and event series analysis component
The newest version!
/*
***************************************************************************************
* Copyright (C) 2006 EsperTech, Inc. All rights reserved. *
* http://www.espertech.com/esper *
* http://www.espertech.com *
* ---------------------------------------------------------------------------------- *
* The software in this package is published under the terms of the GPL license *
* a copy of which has been included with this distribution in the license.txt file. *
***************************************************************************************
*/
package com.espertech.esper.epl.join.exec.composite;
import com.espertech.esper.client.EventBean;
import com.espertech.esper.collection.MultiKeyUntyped;
import com.espertech.esper.epl.expression.core.ExprEvaluator;
import com.espertech.esper.epl.expression.core.ExprEvaluatorContext;
import com.espertech.esper.epl.join.plan.QueryGraphValueEntryHashKeyed;
import com.espertech.esper.event.EventBeanUtility;
import java.util.*;
public class CompositeIndexQueryKeyed implements CompositeIndexQuery {
private final ExprEvaluator[] evaluators;
private final Class[] keyCoercionTypes;
private final int lookupStream;
private final EventBean[] events;
private final boolean isNWOnTrigger;
private CompositeIndexQuery next;
public CompositeIndexQueryKeyed(boolean isNWOnTrigger, int lookupStream, int numStreams, List hashKeys, Class[] keyCoercionTypes) {
this.keyCoercionTypes = keyCoercionTypes;
this.evaluators = new ExprEvaluator[hashKeys.size()];
this.isNWOnTrigger = isNWOnTrigger;
this.lookupStream = lookupStream;
for (int i = 0; i < evaluators.length; i++) {
evaluators[i] = hashKeys.get(i).getKeyExpr().getForge().getExprEvaluator();
}
if (lookupStream != -1) {
events = new EventBean[lookupStream + 1];
} else {
events = new EventBean[numStreams + 1];
}
}
public void setNext(CompositeIndexQuery next) {
this.next = next;
}
public Set get(EventBean theEvent, Map parent, ExprEvaluatorContext context, CompositeIndexQueryResultPostProcessor postProcessor) {
events[lookupStream] = theEvent;
MultiKeyUntyped mk = EventBeanUtility.getMultiKey(events, evaluators, context, keyCoercionTypes);
Map innerIndex = (Map) parent.get(mk);
if (innerIndex == null) {
return null;
}
return next.get(theEvent, innerIndex, context, postProcessor);
}
public Set getCollectKeys(EventBean theEvent, Map parent, ExprEvaluatorContext context, ArrayList