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
,LobStorageMap.BlobMeta.Type
,LobStorageMap.BlobReference.Type
,LongDataType
,MetaType
,MVStoreTool.GenericDataType
,ObjectDataType
,ObjectDataType.AutoDetectDataType
,Record.Type
,RowDataType
,SpatialDataType
,StringDataType
,ValueDataType
,VersionedValueType
The base class for data type implementations.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
binarySearch
(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.int
Compare two keys.boolean
abstract int
Calculates the amount of used memory in bytes.int
hashCode()
boolean
Whether memory estimation based on previously seen values is allowed/desirableabstract 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.abstract void
write
(WriteBuffer buff, T obj) Write an object.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface org.h2.mvstore.type.DataType
createStorage
-
Constructor Details
-
BasicDataType
public BasicDataType()
-
-
Method Details
-
getMemory
Description copied from interface:DataType
Calculates the amount of used memory in bytes. -
write
Description copied from interface:DataType
Write an object. -
read
Description copied from interface:DataType
Read an object. -
compare
Description copied from interface:DataType
Compare two keys. -
isMemoryEstimationAllowed
public boolean isMemoryEstimationAllowed()Description copied from interface:DataType
Whether memory estimation based on previously seen values is allowed/desirable- Specified by:
isMemoryEstimationAllowed
in interfaceDataType<T>
- Returns:
- true if memory estimation is allowed
-
binarySearch
Description copied from interface:DataType
Perform binary search for the key within the storage- Specified by:
binarySearch
in 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:DataType
Write a list of objects. -
read
Description copied from interface:DataType
Read a list of objects. -
hashCode
public int hashCode() -
equals
- Specified by:
equals
in interfaceComparator<T>
- Overrides:
equals
in classObject
-
cast
Cast the storage object to an array of type T.- Parameters:
storage
- the storage object- Returns:
- the array
-