Class IntegerType

  • All Implemented Interfaces:
    java.util.Comparator<java.nio.ByteBuffer>, AssignmentTestable

    public final class IntegerType
    extends NumberType<java.math.BigInteger>
    • Field Detail

    • Method Detail

      • compareCustom

        public <VL,​VR> int compareCustom​(VL left,
                                               ValueAccessor<VL> accessorL,
                                               VR right,
                                               ValueAccessor<VR> accessorR)
        Description copied from class: AbstractType
        Implement IFF ComparisonType is CUSTOM Compares the byte representation of two instances of this class, for types where this cannot be done by simple in-order comparison of the unsigned bytes Standard Java compare semantics
        Overrides:
        compareCustom in class AbstractType<java.math.BigInteger>
      • compareIntegers

        public static <VL,​VR> int compareIntegers​(VL lhs,
                                                        ValueAccessor<VL> accessorL,
                                                        VR rhs,
                                                        ValueAccessor<VR> accessorR)
      • fromJSONObject

        public Term fromJSONObject​(java.lang.Object parsed)
                            throws MarshalException
        Description copied from class: AbstractType
        Given a parsed JSON string, return a byte representation of the object.
        Specified by:
        fromJSONObject in class AbstractType<java.math.BigInteger>
        Parameters:
        parsed - the result of parsing a json string
        Throws:
        MarshalException
      • toJSONString

        public java.lang.String toJSONString​(java.nio.ByteBuffer buffer,
                                             ProtocolVersion protocolVersion)
        Description copied from class: AbstractType
        Converts the specified value into its JSON representation.

        The buffer position will stay the same.

        Overrides:
        toJSONString in class AbstractType<java.math.BigInteger>
        Parameters:
        buffer - the value to convert
        protocolVersion - the protocol version to use for the conversion
        Returns:
        a JSON string representing the specified value
      • isValueCompatibleWithInternal

        public boolean isValueCompatibleWithInternal​(AbstractType<?> otherType)
        Description copied from class: AbstractType
        Needed to handle ReversedType in value-compatibility checks. Subclasses should implement this instead of isValueCompatibleWith().
        Overrides:
        isValueCompatibleWithInternal in class AbstractType<java.math.BigInteger>
      • toInt

        protected int toInt​(java.nio.ByteBuffer value)
        Description copied from class: NumberType
        Converts the specified value into an int if allowed.
        Overrides:
        toInt in class NumberType<java.math.BigInteger>
        Parameters:
        value - the value to convert
        Returns:
        the converted value
      • toFloat

        protected float toFloat​(java.nio.ByteBuffer value)
        Description copied from class: NumberType
        Converts the specified value into a float if allowed.
        Overrides:
        toFloat in class NumberType<java.math.BigInteger>
        Parameters:
        value - the value to convert
        Returns:
        the converted value
      • toLong

        protected long toLong​(java.nio.ByteBuffer value)
        Description copied from class: NumberType
        Converts the specified value into a long if allowed.
        Overrides:
        toLong in class NumberType<java.math.BigInteger>
        Parameters:
        value - the value to convert
        Returns:
        the converted value
      • toDouble

        protected double toDouble​(java.nio.ByteBuffer value)
        Description copied from class: NumberType
        Converts the specified value into a double if allowed.
        Overrides:
        toDouble in class NumberType<java.math.BigInteger>
        Parameters:
        value - the value to convert
        Returns:
        the converted value
      • toBigInteger

        protected java.math.BigInteger toBigInteger​(java.nio.ByteBuffer value)
        Description copied from class: NumberType
        Converts the specified value into a BigInteger if allowed.
        Overrides:
        toBigInteger in class NumberType<java.math.BigInteger>
        Parameters:
        value - the value to convert
        Returns:
        the converted value
      • toBigDecimal

        protected java.math.BigDecimal toBigDecimal​(java.nio.ByteBuffer value)
        Description copied from class: NumberType
        Converts the specified value into a BigDecimal.
        Overrides:
        toBigDecimal in class NumberType<java.math.BigInteger>
        Parameters:
        value - the value to convert
        Returns:
        the converted value
      • add

        public java.nio.ByteBuffer add​(NumberType<?> leftType,
                                       java.nio.ByteBuffer left,
                                       NumberType<?> rightType,
                                       java.nio.ByteBuffer right)
        Description copied from class: NumberType
        Adds the left argument to the right one.
        Specified by:
        add in class NumberType<java.math.BigInteger>
        Parameters:
        leftType - the type associated to the left argument
        left - the left argument
        rightType - the type associated to the right argument
        right - the right argument
        Returns:
        the addition result
      • substract

        public java.nio.ByteBuffer substract​(NumberType<?> leftType,
                                             java.nio.ByteBuffer left,
                                             NumberType<?> rightType,
                                             java.nio.ByteBuffer right)
        Description copied from class: NumberType
        Substracts the left argument from the right one.
        Specified by:
        substract in class NumberType<java.math.BigInteger>
        Parameters:
        leftType - the type associated to the left argument
        left - the left argument
        rightType - the type associated to the right argument
        right - the right argument
        Returns:
        the substraction result
      • multiply

        public java.nio.ByteBuffer multiply​(NumberType<?> leftType,
                                            java.nio.ByteBuffer left,
                                            NumberType<?> rightType,
                                            java.nio.ByteBuffer right)
        Description copied from class: NumberType
        Multiplies the left argument with the right one.
        Specified by:
        multiply in class NumberType<java.math.BigInteger>
        Parameters:
        leftType - the type associated to the left argument
        left - the left argument
        rightType - the type associated to the right argument
        right - the right argument
        Returns:
        the multiplication result
      • divide

        public java.nio.ByteBuffer divide​(NumberType<?> leftType,
                                          java.nio.ByteBuffer left,
                                          NumberType<?> rightType,
                                          java.nio.ByteBuffer right)
        Description copied from class: NumberType
        Divides the left argument by the right one.
        Specified by:
        divide in class NumberType<java.math.BigInteger>
        Parameters:
        leftType - the type associated to the left argument
        left - the left argument
        rightType - the type associated to the right argument
        right - the right argument
        Returns:
        the division result
      • mod

        public java.nio.ByteBuffer mod​(NumberType<?> leftType,
                                       java.nio.ByteBuffer left,
                                       NumberType<?> rightType,
                                       java.nio.ByteBuffer right)
        Description copied from class: NumberType
        Return the remainder.
        Specified by:
        mod in class NumberType<java.math.BigInteger>
        Parameters:
        leftType - the type associated to the left argument
        left - the left argument
        rightType - the type associated to the right argument
        right - the right argument
        Returns:
        the remainder
      • negate

        public java.nio.ByteBuffer negate​(java.nio.ByteBuffer input)
        Description copied from class: NumberType
        Negates the argument.
        Specified by:
        negate in class NumberType<java.math.BigInteger>
        Parameters:
        input - the argument to negate
        Returns:
        the negated argument