public abstract class BasicDataType<T> extends java.lang.Object implements DataType<T>
| Constructor and Description |
|---|
BasicDataType() |
| Modifier and Type | Method and Description |
|---|---|
int |
binarySearch(T key,
java.lang.Object storageObj,
int size,
int initialGuess)
Perform binary search for the key within the storage
|
protected T[] |
cast(java.lang.Object storage)
Cast the storage object to an array of type T.
|
int |
compare(T a,
T b)
Compare two keys.
|
boolean |
equals(java.lang.Object obj) |
abstract int |
getMemory(T obj)
Calculates the amount of used memory in bytes.
|
int |
hashCode() |
boolean |
isMemoryEstimationAllowed()
Whether memory estimation based on previously seen values is allowed/desirable
|
abstract 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.
|
abstract void |
write(WriteBuffer buff,
T obj)
Write an object.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitcreateStoragepublic abstract int getMemory(T obj)
DataTypepublic abstract void write(WriteBuffer buff, T obj)
DataTypepublic abstract T read(java.nio.ByteBuffer buff)
DataTypepublic boolean isMemoryEstimationAllowed()
DataTypeisMemoryEstimationAllowed in interface DataType<T>public int binarySearch(T key, java.lang.Object storageObj, int size, int initialGuess)
DataTypebinarySearch in interface DataType<T>key - to search forstorageObj - to search within (an array of type T)size - number of data items in the storageinitialGuess - for key positionpublic void write(WriteBuffer buff, java.lang.Object storage, int len)
DataTypepublic void read(java.nio.ByteBuffer buff,
java.lang.Object storage,
int len)
DataTypepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in interface java.util.Comparator<T>equals in class java.lang.Objectprotected final T[] cast(java.lang.Object storage)
storage - the storage object