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 TypeMethodDescriptionvoid
addDoubleKey
(double relatedKey, Object o) void
void
clone()
int
getNearest
(double key, double tolerance) retrieves the object with the key nearest to given valuegetNearest
(DoubleKey d, double tolerance) void
setMaxCacheSize
(int maxSize)
-
Constructor Details
-
DefaultCache
public DefaultCache() -
DefaultCache
public DefaultCache(int maxSize)
-
-
Method Details
-
getNearest
Description copied from interface:DoubleKeyCache
retrieves the object with the key nearest to given value- Specified by:
getNearest
in 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:
addDoubleKey
in interfaceDoubleKeyCache
-
addDoubleKey
-
setMaxCacheSize
public void setMaxCacheSize(int maxSize) -
getMaxCacheSize
public int getMaxCacheSize() -
clearCache
public void clearCache()- Specified by:
clearCache
in interfaceDoubleKeyCache
-
clone
- Specified by:
clone
in interfaceDoubleKeyCache
- Overrides:
clone
in classObject
-