org.jacorb.notification.util
Class CachingWildcardMap
public class CachingWildcardMap
Add Caching to WildcardMap. If the Keys inside the Map contain the
Wildcard Operator '*' the Operation getWithExpansion is rather expensive.
For each Key that contains a '*' a pattern match must be done. This
Subclass adds simple Caching. When a key is looked up the retrieved
value is stored in an internal cache with fixed size. Subsequent
getWithExpansion Operations query the cache first. As soon as a put
or remove Operation occurs the Cache is invalidated.
Version:
- Alphonse Bendt
Object[] | getWithExpansion(Object key) - Returns the value to which this map maps the specified
key.
|
Object | put(Object key, Object value) - The operation
put associates the specified value
with the specified key in this map.
|
Object | remove(Object key) - remove the specified key from this Map.
|
CachingWildcardMap
public CachingWildcardMap(int cacheSize)
getWithExpansion
public Object[] getWithExpansion(Object key)
Returns the value to which this map maps the specified
key. Additionaly return all Values which keys contain a
Wildcard and match the requested key. Returns null if the map
contains no mapping for this key.
- getWithExpansion in interface WildcardMap
key
- key whose associated value is to be returned
- an Array of all Matching entries or null if no matching
entry could be found.
put
public Object put(Object key,
Object value)
The operation put
associates the specified value
with the specified key in this map. The String representation
of the Key toString()
is
used. If the map previously
contained a mapping for this key, the old value is replaced by
the specified value.
- put in interface WildcardMap
key
- key with which String representation the specified value
is to be associated.value
- value to be associated with the specified key.
- previous value associated with specified key, or null
if there was no mapping for key.
remove
public Object remove(Object key)
remove the specified key from this Map.
- remove in interface WildcardMap