Package org.apache.qpid.protonj2.types
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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static UnsignedLong
MAX_VALUE
static UnsignedLong
ONE
static UnsignedLong
ZERO
-
Constructor Summary
Constructors Constructor Description UnsignedLong(long underlying)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigInteger
bigIntegerValue()
static int
compare(long left, long right)
Compares two long values numerically treating the values as unsigned.int
compareTo(long value)
Compares the give long value to thisUnsignedLong
numerically treating the given value as unsigned.int
compareTo(UnsignedLong o)
double
doubleValue()
boolean
equals(Object o)
float
floatValue()
int
hashCode()
int
intValue()
long
longValue()
String
toString()
static UnsignedLong
valueOf(long value)
Returns an UnsignedLong instance representing the specified int value.static UnsignedLong
valueOf(String value)
Returns anUnsignedLong
instance representing the specifiedString
value.static UnsignedLong
valueOf(BigInteger value)
Returns anUnsignedLong
instance representing the specifiedBigInteger
value.-
Methods inherited from class java.lang.Number
byteValue, shortValue
-
-
-
-
Field Detail
-
ZERO
public static final UnsignedLong ZERO
-
ONE
public static final UnsignedLong ONE
-
MAX_VALUE
public static final UnsignedLong MAX_VALUE
-
-
Method Detail
-
bigIntegerValue
public BigInteger bigIntegerValue()
-
floatValue
public float floatValue()
- Specified by:
floatValue
in classNumber
-
doubleValue
public double doubleValue()
- Specified by:
doubleValue
in classNumber
-
compareTo
public int compareTo(long value)
Compares the give long value to thisUnsignedLong
numerically treating the given value as unsigned.- Parameters:
value
- the long to compare to thisUnsignedLong
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 interfaceComparable<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 compareright
- 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
-
valueOf
public static UnsignedLong valueOf(long value)
Returns an UnsignedLong instance representing the specified int value. This method always returns a cachedUnsignedLong
instance for values in the range [0...255] which can save space and time over calling the constructorUnsignedLong(long)
which will always create a new instance of theUnsignedLong
type.- Parameters:
value
- The long value to return as anUnsignedLong
instance.- Returns:
- an
UnsignedLong
instance representing the unsigned view of the given long.
-
valueOf
public static UnsignedLong valueOf(String value)
Returns anUnsignedLong
instance representing the specifiedString
value. This method always returns a cachedUnsignedLong
instance for values in the range [0...255] which can save space and time over calling the constructorUnsignedLong(long)
which will always create a new instance of theUnsignedLong
type.- Parameters:
value
- The String value to return as anUnsignedLong
instance.- Returns:
- an
UnsignedLong
instance representing the unsigned view of the given String. - Throws:
NumberFormatException
- if the given value is greater than the maxUnsignedLong
value possible or theString
value given cannot be converted to a numeric value.
-
valueOf
public static UnsignedLong valueOf(BigInteger value)
Returns anUnsignedLong
instance representing the specifiedBigInteger
value. This method always returns a cachedUnsignedLong
instance for values in the range [0...255] which can save space and time over calling the constructorUnsignedLong(long)
which will always create a new instance of theUnsignedLong
type.- Parameters:
value
- TheBigInteger
value to return as anUnsignedLong
instance.- Returns:
- an
UnsignedLong
instance representing the unsigned view of the givenBigInteger
. - Throws:
NumberFormatException
- if the given value is greater than the maxUnsignedLong
value possible.
-
-