|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.egothor.store.Terms
public class Terms
This objects implements the data structure that uses an 1-level index.
The elements are stored in A-Z order in the 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.
Constructor Summary | |
---|---|
protected |
Terms(java.lang.String location)
Constructor for the DiscKeyIndexData object. |
Method Summary | |
---|---|
void |
close()
Close all open files. |
void |
destroy()
Destroys the two files - terms and iterms
in this structure's directory. |
static void |
destroy(java.lang.String location)
|
IListMetadataRead |
elementAt(java.lang.String key)
Return the element with the given key. |
Sequence<? extends IListMetadata> |
elements(java.lang.String prefix)
Return an Enumeration of elements containing the given prefix. |
protected void |
finalize()
Close this object and attempt garbage collection. |
SequenceWithClose<IListMetadataRead> |
getReader()
Open this data structure for sequential read access. |
void |
setLocation(java.lang.String location)
Setter for the DiscKeyIndexData object. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Terms(java.lang.String location)
location
- the directory of the data structureMethod Detail |
---|
public void setLocation(java.lang.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(java.lang.String location)
public IListMetadataRead elementAt(java.lang.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 value
public Sequence<? extends IListMetadata> elements(java.lang.String prefix)
prefix
- the prefix to check for
public void close()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
- garbage collection, who knows?
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |