org.walluck.oscar
Class SNACHashMap

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.HashMap
          extended by org.walluck.oscar.SNACHashMap
All Implemented Interfaces:
Serializable, Cloneable, Map

public class SNACHashMap
extends HashMap

A hash table for storing sent SNAC's.

Since:
1.0
Version:
1.0
Author:
David Walluck
See Also:
Serialized Form

Constructor Summary
SNACHashMap(AIMSession sess, AIMConnection conn)
          Creates a new SNAC hash table with the default size.
SNACHashMap(AIMSession sess, AIMConnection conn, int size)
          Creates a new SNAC hash table with the given size.
 
Method Summary
 int clean(int maxAge)
          Clean out SNAC's over a certain number of seconds old.
 SNAC peek(int snacId)
          Peek at a SNAC in the hash table.
 SNAC put(SNAC snac)
          Put a SNAC into the hash table.
 SNAC remove(int snacId)
          Remove a SNAC from the hash table.
 
Methods inherited from class java.util.HashMap
clear, clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, put, putAll, remove, size, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode
 

Constructor Detail

SNACHashMap

public SNACHashMap(AIMSession sess,
                   AIMConnection conn)
Creates a new SNAC hash table with the default size.

Parameters:
sess - the oscar session
conn - the connection

SNACHashMap

public SNACHashMap(AIMSession sess,
                   AIMConnection conn,
                   int size)
Creates a new SNAC hash table with the given size.

Parameters:
sess - the oscar session
conn - the connection
size - the size of this hash table
Method Detail

put

public SNAC put(SNAC snac)
Put a SNAC into the hash table.

Parameters:
snac - the SNAC to put in the hash table
Returns:
the SNAC added

peek

public SNAC peek(int snacId)
Peek at a SNAC in the hash table.

Parameters:
snacId - the ID of the SNAC to look for
Returns:
the SNAC if found

remove

public SNAC remove(int snacId)
Remove a SNAC from the hash table.

Parameters:
snacId - the ID of the SNAC to remove
Returns:
the SNAC removed

clean

public int clean(int maxAge)
Clean out SNAC's over a certain number of seconds old.

Parameters:
maxAge - the maximum age for the SNAC's, in seconds
Returns:
the number of SNAC's removed