protected java.lang.String |
basicFormat(long num)
Methods inherited from class com.ibm.btt.base.FormatElement |
checkIndexes, exceptionInfo, externalizer, extract, getDataElementName, getExternalizer, getName, getTagName, isCacheable, isConstant, isItConstant, isNull, readExternal, readExternal, readObject, reinitialize, removeExternal, rootDecorated, setDataElementName, setExternalizer, setName, setSize, toTags, unformat, writeExternal, writeExternal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
PackedFormat
public PackedFormat()
- This is the default constructor used to create a PackedFormat object.
PackedFormat
public PackedFormat(java.lang.String aName)
throws java.io.IOException
- This is the constructor used by the externalizer to create a PackedFormat object.
- Parameters:
aName - java.lang.String
- Throws:
java.io.IOException
basicFormat
protected java.lang.String basicFormat(long num)
throws DSEInvalidArgumentException
- Performs the conversion of num into a String. In the String each character
represents two digits compressed into four bits each. This format takes the
asumption that the second byte of a char is 0 (that is, ASCII code).
- Parameters:
num - long
- Returns:
- java.lang.String
- Throws:
DSEInvalidArgumentException
basicParse
protected long basicParse(java.lang.String aString)
throws DSEInvalidArgumentException
- Interprets the String as a packed integer in which a digit is represented
by four bits of a character. As a result, in the String, each character represents two
digits. This format takes the asumption that the second byte of a char is 0 (that is, ASCII code).
- Parameters:
aString - java.lang.String
- Returns:
- long
- Throws:
DSEInvalidArgumentException
format
public java.lang.String format(double value)
throws DSEInvalidArgumentException
- Formats a Double into a packed integer.
- Parameters:
value - double
- Returns:
- java.lang.String
- Throws:
DSEInvalidArgumentException
format
public java.lang.String format(long value)
throws DSEInvalidArgumentException
- Formats a long into a packed integer.
- Parameters:
value - long
- Returns:
- java.lang.String
- Throws:
DSEInvalidArgumentException
formatField
public java.lang.String formatField(DataField aDataField)
throws DSEInvalidClassException,
DSEInvalidArgumentException
- Accesses the value of the aDataField, checks it, and returns it as a packed decimal string
representation with an EBCDIC sign such as "+" --> 0xc or "-" --> 0xd.
- Specified by:
formatField in class FieldFormat
- Parameters:
aDataField - DataField
- Returns:
- String
- Throws:
DSEInvalidClassException
DSEInvalidArgumentException
getDecimalPlaces
public int getDecimalPlaces()
- Returns the value of decimalPlaces.
- Returns:
- int
getSigned
public boolean getSigned()
- Returns the value of the signed attribute.
- Returns:
- boolean
initializeFrom
public java.lang.Object initializeFrom(Tag aTag)
throws java.io.IOException
- Initializes a PackedFormat with the aTag attributes.
- Specified by:
initializeFrom in class FormatElement
- Parameters:
aTag - com.ibm.btt.base.Tag
- Returns:
- java.lang.Object
- Throws:
java.io.IOException
isSigned
public boolean isSigned()
- Returns true if the data is to be formatted as signed.
- Returns:
- boolean
parseToDouble
public double parseToDouble(java.lang.String aString)
throws DSEInvalidArgumentException
- Unformats a String by interpreting it as a packed double.
- Parameters:
aString - java.lang.String
- Returns:
- double
- Throws:
DSEInvalidArgumentException
parseToLong
public long parseToLong(java.lang.String aString)
throws DSEInvalidArgumentException
- Unformats a String by interpreting it as a packed integer.
- Parameters:
aString - java.lang.String
- Returns:
- long
- Throws:
DSEInvalidArgumentException
setDecimalPlaces
public void setDecimalPlaces(int anInt)
- Sets the value of decimalPlaces.
- Parameters:
anInt - int
setSigned
public void setSigned(boolean aBoolean)
- Sets the value of signed.
- Parameters:
aBoolean - boolean
toString
public java.lang.String toString()
- Returns a visual representation of this format.
- Overrides:
toString in class FormatElement
- Returns:
- java.lang.String
unformatField
public DataField unformatField(java.lang.String aString,
DataField aDataField)
throws DSEInvalidArgumentException
- Updates the value of the DataField by interpreting aString as a packed decimal
string representation with an an EBCDIC sign such as "+" --> 0xc or "-" --> 0xd.
- Specified by:
unformatField in class FieldFormat
- Parameters:
aString - StringaDataField - DataField
- Returns:
- DataField
- Throws:
DSEInvalidArgumentException
(c) Copyright IBM Corporation 1998, 2009
|