class FilteredResults extends SimpleResults
Results
interface which evaluates
one or more client-side where clause expressions per virtual record, to
create a filtered list of records.Modifier and Type | Field and Description |
---|---|
private java.util.List<RecordBuffer> |
buffers
Record buffer(s) used during filtering
|
private java.util.Collection<java.util.function.Supplier<logical>> |
filters
Client-side where expressions which define the filter
|
private boolean |
idsOnly
Store primary key IDs only or full records in filtered results?
|
private Results |
unfiltered
Results to be filtered
|
Constructor and Description |
---|
FilteredResults(Results unfiltered,
java.util.List<RecordBuffer> buffers,
java.util.Collection<java.util.function.Supplier<logical>> filters,
boolean idsOnly)
Construct an instance of this object from a first-pass result set
provided by query execution.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanup()
Clear the internal list of result rows and invoke the underlying
results object's cleanup method.
|
boolean |
first()
Move cursor to the first results row.
|
boolean |
isLast()
Determine whether the cursor is on the last row in the results set.
|
boolean |
last()
Move cursor to the last results row.
|
boolean |
next()
Move cursor to the next results row.
|
boolean |
scroll(int rows)
Scroll the cursor ahead by the specified number of rows.
|
void |
sessionClosing()
Give the unfiltered results object a chance to respond to the session
closing event.
|
boolean |
setRowNumber(int row)
Set the row number currently under the cursor.
|
deleteRow, get, get, getID, getNumberOfLoadedRows, getRowNumber, getRows, isFirst, previous, reset
private final Results unfiltered
private final java.util.List<RecordBuffer> buffers
private final java.util.Collection<java.util.function.Supplier<logical>> filters
private final boolean idsOnly
FilteredResults(Results unfiltered, java.util.List<RecordBuffer> buffers, java.util.Collection<java.util.function.Supplier<logical>> filters, boolean idsOnly)
unfiltered
- Unfiltered result set generated by the initial query.buffers
- Record buffer(s) used during filtering.filters
- Client-side where expressions which define the filter.idsOnly
- If true
, only primary key IDs are stored in the
filtered results; if false
, full records are
stored.public boolean first()
first
in interface Results
first
in class SimpleResults
true
if there are any results.public boolean last()
last
in interface Results
last
in class SimpleResults
true
if there are any results.public boolean next()
If we have not previously found the next (filtered) record, advance through the unfiltered results until we find a record which matches the filter criteria or until we run out of test records. The underlying, unfiltered results will be left at the matching record or off-end, respectively when this method completes.
Non-matching records are evicted from the persistence session, unless other buffers in the current context are using them.
next
in interface Results
next
in class SimpleResults
true
if there is a result under the cursor
after the move.public boolean isLast()
isLast
in interface Results
isLast
in class SimpleResults
true
if the cursor is on the first row.public boolean setRowNumber(int row)
Scrolling to a previously visited row (in either direction) is an inexpensive operation. Scrolling forward to a new row may be an expensive operation, since it may require the retrieval and testing of many records.
setRowNumber
in interface Results
setRowNumber
in class SimpleResults
row
- Zero-based index of the row to be set as the current row.true
if there is a row at the specified row
number; else false
.public boolean scroll(int rows)
This may put the cursor off the end (either end) of the query's results.
Scrolling to a previously visited row (in either direction) is an inexpensive operation. Scrolling forward to a new row may be an expensive operation, since it may require the retrieval and testing of many records.
scroll
in interface Results
scroll
in class SimpleResults
rows
- Number of rows to jump ahead or back.true
if there is a row at the new location;
else false
.public void sessionClosing()
sessionClosing
in interface Results
sessionClosing
in class SimpleResults
SimpleResults.sessionClosing()
public void cleanup()
cleanup
in interface Results
cleanup
in class SimpleResults