Package org.apache.flink.types
Class FloatValue
- java.lang.Object
-
- org.apache.flink.types.FloatValue
-
- All Implemented Interfaces:
Serializable,Comparable<FloatValue>,IOReadableWritable,CopyableValue<FloatValue>,Key<FloatValue>,ResettableValue<FloatValue>,Value
@Public public class FloatValue extends Object implements Comparable<FloatValue>, ResettableValue<FloatValue>, CopyableValue<FloatValue>, Key<FloatValue>
Boxed serializable and comparable single precision floating point type, representing the primitive typefloat.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FloatValue()Initializes the encapsulated float with 0.0.FloatValue(float value)Initializes the encapsulated float with the provided value.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(FloatValue o)FloatValuecopy()Performs a deep copy of this object into a new instance.voidcopy(DataInputView source, DataOutputView target)Copies the next serialized instance fromsourcetotarget.voidcopyTo(FloatValue target)Performs a deep copy of this object into thetargetinstance.booleanequals(Object obj)Compares the object on equality with another object.intgetBinaryLength()Gets the length of the data type when it is serialized, in bytes.floatgetValue()Returns the value of the encapsulated primitive float.inthashCode()All keys must override the hash-code function to generate proper deterministic hash codes, based on their contents.voidread(DataInputView in)Reads the object's internal data from the given data input view.voidsetValue(float value)Sets the value of the encapsulated primitive float.voidsetValue(FloatValue value)Sets the encapsulated value to another valueStringtoString()voidwrite(DataOutputView out)Writes the object's internal data to the given data output view.
-
-
-
Method Detail
-
getValue
public float getValue()
Returns the value of the encapsulated primitive float.- Returns:
- the value of the encapsulated primitive float.
-
setValue
public void setValue(float value)
Sets the value of the encapsulated primitive float.- Parameters:
value- the new value of the encapsulated primitive float.
-
setValue
public void setValue(FloatValue value)
Description copied from interface:ResettableValueSets the encapsulated value to another value- Specified by:
setValuein interfaceResettableValue<FloatValue>- Parameters:
value- the new value of the encapsulated value
-
read
public void read(DataInputView in) throws IOException
Description copied from interface:IOReadableWritableReads the object's internal data from the given data input view.- Specified by:
readin 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:IOReadableWritableWrites the object's internal data to the given data output view.- Specified by:
writein 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(FloatValue o)
- Specified by:
compareToin interfaceComparable<FloatValue>
-
hashCode
public int hashCode()
Description copied from interface:KeyAll keys must override the hash-code function to generate proper deterministic hash codes, based on their contents.- Specified by:
hashCodein interfaceKey<FloatValue>- Overrides:
hashCodein classObject- Returns:
- The hash code of the key
-
equals
public boolean equals(Object obj)
Description copied from interface:KeyCompares the object on equality with another object.- Specified by:
equalsin interfaceKey<FloatValue>- Overrides:
equalsin classObject- Parameters:
obj- The other object to compare against.- Returns:
- True, iff this object is identical to the other object, false otherwise.
-
getBinaryLength
public int getBinaryLength()
Description copied from interface:CopyableValueGets the length of the data type when it is serialized, in bytes.- Specified by:
getBinaryLengthin interfaceCopyableValue<FloatValue>- Returns:
- The length of the data type, or
-1, if variable length.
-
copyTo
public void copyTo(FloatValue target)
Description copied from interface:CopyableValuePerforms a deep copy of this object into thetargetinstance.- Specified by:
copyToin interfaceCopyableValue<FloatValue>- Parameters:
target- Object to copy into.
-
copy
public FloatValue copy()
Description copied from interface:CopyableValuePerforms a deep copy of this object into a new instance.This method is useful for generic user-defined functions to clone a
CopyableValuewhen storing multiple objects. With object reuse a deep copy must be created and type erasure prevents calling new.- Specified by:
copyin interfaceCopyableValue<FloatValue>- Returns:
- New object with copied fields.
-
copy
public void copy(DataInputView source, DataOutputView target) throws IOException
Description copied from interface:CopyableValueCopies the next serialized instance fromsourcetotarget.This method is equivalent to calling
IOReadableWritable.read(DataInputView)followed byIOReadableWritable.write(DataOutputView)but does not require intermediate deserialization.- Specified by:
copyin interfaceCopyableValue<FloatValue>- Parameters:
source- Data source for serialized instance.target- Data target for serialized instance.- Throws:
IOException- See Also:
IOReadableWritable
-
-