Package org.datavec.api.writable
Class FloatWritable
- java.lang.Object
-
- org.datavec.api.writable.FloatWritable
-
- All Implemented Interfaces:
Serializable
,Comparable
,WritableComparable
,Writable
public class FloatWritable extends Object implements WritableComparable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FloatWritable.Comparator
A Comparator optimized for FloatWritable.
-
Constructor Summary
Constructors Constructor Description FloatWritable()
FloatWritable(float value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object o)
Compares two FloatWritables.boolean
equals(Object o)
Returns true iffo
is a FloatWritable with the same value.boolean
fuzzyEquals(Writable o, double tolerance)
float
get()
Return the value of this FloatWritable.WritableType
getType()
Get the type of the writable.int
hashCode()
void
readFields(DataInput in)
Deserialize the fields of this object fromin
.void
set(float value)
Set the value of this FloatWritable.double
toDouble()
Convert Writable to double.float
toFloat()
Convert Writable to float.int
toInt()
Convert Writable to int.long
toLong()
Convert Writable to long.String
toString()
void
write(DataOutput out)
Serialize the fields of this object toout
.void
writeType(DataOutput out)
Write the type (a single short value) to the DataOutput.
-
-
-
Method Detail
-
set
public void set(float value)
Set the value of this FloatWritable.
-
get
public float get()
Return the value of this FloatWritable.
-
readFields
public void readFields(DataInput in) throws IOException
Description copied from interface:Writable
Deserialize the fields of this object fromin
.For efficiency, implementations should attempt to re-use storage in the existing object where possible.
- Specified by:
readFields
in interfaceWritable
- Parameters:
in
-DataInput
to deseriablize this object from.- Throws:
IOException
-
writeType
public void writeType(DataOutput out) throws IOException
Description copied from interface:Writable
Write the type (a single short value) to the DataOutput. SeeWritableFactory
for details.- Specified by:
writeType
in interfaceWritable
- Parameters:
out
- DataOutput to write to- Throws:
IOException
- For errors during writing
-
write
public void write(DataOutput out) throws IOException
Description copied from interface:Writable
Serialize the fields of this object toout
.- Specified by:
write
in interfaceWritable
- Parameters:
out
-DataOuput
to serialize this object into.- Throws:
IOException
-
fuzzyEquals
public boolean fuzzyEquals(Writable o, double tolerance)
-
equals
public boolean equals(Object o)
Returns true iffo
is a FloatWritable with the same value.
-
compareTo
public int compareTo(Object o)
Compares two FloatWritables.- Specified by:
compareTo
in interfaceComparable
-
toDouble
public double toDouble()
Description copied from interface:Writable
Convert Writable to double. Whether this is supported depends on the specific writable.
-
toFloat
public float toFloat()
Description copied from interface:Writable
Convert Writable to float. Whether this is supported depends on the specific writable.
-
toInt
public int toInt()
Description copied from interface:Writable
Convert Writable to int. Whether this is supported depends on the specific writable.
-
toLong
public long toLong()
Description copied from interface:Writable
Convert Writable to long. Whether this is supported depends on the specific writable.
-
getType
public WritableType getType()
Description copied from interface:Writable
Get the type of the writable.
-
-