|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hecl.NumberThing
org.hecl.FractionalThing
org.hecl.DoubleThing
public class DoubleThing
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 |
---|
public DoubleThing()
DoubleThing
instance equal to 0.
public DoubleThing(double d)
DoubleThing
instance with value i.
d
- a double
valuepublic DoubleThing(boolean b)
DoubleThing
instance from boolean b where true
is 1 and false is 0.
b
- a boolean
valuepublic DoubleThing(java.lang.String s) throws java.lang.NumberFormatException
DoubleThing
instance from string s.
s
- a String
value
java.lang.NumberFormatException
- when argum,ent does not adhere to
floating point number syntax.Method Detail |
---|
public java.lang.String thingclass()
public static Thing create(double d)
create
method creates and returns a newly allocated
Thing with a DoubleThing internal representation.
d
- a double
value
Thing
valuepublic static Thing create(boolean b)
create
method creates and returns a newly allocated
Thing with a DoubleThing internal representation.
b
- an boolean
value
Thing
valuepublic static double get(Thing thing) throws HeclException
get
attempts to fetch a double value from a Thing.
thing
- a Thing
value
double
value
HeclException
- if an error occurspublic byte byteValue()
NumberThing
byteValue
returns the number as a byte.
byteValue
in class NumberThing
byte
valuepublic short shortValue()
NumberThing
shortValue
returns the number as a short.
shortValue
in class NumberThing
short
valuepublic int intValue()
NumberThing
intValue
returns the number as an int.
intValue
in class NumberThing
int
valuepublic long longValue()
NumberThing
longValue
returns the value as a long.
longValue
in class NumberThing
long
valuepublic float floatValue()
NumberThing
floatValue
returns the value as a float. Not
available in CLDC 1.0
floatValue
in class NumberThing
float
valuepublic double doubleValue()
NumberThing
doubleValue
returns the value as a double. Not
available in CLDC 1.0
doubleValue
in class NumberThing
double
valuepublic void set(double d)
set
sets the internal value of a DoubleThing to i.
d
- a double
valuepublic RealThing deepcopy()
deepcopy
makes a copy.
deepcopy
in interface RealThing
deepcopy
in class NumberThing
RealThing
valuepublic java.lang.String getStringRep()
getStringRep
creates a string representation of the
DoubleThing.
getStringRep
in interface RealThing
getStringRep
in class NumberThing
String
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |