moka.lang
Class Double

java.lang.Object
  |
  +--moka.lang.Object
        |
        +--moka.lang.Double

public class Double
extends Object

The Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double.

In addition, this class provides several methods for converting a double to a String and a String to a double, as well as other constants and methods useful when dealing with a double.

This class can also be used to manipulate float.

Since:
MDK1.0a

Field Summary
static double MAX_VALUE
          A constant holding the largest positive finite value of type double.
static double MIN_VALUE
          A constant holding the smallest positive nonzero value of type double.
 
Constructor Summary
Double(double value)
          Constructs a newly allocated Double object that represents the primitive double argument.
Double(moka.lang.String s)
          Constructs a newly allocated Double object that represents the value represented by the string.
 
Method Summary
 byte byteValue()
          Returns the value of this Double as a byte.
 double doubleValue()
          Returns the value of this Double as an double.
 boolean equals(moka.lang.Object obj)
          Compares this object to the specified object.
 int intValue()
          Returns the value of this Double as an int.
static boolean isDouble(moka.lang.String str)
          Checks if the specified string is a decimal representation of a double.
 long longValue()
          Returns the value of this Double as a long.
static double parseDouble(moka.lang.String s)
          Parses the string argument as a signed decimal integer.
 short shortValue()
          Returns the value of this Double as a short.
 moka.lang.String toString()
          Returns a String object representing this Double's value.
 
Methods inherited from class moka.lang.Object
finalize, getClassName
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_VALUE

public static final double MAX_VALUE
A constant holding the largest positive finite value of type double.


MIN_VALUE

public static final double MIN_VALUE
A constant holding the smallest positive nonzero value of type double.

Constructor Detail

Double

public Double(double value)
Constructs a newly allocated Double object that represents the primitive double argument.

Parameters:
value - the value to be represented by the Integer.

Double

public Double(moka.lang.String s)
Constructs a newly allocated Double object that represents the value represented by the string. The string is converted to an double in exactly the manner used by the parseDouble method.

Parameters:
s - the String to be converted to an Integer.
Method Detail

toString

public moka.lang.String toString()
Returns a String object representing this Double's value. The value is converted to floating point, format [-]d.dddde[sign]ddd (exponential format) representation and returned as a string, exactly as if the double value were given as an argument to the valueOf method of String.

Overrides:
toString in class Object
Returns:
a string representation of the value of this object.

equals

public boolean equals(moka.lang.Object obj)
Compares this object to the specified object. The result is true if and only if the argument is not null and is an Double object that contains the same double value as this object.

Overrides:
equals in class Object
Parameters:
obj - the object to compare with.
Returns:
true if the objects are the same; false otherwise.

doubleValue

public double doubleValue()
Returns the value of this Double as an double.


parseDouble

public static double parseDouble(moka.lang.String s)
Parses the string argument as a signed decimal integer. It recognizes the character representation of a floating point number. The resulting double value is returned. The string argument is finalized before the method returns.

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

intValue

public int intValue()
Returns the value of this Double as an int. This may involve rounding or truncation.

Returns:
the numeric value represented by this object after conversion to type int.

longValue

public long longValue()
Returns the value of this Double as a long. This may involve rounding or truncation.

Returns:
the numeric value represented by this object after conversion to type long.

byteValue

public byte byteValue()
Returns the value of this Double as a byte. This may involve rounding or truncation.

Returns:
the numeric value represented by this object after conversion to type byte.

shortValue

public short shortValue()
Returns the value of this Double as a short. This may involve rounding or truncation.

Returns:
the numeric value represented by this object after conversion to type short.

isDouble

public static boolean isDouble(moka.lang.String str)
Checks if the specified string is a decimal representation of a double.

Parameters:
str - The string to verify
Returns:
true if the specified string is a decimal representation of a double, false otherwize.