org.jfree.formula.lvalues

Class FormulaFunction

public class FormulaFunction extends AbstractLValue

A function. Formulas consist of functions, references or static values, which are connected by operators.

Functions always have a cannonical name, which must be unique and which identifies the function. Functions can have a list of parameters. The number of parameters can vary, and not all parameters need to be filled.

Functions can have required and optional parameters. Mixing required and optional parameters is not allowed. Optional parameters cannot be ommited, unless they are the last parameter in the list.

This class provides the necessary wrapper functionality to fill in the parameters.

Author: Thomas Morgner

Constructor Summary
FormulaFunction(String functionName, LValue[] parameters)
Method Summary
Objectclone()
TypeValuePairevaluate()
LValue[]getChildValues()
Returns any dependent lvalues (parameters and operands, mostly).
FunctiongetFunction()
Returns the initialized function.
StringgetFunctionName()
Returns the function's name.
FunctionDescriptiongetMetaData()
Returns the function's meta-data.
voidinitialize(FormulaContext context)
booleanisConstant()
Checks, whether the LValue is constant.
StringtoString()

Constructor Detail

FormulaFunction

public FormulaFunction(String functionName, LValue[] parameters)

Method Detail

clone

public Object clone()

evaluate

public TypeValuePair evaluate()

getChildValues

public LValue[] getChildValues()
Returns any dependent lvalues (parameters and operands, mostly).

Returns:

getFunction

public Function getFunction()
Returns the initialized function. Be aware that this method will return null if this LValue instance has not yet been initialized.

Returns: the function instance or null, if the FormulaFunction instance has not yet been initialized.

getFunctionName

public String getFunctionName()
Returns the function's name. This is the normalized name and may not be suitable for the user. Query the function's metadata to retrieve a display-name.

Returns: the function's name.

getMetaData

public FunctionDescription getMetaData()
Returns the function's meta-data. Be aware that this method will return null if this LValue instance has not yet been initialized.

Returns: the function description instance or null, if the FormulaFunction instance has not yet been initialized.

initialize

public void initialize(FormulaContext context)

isConstant

public boolean isConstant()
Checks, whether the LValue is constant. Constant lvalues always return the same value.

Returns:

toString

public String toString()