Package com.ericsson.otp.erlang
Class OtpErlangDouble
java.lang.Object
com.ericsson.otp.erlang.OtpErlangObject
com.ericsson.otp.erlang.OtpErlangDouble
- All Implemented Interfaces:
Serializable,Cloneable
- Direct Known Subclasses:
OtpErlangFloat
Provides a Java representation of Erlang floats and doubles. Erlang defines
only one floating point numeric type, however this class and its subclass
OtpErlangFloat are used to provide representations corresponding to
the Java types Double and Float.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ericsson.otp.erlang.OtpErlangObject
OtpErlangObject.Hash -
Field Summary
Fields inherited from class com.ericsson.otp.erlang.OtpErlangObject
hashCodeValue -
Constructor Summary
ConstructorsConstructorDescriptionOtpErlangDouble(double d) Create an Erlang float from the given double value.Create an Erlang float from a stream containing a double encoded in Erlang external format. -
Method Summary
Modifier and TypeMethodDescriptionprotected intdoubleGet the value, as a double.voidencode(OtpOutputStream buf) Convert this double to the equivalent Erlang external representation.booleanDetermine if two floats are equal.floatGet the value, as a float.toString()Get the string representation of this double.
-
Constructor Details
-
OtpErlangDouble
public OtpErlangDouble(double d) Create an Erlang float from the given double value. -
OtpErlangDouble
Create an Erlang float from a stream containing a double encoded in Erlang external format.- Parameters:
buf- the stream containing the encoded value.- Throws:
OtpErlangDecodeException- if the buffer does not contain a valid external representation of an Erlang float.
-
-
Method Details
-
doubleValue
public double doubleValue()Get the value, as a double.- Returns:
- the value of this object, as a double.
-
floatValue
Get the value, as a float.- Returns:
- the value of this object, as a float.
- Throws:
OtpErlangRangeException- if the value cannot be represented as a float.
-
toString
Get the string representation of this double.- Specified by:
toStringin classOtpErlangObject- Returns:
- the string representation of this double.
-
encode
Convert this double to the equivalent Erlang external representation.- Specified by:
encodein classOtpErlangObject- Parameters:
buf- an output stream to which the encoded value should be written.
-
equals
Determine if two floats are equal. Floats are equal if they contain the same value.- Specified by:
equalsin classOtpErlangObject- Parameters:
o- the float to compare to.- Returns:
- true if the floats have the same value.
-
doHashCode
protected int doHashCode()- Overrides:
doHashCodein classOtpErlangObject
-