@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) {
            initTimeParameter(attributeExpressionExecutors[0]);
        } else if (attributeExpressionExecutors.length == 2) {
            initTimeParameter(attributeExpressionExecutors[0]);

            if (!(attributeExpressionExecutors[1] instanceof ConstantExpressionExecutor)) {
                throw new SiddhiAppValidationException("TimeBatch window's window.time (2nd) parameter should be " +
                        "constant but found a dynamic attribute " +
                        attributeExpressionExecutors[1].getClass().getCanonicalName());
            }

            // start time
            if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.INT) {
                isStartTimeEnabled = true;
                startTime = Integer.parseInt(String.valueOf(((ConstantExpressionExecutor)
                        attributeExpressionExecutors[1]).getValue()));
            } else if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.LONG) {
                isStartTimeEnabled = true;
                startTime = Long.parseLong(String.valueOf(((ConstantExpressionExecutor)
                        attributeExpressionExecutors[1]).getValue()));
            } else if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.BOOL) {
                isStreamCurrentEvents = Boolean.valueOf(String.valueOf(((ConstantExpressionExecutor)
                        attributeExpressionExecutors[1]).getValue()));
            } else {
                throw new SiddhiAppValidationException("TimeBatch window's 2nd parameter " +
                        "should be 'start.time' which is int or long, or 'stream.current.event' which is bool " +
                        " but found " + attributeExpressionExecutors[1].getReturnType());
            }
        } else if (attributeExpressionExecutors.length == 3) {
            initTimeParameter(attributeExpressionExecutors[0]);

            if (!(attributeExpressionExecutors[1] instanceof ConstantExpressionExecutor)) {
                throw new SiddhiAppValidationException("TimeBatch window's window.time (2nd) parameter 'start.time' " +
                        "should be a constant but found a dynamic attribute " +
                        attributeExpressionExecutors[1].getClass().getCanonicalName());
            }

            // start time
            isStartTimeEnabled = true;
            if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.INT) {
                startTime = Integer.parseInt(String.valueOf(((ConstantExpressionExecutor)
                        attributeExpressionExecutors[1]).getValue()));
            } else if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.LONG) {
                startTime = Long.parseLong(String.valueOf(((ConstantExpressionExecutor)
                        attributeExpressionExecutors[1]).getValue()));
            } else {
                throw new SiddhiAppValidationException("TimeBatch window's 2nd parameter " +
                        "should be 'start.time' which is int or long, " +
                        " but found " + attributeExpressionExecutors[1].getReturnType());
            }

            if (!(attributeExpressionExecutors[2] instanceof ConstantExpressionExecutor)) {
                throw new SiddhiAppValidationException("TimeBatch window's window.time (3rd) parameter " +
                        "'stream.current.event' should be a constant but found a dynamic attribute " +
                        attributeExpressionExecutors[2].getClass().getCanonicalName());
            }

            if (attributeExpressionExecutors[2].getReturnType() == Attribute.Type.BOOL) {
                isStreamCurrentEvents = Boolean.valueOf(String.valueOf(((ConstantExpressionExecutor)
                        attributeExpressionExecutors[2]).getValue()));
            } else {
                throw new SiddhiAppValidationException("TimeBatch window's 3rd parameter " +
                        "should be 'stream.current.event' which is bool " +
                        " but found " + attributeExpressionExecutors[2].getReturnType());
            }
        } else {
            throw new SiddhiAppValidationException("Time window should only have one or two parameters. " +
                    "(<int|long|time> windowTime), but found " +
                    attributeExpressionExecutors.length + " input " +
                    "attributes");
        }
        return () -> new WindowState(streamEventClonerHolder, outputExpectsExpiredEvents, findToBeExecuted);

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