private void processStreamEvent(WindowState state, long currentTime, StreamEvent streamEvent,
                                    StreamEventCloner streamEventCloner,
                                    List<ComplexEventChunk<StreamEvent>> streamEventChunks) {
        StateEvent stateEventCurrent = new StateEvent(3, 0);
        stateEventCurrent.setEvent(0, streamEvent);
        if (state.currentEventQueue.getFirst() != null) {
            stateEventCurrent.setEvent(1, state.currentEventQueue.getFirst());
        } else {
            stateEventCurrent.setEvent(1, streamEvent);
        }
        stateEventCurrent.setEvent(2, streamEvent);
        if (!(Boolean) expressionExecutor.execute(stateEventCurrent)) {
            stateEventCurrent.setType(ComplexEvent.Type.RESET);
            expressionExecutor.execute(stateEventCurrent);
            stateEventCurrent.setType(ComplexEvent.Type.CURRENT);
            expressionExecutor.execute(stateEventCurrent);
            ComplexEventChunk<StreamEvent> outputStreamEventChunk = new ComplexEventChunk<>();
            state.expiredEventQueue.reset();
            if (state.expiredEventQueue.getFirst() != null) {
                while (state.expiredEventQueue.hasNext()) {
                    StreamEvent expiredEvent = state.expiredEventQueue.next();
                    expiredEvent.setTimestamp(currentTime);
                }
                outputStreamEventChunk.add(state.expiredEventQueue.getFirst());
                state.expiredEventQueue.clear();
            }
            if (state.currentEventQueue.getFirst() != null) {
                while (state.currentEventQueue.hasNext()) {
                    StreamEvent currentEvent = state.currentEventQueue.next();
                    currentEvent.setTimestamp(currentTime);
                    StreamEvent expiredEvent = streamEventCloner.copyStreamEvent(currentEvent);
                    expiredEvent.setType(ComplexEvent.Type.EXPIRED);
                    state.expiredEventQueue.add(expiredEvent);
                }
                outputStreamEventChunk.add(state.currentEventQueue.getFirst());
                state.currentEventQueue.clear();
                if (includeTriggeringEventExecutor != null &&
                        (Boolean) includeTriggeringEventExecutor.execute(streamEvent) ||
                        includeTriggeringEvent) {
                    outputStreamEventChunk.add(streamEvent);
                    StreamEvent expiredEvent = streamEventCloner.copyStreamEvent(streamEvent);
                    expiredEvent.setTimestamp(currentTime);
                    expiredEvent.setType(ComplexEvent.Type.EXPIRED);
                    state.expiredEventQueue.add(expiredEvent);
                } else {
                    state.currentEventQueue.add(streamEvent);
                }
            } else {
                StreamEvent expiredEvent = streamEventCloner.copyStreamEvent(streamEvent);
                expiredEvent.setType(ComplexEvent.Type.EXPIRED);
                expiredEvent.setTimestamp(currentTime);
                outputStreamEventChunk.add(expiredEvent);
                streamEvent.setTimestamp(currentTime);
                outputStreamEventChunk.add(streamEvent);
            }
            streamEventChunks.add(outputStreamEventChunk);
        } else {
            state.currentEventQueue.add(streamEvent);
        }
    }
Implementation of {@link WindowProcessor} which represent a Window operating based on a expression.
modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/ExpressionBatchWindowProcessor.java