ewe.sys
Class Decimal

java.lang.Object
  extended byewe.data.DataObject
      extended byewe.sys.Decimal
All Implemented Interfaces:
ByteDecodable, ByteEncodable, Comparable, Copyable, DataUnit, Stringable, Value

public class Decimal
extends DataObject
implements Value, ByteEncodable, ByteDecodable

A Decimal is a mutable version of BigDecimal. It contains a BigDecimal within itself which you can access and replace with a new value if needed.


Constructor Summary
Decimal()
           
Decimal(BigDecimal bd)
           
Decimal(double value)
           
Decimal(String str)
           
 
Method Summary
 int compareTo(Object other)
          Compare this object with another.
 void copyFrom(Object other)
          Copy all appropriate data from another object.
 int decodeBytes(byte[] source, int offset, int length)
          This requests the Object to decode itself from a stream of bytes.
 int encodeBytes(ByteArray dest)
          This requests the Object to encode itself as a stream of bytes which is appended to the destination ByteArray.
 void fromString(String value)
           
 BigDecimal getBigDecimal()
           
 Object getCopy()
          Return a copy of this object.
 void setBigDecimal(BigDecimal bd)
           
 Decimal setDouble(double value)
           
 String toString()
          Return a String representation of this object.
 
Methods inherited from class ewe.data.DataObject
_getSetField, appendAllFields, copied, equals, getDeclaredField, getDeclaredFieldValue, getDeclaredFieldValue, getFieldList, getFieldList, getMyFieldList, getNew
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode
 

Constructor Detail

Decimal

public Decimal()

Decimal

public Decimal(double value)

Decimal

public Decimal(BigDecimal bd)

Decimal

public Decimal(String str)
Method Detail

getCopy

public Object getCopy()
Description copied from interface: Copyable
Return a copy of this object.

Specified by:
getCopy in interface Copyable
Overrides:
getCopy in class DataObject

copyFrom

public void copyFrom(Object other)
Description copied from interface: DataUnit
Copy all appropriate data from another object.

Specified by:
copyFrom in interface DataUnit
Overrides:
copyFrom in class DataObject

compareTo

public int compareTo(Object other)
Description copied from interface: Comparable
Compare this object with another. It should return: less than 0 if this object is considered LESS than the "other" object; greater than 0 if this object is considered GREATER than the "other" object; 0 if this object is considered EQUAL to the "other" object. (i.e. it is an implicit subtraction).

Specified by:
compareTo in interface Comparable
Overrides:
compareTo in class DataObject

toString

public String toString()
Description copied from class: Object
Return a String representation of this object.

Specified by:
toString in interface Stringable
Overrides:
toString in class Object
Returns:
a String representing this object.

fromString

public void fromString(String value)
Specified by:
fromString in interface Stringable

getBigDecimal

public BigDecimal getBigDecimal()

setBigDecimal

public void setBigDecimal(BigDecimal bd)

encodeBytes

public int encodeBytes(ByteArray dest)
Description copied from interface: ByteEncodable
This requests the Object to encode itself as a stream of bytes which is appended to the destination ByteArray. If the destination ByteArray is null, then the object should report how many bytes would be used if the object was encoded.

Specified by:
encodeBytes in interface ByteEncodable
Parameters:
dest - The destination ByteArray, or null to determine the number of bytes needed to encode.
Returns:
The number of bytes appended to the ByteArray or the number of bytes needed to encode.

decodeBytes

public int decodeBytes(byte[] source,
                       int offset,
                       int length)
Description copied from interface: ByteDecodable
This requests the Object to decode itself from a stream of bytes.

Specified by:
decodeBytes in interface ByteDecodable
Parameters:
source - The source of the encoded bytes.
offset - Where the object should start decoding from.
length - The number of bytes left starting from startOffsetInSource.
Returns:
the number of bytes decoded.

setDouble

public Decimal setDouble(double value)