|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.unister.semweb.drums.file.IndexForHeaderIndexFile
public class IndexForHeaderIndexFile
This class represents a sparse index for one HeaderIndexFile. It writes its updates to the given
MappedByteBuffer. A IndexForHeaderIndexFile knows for each defined chunk the largest key. If the
elements are ordered in some manner this allows fast access.
Example, 3 Chunks, the third chunk is not fully filled:
------- 10 | ----------- 50 | -- 200 |
1 2 4 5 10 | 11 23 32 49 50 | 51 200 |
| Constructor Summary | |
|---|---|
IndexForHeaderIndexFile(int numberOfChunks,
int keySize,
int chunkSize,
java.nio.ByteBuffer indexBuffer)
This constructor instantiates a new IndexForHeaderIndexFile. |
|
| Method Summary | |
|---|---|
int |
getChunkId(byte[] key)
returns the index of the chunk, where the element could be found. |
long |
getStartOffsetOfChunk(int chunkIndex)
returns the position of chunk with the given index in the file. |
long |
getStartOffsetOfChunkByKey(byte[] key)
returns the position in the file, where the chunk, where the key belongs to starts. |
boolean |
isConsistent()
Checks, if this index is consistent. |
void |
setLargestKey(int chunkIdx,
byte[] largestKeyInChunk)
Sets a new largest key in the chunk with the given index. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IndexForHeaderIndexFile(int numberOfChunks,
int keySize,
int chunkSize,
java.nio.ByteBuffer indexBuffer)
IndexForHeaderIndexFile. You need to give the number of the indexed
chunks, the chunksize and the MappedByteBuffer, where the index should be written to.
numberOfChunks - the expected or maximal number of chunkskeySize - chunkSize - the size of one chunkindexBuffer - the buffer were to write the indexinformations| Method Detail |
|---|
public long getStartOffsetOfChunk(int chunkIndex)
chunkIndex -
public long getStartOffsetOfChunkByKey(byte[] key)
key -
public int getChunkId(byte[] key)
key - the key to look for
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isConsistent()
public void setLargestKey(int chunkIdx,
byte[] largestKeyInChunk)
chunkIdx - largestKeyInChunk -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||