fr.expression4j.basic.impl
Class ParametersExpressionElement

java.lang.Object
  extended by fr.expression4j.basic.impl.ParametersExpressionElement
All Implemented Interfaces:
ExpressionElement

public class ParametersExpressionElement
extends java.lang.Object
implements ExpressionElement

Parse a function parameters in an expression. in expression "f(x)=g(2*x+1)" parameters is "2*x+1". BNF is parameters ::= expression "," parameters | expression | "" expression ::= [see global BNF in @link ExpressionImp]

Author:
SGINER

Constructor Summary
ParametersExpressionElement()
           
 
Method Summary
 MathematicalElement evaluate(TreeElement element, Catalog catalog, OperatorManager operatorManager, Parameters parameters, ExpressionModel model)
          Evaluate the value of the current expression element
 java.lang.String getName()
          get the name of the element (like integer, variable ...)
protected  boolean operator(java.lang.String expression, java.lang.String operatorList, int position)
          check if char at position in expression is in given operator list.
 boolean parseElement(java.lang.String expression, ExpressionModel expressionModel, ParseInfo parseInfo, Catalog catalog, java.util.List functionParameters, int priorityOperatorLevel)
          Parse an element of an expression like term, real, integer ...
 java.lang.String toString(TreeElement element, ExpressionModel expressionModel)
          Create the String object associated to the expression element.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ParametersExpressionElement

public ParametersExpressionElement()
Method Detail

operator

protected boolean operator(java.lang.String expression,
                           java.lang.String operatorList,
                           int position)
check if char at position in expression is in given operator list.

Parameters:
operatorList - operator list as string.
position - position to check.
Returns:
true if operator at position is in the given operator list.

parseElement

public boolean parseElement(java.lang.String expression,
                            ExpressionModel expressionModel,
                            ParseInfo parseInfo,
                            Catalog catalog,
                            java.util.List functionParameters,
                            int priorityOperatorLevel)
                     throws ParsingException
Description copied from interface: ExpressionElement
Parse an element of an expression like term, real, integer ... (See BNF)

Specified by:
parseElement in interface ExpressionElement
Parameters:
expression - expression to parse.
expressionModel - meta model of expression.
parseInfo - info about parsing
catalog - function and constant catalog
functionParameters - parameters of the function (f(x), x is a parameter)
priorityOperatorLevel - priority of current operator.
Returns:
true if the expression content the element at the given position.
Throws:
ParsingException

getName

public java.lang.String getName()
Description copied from interface: ExpressionElement
get the name of the element (like integer, variable ...)

Specified by:
getName in interface ExpressionElement
Returns:
the name of the element

evaluate

public MathematicalElement evaluate(TreeElement element,
                                    Catalog catalog,
                                    OperatorManager operatorManager,
                                    Parameters parameters,
                                    ExpressionModel model)
                             throws EvalException
Description copied from interface: ExpressionElement
Evaluate the value of the current expression element

Specified by:
evaluate in interface ExpressionElement
Parameters:
element - tree element of the expression.
operatorManager - operator manager of the current expression.
parameters - parameters given to the expression.
Returns:
the evaluated value of the expression.
Throws:
EvalException

toString

public java.lang.String toString(TreeElement element,
                                 ExpressionModel expressionModel)
Description copied from interface: ExpressionElement
Create the String object associated to the expression element.

Specified by:
toString in interface ExpressionElement
Parameters:
element - element properties for convertion.
expressionModel - expression model to use for current expression element.
Returns:
the string of the element.