2.17.2: 2011-06-17

net.sf.basedb.util.jep
Interface JepExpressionFunction

All Superinterfaces:
JepFunction, org.nfunk.jep.function.PostfixMathCommandI
All Known Implementing Classes:
ChannelFunction, ExtraValueFunction, Log2Function, MeanFunction, PositionFunction, RawChannelFunction, RawFunction, ReporterFunction, ScoreFunction

public interface JepExpressionFunction
extends JepFunction

This interface should be implemented by JEP functions that can also be converted into an Expression that can be used in queries.

Version:
2.0
Author:
Nicklas
See Also:
Jep.formulaToExpression(String, JepFunction[])
Last modified
$Date: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

Method Summary
 Expression toExpression(Node node)
          Convert this function to an Expression that can be used in a query.
 
Methods inherited from interface net.sf.basedb.util.jep.JepFunction
getFunctionName
 
Methods inherited from interface org.nfunk.jep.function.PostfixMathCommandI
checkNumberOfParameters, getNumberOfParameters, run, setCurNumberOfParameters
 

Method Detail

toExpression

Expression toExpression(Node node)
Convert this function to an Expression that can be used in a query. The implementation must check that the node contains the correct number of children (ie. arguments to the function) and convert the arguments to whatever is suitable for the expression. Example from the Log2Function
int numChildren = node.jjtGetNumChildren();
if (numChildren != 1)
{
   throw new BaseException("Invalid number of arguments for 'log2' function: " + numChildren);
}
return Expressions.log2(Jep.nodeToExpression(node.jjtGetChild(0)));

Parameters:
node - The node representing this function
Returns:
An Expression object

2.17.2: 2011-06-17