org.basex.util.hash
Class IntObjMap<E>

java.lang.Object
  extended by org.basex.util.hash.ASet
      extended by org.basex.util.hash.IntSet
          extended by org.basex.util.hash.IntObjMap<E>
Type Parameters:
E - generic value type

public final class IntObjMap<E>
extends IntSet

This is an efficient and memory-saving hash map for storing primitive integers and objects. It extends the IntSet class.

Author:
BaseX Team 2005-13, BSD License, Christian Gruen

Field Summary
 
Fields inherited from class org.basex.util.hash.IntSet
keys
 
Fields inherited from class org.basex.util.hash.ASet
bucket, next, size
 
Constructor Summary
IntObjMap()
           
 
Method Summary
 int delete(int key)
          Deletes the specified key.
 E get(int key)
          Returns the value for the specified key.
 void put(int key, E value)
          Indexes the specified key and stores the associated value.
protected  void rehash(int s)
          Rehashes all entries.
 java.lang.String toString()
           
 java.lang.Iterable<E> values()
          Returns a value iterator.
 
Methods inherited from class org.basex.util.hash.IntSet
add, contains, hash, id, key, put, toArray
 
Methods inherited from class org.basex.util.hash.ASet
checkSize, clear, isEmpty, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntObjMap

public IntObjMap()
Method Detail

put

public void put(int key,
                E value)
Indexes the specified key and stores the associated value. If the key already exists, the value is updated.

Parameters:
key - key
value - value

get

public E get(int key)
Returns the value for the specified key.

Parameters:
key - key to be looked up
Returns:
value, or null if the key was not found

values

public java.lang.Iterable<E> values()
Returns a value iterator.

Returns:
iterator

rehash

protected void rehash(int s)
Description copied from class: ASet
Rehashes all entries.

Overrides:
rehash in class IntSet
Parameters:
s - new hash size

delete

public int delete(int key)
Description copied from class: IntSet
Deletes the specified key. The deletion of keys will lead to empty entries. If ASet.size is called after deletions, the original number of entries will be returned.

Overrides:
delete in class IntSet
Parameters:
key - key
Returns:
deleted key or 0

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object