public void restore(SnapshotStateList snapshotStatelist) {
        TreeMap<Long, Snapshot> revisions = snapshotStatelist.getSnapshotStates();
        Iterator<Map.Entry<Long, Snapshot>> itr = revisions.entrySet().iterator();
        this.isOperationLogEnabled = false;
        while (itr.hasNext()) {
            Map.Entry<Long, Snapshot> snapshotEntry = itr.next();
            if (!snapshotEntry.getValue().isIncrementalSnapshot()) {
                this.clear();
                this.add((StreamEvent) snapshotEntry.getValue().getState());
                forceFullSnapshot = false;
            } else {
                ArrayList<Operation> operations = (ArrayList<Operation>) snapshotEntry.getValue().getState();
                for (Operation op : operations) {
                    switch (op.operation) {
                        case ADD:
                            add((StreamEvent) op.parameters);
                            break;
                        case REMOVE:
                            poll();
                            break;
                        case CLEAR:
                            clear();
                            break;
                        case OVERWRITE:
                            int overwriteIndex = (int) ((Object[]) op.parameters)[0];
                            StreamEvent streamEvent = (StreamEvent) ((Object[]) op.parameters)[1];
                            while (hasNext()) {
                                next();
                                if (overwriteIndex == eventIndex) {
                                    overwrite(streamEvent);
                                    break;
                                }
                            }
                            break;
                        case DELETE_BY_OPERATOR:
                            break;
                        case DELETE_BY_INDEX:
                            int deleteIndex = (int) op.parameters;
                            while (hasNext()) {
                                next();
                                if (deleteIndex == eventIndex) {
                                    remove();
                                    break;
                                }
                            }
                            break;
                        default:
                            continue;
                    }
                }
            }
        }
        this.isOperationLogEnabled = true;
    }
Returns the next element in the iteration.

@return the next element in the iteration.
@throws NoSuchElementException iteration has no more elements.
modules/siddhi-core/src/main/java/io/siddhi/core/event/stream/holder/SnapshotableStreamEventQueue.java