Package com.singularsys.jep.bigdecimal.functions

# Class BigDecVSum

java.lang.Object
com.singularsys.jep.functions.PostfixMathCommand
com.singularsys.jep.functions.ArrayFunctionBase
com.singularsys.jep.bigdecimal.functions.BigDecVSum

All Implemented Interfaces:
  `FixedPrecisionFunctionI`, `ZeroLengthBehaviourI`, `PostfixMathCommandI`, `Serializable`

public class BigDecVSum extends ArrayFunctionBase implements FixedPrecisionFunctionI
Sum function, expanding its arguments together. Uses `BigDecimal.add(BigDecimal, MathContext)` for calculating running totals. If the number of decimal places is set, then the final value is rounded to that number of decimal places.

Since:
  Jep 4.1
See Also:
  - Serialized Form

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from interface com.singularsys.jep.functions.ZeroLengthBehaviourI

  `ZeroLengthBehaviourI.DefaultZeroLengthBehaviourI, ZeroLengthBehaviourI.ZeroLengthErrorBehaviour, ZeroLengthBehaviourI.ZeroLengthHelper`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected MathContext`
  `mc`
  `protected int`
  `scale`

  ### Fields inherited from class com.singularsys.jep.functions.PostfixMathCommand

  `curNumberOfParameters, description, name, NaN, numberOfParameters`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BigDecVSum(MathContext mc)`
  Constructor with a given MathContext
  `BigDecVSum(MathContext mc, int dp)`
  Fixed-point constructor

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected Object`
  `calc(List<Object> l)`
  Abstract method for performing the array calculation.
  `boolean`
  `checkNumberOfParameters(int n)`
  Must have one or more parameter
  `int`
  `getDecimalPlaces()`
  Gets the number of decimal places used.
  `MathContext`
  `getMathContext()`
  `void`
  `setDecimalPlaces(int scale)`
  Sets the number of decimal places to use.
  `void`
  `setMathContext(MathContext mc)`

  ### Methods inherited from class com.singularsys.jep.functions.ArrayFunctionBase

  `addToArray, getZeroLengthErrorBehaviour, getZeroLengthValue, run, setZeroLengthErrorBehaviour, setZeroLengthValue, throwAtLeastOneExcep`

  ### Methods inherited from class com.singularsys.jep.functions.PostfixMathCommand

  `asArray, asBool, asDouble, asInt, asLong, asStrictInt, asString, asType, getDescription, getDescription, getDescriptionWithType, getName, getNumberOfParameters, setCurNumberOfParameters, setDescription, setName, toString, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

  ### Methods inherited from interface com.singularsys.jep.functions.ZeroLengthBehaviourI

  `getErrorMessage, getValueOrException, zeroLengthResultOrException`

- ## Field Details

  - ### mc

    protected MathContext mc

  - ### scale

    protected int scale

- ## Constructor Details

  - ### BigDecVSum

    public BigDecVSum(MathContext mc)
    Constructor with a given MathContext
    Parameters:
      `mc` - MathContext to use

  - ### BigDecVSum

    public BigDecVSum(MathContext mc, int dp)
    Fixed-point constructor
    Parameters:
      `mc` - MathContext to use
      `dp` - number of decimal places to round final results to

- ## Method Details

  - ### checkNumberOfParameters

    public boolean checkNumberOfParameters(int n)
    Description copied from class: `ArrayFunctionBase`
    Must have one or more parameter
    Specified by:
      `checkNumberOfParameters` in interface `PostfixMathCommandI`
    Overrides:
      `checkNumberOfParameters` in class `ArrayFunctionBase`
    Parameters:
      `n` - number of parameters function will be called with.
    Returns:
      false if an illegal number of parameters is supplied, true otherwise.

  - ### calc

    protected Object calc(List<Object> l) throws EvaluationException
    Description copied from class: `ArrayFunctionBase`
    Abstract method for performing the array calculation.
    Specified by:
      `calc` in class `ArrayFunctionBase`
    Parameters:
      `l` - The list to operate on. Note this is in reverse order of the arguments of the function.
    Returns:
      The result of the calculation.
    Throws:
      `EvaluationException` - if the calculation cannot be performed

  - ### setDecimalPlaces

    public void setDecimalPlaces(int scale)
    Description copied from interface: `FixedPrecisionFunctionI`
    Sets the number of decimal places to use.
    Specified by:
      `setDecimalPlaces` in interface `FixedPrecisionFunctionI`
    Parameters:
      `scale` - either zero, a positive number or -1 for floating-point formats

  - ### getMathContext

    public MathContext getMathContext()

  - ### setMathContext

    public void setMathContext(MathContext mc)

  - ### getDecimalPlaces

    public int getDecimalPlaces()
    Description copied from interface: `FixedPrecisionFunctionI`
    Gets the number of decimal places used.
    Specified by:
      `getDecimalPlaces` in interface `FixedPrecisionFunctionI`
    Returns:
      either zero, a positive number or -1 for floating-point formats