Package org.h2.mvstore.type
Class BasicDataType<T>
- java.lang.Object
-
- org.h2.mvstore.type.BasicDataType<T>
-
- All Implemented Interfaces:
java.util.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
public abstract class BasicDataType<T> extends java.lang.Object implements DataType<T>
The base class for data type implementations.
-
-
Constructor Summary
Constructors Constructor Description BasicDataType()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intbinarySearch(T key, java.lang.Object storageObj, int size, int initialGuess)Perform binary search for the key within the storageprotected T[]cast(java.lang.Object storage)Cast the storage object to an array of type T.intcompare(T a, T b)Compare two keys.booleanequals(java.lang.Object obj)abstract intgetMemory(T obj)Calculates the amount of used memory in bytes.inthashCode()booleanisMemoryEstimationAllowed()Whether memory estimation based on previously seen values is allowed/desirableabstract Tread(java.nio.ByteBuffer buff)Read an object.voidread(java.nio.ByteBuffer buff, java.lang.Object storage, int len)Read a list of objects.voidwrite(WriteBuffer buff, java.lang.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, 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
-
-
-
-
Method Detail
-
getMemory
public abstract int getMemory(T obj)
Description copied from interface:DataTypeCalculates the amount of used memory in bytes.
-
write
public abstract void write(WriteBuffer buff, T obj)
Description copied from interface:DataTypeWrite an object.
-
read
public abstract T read(java.nio.ByteBuffer buff)
Description copied from interface:DataTypeRead an object.
-
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
public int binarySearch(T key, java.lang.Object storageObj, int size, int initialGuess)
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
public void write(WriteBuffer buff, java.lang.Object storage, int len)
Description copied from interface:DataTypeWrite a list of objects.
-
read
public void read(java.nio.ByteBuffer buff, java.lang.Object storage, int len)Description copied from interface:DataTypeRead a list of objects.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin interfacejava.util.Comparator<T>- Overrides:
equalsin classjava.lang.Object
-
cast
protected final T[] cast(java.lang.Object storage)
Cast the storage object to an array of type T.- Parameters:
storage- the storage object- Returns:
- the array
-
-