private void processStreamCurrentEvents(StreamEvent streamEvent,
                                            ComplexEventChunk<StreamEvent> outputStreamEventChunk,
                                            long currentTime, WindowState state,
                                            StreamEventCloner streamEventCloner) {
        state.count++;
        if (state.count == length + 1) {
            if (outputExpectsExpiredEvents && 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.resetEvent != null) {
                state.resetEvent.setTimestamp(currentTime);
                outputStreamEventChunk.add(state.resetEvent);
                state.resetEvent = null;
            }
            state.count = 1;
        }
        outputStreamEventChunk.add(streamEvent);
        if (state.expiredEventQueue != null) {
            StreamEvent clonedStreamEvent = streamEventCloner.copyStreamEvent(streamEvent);
            clonedStreamEvent.setType(StreamEvent.Type.EXPIRED);
            state.expiredEventQueue.add(clonedStreamEvent);
        }

    }
Implementation of {@link WindowProcessor} which represent a Batch Window operating based on pre-defined length.
modules/siddhi-core/src/main/java/io/siddhi/core/query/processor/stream/window/LengthBatchWindowProcessor.java