org.basex.util.hash
Class TokenBoolMap

java.lang.Object
  extended by org.basex.util.hash.ASet
      extended by org.basex.util.hash.TokenSet
          extended by org.basex.util.hash.TokenBoolMap
All Implemented Interfaces:
java.lang.Iterable<byte[]>

public final class TokenBoolMap
extends TokenSet

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

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
TokenBoolMap()
          Constructor.
 
Method Summary
 boolean get(byte[] key)
          Returns the value for the specified key.
 void put(byte[] key, boolean value)
          Indexes the specified key and stores the associated value.
protected  void rehash(int s)
          Rehashes all entries.
 
Methods inherited from class org.basex.util.hash.TokenSet
add, add, clear, contains, delete, 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

TokenBoolMap

public TokenBoolMap()
Constructor.

Method Detail

put

public void put(byte[] key,
                boolean 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 boolean get(byte[] key)
Returns the value for the specified key.

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

rehash

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

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