private void offsetEventChunk(ComplexEventChunk complexEventChunk) {
        complexEventChunk.reset();
        int offsetCount = 0;
        while (complexEventChunk.hasNext()) {
            ComplexEvent event = complexEventChunk.next();
            if (event.getType() == StreamEvent.Type.CURRENT || event.getType() == StreamEvent.Type.EXPIRED) {
                if (offset > offsetCount) {
                    if ((event.getType() == StreamEvent.Type.CURRENT && currentOn) ||
                            (event.getType() == StreamEvent.Type.EXPIRED && expiredOn)) {
                        offsetCount++;
                    }
                    complexEventChunk.remove();
                } else {
                    break;
                }
            }
        }
    }
Processor implementation representing selector portion of the Siddhi query.
modules/siddhi-core/src/main/java/io/siddhi/core/query/selector/QuerySelector.java