Module org.cloudi

Class OtpErlangLong

    • Constructor Detail

      • OtpErlangLong

        public OtpErlangLong​(long l)
        Create an Erlang integer from the given value.
        Parameters:
        l - the long value to use.
      • OtpErlangLong

        public OtpErlangLong​(BigInteger v)
        Create an Erlang integer from the given value.
        Parameters:
        v - the big integer value to use.
      • OtpErlangLong

        public 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

      • bigIntegerValue

        public BigInteger bigIntegerValue()
        Get this number as a BigInteger.
        Returns:
        the value of this number, as a BigInteger.
      • longValue

        public 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.
      • isLong

        public 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.
      • isULong

        public 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.
      • bitLength

        public 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.
      • signum

        public int signum()
        Return the signum function of this object.
        Returns:
        -1, 0 or 1 as the value is negative, zero or positive.
      • uIntValue

        public int uIntValue()
                      throws OtpErlangRangeException
        Get 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.
      • shortValue

        public short shortValue()
                         throws OtpErlangRangeException
        Get 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.
      • uShortValue

        public short uShortValue()
                          throws OtpErlangRangeException
        Get 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.
      • toString

        public String toString()
        Get the string representation of this number.
        Specified by:
        toString in class OtpErlangObject
        Returns:
        the string representation of this number.
      • encode

        public void encode​(OtpOutputStream buf)
        Convert this number to the equivalent Erlang external representation.
        Specified by:
        encode in class OtpErlangObject
        Parameters:
        buf - an output stream to which the encoded number should be written.
      • equals

        public boolean equals​(Object o)
        Determine if two numbers are equal. Numbers are equal if they contain the same value.
        Specified by:
        equals in class OtpErlangObject
        Parameters:
        o - the number to compare to.
        Returns:
        true if the numbers have the same value.