Package org.h2.mvstore.db
Class ValueDataType
- java.lang.Object
-
- org.h2.mvstore.type.BasicDataType<Value>
-
- org.h2.mvstore.db.ValueDataType
-
- All Implemented Interfaces:
java.util.Comparator<Value>,DataType<Value>,StatefulDataType<Database>
public final class ValueDataType extends BasicDataType<Value> implements StatefulDataType<Database>
A row type.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classValueDataType.Factory
-
Constructor Summary
Constructors Constructor Description ValueDataType()ValueDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes)ValueDataType(Database database, int[] sortTypes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(Value a, Value b)Compare two keys.intcompareValues(Value a, Value b, int sortType)Compares the specified values.Value[]createStorage(int size)Create storage object of array type to hold valuesbooleanequals(java.lang.Object obj)ValueDataType.FactorygetFactory()intgetMemory(Value v)Calculates the amount of used memory in bytes.RowFactorygetRowFactory()inthashCode()Valueread(java.nio.ByteBuffer buff)Read an object.voidsave(WriteBuffer buff, MetaType<Database> metaType)Save the state.voidsetRowFactory(RowFactory rowFactory)voidwrite(WriteBuffer buff, Value v)Write an object.static voidwriteLong(WriteBuffer buff, long x)Writes a long.-
Methods inherited from class org.h2.mvstore.type.BasicDataType
binarySearch, cast, isMemoryEstimationAllowed, read, write
-
-
-
-
Constructor Detail
-
ValueDataType
public ValueDataType()
-
ValueDataType
public ValueDataType(Database database, int[] sortTypes)
-
ValueDataType
public ValueDataType(CastDataProvider provider, CompareMode compareMode, DataHandler handler, int[] sortTypes)
-
-
Method Detail
-
getRowFactory
public RowFactory getRowFactory()
-
setRowFactory
public void setRowFactory(RowFactory rowFactory)
-
createStorage
public Value[] createStorage(int size)
Description copied from interface:DataTypeCreate storage object of array type to hold values- Specified by:
createStoragein interfaceDataType<Value>- Parameters:
size- number of values to hold- Returns:
- storage object
-
compare
public int compare(Value a, Value b)
Description copied from interface:DataTypeCompare two keys.
-
compareValues
public int compareValues(Value a, Value b, int sortType)
Compares the specified values.- Parameters:
a- the first valueb- the second valuesortType- the sorting type- Returns:
- 0 if equal, -1 if first value is smaller for ascending or larger for descending sort type, 1 otherwise
-
getMemory
public int getMemory(Value v)
Description copied from interface:DataTypeCalculates the amount of used memory in bytes.
-
read
public Value read(java.nio.ByteBuffer buff)
Description copied from interface:DataTypeRead an object.
-
write
public void write(WriteBuffer buff, Value v)
Description copied from interface:DataTypeWrite an object.
-
writeLong
public static void writeLong(WriteBuffer buff, long x)
Writes a long.- Parameters:
buff- the target bufferx- the long value
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin interfacejava.util.Comparator<Value>- Overrides:
equalsin classBasicDataType<Value>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classBasicDataType<Value>
-
save
public void save(WriteBuffer buff, MetaType<Database> metaType)
Description copied from interface:StatefulDataTypeSave the state.- Specified by:
savein interfaceStatefulDataType<Database>- Parameters:
buff- the target buffermetaType- the meta type
-
getFactory
public ValueDataType.Factory getFactory()
- Specified by:
getFactoryin interfaceStatefulDataType<Database>
-
-