org.opengts.geocoder
Class ReverseGeocodeCache

java.lang.Object
  extended by org.opengts.geocoder.ReverseGeocodeCache

public class ReverseGeocodeCache
extends java.lang.Object


Constructor Summary
ReverseGeocodeCache()
          Constructor
ReverseGeocodeCache(int maxSize, long maxAgeMS)
          Constructor
 
Method Summary
 boolean addReverseGeocode(GeoPoint gp, ReverseGeocode rg)
          Adds the specified ReverseGeocode to the cache for the specified GeoPoint.
 long getMaximumAgeMS()
          Gets the maximum entry age, in milliseconds
 int getMaximumSize()
          Gets the maximum cache size
 ReverseGeocode getReverseGeocode(GeoPoint gp)
          Gets the cached ReverseGeocode for the specified GeoPoint, or null if no ReverseGeocode exists for the specified GeoPoint.
 int getSize()
          Gets the current size of the memory cache
 int getSizeCutbackCount()
           
static void main(java.lang.String[] argv)
          Main testing/debugging entry point
 void setMaximumAgeMS(long maxAgeMS)
          Sets the maximum entry age, in milliseconds
 void setMaximumSize(int maxSize)
          Sets the maximum cache size
 void setTrimOnAdd(boolean trim)
          Sets the trim-on-add attribute
 boolean startAutoTrimThread(long intervalMS)
          Starts the "trim" thread.
 void stopAutoTrimThread()
          Stop the "trim" thread.
protected  void trimCache()
          Trims/removes aged/excessive entries from cache
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReverseGeocodeCache

public ReverseGeocodeCache()
Constructor


ReverseGeocodeCache

public ReverseGeocodeCache(int maxSize,
                           long maxAgeMS)
Constructor

Method Detail

getSize

public int getSize()
Gets the current size of the memory cache


getSizeCutbackCount

public int getSizeCutbackCount()

setMaximumSize

public void setMaximumSize(int maxSize)
Sets the maximum cache size


getMaximumSize

public int getMaximumSize()
Gets the maximum cache size


setMaximumAgeMS

public void setMaximumAgeMS(long maxAgeMS)
Sets the maximum entry age, in milliseconds


getMaximumAgeMS

public long getMaximumAgeMS()
Gets the maximum entry age, in milliseconds


setTrimOnAdd

public void setTrimOnAdd(boolean trim)
Sets the trim-on-add attribute


trimCache

protected void trimCache()
Trims/removes aged/excessive entries from cache


startAutoTrimThread

public boolean startAutoTrimThread(long intervalMS)
Starts the "trim" thread.

Returns:
True if started, or already running.

stopAutoTrimThread

public void stopAutoTrimThread()
Stop the "trim" thread. Once stopped, it cannot be restarted.


getReverseGeocode

public ReverseGeocode getReverseGeocode(GeoPoint gp)
Gets the cached ReverseGeocode for the specified GeoPoint, or null if no ReverseGeocode exists for the specified GeoPoint.


addReverseGeocode

public boolean addReverseGeocode(GeoPoint gp,
                                 ReverseGeocode rg)
Adds the specified ReverseGeocode to the cache for the specified GeoPoint.


main

public static void main(java.lang.String[] argv)
Main testing/debugging entry point