DODS 7.2 API

org.enhydra.dods.cache
Class DODSHashMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          extended by org.enhydra.dods.cache.DODSHashMap
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.util.Map, CacheStatistics

public class DODSHashMap
extends java.util.HashMap
implements CacheStatistics

DODSHashMap class implements Hash map (for storing data objects), and provides statistics about the cache (query number, cache hits number, their get/set/increment methods, percents of used cache, cache hits,...).

Version:
1.0 15.09.2003.
Author:
Tanja Jovanovic
See Also:
Serialized Form

Field Summary
protected  int cacheAccessNum
          Total number of times the cache was accessed.
protected  int cacheHitsNum
          Number of queries performed on the cache successfully.
 
Method Summary
 void clearStatistics()
          Clears statistics.
 int getCacheAccessNum()
          Returns total number of times the cache was accessed.
 int getCacheHitsNum()
          Returns number of queries performed on the cache successfully.
 double getCacheHitsPercents()
          Returns how much queries performed on the cache were successful.
 double getUsedPercents()
          Returns how much cache is currently used.
 void incrementCacheAccessNum(int num)
          Increases total number of times the cache was accessed.
 void incrementCacheHitsNum(int num)
          Increases number of queries performed on the cache successfully for one.
 void setCacheAccessNum(int num)
          Sets total number of times the cache was accessed.
 void setCacheHitsNum(int cacheHitsNum)
          Sets number of queries performed on the cache successfully.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Field Detail

cacheAccessNum

protected int cacheAccessNum
Total number of times the cache was accessed.


cacheHitsNum

protected int cacheHitsNum
Number of queries performed on the cache successfully.

Method Detail

getCacheAccessNum

public int getCacheAccessNum()
Returns total number of times the cache was accessed.

Specified by:
getCacheAccessNum in interface CacheStatistics
Returns:
total number of times the cache was accessed.

setCacheAccessNum

public void setCacheAccessNum(int num)
Sets total number of times the cache was accessed.

Specified by:
setCacheAccessNum in interface CacheStatistics
Parameters:
num - Total number of times the cache was accessed.

incrementCacheAccessNum

public void incrementCacheAccessNum(int num)
Increases total number of times the cache was accessed.

Specified by:
incrementCacheAccessNum in interface CacheStatistics

getCacheHitsNum

public int getCacheHitsNum()
Returns number of queries performed on the cache successfully.

Specified by:
getCacheHitsNum in interface CacheStatistics
Returns:
Number of queries performed on the cache successfully.

setCacheHitsNum

public void setCacheHitsNum(int cacheHitsNum)
Sets number of queries performed on the cache successfully.

Specified by:
setCacheHitsNum in interface CacheStatistics
Parameters:
cacheHitsNum - Number of queries performed on the cache successfully.

incrementCacheHitsNum

public void incrementCacheHitsNum(int num)
Increases number of queries performed on the cache successfully for one.

Specified by:
incrementCacheHitsNum in interface CacheStatistics

getUsedPercents

public double getUsedPercents()
Returns how much cache is currently used. This value is given in percents. If cache is unbounded, method returns 100%.

Specified by:
getUsedPercents in interface CacheStatistics
Returns:
Percents - how much cache is currently used.

getCacheHitsPercents

public double getCacheHitsPercents()
Returns how much queries performed on the cache were successful. This value is given in percents.

Specified by:
getCacheHitsPercents in interface CacheStatistics
Returns:
Percents - how much queries performed on the cache were successful.

clearStatistics

public void clearStatistics()
Clears statistics.

Specified by:
clearStatistics in interface CacheStatistics

DODS 7.2 API