Package org.apache.flink.types
Class DoubleValue
- java.lang.Object
-
- org.apache.flink.types.DoubleValue
-
- All Implemented Interfaces:
Serializable
,Comparable<DoubleValue>
,IOReadableWritable
,CopyableValue<DoubleValue>
,ResettableValue<DoubleValue>
,Value
@Public public class DoubleValue extends Object implements Comparable<DoubleValue>, ResettableValue<DoubleValue>, CopyableValue<DoubleValue>
Boxed serializable and comparable double precision floating point type, representing the primitive typedouble
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DoubleValue()
Initializes the encapsulated double with 0.0.DoubleValue(double value)
Initializes the encapsulated double with the provided value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(DoubleValue o)
DoubleValue
copy()
Performs a deep copy of this object into a new instance.void
copy(DataInputView source, DataOutputView target)
Copies the next serialized instance fromsource
totarget
.void
copyTo(DoubleValue target)
Performs a deep copy of this object into thetarget
instance.boolean
equals(Object obj)
int
getBinaryLength()
Gets the length of the data type when it is serialized, in bytes.double
getValue()
Returns the value of the encapsulated primitive double.int
hashCode()
void
read(DataInputView in)
Reads the object's internal data from the given data input view.void
setValue(double value)
Sets the value of the encapsulated primitive double.void
setValue(DoubleValue value)
Sets the encapsulated value to another valueString
toString()
void
write(DataOutputView out)
Writes the object's internal data to the given data output view.
-
-
-
Method Detail
-
getValue
public double getValue()
Returns the value of the encapsulated primitive double.- Returns:
- the value of the encapsulated primitive double.
-
setValue
public void setValue(double value)
Sets the value of the encapsulated primitive double.- Parameters:
value
- the new value of the encapsulated primitive double.
-
setValue
public void setValue(DoubleValue value)
Description copied from interface:ResettableValue
Sets the encapsulated value to another value- Specified by:
setValue
in interfaceResettableValue<DoubleValue>
- Parameters:
value
- the new value of the encapsulated value
-
read
public void read(DataInputView in) throws IOException
Description copied from interface:IOReadableWritable
Reads the object's internal data from the given data input view.- Specified by:
read
in interfaceIOReadableWritable
- Parameters:
in
- the input view to read the data from- Throws:
IOException
- thrown if any error occurs while reading from the input stream
-
write
public void write(DataOutputView out) throws IOException
Description copied from interface:IOReadableWritable
Writes the object's internal data to the given data output view.- Specified by:
write
in interfaceIOReadableWritable
- Parameters:
out
- the output view to receive the data.- Throws:
IOException
- thrown if any error occurs while writing to the output stream
-
compareTo
public int compareTo(DoubleValue o)
- Specified by:
compareTo
in interfaceComparable<DoubleValue>
-
getBinaryLength
public int getBinaryLength()
Description copied from interface:CopyableValue
Gets the length of the data type when it is serialized, in bytes.- Specified by:
getBinaryLength
in interfaceCopyableValue<DoubleValue>
- Returns:
- The length of the data type, or
-1
, if variable length.
-
copyTo
public void copyTo(DoubleValue target)
Description copied from interface:CopyableValue
Performs a deep copy of this object into thetarget
instance.- Specified by:
copyTo
in interfaceCopyableValue<DoubleValue>
- Parameters:
target
- Object to copy into.
-
copy
public DoubleValue copy()
Description copied from interface:CopyableValue
Performs a deep copy of this object into a new instance.This method is useful for generic user-defined functions to clone a
CopyableValue
when storing multiple objects. With object reuse a deep copy must be created and type erasure prevents calling new.- Specified by:
copy
in interfaceCopyableValue<DoubleValue>
- Returns:
- New object with copied fields.
-
copy
public void copy(DataInputView source, DataOutputView target) throws IOException
Description copied from interface:CopyableValue
Copies the next serialized instance fromsource
totarget
.This method is equivalent to calling
IOReadableWritable.read(DataInputView)
followed byIOReadableWritable.write(DataOutputView)
but does not require intermediate deserialization.- Specified by:
copy
in interfaceCopyableValue<DoubleValue>
- Parameters:
source
- Data source for serialized instance.target
- Data target for serialized instance.- Throws:
IOException
- See Also:
IOReadableWritable
-
-