com.ibm.jzos.fields
Class BinaryAsBigDecimalField

java.lang.Object
  extended by com.ibm.jzos.fields.BinaryAsBigIntegerField
      extended by com.ibm.jzos.fields.BinaryAsBigDecimalField
All Implemented Interfaces:
BigDecimalAccessor, BigIntegerAccessor, Field

public class BinaryAsBigDecimalField
extends BinaryAsBigIntegerField
implements BigDecimalAccessor

A binary field with BigDecimal accessors. A "scale" determines the implied number of digits to the right of the decimal point.


Constructor Summary
BinaryAsBigDecimalField(int offset, int length, int scale, boolean signed)
          Construct an instance.
 
Method Summary
 boolean equals(java.math.BigDecimal a, java.math.BigDecimal b)
          Compare two BigDecimal instances, possibly null, for equality.
 java.math.BigDecimal getBigDecimal(byte[] buffer)
          Answer a BigDecimal from the given byte array buffer, at the offset of this field.
 java.math.BigDecimal getBigDecimal(byte[] buffer, int bufOffset)
          Answer a BigDecimal from the given byte array buffer, at the bufOffset + offset of this field.
 int getScale()
           
 void putBigDecimal(java.math.BigDecimal value, byte[] buffer)
          Put a BigDecimal into the given byte array buffer, at the offset of this field.
 void putBigDecimal(java.math.BigDecimal value, byte[] buffer, int bufOffset)
          Put a BigDecimal into the given byte array buffer, at the bufOffset + offset of this field.
 
Methods inherited from class com.ibm.jzos.fields.BinaryAsBigIntegerField
equals, getBigInteger, getBigInteger, getByteLength, getLength, getOffset, isSigned, putBigInteger, putBigInteger, setOffset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.jzos.fields.Field
getByteLength, getOffset, setOffset
 

Constructor Detail

BinaryAsBigDecimalField

public BinaryAsBigDecimalField(int offset,
                               int length,
                               int scale,
                               boolean signed)
Construct an instance.

Parameters:
offset - int the offset of this field
length - int the size in bytes of this field
scale - the number of implied decimal digits to the right of the decimal point
signed - boolean true if the value is signed, false if unsigned
Method Detail

getBigDecimal

public java.math.BigDecimal getBigDecimal(byte[] buffer)
Answer a BigDecimal from the given byte array buffer, at the offset of this field.

Specified by:
getBigDecimal in interface BigDecimalAccessor
Parameters:
buffer - the byte array
Returns:
BigDecimal

getBigDecimal

public java.math.BigDecimal getBigDecimal(byte[] buffer,
                                          int bufOffset)
Answer a BigDecimal from the given byte array buffer, at the bufOffset + offset of this field.

Specified by:
getBigDecimal in interface BigDecimalAccessor
Parameters:
buffer - the byte array
bufOffset - the additional offset into the byte array
Returns:
BigDecimal

putBigDecimal

public void putBigDecimal(java.math.BigDecimal value,
                          byte[] buffer)
                   throws java.lang.IllegalArgumentException
Put a BigDecimal into the given byte array buffer, at the offset of this field.

Specified by:
putBigDecimal in interface BigDecimalAccessor
Parameters:
value - the BigDecimal value
buffer - the byte array
Throws:
java.lang.IllegalArgumentException - if the value is out of range

putBigDecimal

public void putBigDecimal(java.math.BigDecimal value,
                          byte[] buffer,
                          int bufOffset)
                   throws java.lang.IllegalArgumentException
Put a BigDecimal into the given byte array buffer, at the bufOffset + offset of this field.

Specified by:
putBigDecimal in interface BigDecimalAccessor
Parameters:
value - the BigDecimal value
buffer - the byte array
bufOffset - the additional offset into the byte array
Throws:
java.lang.IllegalArgumentException - if the value is out of range

equals

public boolean equals(java.math.BigDecimal a,
                      java.math.BigDecimal b)
Compare two BigDecimal instances, possibly null, for equality.

Parameters:
a - BigDecimal
b - BigDecimal
Returns:
boolean true if equal, false otherwise

getScale

public int getScale()
Overrides:
getScale in class BinaryAsBigIntegerField
Returns:
int the scale <= 0