Class ConverterCollections.ConverterQueryMap<FK,TK,FV,TV>
- java.lang.Object
-
- com.tangosol.util.ConverterCollections.ConverterMap<FK,TK,FV,TV>
-
- com.tangosol.util.ConverterCollections.ConverterQueryMap<FK,TK,FV,TV>
-
- All Implemented Interfaces:
QueryMap<TK,TV>
,Serializable
,Map<TK,TV>
- Enclosing class:
- ConverterCollections
public static class ConverterCollections.ConverterQueryMap<FK,TK,FV,TV> extends ConverterCollections.ConverterMap<FK,TK,FV,TV> implements QueryMap<TK,TV>, Serializable
A Converter QueryMap views an underlying QueryMap through a set of key and value Converters.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.tangosol.util.ConverterCollections.ConverterMap
m_convKeyDown, m_convKeyUp, m_convValDown, m_convValUp, m_map, m_set
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T,E>
voidaddIndex(ValueExtractor<? super T,? extends E> extractor, boolean fOrdered, Comparator<? super E> comparator)
Add an index to this QueryMap.Set<Map.Entry<TK,TV>>
entrySet(Filter filter)
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter.Set<Map.Entry<TK,TV>>
entrySet(Filter filter, Comparator comparator)
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter.QueryMap<FK,FV>
getQueryMap()
Return the underlying QueryMap.Set<TK>
keySet(Filter filter)
Return a set view of the keys contained in this map for entries that satisfy the criteria expressed by the filter.<T,E>
voidremoveIndex(ValueExtractor<? super T,? extends E> extractor)
Remove an index from this QueryMap.-
Methods inherited from class com.tangosol.util.ConverterCollections.ConverterMap
clear, containsKey, containsValue, entrySet, equals, get, getConverterKeyDown, getConverterKeyUp, getConverterValueDown, getConverterValueUp, getMap, hashCode, instantiateCollection, instantiateEntrySet, instantiateMap, instantiateSet, isEmpty, keySet, put, putAll, remove, size, subMap, toString, values
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
-
-
-
Constructor Detail
-
ConverterQueryMap
public ConverterQueryMap(QueryMap<FK,FV> map, Converter<FK,TK> convKeyUp, Converter<TK,FK> convKeyDown, Converter<FV,TV> convValUp, Converter<TV,FV> convValDown)
Constructor.- Parameters:
map
- the underlying QueryMapconvKeyUp
- the Converter to view the underlying QueryMap's keys throughconvKeyDown
- the Converter to use to pass keys down to the underlying QueryMapconvValUp
- the Converter to view the underlying QueryMap's values throughconvValDown
- the Converter to use to pass values down to the underlying QueryMap
-
-
Method Detail
-
keySet
public Set<TK> keySet(Filter filter)
Return a set view of the keys contained in this map for entries that satisfy the criteria expressed by the filter.Unlike the
Map.keySet()
method, the set returned by this method may not be backed by the map, so changes to the set may not reflected in the map, and vice-versa.Note: The Partitioned Cache implements the QueryMap interface using the Parallel Query feature.
-
entrySet
public Set<Map.Entry<TK,TV>> entrySet(Filter filter)
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter. Each element in the returned set is aMap.Entry
.Unlike the
Map.entrySet()
method, the set returned by this method may not be backed by the map, so changes to the set may not be reflected in the map, and vice-versa.Note: The Partitioned Cache implements the QueryMap interface using the Parallel Query feature.
-
entrySet
public Set<Map.Entry<TK,TV>> entrySet(Filter filter, Comparator comparator)
Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter. Each element in the returned set is aMap.Entry
. It is further guaranteed that its iterator will traverse the set in such a way that the entry values come up in ascending order, sorted by the specified Comparator or according to the natural ordering (seeComparable
).Unlike the
Map.entrySet()
method, the set returned by this method may not be backed by the map, so changes to the set may not be reflected in the map, and vice-versa.Note: The Partitioned Cache implements the QueryMap interface using the Parallel Query feature.
- Specified by:
entrySet
in interfaceQueryMap<FK,TK>
- Parameters:
filter
- the Filter object representing the criteria that the entries of this map should satisfycomparator
- the Comparator object which imposes an ordering on entries in the resulting set; or null if the entries' values natural ordering should be used- Returns:
- a set of entries that satisfy the specified criteria
- See Also:
ChainedComparator
-
addIndex
public <T,E> void addIndex(ValueExtractor<? super T,? extends E> extractor, boolean fOrdered, Comparator<? super E> comparator)
Add an index to this QueryMap. This allows to correlate values stored in this indexed Map (or attributes of those values) to the corresponding keys in the indexed Map and increase the performance of methods that useFilters
.The ordering maintained by this map (as determined by either the specified Comparator or the natural ordering of the indexed values) must be consistent with equals (see
Comparable
orComparator
for a precise definition of consistent with equals.)This method is only intended as a hint to the map implementation, and as such it may be ignored by the map if indexes are not supported or if the desired index (or a similar index) already exists. It is expected that an application will call this method to suggest an index even if the index may already exist, just so that the application is certain that index has been suggested. For example in a distributed environment, each server will likely suggest the same set of indexes when it starts, and there is no downside to the application blindly requesting those indexes regardless of whether another server has already requested the same indexes.
- Specified by:
addIndex
in interfaceQueryMap<FK,TK>
- Type Parameters:
T
- the type of the value to extract fromE
- the type of value that will be extracted- Parameters:
extractor
- the ValueExtractor object that is used to extract an indexable Object from a value stored in the indexed Map. Must not be null.fOrdered
- true iff the contents of the indexed information should be ordered; false otherwisecomparator
- the Comparator object which imposes an ordering on entries in the indexed map; or null if the entries' values natural ordering should be used- See Also:
ReflectionExtractor
,ChainedComparator
-
removeIndex
public <T,E> void removeIndex(ValueExtractor<? super T,? extends E> extractor)
Remove an index from this QueryMap.- Specified by:
removeIndex
in interfaceQueryMap<FK,TK>
- Type Parameters:
T
- the type of the value to extract fromE
- the type of value that will be extracted- Parameters:
extractor
- the ValueExtractor object that is used to extract an indexable Object from a value stored in the Map.
-
-