modnlp.idx.database
public class IntOffsetArrayBinding extends com.sleepycat.bind.tuple.TupleBinding
for each offset
if (offset < max_size_of_unsigned_byte)
store it as unsigned_byte
else
store an overflow marker // i.e. an unsigned byte of value 255
store offset as unsigned_int
end if
end for
This is a simple enough strategy that typically achieves a 75%
compression ratio (w.r.t. storage of absolute positions). Although the algorithm works for any ordered sequence of ints
Caveat: we currently make no effort to store offsets greater than
the max size of an unsigned_intWordPositionTable| Modifier and Type | Field and Description |
|---|---|
static long |
MAXOFFSET_VALUE |
| Constructor and Description |
|---|
IntOffsetArrayBinding() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
entryToObject(com.sleepycat.bind.tuple.TupleInput ti) |
int |
getBytesReceived()
Get no.
|
int |
getBytesWritten()
Get no of bytes actually written into the Object stream so far
|
double |
getCompressionRatio()
getCompressionRatio return the compression ratio given
by bytesWritten/bytesReceived; |
void |
objectToEntry(java.lang.Object object,
com.sleepycat.bind.tuple.TupleOutput to) |
entryToObject, getPrimitiveBinding, objectToEntrypublic void objectToEntry(java.lang.Object object,
com.sleepycat.bind.tuple.TupleOutput to)
objectToEntry in class com.sleepycat.bind.tuple.TupleBindingpublic java.lang.Object entryToObject(com.sleepycat.bind.tuple.TupleInput ti)
entryToObject in class com.sleepycat.bind.tuple.TupleBindingpublic double getCompressionRatio()
getCompressionRatio return the compression ratio given
by bytesWritten/bytesReceived;public int getBytesReceived()
int valuepublic int getBytesWritten()
int value