org.hecl
Class DoubleThing
- java.lang.Object
-
- org.hecl.NumberThing
-
- org.hecl.FractionalThing
-
- org.hecl.DoubleThing
-
- All Implemented Interfaces:
- RealThing
public class DoubleThing extends FractionalThing
TheDoubleThingclass represents a Thing that contains a double value.
-
-
Constructor Summary
Constructors Constructor and Description DoubleThing()Creates a newDoubleThinginstance equal to 0.DoubleThing(boolean b)Creates a newDoubleThinginstance from boolean b where true is 1 and false is 0.DoubleThing(double d)Creates a newDoubleThinginstance with value i.DoubleThing(java.lang.String s)Creates a newDoubleThinginstance 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 a DoubleThing internal representation.static Thingcreate(double d)Thecreatemethod creates and returns a newly allocated Thing with a DoubleThing internal representation.RealThingdeepcopy()deepcopymakes a copy.doubledoubleValue()doubleValuereturns the value as a double.floatfloatValue()floatValuereturns the value as a float.static doubleget(Thing thing)getattempts to fetch a double value from a Thing.java.lang.StringgetStringRep()getStringRepcreates a string representation of the DoubleThing.intintValue()intValuereturns the number as an int.longlongValue()longValuereturns the value as a long.voidset(double d)setsets the internal value of a DoubleThing to i.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
-
DoubleThing
public DoubleThing()
Creates a newDoubleThinginstance equal to 0.
-
DoubleThing
public DoubleThing(double d)
Creates a newDoubleThinginstance with value i.- Parameters:
d- adoublevalue
-
DoubleThing
public DoubleThing(boolean b)
Creates a newDoubleThinginstance from boolean b where true is 1 and false is 0.- Parameters:
b- abooleanvalue
-
DoubleThing
public DoubleThing(java.lang.String s) throws java.lang.NumberFormatExceptionCreates a newDoubleThinginstance from string s.- Parameters:
s- aStringvalue- Throws:
java.lang.NumberFormatException- when argum,ent does not adhere to floating point number syntax.
-
-
Method Detail
-
thingclass
public java.lang.String thingclass()
-
create
public static Thing create(double d)
Thecreatemethod creates and returns a newly allocated Thing with a DoubleThing internal representation.- Parameters:
d- adoublevalue- Returns:
- a
Thingvalue
-
create
public static Thing create(boolean b)
Thecreatemethod creates and returns a newly allocated Thing with a DoubleThing internal representation.- Parameters:
b- anbooleanvalue- Returns:
- a
Thingvalue
-
get
public static double get(Thing thing) throws HeclException
getattempts to fetch a double value from a Thing.- Parameters:
thing- aThingvalue- Returns:
- a
doublevalue - 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(double d)
setsets the internal value of a DoubleThing to i.- Parameters:
d- adoublevalue
-
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 DoubleThing.- Specified by:
getStringRepin interfaceRealThing- Specified by:
getStringRepin classNumberThing- Returns:
- a
Stringvalue
-
-
DataMelt 3.0 © DataMelt by jWork.ORG