component/src/main/java/org/wso2/extension/siddhi/execution/extrema/MaxByMinByTimeBatchWindowProcessor.java
@Override
    protected StateFactory<ExtensionState> init(ExpressionExecutor[] attributeExpressionExecutors,
                                                ConfigReader configReader,
                                                StreamEventClonerHolder streamEventClonerHolder,
                                                boolean outputExpectsExpiredEvents,
                                                boolean findToBeExecuted, SiddhiQueryContext siddhiQueryContext) {
        this.siddhiQueryContext = siddhiQueryContext;
        this.outputExpectsExpiredEvents = outputExpectsExpiredEvents;
        if (attributeExpressionExecutors.length == 2) {
            Attribute.Type attributeType = attributeExpressionExecutors[0].getReturnType();
            sortByAttribute = attributeExpressionExecutors[0];
            if (!((attributeType == Attribute.Type.DOUBLE) || (attributeType == Attribute.Type.INT) || (attributeType
                    == Attribute.Type.FLOAT) || (attributeType == Attribute.Type.LONG) || (attributeType
                    == Attribute.Type.STRING))) {
                throw new SiddhiAppValidationException(
                        "Invalid parameter type found for the first argument of " + windowType + " " + "required "
                                + Attribute.Type.INT + " or " + Attribute.Type.LONG + " or " + Attribute.Type.FLOAT
                                + " or " + Attribute.Type.DOUBLE + " or " + Attribute.Type.STRING + ", but found "
                                + attributeType.toString());
            }
            if (attributeExpressionExecutors[1] instanceof ConstantExpressionExecutor) {
                if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.INT) {
                    timeInMilliSeconds = (Integer) ((ConstantExpressionExecutor) attributeExpressionExecutors[1])
                            .getValue();

                } else if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.LONG) {
                    timeInMilliSeconds = (Long) ((ConstantExpressionExecutor) attributeExpressionExecutors[1])
                            .getValue();
                } else {
                    throw new SiddhiAppValidationException(
                            "Time Batch window's parameter attribute should be either int or long, but found "
                                    + attributeExpressionExecutors[1].getReturnType());
                }
            } else {
                throw new SiddhiAppValidationException(
                        "Time Batch window should have constant parameter attribute but found a dynamic attribute "
                                + attributeExpressionExecutors[1].getClass().getCanonicalName());
            }
        } else if (attributeExpressionExecutors.length == 3) {
            Attribute.Type attributeType = attributeExpressionExecutors[0].getReturnType();
            sortByAttribute = attributeExpressionExecutors[0];
            if (!((attributeType == Attribute.Type.DOUBLE) || (attributeType == Attribute.Type.INT) || (attributeType
                    == Attribute.Type.FLOAT) || (attributeType == Attribute.Type.LONG) || (attributeType
                    == Attribute.Type.STRING))) {
                throw new SiddhiAppValidationException(
                        "Invalid parameter type found for the first argument of " + windowType + " required "
                                + Attribute.Type.INT + " or " + Attribute.Type.LONG + " or " + Attribute.Type.FLOAT
                                + " or " + Attribute.Type.DOUBLE + " or " + Attribute.Type.STRING + ", but found "
                                + attributeType.toString());
            }
            if (attributeExpressionExecutors[1] instanceof ConstantExpressionExecutor) {
                if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.INT) {
                    timeInMilliSeconds = (Integer) ((ConstantExpressionExecutor) attributeExpressionExecutors[1])
                            .getValue();

                } else if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.LONG) {
                    timeInMilliSeconds = (Long) ((ConstantExpressionExecutor) attributeExpressionExecutors[1])
                            .getValue();
                } else {
                    throw new SiddhiAppValidationException(
                            "Time window's parameter attribute should be either int or long, but found "
                                    + attributeExpressionExecutors[1].getReturnType());
                }
            } else {
                throw new SiddhiAppValidationException(
                        "Time window should have constant parameter attribute but found a dynamic attribute "
                                + attributeExpressionExecutors[1].getClass().getCanonicalName());
            }
            // start time
            isStartTimeEnabled = true;
            if (attributeExpressionExecutors[2].getReturnType() == Attribute.Type.INT) {
                startTime = Integer.parseInt(
                        String.valueOf(((ConstantExpressionExecutor) attributeExpressionExecutors[2]).getValue()));
            } else {
                startTime = Long.parseLong(
                        String.valueOf(((ConstantExpressionExecutor) attributeExpressionExecutors[2]).getValue()));
            }
        } else {
            throw new SiddhiAppValidationException(
                    windowType + " should only have two or three parameters. but found "
                            + attributeExpressionExecutors.length + " input attributes");
        }
        return ExtensionState::new;
    }
/**
     * The init method of the WindowProcessor, this method will be called before other methods
     *
     * @param attributeExpressionExecutors the executors of each function parameters
     * @param siddhiQueryContext             the context of the siddhi query
     */
The init method of the WindowProcessor, this method will be called before other methods
@param attributeExpressionExecutors the executors of each function parameters
@param siddhiQueryContext             the context of the siddhi query
The init method of the WindowProcessor this method will be called before other methods @param attributeExpressionExecutors the executors of each function parameters @param siddhiQueryContext the context of the siddhi query
@Override
    protected StateFactory<ExtensionState> init(ExpressionExecutor[] attributeExpressionExecutors,
                                                ConfigReader configReader,
                                                StreamEventClonerHolder streamEventClonerHolder,
                                                boolean outputExpectsExpiredEvents,
                                                boolean findToBeExecuted, SiddhiQueryContext siddhiQueryContext) {
        this.siddhiQueryContext = siddhiQueryContext;
        this.outputExpectsExpiredEvents = outputExpectsExpiredEvents;
        if (attributeExpressionExecutors.length == 2) {
            Attribute.Type attributeType = attributeExpressionExecutors[0].getReturnType();
            sortByAttribute = attributeExpressionExecutors[0];
            if (!((attributeType == Attribute.Type.DOUBLE) || (attributeType == Attribute.Type.INT) || (attributeType
                    == Attribute.Type.FLOAT) || (attributeType == Attribute.Type.LONG) || (attributeType
                    == Attribute.Type.STRING))) {
                throw new SiddhiAppValidationException(
                        "Invalid parameter type found for the first argument of " + windowType + " " + "required "
                                + Attribute.Type.INT + " or " + Attribute.Type.LONG + " or " + Attribute.Type.FLOAT
                                + " or " + Attribute.Type.DOUBLE + " or " + Attribute.Type.STRING + ", but found "
                                + attributeType.toString());
            }
            if (attributeExpressionExecutors[1] instanceof ConstantExpressionExecutor) {
                if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.INT) {
                    timeInMilliSeconds = (Integer) ((ConstantExpressionExecutor) attributeExpressionExecutors[1])
                            .getValue();
                } else if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.LONG) {
                    timeInMilliSeconds = (Long) ((ConstantExpressionExecutor) attributeExpressionExecutors[1])
                            .getValue();
                } else {
                    throw new SiddhiAppValidationException(
                            "Time Batch window's parameter attribute should be either int or long, but found "
                                    + attributeExpressionExecutors[1].getReturnType());
                }
            } else {
                throw new SiddhiAppValidationException(
                        "Time Batch window should have constant parameter attribute but found a dynamic attribute "
                                + attributeExpressionExecutors[1].getClass().getCanonicalName());
            }
        } else if (attributeExpressionExecutors.length == 3) {
            Attribute.Type attributeType = attributeExpressionExecutors[0].getReturnType();
            sortByAttribute = attributeExpressionExecutors[0];
            if (!((attributeType == Attribute.Type.DOUBLE) || (attributeType == Attribute.Type.INT) || (attributeType
                    == Attribute.Type.FLOAT) || (attributeType == Attribute.Type.LONG) || (attributeType
                    == Attribute.Type.STRING))) {
                throw new SiddhiAppValidationException(
                        "Invalid parameter type found for the first argument of " + windowType + " required "
                                + Attribute.Type.INT + " or " + Attribute.Type.LONG + " or " + Attribute.Type.FLOAT
                                + " or " + Attribute.Type.DOUBLE + " or " + Attribute.Type.STRING + ", but found "
                                + attributeType.toString());
            }
            if (attributeExpressionExecutors[1] instanceof ConstantExpressionExecutor) {
                if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.INT) {
                    timeInMilliSeconds = (Integer) ((ConstantExpressionExecutor) attributeExpressionExecutors[1])
                            .getValue();
                } else if (attributeExpressionExecutors[1].getReturnType() == Attribute.Type.LONG) {
                    timeInMilliSeconds = (Long) ((ConstantExpressionExecutor) attributeExpressionExecutors[1])
                            .getValue();
                } else {
                    throw new SiddhiAppValidationException(
                            "Time window's parameter attribute should be either int or long, but found "
                                    + attributeExpressionExecutors[1].getReturnType());
                }
            } else {
                throw new SiddhiAppValidationException(
                        "Time window should have constant parameter attribute but found a dynamic attribute "
                                + attributeExpressionExecutors[1].getClass().getCanonicalName());
            }
            isStartTimeEnabled = true;
            if (attributeExpressionExecutors[2].getReturnType() == Attribute.Type.INT) {
                startTime = Integer.parseInt(
                        String.valueOf(((ConstantExpressionExecutor) attributeExpressionExecutors[2]).getValue()));
            } else {
                startTime = Long.parseLong(
                        String.valueOf(((ConstantExpressionExecutor) attributeExpressionExecutors[2]).getValue()));
            }
        } else {
            throw new SiddhiAppValidationException(
                    windowType + " should only have two or three parameters. but found "
                            + attributeExpressionExecutors.length + " input attributes");
        }
        return ExtensionState::new;
    }
@ Override protected StateFactory < ExtensionState > init ( ExpressionExecutor [ ] attributeExpressionExecutors , ConfigReader configReader , StreamEventClonerHolder streamEventClonerHolder , boolean outputExpectsExpiredEvents , boolean findToBeExecuted , SiddhiQueryContext siddhiQueryContext ) { this . siddhiQueryContext = siddhiQueryContext ; this . outputExpectsExpiredEvents = outputExpectsExpiredEvents ; if ( attributeExpressionExecutors . length == 2 ) { Attribute . Type attributeType = attributeExpressionExecutors [ 0 ] . getReturnType ( ) ; sortByAttribute = attributeExpressionExecutors [ 0 ] ; if ( ! ( ( attributeType == Attribute . Type . DOUBLE ) || ( attributeType == Attribute . Type . INT ) || ( attributeType == Attribute . Type . FLOAT ) || ( attributeType == Attribute . Type . LONG ) || ( attributeType == Attribute . Type . STRING ) ) ) { throw new SiddhiAppValidationException ( "Invalid parameter type found for the first argument of " + windowType + " " + "required " + Attribute . Type . INT + " or " + Attribute . Type . LONG + " or " + Attribute . Type . FLOAT + " or " + Attribute . Type . DOUBLE + " or " + Attribute . Type . STRING + ", but found " + attributeType . toString ( ) ) ; } if ( attributeExpressionExecutors [ 1 ] instanceof ConstantExpressionExecutor ) { if ( attributeExpressionExecutors [ 1 ] . getReturnType ( ) == Attribute . Type . INT ) { timeInMilliSeconds = ( Integer ) ( ( ConstantExpressionExecutor ) attributeExpressionExecutors [ 1 ] ) . getValue ( ) ; } else if ( attributeExpressionExecutors [ 1 ] . getReturnType ( ) == Attribute . Type . LONG ) { timeInMilliSeconds = ( Long ) ( ( ConstantExpressionExecutor ) attributeExpressionExecutors [ 1 ] ) . getValue ( ) ; } else { throw new SiddhiAppValidationException ( "Time Batch window's parameter attribute should be either int or long, but found " + attributeExpressionExecutors [ 1 ] . getReturnType ( ) ) ; } } else { throw new SiddhiAppValidationException ( "Time Batch window should have constant parameter attribute but found a dynamic attribute " + attributeExpressionExecutors [ 1 ] . getClass ( ) . getCanonicalName ( ) ) ; } } else if ( attributeExpressionExecutors . length == 3 ) { Attribute . Type attributeType = attributeExpressionExecutors [ 0 ] . getReturnType ( ) ; sortByAttribute = attributeExpressionExecutors [ 0 ] ; if ( ! ( ( attributeType == Attribute . Type . DOUBLE ) || ( attributeType == Attribute . Type . INT ) || ( attributeType == Attribute . Type . FLOAT ) || ( attributeType == Attribute . Type . LONG ) || ( attributeType == Attribute . Type . STRING ) ) ) { throw new SiddhiAppValidationException ( "Invalid parameter type found for the first argument of " + windowType + " required " + Attribute . Type . INT + " or " + Attribute . Type . LONG + " or " + Attribute . Type . FLOAT + " or " + Attribute . Type . DOUBLE + " or " + Attribute . Type . STRING + ", but found " + attributeType . toString ( ) ) ; } if ( attributeExpressionExecutors [ 1 ] instanceof ConstantExpressionExecutor ) { if ( attributeExpressionExecutors [ 1 ] . getReturnType ( ) == Attribute . Type . INT ) { timeInMilliSeconds = ( Integer ) ( ( ConstantExpressionExecutor ) attributeExpressionExecutors [ 1 ] ) . getValue ( ) ; } else if ( attributeExpressionExecutors [ 1 ] . getReturnType ( ) == Attribute . Type . LONG ) { timeInMilliSeconds = ( Long ) ( ( ConstantExpressionExecutor ) attributeExpressionExecutors [ 1 ] ) . getValue ( ) ; } else { throw new SiddhiAppValidationException ( "Time window's parameter attribute should be either int or long, but found " + attributeExpressionExecutors [ 1 ] . getReturnType ( ) ) ; } } else { throw new SiddhiAppValidationException ( "Time window should have constant parameter attribute but found a dynamic attribute " + attributeExpressionExecutors [ 1 ] . getClass ( ) . getCanonicalName ( ) ) ; } isStartTimeEnabled = true ; if ( attributeExpressionExecutors [ 2 ] . getReturnType ( ) == Attribute . Type . INT ) { startTime = Integer . parseInt ( String . valueOf ( ( ( ConstantExpressionExecutor ) attributeExpressionExecutors [ 2 ] ) . getValue ( ) ) ) ; } else { startTime = Long . parseLong ( String . valueOf ( ( ( ConstantExpressionExecutor ) attributeExpressionExecutors [ 2 ] ) . getValue ( ) ) ) ; } } else { throw new SiddhiAppValidationException ( windowType + " should only have two or three parameters. but found " + attributeExpressionExecutors . length + " input attributes" ) ; } return ExtensionState :: new ; }
The init method of the WindowProcessor, this method will be called before other methods
 @param attributeExpressionExecutors the executors of each function parameters
 @param siddhiQueryContext             the context of the siddhi query
The init method of the WindowProcessor this method will be called before other methods @param attributeExpressionExecutors the executors of each function parameters @param siddhiQueryContext the context of the siddhi query
// start time