csheets.core.formula.lang
Class Sum

java.lang.Object
  extended by csheets.core.formula.lang.Sum
All Implemented Interfaces:
Function

public class Sum
extends Object
implements Function

A function that returns the numeric sum of its arguments.

Author:
Einar Pehrson

Field Summary
static FunctionParameter[] parameters
          The only (but repeatable) parameter: a numeric term
 
Constructor Summary
Sum()
          Creates a new instance of the SUM function.
 
Method Summary
 Value applyTo(Expression[] arguments)
          Invokes the function using the given arguments and returns the result.
 String getIdentifier()
          Returns the operator's string identirifer.
 FunctionParameter[] getParameters()
          Returns the parameters of the function.
 boolean isVarArg()
          Returns whether the function accepts a variable number of arguments, i.e. whether the function's parameter list is unbounded.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameters

public static final FunctionParameter[] parameters
The only (but repeatable) parameter: a numeric term

Constructor Detail

Sum

public Sum()
Creates a new instance of the SUM function.

Method Detail

getIdentifier

public String getIdentifier()
Description copied from interface: Function
Returns the operator's string identirifer.

Specified by:
getIdentifier in interface Function
Returns:
a string representation of the operator.

applyTo

public Value applyTo(Expression[] arguments)
              throws IllegalValueTypeException
Description copied from interface: Function
Invokes the function using the given arguments and returns the result.

Specified by:
applyTo in interface Function
Returns:
the result of the operation
Throws:
IllegalValueTypeException

getParameters

public FunctionParameter[] getParameters()
Description copied from interface: Function
Returns the parameters of the function.

Specified by:
getParameters in interface Function
Returns:
the parameters of the function

isVarArg

public boolean isVarArg()
Description copied from interface: Function
Returns whether the function accepts a variable number of arguments, i.e. whether the function's parameter list is unbounded.

Specified by:
isVarArg in interface Function
Returns:
true if the function accepts a variable number of arguments