|
Groovy JDK |
Method Summary | |
---|---|
int
|
abs()
Get the absolute value |
Number
|
and(Number right)
Bitwise AND together two Numbers |
Object
|
asType(Class c)
Transform this number to a the given type, using the 'as' operator following types are supported in addition to the default {@link #asType(Object,Class)}:
|
int
|
compareTo(Character right)
Compare a Number and a Character digit (i representation |
int
|
compareTo(Number right)
Compare two Numbers |
Number
|
div(Character right)
Divide a Number by a Character digit (i representation |
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 types throw UnsupportedOperationException |
Number
|
minus(Character right)
Subtract a Character from a Number digit (i representation |
Number
|
minus(Number right)
Substraction of two Numbers |
Number
|
mod(Number right)
Performs a division modulus operation |
Number
|
multiply(Character right)
Multiply a Number by a Character digit (i representation |
Number
|
multiply(Number right)
Multiply two Numbers |
Number
|
next()
Increment a Number by one |
Number
|
or(Number right)
Bitwise OR together two numbers |
String
|
plus(String right)
Appends a String to the string representation of this number |
Number
|
plus(Character right)
Add a Number and a Character digits '0' through '9' |
Number
|
plus(Number right)
Add two numbers and return the result |
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 types throw UnsupportedOperationException |
Number
|
rightShiftUnsigned(Number operand)
Implementation of the right shift (unsigned) operator for integral types Number types throw UnsupportedOperationException |
void
|
step(Number to, Number stepNumber, Closure closure)
Iterates from this number up to the given number using a step increment Each intermediate number is passed to the given closure 0 println it }Prints even numbers 0 through 8 |
void
|
times(Closure closure)
Executes the closure this many times, starting from zero index is passed to the closure each time Example: 10 println it }Prints the numbers 0 through 9 |
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 a single operand, i |
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 |
Method Detail |
---|
public int abs()
public Number and(Number right)
right
- another Number to bitwise AND.
public Object asType(Class c)
c
- the desired type of the transformed result.
public int compareTo(Character right)
right
- a Character.
public int compareTo(Number right)
right
- another Number to compare to.
public Number div(Character right)
right
- a Character.
public Number div(Number right)
right
- another Number.
public void downto(Number to, Closure closure)
to
- another Number to go down to.
closure
- the closure to call.
public Number intdiv(Character right)
right
- a Character.
public Number intdiv(Number right)
right
- another Number.
public boolean isCase(Number switchValue)
compareTo()
method for comparing numbers of different
types.
switchValue
- the switch value.
public Number leftShift(Number operand)
operand
- the shift distance by which to left shift the number.
public Number minus(Character right)
right
- a Character.
public Number minus(Number right)
right
- another Number to substract to the first one.
public Number mod(Number right)
right
- another Number to mod.
public Number multiply(Character right)
right
- a Character.
public Number multiply(Number right)
right
- another Number.
public Number next()
public Number or(Number right)
right
- another Number to bitwise OR.
public String plus(String right)
right
- a String.
public Number plus(Character right)
right
- a Character.
public Number plus(Number right)
right
- another Number to add.
public Number power(Number exponent)
exponent
- a Number exponent.
public Number previous()
public Number rightShift(Number operand)
operand
- the shift distance by which to right shift the number.
public Number rightShiftUnsigned(Number operand)
operand
- the shift distance by which to right shift (unsigned) the number.
public void step(Number to, Number stepNumber, Closure closure)
0.step( 10, 2 ) { println it }Prints even numbers 0 through 8.
to
- a Number to go up to, exclusive.
stepNumber
- a Number representing the step increment.
closure
- the closure to call.
public void times(Closure closure)
10.times { println it }Prints the numbers 0 through 9.
closure
- the closure to call a number of times.
public BigDecimal toBigDecimal()
public BigInteger toBigInteger()
public Double toDouble()
public Float toFloat()
public Integer toInteger()
public Long toLong()
public Number unaryMinus()
-10
public void upto(Number to, Closure closure)
to
- another Number to go up to.
closure
- the closure to call.
public Number xor(Number right)
right
- another Number to bitwse XOR.
|
Groovy JDK |