Class IndexCache.Index

  • Enclosing class:
    IndexCache

    public static final class IndexCache.Index
    extends Object
    Tracks the individual index parameters and its location within the cache file. Index instances are accessed via IndexCache.getIndex(String). This index is incremented by the method nextIndex(). This index can be reset to its initial value by the method resetIndex().
    • Method Detail

      • name

        public String name()
        Returns the index name.
        Returns:
        the index name.
      • initialIndex

        public long initialIndex()
        Returns the initial cache index.
        Returns:
        initial cache index.
      • increment

        public long increment()
        Returns the increment used to obtain the next cached index.
        Returns:
        index increment.
      • finalIndex

        public long finalIndex()
        Returns the maximum cached index.
        Returns:
        maximum cached index.
      • currentIndex

        public long currentIndex()
        Returns the current cached index.
        Returns:
        current cached index.
      • doesResetUponFinalIndex

        public boolean doesResetUponFinalIndex()
        Returns true if the cache automatically resets to the initial index once the final index is reached.
        Returns:
        true if the cache automatically resets to the initial index.
      • nextIndex

        public long nextIndex()
        Returns the current index value. If the current index value exceeds the final index value and if the "reset upon final index" flag is true, then the initial index value is returned. If the flag is false, an IndexOutOfBoundsException is thrown. Otherwise the current index is incremented prior to returning but this incremented value is not returned.
        Returns:
        the current index value.
        Throws:
        IndexOutOfBoundsException - if the incremented index exceeds the final index value and the index does not reset back to the initial value.
      • currentIndex

        public void currentIndex​(long index)
        Sets the current index to the given value.
        Parameters:
        index - the new current index.
        Throws:
        IllegalArgumentException - if index is not between the index initial and final values.
      • resetIndex

        public long resetIndex()
        Resets the current index to the initial value and returns the new current index.
        Returns:
        the newly reset current index.
      • toString

        public String toString()
        Returns the textual representation of this index.
        Overrides:
        toString in class Object
        Returns:
        the textual representation of this index.