public interface DataType<T> extends Comparator<T>
| 限定符和类型 | 方法和说明 |
|---|---|
int |
binarySearch(T key,
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(ByteBuffer buff)
Read an object.
|
void |
read(ByteBuffer buff,
Object storage,
int len)
Read a list of objects.
|
void |
write(WriteBuffer buff,
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 在接口中 Comparator<T>a - the first keyb - the second keyUnsupportedOperationException - if the type is not orderableint binarySearch(T key, 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, Object storage, int len)
buff - the target bufferstorage - the objectslen - the number of objects to writeT read(ByteBuffer buff)
buff - the source buffervoid read(ByteBuffer buff, Object storage, int len)
buff - the target bufferstorage - the objectslen - the number of objects to readT[] createStorage(int size)
size - number of values to holdCopyright © 2022. All rights reserved.