public interface DataType<T>
extends java.util.Comparator<T>
| Modifier and Type | Method and Description |
|---|---|
int |
binarySearch(T key,
java.lang.Object storage,
int size,
int initialGuess)
Perform binary search for the key within the storage
|
int |
compare(T a,
T b)
Compare two keys.
|
T[] |
createStorage(int size)
Create storage object of array type to hold values
|
int |
getMemory(T obj)
Calculates the amount of used memory in bytes.
|
boolean |
isMemoryEstimationAllowed()
Whether memory estimation based on previously seen values is allowed/desirable
|
T |
read(java.nio.ByteBuffer buff)
Read an object.
|
void |
read(java.nio.ByteBuffer buff,
java.lang.Object storage,
int len)
Read a list of objects.
|
void |
write(WriteBuffer buff,
java.lang.Object storage,
int len)
Write a list of objects.
|
void |
write(WriteBuffer buff,
T obj)
Write an object.
|
int compare(T a, T b)
compare in interface java.util.Comparator<T>a - the first keyb - the second keyjava.lang.UnsupportedOperationException - if the type is not orderableint binarySearch(T key, java.lang.Object storage, int size, int initialGuess)
key - to search forstorage - to search within (an array of type T)size - number of data items in the storageinitialGuess - for key positionint getMemory(T obj)
obj - the objectboolean isMemoryEstimationAllowed()
void write(WriteBuffer buff, T obj)
buff - the target bufferobj - the valuevoid write(WriteBuffer buff, java.lang.Object storage, int len)
buff - the target bufferstorage - the objectslen - the number of objects to writeT read(java.nio.ByteBuffer buff)
buff - the source buffervoid read(java.nio.ByteBuffer buff,
java.lang.Object storage,
int len)
buff - the target bufferstorage - the objectslen - the number of objects to readT[] createStorage(int size)
size - number of values to hold