Class ShortType

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

    public class ShortType
    extends NumberType<java.lang.Short>
    • Field Detail

      • instance

        public static final ShortType instance
    • 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.lang.Short>
      • 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.lang.Short>
        Parameters:
        buffer - the value to convert
        protocolVersion - the protocol version to use for the conversion
        Returns:
        a JSON string representing the specified value
      • toShort

        public short toShort​(java.nio.ByteBuffer value)
        Description copied from class: NumberType
        Converts the specified value into a short if allowed.
        Overrides:
        toShort in class NumberType<java.lang.Short>
        Parameters:
        value - the value to convert
        Returns:
        the converted value
      • toInt

        public 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.lang.Short>
        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.lang.Short>
        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.lang.Short>
        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.lang.Short>
        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.lang.Short>
        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.lang.Short>
        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.lang.Short>
        Parameters:
        input - the argument to negate
        Returns:
        the negated argument