com.tivoli.twg.libs
Class ShortKeyTable

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

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

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

See Also:
Serialized Form

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

ShortKeyTable

public ShortKeyTable()
Constructor for ShortKeyTable: 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(short 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(short 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(short 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 Short instances

GetAllKeys

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