Class IndexCursorImpl

    • Method Detail

      • createCursor

        public static IndexCursorImpl createCursor​(TableImpl table,
                                                   IndexImpl index,
                                                   Object[] startRow,
                                                   boolean startInclusive,
                                                   Object[] endRow,
                                                   boolean endInclusive)
                                            throws IOException
        Creates an indexed cursor for the given table, narrowed to the given range.

        Note, index based table traversal may not include all rows, as certain types of indexes do not include all entries (namely, some indexes ignore null entries, see Index.shouldIgnoreNulls()).

        Parameters:
        table - the table over which this cursor will traverse
        index - index for the table which will define traversal order as well as enhance certain lookups
        startRow - the first row of data for the cursor, or null for the first entry
        startInclusive - whether or not startRow is inclusive or exclusive
        endRow - the last row of data for the cursor, or null for the last entry
        endInclusive - whether or not endRow is inclusive or exclusive
        Throws:
        IOException
      • findRowByEntry

        public Row findRowByEntry​(Object... entryValues)
                           throws IOException
        Description copied from interface: IndexCursor
        Finds the first row (as defined by the cursor) where the index entries match the given values. If a match is not found (or an exception is thrown), the cursor is restored to its previous state.
        Specified by:
        findRowByEntry in interface IndexCursor
        Parameters:
        entryValues - the column values for the index's columns.
        Returns:
        the matching row or null if a match could not be found.
        Throws:
        IOException
      • findFirstRowByEntry

        public boolean findFirstRowByEntry​(Object... entryValues)
                                    throws IOException
        Description copied from interface: IndexCursor
        Moves to the first row (as defined by the cursor) where the index entries match the given values. If a match is not found (or an exception is thrown), the cursor is restored to its previous state.

        Warning, this method always starts searching from the beginning of the Table (you cannot use it to find successive matches).

        Specified by:
        findFirstRowByEntry in interface IndexCursor
        Parameters:
        entryValues - the column values for the index's columns.
        Returns:
        true if a valid row was found with the given values, false if no row was found
        Throws:
        IOException
      • findClosestRowByEntry

        public void findClosestRowByEntry​(Object... entryValues)
                                   throws IOException
        Description copied from interface: IndexCursor
        Moves to the first row (as defined by the cursor) where the index entries are >= the given values. If a an exception is thrown, the cursor is restored to its previous state.
        Specified by:
        findClosestRowByEntry in interface IndexCursor
        Parameters:
        entryValues - the column values for the index's columns.
        Throws:
        IOException
      • currentRowMatchesEntry

        public boolean currentRowMatchesEntry​(Object... entryValues)
                                       throws IOException
        Description copied from interface: IndexCursor
        Returns true if the current row matches the given index entries.
        Specified by:
        currentRowMatchesEntry in interface IndexCursor
        Parameters:
        entryValues - the column values for the index's columns.
        Throws:
        IOException
      • newEntryIterable

        public EntryIterableBuilder newEntryIterable​(Object... entryValues)
        Description copied from interface: IndexCursor
        Convenience method for constructing a new EntryIterableBuilder for this cursor. An EntryIterableBuilder provides a variety of options for more flexible iteration based on a specific index entry.
        Specified by:
        newEntryIterable in interface IndexCursor
        Parameters:
        entryValues - the column values for the index's columns.