edu.neu.ccs
Class XBigDecimal

java.lang.Object
  |
  +--edu.neu.ccs.XObject
        |
        +--edu.neu.ccs.XNumber
              |
              +--edu.neu.ccs.XBigDecimal
All Implemented Interfaces:
Cloneable, Serializable, Stringable

public class XBigDecimal
extends XNumber

Object wrapper for the arbitrary precision BigDecimal class, that also provides Stringable capabilities. The default value for this class is the BigDecimal representation of zero.

Since:
1.0
See Also:
Serialized Form

Field Summary
 
Fields inherited from class edu.neu.ccs.XObject
changeAdapter, VALUE
 
Constructor Summary
XBigDecimal()
          Constructs a wrapper for the default BigDecimal value of 0.0.
XBigDecimal(BigDecimal b)
          Constructs a wrapper for the given BigDecimal value.
XBigDecimal(String s)
          Constructs a wrapper for the BigDecimal value whose state information is encapsulated in the given String data.
 
Method Summary
 byte byteValue()
          Returns the value of this number as a byte value.
 double doubleValue()
          Returns the value of this number as a double value.
 boolean equals(Object other)
          Returns true if the wrapped object is equal to the given object, and false if it is not.
 float floatValue()
          Returns the value of this number as a float value.
 void fromStringData(String data)
          Sets the state of this object using information contained in the given String.
 BigDecimal getValue()
          Returns the value wrapped by this object.
 int hashCode()
          Returns an int hash code appropriate for the wrapped object.
 int intValue()
          Returns the value of this number as a int value.
 long longValue()
          Returns the value of this number as a long value.
 void setValue(BigDecimal b)
          Sets the value wrapped by this object to the given value.
 short shortValue()
          Returns the value of this number as a short value.
static BigDecimal[] toPrimitiveArray(XBigDecimal[] x)
          Returns an array of BigDecimal objects copied from the given array of XBigDecimal objects.
 String toString()
          Returns a String representation of the wrapped value.
 String toStringData()
          Returns a String encapsulation of this object that contains information needed to set the state of this object at a later time.
static XBigDecimal[] toXArray(BigDecimal[] a)
          Returns an array of XBigDecimal objects initialized from the given array of BigDecimal objects.
 
Methods inherited from class edu.neu.ccs.XObject
addPropertyChangeListener, addPropertyChangeListener, formatErrorMessage, removePropertyChangeListener, removePropertyChangeListener, toStringArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XBigDecimal

public XBigDecimal()
Constructs a wrapper for the default BigDecimal value of 0.0.

See Also:
XBigDecimal(BigDecimal), XBigDecimal(String)

XBigDecimal

public XBigDecimal(BigDecimal b)
Constructs a wrapper for the given BigDecimal value. If the given value is null, the created object wraps the value 0.0.

Parameters:
b - the value to be wrapped
See Also:
XBigDecimal(), XBigDecimal(String)

XBigDecimal

public XBigDecimal(String s)
            throws ParseException
Constructs a wrapper for the BigDecimal value whose state information is encapsulated in the given String data.

Parameters:
s - a String representation of the desired value
Throws:
ParseException - if the data is malformed
See Also:
XBigDecimal(), XBigDecimal(BigDecimal)
Method Detail

fromStringData

public void fromStringData(String data)
                    throws ParseException
Description copied from interface: Stringable
Sets the state of this object using information contained in the given String.

Specified by:
fromStringData in interface Stringable
Specified by:
fromStringData in class XObject
Parameters:
data - the String containing state information
Throws:
ParseException - if the data is malformed
See Also:
Stringable.toStringData()

toStringData

public String toStringData()
Description copied from interface: Stringable
Returns a String encapsulation of this object that contains information needed to set the state of this object at a later time.

Specified by:
toStringData in interface Stringable
Specified by:
toStringData in class XObject
See Also:
Stringable.fromStringData(String)

byteValue

public byte byteValue()
Description copied from class: XNumber
Returns the value of this number as a byte value.

Specified by:
byteValue in class XNumber

shortValue

public short shortValue()
Description copied from class: XNumber
Returns the value of this number as a short value.

Specified by:
shortValue in class XNumber

intValue

public int intValue()
Description copied from class: XNumber
Returns the value of this number as a int value.

Specified by:
intValue in class XNumber

longValue

public long longValue()
Description copied from class: XNumber
Returns the value of this number as a long value.

Specified by:
longValue in class XNumber

floatValue

public float floatValue()
Description copied from class: XNumber
Returns the value of this number as a float value.

Specified by:
floatValue in class XNumber

doubleValue

public double doubleValue()
Description copied from class: XNumber
Returns the value of this number as a double value.

Specified by:
doubleValue in class XNumber

equals

public boolean equals(Object other)
Returns true if the wrapped object is equal to the given object, and false if it is not.

Overrides:
equals in class Object

hashCode

public int hashCode()
Returns an int hash code appropriate for the wrapped object.

Overrides:
hashCode in class Object

toString

public String toString()
Returns a String representation of the wrapped value.

Overrides:
toString in class Object

setValue

public void setValue(BigDecimal b)
Sets the value wrapped by this object to the given value. If null, the value is set to the default value.

Parameters:
b - the value to be wrapped
See Also:
getValue()

getValue

public BigDecimal getValue()
Returns the value wrapped by this object.

See Also:
setValue(BigDecimal)

toPrimitiveArray

public static BigDecimal[] toPrimitiveArray(XBigDecimal[] x)
Returns an array of BigDecimal objects copied from the given array of XBigDecimal objects.

Parameters:
x - an array of XBigDecimals
Returns:
the resulting array of BigDecimal objects
See Also:
toXArray(BigDecimal[])

toXArray

public static XBigDecimal[] toXArray(BigDecimal[] a)
Returns an array of XBigDecimal objects initialized from the given array of BigDecimal objects.

Parameters:
a - an array of BigDecimals
Returns:
the resulting array of XBigDecimal objects
See Also:
toPrimitiveArray(XBigDecimal[])