Interface IndexRangeSeek

All Superinterfaces:
IndexRange

public interface IndexRangeSeek extends IndexRange
A range of discrete integers, where one can always find the succeeding or preceding index.

It can be navigated to find where indexes are with nextIndex(int), previousIndex(int) etc.

Author:
Owen Feehan
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    nextIndex(int index)
    Finds the next index in the range after index.
    int
    previousEqualIndex(int index)
    Finds the previous index in the range before index, or returns index itself if it's a valid index.
    int
    previousIndex(int index)
    Finds the previous index in the range before index.

    Methods inherited from interface org.anchoranalysis.core.index.range.IndexRange

    getMaximumIndex, getMinimumIndex
  • Method Details

    • nextIndex

      int nextIndex(int index)
      Finds the next index in the range after index.
      Parameters:
      index - the base index, for which a next index is to be found.
      Returns:
      the next index after index or -1 if none exists.
    • previousIndex

      int previousIndex(int index)
      Finds the previous index in the range before index.
      Parameters:
      index - the base index, for which a previous index is to be found.
      Returns:
      the previous index before index or -1 if none exists.
    • previousEqualIndex

      int previousEqualIndex(int index)
      Finds the previous index in the range before index, or returns index itself if it's a valid index.
      Parameters:
      index - the base index, for which a previous (or equal) index is to be found.
      Returns:
      {code index} itself it is a valid index, or the previous index before index or -1 if none exists.