|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--quamj.qps.rm.RRHashtable
Hashtable using part of the n_s_id of the ResourceReservation as keys, with no extra objects created. This uses the standard hash technique of adding a standard offset to the computed position in the table when a collision occurs, so that several checks may potentially be necessary in order to determine if a particular key value is present in the table (since if the slot calculated by the hash function is occupied by a different entry it's still necessary to check the offset slot for a match, and then the offset slot from that, until a empty slot is found).
Each time the number of entries present in the table grows above the specified fraction full the table is expanded to twice its prior size plus one (to ensure the size is always an odd number). The collision offset is set to half the table size rounded down, ensuring that it will cycle through all slots of the table before returning to the original slot.
Field Summary | |
protected static double |
DEFAULT_FILL
Default fill fraction allowed before growing table. |
protected int |
entryCount
Number of entries present in table. |
protected int |
entryLimit
Entries allowed before growing table. |
protected double |
fillFraction
Fill fraction allowed for this hash table. |
protected ResourceReservation[] |
hashTable
Array of table slots. |
protected int |
hitOffset
Offset added (modulo table size) to slot number on collision. |
protected static int |
KEY_MULTIPLIER
Hash value multiplier to scramble bits before calculating slot. |
protected static int |
MINIMUM_SIZE
Minimum size used for hash table. |
Constructor Summary | |
RRHashtable()
Default constructor. |
|
RRHashtable(int count)
Constructor with only size supplied. |
|
RRHashtable(int count,
double fill)
Constructor with full specification. |
|
RRHashtable(ResourceReservation[] from)
|
Method Summary | |
protected int |
assignSlot(ResourceReservation entry)
Find slot number for entry. |
void |
clear()
Remove all entries from the table. |
protected void |
expandTable()
Expand the table. |
ResourceReservation |
get(N_S_ID_TYPE key)
Find an entry in the table. |
void |
put(ResourceReservation entry)
Add an entry to the table. |
void |
remove(N_S_ID_TYPE key)
Remove an entry from the table. |
int |
size()
Get number of items in table. |
ResourceReservation[] |
toArray()
Construct an array containing all elements of the table. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final double DEFAULT_FILL
protected static final int MINIMUM_SIZE
protected static final int KEY_MULTIPLIER
protected double fillFraction
protected int entryCount
protected int entryLimit
protected int hitOffset
protected ResourceReservation[] hashTable
Constructor Detail |
public RRHashtable(int count, double fill)
count
- number of values to assume in initial sizing of tablefill
- fraction full allowed for table before growingpublic RRHashtable(int count)
count
- number of values to assume in initial sizing of tablepublic RRHashtable()
public RRHashtable(ResourceReservation[] from)
Method Detail |
public int size()
protected int assignSlot(ResourceReservation entry)
entry
- entry to be added to table
protected void expandTable()
public void put(ResourceReservation entry)
entry
- entry to be added to tablepublic ResourceReservation get(N_S_ID_TYPE key)
key
- for entry to be returned
null
if nonepublic void remove(N_S_ID_TYPE key)
key
- for entry to be removedpublic void clear()
public ResourceReservation[] toArray()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |