public class CompressedPostings extends Object implements Writable
| Modifier and Type | Method and Description |
|---|---|
int |
decompressBlock(int[] outBlock,
int blockNumber)
Decompresses a block, stores the decompressed data in an array and returns
the number of decompressed elements as output.
|
boolean |
equals(Object o) |
int |
getBlockCount() |
int |
getBlockNumber(int index)
Computes the block number of a given index.
|
static int |
getBlockSize() |
int |
getBlockStartIndex(int blockNumber)
Returns the index (in the original data) of the
first element in the compressed block.
|
int |
getPositionInBlock(int index) |
boolean |
isFirstElementInBlock(int index) |
static CompressedPostings |
newInstance(int[] data)
Compresses the given input and generates a new
instance of this class.
|
void |
readFields(DataInput input) |
static CompressedPostings |
readInstance(DataInput input)
Reads an instance of this class from a given input.
|
void |
write(DataOutput output) |
public int decompressBlock(int[] outBlock,
int blockNumber)
original_data[0] = outBlock(0)
original_data[1] = original_data[0] + outBlock[1]
original_data[2] = original_data[1] + outBlock[2]
...
original_data[n-1] = original_data[n-2] + outBlock[n-1]
outBlock - Array to store the decompressed values. Note that the size
of this array must be at least equal to the size of each block.blockNumber - The block index to decompress.public int getBlockCount()
public int getBlockNumber(int index)
index - Index of an element in the original datapublic static int getBlockSize()
public int getBlockStartIndex(int blockNumber)
blockNumber - Block index.public int getPositionInBlock(int index)
index - Index of an element in the original datapublic boolean isFirstElementInBlock(int index)
index - Index of an element in the original datadecompressBlock(int[], int)public static CompressedPostings newInstance(int[] data)
data - Array of sorted document idspublic void readFields(DataInput input) throws IOException
readFields in interface WritableIOExceptionpublic static CompressedPostings readInstance(DataInput input) throws IOException
input - Data inputIOExceptionpublic void write(DataOutput output) throws IOException
write in interface WritableIOException