Package org.basex.index.value
Class DiskValues
java.lang.Object
org.basex.index.value.ValueIndex
org.basex.index.value.DiskValues
- All Implemented Interfaces:
Index
- Direct Known Subclasses:
UpdatableDiskValues
This class provides access to attribute values and text contents stored on disk.
The data structure is described in the
DiskValuesBuilder class.- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields inherited from class org.basex.index.value.ValueIndex
data, type -
Constructor Summary
ConstructorsConstructorDescriptionDiskValues(Data data, IndexType type) Constructor, initializing the index structure. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(ValueCache values) Add entries to the index.final voidclose()Closes the index.final IndexCostscosts(IndexSearch search) Computes costs for performing the specified search.voiddelete(ValueCache values) Deletes entries from the index.final booleandrop()Drops the index.final EntryIteratorentries(IndexEntries entries) Returns all entries that match the specified token.final voidflush()Flushes the buffered data.protected final intget(byte[] key) Binary search for key in theidxrreference file.protected final intget(byte[] key, int first, int last) Binary search for key in the#idxrreference file.final byte[]info(MainOptions options) Returns information on the index structure.final IndexIteratoriter(IndexSearch search) Returns an iterator for the index results.protected intpre(int id) Returns theprevalue for the specified id.protected IntListpres(int sz, long offset) Iterator method.final intsize()Returns the number of index entries.toString()final StringtoString(boolean all) Returns a string representation of the index structure.
-
Constructor Details
-
DiskValues
Constructor, initializing the index structure.- Parameters:
data- data referencetype- index type- Throws:
IOException- I/O Exception
-
-
Method Details
-
info
Description copied from interface:IndexReturns information on the index structure.- Parameters:
options- main options- Returns:
- info
-
size
public final int size()Description copied from class:ValueIndexReturns the number of index entries.- Specified by:
sizein classValueIndex- Returns:
- number of index entries
-
costs
Description copied from interface:IndexComputes costs for performing the specified search. An integer is returned:- A negative value indicates that index access is not possible.
- A value of zero indicates that no results will be returned.
- A small value indicates that index access is fast.
- Parameters:
search- index search definition- Returns:
- cost estimation
-
iter
Description copied from interface:IndexReturns an iterator for the index results.- Parameters:
search- index search definition- Returns:
- sorted pre values for the token
-
drop
public final boolean drop()Description copied from interface:IndexDrops the index. Also returns true if the index does not exist.- Returns:
- success flag
-
close
public final void close()Description copied from interface:IndexCloses the index. -
add
Description copied from class:ValueIndexAdd entries to the index.- Specified by:
addin classValueIndex- Parameters:
values- value cache with [key, id-list] pairs
-
delete
Description copied from class:ValueIndexDeletes entries from the index.- Specified by:
deletein classValueIndex- Parameters:
values- value cache with [key, id-list] pairs
-
entries
Description copied from interface:IndexReturns all entries that match the specified token.- Parameters:
entries- index entries- Returns:
- entries
-
flush
public final void flush()Description copied from class:ValueIndexFlushes the buffered data.- Specified by:
flushin classValueIndex
-
pre
protected int pre(int id) Returns theprevalue for the specified id.- Parameters:
id- id value- Returns:
- pre value
-
get
protected final int get(byte[] key) Binary search for key in theidxrreference file.Important: This method is thread-safe.
- Parameters:
key- token to be found- Returns:
- index of the key, or (-(insertion point) - 1)
-
get
protected final int get(byte[] key, int first, int last) Binary search for key in the#idxrreference file.Important: This method is thread-safe.
- Parameters:
key- token to be foundfirst- begin of the search interval (inclusive)last- end of the search interval (exclusive)- Returns:
- index of the key, or (-(insertion point) - 1)
-
pres
Iterator method.Important: This method is thread-safe.
- Parameters:
sz- number of valuesoffset- offset- Returns:
- sorted pre values
-
toString
Returns a string representation of the index structure.- Parameters:
all- include database contents in the representation. During updates, database lookups must be avoided, as the data structures will be inconsistent- Returns:
- string
-
toString
-