## org.pentaho.reporting.libraries.formula.lvalues
Class FormulaFunction

    java.lang.Object
      org.pentaho.reporting.libraries.formula.lvalues.AbstractLValue
          org.pentaho.reporting.libraries.formula.lvalues.FormulaFunction

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, LValue

    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
See Also:
  Serialized Form

Constructor Summary
`FormulaFunction(java.lang.String functionName, LValue[] parameters)`
`FormulaFunction(java.lang.String functionName, LValue[] parameters, ParsePosition parsePosition)`

Method Summary
`java.lang.Object` `clone()`
`TypeValuePair` `evaluate()`
`LValue[]` `getChildValues()` Returns any dependent lvalues (parameters and operands, mostly).
`Function` `getFunction()` Returns the initialized function.
`java.lang.String` `getFunctionName()` Returns the function's name.
`FunctionDescription` `getMetaData()` Returns the function's meta-data.
`void` `initialize(FormulaContext context)`
`boolean` `isConstant()` Checks whether the LValue is constant.
`java.lang.String` `toString()`

Methods inherited from class org.pentaho.reporting.libraries.formula.lvalues.AbstractLValue
`getContext, getParsePosition, getValueType, setParsePosition`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### FormulaFunction

    public FormulaFunction(java.lang.String functionName,
                           LValue[] parameters,
                           ParsePosition parsePosition)

### FormulaFunction

    public FormulaFunction(java.lang.String functionName,
                           LValue[] parameters)

Method Detail

### initialize

    public void initialize(FormulaContext context)
                    throws EvaluationException

  Specified by:
    `initialize` in interface `LValue`
  Overrides:
    `initialize` in class `AbstractLValue`
  Throws:
    `EvaluationException`

### getFunctionName

    public java.lang.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.

### 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.

### 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.

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Specified by:
    `clone` in interface `LValue`
  Overrides:
    `clone` in class `AbstractLValue`
  Throws:
    `java.lang.CloneNotSupportedException`

### evaluate

    public TypeValuePair evaluate()
                           throws EvaluationException

  Throws:
    `EvaluationException`

### getChildValues

    public LValue[] getChildValues()

  Returns any dependent lvalues (parameters and operands, mostly).

  Specified by:
    `getChildValues` in interface `LValue`
  Overrides:
    `getChildValues` in class `AbstractLValue`
  Returns:

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### isConstant

    public boolean isConstant()

  Checks whether the LValue is constant. Constant lvalues always return the same value.

  Returns:
    true, if the function will always return the same value.