Package pal.util

Class DefaultCache

java.lang.Object
pal.util.DefaultCache
All Implemented Interfaces:
DoubleKeyCache

public class DefaultCache extends 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 Details

    • DefaultCache

      public DefaultCache()
    • DefaultCache

      public DefaultCache(int maxSize)
  • Method Details

    • getNearest

      public Object getNearest(double key, double tolerance)
      Description copied from interface: DoubleKeyCache
      retrieves the object with the key nearest to given value
      Specified by:
      getNearest in interface DoubleKeyCache
    • 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, Object o)
      Specified by:
      addDoubleKey in interface DoubleKeyCache
    • addDoubleKey

      public void addDoubleKey(DoubleKey d)
    • setMaxCacheSize

      public void setMaxCacheSize(int maxSize)
    • getMaxCacheSize

      public int getMaxCacheSize()
    • clearCache

      public void clearCache()
      Specified by:
      clearCache in interface DoubleKeyCache
    • clone

      public Object clone()
      Specified by:
      clone in interface DoubleKeyCache
      Overrides:
      clone in class Object