Package org.apache.qpid.protonj2.types
Class UnsignedLong
- java.lang.Object
-
- java.lang.Number
-
- org.apache.qpid.protonj2.types.UnsignedLong
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<UnsignedLong>
public final class UnsignedLong extends java.lang.Number implements java.lang.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 java.math.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(java.lang.Object o)
float
floatValue()
int
hashCode()
int
intValue()
long
longValue()
java.lang.String
toString()
static UnsignedLong
valueOf(long value)
Returns an UnsignedLong instance representing the specified int value.static UnsignedLong
valueOf(java.lang.String value)
Returns anUnsignedLong
instance representing the specifiedString
value.static UnsignedLong
valueOf(java.math.BigInteger value)
Returns anUnsignedLong
instance representing the specifiedBigInteger
value.
-
-
-
Field Detail
-
ZERO
public static final UnsignedLong ZERO
-
ONE
public static final UnsignedLong ONE
-
MAX_VALUE
public static final UnsignedLong MAX_VALUE
-
-
Method Detail
-
intValue
public int intValue()
- Specified by:
intValue
in classjava.lang.Number
-
longValue
public long longValue()
- Specified by:
longValue
in classjava.lang.Number
-
bigIntegerValue
public java.math.BigInteger bigIntegerValue()
-
floatValue
public float floatValue()
- Specified by:
floatValue
in classjava.lang.Number
-
doubleValue
public double doubleValue()
- Specified by:
doubleValue
in classjava.lang.Number
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
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 interfacejava.lang.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 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()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
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(java.lang.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:
java.lang.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(java.math.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:
java.lang.NumberFormatException
- if the given value is greater than the maxUnsignedLong
value possible.
-
-