edu.ucsb.nceas.morpho.util
Class ObjectCache

java.lang.Object
  extended byedu.ucsb.nceas.morpho.util.ObjectCache

public class ObjectCache
extends java.lang.Object

Object cache is a caching utility which stores objects as SortReference objects. Thus, garbage collection can clean up out-of-date objects, while objects can still be referenced until removed from memory


Constructor Summary
ObjectCache()
          constructor
 
Method Summary
protected  void addNewObjectToCache(java.lang.String docid)
          create a new object and add it to the cache Override this to put a new object in the cache if it is currently missing
 java.util.Enumeration getKeys()
          get enumeration of current docids (keys)
 java.lang.Object getObject(java.lang.String docid)
          get an object in the cache; returns null if object is not in the cache or has been garbage collected
 int getSize()
          get the current size of the cache
 boolean isInObjectCollection(java.lang.String docid)
           
 void putObject(java.lang.String docid, java.lang.Object obj)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectCache

public ObjectCache()
constructor

Method Detail

putObject

public void putObject(java.lang.String docid,
                      java.lang.Object obj)

isInObjectCollection

public boolean isInObjectCollection(java.lang.String docid)

getObject

public java.lang.Object getObject(java.lang.String docid)
get an object in the cache; returns null if object is not in the cache or has been garbage collected


getSize

public int getSize()
get the current size of the cache


getKeys

public java.util.Enumeration getKeys()
get enumeration of current docids (keys)


addNewObjectToCache

protected void addNewObjectToCache(java.lang.String docid)
create a new object and add it to the cache Override this to put a new object in the cache if it is currently missing



Copyright © 2000 National Center for Ecological Analysis and Synthesis. All Rights Reserved.