org.hecl
Class LongThing
- java.lang.Object
-
- org.hecl.NumberThing
-
- org.hecl.FractionalThing
-
- org.hecl.LongThing
-
- All Implemented Interfaces:
- RealThing
public class LongThing extends FractionalThing
TheLongThingclass represents a 'long' Thing.
-
-
Constructor Summary
Constructors Constructor and Description LongThing()Creates a newLongThinginstance equal to 0.LongThing(boolean b)Creates a newLongThinginstance from boolean b where true is 1 and false is 0.LongThing(long l)Creates a newLongThinginstance with value l.LongThing(java.lang.String s)Creates a newLongThinginstance 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 LongThing internal representation.static Thingcreate(int i)Thecreatemethod creates and returns a newly allocated Thing with an LongThing internal representation.static Thingcreate(long l)Thecreatemethod creates and returns a newly allocated Thing with an LongThing internal representation.RealThingdeepcopy()deepcopymakes a copy.doubledoubleValue()doubleValuereturns the value as a double.floatfloatValue()floatValuereturns the value as a float.static longget(Thing thing)getattempts to fetch an integer value from a Thing.java.lang.StringgetStringRep()getStringRepcreates a string representation of the LongThing.intintValue()intValuereturns the number as an int.booleanisLong()longlongValue()longValuereturns the value as a long.voidset(long l)setsets the internal value of an LongThing to l.shortshortValue()shortValuereturns the number as a short.java.lang.Stringthingclass()-
Methods inherited from class org.hecl.FractionalThing
isFractional, isIntegral
-
Methods inherited from class org.hecl.NumberThing
asNumber, create, isFractional, isIntegral, isNumber, isNumber
-
-
-
-
Constructor Detail
-
LongThing
public LongThing()
Creates a newLongThinginstance equal to 0.
-
LongThing
public LongThing(long l)
Creates a newLongThinginstance with value l.- Parameters:
l- alongvalue
-
LongThing
public LongThing(boolean b)
Creates a newLongThinginstance from boolean b where true is 1 and false is 0.- Parameters:
b- abooleanvalue
-
LongThing
public LongThing(java.lang.String s) throws java.lang.NumberFormatExceptionCreates a newLongThinginstance from string s.- Parameters:
s- aStringvalue- Throws:
java.lang.NumberFormatException- when argum,ent does not adhere to integral number syntax.
-
-
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 LongThing internal representation.- Parameters:
i- anintvalue- Returns:
- a
Thingvalue
-
create
public static Thing create(long l)
Thecreatemethod creates and returns a newly allocated Thing with an LongThing internal representation.- Parameters:
l- anlongvalue- Returns:
- a
Thingvalue
-
create
public static Thing create(boolean b)
Thecreatemethod creates and returns a newly allocated Thing with an LongThing internal representation.- Parameters:
b- anbooleanvalue- Returns:
- a
Thingvalue
-
get
public static long 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
-
isLong
public boolean isLong()
-
set
public void set(long l)
setsets the internal value of an LongThing to l.- Parameters:
l- alongvalue
-
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 LongThing.- Specified by:
getStringRepin interfaceRealThing- Specified by:
getStringRepin classNumberThing- Returns:
- a
Stringvalue
-
-
DataMelt 3.0 © DataMelt by jWork.ORG