com.sun.btrace
Class BTraceUtils.Numbers

java.lang.Object
  extended by com.sun.btrace.BTraceUtils.Numbers
Enclosing class:
BTraceUtils

public static class BTraceUtils.Numbers
extends java.lang.Object


Constructor Summary
BTraceUtils.Numbers()
           
 
Method Summary
static java.lang.Boolean box(boolean b)
          Returns a Boolean instance representing the specified boolean value.
static java.lang.Byte box(byte b)
          Returns a Byte instance representing the specified byte value.
static java.lang.Character box(char c)
          Returns a Character instance representing the specified char value.
static java.lang.Double box(double d)
          Returns a Double instance representing the specified double value.
static java.lang.Float box(float f)
          Returns a Float instance representing the specified float value.
static java.lang.Integer box(int i)
          Returns a Integer instance representing the specified int value.
static java.lang.Long box(long l)
          Returns a Long instance representing the specified long value.
static java.lang.Short box(short s)
          Returns a Short instance representing the specified short value.
static double exp(double a)
          Returns Euler's number e raised to the power of a double value.
static boolean isInfinite(double d)
          Returns true if the specified number is infinitely large in magnitude, false otherwise.
static boolean isInfinite(float f)
          Returns true if the specified number is infinitely large in magnitude, false otherwise.
static boolean isNaN(double d)
          Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.
static boolean isNaN(float f)
          Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.
static double log(double a)
          Returns the natural logarithm (base e) of a double value.
static double log10(double a)
          Returns the base 10 logarithm of a double value.
static boolean parseBoolean(java.lang.String s)
          Parses the string argument as a boolean.
static byte parseByte(java.lang.String s)
          Parses the string argument as a signed decimal byte.
static double parseDouble(java.lang.String s)
          Returns a new double initialized to the value represented by the specified String, as performed by the valueOf methcod of class Double.
static float parseFloat(java.lang.String s)
          Returns a new float initialized to the value represented by the specified String, as performed by the valueOf method of class Float.
static int parseInt(java.lang.String s)
          Parses the string argument as a signed decimal integer.
static long parseLong(java.lang.String s)
          Parses the string argument as a signed decimal long.
static short parseShort(java.lang.String s)
          Parses the string argument as a signed decimal short.
static double random()
          Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
static boolean unbox(java.lang.Boolean b)
          Returns the value of the given Boolean object as a boolean primitive.
static byte unbox(java.lang.Byte b)
          Returns the value of the specified Byte as a byte.
static char unbox(java.lang.Character ch)
          Returns the value of the given Character object as a char primitive.
static double unbox(java.lang.Double d)
          Returns the double value represented by the specified Double.
static float unbox(java.lang.Float f)
          Returns the float value represented by the specified Float.
static int unbox(java.lang.Integer i)
          Returns the value of represented by Integer.
static long unbox(java.lang.Long l)
          Returns the long value represented by the specified Long.
static short unbox(java.lang.Short s)
          Returns the short value represented by Short.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BTraceUtils.Numbers

public BTraceUtils.Numbers()
Method Detail

random

public static double random()
Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0. Returned values are chosen pseudorandomly with (approximately) uniform distribution from that range.


log

public static double log(double a)
Returns the natural logarithm (base e) of a double value. Special cases:

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters:
a - a value
Returns:
the value ln a, the natural logarithm of a.

log10

public static double log10(double a)
Returns the base 10 logarithm of a double value. Special cases:

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters:
a - a value
Returns:
the base 10 logarithm of a.

exp

public static double exp(double a)
Returns Euler's number e raised to the power of a double value. Special cases:

The computed result must be within 1 ulp of the exact result. Results must be semi-monotonic.

Parameters:
a - the exponent to raise e to.
Returns:
the value ea, where e is the base of the natural logarithms.

isNaN

public static boolean isNaN(double d)
Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

Parameters:
d - the value to be tested.
Returns:
true if the value of the argument is NaN; false otherwise.

isNaN

public static boolean isNaN(float f)
Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

Parameters:
f - the value to be tested.
Returns:
true if the value of the argument is NaN; false otherwise.

isInfinite

public static boolean isInfinite(double d)
Returns true if the specified number is infinitely large in magnitude, false otherwise.

Parameters:
d - the value to be tested.
Returns:
true if the value of the argument is positive infinity or negative infinity; false otherwise.

isInfinite

public static boolean isInfinite(float f)
Returns true if the specified number is infinitely large in magnitude, false otherwise.

Parameters:
f - the value to be tested.
Returns:
true if the value of the argument is positive infinity or negative infinity; false otherwise.

parseBoolean

public static boolean parseBoolean(java.lang.String s)
Parses the string argument as a boolean. The boolean returned represents the value true if the string argument is not null and is equal, ignoring case, to the string "true".

Example: Boolean.parseBoolean("True") returns true.
Example: Boolean.parseBoolean("yes") returns false.

Parameters:
s - the String containing the boolean representation to be parsed
Returns:
the boolean represented by the string argument

parseByte

public static byte parseByte(java.lang.String s)
Parses the string argument as a signed decimal byte. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' ('\u002D') to indicate a negative value. The resulting byte value is returned.

Parameters:
s - a String containing the byte representation to be parsed
Returns:
the byte value represented by the argument in decimal

parseShort

public static short parseShort(java.lang.String s)
Parses the string argument as a signed decimal short. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' ('\u002D') to indicate a negative value. The resulting short value is returned.

Parameters:
s - a String containing the short representation to be parsed
Returns:
the short value represented by the argument in decimal.

parseInt

public static int parseInt(java.lang.String s)
Parses the string argument as a signed decimal integer. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' ('\u002D') to indicate a negative value. The resulting integer value is returned.

Parameters:
s - a String containing the int representation to be parsed
Returns:
the integer value represented by the argument in decimal.

parseLong

public static long parseLong(java.lang.String s)
Parses the string argument as a signed decimal long. The characters in the string must all be decimal digits, except that the first character may be an ASCII minus sign '-' (\u002D') to indicate a negative value. The resulting long value is returned.

Note that neither the character L ('\u004C') nor l ('\u006C') is permitted to appear at the end of the string as a type indicator, as would be permitted in Java programming language source code.

Parameters:
s - a String containing the long representation to be parsed
Returns:
the long represented by the argument in decimal.

parseFloat

public static float parseFloat(java.lang.String s)
Returns a new float initialized to the value represented by the specified String, as performed by the valueOf method of class Float.

Parameters:
s - the string to be parsed.
Returns:
the float value represented by the string argument.

parseDouble

public static double parseDouble(java.lang.String s)
Returns a new double initialized to the value represented by the specified String, as performed by the valueOf methcod of class Double.

Parameters:
s - the string to be parsed.
Returns:
the double value represented by the string argument.

box

public static java.lang.Boolean box(boolean b)
Returns a Boolean instance representing the specified boolean value. If the specified boolean value is true, this method returns Boolean.TRUE; if it is false, this method returns Boolean.FALSE.

Parameters:
b - a boolean value.
Returns:
a Boolean instance representing b.

box

public static java.lang.Character box(char c)
Returns a Character instance representing the specified char value.

Parameters:
c - a char value.
Returns:
a Character instance representing c.

box

public static java.lang.Byte box(byte b)
Returns a Byte instance representing the specified byte value.

Parameters:
b - a byte value.
Returns:
a Byte instance representing b.

box

public static java.lang.Short box(short s)
Returns a Short instance representing the specified short value.

Parameters:
s - a short value.
Returns:
a Short instance representing s.

box

public static java.lang.Integer box(int i)
Returns a Integer instance representing the specified int value.

Parameters:
i - an int value.
Returns:
a Integer instance representing i.

box

public static java.lang.Long box(long l)
Returns a Long instance representing the specified long value.

Parameters:
l - a long value.
Returns:
a Long instance representing l.

box

public static java.lang.Float box(float f)
Returns a Float instance representing the specified float value.

Parameters:
f - a float value.
Returns:
a Float instance representing f.

box

public static java.lang.Double box(double d)
Returns a Double instance representing the specified double value.

Parameters:
d - a double value.
Returns:
a Double instance representing d.

unbox

public static boolean unbox(java.lang.Boolean b)
Returns the value of the given Boolean object as a boolean primitive.

Parameters:
b - the Boolean object whose value is returned.
Returns:
the primitive boolean value of the object.

unbox

public static char unbox(java.lang.Character ch)
Returns the value of the given Character object as a char primitive.

Parameters:
ch - the Character object whose value is returned.
Returns:
the primitive char value of the object.

unbox

public static byte unbox(java.lang.Byte b)
Returns the value of the specified Byte as a byte.

Parameters:
b - Byte that is unboxed
Returns:
the byte value represented by the Byte.

unbox

public static short unbox(java.lang.Short s)
Returns the short value represented by Short.

Parameters:
s - Short that is unboxed.
Returns:
the short value represented by the Short.

unbox

public static int unbox(java.lang.Integer i)
Returns the value of represented by Integer.

Parameters:
i - Integer that is unboxed.
Returns:
the int value represented by the Integer.

unbox

public static long unbox(java.lang.Long l)
Returns the long value represented by the specified Long.

Parameters:
l - Long to be unboxed.
Returns:
the long value represented by the Long.

unbox

public static float unbox(java.lang.Float f)
Returns the float value represented by the specified Float.

Parameters:
f - Float to be unboxed.
Returns:
the float value represented by the Float.

unbox

public static double unbox(java.lang.Double d)
Returns the double value represented by the specified Double.

Parameters:
d - Double to be unboxed.