com.tivoli.twg.libs
Class IntKeyTable

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

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

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

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Constructor Summary
IntKeyTable()
          Constructor for IntKeyTable: initialize empty table
 
Method Summary
 int Count()
          Return number of objects in table
 void EmptyTable()
          Empty the table
 java.lang.Object FindObject(int id)
          Find object, given an object ID
 int[] 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(int id, java.lang.Object obj)
          Insert new (or updated) record into the hash table
 java.lang.Object RemoveObject(int 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

IntKeyTable

public IntKeyTable()
Constructor for IntKeyTable: 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(int 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(int 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(int 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 Int instances

GetAllKeys

public int[] 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