|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Dictionary<K,V>
java.util.Hashtable
org.ceryle.xnode.XNodeCache
public class XNodeCache
Extends Hashtable as a cache for XNode objects.
Also, generalize this as org.ceryle.util.Cache, then subclass for XNodeIDs and XNodes.
| Field Summary | |
|---|---|
static int |
DEFAULT_SIZE
The value of the default cache size. |
static int |
hysteresis
The value of size-trimming hysteresis (the amount over the limit permitted prior to trimming, used to reduce the cost of trimming). |
| Constructor Summary | |
|---|---|
XNodeCache()
Constructor for an XNodeCache using the default cache size (of 50) and automatically checking the limit. |
|
XNodeCache(int limit,
boolean autocheck)
Constructor for an XNodeCache with a cache size limit and the boolean controlling whether the limit check is automatic or manual. |
|
| Method Summary | |
|---|---|
protected void |
addToCache(XNodeID xid,
XNode xnode)
Adds the XNode xnode to the cache using the XNodeID xid as the key. |
XNode |
checkCacheFor(XNodeID xid)
Checks the cache for an XNode corresponding to the XNodeID xid, returning null if it is not in the cache, or if caching is inactive. |
void |
checkLimit()
Checks the current cache size against the limit and removes objects as necessary to reach the limit. |
void |
clear()
Clears the document cache. |
Object |
get(Object key)
Throws an exception. |
Iterator |
getAll()
Returns an Iterator over the XNodes in the cache. |
Object |
put(Object key,
Object value)
Throws an exception. |
void |
putAll(Map map)
Throws an exception. |
Object |
remove(Object key)
Throws an exception. |
boolean |
removeFromCache(XNode xnode)
Removes the XNode xnode from the document cache, returning true if it was removed. |
boolean |
removeFromCache(XNodeID xid)
Removes the document specified by the XNodeID xid from the cache, returning true if it was removed. |
Collection |
values()
Throws an exception. |
| Methods inherited from class java.util.Hashtable |
|---|
clone, contains, containsKey, containsValue, elements, entrySet, equals, hashCode, isEmpty, keys, keySet, rehash, size, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DEFAULT_SIZE
public static int hysteresis
| Constructor Detail |
|---|
public XNodeCache()
public XNodeCache(int limit,
boolean autocheck)
| Method Detail |
|---|
protected void addToCache(XNodeID xid,
XNode xnode)
public XNode checkCacheFor(XNodeID xid)
public boolean removeFromCache(XNodeID xid)
public boolean removeFromCache(XNode xnode)
public Iterator getAll()
public void clear()
clear in interface Mapclear in class Hashtablepublic void checkLimit()
hysteresis
prior to trimming.
public final Collection values()
getAll() instead.
values in interface Mapvalues in class Hashtablepublic final Object remove(Object key)
removeFromCache(XNodeID) instead.
remove in interface Mapremove in class Hashtablepublic final Object get(Object key)
checkCacheFor(XNodeID) instead.
get in interface Mapget in class Hashtable
public final Object put(Object key,
Object value)
addToCache(XNodeID,XNode) instead.
put in interface Mapput in class Hashtablepublic final void putAll(Map map)
addToCache(XNodeID,XNode) instead.
putAll in interface MapputAll in class Hashtable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||