com.ibm.jzos.fields
Class ExternalFloatField

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

public class ExternalFloatField
extends java.lang.Object
implements DoubleAccessor

A character floating point representation Field with double accessors. In Cobol, refered to as "External Float".


Constructor Summary
ExternalFloatField(int offset, int precision, int scale, boolean mantSign, boolean expSign, boolean impliedDecimal)
          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 a double from the given byte array buffer, at the offset of this field.
 double getDouble(byte[] buffer, int bufOffset)
          Return a double from the given byte array buffer, at the bufOffset + offset of this field.
 int getLength()
           
 int getOffset()
          Answer the offset of this field into some array of bytes
 int getPrecision()
           
 int getScale()
           
 boolean isImpliedDecimal()
           
 boolean isShowExponentPlusSign()
           
 boolean isShowMantissaPlusSign()
           
 void putDouble(double value, byte[] buffer)
          Put a double value into the given byte array buffer, at the offset of this field.
 void putDouble(double value, byte[] buffer, int bufOffset)
          Put a double value 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
 

Constructor Detail

ExternalFloatField

public ExternalFloatField(int offset,
                          int precision,
                          int scale,
                          boolean mantSign,
                          boolean expSign,
                          boolean impliedDecimal)
Construct an instance.

Parameters:
offset - int the offset of this field
precision - in the number of decimal degits of precision
scale - the number of implied decimal digits to the right of the decimal point
mantSign - true if the '+' character is present for positive mantissa values. A minus character '-' is always present for negative values.
expSign - true if the '+' character is present for positive exponent values A minus character '-' is always present for negative values.
impliedDecimal - true if the decimal point is not explicit
Method Detail

getDouble

public double getDouble(byte[] buffer)
Return a 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 a 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 value into the given byte array buffer, at the offset of this field.

Specified by:
putDouble in interface DoubleAccessor
Parameters:
value - the double value
buffer - the byte array
Throws:
java.lang.IllegalArgumentException - if the value is Infinity or NaN

putDouble

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

Specified by:
putDouble in interface DoubleAccessor
Parameters:
value - the double value
buffer - the byte array
bufOffset - the additional offset into the byte array
Throws:
java.lang.IllegalArgumentException - if the value is Infinity or NaN

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)

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

isImpliedDecimal

public boolean isImpliedDecimal()

getLength

public int getLength()

getPrecision

public int getPrecision()

getScale

public int getScale()

isShowExponentPlusSign

public boolean isShowExponentPlusSign()

isShowMantissaPlusSign

public boolean isShowMantissaPlusSign()