Constructor and Description |
---|
FunctionCallEvaluator(Function f,
Expression[] p,
Type defaultType,
Context globalContext)
Creates a new
FunctionCallEvaluator for the specified
Function . |
Modifier and Type | Method and Description |
---|---|
Object |
evaluate()
Evaluates a
FunctionCall and returns the value as an
Object . |
Evaluator |
getEvaluator(Symbol s)
Returns the parameter evaluator or the global
Variable regarding
to the specified Symbol . |
Function |
getFunction(FunctionCall fc)
Delegates the method
DefinitionModel.getFunction(FunctionCall)
of the global Context to return the Function according
to the specified FunctionCall which is a sub-expression in
the function definition. |
Evaluator |
getParameterEvaluator(int index)
Returns a new
Evaluator for the index' parameter. |
Type |
getReturnType()
Returns the
Type of the evaluated value. |
public FunctionCallEvaluator(Function f, Expression[] p, Type defaultType, Context globalContext)
FunctionCallEvaluator
for the specified
Function
.
defaultType
is the Type
from which the method
Type.getEvaluator(FunctionCall,Context)
was called - in other
words: It specifies, how to deal with Symbols
in the
expression-tree-hirarchy (e.g.: evaluate any Symbol
as a
Complex
or a Real
or whatever).f
- the Function
which is to be evaluated.p
- an array of all parameter Expressions
of the
FunctionCall
.defaultType
- the Type
any Symbol
will be
evaluated to.globalContext
- the Context
, the Evaluators
for the Symbols
in the function definition, which are no parameters,
are getting from.
Function.getCallEvaluator(Type,Context)
public Object evaluate()
FunctionCall
and returns the value as an
Object
. The Type
of that Object
will be returned by the method getReturnType()
.evaluate
in interface Evaluator
FunctionCall
.AbstractRealEvaluator.getRealValue(Real)
,
AbstractComplexEvaluator.getComplexValue(Complex)
,
AbstractRealVectorEvaluator.getRealVectorValue(RealVector)
,
AbstractComplexVectorEvaluator.getComplexVectorValue(ComplexVector)
public Evaluator getEvaluator(Symbol s)
Variable
regarding
to the specified Symbol
.
The Evaluator
for the function definition
gets this FunctionCallEvaluator
as its Context to be able to decide
between parameters and global variables in the function definition.getEvaluator
in interface Context
s
- the Symbol
an Evaluator
will be
returned for.Variable
regarding
to the specified Symbol
.public Function getFunction(FunctionCall fc)
DefinitionModel.getFunction(FunctionCall)
of the global Context
to return the Function
according
to the specified FunctionCall
which is a sub-expression in
the function definition.getFunction
in interface Context
fc
- the FunctionCall
(a sub-expression in the
function definition) calling the Function
to be return.Function
according to the specified
FunctionCall
.public Evaluator getParameterEvaluator(int index)
Evaluator
for the index'
parameter.index
- the index of the parameter which Evaluater
is to
be returned.Evaluator
for the index'
parameter.public Type getReturnType()
Type
of the evaluated value.getReturnType
in interface Evaluator
Type
of the evaluated value.evaluate()