K
- the entry key typeV
- the entry value typepublic class PagingPredicateImpl<K,V> extends Object implements PagingPredicate<K,V>, IndexAwarePredicate<K,V>, VisitablePredicate, IdentifiedDataSerializable
PagingPredicate
.Constructor and Description |
---|
PagingPredicateImpl()
Used for serialization internally
|
PagingPredicateImpl(Comparator<Map.Entry<K,V>> comparator,
int pageSize)
Construct with a comparator and pageSize
results will not be filtered
results will be ordered via comparator
throws
IllegalArgumentException if pageSize is not greater than 0 |
PagingPredicateImpl(int pageSize)
Construct with a pageSize
results will not be filtered
results will be natural ordered
throws
IllegalArgumentException if pageSize is not greater than 0 |
PagingPredicateImpl(Predicate<K,V> predicate,
Comparator<Map.Entry<K,V>> comparator,
int pageSize)
Construct with an inner predicate, comparator and pageSize
results will be filtered via inner predicate
results will be ordered via comparator
throws
IllegalArgumentException if pageSize is not greater than 0
throws IllegalArgumentException if inner predicate is also a PagingPredicate |
PagingPredicateImpl(Predicate predicate,
int pageSize)
Construct with an inner predicate and pageSize
results will be filtered via inner predicate
results will be natural ordered
throws
IllegalArgumentException if pageSize is not greater than 0
throws IllegalArgumentException if inner predicate is also a PagingPredicate |
Modifier and Type | Method and Description |
---|---|
Predicate |
accept(Visitor visitor,
Indexes indexes)
Accept visitor.
|
boolean |
apply(Map.Entry mapEntry)
Used for delegating filtering to inner predicate.
|
Set<QueryableEntry<K,V>> |
filter(QueryContext queryContext)
Used if inner predicate is instanceof
IndexAwarePredicate for filtering. |
Map.Entry<K,V> |
getAnchor()
Retrieve the anchor object which is the last value object on the previous page.
|
int |
getClassId()
Returns type identifier for this class.
|
Comparator<Map.Entry<K,V>> |
getComparator()
Returns the comparator used by this predicate (if any).
|
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
IterationType |
getIterationType() |
Map.Entry<Integer,Map.Entry> |
getNearestAnchorEntry() |
int |
getPage()
Returns the current page value.
|
int |
getPageSize()
Returns the page size.
|
Predicate<K,V> |
getPredicate() |
boolean |
isIndexed(QueryContext queryContext)
Used if inner predicate is instanceof
IndexAwarePredicate for checking if indexed. |
void |
nextPage()
Sets the page value to next page.
|
void |
previousPage()
Sets the page value to previous page.
|
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
void |
reset()
Resets for reuse.
|
void |
setAnchor(int page,
Map.Entry anchor)
After each query, an anchor entry is set for that page.
|
void |
setIterationType(IterationType iterationType) |
void |
setPage(int page)
Sets the current page value.
|
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public PagingPredicateImpl()
public PagingPredicateImpl(int pageSize)
IllegalArgumentException
if pageSize is not greater than 0pageSize
- page sizepublic PagingPredicateImpl(Predicate predicate, int pageSize)
IllegalArgumentException
if pageSize is not greater than 0
throws IllegalArgumentException
if inner predicate is also a PagingPredicate
predicate
- the inner predicate through which results will be filteredpageSize
- the page sizepublic PagingPredicateImpl(Comparator<Map.Entry<K,V>> comparator, int pageSize)
IllegalArgumentException
if pageSize is not greater than 0comparator
- the comparator through which results will be orderedpageSize
- the page sizepublic PagingPredicateImpl(Predicate<K,V> predicate, Comparator<Map.Entry<K,V>> comparator, int pageSize)
IllegalArgumentException
if pageSize is not greater than 0
throws IllegalArgumentException
if inner predicate is also a PagingPredicate
predicate
- the inner predicate through which results will be filteredcomparator
- the comparator through which results will be orderedpageSize
- the page sizepublic Predicate accept(Visitor visitor, Indexes indexes)
VisitablePredicate
accept
in interface VisitablePredicate
visitor
- visitor to acceptindexes
- indexespublic Set<QueryableEntry<K,V>> filter(QueryContext queryContext)
IndexAwarePredicate
for filtering.filter
in interface IndexAwarePredicate<K,V>
queryContext
- public boolean isIndexed(QueryContext queryContext)
IndexAwarePredicate
for checking if indexed.isIndexed
in interface IndexAwarePredicate<K,V>
queryContext
- public boolean apply(Map.Entry mapEntry)
public void reset()
PagingPredicate
reset
in interface PagingPredicate<K,V>
public void nextPage()
PagingPredicate
nextPage
in interface PagingPredicate<K,V>
public void previousPage()
PagingPredicate
previousPage
in interface PagingPredicate<K,V>
public IterationType getIterationType()
public void setIterationType(IterationType iterationType)
public int getPage()
PagingPredicate
getPage
in interface PagingPredicate<K,V>
public void setPage(int page)
PagingPredicate
setPage
in interface PagingPredicate<K,V>
page
- the current page value.public int getPageSize()
PagingPredicate
getPageSize
in interface PagingPredicate<K,V>
public Comparator<Map.Entry<K,V>> getComparator()
PagingPredicate
getComparator
in interface PagingPredicate<K,V>
null
public Map.Entry<K,V> getAnchor()
PagingPredicate
Note: This method will return `null` on the first page of the query result or if the predicate was not applied for the previous page number.
getAnchor
in interface PagingPredicate<K,V>
public void setAnchor(int page, Map.Entry anchor)
anchor
- the last entry of the querypublic void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getClassId()
IdentifiedDataSerializable
getClassId
in interface IdentifiedDataSerializable
Copyright © 2019 Hazelcast, Inc.. All rights reserved.