Package pal.util
Class DefaultCache
java.lang.Object
pal.util.DefaultCache
- All Implemented Interfaces:
DoubleKeyCache
- Version:
- $Id: DefaultCache.java,v 1.3 2001/10/10 04:02:45 matt Exp $ This class is not threadsafe!
- Author:
- Alexei Drummond
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddDoubleKey(double relatedKey, Object o) voidvoidclone()intgetNearest(double key, double tolerance) retrieves the object with the key nearest to given valuegetNearest(DoubleKey d, double tolerance) voidsetMaxCacheSize(int maxSize)
-
Constructor Details
-
DefaultCache
public DefaultCache() -
DefaultCache
public DefaultCache(int maxSize)
-
-
Method Details
-
getNearest
Description copied from interface:DoubleKeyCacheretrieves the object with the key nearest to given value- Specified by:
getNearestin interfaceDoubleKeyCache
-
getNearest
- Returns:
- the object with the key nearest to given value. if no objects within the given tolerance exist then null is returned.
-
addDoubleKey
- Specified by:
addDoubleKeyin interfaceDoubleKeyCache
-
addDoubleKey
-
setMaxCacheSize
public void setMaxCacheSize(int maxSize) -
getMaxCacheSize
public int getMaxCacheSize() -
clearCache
public void clearCache()- Specified by:
clearCachein interfaceDoubleKeyCache
-
clone
- Specified by:
clonein interfaceDoubleKeyCache- Overrides:
clonein classObject
-