public class BinarySearchIndexBuilder extends Object implements IndexBuilder
BinarySearchIndex
.Modifier and Type | Field and Description |
---|---|
protected Indexable |
dictionary |
protected IndexContainer |
indexContainer |
protected static Random |
random
Random number generator.
|
protected ByteBuffer |
tempIndex |
protected IntBuffer |
tempIndexInt |
protected int |
type |
Constructor and Description |
---|
BinarySearchIndexBuilder(int _type) |
Modifier and Type | Method and Description |
---|---|
boolean |
addEntry(int location,
int length,
DictionaryEntryField field)
Add an entry to the index structure.
|
void |
endBuildIndex(boolean commit)
End the index build.
|
protected void |
quicksortIndex(int left,
int right,
IntBuffer index)
Sorts a part of the index array using randomized quicksort.
|
void |
startBuildIndex(IndexContainer _container,
Indexable _dictionary)
Begin building a new index.
|
protected IndexContainer indexContainer
protected Indexable dictionary
protected ByteBuffer tempIndex
protected IntBuffer tempIndexInt
protected int type
protected static Random random
public void startBuildIndex(IndexContainer _container, Indexable _dictionary) throws IndexException
IndexBuilder
startBuildIndex
in interface IndexBuilder
_container
- Container to which the index should be added._dictionary
- Dictionary in which the index entries are stored.IndexException
public boolean addEntry(int location, int length, DictionaryEntryField field) throws IndexException
IndexBuilder
addEntry
in interface IndexBuilder
location
- Location of the index entry, encoded as integer value in a
Indexable
-dependent way.length
- Length of the index entry, encoded in a
Indexable
-dependent way. (location+length)
is the
first location not belonging to the index entry.field
- Dictionary entry field in which the index entry is contained. The index builder
may ignore index entries for certain fields.true
if the entry was added to the index, false
if it
was ignored.IndexException
public void endBuildIndex(boolean commit) throws IndexException
IndexBuilder
endBuildIndex
in interface IndexBuilder
commit
- true
if the generated index data should be stored, false
if some error occurred during index creation and the index data should be discarded.IndexException
protected void quicksortIndex(int left, int right, IntBuffer index) throws IOException, IndexException
IOException
IndexException
Copyright © 2001-2013 the JGloss developers. All Rights Reserved.