|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hecl.NumberThing
public abstract class NumberThing
The NumberThing
class is what all numeric Thing types
are derived from.
Constructor Summary | |
---|---|
NumberThing()
|
Method Summary | |
---|---|
static NumberThing |
asNumber(Thing t)
asNumber attempts to transform Thing t into a
number of some sort. |
abstract byte |
byteValue()
byteValue returns the number as a byte. |
static Thing |
create(NumberThing n)
The create method creates a new Thing from
NumberThing n. |
abstract RealThing |
deepcopy()
The deepcopy method must copy a RealThing and any values
it contains. |
abstract double |
doubleValue()
doubleValue returns the value as a double. |
abstract float |
floatValue()
floatValue returns the value as a float. |
abstract java.lang.String |
getStringRep()
The getStringRep method returns the string representation
of a RealThing . |
abstract int |
intValue()
intValue returns the number as an int. |
abstract boolean |
isFractional()
|
static boolean |
isFractional(Thing t)
isFractional returns true if Thing t is a
fractional (floating point) number, false if it isn't. |
abstract boolean |
isIntegral()
|
static boolean |
isIntegral(Thing t)
isIntegral returns true if Thing t is a whole
number (an int or long), or false if it isn't. |
static boolean |
isNumber(RealThing rt)
|
static boolean |
isNumber(Thing t)
isNumber returns true if Thing t is represented as
a number internally. |
abstract long |
longValue()
longValue returns the value as a long. |
abstract short |
shortValue()
shortValue returns the number as a short. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.hecl.RealThing |
---|
thingclass |
Constructor Detail |
---|
public NumberThing()
Method Detail |
---|
public abstract RealThing deepcopy() throws HeclException
RealThing
deepcopy
method must copy a RealThing and any values
it contains.
deepcopy
in interface RealThing
RealThing
value
HeclException
public abstract java.lang.String getStringRep()
RealThing
getStringRep
method returns the string representation
of a RealThing
.
getStringRep
in interface RealThing
String
representation of the valuepublic static boolean isNumber(Thing t)
isNumber
returns true if Thing t is represented as
a number internally.
t
- a Thing
value
boolean
valuepublic static boolean isNumber(RealThing rt)
public static boolean isIntegral(Thing t)
isIntegral
returns true if Thing t is a whole
number (an int or long), or false if it isn't.
t
- a Thing
value
boolean
valuepublic static boolean isFractional(Thing t)
isFractional
returns true if Thing t is a
fractional (floating point) number, false if it isn't.
t
- a Thing
value
boolean
valuepublic abstract boolean isIntegral()
public abstract boolean isFractional()
public abstract byte byteValue()
byteValue
returns the number as a byte.
byte
valuepublic abstract short shortValue()
shortValue
returns the number as a short.
short
valuepublic abstract int intValue()
intValue
returns the number as an int.
int
valuepublic abstract long longValue()
longValue
returns the value as a long.
long
valuepublic abstract float floatValue()
floatValue
returns the value as a float. Not
available in CLDC 1.0
float
valuepublic abstract double doubleValue()
doubleValue
returns the value as a double. Not
available in CLDC 1.0
double
valuepublic static NumberThing asNumber(Thing t) throws java.lang.NumberFormatException
asNumber
attempts to transform Thing t into a
number of some sort. It first tries to get an int from t, then
a long, and finally a double.
t
- a Thing
value
NumberThing
value
java.lang.NumberFormatException
- when argument does not adhere to number
format syntax.public static Thing create(NumberThing n)
create
method creates a new Thing from
NumberThing n.
n
- a NumberThing
value
Thing
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |