csheets.core.formula.lang
Class If

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

public class If
extends Object
implements Function

A function that emulates the if-then-else statement.

Author:
Einar Pehrson

Field Summary
static FunctionParameter[] parameters
          The function's three parameters: condition, result and alternative
 
Constructor Summary
If()
          Creates a new instance of the IF 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 function's three parameters: condition, result and alternative

Constructor Detail

If

public If()
Creates a new instance of the IF 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