csheets.core.formula
Class FunctionCall

java.lang.Object
  extended by csheets.core.formula.FunctionCall
All Implemented Interfaces:
Expression, Serializable

public class FunctionCall
extends Object
implements Expression

A call to a function in a formula.

Author:
Einar Pehrson
See Also:
Serialized Form

Constructor Summary
FunctionCall(Function function, Expression... args)
          Creates a new function call.
 
Method Summary
 Object accept(ExpressionVisitor visitor)
          Accepts to visit the given expression visitor.
 Value evaluate()
          Evaluates the expression and returns the result.
 Expression[] getArguments()
          Returns the arguments passed to the function.
 Function getFunction()
          Returns the function that is called.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FunctionCall

public FunctionCall(Function function,
                    Expression... args)
             throws IllegalFunctionCallException
Creates a new function call.

Parameters:
function - the function that is called
args - the arguments passed to the function
Throws:
IllegalFunctionCallException - if the arguments passed to the function did not match its parameters
Method Detail

evaluate

public Value evaluate()
               throws IllegalValueTypeException
Description copied from interface: Expression
Evaluates the expression and returns the result.

Specified by:
evaluate in interface Expression
Returns:
the result of the evaluation
Throws:
IllegalValueTypeException - if a value of an unexpected type was encountered when evaluating the expression

getFunction

public Function getFunction()
Returns the function that is called.

Returns:
the function that is called

getArguments

public Expression[] getArguments()
Returns the arguments passed to the function.

Returns:
the arguments passed to the function

accept

public Object accept(ExpressionVisitor visitor)
Description copied from interface: Expression
Accepts to visit the given expression visitor.

Specified by:
accept in interface Expression
Parameters:
visitor - the visitor

toString

public String toString()
Overrides:
toString in class Object