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 UnsignedLongMAX_VALUEstatic UnsignedLongONEstatic UnsignedLongZERO
-
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.BigIntegerbigIntegerValue()static intcompare(long left, long right)Compares two long values numerically treating the values as unsigned.intcompareTo(long value)Compares the give long value to thisUnsignedLongnumerically treating the given value as unsigned.intcompareTo(UnsignedLong o)doubledoubleValue()booleanequals(java.lang.Object o)floatfloatValue()inthashCode()intintValue()longlongValue()java.lang.StringtoString()static UnsignedLongvalueOf(long value)Returns an UnsignedLong instance representing the specified int value.static UnsignedLongvalueOf(java.lang.String value)Returns anUnsignedLonginstance representing the specifiedStringvalue.static UnsignedLongvalueOf(java.math.BigInteger value)Returns anUnsignedLonginstance representing the specifiedBigIntegervalue.
-
-
-
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:
intValuein classjava.lang.Number
-
longValue
public long longValue()
- Specified by:
longValuein classjava.lang.Number
-
bigIntegerValue
public java.math.BigInteger bigIntegerValue()
-
floatValue
public float floatValue()
- Specified by:
floatValuein classjava.lang.Number
-
doubleValue
public double doubleValue()
- Specified by:
doubleValuein classjava.lang.Number
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
compareTo
public int compareTo(long value)
Compares the give long value to thisUnsignedLongnumerically treating the given value as unsigned.- Parameters:
value- the long to compare to thisUnsignedLonginstance.- 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:
compareToin 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:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
valueOf
public static UnsignedLong valueOf(long value)
Returns an UnsignedLong instance representing the specified int value. This method always returns a cachedUnsignedLonginstance 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 theUnsignedLongtype.- Parameters:
value- The long value to return as anUnsignedLonginstance.- Returns:
- an
UnsignedLonginstance representing the unsigned view of the given long.
-
valueOf
public static UnsignedLong valueOf(java.lang.String value)
Returns anUnsignedLonginstance representing the specifiedStringvalue. This method always returns a cachedUnsignedLonginstance 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 theUnsignedLongtype.- Parameters:
value- The String value to return as anUnsignedLonginstance.- Returns:
- an
UnsignedLonginstance representing the unsigned view of the given String. - Throws:
java.lang.NumberFormatException- if the given value is greater than the maxUnsignedLongvalue possible or theStringvalue given cannot be converted to a numeric value.
-
valueOf
public static UnsignedLong valueOf(java.math.BigInteger value)
Returns anUnsignedLonginstance representing the specifiedBigIntegervalue. This method always returns a cachedUnsignedLonginstance 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 theUnsignedLongtype.- Parameters:
value- TheBigIntegervalue to return as anUnsignedLonginstance.- Returns:
- an
UnsignedLonginstance representing the unsigned view of the givenBigInteger. - Throws:
java.lang.NumberFormatException- if the given value is greater than the maxUnsignedLongvalue possible.
-
-