Class UnsignedLong

java.lang.Object
java.lang.Number
org.apache.qpid.protonj2.types.UnsignedLong
All Implemented Interfaces:
Serializable, Comparable<UnsignedLong>

public final class UnsignedLong extends Number implements Comparable<UnsignedLong>
See Also:
  • Field Details

  • Constructor Details

    • UnsignedLong

      public UnsignedLong(long underlying)
  • Method Details

    • intValue

      public int intValue()
      Specified by:
      intValue in class Number
    • longValue

      public long longValue()
      Specified by:
      longValue in class Number
    • bigIntegerValue

      public BigInteger bigIntegerValue()
    • floatValue

      public float floatValue()
      Specified by:
      floatValue in class Number
    • doubleValue

      public double doubleValue()
      Specified by:
      doubleValue in class Number
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(long value)
      Compares the give long value to this UnsignedLong numerically treating the given value as unsigned.
      Parameters:
      value - the long to compare to this UnsignedLong instance.
      Returns:
      the value 0 if this == value; a value less than 0 if this < value as unsigned values; and a value greater than 0 if this > value as unsigned values
    • compareTo

      public int compareTo(UnsignedLong o)
      Specified by:
      compareTo in interface Comparable<UnsignedLong>
    • compare

      public static int compare(long left, long right)
      Compares two long values numerically treating the values as unsigned.
      Parameters:
      left - the left hand side long to compare
      right - the right hand side long to compare
      Returns:
      the value 0 if left == right; a value less than 0 if left < right as unsigned values; and a value greater than 0 if left > right as unsigned values
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • valueOf

      public static UnsignedLong valueOf(long value)
      Returns an UnsignedLong instance representing the specified int value. This method always returns a cached UnsignedLong instance for values in the range [0...255] which can save space and time over calling the constructor UnsignedLong(long) which will always create a new instance of the UnsignedLong type.
      Parameters:
      value - The long value to return as an UnsignedLong instance.
      Returns:
      an UnsignedLong instance representing the unsigned view of the given long.
    • valueOf

      public static UnsignedLong valueOf(String value)
      Returns an UnsignedLong instance representing the specified String value. This method always returns a cached UnsignedLong instance for values in the range [0...255] which can save space and time over calling the constructor UnsignedLong(long) which will always create a new instance of the UnsignedLong type.
      Parameters:
      value - The String value to return as an UnsignedLong instance.
      Returns:
      an UnsignedLong instance representing the unsigned view of the given String.
      Throws:
      NumberFormatException - if the given value is greater than the max UnsignedLong value possible or the String value given cannot be converted to a numeric value.
    • valueOf

      public static UnsignedLong valueOf(BigInteger value)
      Returns an UnsignedLong instance representing the specified BigInteger value. This method always returns a cached UnsignedLong instance for values in the range [0...255] which can save space and time over calling the constructor UnsignedLong(long) which will always create a new instance of the UnsignedLong type.
      Parameters:
      value - The BigInteger value to return as an UnsignedLong instance.
      Returns:
      an UnsignedLong instance representing the unsigned view of the given BigInteger.
      Throws:
      NumberFormatException - if the given value is greater than the max UnsignedLong value possible.