com.ibm.jzos.fields
Class IbmDoubleField

java.lang.Object
  extended by com.ibm.jzos.fields.IbmDoubleField
All Implemented Interfaces:
DoubleAccessor, Field

public class IbmDoubleField
extends java.lang.Object
implements DoubleAccessor

An extended IBM hexadecimal floating point Field with double accessors.


Field Summary
static long ALL_NON_SIGN_BITS
           
static int BFP_BIAS
           
static long BFP_EXP_MASK
           
static long BFP_FRACTION_HON
           
static long BFP_FRACTION_IMPLIED_HOB
           
static int BFP_FRACTION_LENGTH
           
static long BFP_FRACTION_MASK
           
static int BFP_INF_EXP
           
static int BYTE_LENGTH
           
static int HFP_BIAS
           
static long HFP_EXP_MASK
           
static int HFP_FRACTION_LENGTH
           
static long HFP_FRACTION_MASK
           
static int HFP_MAX_EXP
           
static long SIGN_BIT
           
 
Constructor Summary
IbmDoubleField(int offset)
          Construct an instance.
 
Method Summary
 boolean equals(java.lang.Double aDouble, double adouble)
          Compare a Double with a double for equality.
 int getByteLength()
          Answer the length of the field described by the receiver
 double getDouble(byte[] buffer)
          Return an IEEE (binary) double from the given byte array buffer, at the offset of this field.
 double getDouble(byte[] buffer, int bufOffset)
          Return an IEEE (binary) double from the given byte array buffer, at the bufOffset + offset of this field.
 int getOffset()
          Answer the offset of this field into some array of bytes
 void putDouble(double value, byte[] buffer)
          Put a double into the given byte array buffer, at the offset of this field.
 void putDouble(double value, byte[] buffer, int bufOffset)
          Put a double into the given byte array buffer, at the bufOffset + offset of this field.
 void setOffset(int offset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BYTE_LENGTH

public static final int BYTE_LENGTH
See Also:
Constant Field Values

SIGN_BIT

public static final long SIGN_BIT
See Also:
Constant Field Values

ALL_NON_SIGN_BITS

public static final long ALL_NON_SIGN_BITS
See Also:
Constant Field Values

HFP_FRACTION_MASK

public static final long HFP_FRACTION_MASK
See Also:
Constant Field Values

BFP_FRACTION_MASK

public static final long BFP_FRACTION_MASK
See Also:
Constant Field Values

BFP_FRACTION_IMPLIED_HOB

public static final long BFP_FRACTION_IMPLIED_HOB
See Also:
Constant Field Values

BFP_FRACTION_HON

public static final long BFP_FRACTION_HON
See Also:
Constant Field Values

HFP_EXP_MASK

public static final long HFP_EXP_MASK
See Also:
Constant Field Values

BFP_EXP_MASK

public static final long BFP_EXP_MASK
See Also:
Constant Field Values

HFP_FRACTION_LENGTH

public static final int HFP_FRACTION_LENGTH
See Also:
Constant Field Values

BFP_FRACTION_LENGTH

public static final int BFP_FRACTION_LENGTH
See Also:
Constant Field Values

HFP_BIAS

public static final int HFP_BIAS
See Also:
Constant Field Values

HFP_MAX_EXP

public static final int HFP_MAX_EXP
See Also:
Constant Field Values

BFP_BIAS

public static final int BFP_BIAS
See Also:
Constant Field Values

BFP_INF_EXP

public static final int BFP_INF_EXP
See Also:
Constant Field Values
Constructor Detail

IbmDoubleField

public IbmDoubleField(int offset)
Construct an instance.

Parameters:
offset - int the offset in some byte array to the start of this field.
Method Detail

getByteLength

public int getByteLength()
Description copied from interface: Field
Answer the length of the field described by the receiver

Specified by:
getByteLength in interface Field
Returns:
int
See Also:
Field.getByteLength()

getOffset

public int getOffset()
Description copied from interface: Field
Answer the offset of this field into some array of bytes

Specified by:
getOffset in interface Field
Returns:
int
See Also:
Field.getOffset()

setOffset

public void setOffset(int offset)
Specified by:
setOffset in interface Field
See Also:
Field.setOffset(int)

getDouble

public double getDouble(byte[] buffer)
Return an IEEE (binary) double from the given byte array buffer, at the offset of this field.

Specified by:
getDouble in interface DoubleAccessor
Parameters:
buffer - the byte array
Returns:
double

getDouble

public double getDouble(byte[] buffer,
                        int bufOffset)
Return an IEEE (binary) double from the given byte array buffer, at the bufOffset + offset of this field.

Specified by:
getDouble in interface DoubleAccessor
Parameters:
buffer - the byte array
bufOffset - the additional offset into the byte array
Returns:
double

putDouble

public void putDouble(double value,
                      byte[] buffer)
Put a double into the given byte array buffer, at the offset of this field.

Specified by:
putDouble in interface DoubleAccessor
Parameters:
value - the float value
buffer - the byte array
Throws:
java.lang.IllegalArgumentException - if the resulting hexadecimal exponent is too large to fit into the IBM representation.

putDouble

public void putDouble(double value,
                      byte[] buffer,
                      int bufOffset)
Put a double into the given byte array buffer, at the bufOffset + offset of this field.

Specified by:
putDouble in interface DoubleAccessor
Parameters:
value - the float value
buffer - the byte array
bufOffset - the additional offset into the byte array
Throws:
java.lang.IllegalArgumentException - if the resulting hexadecimal exponent is too large to fit into the IBM representation.

equals

public boolean equals(java.lang.Double aDouble,
                      double adouble)
Compare a Double with a double for equality.

Parameters:
aDouble - possibly null
adouble -
Returns:
boolean true if equal, false otherwise