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>
public class ASTFunNodeConverter
- extends AbstractJepConversionFunction<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: 2010-04-20 10:02:16 +0200 (Tue, 20 Apr 2010) $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ASTFunNodeConverter
public ASTFunNodeConverter()
toExpression
public Expression toExpression(ASTFunNode node)
- Get the
PostfixMathCommandI
object from the function node
and delegate conversion to JepExpressionFunction
if that interface
is implemented. Otherwise check the ConverterFactory
for
a registered converter and use it.
- Specified by:
toExpression
in interface JepConversionFunction<ASTFunNode>
- Overrides:
toExpression
in class AbstractJepConversionFunction<ASTFunNode>
- Parameters:
node
- The object to convert
- Returns:
- An expression or null
- Throws:
BaseException
- If the node can't be converted
toRestriction
public Restriction toRestriction(ASTFunNode node)
- Get the
PostfixMathCommandI
object from the function node
and delegate conversion to JepRestrictionFunction
if that interface
is implemented. Otherwise check the ConverterFactory
for
a registered converter and use it.
Get the Operator
object from the function node
and check the ConverterFactory
for
a registered converter and use it.
- Specified by:
toRestriction
in interface JepConversionFunction<ASTFunNode>
- Overrides:
toRestriction
in class AbstractJepConversionFunction<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