Class CustomFunctionProvider
- java.lang.Object
-
- de.fzi.power.interpreter.calculator.expressionoasis.custom.CustomFunctionProvider
-
- All Implemented Interfaces:
FunctionProvider
public final class CustomFunctionProvider extends Object implements FunctionProvider
-
-
Constructor Summary
Constructors Constructor Description CustomFunctionProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TypegetFunctionType(String functionName, Type[] parameterTypes)Gets the return type of the function.ValueObjectgetFunctionValue(String functionName, ValueObject[] parameters)Gets the return value of function.voidinitialize(ExpressionContext expressionContext)It initialize the Function provider with expression context and also gives a chance to pre-initialize any internal states for operationsbooleansupportsFunction(String functionName, Type[] parameterTypes)Checks whether the this function provider supports any function or not.
-
-
-
Field Detail
-
POW
public static final String POW
The provided composite 'POW' function.- See Also:
- Constant Field Values
-
SQRT
public static final String SQRT
The provided composite 'SQRT' function.- See Also:
- Constant Field Values
-
-
Method Detail
-
initialize
public void initialize(ExpressionContext expressionContext)
Description copied from interface:FunctionProviderIt initialize the Function provider with expression context and also gives a chance to pre-initialize any internal states for operations- Specified by:
initializein interfaceFunctionProvider- Parameters:
expressionContext- Context of current expression evaluation process- Throws:
AssertionError- In case the passedExpressionContextis not aCustomExpressionContextinstance.
-
getFunctionType
public Type getFunctionType(String functionName, Type[] parameterTypes) throws ExpressionEngineException
Description copied from interface:FunctionProviderGets the return type of the function.- Specified by:
getFunctionTypein interfaceFunctionProvider- Parameters:
functionName- the name of the function.parameterTypes- the types of the parameters- Returns:
Type.DOUBLEin casesupportsFunction(String, Type[])called with the given arguments returnstrue, otherwisenull.- Throws:
ExpressionEngineException- if anything goes wrong
-
getFunctionValue
public ValueObject getFunctionValue(String functionName, ValueObject[] parameters) throws ExpressionEngineException
Gets the return value of function.- Specified by:
getFunctionValuein interfaceFunctionProvider- Parameters:
functionName- the name of the functionparameters- the parameters values of the function- Returns:
nullis returned in case the function denoted by the given name is not provided by this instance.- A
ValueObjectofType.DOUBLEis returned if none of the parameters is aMeasuredFactor. - A
MeasuredValuesCompositeValueObjectis returned in any other case.
- Throws:
ExpressionEngineException- if anything goes wrong
-
supportsFunction
public boolean supportsFunction(String functionName, Type[] parameterTypes) throws ExpressionEngineException
Description copied from interface:FunctionProviderChecks whether the this function provider supports any function or not.- Specified by:
supportsFunctionin interfaceFunctionProvider- Parameters:
functionName- the name of the functionparameterTypes- the type of parameters for the function- Returns:
trueif function provider supports the functionfalseotherwise- Throws:
ExpressionEngineException- if anything goes wrong
-
-