edu.neu.ccs
Class XNumber

java.lang.Object
  extended byedu.neu.ccs.XObject
      extended byedu.neu.ccs.XNumber
All Implemented Interfaces:
Cloneable, Serializable, Stringable
Direct Known Subclasses:
XBigDecimal, XBigInteger, XByte, XDouble, XFloat, XInt, XLong, XShort

public abstract class XNumber
extends XObject

Abstract superclass for Stringable objects that wrap a numeric value, whether it is a primitive type or an arbitrary precision representation. The intention of this class is to provide a specification for the required casting operations for wrapper classes. It is documented, though not required that derived classes of this abstract class should police promotion and demotion between types and throw instances of NumberFormatException when such casting operations cannot be safely performed.

Since:
1.0
Version:
2.2
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.neu.ccs.XObject
changeAdapter, VALUE
 
Constructor Summary
XNumber()
           
 
Method Summary
abstract  byte byteValue()
          Returns the value of this number as a byte value.
abstract  double doubleValue()
          Returns the value of this number as a double value.
abstract  float floatValue()
          Returns the value of this number as a float value.
abstract  int intValue()
          Returns the value of this number as a int value.
abstract  long longValue()
          Returns the value of this number as a long value.
abstract  short shortValue()
          Returns the value of this number as a short value.
 
Methods inherited from class edu.neu.ccs.XObject
addPropertyChangeListener, addPropertyChangeListener, formatErrorMessage, fromStringData, removePropertyChangeListener, removePropertyChangeListener, toStringArray, toStringData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XNumber

public XNumber()
Method Detail

byteValue

public abstract byte byteValue()
Returns the value of this number as a byte value.

Throws:
NumberFormatException - if the value cannot be promoted or demoted to the type

shortValue

public abstract short shortValue()
Returns the value of this number as a short value.

Throws:
NumberFormatException - if the value cannot be promoted or demoted to the type

intValue

public abstract int intValue()
Returns the value of this number as a int value.

Throws:
NumberFormatException - if the value cannot be promoted or demoted to the type

longValue

public abstract long longValue()
Returns the value of this number as a long value.

Throws:
NumberFormatException - if the value cannot be promoted or demoted to the type

floatValue

public abstract float floatValue()
Returns the value of this number as a float value.

Throws:
NumberFormatException - if the value cannot be promoted or demoted to the type

doubleValue

public abstract double doubleValue()
Returns the value of this number as a double value.

Throws:
NumberFormatException - if the value cannot be promoted or demoted to the type