Class IndexCursorImpl
- java.lang.Object
-
- com.healthmarketscience.jackcess.impl.CursorImpl
-
- com.healthmarketscience.jackcess.impl.IndexCursorImpl
-
- All Implemented Interfaces:
Cursor,IndexCursor,Iterable<Row>
public class IndexCursorImpl extends CursorImpl implements IndexCursor
Cursor backed by an index with extended traversal options.- Author:
- James Ahlborn
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.healthmarketscience.jackcess.Cursor
Cursor.Id, Cursor.Position, Cursor.Savepoint
-
-
Field Summary
-
Fields inherited from class com.healthmarketscience.jackcess.impl.CursorImpl
MOVE_FORWARD, MOVE_REVERSE
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static IndexCursorImplcreateCursor(TableImpl table, IndexImpl index, Object[] startRow, boolean startInclusive, Object[] endRow, boolean endInclusive)Creates an indexed cursor for the given table, narrowed to the given range.booleancurrentRowMatchesEntry(Object... entryValues)Returnstrueif the current row matches the given index entries.Iterator<Row>entryIterator(EntryIterableBuilder iterBuilder)voidfindClosestRowByEntry(Object... entryValues)Moves to the first row (as defined by the cursor) where the index entries are >= the given values.booleanfindFirstRowByEntry(Object... entryValues)Moves to the first row (as defined by the cursor) where the index entries match the given values.RowfindRowByEntry(Object... entryValues)Finds the first row (as defined by the cursor) where the index entries match the given values.IndexImplgetIndex()EntryIterableBuildernewEntryIterable(Object... entryValues)Convenience method for constructing a new EntryIterableBuilder for this cursor.-
Methods inherited from class com.healthmarketscience.jackcess.impl.CursorImpl
afterLast, beforeFirst, createCursor, currentRowMatches, currentRowMatches, currentRowMatches, deleteCurrentRow, findFirstRow, findFirstRow, findFirstRow, findNextRow, findNextRow, findNextRow, findRow, getColumnMatcher, getCurrentRow, getCurrentRow, getCurrentRowValue, getCurrentRowValue, getErrorHandler, getFormat, getId, getNextRow, getNextRow, getPageChannel, getPreviousRow, getPreviousRow, getRowState, getSavepoint, getTable, isAfterLast, isBeforeFirst, isCurrentRowDeleted, iterator, iterator, moveNextRows, movePreviousRows, moveToNextRow, moveToPreviousRow, newIterable, reset, restoreSavepoint, restoreSavepoint, setColumnMatcher, setCurrentRowValue, setCurrentRowValue, setErrorHandler, toString, updateCurrentRow, updateCurrentRowFromMap
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.healthmarketscience.jackcess.Cursor
afterLast, beforeFirst, currentRowMatches, currentRowMatches, deleteCurrentRow, findFirstRow, findFirstRow, findNextRow, findNextRow, findRow, getColumnMatcher, getCurrentRow, getCurrentRow, getCurrentRowValue, getErrorHandler, getId, getNextRow, getNextRow, getPreviousRow, getPreviousRow, getSavepoint, getTable, isAfterLast, isBeforeFirst, isCurrentRowDeleted, iterator, moveNextRows, movePreviousRows, moveToNextRow, moveToPreviousRow, newIterable, reset, restoreSavepoint, setColumnMatcher, setCurrentRowValue, setErrorHandler, stream, updateCurrentRow, updateCurrentRowFromMap
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
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 traverseindex- index for the table which will define traversal order as well as enhance certain lookupsstartRow- the first row of data for the cursor, ornullfor the first entrystartInclusive- whether or not startRow is inclusive or exclusiveendRow- the last row of data for the cursor, ornullfor the last entryendInclusive- whether or not endRow is inclusive or exclusive- Throws:
IOException
-
getIndex
public IndexImpl getIndex()
- Specified by:
getIndexin interfaceIndexCursor
-
findRowByEntry
public Row findRowByEntry(Object... entryValues) throws IOException
Description copied from interface:IndexCursorFinds 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:
findRowByEntryin interfaceIndexCursor- Parameters:
entryValues- the column values for the index's columns.- Returns:
- the matching row or
nullif a match could not be found. - Throws:
IOException
-
findFirstRowByEntry
public boolean findFirstRowByEntry(Object... entryValues) throws IOException
Description copied from interface:IndexCursorMoves 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:
findFirstRowByEntryin interfaceIndexCursor- Parameters:
entryValues- the column values for the index's columns.- Returns:
trueif a valid row was found with the given values,falseif no row was found- Throws:
IOException
-
findClosestRowByEntry
public void findClosestRowByEntry(Object... entryValues) throws IOException
Description copied from interface:IndexCursorMoves 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:
findClosestRowByEntryin interfaceIndexCursor- Parameters:
entryValues- the column values for the index's columns.- Throws:
IOException
-
currentRowMatchesEntry
public boolean currentRowMatchesEntry(Object... entryValues) throws IOException
Description copied from interface:IndexCursorReturnstrueif the current row matches the given index entries.- Specified by:
currentRowMatchesEntryin interfaceIndexCursor- Parameters:
entryValues- the column values for the index's columns.- Throws:
IOException
-
newEntryIterable
public EntryIterableBuilder newEntryIterable(Object... entryValues)
Description copied from interface:IndexCursorConvenience 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:
newEntryIterablein interfaceIndexCursor- Parameters:
entryValues- the column values for the index's columns.
-
entryIterator
public Iterator<Row> entryIterator(EntryIterableBuilder iterBuilder)
-
-