protected boolean isExpired(StateEvent pendingStateEvent, long currentTimestamp) {
        if (withinTime != SiddhiConstants.UNKNOWN_STATE) {
            for (int startStateId : startStateIds) {
                StreamEvent streamEvent = pendingStateEvent.getStreamEvent(startStateId);
                if (streamEvent != null && Math.abs(pendingStateEvent.getStreamEvent(startStateId).getTimestamp()
                        - currentTimestamp) > withinTime) {
                    return true;
                }
            }
        }
        return false;
    }
Process the handed StreamEvent

@param complexEventChunk event chunk to be processed
modules/siddhi-core/src/main/java/io/siddhi/core/query/input/stream/state/StreamPreStateProcessor.java