org.hecl
Class DoubleThing

java.lang.Object
  extended by org.hecl.NumberThing
      extended by org.hecl.FractionalThing
          extended by org.hecl.DoubleThing
All Implemented Interfaces:
RealThing

public class DoubleThing
extends FractionalThing

The DoubleThing class represents a Thing that contains a double value.


Constructor Summary
DoubleThing()
          Creates a new DoubleThing instance equal to 0.
DoubleThing(boolean b)
          Creates a new DoubleThing instance from boolean b where true is 1 and false is 0.
DoubleThing(double d)
          Creates a new DoubleThing instance with value i.
DoubleThing(java.lang.String s)
          Creates a new DoubleThing instance from string s.
 
Method Summary
 byte byteValue()
          byteValue returns the number as a byte.
static Thing create(boolean b)
          The create method creates and returns a newly allocated Thing with a DoubleThing internal representation.
static Thing create(double d)
          The create method creates and returns a newly allocated Thing with a DoubleThing internal representation.
 RealThing deepcopy()
          deepcopy makes a copy.
 double doubleValue()
          doubleValue returns the value as a double.
 float floatValue()
          floatValue returns the value as a float.
static double get(Thing thing)
          get attempts to fetch a double value from a Thing.
 java.lang.String getStringRep()
          getStringRep creates a string representation of the DoubleThing.
 int intValue()
          intValue returns the number as an int.
 long longValue()
          longValue returns the value as a long.
 void set(double d)
          set sets the internal value of a DoubleThing to i.
 short shortValue()
          shortValue returns the number as a short.
 java.lang.String thingclass()
           
 
Methods inherited from class org.hecl.FractionalThing
isFractional, isIntegral
 
Methods inherited from class org.hecl.NumberThing
asNumber, create, isFractional, isIntegral, isNumber, isNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DoubleThing

public DoubleThing()
Creates a new DoubleThing instance equal to 0.


DoubleThing

public DoubleThing(double d)
Creates a new DoubleThing instance with value i.

Parameters:
d - a double value

DoubleThing

public DoubleThing(boolean b)
Creates a new DoubleThing instance from boolean b where true is 1 and false is 0.

Parameters:
b - a boolean value

DoubleThing

public DoubleThing(java.lang.String s)
            throws java.lang.NumberFormatException
Creates a new DoubleThing instance from string s.

Parameters:
s - a String value
Throws:
java.lang.NumberFormatException - when argum,ent does not adhere to floating point number syntax.
Method Detail

thingclass

public java.lang.String thingclass()

create

public static Thing create(double d)
The create method creates and returns a newly allocated Thing with a DoubleThing internal representation.

Parameters:
d - a double value
Returns:
a Thing value

create

public static Thing create(boolean b)
The create method creates and returns a newly allocated Thing with a DoubleThing internal representation.

Parameters:
b - an boolean value
Returns:
a Thing value

get

public static double get(Thing thing)
                  throws HeclException
get attempts to fetch a double value from a Thing.

Parameters:
thing - a Thing value
Returns:
a double value
Throws:
HeclException - if an error occurs

byteValue

public byte byteValue()
Description copied from class: NumberThing
byteValue returns the number as a byte.

Specified by:
byteValue in class NumberThing
Returns:
a byte value

shortValue

public short shortValue()
Description copied from class: NumberThing
shortValue returns the number as a short.

Specified by:
shortValue in class NumberThing
Returns:
a short value

intValue

public int intValue()
Description copied from class: NumberThing
intValue returns the number as an int.

Specified by:
intValue in class NumberThing
Returns:
an int value

longValue

public long longValue()
Description copied from class: NumberThing
longValue returns the value as a long.

Specified by:
longValue in class NumberThing
Returns:
a long value

floatValue

public float floatValue()
Description copied from class: NumberThing
floatValue returns the value as a float. Not available in CLDC 1.0

Specified by:
floatValue in class NumberThing
Returns:
a float value

doubleValue

public double doubleValue()
Description copied from class: NumberThing
doubleValue returns the value as a double. Not available in CLDC 1.0

Specified by:
doubleValue in class NumberThing
Returns:
a double value

set

public void set(double d)
set sets the internal value of a DoubleThing to i.

Parameters:
d - a double value

deepcopy

public RealThing deepcopy()
deepcopy makes a copy.

Specified by:
deepcopy in interface RealThing
Specified by:
deepcopy in class NumberThing
Returns:
a RealThing value

getStringRep

public java.lang.String getStringRep()
getStringRep creates a string representation of the DoubleThing.

Specified by:
getStringRep in interface RealThing
Specified by:
getStringRep in class NumberThing
Returns:
a String value