arlut.csd.ganymede
Class DBBaseFieldTable

java.lang.Object
  |
  +--arlut.csd.ganymede.DBBaseFieldTable

public class DBBaseFieldTable
extends java.lang.Object

A customized variant of the java.util.Hashtable class that is tuned for use in managing DBObjectBaseFields in a Ganymede DBObjectBase.


Field Summary
private  int count
          The total number of entries in the hash table.
private  float loadFactor
          The load factor for the hashtable.
private  arlut.csd.ganymede.DBObjectBaseField[] table
          The hash table data.
private  int threshold
          Rehashes the table when count exceeds this threshold.
 
Constructor Summary
DBBaseFieldTable()
          Constructs a new, empty DBBaseFieldTable with a default capacity and load factor.
DBBaseFieldTable(int initialCapacity)
          Constructs a new, empty DBBaseFieldTable with the specified initial capacity and default load factor.
DBBaseFieldTable(int initialCapacity, float loadFactor)
          Constructs a new, empty DBBaseFieldTable with the specified initial capacity and the specified load factor.
 
Method Summary
 void clear()
          Clears this DBBaseFieldTable.
 boolean contains(arlut.csd.ganymede.DBObjectBaseField value)
          Tests if the DBObjectBaseField value is contained in this DBBaseFieldTable.
 boolean containsKey(short key)
          Tests if a DBObjectBaseField with the specified object id is in this DBBaseFieldTable.
 boolean containsKey(java.lang.Short key)
          Tests if a DBObjectBaseField with the specified object id is in this DBBaseFieldTable.
 java.util.Enumeration elements()
          Returns an enumeration of the objects in this DBBaseFieldTable.
 arlut.csd.ganymede.DBObjectBaseField get(short key)
          Returns the DBObjectBaseField with the specified key from this DBBaseFieldTable, or null if no object with that id is in this table.
 arlut.csd.ganymede.DBObjectBaseField getNoSync(short key)
          Returns the DBObjectBaseField with the specified key from this DBBaseFieldTable, or null if no object with that id is in this table.
 boolean isEmpty()
          Tests if this DBBaseFieldTable contains no objects.
 void put(arlut.csd.ganymede.DBObjectBaseField value)
          Inserts a DBObjectBaseField into this DBBaseFieldTable
 void putNoSync(arlut.csd.ganymede.DBObjectBaseField value)
          Inserts a DBObjectBaseField into this DBBaseFieldTable.
 void putNoSyncNoRemove(arlut.csd.ganymede.DBObjectBaseField value)
          Inserts a DBObjectBaseField into this DBBaseFieldTable.
protected  void rehash()
          Rehashes the contents of the DBBaseFieldTable into a DBBaseFieldTable with a larger capacity.
 void remove(short key)
          Removes the DBObjectBaseField with the given id from this DBBaseFieldTable.
 void removeNoSync(short key)
          Removes the DBObjectBaseField with the given id from this DBBaseFieldTable.
 int size()
          Returns the number of objects in this DBBaseFieldTable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

table

private transient arlut.csd.ganymede.DBObjectBaseField[] table
The hash table data.


count

private transient int count
The total number of entries in the hash table.


threshold

private int threshold
Rehashes the table when count exceeds this threshold.


loadFactor

private float loadFactor
The load factor for the hashtable.

Constructor Detail

DBBaseFieldTable

public DBBaseFieldTable(int initialCapacity,
                        float loadFactor)
Constructs a new, empty DBBaseFieldTable with the specified initial capacity and the specified load factor.

Parameters:
initialCapacity - the initial capacity of the hashtable.
loadFactor - a number between 0.0 and 1.0.
Throws:
java.lang.IllegalArgumentException - if the initial capacity is less than or equal to zero, or if the load factor is less than or equal to zero.

DBBaseFieldTable

public DBBaseFieldTable(int initialCapacity)
Constructs a new, empty DBBaseFieldTable with the specified initial capacity and default load factor.

Parameters:
initialCapacity - the initial capacity of the hashtable.

DBBaseFieldTable

public DBBaseFieldTable()
Constructs a new, empty DBBaseFieldTable with a default capacity and load factor.

Method Detail

size

public int size()
Returns the number of objects in this DBBaseFieldTable.

Returns:
the number of objects in this DBBaseFieldTable.

isEmpty

public boolean isEmpty()
Tests if this DBBaseFieldTable contains no objects.

Returns:
true if this DBBaseFieldTable contains no values; false otherwise.

elements

public java.util.Enumeration elements()
Returns an enumeration of the objects in this DBBaseFieldTable. Use the Enumeration methods on the returned object to fetch the elements sequentially.

Returns:
an enumeration of the objects in this DBBaseFieldTable.
See Also:
Enumeration

contains

public boolean contains(arlut.csd.ganymede.DBObjectBaseField value)
Tests if the DBObjectBaseField value is contained in this DBBaseFieldTable.

Parameters:
value - a DBObjectBaseField to search for.
Throws:
java.lang.NullPointerException - if the value is null.

containsKey

public boolean containsKey(java.lang.Short key)
Tests if a DBObjectBaseField with the specified object id is in this DBBaseFieldTable.

Parameters:
key - possible object id.

containsKey

public boolean containsKey(short key)
Tests if a DBObjectBaseField with the specified object id is in this DBBaseFieldTable.

Parameters:
key - possible object id.

getNoSync

public arlut.csd.ganymede.DBObjectBaseField getNoSync(short key)
Returns the DBObjectBaseField with the specified key from this DBBaseFieldTable, or null if no object with that id is in this table.


get

public arlut.csd.ganymede.DBObjectBaseField get(short key)
Returns the DBObjectBaseField with the specified key from this DBBaseFieldTable, or null if no object with that id is in this table.


rehash

protected void rehash()
Rehashes the contents of the DBBaseFieldTable into a DBBaseFieldTable with a larger capacity. This method is called automatically when the number of keys in the hashtable exceeds this DBBaseFieldTable's capacity and load factor.


putNoSync

public void putNoSync(arlut.csd.ganymede.DBObjectBaseField value)
Inserts a DBObjectBaseField into this DBBaseFieldTable. This put is not sync'ed, and should only be used with higher level sync provisions.


put

public void put(arlut.csd.ganymede.DBObjectBaseField value)
Inserts a DBObjectBaseField into this DBBaseFieldTable


putNoSyncNoRemove

public void putNoSyncNoRemove(arlut.csd.ganymede.DBObjectBaseField value)
Inserts a DBObjectBaseField into this DBBaseFieldTable. This put is not sync'ed, and should only be used with higher level sync provisions.


removeNoSync

public void removeNoSync(short key)
Removes the DBObjectBaseField with the given id from this DBBaseFieldTable.


remove

public void remove(short key)
Removes the DBObjectBaseField with the given id from this DBBaseFieldTable.


clear

public void clear()
Clears this DBBaseFieldTable.