uka.util
Class Long2ObjectHashtable

java.lang.Object
  extended byuka.util.Long2ObjectHashtable

public class Long2ObjectHashtable
extends java.lang.Object

Implements a Hashtable similar to java.util.Hashtable, but always maps long keys to Object values. This allows a much more efficient implementation. The code is based on GJ's Hashtable implementation.

Author:
Jürgen Reuter

Nested Class Summary
private static class Long2ObjectHashtable.Entry
           
 
Field Summary
private  int hashMask
           
private  int hashSize
           
private  int limit
           
private  int size
           
private  Long2ObjectHashtable.Entry spare
          Keep unused entries for later reuse here.
private  Long2ObjectHashtable.Entry[] table
           
 
Constructor Summary
Long2ObjectHashtable()
           
Long2ObjectHashtable(int initialSize)
           
Long2ObjectHashtable(int initialSize, float fillFactor)
           
 
Method Summary
private  void copy(Long2ObjectHashtable.Entry e)
           
private  void dble()
           
 java.lang.Object get(long key)
          Return value for key or null, if key not found.
private  int getIndex(long key)
           
static Long2ObjectHashtable make()
           
 java.lang.Object put(long key, java.lang.Object value)
          Put (key, value) pair into map.
 void remove(long key)
           
 void reset()
           
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

hashSize

private int hashSize

hashMask

private int hashMask

limit

private int limit

size

private int size

table

private Long2ObjectHashtable.Entry[] table

spare

private Long2ObjectHashtable.Entry spare
Keep unused entries for later reuse here.

Constructor Detail

Long2ObjectHashtable

public Long2ObjectHashtable(int initialSize,
                            float fillFactor)

Long2ObjectHashtable

public Long2ObjectHashtable(int initialSize)

Long2ObjectHashtable

public Long2ObjectHashtable()
Method Detail

make

public static Long2ObjectHashtable make()

dble

private void dble()

getIndex

private final int getIndex(long key)

copy

private void copy(Long2ObjectHashtable.Entry e)

get

public java.lang.Object get(long key)
Return value for key or null, if key not found.


put

public java.lang.Object put(long key,
                            java.lang.Object value)
Put (key, value) pair into map. Remove (key, *), if (value == null).

Returns:
old value associated with key, or null, if key was not present before.

remove

public void remove(long key)

size

public int size()

reset

public void reset()