@Override
    protected StateFactory init(ExpressionExecutor[] attributeExpressionExecutors, ConfigReader configReader,
                                StreamEventClonerHolder streamEventClonerHolder, boolean outputExpectsExpiredEvents,
                                boolean findToBeExecuted, SiddhiQueryContext siddhiQueryContext) {
        this.outputExpectsExpiredEvents = outputExpectsExpiredEvents;
        this.siddhiQueryContext = siddhiQueryContext;
        if (attributeExpressionExecutors.length >= 1) {
            if (!(attributeExpressionExecutors[0] instanceof ConstantExpressionExecutor)) {
                throw new SiddhiAppValidationException("TimeBatch window's window.time (1st) parameter " +
                        "'window.length' should be a constant but found a dynamic parameter " +
                        attributeExpressionExecutors[0].getClass().getCanonicalName());
            }
            length = (Integer) (((ConstantExpressionExecutor) attributeExpressionExecutors[0]).getValue());
        }
        if (attributeExpressionExecutors.length == 2) {
            if (!(attributeExpressionExecutors[1] instanceof ConstantExpressionExecutor)) {
                throw new SiddhiAppValidationException("TimeBatch window's window.time (2nd) parameter " +
                        "'stream.current.event' should be a constant but found a dynamic parameter " +
                        attributeExpressionExecutors[1].getClass().getCanonicalName());
            }
            isStreamCurrentEvents = (Boolean) (((ConstantExpressionExecutor)
                    attributeExpressionExecutors[1]).getValue());
        }
        if (attributeExpressionExecutors.length > 2) {
            throw new SiddhiAppValidationException("LengthBatch window should have one parameter (<int> " +
                    "window.length) or two parameters (<int> window.length, <bool> stream.current.event), " +
                    "but found " + attributeExpressionExecutors.length + " input parameters.");
        }
        return () -> new WindowState(streamEventClonerHolder, isStreamCurrentEvents,
                outputExpectsExpiredEvents, findToBeExecuted);
    }
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