de.hillenbrand.datatypes
Class AgingHashtable<K,V>

java.lang.Object
  extended by java.util.Dictionary<K,V>
      extended by de.hillenbrand.datatypes.AgingHashtable<K,V>

public class AgingHashtable<K,V>
extends java.util.Dictionary<K,V>


Constructor Summary
AgingHashtable(long maxAgeInSeconds)
          Creates a hashtable where the keys have a limited lifetime.
 
Method Summary
 void clear()
          Removes all entries at once.
 java.util.Enumeration<V> elements()
           
protected  void finalize()
           
 V get(java.lang.Object key)
           
 boolean isEmpty()
           
 java.util.Enumeration<K> keys()
           
static void main(java.lang.String[] args)
          Just a test.
 V put(K key, V value)
           
 V remove(java.lang.Object key)
           
protected  void removeAgedElements()
          Removes all elements from the hashtable that have not been updated in time.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AgingHashtable

public AgingHashtable(long maxAgeInSeconds)
Creates a hashtable where the keys have a limited lifetime. If they are new inserted again within the defined period, they will be removed.

Parameters:
maxAgeInSeconds - the maximum age in seconds
Method Detail

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

size

public int size()
Specified by:
size in class java.util.Dictionary<K,V>

clear

public void clear()
Removes all entries at once.


isEmpty

public boolean isEmpty()
Specified by:
isEmpty in class java.util.Dictionary<K,V>

keys

public java.util.Enumeration<K> keys()
Specified by:
keys in class java.util.Dictionary<K,V>

elements

public java.util.Enumeration<V> elements()
Specified by:
elements in class java.util.Dictionary<K,V>

get

public V get(java.lang.Object key)
Specified by:
get in class java.util.Dictionary<K,V>

put

public V put(K key,
             V value)
Specified by:
put in class java.util.Dictionary<K,V>

remove

public V remove(java.lang.Object key)
Specified by:
remove in class java.util.Dictionary<K,V>

removeAgedElements

protected void removeAgedElements()
Removes all elements from the hashtable that have not been updated in time.


main

public static void main(java.lang.String[] args)
Just a test.

Parameters:
args -