All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kolibrifx.plovercrest.server.TableReader Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2010-2017, KolibriFX AS. Licensed under the Apache License, version 2.0.
 */

package com.kolibrifx.plovercrest.server;

import com.kolibrifx.plovercrest.server.internal.engine.DeferredReader;

public class TableReader {

    private final DeferredReader iterator;

    TableReader(final DeferredReader deferredReader) {
        this.iterator = deferredReader;
    }

    public  T read(final ReadObserver observer) {
        return iterator.read(observer);
    }

    public long seekTakePrevious(final long desiredTimestamp) {
        return iterator.seekTakePrevious(desiredTimestamp);
    }

    public long seekTakeNext(final long desiredTimestamp) {
        return iterator.seekTakeNext(desiredTimestamp);
    }

    public long getLastTimestamp() {
        return iterator.getLastTimestamp();
    }

    public long getFirstTimestamp() {
        return iterator.getFirstTimestamp();
    }

    public long getLastValidTimestamp() {
        return iterator.getLastValidTimestamp();
    }

    /**
     * Seek to the N-th entry. If the index is beyond the end of the table, the reader will be at
     * the end of the table (beyond the last entry).
     */
    public void seekToEntryIndex(final long entryIndex) {
        iterator.seekToEntryIndex(entryIndex);
    }

    /**
     * Returns the index of the next entry to be read. If the reader is at the end of the table,
     * this is the same as {@link Table#getEntryCount()}.
     */
    public long getEntryIndex() {
        return iterator.getEntryIndex();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy