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>
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final UnsignedLong
static final UnsignedLong
static final UnsignedLong
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
double
boolean
float
int
hashCode()
int
intValue()
long
toString()
static UnsignedLong
valueOf
(long value) Returns an UnsignedLong instance representing the specified int value.static UnsignedLong
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 Details
-
ZERO
-
ONE
-
MAX_VALUE
-
-
Constructor Details
-
UnsignedLong
public UnsignedLong(long underlying)
-
-
Method Details
-
intValue
public int intValue() -
longValue
public long longValue() -
bigIntegerValue
-
floatValue
public float floatValue()- Specified by:
floatValue
in classNumber
-
doubleValue
public double doubleValue()- Specified by:
doubleValue
in classNumber
-
equals
-
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
- 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
-
hashCode
public int hashCode() -
toString
-
valueOf
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
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
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.
-