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

java.lang.Object
  extended by org.basex.util.hash.ASet
      extended by org.basex.util.hash.TokenSet
          extended by org.basex.util.hash.TokenObjMap<E>
Type Parameters:
E - generic value type
All Implemented Interfaces:
java.lang.Iterable<byte[]>

public final class TokenObjMap<E>
extends TokenSet

This is an efficient and memory-saving hash map for storing tokens and objects. hash set.

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

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

Constructor Detail

TokenObjMap

public TokenObjMap()
Method Detail

put

public void put(byte[] key,
                E val)
Indexes the specified key and value. If the key exists, the value is updated.

Parameters:
key - key
val - value

get

public E get(byte[] key)
Returns the value for the specified key.

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

values

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

Returns:
iterator

delete

public int delete(byte[] key)
Description copied from class: TokenSet
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 TokenSet
Parameters:
key - key
Returns:
deleted key or 0

rehash

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

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