Class CassandraUInt


  • public class CassandraUInt
    extends java.lang.Object
    This class packages several UInt utility methods so we can easily change it's implementation when needed.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long MAX_VALUE_LONG
      Returns the long representation of the maximum value we can hold
      static int MAX_VALUE_UINT
      Returns the UInt representation of the maximum value we can hold
    • Constructor Summary

      Constructors 
      Constructor Description
      CassandraUInt()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int compare​(int x, int y)
      Compare 2 Uints
      static int fromLong​(long value)
      Converts a long to it's unsigned integer representation
      static int[] fromLong​(long[] values)
      The same but works on an array on longs
      static long toLong​(int value)
      Returns the long resulting from parsing the int as an unsigned integer
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • MAX_VALUE_LONG

        public static final long MAX_VALUE_LONG
        Returns the long representation of the maximum value we can hold
      • MAX_VALUE_UINT

        public static final int MAX_VALUE_UINT
        Returns the UInt representation of the maximum value we can hold
    • Constructor Detail

      • CassandraUInt

        public CassandraUInt()
    • Method Detail

      • fromLong

        public static int fromLong​(long value)
        Converts a long to it's unsigned integer representation
        Parameters:
        value - A long between 0 and 232-1 inclusive
        Returns:
        an unsigned integer representation of the long
        Throws:
        java.lang.IllegalArgumentException - if value '< 0' or '>= 232'
      • fromLong

        public static int[] fromLong​(long[] values)
        The same but works on an array on longs
      • toLong

        public static long toLong​(int value)
        Returns the long resulting from parsing the int as an unsigned integer
        Parameters:
        value - Unsigned integer representation of the long
        Returns:
        The long resulting from parsing the int as an unsigned integer
      • compare

        public static int compare​(int x,
                                  int y)
        Compare 2 Uints
        Returns:
        < 0 if x is less than y. > 0 if x is greater than y. Zero if they are equal