Package net.sf.basedb.util.jep.convert
Class ASTFunNodeConverter
java.lang.Object
net.sf.basedb.util.jep.convert.AbstractJepConversionFunction<ASTFunNode>
net.sf.basedb.util.jep.convert.ASTFunNodeConverter
- All Implemented Interfaces:
JepConversionFunction<ASTFunNode>
Converts a function node to an expression or restriction. Function
nodes are used by JEP to represent both operators (+, -, *, ==, !=, etc.)
and built-in or extended functions (ln, exp, sqrt, etc.).
- Version:
- 2.4
- Author:
- nicklas
- Last modified
- $Date: 2015-04-20 11:08:18 +0200 (må, 20 apr 2015) $
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate JepConversionFunction<?>
getConverter
(org.nfunk.jep.function.PostfixMathCommandI function, Operator operator) Get a converter by first checking the if one exists for the given function, and then for the given operator symbol.toExpression
(ASTFunNode node) Get thePostfixMathCommandI
object from the function node and delegate conversion toJepExpressionFunction
if that interface is implemented.toRestriction
(ASTFunNode node) Get thePostfixMathCommandI
object from the function node and delegate conversion toJepRestrictionFunction
if that interface is implemented.Methods inherited from class net.sf.basedb.util.jep.convert.AbstractJepConversionFunction
getDescription, getName, isFunction, isOperator
-
Constructor Details
-
ASTFunNodeConverter
public ASTFunNodeConverter()
-
-
Method Details
-
toExpression
Get thePostfixMathCommandI
object from the function node and delegate conversion toJepExpressionFunction
if that interface is implemented. Otherwise check theConverterFactory
for a registered converter and use it.- Specified by:
toExpression
in interfaceJepConversionFunction<ASTFunNode>
- Overrides:
toExpression
in classAbstractJepConversionFunction<ASTFunNode>
- Parameters:
node
- The object to convert- Returns:
- An expression or null
- Throws:
BaseException
- If the node can't be converted
-
toRestriction
Get thePostfixMathCommandI
object from the function node and delegate conversion toJepRestrictionFunction
if that interface is implemented. Otherwise check theConverterFactory
for a registered converter and use it. Get theOperator
object from the function node and check theConverterFactory
for a registered converter and use it.- Specified by:
toRestriction
in interfaceJepConversionFunction<ASTFunNode>
- Overrides:
toRestriction
in classAbstractJepConversionFunction<ASTFunNode>
- Parameters:
node
- The object to convert- Returns:
- A restriction or null
- Throws:
BaseException
- If the node can't be converted
-
getConverter
private JepConversionFunction<?> getConverter(org.nfunk.jep.function.PostfixMathCommandI function, Operator operator) Get a converter by first checking the if one exists for the given function, and then for the given operator symbol.- Returns:
- The converter or null if none is found
-