IBM Branch Transformation Toolkit Javadoc

com.ibm.btt.base
Class FloatFormat

java.lang.Object
  extended bycom.ibm.btt.base.FormatElement
      extended bycom.ibm.btt.base.FieldFormat
          extended bycom.ibm.btt.base.FloatFormat
All Implemented Interfaces:
Cacheable, Externalizable, java.io.Externalizable, java.io.Serializable

public class FloatFormat
extends FieldFormat

This class formats a Float or a Double into the String used as its internal byte-representation. The size of its representation is float (4 bytes) or double precision (8 bytes). You can set attributes to have it return the data field in big-endian (host) or little-endian (PC) byte ordering.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.ibm.btt.base.FormatElement
dataElementName, externalizer, name
 
Constructor Summary
FloatFormat()
          This is the default constructor used to create a FloatFormat object.
FloatFormat(java.lang.String aName)
          This is the constructor used by the Externalizer to create a FloatFormat object.
 
Method Summary
 java.lang.String[] extract(java.lang.String aString)
          Extracts (strips) the substring corresponding to the format element from the input String and returns it and the remaining String as the elements of an array.
 java.lang.String format(double value)
          Formats a Double into the String used as its internal byte-representation.
 java.lang.String format(float value)
          Formats a Float into the String used as its internal byte-representation.
 java.lang.String formatField(DataField aDataField)
          Takes the value of the data field and formats it according its class, Double or Float.
 int getByteOrdering()
          Returns the value of byteOrdering.
 int getSize()
          Returns the value of size.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes a FloatFormat object using the supplied Tag.
 double parseToDouble(java.lang.String aString)
          Obtains a double from the String used as the double's internal byte-representation.
 float parseToFloat(java.lang.String aString)
          Obtains a float from the String used as the float's internal byte-representation.
 void setByteOrdering(int anInt)
          Sets the value of byteOrdering.
 void setSize(int aSize)
          Sets the value of size.
 java.lang.String toString()
          Returns a visual representation of the format element.
 DataField unformatField(java.lang.String aString, DataField aDataField)
          Changes the String to a Double or Float depending on its size.
 
Methods inherited from class com.ibm.btt.base.FieldFormat
format, format, toStrings, unformat, unformat
 
Methods inherited from class com.ibm.btt.base.FormatElement
exceptionInfo, externalizer, getDataElementName, getExternalizer, getName, getTagName, isCacheable, isConstant, isItConstant, readExternal, readExternal, readObject, reinitialize, removeExternal, rootDecorated, setDataElementName, setExternalizer, setName, toTags, writeExternal, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FloatFormat

public FloatFormat()
This is the default constructor used to create a FloatFormat object.


FloatFormat

public FloatFormat(java.lang.String aName)
            throws java.io.IOException
This is the constructor used by the Externalizer to create a FloatFormat object.

Parameters:
aName - java.lang.String
Method Detail

extract

public java.lang.String[] extract(java.lang.String aString)
                           throws DSEInvalidArgumentException
Extracts (strips) the substring corresponding to the format element from the input String and returns it and the remaining String as the elements of an array.

Overrides:
extract in class FormatElement
Parameters:
aString - String
Returns:
String[]
Throws:
DSEInvalidArgumentException

format

public java.lang.String format(double value)
                        throws DSEInvalidArgumentException
Formats a Double into the String used as its internal byte-representation.

Parameters:
value - double
Returns:
java.lang.String
Throws:
DSEInvalidArgumentException

format

public java.lang.String format(float value)
                        throws DSEInvalidArgumentException
Formats a Float into the String used as its internal byte-representation.

Parameters:
value - float
Returns:
java.lang.String
Throws:
DSEInvalidArgumentException

formatField

public java.lang.String formatField(DataField aDataField)
                             throws DSEInvalidArgumentException,
                                    DSEInvalidClassException
Takes the value of the data field and formats it according its class, Double or Float.

Specified by:
formatField in class FieldFormat
Parameters:
aDataField - DataField
Returns:
java.lang.String
Throws:
DSEInvalidArgumentException
DSEInvalidClassException

getByteOrdering

public int getByteOrdering()
Returns the value of byteOrdering.

Returns:
int

getSize

public int getSize()
Returns the value of size.

Returns:
int

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException
Initializes a FloatFormat object using the supplied Tag.

Specified by:
initializeFrom in interface Externalizable
Specified by:
initializeFrom in class FormatElement
Parameters:
aTag - com.ibm.btt.base.Tag
Returns:
java.lang.Object
Throws:
java.io.IOException

parseToDouble

public double parseToDouble(java.lang.String aString)
Obtains a double from the String used as the double's internal byte-representation.

Parameters:
aString - java.lang.String
Returns:
double

parseToFloat

public float parseToFloat(java.lang.String aString)
Obtains a float from the String used as the float's internal byte-representation.

Parameters:
aString - java.lang.String
Returns:
float

setByteOrdering

public void setByteOrdering(int anInt)
Sets the value of byteOrdering. The values for this attribute are: 0 ==> PC or littleEndian 1 ==> Host or bigEndian.


setSize

public void setSize(int aSize)
Sets the value of size. The values for this attribute are: 4 ==> float representation 8 ==> double representation.

Overrides:
setSize in class FormatElement
Parameters:
aSize - int

toString

public java.lang.String toString()
Returns a visual representation of the format element.

Overrides:
toString in class FormatElement
Returns:
java.lang.String

unformatField

public DataField unformatField(java.lang.String aString,
                               DataField aDataField)
Changes the String to a Double or Float depending on its size.

Specified by:
unformatField in class FieldFormat
Parameters:
aString - java.lang.String
Returns:
DataField

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005