Oracle® Coherence Java API Reference
v3.5

E14977-01

com.tangosol.util
Interface QueryMap

All Superinterfaces:
java.util.Map
All Known Subinterfaces:
NamedCache
All Known Implementing Classes:
BundlingNamedCache, ContinuousQueryCache, ConverterCollections.ConverterNamedCache, ConverterCollections.ConverterQueryMap, NearCache, ReadonlyNamedCache, VersionedNearCache, WrapperNamedCache

public interface QueryMap
extends java.util.Map

Map with additional query features.

Author:
gg 2002.09.24

Nested Class Summary
static interface QueryMap.Entry
          A QueryMap Entry exposes additional index-related operation that the basic Map Entry does not.
 
Method Summary
 void addIndex(ValueExtractor extractor, boolean fOrdered, java.util.Comparator comparator)
          Add an index to this QueryMap.
 java.util.Set entrySet(Filter filter)
          Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter.
 java.util.Set entrySet(Filter filter, java.util.Comparator comparator)
          Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter.
 java.util.Set keySet(Filter filter)
          Return a set view of the keys contained in this map for entries that satisfy the criteria expressed by the filter.
 void removeIndex(ValueExtractor extractor)
          Remove an index from this QueryMap.
 
Methods inherited from interface java.util.Map
clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
 

Method Detail

keySet

java.util.Set 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: When using the Coherence Enterprise Edition or Grid Edition, the Partitioned Cache implements the QueryMap interface using the Parallel Query feature. When using Coherence Standard Edition, the Parallel Query feature is not available, resulting in lower performance for most queries, and particularly when querying large data sets.

Parameters:
filter - the Filter object representing the criteria that the entries of this map should satisfy
Returns:
a set of keys for entries that satisfy the specified criteria

entrySet

java.util.Set 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 a Map.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: When using the Coherence Enterprise Edition or Grid Edition, the Partitioned Cache implements the QueryMap interface using the Parallel Query feature. When using Coherence Standard Edition, the Parallel Query feature is not available, resulting in lower performance for most queries, and particularly when querying large data sets.

Parameters:
filter - the Filter object representing the criteria that the entries of this map should satisfy
Returns:
a set of entries that satisfy the specified criteria

entrySet

java.util.Set entrySet(Filter filter,
                       java.util.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 a Map.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 (see Comparable).

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: When using the Coherence Enterprise Edition or Grid Edition, the Partitioned Cache implements the QueryMap interface using the Parallel Query feature. When using Coherence Standard Edition, the Parallel Query feature is not available, resulting in lower performance for most queries, and particularly when querying large data sets.

Parameters:
filter - the Filter object representing the criteria that the entries of this map should satisfy
comparator - 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

void addIndex(ValueExtractor extractor,
              boolean fOrdered,
              java.util.Comparator 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 keySet and entrySet methods.

This method is only intended as a hint to the cache implementation, and as such it may be ignored by the cache 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.

Note: Indexes are a feature of Coherence Enterprise Edition and Coherence Grid Edition. This method will have no effect when using Coherence Standard Edition.

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 otherwise
comparator - 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

void removeIndex(ValueExtractor extractor)
Remove an index from this QueryMap.

Parameters:
extractor - the ValueExtractor object that is used to extract an indexable Object from a value stored in the Map.

Oracle® Coherence Java API Reference
v3.5

E14977-01

Copyright © 2000, 2009, Oracle. All rights reserved.