Package org.h2.mvstore.type
Class ObjectDataType.DoubleType
- java.lang.Object
-
- org.h2.mvstore.type.BasicDataType<T>
-
- org.h2.mvstore.type.ObjectDataType.AutoDetectDataType<java.lang.Double>
-
- org.h2.mvstore.type.ObjectDataType.DoubleType
-
- All Implemented Interfaces:
java.util.Comparator<java.lang.Double>
,DataType<java.lang.Double>
- Enclosing class:
- ObjectDataType
static class ObjectDataType.DoubleType extends ObjectDataType.AutoDetectDataType<java.lang.Double>
The type for double objects.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static ObjectDataType.DoubleType
INSTANCE
The only instance of this type.-
Fields inherited from class org.h2.mvstore.type.ObjectDataType.AutoDetectDataType
typeId
-
-
Constructor Summary
Constructors Modifier Constructor Description private
DoubleType()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(java.lang.Double a, java.lang.Double b)
Compare two keys.java.lang.Double[]
createStorage(int size)
Create storage object of array type to hold valuesint
getMemory(java.lang.Double obj)
Calculates the amount of used memory in bytes.java.lang.Double
read(java.nio.ByteBuffer buff)
Read an object.java.lang.Double
read(java.nio.ByteBuffer buff, int tag)
Read an object from the buffer.void
write(WriteBuffer buff, java.lang.Double obj)
Write an object.-
Methods inherited from class org.h2.mvstore.type.ObjectDataType.AutoDetectDataType
getType
-
Methods inherited from class org.h2.mvstore.type.BasicDataType
binarySearch, cast, equals, hashCode, isMemoryEstimationAllowed, read, write
-
-
-
-
Field Detail
-
INSTANCE
static final ObjectDataType.DoubleType INSTANCE
The only instance of this type.
-
-
Method Detail
-
createStorage
public java.lang.Double[] createStorage(int size)
Description copied from interface:DataType
Create storage object of array type to hold values- Parameters:
size
- number of values to hold- Returns:
- storage object
-
compare
public int compare(java.lang.Double a, java.lang.Double b)
Description copied from interface:DataType
Compare two keys.- Specified by:
compare
in interfacejava.util.Comparator<java.lang.Double>
- Specified by:
compare
in interfaceDataType<java.lang.Double>
- Overrides:
compare
in classBasicDataType<java.lang.Double>
- Parameters:
a
- the first keyb
- the second key- Returns:
- -1 if the first key is smaller, 1 if larger, and 0 if equal
-
getMemory
public int getMemory(java.lang.Double obj)
Description copied from interface:DataType
Calculates the amount of used memory in bytes.- Specified by:
getMemory
in interfaceDataType<java.lang.Double>
- Overrides:
getMemory
in classObjectDataType.AutoDetectDataType<java.lang.Double>
- Parameters:
obj
- the object- Returns:
- the used memory
-
write
public void write(WriteBuffer buff, java.lang.Double obj)
Description copied from interface:DataType
Write an object.- Specified by:
write
in interfaceDataType<java.lang.Double>
- Overrides:
write
in classObjectDataType.AutoDetectDataType<java.lang.Double>
- Parameters:
buff
- the target bufferobj
- the value
-
read
public java.lang.Double read(java.nio.ByteBuffer buff)
Description copied from interface:DataType
Read an object.- Specified by:
read
in interfaceDataType<java.lang.Double>
- Specified by:
read
in classBasicDataType<java.lang.Double>
- Parameters:
buff
- the source buffer- Returns:
- the object
-
read
public java.lang.Double read(java.nio.ByteBuffer buff, int tag)
Description copied from class:ObjectDataType.AutoDetectDataType
Read an object from the buffer.- Specified by:
read
in classObjectDataType.AutoDetectDataType<java.lang.Double>
- Parameters:
buff
- the buffertag
- the first byte of the object (usually the type)- Returns:
- the read object
-
-