com.ericsson.otp.erlang
Class OtpErlangDouble
java.lang.Object
|
+--com.ericsson.otp.erlang.OtpErlangObject
|
+--com.ericsson.otp.erlang.OtpErlangDouble
- Direct Known Subclasses:
- OtpErlangFloat
- public class OtpErlangDouble
- extends OtpErlangObject
- implements java.io.Serializable, java.lang.Cloneable
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:
- Serialized Form
Constructor Summary |
OtpErlangDouble(double d)
Create an Erlang float from the given double value. |
OtpErlangDouble(OtpInputStream buf)
Create an Erlang float from a stream containing a double encoded
in Erlang external format. |
Method Summary |
double |
doubleValue()
Get the value, as a double. |
void |
encode(OtpOutputStream buf)
Convert this double to the equivalent Erlang external representation. |
boolean |
equals(java.lang.Object o)
Determine if two floats are equal. |
float |
floatValue()
Get the value, as a float. |
java.lang.String |
toString()
Get the string representation of this double. |
Methods inherited from class java.lang.Object |
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
OtpErlangDouble
public OtpErlangDouble(double d)
- Create an Erlang float from the given double value.
OtpErlangDouble
public OtpErlangDouble(OtpInputStream buf)
throws OtpErlangDecodeException
- 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.
doubleValue
public double doubleValue()
- Get the value, as a double.
- Returns:
- the value of this object, as a double.
floatValue
public float floatValue()
throws OtpErlangRangeException
- 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
public java.lang.String toString()
- Get the string representation of this double.
- Overrides:
- toString in class OtpErlangObject
- Returns:
- the string representation of this double.
encode
public void encode(OtpOutputStream buf)
- Convert this double to the equivalent Erlang external representation.
- Overrides:
- encode in class OtpErlangObject
- Parameters:
buf
- an output stream to which the encoded value should be
written.
equals
public boolean equals(java.lang.Object o)
- Determine if two floats are equal. Floats are equal if they
contain the same value.
- Overrides:
- equals in class OtpErlangObject
- Parameters:
o
- the float to compare to.- Returns:
- true if the floats have the same value.