org.basex.util
Class Set

java.lang.Object
  extended by org.basex.util.Set
Direct Known Subclasses:
FNIndex, Map, Names, Namespaces, TokenMap

public class Set
extends java.lang.Object

This is a simple hash set, storing keys in byte arrays. The TokenMap class extends it to a hash map.

Author:
Workgroup DBIS, University of Konstanz 2005-08, ISC License, Christian Gruen

Field Summary
 int size
          Hash entries.
 
Constructor Summary
Set()
          Empty Constructor.
 
Method Summary
 int add(byte[] key)
          Indexes the specified key.
 int delete(byte[] key)
          Deletes the specified key.
 int id(byte[] key)
          Returns the id of the specified key or 0 if key was not found.
 byte[] key(int p)
          Returns the specified key.
 byte[][] keys()
          Returns the hash keys.
 int size()
          Returns number of entries.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

size

public int size
Hash entries. Actual hash size is size - 1.

Constructor Detail

Set

public Set()
Empty Constructor.

Method Detail

add

public int add(byte[] key)
Indexes the specified key.

Parameters:
key - key
Returns:
offset of added key, negative offset otherwise

delete

public final int delete(byte[] key)
Deletes the specified key.

Parameters:
key - key
Returns:
deleted key or 0

id

public final int id(byte[] key)
Returns the id of the specified key or 0 if key was not found.

Parameters:
key - key to be found
Returns:
id or 0 if nothing was found

key

public final byte[] key(int p)
Returns the specified key.

Parameters:
p - key index
Returns:
key

keys

public final byte[][] keys()
Returns the hash keys.

Returns:
keys

size

public final int size()
Returns number of entries.

Returns:
number of entries.