uk.co.prosperosoftware.pspnum
Class PSPDecAr

java.lang.Object
  |
  +--uk.co.prosperosoftware.pspnum.PSPDecAr
All Implemented Interfaces:
java.io.Serializable

public class PSPDecAr
extends java.lang.Object
implements java.io.Serializable

PSPDecAr (short for 'Prospero Software Products Decimal Array') is a class that records and manipulates arrays of decimal numbers with exact precision. Each PSPDecAr has a declared Dimension (the number of elements in the array). You set the current element of the PSPDecAr array via the setElement() method.

The PSPDecAr class is based on the PSPDec class which is included separately in our decimal numeric packages. In fact, PSPDecAr encapsulates a single PSPDec object named 'Num' which always stores the value of the current PSPDecAr element. 'Num' is declared with public access, so you can invoke any PSPDec method on it directly e.g.


// Declare array 5 elements each 11 digits before decimal place and 2 digits after decimal place
PSPDecAr MyArray = new PSPDecAr(11,2,5);
// Access current element of array - add 1 to it.
MyArray.Num.add("1");

The general rule is that operations on the PSPDec 'Num' object affect only that current element of the array, whereas operations on the entire PSPDecAr affect multiple elements of the array.

You can declare your own arrays/collections of PSPDec objects in Java. However using the PSPDecAr class is considerably more efficient and provides many more operations (such as sorting or summing elements) than a regular Java array of PSPDec objects could provide.

PSPDecAr/PSPDec classes are much better than floating-point to use for decimal numerics. PSPDecAr/PSPDec classes are quite similar to, but also better than the Java BigDecimal class.

Generally all issues for PSPDec arithmetic and logical operations such as overflow and rounding behaviour apply equally to PSPDecAr objects. For example, there are very similar methods such as addRound for the two classes which treat rounding the same way. The only difference is that PSPDecAr offers multiple element values to which these operations may apply, wheras PSPDec is always limited to only one value.

All PSPDecAr elements have the same exact decimal size i.e. you set the number of digits you want either side of the decimal place. The internal numeric value(s) are exact (no degrees of precision) within these limits. You can access the value of one array element or the entire array via the internal packed decimal or zoned decimal formats, however you are more likely to access the numeric value(s) as a plain string or a string you can format via a mask.

Click here for index to PSPDecAr online documentation and some introductory Java code samples showing basic uses of PSPDecAr.

Version:
4.4 05Jun2003
Author:
www.prosperosoftware.co.uk
See Also:
Serialized Form

Field Summary
static int MAXBASE
          Maximum Base (first element number) allowed for any one PSPDecAr array via setBase(..) method.
static int MAXDIMENSION
          Maximum Dimension allowed for any one PSPDecAr array via setDimension(..) method.
 PSPDec Num
          Encapsulated PSPDec object representing current element of PSPDecAr.
 
Constructor Summary
PSPDecAr(char format, int digitsBeforeDP, int digitsAfterDP, int dimension)
          Construct new PSPDecAr with specified format, number of digits either side of decimal place, and dimension.
PSPDecAr(char format, int digitsBeforeDP, int digitsAfterDP, int dimension, PSPDec assignValue)
          Construct new PSPDecAr with specified format, number of digits either side of decimal place, dimension and initial value same as parameter PSPDec.
PSPDecAr(char format, int digitsBeforeDP, int digitsAfterDP, int dimension, java.lang.String assignValue)
          Construct new PSPDecAr with specified format, number of digits either side of decimal place, dimension and initial numeric value(s) in parameter String.
PSPDecAr(int digitsBeforeDP, int digitsAfterDP, int dimension)
          Construct new PSPDecAr with specified number of digits either side of decimal place and dimension.
PSPDecAr(int digitsBeforeDP, int digitsAfterDP, int dimension, PSPDec assignValue)
          Construct new PSPDecAr with number of digits either side of decimal place, dimension and initial value same as parameter PSPDec.
PSPDecAr(int digitsBeforeDP, int digitsAfterDP, int dimension, java.lang.String assignValue)
          Construct new PSPDecAr with number of digits either side of decimal place, dimension and initial numeric value(s) in parameter String.
PSPDecAr(PSPDecAr copyDecAr)
          Construct new PSPDecAr with all attributes and value same as parameter PSPDecAr (copy constructor).
 
Method Summary
 PSPDecAr add(PSPDec addValue)
          Add value of parameter PSPDec to every element of this array (equivalent to the += operator) without rounding.
 PSPDecAr add(java.lang.String addValue)
          Add single numeric value in paramater String to every element of this array (equivalent to the += operator) without rounding.
 PSPDecAr addRound(PSPDec addValue)
          Add value of parameter PSPDec to every element of this array (equivalent to the += operator) with rounding.
 PSPDecAr addRound(java.lang.String addValue)
          Add single numeric value in paramater String to every element of this array (equivalent to the += operator) with rounding.
 PSPDecAr assign(PSPDec assignValue)
          Assign value of parameter PSPDec to every element of this array without rounding.
 PSPDecAr assign(java.lang.String assignValue)
          Assign numeric value(s) in parameter String to elements of this array without rounding.
 PSPDecAr assign(java.lang.String assignValue, char decimalPlace)
          Assign numeric value(s) in parameter String to elements of this array without rounding.
 PSPDecAr assignRound(PSPDec assignValue)
          Assign value of parameter PSPDec to every element of this array with rounding.
 PSPDecAr assignRound(java.lang.String assignValue)
          Assign numeric value(s) in parameter String to elements of this array with rounding.
 PSPDecAr assignRound(java.lang.String assignValue, char decimalPlace)
          Assign numeric value(s) in parameter String to elements of this array with rounding.
 PSPDecAr clear()
          Clear value of every element of array - set to zero.
 PSPDecAr divide(PSPDec that)
          Divide every element of this array by value of parameter PSPDec (equivalent to the /= operator) without rounding.
 PSPDecAr divide(java.lang.String divideValue)
          Divide every element of this array by single numeric value in parameter String (equivalent to the /= operator) without rounding.
 PSPDecAr divideRound(PSPDec divideValue)
          Divide every element of this array by value of parameter PSPDec (equivalent to the /= operator) with rounding.
 PSPDecAr divideRound(java.lang.String divideValue)
          Divide every element of this array by single numeric value in parameter String (equivalent to the /= operator) with rounding.
 int getBase()
          Retrieve Base (index of lowest element) of this array.
 int getDigitsAfterDP()
          Retrieve current setting for number of digits after decimal place (applies to every element of the array).
 int getDigitsBeforeDP()
          Retrieve current setting for number of digits before decimal place (applies to every element of the array).
 int getDimension()
          Retrieve Dimension (total number of elements) of this array.
 int getElement()
          Retrieve current element (index) of this array.
 int getMaxElement()
          Retrieve highest permissible element number (index) of this array.
 byte[] getPackedValue()
          Retrieve numeric value of this entire array (all elements) in packed decimal format.
 byte[] getValue()
          Retrieve numeric value of this entire array (all elements) in format (zoned or packed decimal) currently determined for the array by the Num.getFormat() method.
 int getValueLength()
          Retrieve length of byte array that would be returned by getValue() method.
 byte[] getZonedValue()
          Retrieve numeric value of this entire array (all elements) in zoned decimal format.
 boolean isEQ(PSPDec compareValue)
          Test if every element of this array has numeric value same as parameter PSPDec.
 boolean isEQ(java.lang.String compareValue)
          Test if every element of this array has value same as single numeric value in parameter string.
 boolean isGE(PSPDec compareValue)
          Test if every element of this array has numeric value greater than or equal to parameter PSPDec.
 boolean isGE(java.lang.String rhs)
          Test if every element of this array has value greater than or equal to single numeric value in parameter string.
 boolean isGT(PSPDec compareValue)
          Test if every element of this array has numeric value greater than parameter PSPDec.
 boolean isGT(java.lang.String compareValue)
          Test if every element of this array has value greater than single numeric value in parameter string.
 boolean isLE(PSPDec compareValue)
          Test if every element of this array has numeric value less than or equal to parameter PSPDec.
 boolean isLE(java.lang.String compareValue)
          Test if every element of this array has value less than or equal to single numeric value in parameter string.
 boolean isLT(PSPDec compareValue)
          Test if every element of this array has numeric value less than parameter PSPDec.
 boolean isLT(java.lang.String compareValue)
          Test if every element of this array has value less than single numeric value in parameter string.
 boolean isNE(PSPDec compareValue)
          Test if every element of this array has numeric value not equal to parameter PSPDec.
 boolean isNE(java.lang.String compareValue)
          Test if every element of this array has value not equal to single numeric value in parameter string.
 boolean isNegative()
          Test if every element of this array has a negative value.
 boolean isPositive()
          Test if every element of this array has a positive value.
 boolean isZero()
          Test if every element of this array has a zero value.
 PSPDecAr multiply(PSPDec that)
          Multiply every element of this array by value of parameter PSPDec (equivalent to the *= operator) without rounding.
 PSPDecAr multiply(java.lang.String that)
          Multiply every element of this array by single numeric value in parameter String (equivalent to the *= operator) without rounding.
 PSPDecAr multiplyRound(PSPDec that)
          Multiply every element of this array by value of parameter PSPDec (equivalent to the *= operator) with rounding.
 PSPDecAr multiplyRound(java.lang.String that)
          Multiply every element of this array by single numeric value in parameter String (equivalent to the *= operator) with rounding.
 int setBase(int Base)
          Set Base (index of lowest element) of this array.
 int setDigitsAfterDP(int digitsAfterDP)
          Reset number of digits after the decimal place for this array, without rounding if digits reduced.
 int setDigitsAfterDPRound(int digitsAfterDP)
          Reset number of digits after the decimal place for this array, with rounding if digits reduced.
 int setDigitsBeforeDP(int digitsBeforeDP)
          Reset number of digits before decimal place for this array, with treatment of overflow determined by Num.getOverflow() if digits reduced.
 int setDimension(int d)
          Reset Dimension (total number of elements) of this array.
 int setElement(int idx)
          Set current element (index) of this array.
 PSPDecAr setHighValue()
          Set numeric value of every element of this array to highest possible value - every digit set to 9 and positive value assigned.
 PSPDecAr setLowValue()
          Set numeric value of every element of this array to lowest possible value - every digit set to 9 and negative value assigned.
 PSPDecAr sortAscend()
          Sort elements of this array into ascending sequence by numeric value.
 PSPDecAr sortAscend(boolean preserveElement)
          Sort elements of this array into ascending sequence by numeric value.
 PSPDecAr sortDescend()
          Sort elements of this array into descending sequence by numeric value.
 PSPDecAr sortDescend(boolean preserveElement)
          Sort elements of this array into descending sequence by numeric value.
 PSPDecAr subtract(PSPDec subtractValue)
          Subtract value of parameter PSPDec from every element of this array (equivalent to the -= operator) without rounding.
 PSPDecAr subtract(java.lang.String subtractValue)
          Subtract single numeric value in parameter String from every element of this array (equivalent to the -= operator) without rounding.
 PSPDecAr subtractRound(PSPDec subtractValue)
          Subtract value of parameter PSPDec from every element of this array (equivalent to the -= operator) with rounding.
 PSPDecAr subtractRound(java.lang.String subtractValue)
          Subtract single numeric value in parameter String from every element of this array (equivalent to the -= operator) with rounding.
 java.lang.String sumElements()
          Total element values of this array and return the sum as a plain formatted String with the decimal place (if any) given by the Num.getDecimalPlace() method.
 java.lang.String toString()
          Returns the internal numeric value of all array elements of this array in a String where element values 1) are delimited by ';' and 2) use the decimal place (if any) given by the Num.getDecimalPlace() method.
 java.lang.String toString(char DecimalPlace)
          Returns the internal numeric value of all array elements of this array in a String where element values are 1) delimited by ';' and 2) use the decimal place (if any) specified via parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAXDIMENSION

public static final int MAXDIMENSION
Maximum Dimension allowed for any one PSPDecAr array via setDimension(..) method. Value is 2000.

See Also:
Constant Field Values

MAXBASE

public static final int MAXBASE
Maximum Base (first element number) allowed for any one PSPDecAr array via setBase(..) method. Value is 20000.

See Also:
Constant Field Values

Num

public PSPDec Num
Encapsulated PSPDec object representing current element of PSPDecAr.

Constructor Detail

PSPDecAr

public PSPDecAr(char format,
                int digitsBeforeDP,
                int digitsAfterDP,
                int dimension)
         throws PSPException
Construct new PSPDecAr with specified format, number of digits either side of decimal place, and dimension. All array element values default to zero.

Parameters:
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.
dimension - number of array elemnents.

PSPDecAr

public PSPDecAr(char format,
                int digitsBeforeDP,
                int digitsAfterDP,
                int dimension,
                PSPDec assignValue)
         throws PSPException
Construct new PSPDecAr with specified format, number of digits either side of decimal place, dimension and initial value same as parameter PSPDec.

Parameters:
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.
dimension - number of array elemnents.
assignValue - initial value assigned to *every* element of array.

PSPDecAr

public PSPDecAr(char format,
                int digitsBeforeDP,
                int digitsAfterDP,
                int dimension,
                java.lang.String assignValue)
         throws PSPException
Construct new PSPDecAr with specified format, number of digits either side of decimal place, dimension and initial numeric value(s) in parameter String.

Parameters:
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.
dimension - number of array elements.
assignValue - initial value assigned to *every* element of array (if a single value) otherwise to elements of array from first (if multiple values delimited by ';').

PSPDecAr

public PSPDecAr(int digitsBeforeDP,
                int digitsAfterDP,
                int dimension)
         throws PSPException
Construct new PSPDecAr with specified number of digits either side of decimal place and dimension. Format determined by getFormatDefault() of the encapsulated PSPDec object 'Num'. All array element values default to zero.

Parameters:
digitsBeforeDP - for number of digits before decimal place.
digitsAfterDP - for number of digits after decimal place.
dimension - number of array elements.

PSPDecAr

public PSPDecAr(int digitsBeforeDP,
                int digitsAfterDP,
                int dimension,
                PSPDec assignValue)
         throws PSPException
Construct new PSPDecAr with number of digits either side of decimal place, dimension and initial value same as parameter PSPDec. Format determined by getFormatDefault() of encapsulated PSPDec object 'Num'.

Parameters:
digitsBeforeDP - for number of digits before decimal place.
digitsAfterDP - for number of digits after decimal place.
dimension - number of array elements.
assignValue - initial value assigned to *every* element of array.

PSPDecAr

public PSPDecAr(int digitsBeforeDP,
                int digitsAfterDP,
                int dimension,
                java.lang.String assignValue)
         throws PSPException
Construct new PSPDecAr with number of digits either side of decimal place, dimension and initial numeric value(s) in parameter String. Format determined by getFormatDefault() of encapsulated PSPDec object 'Num'.

Parameters:
digitsBeforeDP - for number of digits before decimal place.
digitsAfterDP - for number of digits after decimal place.
dimension - number of array elements.
assignValue - initial value assigned to *every* element of array (if a single value) otherwise to elements of array from first (if multiple values delimited by ';').

PSPDecAr

public PSPDecAr(PSPDecAr copyDecAr)
         throws PSPException
Construct new PSPDecAr with all attributes and value same as parameter PSPDecAr (copy constructor).

Parameters:
copyDecAr - the PSPDecAr to be copied.
Method Detail

add

public PSPDecAr add(PSPDec addValue)
             throws PSPException
Add value of parameter PSPDec to every element of this array (equivalent to the += operator) without rounding.

Parameters:
addValue - value to be added to every element of this array.
Returns:
this PSPDecAr after the addition.
PSPException

add

public PSPDecAr add(java.lang.String addValue)
             throws PSPException
Add single numeric value in paramater String to every element of this array (equivalent to the += operator) without rounding.

Parameters:
addValue - value to be added to every element of this array.
Returns:
this PSPDecAr after the addition.
PSPException

addRound

public PSPDecAr addRound(PSPDec addValue)
                  throws PSPException
Add value of parameter PSPDec to every element of this array (equivalent to the += operator) with rounding.

Parameters:
addValue - value to be added to every element of this array.
Returns:
this PSPDecAr after the addition.
PSPException

addRound

public PSPDecAr addRound(java.lang.String addValue)
                  throws PSPException
Add single numeric value in paramater String to every element of this array (equivalent to the += operator) with rounding.

Parameters:
addValue - value to be added to every element of this array.
Returns:
this PSPDecAr after the addition.
PSPException

assign

public PSPDecAr assign(PSPDec assignValue)
                throws PSPException
Assign value of parameter PSPDec to every element of this array without rounding.

Parameters:
assignValue - value to be assigned to every element of this array.
Returns:
this PSPDecAr after the assignment.
PSPException

assign

public PSPDecAr assign(java.lang.String assignValue)
                throws PSPException
Assign numeric value(s) in parameter String to elements of this array without rounding. Each numeric value in parameter String is assumed to have the decimal place (if any) given by the Num.getDecimalPlace() method.

Parameters:
assignValue - value assigned to every element of array (if a single value) otherwise to elements of array from first (if multiple values delimited by ';').
Returns:
this PSPDecAr after the assignment.
PSPException

assign

public PSPDecAr assign(java.lang.String assignValue,
                       char decimalPlace)
                throws PSPException
Assign numeric value(s) in parameter String to elements of this array without rounding. Each numeric value in parameter String is assumed to have the decimal place (if any) given by the second parameter.

Parameters:
assignValue - value assigned to every element of array (if a single value) otherwise to elements of array from first (if multiple values delimited by ';').
decimalPlace - the character used for the decimal place in the String.
Returns:
this PSPDecAr after the assignment.
PSPException

assignRound

public PSPDecAr assignRound(PSPDec assignValue)
                     throws PSPException
Assign value of parameter PSPDec to every element of this array with rounding.

Parameters:
assignValue - value to be assigned to every element of this array.
Returns:
this PSPDecAr after the assignment.
PSPException

assignRound

public PSPDecAr assignRound(java.lang.String assignValue)
                     throws PSPException
Assign numeric value(s) in parameter String to elements of this array with rounding. Each numeric value in parameter String is assumed to have the decimal place (if any) given by the Num.getDecimalPlace() method.

Parameters:
assignValue - value assigned to *every* element of array (if a single value) otherwise to elements of array from first (if multiple values delimited by ';').
Returns:
this PSPDecAr after the assignment.
PSPException

assignRound

public PSPDecAr assignRound(java.lang.String assignValue,
                            char decimalPlace)
                     throws PSPException
Assign numeric value(s) in parameter String to elements of this array with rounding. Each numeric value in parameter String is assumed to have the decimal place (if any) given by the second parameter.

Parameters:
assignValue - value assigned to every element of array (if a single value) otherwise to elements of array from first (if multiple values delimited by ';').
decimalPlace - the character used for the decimal place in the String.
Returns:
this PSPDecAr after the assignment.
PSPException

clear

public PSPDecAr clear()
               throws PSPException
Clear value of every element of array - set to zero.

Returns:
this PSPDecAr after all elements set to zero.
PSPException

divide

public PSPDecAr divide(PSPDec that)
                throws PSPException
Divide every element of this array by value of parameter PSPDec (equivalent to the /= operator) without rounding.

Returns:
this PSPDecAr after the division.
PSPException

divide

public PSPDecAr divide(java.lang.String divideValue)
                throws PSPException
Divide every element of this array by single numeric value in parameter String (equivalent to the /= operator) without rounding.

Parameters:
divideValue - value to be divided into every element of this array.
Returns:
this PSPDecAr after the division.
PSPException

divideRound

public PSPDecAr divideRound(PSPDec divideValue)
                     throws PSPException
Divide every element of this array by value of parameter PSPDec (equivalent to the /= operator) with rounding.

Parameters:
divideValue - value to be divided into every element of this array.
Returns:
this PSPDecAr after the division.
PSPException

divideRound

public PSPDecAr divideRound(java.lang.String divideValue)
                     throws PSPException
Divide every element of this array by single numeric value in parameter String (equivalent to the /= operator) with rounding.

Parameters:
divideValue - value to be divided into every element of this array.
Returns:
this PSPDecAr after the division.
PSPException

getBase

public int getBase()
Retrieve Base (index of lowest element) of this array.

Returns:
Base of array (lowest element index).

getDimension

public int getDimension()
Retrieve Dimension (total number of elements) of this array.

Returns:
Dimension of array (number of elements).

getDigitsAfterDP

public int getDigitsAfterDP()
Retrieve current setting for number of digits after decimal place (applies to every element of the array).

Returns:
number of digits after decimal place.

getDigitsBeforeDP

public int getDigitsBeforeDP()
Retrieve current setting for number of digits before decimal place (applies to every element of the array).

Returns:
number of digits before decimal place.

getElement

public int getElement()
Retrieve current element (index) of this array. This should always have a value between getBase() and getMaxElement().

Returns:
current element (index) of this array.

getMaxElement

public int getMaxElement()
Retrieve highest permissible element number (index) of this array. This should always have a value of Base+Dimension-1.

Returns:
highest element (index) of this array.

getPackedValue

public byte[] getPackedValue()
                      throws PSPException
Retrieve numeric value of this entire array (all elements) in packed decimal format.

Returns:
byte array holding array value in packed decimal format.
PSPException

getValue

public byte[] getValue()
                throws PSPException
Retrieve numeric value of this entire array (all elements) in format (zoned or packed decimal) currently determined for the array by the Num.getFormat() method.

Returns:
byte array holding array value in packed or zoned decimal value.
PSPException

getValueLength

public int getValueLength()
Retrieve length of byte array that would be returned by getValue() method.

Returns:
length of byte array that would be returned by getValue() method.

getZonedValue

public byte[] getZonedValue()
                     throws PSPException
Retrieve numeric value of this entire array (all elements) in zoned decimal format.

Returns:
byte array holding array value in zoned decimal format.
PSPException

isEQ

public boolean isEQ(PSPDec compareValue)
             throws PSPException
Test if every element of this array has numeric value same as parameter PSPDec.

Parameters:
compareValue - PSPDec with value to be compared.
Returns:
true if all elements of this array have value == parameter value, otherwise false.
PSPException

isEQ

public boolean isEQ(java.lang.String compareValue)
             throws PSPException
Test if every element of this array has value same as single numeric value in parameter string.

Parameters:
compareValue - String holding single numeric value to be compared.
Returns:
true if all elements of this array have value == parameter value, otherwise false.
PSPException

isGE

public boolean isGE(PSPDec compareValue)
             throws PSPException
Test if every element of this array has numeric value greater than or equal to parameter PSPDec.

Parameters:
compareValue - PSPDec with value to be compared.
Returns:
true if all elements of this array have value >= parameter value, otherwise false.
PSPException

isGE

public boolean isGE(java.lang.String rhs)
             throws PSPException
Test if every element of this array has value greater than or equal to single numeric value in parameter string.

Returns:
true if all elements of this array have value >= parameter value, otherwise false.
PSPException

isGT

public boolean isGT(PSPDec compareValue)
             throws PSPException
Test if every element of this array has numeric value greater than parameter PSPDec.

Parameters:
compareValue - PSPDec with value to be compared.
Returns:
true if all elements of this array have value > parameter value, otherwise false.
PSPException

isGT

public boolean isGT(java.lang.String compareValue)
             throws PSPException
Test if every element of this array has value greater than single numeric value in parameter string.

Parameters:
compareValue - String holding single numeric value to be compared.
Returns:
true if all elements of this array have value > parameter value, otherwise false.
PSPException

isLE

public boolean isLE(PSPDec compareValue)
             throws PSPException
Test if every element of this array has numeric value less than or equal to parameter PSPDec.

Parameters:
compareValue - PSPDec with value to be compared.
Returns:
true if all elements of this array have value <= parameter value, otherwise false.
PSPException

isLE

public boolean isLE(java.lang.String compareValue)
             throws PSPException
Test if every element of this array has value less than or equal to single numeric value in parameter string.

Parameters:
compareValue - String holding single numeric value to be compared.
Returns:
true if all elements of this array have value <= parameter value, otherwise false.
PSPException

isLT

public boolean isLT(PSPDec compareValue)
             throws PSPException
Test if every element of this array has numeric value less than parameter PSPDec.

Parameters:
compareValue - PSPDec with value to be compared.
Returns:
true if all elements of this array have value < parameter value, otherwise false.
PSPException

isLT

public boolean isLT(java.lang.String compareValue)
             throws PSPException
Test if every element of this array has value less than single numeric value in parameter string.

Parameters:
compareValue - String holding single numeric value to be compared.
Returns:
true if all elements of this array have value < parameter value, otherwise false.
PSPException

isNE

public boolean isNE(PSPDec compareValue)
             throws PSPException
Test if every element of this array has numeric value not equal to parameter PSPDec.

Parameters:
compareValue - PSPDec with value to be compared.
Returns:
true if all elements of this array have value != parameter value, otherwise false.
PSPException

isNE

public boolean isNE(java.lang.String compareValue)
             throws PSPException
Test if every element of this array has value not equal to single numeric value in parameter string.

Parameters:
compareValue - PSPDec with value to be compared.
Returns:
true if all elements of this array have value != parameter value, otherwise false.
PSPException

isNegative

public boolean isNegative()
Test if every element of this array has a negative value.

Returns:
true if every element of this array has a negative value, otherwise false.

isPositive

public boolean isPositive()
Test if every element of this array has a positive value.

Returns:
true if every element of this array has a positive value, otherwise false.

isZero

public boolean isZero()
Test if every element of this array has a zero value.

Returns:
true if every element of this array has a zero value, otherwise false.

multiply

public PSPDecAr multiply(PSPDec that)
                  throws PSPException
Multiply every element of this array by value of parameter PSPDec (equivalent to the *= operator) without rounding.

Returns:
this PSPDecAr after the multiplication.
PSPException

multiply

public PSPDecAr multiply(java.lang.String that)
                  throws PSPException
Multiply every element of this array by single numeric value in parameter String (equivalent to the *= operator) without rounding.

Returns:
this PSPDecAr after the multiplication.
PSPException

multiplyRound

public PSPDecAr multiplyRound(PSPDec that)
                       throws PSPException
Multiply every element of this array by value of parameter PSPDec (equivalent to the *= operator) with rounding.

Returns:
this PSPDecAr after the multiplication.
PSPException

multiplyRound

public PSPDecAr multiplyRound(java.lang.String that)
                       throws PSPException
Multiply every element of this array by single numeric value in parameter String (equivalent to the *= operator) with rounding.

Returns:
this PSPDecAr after the multiplication.
PSPException

setBase

public int setBase(int Base)
Set Base (index of lowest element) of this array. The current element getElement() is adjusted by the difference between the old/new bases so as to index the same element in the array before/after the Base is changed.

Parameters:
Base - new Base for array.
Returns:
the revised Base for array.

setDigitsAfterDP

public int setDigitsAfterDP(int digitsAfterDP)
Reset number of digits after the decimal place for this array, without rounding if digits reduced. The new setting applies to every element of the array.

Parameters:
digitsAfterDP - the new number of digits after the decimal place.
Returns:
the revised number of digits after the decimal place.

setDigitsAfterDPRound

public int setDigitsAfterDPRound(int digitsAfterDP)
Reset number of digits after the decimal place for this array, with rounding if digits reduced. The new setting applies to every element of the array.

Parameters:
digitsAfterDP - the new number of digits after the decimal place.
Returns:
the revised number of digits after the decimal place.

setDigitsBeforeDP

public int setDigitsBeforeDP(int digitsBeforeDP)
Reset number of digits before decimal place for this array, with treatment of overflow determined by Num.getOverflow() if digits reduced. The new setting applies to every element of the array.

Parameters:
digitsBeforeDP - the new number of digits before the decimal place.
Returns:
the revised number of digits before the decimal place.

setDimension

public int setDimension(int d)
Reset Dimension (total number of elements) of this array. If the dimension is reduced, then the current element getElement() may be reduced if it previously indexed an element in the reduced portion of the array. In this case, the new current element is simply the last in the array.

Returns:
the revised dimension of the array.

setElement

public int setElement(int idx)
Set current element (index) of this array. This should always have a value between getBase() and getMaxElement(). When you do this, the new element value is automatically refreshed in the PSPDec named 'Num' encapsulated within this PSPDecAr.

Returns:
current element (index) of this array.

setHighValue

public PSPDecAr setHighValue()
                      throws PSPException
Set numeric value of every element of this array to highest possible value - every digit set to 9 and positive value assigned.

Returns:
this array after all element values reset to highest possible.
PSPException

setLowValue

public PSPDecAr setLowValue()
                     throws PSPException
Set numeric value of every element of this array to lowest possible value - every digit set to 9 and negative value assigned.

Returns:
this array after all element values reset to lowest possible.
PSPException

sortAscend

public PSPDecAr sortAscend()
                    throws PSPException
Sort elements of this array into ascending sequence by numeric value. The current element getElement() of the array is unchanged, so the encapsulated PSPDec 'Num' may have a different numeric value after the sort.

Returns:
this array after element values sorted into ascending sequence.
PSPException

sortAscend

public PSPDecAr sortAscend(boolean preserveElement)
                    throws PSPException
Sort elements of this array into ascending sequence by numeric value. The current element getElement() of the array may change or not, depending upon your boolean choice for the single parameter to this method. If 'false' then the current element does not change in which case the encapsulated PSPDec 'Num' may have a different numeric value after the sort. If 'true', then the current element changes so that it indexes the same numeric value in the array before/after the sort - the encapsulated PSPDec 'Num' holds the same numeric value after the sort as before.

Parameters:
preserveElement - if current element of array is to index same numeric value before and after the sort - getElement() is allowed to adjust.
Returns:
this array after element values sorted into ascending sequence.
PSPException

sortDescend

public PSPDecAr sortDescend()
                     throws PSPException
Sort elements of this array into descending sequence by numeric value. The current element getElement() of the array is unchanged, so the encapsulated PSPDec 'Num' may have a different numeric value after the sort.

Returns:
this array after element values sorted into descending sequence.
PSPException

sortDescend

public PSPDecAr sortDescend(boolean preserveElement)
                     throws PSPException
Sort elements of this array into descending sequence by numeric value. The current element getElement() of the array may change or not, depending upon your boolean choice for the single parameter to this method. If 'false' then the current element does not change in which case the encapsulated PSPDec 'Num' may have a different numeric value after the sort. If 'true', then the current element changes so that it indexes the same numeric value in the array before/after the sort so the encapsulated PSPDec 'Num' holds the same numeric value after the sort as before.

Parameters:
preserveElement - if current element of array is to index same numeric value before and after the sort - getElement() is allowed to adjust.
Returns:
this array after element values sorted into descending sequence.
PSPException

subtract

public PSPDecAr subtract(PSPDec subtractValue)
                  throws PSPException
Subtract value of parameter PSPDec from every element of this array (equivalent to the -= operator) without rounding.

Parameters:
subtractValue - value to be subtracted from every element of this array.
Returns:
this PSPDecAr after the subtraction.
PSPException

subtract

public PSPDecAr subtract(java.lang.String subtractValue)
                  throws PSPException
Subtract single numeric value in parameter String from every element of this array (equivalent to the -= operator) without rounding.

Parameters:
subtractValue - value to be subtracted from every element of this array.
Returns:
this PSPDecAr after the subtraction.
PSPException

subtractRound

public PSPDecAr subtractRound(PSPDec subtractValue)
                       throws PSPException
Subtract value of parameter PSPDec from every element of this array (equivalent to the -= operator) with rounding.

Parameters:
subtractValue - value to be subtracted from every element of this array.
Returns:
this PSPDecAr after the subtraction.
PSPException

subtractRound

public PSPDecAr subtractRound(java.lang.String subtractValue)
                       throws PSPException
Subtract single numeric value in parameter String from every element of this array (equivalent to the -= operator) with rounding.

Parameters:
subtractValue - value to be subtracted from every element of this array.
Returns:
this PSPDecAr after the subtraction.
PSPException

sumElements

public java.lang.String sumElements()
                             throws PSPException
Total element values of this array and return the sum as a plain formatted String with the decimal place (if any) given by the Num.getDecimalPlace() method.

Returns:
the sum of all array elements as a plain formatted String.
PSPException

toString

public java.lang.String toString()
                          throws PSPException
Returns the internal numeric value of all array elements of this array in a String where element values 1) are delimited by ';' and 2) use the decimal place (if any) given by the Num.getDecimalPlace() method.

Overrides:
toString in class java.lang.Object
Returns:
numeric value of all array elements as a String.
PSPException

toString

public java.lang.String toString(char DecimalPlace)
                          throws PSPException
Returns the internal numeric value of all array elements of this array in a String where element values are 1) delimited by ';' and 2) use the decimal place (if any) specified via parameter.

Returns:
numeric value of all array elements as a String.
PSPException