|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hecl.NumberThing
org.hecl.IntegralThing
org.hecl.IntThing
public class IntThing
The IntThing
class represents an integer Thing.
Field Summary | |
---|---|
static IntThing |
NEGONE
|
static IntThing |
ONE
|
static IntThing |
ZERO
|
Constructor Summary | |
---|---|
IntThing()
Creates a new IntThing instance equal to 0. |
|
IntThing(boolean b)
Creates a new IntThing instance from boolean b where true
is 1 and false is 0. |
|
IntThing(int i)
Creates a new IntThing instance with value i. |
|
IntThing(java.lang.String s)
Creates a new IntThing 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 an IntThing internal representation. |
static Thing |
create(int i)
The create method creates and returns a newly allocated
Thing with an IntThing 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 int |
get(Thing thing)
get attempts to fetch an integer value from a Thing. |
java.lang.String |
getStringRep()
getStringRep creates a string representation of the
IntThing. |
int |
intValue()
intValue returns the number as an int. |
long |
longValue()
longValue returns the value as a long. |
void |
set(int i)
set sets the internal value of an IntThing to i. |
short |
shortValue()
shortValue returns the number as a short. |
java.lang.String |
thingclass()
|
Methods inherited from class org.hecl.IntegralThing |
---|
isFractional, isIntegral, isLong |
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 |
Field Detail |
---|
public static IntThing ZERO
public static IntThing ONE
public static IntThing NEGONE
Constructor Detail |
---|
public IntThing()
IntThing
instance equal to 0.
public IntThing(int i)
IntThing
instance with value i.
i
- an int
valuepublic IntThing(boolean b)
IntThing
instance from boolean b where true
is 1 and false is 0.
b
- a boolean
valuepublic IntThing(java.lang.String s)
IntThing
instance from string s.
s
- a String
valueMethod Detail |
---|
public java.lang.String thingclass()
public static Thing create(int i)
create
method creates and returns a newly allocated
Thing with an IntThing internal representation.
i
- an int
value
Thing
valuepublic static Thing create(boolean b)
create
method creates and returns a newly allocated
Thing with an IntThing internal representation.
b
- an boolean
value
Thing
valuepublic static int get(Thing thing) throws HeclException
get
attempts to fetch an integer value from a Thing.
thing
- a Thing
value
int
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(int i)
set
sets the internal value of an IntThing to i.
i
- an int
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
IntThing.
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 |