org.hecl
Class IntThing
- java.lang.Object
-
- org.hecl.NumberThing
-
- org.hecl.IntegralThing
-
- org.hecl.IntThing
-
- All Implemented Interfaces:
- RealThing
public class IntThing extends IntegralThing
TheIntThingclass represents an integer Thing.
-
-
Field Summary
Fields Modifier and Type Field and Description static IntThingNEGONEstatic IntThingONEstatic IntThingZERO
-
Constructor Summary
Constructors Constructor and Description IntThing()Creates a newIntThinginstance equal to 0.IntThing(boolean b)Creates a newIntThinginstance from boolean b where true is 1 and false is 0.IntThing(int i)Creates a newIntThinginstance with value i.IntThing(java.lang.String s)Creates a newIntThinginstance from string s.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description bytebyteValue()byteValuereturns the number as a byte.static Thingcreate(boolean b)Thecreatemethod creates and returns a newly allocated Thing with an IntThing internal representation.static Thingcreate(int i)Thecreatemethod creates and returns a newly allocated Thing with an IntThing internal representation.RealThingdeepcopy()deepcopymakes a copy.doubledoubleValue()doubleValuereturns the value as a double.floatfloatValue()floatValuereturns the value as a float.static intget(Thing thing)getattempts to fetch an integer value from a Thing.java.lang.StringgetStringRep()getStringRepcreates a string representation of the IntThing.intintValue()intValuereturns the number as an int.longlongValue()longValuereturns the value as a long.voidset(int i)setsets the internal value of an IntThing to i.shortshortValue()shortValuereturns the number as a short.java.lang.Stringthingclass()-
Methods inherited from class org.hecl.IntegralThing
isFractional, isIntegral, isLong
-
Methods inherited from class org.hecl.NumberThing
asNumber, create, isFractional, isIntegral, isNumber, isNumber
-
-
-
-
Field Detail
-
ZERO
public static IntThing ZERO
-
ONE
public static IntThing ONE
-
NEGONE
public static IntThing NEGONE
-
-
Constructor Detail
-
IntThing
public IntThing()
Creates a newIntThinginstance equal to 0.
-
IntThing
public IntThing(int i)
Creates a newIntThinginstance with value i.- Parameters:
i- anintvalue
-
IntThing
public IntThing(boolean b)
Creates a newIntThinginstance from boolean b where true is 1 and false is 0.- Parameters:
b- abooleanvalue
-
IntThing
public IntThing(java.lang.String s)
Creates a newIntThinginstance from string s.- Parameters:
s- aStringvalue
-
-
Method Detail
-
thingclass
public java.lang.String thingclass()
-
create
public static Thing create(int i)
Thecreatemethod creates and returns a newly allocated Thing with an IntThing internal representation.- Parameters:
i- anintvalue- Returns:
- a
Thingvalue
-
create
public static Thing create(boolean b)
Thecreatemethod creates and returns a newly allocated Thing with an IntThing internal representation.- Parameters:
b- anbooleanvalue- Returns:
- a
Thingvalue
-
get
public static int get(Thing thing) throws HeclException
getattempts to fetch an integer value from a Thing.- Parameters:
thing- aThingvalue- Returns:
- an
intvalue - Throws:
HeclException- if an error occurs
-
byteValue
public byte byteValue()
Description copied from class:NumberThingbyteValuereturns the number as a byte.- Specified by:
byteValuein classNumberThing- Returns:
- a
bytevalue
-
shortValue
public short shortValue()
Description copied from class:NumberThingshortValuereturns the number as a short.- Specified by:
shortValuein classNumberThing- Returns:
- a
shortvalue
-
intValue
public int intValue()
Description copied from class:NumberThingintValuereturns the number as an int.- Specified by:
intValuein classNumberThing- Returns:
- an
intvalue
-
longValue
public long longValue()
Description copied from class:NumberThinglongValuereturns the value as a long.- Specified by:
longValuein classNumberThing- Returns:
- a
longvalue
-
floatValue
public float floatValue()
Description copied from class:NumberThingfloatValuereturns the value as a float. Not available in CLDC 1.0- Specified by:
floatValuein classNumberThing- Returns:
- a
floatvalue
-
doubleValue
public double doubleValue()
Description copied from class:NumberThingdoubleValuereturns the value as a double. Not available in CLDC 1.0- Specified by:
doubleValuein classNumberThing- Returns:
- a
doublevalue
-
set
public void set(int i)
setsets the internal value of an IntThing to i.- Parameters:
i- anintvalue
-
deepcopy
public RealThing deepcopy()
deepcopymakes a copy.- Specified by:
deepcopyin interfaceRealThing- Specified by:
deepcopyin classNumberThing- Returns:
- a
RealThingvalue
-
getStringRep
public java.lang.String getStringRep()
getStringRepcreates a string representation of the IntThing.- Specified by:
getStringRepin interfaceRealThing- Specified by:
getStringRepin classNumberThing- Returns:
- a
Stringvalue
-
-
DataMelt 3.0 © DataMelt by jWork.ORG