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 PagingPredicatepredicate - 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 PagingPredicatepredicate - 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)
VisitablePredicateaccept in interface VisitablePredicatevisitor - 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()
PagingPredicatereset in interface PagingPredicate<K,V>public void nextPage()
PagingPredicatenextPage in interface PagingPredicate<K,V>public void previousPage()
PagingPredicatepreviousPage in interface PagingPredicate<K,V>public IterationType getIterationType()
public void setIterationType(IterationType iterationType)
public int getPage()
PagingPredicategetPage in interface PagingPredicate<K,V>public void setPage(int page)
PagingPredicatesetPage in interface PagingPredicate<K,V>page - the current page value.public int getPageSize()
PagingPredicategetPageSize in interface PagingPredicate<K,V>public Comparator<Map.Entry<K,V>> getComparator()
PagingPredicategetComparator in interface PagingPredicate<K,V>nullpublic Map.Entry<K,V> getAnchor()
PagingPredicateNote: 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
DataSerializablewriteData in interface DataSerializableout - 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
DataSerializablereadData in interface DataSerializablein - inputIOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
input stream has been closed.public int getFactoryId()
IdentifiedDataSerializablegetFactoryId in interface IdentifiedDataSerializablepublic int getClassId()
IdentifiedDataSerializablegetClassId in interface IdentifiedDataSerializableCopyright © 2019 Hazelcast, Inc.. All rights reserved.