private void processStreamEvent(ComplexEventChunk<StreamEvent> streamEventChunk,
                                    WindowState state, long currentTime, StreamEvent streamEvent) {
        state.expiredEventQueue.add(streamEvent);
        StateEvent stateEventCurrent = new StateEvent(3, 0);
        stateEventCurrent.setEvent(0, streamEvent);
        stateEventCurrent.setEvent(1, state.expiredEventQueue.getFirst());
        stateEventCurrent.setEvent(2, streamEvent);
        if (!(Boolean) expressionExecutor.execute(stateEventCurrent)) {
            state.expiredEventQueue.reset();
            while (state.expiredEventQueue.hasNext()) {
                StreamEvent expiredEvent = state.expiredEventQueue.next();
                state.expiredEventQueue.remove();
                streamEventChunk.insertBeforeCurrent(expiredEvent);
                StateEvent stateEvent = new StateEvent(3, 0);
                stateEvent.setEvent(0, expiredEvent);
                StreamEvent firstEvent = state.expiredEventQueue.getFirst();
                if (firstEvent == null) {
                    firstEvent = expiredEvent;
                }
                stateEvent.setEvent(1, firstEvent);
                stateEvent.setEvent(2, streamEvent);
                stateEvent.setType(ComplexEvent.Type.EXPIRED);
                expiredEvent.setTimestamp(currentTime);
                if ((Boolean) expressionExecutor.execute(stateEvent)) {
                    break;
                }


            }
        }
    }
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/ExpressionWindowProcessor.java