Package org.h2.mvstore.type
Class BasicDataType<T>
java.lang.Object
org.h2.mvstore.type.BasicDataType<T>
- All Implemented Interfaces:
Comparator<T>,DataType<T>
- Direct Known Subclasses:
ByteArrayDataType,IntegerDataType,LobStorageMap.BlobMeta.Type,LobStorageMap.BlobReference.Type,LongDataType,MetaType,ObjectDataType,RowDataType,RowDataType,SpatialDataType,StringDataType,ValueDataType,VersionedValueType
The base class for data type implementations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintbinarySearch(T key, Object storageObj, int size, int initialGuess) Perform binary search for the key within the storageprotected final T[]Cast the storage object to an array of type T.intCompare two keys.booleanabstract intCalculates the amount of used memory in bytes.inthashCode()booleanWhether memory estimation based on previously seen values is allowed/desirableabstract Tread(ByteBuffer buff) Read an object.voidread(ByteBuffer buff, Object storage, int len) Read a list of objects.voidwrite(WriteBuffer buff, Object storage, int len) Write a list of objects.abstract voidwrite(WriteBuffer buff, T obj) Write an object.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface org.h2.mvstore.type.DataType
createStorage
-
Constructor Details
-
BasicDataType
public BasicDataType()
-
-
Method Details
-
getMemory
Description copied from interface:DataTypeCalculates the amount of used memory in bytes. -
write
Description copied from interface:DataTypeWrite an object. -
read
Description copied from interface:DataTypeRead an object. -
compare
Description copied from interface:DataTypeCompare two keys. -
isMemoryEstimationAllowed
public boolean isMemoryEstimationAllowed()Description copied from interface:DataTypeWhether memory estimation based on previously seen values is allowed/desirable- Specified by:
isMemoryEstimationAllowedin interfaceDataType<T>- Returns:
- true if memory estimation is allowed
-
binarySearch
Description copied from interface:DataTypePerform binary search for the key within the storage- Specified by:
binarySearchin interfaceDataType<T>- Parameters:
key- to search forstorageObj- to search within (an array of type T)size- number of data items in the storageinitialGuess- for key position- Returns:
- index of the key , if found, - index of the insertion point, if not
-
write
Description copied from interface:DataTypeWrite a list of objects. -
read
Description copied from interface:DataTypeRead a list of objects. -
hashCode
public int hashCode() -
equals
- Specified by:
equalsin interfaceComparator<T>- Overrides:
equalsin classObject
-
cast
Cast the storage object to an array of type T.- Parameters:
storage- the storage object- Returns:
- the array
-