org.basex.index.value
Class MemValues

java.lang.Object
  extended by org.basex.util.hash.ASet
      extended by org.basex.util.hash.TokenSet
          extended by org.basex.index.value.MemValues
All Implemented Interfaces:
java.lang.Iterable<byte[]>, Index
Direct Known Subclasses:
UpdatableMemValues

public class MemValues
extends TokenSet
implements Index

This class provides a main memory access to attribute values and text contents.

Author:
BaseX Team 2005-12, 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
MemValues(Data d)
          Constructor.
 
Method Summary
 void close()
          Closes the index.
 int count(IndexToken it)
          Returns the (approximate/estimated) number of hits for the specified token.
 void delete(byte[] key, int id)
          Removes a record from the index.
 EntryIterator entries(IndexEntries entries)
          Returns all entries that match the specified token.
 byte[] info()
          Returns information on the index structure.
 void init()
          Initializes the index.
 IndexIterator iter(IndexToken tok)
          Returns an iterator for the index results.
 int put(byte[] key, int id)
          Stores the specified key and id.
 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

MemValues

public MemValues(Data d)
Constructor.

Parameters:
d - data instance
Method Detail

init

public void init()
Description copied from interface: Index
Initializes the index.

Specified by:
init in interface Index

iter

public IndexIterator iter(IndexToken tok)
Description copied from interface: Index
Returns an iterator for the index results.

Specified by:
iter in interface Index
Parameters:
tok - token to be found
Returns:
sorted pre values for the token

count

public int count(IndexToken it)
Description copied from interface: Index
Returns the (approximate/estimated) number of hits for the specified token.

Specified by:
count in interface Index
Parameters:
it - token to be found
Returns:
number of hits

entries

public EntryIterator entries(IndexEntries entries)
Description copied from interface: Index
Returns all entries that match the specified token.

Specified by:
entries in interface Index
Parameters:
entries - index entries
Returns:
entries

info

public byte[] info()
Description copied from interface: Index
Returns information on the index structure.

Specified by:
info in interface Index
Returns:
info

close

public void close()
Description copied from interface: Index
Closes the index.

Specified by:
close in interface Index

rehash

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

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

put

public final int put(byte[] key,
                     int id)
Stores the specified key and id.

Parameters:
key - key
id - id value
Returns:
index id

delete

public void delete(byte[] key,
                   int id)
Removes a record from the index.

Parameters:
key - record key
id - record id