Class NumberMath
java.lang.Object
org.checkerframework.common.value.util.NumberMath
Performs Java numeric operations whose left operand is a boxed number.
-
Method Summary
Modifier and TypeMethodDescriptionbitwiseAnd(Number right) Returnsthis & right.Returns~this.Returnsthis | right.bitwiseXor(Number right) Returnsthis ^ right.Returnsthis / right, or null ifrightis zero and the operation is integer division.Returnsthis == right.static NumberMathgetNumberMath(Number number) Returns an arithmetic helper fornumber.greaterThan(Number right) Returnsthis > right.greaterThanEq(Number right) Returnsthis >= right.static booleanisIntegralZero(Number number) Returns whethernumberis an integral zero.Returnsthis < right.lessThanEq(Number right) Returnsthis <= right.Returnsthis - right.notEqualTo(Number right) Returnsthis != right.Returnsthis + right.Returnsthis % right, or null ifrightis zero and the operation is integer remainder.Returnsthis << right.signedShiftRight(Number right) Returnsthis >> right.Returnsthis * right.Returns-this.Returns+this.unsignedShiftRight(Number right) Returnsthis >>> right.
-
Method Details
-
getNumberMath
Returns an arithmetic helper fornumber.- Parameters:
number- a number- Returns:
- an arithmetic helper
- Throws:
UnsupportedOperationException- ifnumberis not a supported boxed primitive
-
plus
Returnsthis + right.- Parameters:
right- the right operand- Returns:
this + right
-
minus
Returnsthis - right.- Parameters:
right- the right operand- Returns:
this - right
-
times
Returnsthis * right.- Parameters:
right- the right operand- Returns:
this * right
-
divide
Returnsthis / right, or null ifrightis zero and the operation is integer division.- Parameters:
right- the right operand- Returns:
this / right, or null ifrightis zero and the operation is integer division
-
remainder
Returnsthis % right, or null ifrightis zero and the operation is integer remainder.- Parameters:
right- the right operand- Returns:
this % right, or null ifrightis zero and the operation is integer remainder
-
shiftLeft
Returnsthis << right.- Parameters:
right- the right operand- Returns:
this << right
-
signedShiftRight
Returnsthis >> right.- Parameters:
right- the right operand- Returns:
this >> right
-
unsignedShiftRight
Returnsthis >>> right.- Parameters:
right- the right operand- Returns:
this >>> right
-
bitwiseAnd
Returnsthis & right.- Parameters:
right- the right operand- Returns:
this & right
-
bitwiseOr
Returnsthis | right.- Parameters:
right- the right operand- Returns:
this | right
-
bitwiseXor
Returnsthis ^ right.- Parameters:
right- the right operand- Returns:
this ^ right
-
unaryPlus
Returns+this.- Returns:
+this
-
unaryMinus
Returns-this.- Returns:
-this
-
bitwiseComplement
Returns~this.- Returns:
~this
-
equalTo
Returnsthis == right.- Parameters:
right- the right operand- Returns:
this == right
-
notEqualTo
Returnsthis != right.- Parameters:
right- the right operand- Returns:
this != right
-
greaterThan
Returnsthis > right.- Parameters:
right- the right operand- Returns:
this > right
-
greaterThanEq
Returnsthis >= right.- Parameters:
right- the right operand- Returns:
this >= right
-
lessThan
Returnsthis < right.- Parameters:
right- the right operand- Returns:
this < right
-
lessThanEq
Returnsthis <= right.- Parameters:
right- the right operand- Returns:
this <= right
-
isIntegralZero
Returns whethernumberis an integral zero.- Parameters:
number- a number- Returns:
- whether
numberis an integral zero
-