org.jacorb.notification.util
Class CachingWildcardMap

java.lang.Object
  extended byorg.jacorb.notification.util.WildcardMap
      extended byorg.jacorb.notification.util.CachingWildcardMap

public class CachingWildcardMap
extends WildcardMap

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:
$Id: CachingWildcardMap.java,v 1.4 2004/05/06 12:40:00 nicolas Exp $
Author:
Alphonse Bendt

Constructor Summary
CachingWildcardMap(int cacheSize)
           
 
Method Summary
 java.lang.Object[] getWithExpansion(java.lang.Object key)
          Returns the value to which this map maps the specified key.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          The operation put associates the specified value with the specified key in this map.
 java.lang.Object remove(java.lang.Object key)
          remove the specified key from this Map.
 
Methods inherited from class org.jacorb.notification.util.WildcardMap
clear, getNoExpansion, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CachingWildcardMap

public CachingWildcardMap(int cacheSize)
Method Detail

remove

public java.lang.Object remove(java.lang.Object key)
Description copied from class: WildcardMap
remove the specified key from this Map.

Overrides:
remove in class WildcardMap

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
Description copied from class: WildcardMap
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.

Overrides:
put in class WildcardMap
Parameters:
key - key with which String representation 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.

getWithExpansion

public java.lang.Object[] getWithExpansion(java.lang.Object key)
Description copied from class: WildcardMap
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.

Overrides:
getWithExpansion in class WildcardMap
Parameters:
key - key whose associated value is to be returned
Returns:
an Array of all Matching entries or null if no matching entry could be found.