CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation

com.tangosol.util
Class ConverterCollections.ConverterMap

java.lang.Object
  extended by com.tangosol.util.Base
      extended by com.tangosol.util.ConverterCollections.ConverterMap
All Implemented Interfaces:
QueryMap, Serializable, Map
Direct Known Subclasses:
CacheStoreMap, ConverterCollections.ConverterObservableMap, ConverterCollections.ConverterSortedMap
Enclosing class:
ConverterCollections

public static class ConverterCollections.ConverterMap
extends Base
implements Map, QueryMap, Serializable

A Converter Map views an underlying Map through a set of key and value Converters.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.tangosol.util.QueryMap
QueryMap.Entry
 
Field Summary
protected  Converter m_convKeyDown
          The Converter used to pass keys down to the Map.
protected  Converter m_convKeyUp
          The Converter used to view keys stored in the Map.
protected  Converter m_convValDown
          The Converter used to pass keys down to the Map.
protected  Converter m_convValUp
          The Converter used to view values stored in the Map.
protected  Map m_map
          The underlying Map.
protected  Set m_set
          The Entry Set.
 
Constructor Summary
ConverterCollections.ConverterMap(Map map, Converter convKeyUp, Converter convKeyDown, Converter convValUp, Converter convValDown)
          Constructor.
 
Method Summary
 void addIndex(ValueExtractor extractor, boolean fOrdered, Comparator comparator)
          This method is not implemented.
 void clear()
          Removes all mappings from this map.
 boolean containsKey(Object key)
          Returns true if this map contains a mapping for the specified key.
 boolean containsValue(Object value)
          Returns true if this map maps one or more keys to the specified value.
 Set entrySet()
          Returns a set view of the mappings contained in this map.
 Set entrySet(Filter filter)
          Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter.
 Set entrySet(Filter filter, Comparator comparator)
          Return a set view of the entries contained in this map that satisfy the criteria expressed by the filter.
 Object get(Object key)
          Returns the value to which this map maps the specified key.
protected  Collection instantiateCollection(Collection col, Converter convUp, Converter convDown)
          Create a Converter Collection.
protected  Set instantiateEntrySet(Set set, Converter convKeyUp, Converter convKeyDown, Converter convValUp, Converter convValDown)
          Create a Converter Entry Set.
protected  Map instantiateMap(Map map, Converter convKeyUp, Converter convKeyDown, Converter convValUp, Converter convValDown)
          Create a Converter Map.
protected  Set instantiateSet(Set set, Converter convUp, Converter convDown)
          Create a Converter Set.
 boolean isEmpty()
          Returns true if this map contains no key-value mappings.
 Set keySet()
          Returns a set view of the keys contained in this map.
 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.
 Object put(Object key, Object value)
          Associates the specified value with the specified key in this map.
 void putAll(Map map)
          Copies all of the mappings from the specified map to this map.
 Object remove(Object key)
          Removes the mapping for this key from this map if present.
 void removeIndex(ValueExtractor extractor)
          This method is not implemented.
 int size()
          Returns the number of key-value mappings in this map.
 String toString()
          Return a String description for this Map.
 Collection values()
          Returns a collection view of the values contained in this map.
 

Field Detail

m_map

protected Map m_map
The underlying Map.


m_convKeyUp

protected Converter m_convKeyUp
The Converter used to view keys stored in the Map.


m_convKeyDown

protected Converter m_convKeyDown
The Converter used to pass keys down to the Map.


m_convValUp

protected Converter m_convValUp
The Converter used to view values stored in the Map.


m_convValDown

protected Converter m_convValDown
The Converter used to pass keys down to the Map.


m_set

protected transient Set m_set
The Entry Set.

Constructor Detail

ConverterCollections.ConverterMap

public ConverterCollections.ConverterMap(Map map,
                                         Converter convKeyUp,
                                         Converter convKeyDown,
                                         Converter convValUp,
                                         Converter convValDown)
Constructor.

Parameters:
map - the underlying Map
convKeyUp - the Converter to view the underlying Map's keys through
convKeyDown - the Converter to use to pass keys down to the underlying Map
convValUp - the Converter to view the underlying Map's values through
convValDown - the Converter to use to pass values down to the underlying Map
Method Detail

size

public int size()
Returns the number of key-value mappings in this map.

Specified by:
size in interface Map
Returns:
the number of key-value mappings in this map

isEmpty

public boolean isEmpty()
Returns true if this map contains no key-value mappings.

Specified by:
isEmpty in interface Map
Returns:
true if this map contains no key-value mappings

containsKey

public boolean containsKey(Object key)
Returns true if this map contains a mapping for the specified key.

Specified by:
containsKey in interface Map
Parameters:
key - key whose presence in this map is to be tested
Returns:
true if this map contains a mapping for the specified key

containsValue

public boolean containsValue(Object value)
Returns true if this map maps one or more keys to the specified value.

Specified by:
containsValue in interface Map
Parameters:
value - value whose presence in this map is to be tested
Returns:
true if this map maps one or more keys to the specified value.

get

public Object get(Object key)
Returns the value to which this map maps the specified key. Returns null if the map contains no mapping for this key.

Specified by:
get in interface Map
Parameters:
key - key whose associated value is to be returned
Returns:
the value to which this map maps the specified key, or null if the map contains no mapping for this key.

put

public Object put(Object key,
                  Object value)
Associates the specified value with the specified key in this map.

Specified by:
put in interface Map
Parameters:
key - key with which the specified value is to be associated
value - value to be associated with the specified key
Returns:
previous value associated with specified key, or null if there was no mapping for key
Throws:
ClassCastException - if the class of the specified key or value prevents it from being stored in this map.

remove

public Object remove(Object key)
Removes the mapping for this key from this map if present.

Specified by:
remove in interface Map
Parameters:
key - key whose mapping is to be removed from the map
Returns:
previous value associated with specified key, or null if there was no mapping for key

putAll

public void putAll(Map map)
Copies all of the mappings from the specified map to this map.

Specified by:
putAll in interface Map
Parameters:
map - Mappings to be stored in this map
Throws:
ClassCastException - if the class of a key or value in the specified map prevents it from being stored in this map

clear

public void clear()
Removes all mappings from this map.

Specified by:
clear in interface Map

keySet

public Set keySet()
Returns a set view of the keys contained in this map. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa.

Specified by:
keySet in interface Map
Returns:
a set view of the keys contained in this map

values

public Collection values()
Returns a collection view of the values contained in this map. The collection is backed by the map, so changes to the map are reflected in the collection, and vice-versa.

Specified by:
values in interface Map
Returns:
a collection view of the values contained in this map

entrySet

public Set entrySet()
Returns a set view of the mappings contained in this map. Each element in the returned set is a Map.Entry. The set is backed by the map, so changes to the map are reflected in the set, and vice-versa.

Specified by:
entrySet in interface Map
Returns:
a set view of the mappings contained in this map

keySet

public 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.

Specified by:
keySet in interface QueryMap
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

public 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.

Specified by:
entrySet in interface QueryMap
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

public Set 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 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.

Specified by:
entrySet in interface QueryMap
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

public void addIndex(ValueExtractor extractor,
                     boolean fOrdered,
                     Comparator comparator)
This method is not implemented.

Specified by:
addIndex in interface QueryMap
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

public void removeIndex(ValueExtractor extractor)
This method is not implemented.

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

toString

public String toString()
Return a String description for this Map.

Returns:
a String description of the Map

instantiateCollection

protected Collection instantiateCollection(Collection col,
                                           Converter convUp,
                                           Converter convDown)
Create a Converter Collection.

Parameters:
col - the underlying Collection
convUp - the Converter to view the underlying Collection through
convDown - the Converter to pass items down to the underlying Collection through
Returns:
a Converter Collection

instantiateSet

protected Set instantiateSet(Set set,
                             Converter convUp,
                             Converter convDown)
Create a Converter Set.

Parameters:
set - the underlying Set
convUp - the Converter to view the underlying Set through
convDown - the Converter to pass items down to the underlying Set through
Returns:
a Converter Set

instantiateMap

protected Map instantiateMap(Map map,
                             Converter convKeyUp,
                             Converter convKeyDown,
                             Converter convValUp,
                             Converter convValDown)
Create a Converter Map.

Parameters:
map - the underlying Map
convKeyUp - the Converter to view the underlying Map's keys through
convKeyDown - the Converter to use to pass keys down to the underlying Map
convValUp - the Converter to view the underlying Map's values through
convValDown - the Converter to use to pass values down to the underlying Map
Returns:
a Converter Map

instantiateEntrySet

protected Set instantiateEntrySet(Set set,
                                  Converter convKeyUp,
                                  Converter convKeyDown,
                                  Converter convValUp,
                                  Converter convValDown)
Create a Converter Entry Set.

Parameters:
set - the underlying Map Entry Set
convKeyUp - the Converter to view the underlying Map's Entry Set's keys through
convKeyDown - the Converter to use to pass keys down to the underlying Map's Entry Set
convValUp - the Converter to view the underlying Map's Entry Set's values through
convValDown - the Converter to use to pass values down to the underlying Map's Entry Set
Returns:
a Converter Entry Set

CoherenceTM v3.3
Copyright© 2000-2007 by Oracle Corporation