| Return type | Name and parameters |
|---|---|
int
|
abs()
Get the absolute value |
Number
|
and(Number right)
Bitwise AND together two Numbers. |
boolean
|
asBoolean()
Coerce a number to a boolean value. |
Object
|
asType(Class c)
Transform this number to a the given type, using the 'as' operator. |
Number
|
bitwiseNegate()
Bitwise NEGATE a Number. |
int
|
compareTo(Character right)
Compare a Number and a Character. |
int
|
compareTo(Number right)
Compare two Numbers. |
Number
|
div(Character right)
Divide a Number by a Character. |
Number
|
div(Number right)
Divide two Numbers. |
void
|
downto(Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time. |
Number
|
intdiv(Character right)
Integer Divide a Number by a Character. |
Number
|
intdiv(Number right)
Integer Divide two Numbers. |
boolean
|
isCase(Number switchValue)
Special 'case' implementation for all numbers, which delegates to the compareTo() method for comparing numbers of different
types.
|
Number
|
leftShift(Number operand)
Implementation of the left shift operator for integral types. |
Number
|
minus(Character right)
Subtract a Character from a Number. |
Number
|
minus(Number right)
Subtraction of two Numbers. |
Number
|
mod(Number right)
Performs a division modulus operation. |
Number
|
multiply(Character right)
Multiply a Number by a Character. |
Number
|
multiply(Number right)
Multiply two Numbers. |
Number
|
next()
Increment a Number by one. |
Number
|
or(Number right)
Bitwise OR together two numbers. |
Number
|
plus(Character right)
Add a Number and a Character. |
Number
|
plus(Number right)
Add two numbers and return the result. |
String
|
plus(String right)
Appends a String to the string representation of this number. |
Number
|
power(Number exponent)
Power of a Number to a certain exponent. |
Number
|
previous()
Decrement a Number by one. |
Number
|
rightShift(Number operand)
Implementation of the right shift operator for integral types. |
Number
|
rightShiftUnsigned(Number operand)
Implementation of the right shift (unsigned) operator for integral types. |
void
|
step(Number to, Number stepNumber, Closure closure)
Iterates from this number up to the given number using a step increment. |
void
|
times(Closure closure)
Executes the closure this many times, starting from zero. |
BigDecimal
|
toBigDecimal()
Transform a Number into a BigDecimal |
BigInteger
|
toBigInteger()
Transform this Number into a BigInteger. |
Double
|
toDouble()
Transform a Number into a Double |
Float
|
toFloat()
Transform a Number into a Float |
Integer
|
toInteger()
Transform a Number into an Integer |
Long
|
toLong()
Transform a Number into a Long |
Number
|
unaryMinus()
Negates the number. |
Number
|
unaryPlus()
Returns the number, effectively being a noop for numbers. |
void
|
upto(Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time. |
Number
|
xor(Number right)
Bitwise XOR together two Numbers. |
addShutdownHook, any, any, asBoolean, asType, collect, collect, collect, contains, count, dump, each, eachWithIndex, equals, every, every, find, find, findAll, findAll, findIndexOf, findIndexOf, findIndexValues, findIndexValues, findLastIndexOf, findLastIndexOf, findResult, findResult, flatten, getAt, getMetaClass, getMetaPropertyValues, getProperties, grep, grep, groupBy, groupBy, hasProperty, identity, inject, inject, inspect, invokeMethod, is, isCase, iterator, join, metaClass, print, print, printf, printf, println, println, println, putAt, respondsTo, respondsTo, setMetaClass, size, split, sprintf, sprintf, sum, sum, sum, sum, toArrayString, toSpreadMap, toString, use, use, use, with, withTraits
Get the absolute value
Bitwise AND together two Numbers.
right - another Number to bitwise ANDCoerce a number to a boolean value. A number is coerced to false if its double value is equal to 0, and to true otherwise, and to true otherwise.
Transform this number to a the given type, using the 'as' operator. The following types are supported in addition to the default Object#asType(java.lang.Class):
c - the desired type of the transformed resultBitwise NEGATE a Number.
Compare a Number and a Character. The ordinal value of the Character is used in the comparison (the ordinal value is the unicode value which for simple character sets is the ASCII value).
right - a CharacterCompare two Numbers. Equality (==) for numbers dispatches to this.
right - another Number to compare toDivide a Number by a Character. The ordinal value of the Character is used in the division (the ordinal value is the unicode value which for simple character sets is the ASCII value).
right - a CharacterDivide two Numbers. Note: Method name different from 'divide' to avoid collision with BigInteger method that has different semantics. We want a BigDecimal result rather than a BigInteger.
right - another NumberIterates from this number down to the given number, inclusive, decrementing by one each time.
to - another Number to go down toclosure - the closure to callInteger Divide a Number by a Character. The ordinal value of the Character is used in the division (the ordinal value is the unicode value which for simple character sets is the ASCII value).
right - a CharacterInteger Divide two Numbers.
right - another NumberSpecial 'case' implementation for all numbers, which delegates to the
compareTo() method for comparing numbers of different
types.
switchValue - the switch valueImplementation of the left shift operator for integral types. Non integral Number types throw UnsupportedOperationException.
operand - the shift distance by which to left shift the numberSubtract a Character from a Number. The ordinal value of the Character is used in the subtraction (the ordinal value is the unicode value which for simple character sets is the ASCII value).
right - a CharacterSubtraction of two Numbers.
right - another Number to subtract to the first onePerforms a division modulus operation. Called by the '%' operator.
right - another Number to modMultiply a Number by a Character. The ordinal value of the Character is used in the multiplication (the ordinal value is the unicode value which for simple character sets is the ASCII value).
right - a CharacterMultiply two Numbers.
right - another NumberIncrement a Number by one.
Bitwise OR together two numbers.
right - another Number to bitwise ORAdd a Number and a Character. The ordinal value of the Character is used in the addition (the ordinal value is the unicode value which for simple character sets is the ASCII value).
right - a CharacterAdd two numbers and return the result.
right - another Number to addAppends a String to the string representation of this number.
right - a StringPower of a Number to a certain exponent. Called by the '**' operator.
exponent - a Number exponentDecrement a Number by one.
Implementation of the right shift operator for integral types. Non integral Number types throw UnsupportedOperationException.
operand - the shift distance by which to right shift the numberImplementation of the right shift (unsigned) operator for integral types. Non integral Number types throw UnsupportedOperationException.
operand - the shift distance by which to right shift (unsigned) the numberIterates from this number up to the given number using a step increment. Each intermediate number is passed to the given closure. Example:
0.step( 10, 2 ) {
println it
}
Prints even numbers 0 through 8.
to - a Number to go up to, exclusivestepNumber - a Number representing the step incrementclosure - the closure to callExecutes the closure this many times, starting from zero. The current index is passed to the closure each time. Example:
10.times {
println it
}
Prints the numbers 0 through 9.
closure - the closure to call a number of timesTransform a Number into a BigDecimal
Transform this Number into a BigInteger.
Transform a Number into a Double
Transform a Number into a Float
Transform a Number into an Integer
Transform a Number into a Long
Negates the number. Equivalent to the '-' operator when it preceeds
a single operand, i.e. -10
Returns the number, effectively being a noop for numbers.
Operator overloaded form of the '+' operator when it preceeds
a single operand, i.e. +10
Iterates from this number up to the given number, inclusive, incrementing by one each time.
to - another Number to go up toclosure - the closure to call