public class Terms extends Object
terms
file.
Their keys are stored in iterms
file. That file organizes
the keys as follows:
The keys are organized by groups of size N (N is defined by writer
object TermsWriter
. The group is stored in this
format: LastKeyOfGroup, SKIP, SIZE, 1st, 2nd,...SIZE-th keys. It is
obvious that SIZE<=N-1. LastKeyOfGroup is SIZE+1-th key. SIZE is
lower than N-1 iff this is the last group of keys. SKIP is the number
of bytes we must skip after finishing read of SKIP if we want to read
the LastKeyOfGroup of following group. Keys are stored with the offset
of their data element in the terms
file.
This object is implemented for IListMeta objects.
Modifier and Type | Method and Description |
---|---|
void |
close()
Close all open files.
|
void |
destroy()
Destroys the two files -
terms and iterms
in this structure's directory. |
static void |
destroy(String location) |
IListMetadataRead |
elementAt(String key)
Return the element with the given key.
|
Sequence<? extends IListMetadata> |
elements(String prefix)
Return an Enumeration of elements containing the given prefix.
|
SequenceWithClose<IListMetadataRead> |
getReader()
Open this data structure for sequential read access.
|
void |
setLocation(String location)
Setter for the DiscKeyIndexData object.
|
public void setLocation(String location)
location
- the directory of the data structurepublic SequenceWithClose<IListMetadataRead> getReader()
public void destroy()
terms
and iterms
in this structure's directory.public static void destroy(String location)
location
- public IListMetadataRead elementAt(String key)
It opens iterms
file. Until it is end-of-file:
- read the last element; if our key
is lower, then
read the group and find your key and its offset to data file (
terms
); if the key
is equal to the last
element, then get its offset to data file; in any other case just
skip SKIP bytes.
key
- the key to the desired valuepublic Sequence<? extends IListMetadata> elements(String prefix)
prefix
- the prefix to check forpublic void close()
Copyright © 2016 Egothor. All Rights Reserved.