|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.xml.xmlc.deferredparsing.Cache
A Cache for arbitrary objects. It holds its objects with soft references. Because broken handling of soft references in current JVM implementations, we also hold additional hard references to the most recently used entries.
Inner Class Summary | |
protected static class |
Cache.MRUCache
A simple class for holding references to the most recently used entries. |
Inner classes inherited from class java.util.Map |
Map.Entry |
Field Summary | |
static int |
DEFAULT_NUM_MRU_ENTRIES
the default size for the MRU cache |
Constructor Summary | |
Cache()
Creates a new Cache instance with the
default value for most recently used entries. |
|
Cache(int numMRUEntries)
Creates a new Cache instance with an
explicit value for most recently used entries cache. |
|
Cache(int numMRUEntries,
Map other)
Creates a new Cache instance. |
|
Cache(Map other)
Creates a new Cache instance. |
Method Summary | |
void |
clear()
Describe clear method here. |
boolean |
containsKey(Object key)
Describe containsKey method here. |
boolean |
containsValue(Object obj)
Describe containsValue method here. |
Set |
entrySet()
Returns a set view of the mappings contained in this cache. |
boolean |
equals(Object cache)
Compare two Cache instances. |
Object |
get(Object key)
Returns the value to which this cache maps the specified key. |
int |
hashCode()
Get hash code of map. |
boolean |
isEmpty()
Map interface, isEmpty method. |
Set |
keySet()
Return a Set of all keys. |
Object |
put(Object key,
Object value)
Associates the specified value with the specified key in this cache. |
void |
putAll(Map cache)
Describe putAll method here. |
Object |
remove(Object key)
Removes the mapping for this key from this cache. |
int |
size()
Get the current size of the cache. |
Collection |
values()
Return a collection of all values this cache contains. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public static final int DEFAULT_NUM_MRU_ENTRIES
Constructor Detail |
public Cache()
Cache
instance with the
default value for most recently used entries.public Cache(int numMRUEntries)
Cache
instance with an
explicit value for most recently used entries cache.numMRUEntries
- an int
valuepublic Cache(Map other)
Cache
instance.
The give Map
will be copied.other
- a Map
valuepublic Cache(int numMRUEntries, Map other)
Cache
instance.
The give Map
will be copied.other
- a Map
valueMethod Detail |
public int hashCode()
hashCode
in interface Map
hashCode
in class Object
int
valuepublic boolean equals(Object cache)
Cache
instances.equals
in interface Map
equals
in class Object
cache
- other cache to compare to.public int size()
size
in interface Map
public void clear()
clear
method here.clear
in interface Map
public Object put(Object key, Object value)
null
values.put
in interface Map
key
- key with which the specified value is to be associated.value
- value to be associated with the specified key.NullPointerException
- if value
is null
.public Object get(Object key)
null
get
in interface Map
key
- key whose associated value is to be returned.null
if the cache contains no mapping for
this key.public Collection values()
null
in this case.values
in interface Map
Collection
containing a values of the cache.public Object remove(Object key)
remove
in interface Map
key
- key whose mapping is to be removed from the cache.public Set keySet()
Set
of all keys.keySet
in interface Map
Set
of all keys.public Set entrySet()
entrySet
in interface Map
Set
view of all values.public boolean isEmpty()
isEmpty
method.isEmpty
in interface Map
Map.isEmpty()
public boolean containsValue(Object obj)
containsValue
method here.containsValue
in interface Map
obj
- an Object
valueboolean
valuepublic boolean containsKey(Object key)
containsKey
method here.containsKey
in interface Map
key
- an Object
valueboolean
valuepublic void putAll(Map cache)
putAll
method here.putAll
in interface Map
cache
- a Map
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |