com.tivoli.twg.libs
Class LongKeyTable

java.lang.Object
  extended bycom.tivoli.twg.libs.LongKeyTable
All Implemented Interfaces:
java.io.Serializable

public class LongKeyTable
extends java.lang.Object
implements java.io.Serializable

Fast, simple hash table for storing references to Objects keyed by an associated 'long' key value. The key value is considered to be a unique identifier for selecting records within the LongKeyTable. In addition, the LongKeyTable class supports a subscribe-listen interface, allowing implementers of the LongKeyTableListener interface to subscribe to receive update notifications for the table.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Constructor Summary
LongKeyTable()
          Constructor for LongKeyTable: initialize empty table
 
Method Summary
 int Count()
          Return number of objects in table
 void EmptyTable()
          Empty the table
 java.lang.Object FindObject(long id)
          Find object, given an object ID
 long[] GetAllKeys()
          Get array of all keys in table.
 java.lang.Object[] GetAllObjects()
          Get array of all objects in table.
 java.util.Enumeration GetKeys()
          Enumerate all keys in table.
 java.util.Enumeration GetObjects()
          Enumerate all objects in table.
 void InsertObject(long id, java.lang.Object obj)
          Insert new (or updated) record into the hash table
 java.lang.Object RemoveObject(long id)
          Remove object with given ID from table (if present)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

LongKeyTable

public LongKeyTable()
Constructor for LongKeyTable: initialize empty table

Method Detail

EmptyTable

public void EmptyTable()
Empty the table


Count

public int Count()
Return number of objects in table

Returns:
object count

InsertObject

public void InsertObject(long id,
                         java.lang.Object obj)
Insert new (or updated) record into the hash table

Parameters:
id - - identifier of object within table
obj - - object to be added to table

RemoveObject

public java.lang.Object RemoveObject(long id)
Remove object with given ID from table (if present)

Parameters:
id - - identifier of object within table
Returns:
object removed, or null if not found

FindObject

public java.lang.Object FindObject(long id)
Find object, given an object ID

Parameters:
id - - object ID of object to find
Returns:
Object reference found, or null if not found

GetKeys

public java.util.Enumeration GetKeys()
Enumerate all keys in table.

Returns:
Enumerator containing key values as Long instances

GetAllKeys

public long[] GetAllKeys()
Get array of all keys in table.

Returns:
Array of key values

GetObjects

public java.util.Enumeration GetObjects()
Enumerate all objects in table.

Returns:
Enumerator containing objects from table

GetAllObjects

public java.lang.Object[] GetAllObjects()
Get array of all objects in table.

Returns:
Array of all objects from table