Package com.ericsson.otp.erlang
Class OtpErlangLong
- java.lang.Object
- 
- com.ericsson.otp.erlang.OtpErlangObject
- 
- com.ericsson.otp.erlang.OtpErlangLong
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Cloneable
 - Direct Known Subclasses:
- OtpErlangByte,- OtpErlangChar,- OtpErlangInt,- OtpErlangShort,- OtpErlangUInt,- OtpErlangUShort
 
 public class OtpErlangLong extends OtpErlangObject Provides a Java representation of Erlang integral types. Erlang does not distinguish between different integral types, however this class and its subclassesOtpErlangByte,OtpErlangChar,OtpErlangInt, andOtpErlangShortattempt to map the Erlang types onto the various Java integral types. Two additional classes,OtpErlangUIntandOtpErlangUShortare provided for Corba compatibility. See the documentation for IC for more information.- See Also:
- Serialized Form
 
- 
- 
Nested Class Summary- 
Nested classes/interfaces inherited from class com.ericsson.otp.erlang.OtpErlangObjectOtpErlangObject.Hash
 
- 
 - 
Field Summary- 
Fields inherited from class com.ericsson.otp.erlang.OtpErlangObjecthashCodeValue
 
- 
 - 
Constructor SummaryConstructors Constructor Description OtpErlangLong(long l)Create an Erlang integer from the given value.OtpErlangLong(OtpInputStream buf)Create an Erlang integer from a stream containing an integer encoded in Erlang external format.OtpErlangLong(java.math.BigInteger v)Create an Erlang integer from the given value.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigIntegerbigIntegerValue()Get this number as a BigInteger.intbitLength()Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit.bytebyteValue()Get this number as a byte.charcharValue()Get this number as a char.protected intdoHashCode()voidencode(OtpOutputStream buf)Convert this number to the equivalent Erlang external representation.booleanequals(java.lang.Object o)Determine if two numbers are equal.intintValue()Get this number as an int.booleanisLong()Determine if this value can be represented as a long without truncation.booleanisULong()Determine if this value can be represented as an unsigned long without truncation, that is if the value is non-negative and its bit pattern completely fits in a long.longlongValue()Get this number as a long, or rather truncate all but the least significant 64 bits from the 2's complement representation of this number and return them as a long.shortshortValue()Get this number as a short.intsignum()Return the signum function of this object.java.lang.StringtoString()Get the string representation of this number.intuIntValue()Get this number as a non-negative int.shortuShortValue()Get this number as a non-negative short.
 
- 
- 
- 
Constructor Detail- 
OtpErlangLongpublic OtpErlangLong(long l) Create an Erlang integer from the given value.- Parameters:
- l- the long value to use.
 
 - 
OtpErlangLongpublic OtpErlangLong(java.math.BigInteger v) Create an Erlang integer from the given value.- Parameters:
- v- the big integer value to use.
 
 - 
OtpErlangLongpublic OtpErlangLong(OtpInputStream buf) throws OtpErlangDecodeException Create an Erlang integer from a stream containing an integer 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 integer.
 
 
- 
 - 
Method Detail- 
bigIntegerValuepublic java.math.BigInteger bigIntegerValue() Get this number as a BigInteger.- Returns:
- the value of this number, as a BigInteger.
 
 - 
longValuepublic long longValue() Get this number as a long, or rather truncate all but the least significant 64 bits from the 2's complement representation of this number and return them as a long.- Returns:
- the value of this number, as a long.
 
 - 
isLongpublic boolean isLong() Determine if this value can be represented as a long without truncation.- Returns:
- true if this value fits in a long, false otherwise.
 
 - 
isULongpublic boolean isULong() Determine if this value can be represented as an unsigned long without truncation, that is if the value is non-negative and its bit pattern completely fits in a long.- Returns:
- true if this value is non-negative and fits in a long false otherwise.
 
 - 
bitLengthpublic int bitLength() Returns the number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit.- Returns:
- number of bits in the minimal two's-complement representation of this BigInteger, excluding a sign bit.
 
 - 
signumpublic int signum() Return the signum function of this object.- Returns:
- -1, 0 or 1 as the value is negative, zero or positive.
 
 - 
intValuepublic int intValue() throws OtpErlangRangeExceptionGet this number as an int.- Returns:
- the value of this number, as an int.
- Throws:
- OtpErlangRangeException- if the value is too large to be represented as an int.
 
 - 
uIntValuepublic int uIntValue() throws OtpErlangRangeExceptionGet this number as a non-negative int.- Returns:
- the value of this number, as an int.
- Throws:
- OtpErlangRangeException- if the value is too large to be represented as an int, or if the value is negative.
 
 - 
shortValuepublic short shortValue() throws OtpErlangRangeExceptionGet this number as a short.- Returns:
- the value of this number, as a short.
- Throws:
- OtpErlangRangeException- if the value is too large to be represented as a short.
 
 - 
uShortValuepublic short uShortValue() throws OtpErlangRangeExceptionGet this number as a non-negative short.- Returns:
- the value of this number, as a short.
- Throws:
- OtpErlangRangeException- if the value is too large to be represented as a short, or if the value is negative.
 
 - 
charValuepublic char charValue() throws OtpErlangRangeExceptionGet this number as a char.- Returns:
- the char value of this number.
- Throws:
- OtpErlangRangeException- if the value is too large to be represented as a char.
 
 - 
byteValuepublic byte byteValue() throws OtpErlangRangeExceptionGet this number as a byte.- Returns:
- the byte value of this number.
- Throws:
- OtpErlangRangeException- if the value is too large to be represented as a byte.
 
 - 
toStringpublic java.lang.String toString() Get the string representation of this number.- Specified by:
- toStringin class- OtpErlangObject
- Returns:
- the string representation of this number.
 
 - 
encodepublic void encode(OtpOutputStream buf) Convert this number to the equivalent Erlang external representation.- Specified by:
- encodein class- OtpErlangObject
- Parameters:
- buf- an output stream to which the encoded number should be written.
 
 - 
equalspublic boolean equals(java.lang.Object o) Determine if two numbers are equal. Numbers are equal if they contain the same value.- Specified by:
- equalsin class- OtpErlangObject
- Parameters:
- o- the number to compare to.
- Returns:
- true if the numbers have the same value.
 
 - 
doHashCodeprotected int doHashCode() - Overrides:
- doHashCodein class- OtpErlangObject
 
 
- 
 
-