org.basex.index
Class IndexTree

java.lang.Object
  extended by org.basex.index.IndexTree

public class IndexTree
extends java.lang.Object

This class indexes keys in a balanced binary tree, including their id values. Iterator methods are available to traverse through the tree.

Author:
BaseX Team 2005-12, BSD License, Christian Gruen, Sebastian Gath

Field Summary
protected  int cn
          Current iterator node.
protected static double FACTOR
          Factor for resize.
 TokenList keys
          Keys saved in the tree.
protected  TokenIntMap maps
          Mapping for using existing tree.
 TokenList values
          Compressed id values.
 
Constructor Summary
IndexTree()
           
 
Method Summary
 void index(byte[] key, int value)
          Indexes the specified key and value.
protected  int index(byte[] key, int value, boolean exist)
          Indexes the specified key and value.
 void init()
          Initializes the index iterator.
 boolean more()
          Checks if the iterator returns more keys.
 int next()
          Returns the next pointer.
 int size()
          Returns the number of entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACTOR

protected static final double FACTOR
Factor for resize.

See Also:
Constant Field Values

keys

public final TokenList keys
Keys saved in the tree.


values

public TokenList values
Compressed id values.


maps

protected TokenIntMap maps
Mapping for using existing tree.


cn

protected int cn
Current iterator node.

Constructor Detail

IndexTree

public IndexTree()
Method Detail

index

public final void index(byte[] key,
                        int value)
Indexes the specified key and value.

Parameters:
key - key to be indexed
value - value to be indexes

index

protected final int index(byte[] key,
                          int value,
                          boolean exist)
Indexes the specified key and value. If the key has already been indexed, its value is added to the existing value array. Otherwise, a new index entry is created.

Parameters:
key - key to be indexed
value - value to be indexed
exist - flag for using existing index
Returns:
int node

size

public final int size()
Returns the number of entries.

Returns:
number of entries

init

public final void init()
Initializes the index iterator. will be removed to save memory.


more

public final boolean more()
Checks if the iterator returns more keys.

Returns:
true if more keys exist

next

public final int next()
Returns the next pointer.

Returns:
next pointer