|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--uk.co.prosperosoftware.pspnum.PSPDec
PSPDec (short for 'Prospero Software Products Decimal') is a class that records and manipulates decimal numbers with exact precision. PSPDec is significantly better than floating-point for decimal numbers. PSPDec is quite similar to, but also better than the Java BigDecimal class.
Each PSPDec has an exact decimal size i.e. you set the number of digits you want either side of the decimal place. The internal numeric value is exact (no degrees of precision) within these limits. You can access the value via the internal packed decimal or zoned decimal formats, however you are more likely to access the numeric value as a plain string or a string you can format via a mask.
PSPDec supports a number of common arithmetic and logical operations for which you can specify both overflow and rounding behaviour.
Click here for index to PSPDec online documentation and some introductory Java code samples showing basic uses of PSPDec.
| Field Summary | |
static int |
MAX_DIGITS
Maximum number (100) of digits in total (before and after decimal place) for PSPDec. |
static int |
MAX_DIGITS_AFTER
Maximum number (50) of digits after decimal place for PSPDec. |
static int |
MAX_DIGITS_BEFORE
Maximum number (50) of digits before decimal place for PSPDec. |
static byte |
OVERFLOW_BUMP_BEFOREDP
When overflow occurs, PSPDec automatically increments DigitsBeforeDP to accommodate the new value. |
static byte |
OVERFLOW_EXCEPTION
When overflow occurs, PSPDec throws a PSPException error for which getErrNum() returns
PSPException.NumOverflow. |
static byte |
OVERFLOW_IGNORE
When overflow occurs, PSPDec silently ignores the new value. |
static byte |
OVERFLOW_IGNORE_BEEP
When overflow occurs, PSPDec ignores the new value and beeps. |
static byte |
OVERFLOW_TRUNCATE
When overflow occurs, PSPDec silently truncates excess high-order digits. |
static byte |
OVERFLOW_TRUNCATE_BEEP
When overflow occurs, PSPDec truncates excess high-order digits and beeps. |
| Constructor Summary | |
PSPDec(char format,
int digitsBeforeDP,
int digitsAfterDP)
Construct new PSPDec with specified format and number of digits either side of decimal place. |
|
PSPDec(char format,
int digitsBeforeDP,
int digitsAfterDP,
PSPDec assignValue)
Construct new PSPDec with specified format, number of digits either side of decimal place and initial value given by parameter PSPDec. |
|
PSPDec(char format,
int digitsBeforeDP,
int digitsAfterDP,
java.lang.String assignValue)
Construct new PSPDec with specified format, number of digits either side of decimal place and initial numeric value in parameter String. |
|
PSPDec(int digitsBeforeDP,
int digitsAfterDP)
Construct new PSPDec with default format and number of digits either side of decimal place. |
|
PSPDec(int digitsBeforeDP,
int digitsAfterDP,
PSPDec assignValue)
Construct new PSPDec with default format, number of digits either side of decimal place and initial value given by parameter PSPDec. |
|
PSPDec(int digitsBeforeDP,
int digitsAfterDP,
java.lang.String assignValue)
Construct new PSPDec with default format, number of digits either side of decimal place and initial numeric value in parameter String. |
|
PSPDec(PSPDec copyDec)
Construct new PSPDec with format, number of digits either side of decimal place, initial value and all other attributes same as parameter PSPDec (copy constructor). |
|
PSPDec(java.lang.String assignValue)
Construct new PSPDec with default format and number of digits either side of decimal place and initial numeric value in parameter String. |
|
| Method Summary | |
PSPDec |
add(PSPDec addValue)
Add value of parameter PSPDec to this value (equivalent to the += operator) without rounding. |
PSPDec |
add(java.lang.String addValue)
Add numeric value in parameter String to this value (equivalent to the += operator) without rounding. |
PSPDec |
addRound(PSPDec addValue)
Add value of parameter PSPDec to this value (equivalent to the += operator) with rounding. |
PSPDec |
addRound(java.lang.String addValue)
Add numeric value in parameter String to this value (equivalent to the += operator) with rounding. |
PSPDec |
assign(PSPDec assignValue)
Assign value of parameter PSPDec to this value without rounding. |
PSPDec |
assign(java.lang.String assignValue)
Assign numeric value in parameter String to this value without rounding. |
PSPDec |
assign(java.lang.String assignValue,
char decimalPlace)
Assign numeric value in parameter String to this value without rounding given the use of the parameter character for the decimal place in the String. |
PSPDec |
assignLeft(PSPDec assignValue)
Assign value of parameter PSPDec to this value - digit-by-digit from left hand side (high-order) ignoring decimal places in both numbers. |
PSPDec |
assignLeftClear(PSPDec assignValue)
Assign value of parameter PSPDec to this value - digit-by-digit from left hand side (high-order) ignoring decimal places in both numbers. |
PSPDec |
assignRight(PSPDec assignValue)
Assign value of parameter PSPDec to this value - digit-by-digit from right hand side (low-order) ignoring decimal places in both numbers. |
PSPDec |
assignRightClear(PSPDec assignValue)
Assign value of parameter PSPDec to this value - digit-by-digit from right hand side (low-order) ignoring decimal places in both numbers. |
PSPDec |
assignRound(PSPDec assignValue)
Assign value of parameter PSPDec to this value with rounding. |
PSPDec |
assignRound(java.lang.String assignValue)
Assign numeric value in parameter String to this value with rounding. |
PSPDec |
assignRound(java.lang.String value,
char decimalPlace)
Assign numeric value in parameter String to this value with rounding given the use of the parameter character for the decimal place in the String. |
static int |
checkStringNumber(java.lang.String value,
char decimalPlace)
Check numeric value in parameter String given the use of the parameter character for the decimal place in the String. |
static int |
checkStringNumber(java.lang.String value,
char decimalPlace,
java.lang.StringBuffer formattedValue)
Check numeric value in parameter String given the use of the parameter character for the decimal place in the String. |
static int |
checkStringNumber(java.lang.String value,
PSPDecMask mask,
java.lang.StringBuffer formattedValue)
Check numeric value in parameter String given the use of the parameter mask for the fully formatted String. |
PSPDec |
clear()
Clear value - set to zero. |
PSPDec |
divide(PSPDec divideValue)
Divide this PSPDec by parameter PSPDec value (equivalent to the /= operator) without rounding. |
PSPDec |
divide(java.lang.String divideValue)
Divide this PSPDec by numeric value in parameter String (equivalent to the /= operator) without rounding. |
PSPDec |
divideRemainder(PSPDec divideValue,
PSPDec remainder)
Divide this PSPDec by first parameter PSPDec value (equivalent to the /= operator) without rounding and assign remainder to second parameter PSPDec. |
PSPDec |
divideRemainder(java.lang.String divideValue,
PSPDec remainder)
Divide this PSPDec by numeric value in parameter String value (equivalent to the /= operator) without rounding and assign remainder to parameter PSPDec. |
PSPDec |
divideRound(PSPDec divideValue)
Divide this PSPDec by parameter PSPDec value (equivalent to the /= operator) with rounding. |
PSPDec |
divideRound(java.lang.String divideValue)
Divide this PSPDec by numeric value in parameter String (equivalent to the /= operator) with rounding. |
double |
doubleValue()
Convert internal numeric value to a double via intermediate conversion to String s followed by the Double.valueOf(s).doubleValue() method. |
float |
floatValue()
Convert internal numeric value to a float via call to doubleValue() which is then cast to a float. |
char |
getDecimalPlace()
Gets decimal place for this PSPDec object. |
char |
getDecimalPlaceDefault()
Gets default decimal place for PSPDec class (this is the default for any new PSPDec objects created). |
int |
getDigits()
Retrieve current setting for total number of digits (before and after decimal place). |
int |
getDigitsAfterDP()
Retrieve current setting for number of digits after decimal place. |
int |
getDigitsBeforeDP()
Retrieve current setting for number of digits before decimal place. |
char |
getFormat()
Retrieve current decimal format. |
char |
getFormatDefault()
Retrieve decimal format default for new PSPDecs. |
byte |
getOverflow()
Returns current setting for overflow following program operations. |
byte[] |
getPackedValue()
Retrieve numeric value of this PSPDec in packed decimal format. |
int |
getUsedDigitsAfterDP()
Determine number of digits after decimal place actually used for current numeric value. |
int |
getUsedDigitsBeforeDP()
Determine number of digits before decimal place actually used for current numeric value. |
byte[] |
getValue()
Retrieve numeric value of this PSPDec in format (zoned or packed decimal) currently specified for this PSPDec. |
int |
getValueLength()
Retrieve length of byte array that would be returned by ( getValue() method. |
byte[] |
getZonedValue()
Retrieve numeric value of this PSPDec in zoned decimal format. |
int |
intValue()
Convert internal numeric value to an int via call to longValue() which is then cast to an int. |
boolean |
isEQ(PSPDec compareValue)
Test if this PSPDec has numeric value same as parameter PSPDec. |
boolean |
isEQ(java.lang.String compareValue)
Test if this PSPDec has value same as numeric value in parameter String. |
boolean |
isGE(PSPDec compareValue)
Test if this PSPDec has numeric value greater than or equal to parameter PSPDec. |
boolean |
isGE(java.lang.String compareValue)
Test if this PSPDec has value greater than or equal to numeric value in parameter String. |
boolean |
isGT(PSPDec compareValue)
Test if this PSPDec has numeric value greater than parameter PSPDec. |
boolean |
isGT(java.lang.String compareValue)
Test if this PSPDec has value greater than numeric value in parameter String. |
boolean |
isLE(PSPDec compareValue)
Test if this PSPDec has numeric value less than or equal to parameter PSPDec. |
boolean |
isLE(java.lang.String compareValue)
Test if this PSPDec has value less than or equal to numeric value in parameter String. |
boolean |
isLT(PSPDec compareValue)
Test if this PSPDec has numeric value less than parameter PSPDec. |
boolean |
isLT(java.lang.String compareValue)
Test if this PSPDec has value less than numeric value in parameter String. |
boolean |
isNE(PSPDec compareValue)
Test if this PSPDec has numeric value not equal to parameter PSPDec. |
boolean |
isNE(java.lang.String compareValue)
Test if this PSPDec has value not equal to numeric value in parameter String. |
boolean |
isNegative()
Test if this PSPDec has negative numeric value. |
boolean |
isOddLength()
Test if this PSPDec has total number of digits odd or even. |
boolean |
isPackedFormat()
Test if cuurent format is packed decimal. |
boolean |
isPositive()
Test if this PSPDec has positive numeric value. |
boolean |
isZero()
Test if this PSPDec has zero numeric value. |
boolean |
isZonedFormat()
Test if cuurent format is zoned decimal. |
long |
longValue()
Convert internal numeric value to a long via intermediate conversion toString() followed by substring s selection of
integer portion only which is then returned via
Long.valueOf(s).longValue() method. |
PSPDec |
multiply(PSPDec multiplyValue)
Multiply this value by value of parameter PSPDec (equivalent to the *= operator) without rounding. |
PSPDec |
multiply(java.lang.String multiplyValue)
Multiply this value by numeric value in parameter String (equivalent to the *= operator) without rounding. |
PSPDec |
multiplyRound(PSPDec multiplyValue)
Multiply this value by value of parameter PSPDec (equivalent to the *= operator) with rounding. |
PSPDec |
multiplyRound(java.lang.String multiplyValue)
Multiply this value by numeric value in parameter String (equivalent to the *= operator) with rounding. |
char |
setDecimalPlace(char decimalPlace)
Sets new decimal place for this PSPDec object (not for entire class) to specified character, which must not be whitespace (tab, newline, blank etc.) or a digit 0-9. |
char |
setDecimalPlaceDefault(char decimalPlaceDefault)
Sets new default decimal place for PSPDec class to specified character, which must not be whitespace (tab, newline, blank etc.) or a digit 0-9. |
int |
setDigitsAfterDP(int digitsAfterDP)
Reset number of digits after the decimal place for this PSPDec, without rounding if digits reduced. |
int |
setDigitsAfterDPRound(int digitsAfterDP)
Reset number of digits after the decimal place for this PSPDec, with rounding if digits reduced. |
int |
setDigitsBeforeDP(int digitsBeforeDP)
Reset number of digits before decimal place for this PSPDec, with treatment of overflow determined by getOverflow() if
digits reduced. |
char |
setFormatDefault(char FormatDefault)
Sets default class-level format for any new PSPDec. |
PSPDec |
setHighValue()
Set numeric value of this PSPDec to highest possible value - every digit set to 9 and positive value assigned. |
PSPDec |
setLowValue()
Set numeric value of this PSPDec to lowest possible value - every digit set to 9 and negative value assigned. |
void |
setOverflow(byte overflow)
Set flag for this PSPDec (not for entire class) to control response to numeric overflow when new value set by program operations. |
void |
setOverflowDefault(byte overflowDefault)
Set flag for PSPDec class (applied to new PSPDec's) to control response to numeric overflow when new value set by program operations. |
PSPDec |
setPackedValue(byte[] value)
Sets internal numeric value from parameter byte array which must contain a valid packed decimal value with the required number of bytes determined by the getDigits() method. |
PSPDec |
setValue(byte[] value)
Sets internal numeric value from parameter byte array which must contain a valid packed or zoned decimal value with the required number of bytes determined by the getDigits() method. |
PSPDec |
setZonedValue(byte[] value)
Sets internal numeric value from parameter byte array which must contain a valid zoned decimal value with the required number of bytes determined by the getDigits() method. |
int |
signum()
Returns the signum function of this PSPDec (-1, 0 or 1 as the value of this number is negative, zero or positive). |
PSPDec |
subtract(PSPDec subtractValue)
Subtract value of parameter PSPDec from this value (equivalent to the -= operator) without rounding. |
PSPDec |
subtract(java.lang.String subtractValue)
Subtract numeric value in parameter String from this value (equivalent to the -= operator) without rounding. |
PSPDec |
subtractRound(PSPDec subtractValue)
Subtract value of parameter PSPDec from this value (equivalent to the -= operator) with rounding. |
PSPDec |
subtractRound(java.lang.String subtractValue)
Subtract numeric value in parameter String from this value (equivalent to the -= operator) with rounding. |
java.lang.String |
toString()
Returns the internal numeric value of this PSPDec as a String with the decimal place (if any) given by the getDecimalPlace() method. |
java.lang.String |
toString(char decimalPlace)
Returns the internal numeric value of this PSPDec as a String with the decimal place (if any) given by the parameter character. |
java.lang.String |
toString(PSPDecMask mask)
Returns the internal numeric value of this PSPDec as a fully formatted String with the decimal place and any other formatting given by the parameter mask. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int MAX_DIGITS_BEFORE
public static final int MAX_DIGITS_AFTER
public static final int MAX_DIGITS
public static final byte OVERFLOW_BUMP_BEFOREDP
setOverflowDefault() method.
public static final byte OVERFLOW_EXCEPTION
getErrNum() returns
PSPException.NumOverflow.
public static final byte OVERFLOW_IGNORE
public static final byte OVERFLOW_IGNORE_BEEP
public static final byte OVERFLOW_TRUNCATE
public static final byte OVERFLOW_TRUNCATE_BEEP
| Constructor Detail |
public PSPDec(char format,
int digitsBeforeDP,
int digitsAfterDP)
throws PSPException
format - of internal value: 'P' for packed decimal, 'Z' for zoned decimal.digitsBeforeDP - for number of digits before decimal place.digitsAfterDP - for number of digits after decimal place.
public PSPDec(char format,
int digitsBeforeDP,
int digitsAfterDP,
PSPDec assignValue)
throws PSPException
format - of internal value: 'P' for packed decimal, 'Z' for zoned decimal.digitsBeforeDP - for number of digits before decimal place.digitsAfterDP - for number of digits after decimal place.assignValue - new value assigned to this object.
public PSPDec(char format,
int digitsBeforeDP,
int digitsAfterDP,
java.lang.String assignValue)
throws PSPException
getDecimalPlaceDefault() method.
format - of internal value: 'P' for packed decimal, 'Z' for zoned decimal.digitsBeforeDP - for number of digits before decimal place.digitsAfterDP - for number of digits after decimal place.assignValue - new value assigned to this object.
public PSPDec(int digitsBeforeDP,
int digitsAfterDP)
throws PSPException
digitsBeforeDP - for number of digits before decimal place.digitsAfterDP - for number of digits after decimal place.
public PSPDec(int digitsBeforeDP,
int digitsAfterDP,
PSPDec assignValue)
throws PSPException
digitsBeforeDP - for number of digits before decimal place.digitsAfterDP - for number of digits after decimal place.assignValue - new value assigned to this object.
public PSPDec(int digitsBeforeDP,
int digitsAfterDP,
java.lang.String assignValue)
throws PSPException
getDecimalPlaceDefault() method.
digitsBeforeDP - for number of digits before decimal place.digitsAfterDP - for number of digits after decimal place.assignValue - new value assigned to this object.
public PSPDec(PSPDec copyDec)
throws PSPException
copyDec - the PSPDec to be copied.
public PSPDec(java.lang.String assignValue)
throws PSPException
getDecimalPlaceDefault().
method, which is the decimal place (if any) which it expects to find
in the parameter String.
If the string has a different decimal place, construct the PSPDec
another way, then execute
setDecimalPlace(char).
and assign(String).
assignValue - string holding numeric value from which this PSPDec
to be constructed.| Method Detail |
public PSPDec add(PSPDec addValue)
throws PSPException
addValue - value to be added into this PSPDec.
PSPException
public PSPDec add(java.lang.String addValue)
throws PSPException
addValue - value to be added into this PSPDec.
PSPException
public PSPDec addRound(PSPDec addValue)
throws PSPException
addValue - value to be added into this PSPDec.
PSPException
public PSPDec addRound(java.lang.String addValue)
throws PSPException
addValue - value to be added into this PSPDec.
PSPException
public PSPDec assign(PSPDec assignValue)
throws PSPException
assignValue - value to be assigned to this PSPDec.
PSPException
public PSPDec assign(java.lang.String assignValue)
throws PSPException
getDecimalPlace() method.
assignValue - value to be assigned to this PSPDec.
PSPException
public PSPDec assign(java.lang.String assignValue,
char decimalPlace)
throws PSPException
assignValue - value to be assigned to this PSPDec.decimalPlace - the character used for the decimal place in the String.
PSPException
public PSPDec assignLeft(PSPDec assignValue)
throws PSPException
assignValue - value to be left-assigned to this PSPDec.
PSPException
public PSPDec assignLeftClear(PSPDec assignValue)
throws PSPException
assignValue - value to be left-assigned to this PSPDec.
PSPException
public PSPDec assignRight(PSPDec assignValue)
throws PSPException
assignValue - value to be right-assigned to this PSPDec.
PSPException
public PSPDec assignRightClear(PSPDec assignValue)
throws PSPException
assignValue - value to be right-assigned to this PSPDec.
PSPException
public PSPDec assignRound(PSPDec assignValue)
throws PSPException
assignValue - value to be assigned to this PSPDec.
PSPException
public PSPDec assignRound(java.lang.String assignValue)
throws PSPException
getDecimalPlace() method.
assignValue - value to be assigned to this PSPDec.
PSPException
public PSPDec assignRound(java.lang.String value,
char decimalPlace)
throws PSPException
decimalPlace - the character used for the decimal place in the String.
PSPException
public static int checkStringNumber(java.lang.String value,
char decimalPlace)
throws PSPException
value - String containing numeric value.decimalPlace - the character used for the decimal place in the String.
PSPException
public static int checkStringNumber(java.lang.String value,
char decimalPlace,
java.lang.StringBuffer formattedValue)
throws PSPException
value - String containing numeric value.decimalPlace - the character used for the decimal place in the String.formattedValue - the String value reformatted (should only be used
if return value indicates no error).
PSPException
public static int checkStringNumber(java.lang.String value,
PSPDecMask mask,
java.lang.StringBuffer formattedValue)
throws PSPException
value - String containing numeric value.mask - the mask used to fully format the String numeric value.formattedValue - the String value deformatted (should only be used
if return value indicates no error).
PSPException
public PSPDec clear()
throws PSPException
PSPException
public PSPDec divide(PSPDec divideValue)
throws PSPException
divideValue - value to be divided into this PSPDec.
PSPException
public PSPDec divide(java.lang.String divideValue)
throws PSPException
divideValue - value to be divided into this PSPDec.
PSPException
public PSPDec divideRemainder(PSPDec divideValue,
PSPDec remainder)
throws PSPException
divideValue - value to be divided into this PSPDec.remainder - PSPDec to hold remainder after division.
PSPException
public PSPDec divideRemainder(java.lang.String divideValue,
PSPDec remainder)
throws PSPException
divideValue - value to be divided into this PSPDec.remainder - PSPDec to hold remainder after division.
PSPException
public PSPDec divideRound(PSPDec divideValue)
throws PSPException
divideValue - value to be divided into this PSPDec.
PSPException
public PSPDec divideRound(java.lang.String divideValue)
throws PSPException
divideValue - value to be divided into this PSPDec.
PSPExceptionpublic char getDecimalPlace()
public char getDecimalPlaceDefault()
public int getDigitsAfterDP()
public int getUsedDigitsAfterDP()
getDigitsAfterDP().
public int getDigitsBeforeDP()
public int getUsedDigitsBeforeDP()
getDigitsBeforeDP().
public int getDigits()
public char getFormat()
public boolean isPackedFormat()
public boolean isZonedFormat()
public char getFormatDefault()
public byte[] getPackedValue()
throws PSPException
PSPExceptionpublic byte getOverflow()
public byte[] getValue()
throws PSPException
PSPExceptionpublic int getValueLength()
getValue() method.
getValue() method.
public byte[] getZonedValue()
throws PSPException
PSPException
public boolean isEQ(PSPDec compareValue)
throws PSPException
compareValue - PSPDec with value to be compared.
PSPException
public boolean isEQ(java.lang.String compareValue)
throws PSPException
compareValue - String holding numeric value to be compared.
PSPException
public boolean isGE(PSPDec compareValue)
throws PSPException
compareValue - PSPDec with value to be compared.
PSPException
public boolean isGE(java.lang.String compareValue)
throws PSPException
compareValue - String holding numeric value to be compared.
PSPException
public boolean isGT(PSPDec compareValue)
throws PSPException
compareValue - PSPDec value to be compared.
PSPException
public boolean isGT(java.lang.String compareValue)
throws PSPException
compareValue - String holding numeric value to be compared.
PSPException
public boolean isLE(PSPDec compareValue)
throws PSPException
compareValue - PSPDec with value to be compared.
PSPException
public boolean isLE(java.lang.String compareValue)
throws PSPException
compareValue - String holding numeric value to be compared.
PSPException
public boolean isLT(PSPDec compareValue)
throws PSPException
compareValue - PSPDec with value to be compared.
PSPException
public boolean isLT(java.lang.String compareValue)
throws PSPException
compareValue - String holding numeric value to be compared.
PSPException
public boolean isNE(PSPDec compareValue)
throws PSPException
compareValue - PSPDec with value to be compared.
PSPException
public boolean isNE(java.lang.String compareValue)
throws PSPException
compareValue - String holding numeric value to be compared.
PSPException
public boolean isNegative()
throws PSPException
PSPException
public boolean isPositive()
throws PSPException
PSPException
public boolean isZero()
throws PSPException
PSPExceptionpublic boolean isOddLength()
public PSPDec multiply(PSPDec multiplyValue)
throws PSPException
multiplyValue - value to multiply this PSPDec by.
PSPException
public PSPDec multiply(java.lang.String multiplyValue)
throws PSPException
multiplyValue - value to multiply this PSPDec by.
PSPException
public PSPDec multiplyRound(PSPDec multiplyValue)
throws PSPException
multiplyValue - value to multiply this PSPDec by.
PSPException
public PSPDec multiplyRound(java.lang.String multiplyValue)
throws PSPException
multiplyValue - value to multiply this PSPDec by.
PSPExceptionpublic char setDecimalPlace(char decimalPlace)
getDecimalPlaceDefault()
method.
decimalPlace - new character for decimal place.
public char setDecimalPlaceDefault(char decimalPlaceDefault)
decimalPlaceDefault - character specified as default for decimal place.
public int setDigitsAfterDP(int digitsAfterDP)
throws PSPException
digitsAfterDP - the new number of digits after the decimal place.
PSPException
public int setDigitsAfterDPRound(int digitsAfterDP)
throws PSPException
digitsAfterDP - the new number of digits after the decimal place.
PSPException
public int setDigitsBeforeDP(int digitsBeforeDP)
throws PSPException
getOverflow() if
digits reduced.
digitsBeforeDP - the new number of digits before the decimal place.
PSPExceptionpublic char setFormatDefault(char FormatDefault)
FormatDefault - new format default: 'P' for packed decimal,
'Z' for zoned decimal.
public PSPDec setHighValue()
throws PSPException
PSPException
public PSPDec setLowValue()
throws PSPException
PSPExceptionpublic void setOverflow(byte overflow)
overflow - Flag controlling overflow response.public void setOverflowDefault(byte overflowDefault)
overflowDefault - Flag controlling overflow response.
public PSPDec setPackedValue(byte[] value)
throws PSPException
getDigits() method.
value - byte array containing new packed decimal value.
PSPException
public PSPDec setValue(byte[] value)
throws PSPException
getDigits() method.
The format of the parameter value (zoned or packed) must match that
determined by the getFormat() method.
value - byte array containing new packed/zoned decimal value.
PSPException
public PSPDec setZonedValue(byte[] value)
throws PSPException
getDigits() method.
value - byte array containing new zoned decimal value.
PSPExceptionpublic int signum()
public PSPDec subtract(PSPDec subtractValue)
throws PSPException
subtractValue - value to be subtracted from this PSPDec.
PSPException
public PSPDec subtract(java.lang.String subtractValue)
throws PSPException
subtractValue - value to be subtracted from this PSPDec.
PSPException
public PSPDec subtractRound(PSPDec subtractValue)
throws PSPException
subtractValue - value to be subtracted from this PSPDec.
PSPException
public PSPDec subtractRound(java.lang.String subtractValue)
throws PSPException
subtractValue - value to be subtracted from this PSPDec.
PSPException
public java.lang.String toString()
throws PSPException
getDecimalPlace() method.
toString in class java.lang.ObjectPSPException
public java.lang.String toString(char decimalPlace)
throws PSPException
decimalPlace - the character to be used as the decimal place
in the returned String.
PSPException
public java.lang.String toString(PSPDecMask mask)
throws PSPException
mask - the mask used to format the String.
PSPException
public int intValue()
throws PSPException
longValue() which is then cast to an int.
PSPException
public long longValue()
throws PSPException,
java.lang.NumberFormatException
toString() followed by substring s selection of
integer portion only which is then returned via
Long.valueOf(s).longValue() method.
PSPException