Package com.ezylang.evalex.functions
Interface FunctionIfc
-
- All Known Implementing Classes:
AbsFunction,AbstractFunction,AbstractMinMaxFunction,AcosFunction,AcosHFunction,AcosRFunction,AcotFunction,AcotHFunction,AcotRFunction,AsinFunction,AsinHFunction,AsinRFunction,Atan2Function,Atan2RFunction,AtanFunction,AtanHFunction,AtanRFunction,AverageFunction,CeilingFunction,CoalesceFunction,CosFunction,CosHFunction,CosRFunction,CotFunction,CotHFunction,CotRFunction,CscFunction,CscHFunction,CscRFunction,DateTimeFormatFunction,DateTimeNewFunction,DateTimeNowFunction,DateTimeParseFunction,DateTimeTodayFunction,DateTimeToEpochFunction,DegFunction,DurationFromMillisFunction,DurationNewFunction,DurationParseFunction,DurationToMillisFunction,FactFunction,FloorFunction,IfFunction,Log10Function,LogFunction,MaxFunction,MinFunction,NotFunction,RadFunction,RandomFunction,RoundFunction,SecFunction,SecHFunction,SecRFunction,SinFunction,SinHFunction,SinRFunction,SqrtFunction,StringContains,StringEndsWithFunction,StringFormatFunction,StringLeftFunction,StringLengthFunction,StringLowerFunction,StringMatchesFunction,StringRightFunction,StringSplitFunction,StringStartsWithFunction,StringSubstringFunction,StringTrimFunction,StringUpperFunction,SumFunction,SwitchFunction,TanFunction,TanHFunction,TanRFunction
public interface FunctionIfcInterface that is required for all functions in a function dictionary for evaluation of expressions.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description EvaluationValueevaluate(Expression expression, Token functionToken, EvaluationValue... parameterValues)Performs the function logic and returns an evaluation result.default intgetCountOfNonVarArgParameters()Returns the count of non-var-arg parameters defined by this function.java.util.List<FunctionParameterDefinition>getFunctionParameterDefinitions()Returns the list of parameter definitions.booleanhasVarArgs()Checks whether the function has a variable number of arguments parameter.default booleanisParameterLazy(int parameterIndex)Checks if the parameter is a lazy parameter.voidvalidatePreEvaluation(Token token, EvaluationValue... parameterValues)Validates the evaluation parameters, called before the actual evaluation.
-
-
-
Method Detail
-
getFunctionParameterDefinitions
java.util.List<FunctionParameterDefinition> getFunctionParameterDefinitions()
Returns the list of parameter definitions. Is never empty ornull.- Returns:
- The parameter definition list.
-
evaluate
EvaluationValue evaluate(Expression expression, Token functionToken, EvaluationValue... parameterValues) throws EvaluationException
Performs the function logic and returns an evaluation result.- Parameters:
expression- The expression, where this function is executed. Can be used to access the expression configuration.functionToken- The function token from the parsed expression.parameterValues- The parameter values.- Returns:
- The evaluation result in form of a
EvaluationValue. - Throws:
EvaluationException- In case there were problems during evaluation.
-
validatePreEvaluation
void validatePreEvaluation(Token token, EvaluationValue... parameterValues) throws EvaluationException
Validates the evaluation parameters, called before the actual evaluation.- Parameters:
token- The function token.parameterValues- The parameter values- Throws:
EvaluationException- in case of any validation error
-
hasVarArgs
boolean hasVarArgs()
Checks whether the function has a variable number of arguments parameter.- Returns:
trueorfalse:
-
isParameterLazy
default boolean isParameterLazy(int parameterIndex)
Checks if the parameter is a lazy parameter.- Parameters:
parameterIndex- The parameter index, starts at 0 for the first parameter. If the index is bigger than the list of parameter definitions, the last parameter definition will be checked.- Returns:
trueif the specified parameter is defined as lazy.
-
getCountOfNonVarArgParameters
default int getCountOfNonVarArgParameters()
Returns the count of non-var-arg parameters defined by this function. If the function has var-args, the result is the count of parameter definitions - 1.- Returns:
- the count of non-var-arg parameters defined by this function.
-
-