Class AbstractInt

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<java.math.BigInteger>, Codec
    Direct Known Subclasses:
    Int, UInt

    public abstract class AbstractInt
    extends java.math.BigInteger
    implements Codec
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.math.BigInteger

        ONE, TEN, TWO, ZERO
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractInt​(boolean isNegative, java.lang.Object value, int bitLength, boolean isHexJson)  
    • Method Summary

      Modifier and Type Method Description
      int bitLength()
      Returns the number of bits in the value
      boolean eq​(java.lang.Object other)
      Compares the value of the input to see if there is a match
      int getEncodedLength()
      The length of the value when encoded as a Uint8Array
      boolean isEmpty()
      Checks if the value is a zero value (align elsewhere)
      java.math.BigInteger toBn()
      Returns the BN representation of the number.
      abstract java.lang.String toHex()
      Returns a hex string representation of the value
      java.lang.Object toJson()
      Converts the Object to JSON, typically used for RPC transfers
      abstract byte[] toU8a​(boolean isBare)  
      • Methods inherited from class java.math.BigInteger

        abs, add, and, andNot, bitCount, byteValueExact, clearBit, compareTo, divide, divideAndRemainder, doubleValue, equals, flipBit, floatValue, gcd, getLowestSetBit, hashCode, intValue, intValueExact, isProbablePrime, longValue, longValueExact, max, min, mod, modInverse, modPow, multiply, negate, nextProbablePrime, not, or, pow, probablePrime, remainder, setBit, shiftLeft, shiftRight, shortValueExact, signum, sqrt, sqrtAndRemainder, subtract, testBit, toByteArray, toString, toString, valueOf, xor
      • Methods inherited from class java.lang.Number

        byteValue, shortValue
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.polkadot.types.Codec

        toU8a
    • Constructor Detail

      • AbstractInt

        public AbstractInt​(boolean isNegative,
                           java.lang.Object value,
                           int bitLength,
                           boolean isHexJson)
    • Method Detail

      • getEncodedLength

        public int getEncodedLength()
        The length of the value when encoded as a Uint8Array
        Specified by:
        getEncodedLength in interface Codec
      • isEmpty

        public boolean isEmpty()
        Checks if the value is a zero value (align elsewhere)
        Specified by:
        isEmpty in interface Codec
      • bitLength

        public int bitLength()
        Returns the number of bits in the value
        Overrides:
        bitLength in class java.math.BigInteger
      • eq

        public boolean eq​(java.lang.Object other)
        Compares the value of the input to see if there is a match
        Specified by:
        eq in interface Codec
      • toBn

        public java.math.BigInteger toBn()
        Returns the BN representation of the number. (Compatibility)
      • toHex

        public abstract java.lang.String toHex()
        Returns a hex string representation of the value
        Specified by:
        toHex in interface Codec
      • toJson

        public java.lang.Object toJson()
        Converts the Object to JSON, typically used for RPC transfers
        Specified by:
        toJson in interface Codec
      • toU8a

        public abstract byte[] toU8a​(boolean isBare)
        Specified by:
        toU8a in interface Codec
        Parameters:
        isBare - true when the value has none of the type-specific prefixes (internal) Encodes the value as a Uint8Array as per the parity-codec specifications