@@ -0,0 +1,3089 @@
+/*%0A * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.%0A *%0A * WSO2 Inc. licenses this file to you under the Apache License,%0A * Version 2.0 (the %22License%22); you may not use this file except%0A * in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *    http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing,%0A * software distributed under the License is distributed on an%0A * %22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A * KIND, either express or implied.  See the License for the%0A * specific language governing permissions and limitations%0A * under the License.%0A */%0Apackage org.wso2.siddhi.core.executor.incremental;%0A%0Aimport org.wso2.siddhi.core.config.SiddhiAppContext;%0Aimport org.wso2.siddhi.core.exception.OperationNotSupportedException;%0Aimport org.wso2.siddhi.core.executor.ExpressionExecutor;%0Aimport org.wso2.siddhi.core.executor.function.FunctionExecutor;%0Aimport org.wso2.siddhi.core.util.config.ConfigReader;%0Aimport org.wso2.siddhi.query.api.definition.Attribute;%0Aimport org.wso2.siddhi.query.api.exception.SiddhiAppValidationException;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0A/**%0A * Execute class for shouldUpdate() function.%0A */%0Apublic class IncrementalShouldUpdateFunctionExecutor extends FunctionExecutor %7B%0A    private long lastTimestamp = 0;%0A%0A    @Override%0A    protected void init(ExpressionExecutor%5B%5D attributeExpressionExecutors, ConfigReader configReader,%0A                        SiddhiAppContext siddhiAppContext) %7B%0A        if (attributeExpressionExecutors.length != 1) %7B%0A            throw new SiddhiAppValidationException(%22shouldUpdate() function has to have exactly 1 parameter, %22 +%0A                    %22currently %22 + attributeExpressionExecutors.length + %22 parameters provided%22);%0A        %7D%0A        if (attributeExpressionExecutors%5B0%5D.getReturnType() != Attribute.Type.LONG) %7B%0A            throw new OperationNotSupportedException(%22Parameter given for shouldUpdate() function has to be of type %22 +%0A                    %22long, but found: %22 + attributeExpressionExecutors%5B0%5D.getReturnType());%0A        %7D%0A    %7D%0A%0A    @Override%0A    protected Object execute(Object%5B%5D data) %7B%0A        //will not occur%0A        return null;%0A    %7D%0A%0A    /**%0A     * return true/false based on timestamp values%0A     *%0A     * @param data of Long type%0A     * @return true/false%0A     */%0A    @Override%0A    protected Object execute(Object data) %7B%0A        long timestamp = (long) data;%0A        if (timestamp %3E= this.lastTimestamp) %7B%0A            this.lastTimestamp = timestamp;%0A            return true;%0A        %7D%0A        return false;%0A    %7D%0A%0A    @Override%0A    public Attribute.Type getReturnType() %7B%0A        return Attribute.Type.BOOL;%0A    %7D%0A%0A    @Override%0A    public Map%3CString, Object%3E currentState() %7B%0A        HashMap%3CString, Object%3E state = new HashMap%3C%3E();%0A        state.put(%22lastTimestamp%22, this.lastTimestamp);%0A        return state;%0A    %7D%0A%0A    @Override%0A    public void restoreState(Map%3CString, Object%3E state) %7B%0A        this.lastTimestamp = ((long) state.get(%22lastTimestamp%22));%0A    %7D%0A%7D%0A

Add IncremtalAggregator:shouldUpdate function executor