Package pal.util
Class DefaultCache
- java.lang.Object
-
- pal.util.DefaultCache
-
- All Implemented Interfaces:
DoubleKeyCache
public class DefaultCache extends java.lang.Object implements 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 Constructor Description DefaultCache()DefaultCache(int maxSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDoubleKey(double relatedKey, java.lang.Object o)voidaddDoubleKey(DoubleKey d)voidclearCache()java.lang.Objectclone()intgetMaxCacheSize()java.lang.ObjectgetNearest(double key, double tolerance)retrieves the object with the key nearest to given valueDoubleKeygetNearest(DoubleKey d, double tolerance)voidsetMaxCacheSize(int maxSize)
-
-
-
Method Detail
-
getNearest
public java.lang.Object getNearest(double key, double tolerance)Description copied from interface:DoubleKeyCacheretrieves the object with the key nearest to given value- Specified by:
getNearestin interfaceDoubleKeyCache
-
getNearest
public DoubleKey getNearest(DoubleKey d, double tolerance)
- Returns:
- the object with the key nearest to given value. if no objects within the given tolerance exist then null is returned.
-
addDoubleKey
public void addDoubleKey(double relatedKey, java.lang.Object o)- Specified by:
addDoubleKeyin interfaceDoubleKeyCache
-
addDoubleKey
public void addDoubleKey(DoubleKey d)
-
setMaxCacheSize
public void setMaxCacheSize(int maxSize)
-
getMaxCacheSize
public int getMaxCacheSize()
-
clearCache
public void clearCache()
- Specified by:
clearCachein interfaceDoubleKeyCache
-
clone
public java.lang.Object clone()
- Specified by:
clonein interfaceDoubleKeyCache- Overrides:
clonein classjava.lang.Object
-
-