com.ibm.dse.base
Class IntegerFormat

java.lang.Object
  |
  +--com.ibm.dse.base.FormatElement
        |
        +--com.ibm.dse.base.FieldFormat
              |
              +--com.ibm.dse.base.IntegerFormat
Direct Known Subclasses:
BinaryIntegerStringFormat

public class IntegerFormat
extends FieldFormat

This class formats a Integer or a Long into its internal byte-representation as a String.

See Also:
Serialized Form

Fields inherited from class com.ibm.dse.base.FormatElement
dataElementName, name
 
Constructor Summary
IntegerFormat()
          This is the default constructor used to create an IntegerFormat object.
IntegerFormat(java.lang.String aName)
          This constructor creates an IntegerFormat object with the specified name.
 
Method Summary
 java.lang.String[] extract(java.lang.String aString)
          Extracts the String according its size attribute.
 java.lang.String format(long aValue)
          Returns the integer's binary representation in a chain of bytes provided aValue is from one to eight bytes in size.
 java.lang.String formatField(DataField aDataField)
          Accesses the value of the DataField and checks that it is a valid integer.
 int getByteOrdering()
          Returns the value of byteOrdering.
 boolean getSign()
          Returns the value of sign.
 int getSize()
          Returns the value of size.
 java.lang.Object initializeFrom(Tag aTag)
          Initializes an IntegerFormat with the aTag attributes.
 long parse(java.lang.String aString)
          Converts aString to a char[] and then converts the char[] to a Java long.
 void setByteOrdering(int anInt)
          Sets the value of byteOrdering.
 void setSign(boolean useSign)
          Sets the sign.
 void setSize(int aSize)
          Sets the value of size.
 java.lang.String toString()
          Converts the IntegerFormat to a String.
 DataField unformatField(java.lang.String aString, DataField aDataField)
          Updates the DataField value by interpreting the input string.
 
Methods inherited from class com.ibm.dse.base.FieldFormat
format, format, unformat, unformat
 
Methods inherited from class com.ibm.dse.base.FormatElement
exceptionInfo, externalizer, format, getDataElementName, getExternalizer, getName, getTagName, isCacheable, isConstant, readExternal, readExternal, readObject, reinitialize, removeExternal, rootDecorated, setDataElementName, setExternalizer, setName, toStrings, toTags, unformat, writeExternal, writeExternal
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IntegerFormat

public IntegerFormat()
This is the default constructor used to create an IntegerFormat object.

IntegerFormat

public IntegerFormat(java.lang.String aName)
              throws java.io.IOException
This constructor creates an IntegerFormat object with the specified name.
Parameters:
aName - java.lang.String
Method Detail

extract

public java.lang.String[] extract(java.lang.String aString)
                           throws DSEInvalidArgumentException
Extracts the String according its size attribute.
Overrides:
extract in class FormatElement
Parameters:
aString - String
Returns:
String[]

format

public java.lang.String format(long aValue)
                        throws DSEInvalidArgumentException
Returns the integer's binary representation in a chain of bytes provided aValue is from one to eight bytes in size.
Parameters:
aValue - long
Returns:
java.lang.String

formatField

public java.lang.String formatField(DataField aDataField)
                             throws DSEInvalidArgumentException,
                                    DSEInvalidClassException
Accesses the value of the DataField and checks that it is a valid integer. It then returns the integer's binary representation in a chain of bytes provided aValue is from one to eight bytes in size.
Overrides:
formatField in class FieldFormat
Parameters:
aDataField - DataField
Returns:
String

getByteOrdering

public int getByteOrdering()
Returns the value of byteOrdering.
Returns:
int

getSign

public boolean getSign()
Returns the value of sign.
Returns:
boolean

getSize

public int getSize()
Returns the value of size.
Returns:
int

initializeFrom

public java.lang.Object initializeFrom(Tag aTag)
                                throws java.io.IOException
Initializes an IntegerFormat with the aTag attributes.
Overrides:
initializeFrom in class FormatElement
Parameters:
aTag - com.ibm.dse.base.Tag
Returns:
java.lang.Object

parse

public long parse(java.lang.String aString)
           throws DSEInvalidArgumentException
Converts aString to a char[] and then converts the char[] to a Java long.
Parameters:
aString - java.lang.String
Returns:
long

setByteOrdering

public void setByteOrdering(int anInt)
Sets the value of byteOrdering. The values of the parameter are:

setSign

public void setSign(boolean useSign)
Sets the sign.
Parameters:
useSign - boolean

setSize

public void setSize(int aSize)
Sets the value of size. The values of the parameter are:
Overrides:
setSize in class FormatElement
Parameters:
aSize - int

toString

public java.lang.String toString()
Converts the IntegerFormat to a String. Default values are not concatenated.
Overrides:
toString in class FormatElement
Returns:
java.lang.String

unformatField

public DataField unformatField(java.lang.String aString,
                               DataField aDataField)
                        throws DSEInvalidArgumentException
Updates the DataField value by interpreting the input string.

If the size of the number is:

Overrides:
unformatField in class FieldFormat
Parameters:
aString - String
aDataField - DataField
Returns:
DataField