org.hecl
Class LongThing

java.lang.Object
  extended by org.hecl.NumberThing
      extended by org.hecl.FractionalThing
          extended by org.hecl.LongThing
All Implemented Interfaces:
RealThing

public class LongThing
extends FractionalThing

The LongThing class represents a 'long' Thing.

Version:
1.0

Constructor Summary
LongThing()
          Creates a new LongThing instance equal to 0.
LongThing(boolean b)
          Creates a new LongThing instance from boolean b where true is 1 and false is 0.
LongThing(long l)
          Creates a new LongThing instance with value l.
LongThing(java.lang.String s)
          Creates a new LongThing 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 LongThing internal representation.
static Thing create(int i)
          The create method creates and returns a newly allocated Thing with an LongThing internal representation.
static Thing create(long l)
          The create method creates and returns a newly allocated Thing with an LongThing 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 long get(Thing thing)
          get attempts to fetch an integer value from a Thing.
 java.lang.String getStringRep()
          getStringRep creates a string representation of the LongThing.
 int intValue()
          intValue returns the number as an int.
 boolean isLong()
           
 long longValue()
          longValue returns the value as a long.
 void set(long l)
          set sets the internal value of an LongThing to l.
 short shortValue()
          shortValue returns the number as a short.
 java.lang.String thingclass()
           
 
Methods inherited from class org.hecl.FractionalThing
isFractional, isIntegral
 
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
 

Constructor Detail

LongThing

public LongThing()
Creates a new LongThing instance equal to 0.


LongThing

public LongThing(long l)
Creates a new LongThing instance with value l.

Parameters:
l - a long value

LongThing

public LongThing(boolean b)
Creates a new LongThing instance from boolean b where true is 1 and false is 0.

Parameters:
b - a boolean value

LongThing

public LongThing(java.lang.String s)
          throws java.lang.NumberFormatException
Creates a new LongThing instance from string s.

Parameters:
s - a String value
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)
The create method creates and returns a newly allocated Thing with an LongThing internal representation.

Parameters:
i - an int value
Returns:
a Thing value

create

public static Thing create(long l)
The create method creates and returns a newly allocated Thing with an LongThing internal representation.

Parameters:
l - an long value
Returns:
a Thing value

create

public static Thing create(boolean b)
The create method creates and returns a newly allocated Thing with an LongThing internal representation.

Parameters:
b - an boolean value
Returns:
a Thing value

get

public static long get(Thing thing)
                throws HeclException
get attempts to fetch an integer value from a Thing.

Parameters:
thing - a Thing value
Returns:
an int value
Throws:
HeclException - if an error occurs

byteValue

public byte byteValue()
Description copied from class: NumberThing
byteValue returns the number as a byte.

Specified by:
byteValue in class NumberThing
Returns:
a byte value

shortValue

public short shortValue()
Description copied from class: NumberThing
shortValue returns the number as a short.

Specified by:
shortValue in class NumberThing
Returns:
a short value

intValue

public int intValue()
Description copied from class: NumberThing
intValue returns the number as an int.

Specified by:
intValue in class NumberThing
Returns:
an int value

longValue

public long longValue()
Description copied from class: NumberThing
longValue returns the value as a long.

Specified by:
longValue in class NumberThing
Returns:
a long value

floatValue

public float floatValue()
Description copied from class: NumberThing
floatValue returns the value as a float. Not available in CLDC 1.0

Specified by:
floatValue in class NumberThing
Returns:
a float value

doubleValue

public double doubleValue()
Description copied from class: NumberThing
doubleValue returns the value as a double. Not available in CLDC 1.0

Specified by:
doubleValue in class NumberThing
Returns:
a double value

isLong

public boolean isLong()

set

public void set(long l)
set sets the internal value of an LongThing to l.

Parameters:
l - a long value

deepcopy

public RealThing deepcopy()
deepcopy makes a copy.

Specified by:
deepcopy in interface RealThing
Specified by:
deepcopy in class NumberThing
Returns:
a RealThing value

getStringRep

public java.lang.String getStringRep()
getStringRep creates a string representation of the LongThing.

Specified by:
getStringRep in interface RealThing
Specified by:
getStringRep in class NumberThing
Returns:
a String value