use of io.siddhi.core.executor.EventVariableFunctionExecutor in project siddhi by wso2.
the class ExpressionParser method constructEventExpressionExecutor.
private static ExpressionExecutor constructEventExpressionExecutor(Variable variable, int currentState, SiddhiQueryContext siddhiQueryContext, int[] eventPosition, MetaStateEvent metaStateEvent) {
AbstractDefinition definition;
MetaStreamEvent[] metaStreamEvents = metaStateEvent.getMetaStreamEvents();
for (int i = 0, metaStreamEventsLength = metaStreamEvents.length; i < metaStreamEventsLength; i++) {
MetaStreamEvent metaStreamEvent = metaStreamEvents[i];
definition = metaStreamEvent.getLastInputDefinition();
if (metaStreamEvent.getInputReferenceId() == null) {
if (definition.getId().equals(variable.getAttributeName())) {
eventPosition[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX] = i;
FunctionExecutor functionExecutor = new EventVariableFunctionExecutor(eventPosition[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX], eventPosition[SiddhiConstants.STREAM_EVENT_INDEX_IN_CHAIN]);
functionExecutor.initExecutor(new ExpressionExecutor[0], ProcessingMode.BATCH, null, false, siddhiQueryContext);
return functionExecutor;
}
} else {
if (metaStreamEvent.getInputReferenceId().equals(variable.getAttributeName())) {
eventPosition[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX] = i;
if (currentState > -1 && metaStreamEvents[currentState].getInputReferenceId() != null && variable.getStreamIndex() != null && variable.getStreamIndex() <= SiddhiConstants.LAST) {
if (variable.getAttributeName().equals(metaStreamEvents[currentState].getInputReferenceId())) {
eventPosition[SiddhiConstants.STREAM_EVENT_INDEX_IN_CHAIN] = variable.getStreamIndex();
}
}
FunctionExecutor functionExecutor = new EventVariableFunctionExecutor(eventPosition[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX], eventPosition[SiddhiConstants.STREAM_EVENT_INDEX_IN_CHAIN]);
functionExecutor.initExecutor(new ExpressionExecutor[0], ProcessingMode.BATCH, null, false, siddhiQueryContext);
return functionExecutor;
}
}
}
return null;
}
Aggregations