Package org.basex.index
Class IndexTree
java.lang.Object
org.basex.index.IndexTree
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-21, BSD License, Christian Gruen, Sebastian Gath
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidadd(byte[] key, int id, int pos) Indexes the specified key and id.protected final intadd(byte[] key, int id, int pos, boolean exist) Indexes the specified key and id.final voidinit()Initializes the index iterator.final booleanmore()Checks if the iterator returns more keys.final intnext()Returns the next pointer.final intsize()Returns the number of entries.toString()
-
Field Details
-
FACTOR
protected static final double FACTORFactor for resize.- See Also:
-
keys
Keys saved in the tree. -
ids
Compressed id values. -
maps
Mapping for using existing tree. -
cn
protected int cnCurrent iterator node.
-
-
Constructor Details
-
IndexTree
Constructor.- Parameters:
type- index type
-
-
Method Details
-
add
public final void add(byte[] key, int id, int pos) Indexes the specified key and id.- Parameters:
key- key to be indexedid- id to be indexedpos- token position (only relevant for token index)
-
add
protected final int add(byte[] key, int id, int pos, boolean exist) Indexes the specified key and id. If the key has already been indexed, its id is appended to the existing array. Otherwise, a new index entry is created.- Parameters:
key- key to be indexedid- id to be indexedpos- token position (only relevant for token index)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
-
toString
-