org.jcreme.caches
Class LUFOCache.LocalKey

java.lang.Object
  extended byorg.jcreme.caches.LUFOCache.LocalKey
All Implemented Interfaces:
java.lang.Comparable
Enclosing class:
LUFOCache

protected class LUFOCache.LocalKey
extends java.lang.Object
implements java.lang.Comparable

This class enable to store the original key and the number of occurences when the associated value was recovered from the cache.


Constructor Summary
LUFOCache.LocalKey(java.lang.Object key)
          Builds a new local key.
 
Method Summary
 int compareTo(java.lang.Object o)
          This method enables to compare the LocalKey objects to order them.
 boolean equals(java.lang.Object o)
          This method compares an object to this key.
 java.lang.Object getKey()
          Gives access to the original key.
 long getNumberOfUses()
          Access to the current number of calls to retrieve the object associated to this key.
 int hashCode()
          This method ensures that we can access in a Hashtable using either the original key or the LocalKey associated.
 long incr()
          This method enables to increment the number of retrievals.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LUFOCache.LocalKey

public LUFOCache.LocalKey(java.lang.Object key)
Builds a new local key.

Parameters:
key - the actual key in the Cache.
Method Detail

incr

public long incr()
This method enables to increment the number of retrievals.

Returns:
the result of the incrementation.

getNumberOfUses

public long getNumberOfUses()
Access to the current number of calls to retrieve the object associated to this key.

Returns:
the number of accesses to the associated value.

getKey

public java.lang.Object getKey()
Gives access to the original key.

Returns:
the original key that was used to create this LocalKey.

compareTo

public int compareTo(java.lang.Object o)
This method enables to compare the LocalKey objects to order them.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - the LocalKey to compare.
Returns:
the comparison result. If the parameter is not a LocalKey and o is the underlying key the result is 0.

hashCode

public int hashCode()
This method ensures that we can access in a Hashtable using either the original key or the LocalKey associated.

Returns:
the hashcode of the underlying key.

equals

public boolean equals(java.lang.Object o)
This method compares an object to this key.

Parameters:
o - the object to test for equality.
Returns:
true if o is a LocalKey with the same underlying key or o is equal to the underlying key. false otherwise.


Copyright 2006 null. All Rights Reserved.