2.17.2: 2011-06-17

net.sf.basedb.util.jep
Class PositionFunction

java.lang.Object
  extended by net.sf.basedb.util.jep.PositionFunction
All Implemented Interfaces:
JepExpressionFunction, JepFunction, org.nfunk.jep.function.PostfixMathCommandI

public class PositionFunction
extends Object
implements JepExpressionFunction

A JEP function class that adds a pos function to a JEP expression parser. The function will look up position. For example: pos()

To be able to use this function it must be registered with the JEP parser. This function can only be used to convert a JEP expression to a Query API Expression. It doesn't support dynamic evalution.

Version:
2.0
Author:
Enell
See Also:
Jep, BioAssaySetUtil.createJepExpression(DbControl, String, DynamicQuery)
Last modified
$Date: 2010-04-20 10:02:16 +0200 (Tue, 20 Apr 2010) $

Constructor Summary
PositionFunction()
           
 
Method Summary
 boolean checkNumberOfParameters(int n)
           
 String getFunctionName()
          Get the name of this function.
 int getNumberOfParameters()
           
 void run(Stack stack)
           
 void setCurNumberOfParameters(int n)
          Can't be changed.
 Expression toExpression(Node node)
          Use the Dynamic.column(VirtualColumn) method to create an expression referencing a position.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PositionFunction

public PositionFunction()
Method Detail

getFunctionName

public String getFunctionName()
Description copied from interface: JepFunction
Get the name of this function. It is used when registering the function with a JEP parser.

Specified by:
getFunctionName in interface JepFunction
Returns:
The string "pos"
See Also:
JEP.addFunction(String, PostfixMathCommandI)

toExpression

public Expression toExpression(Node node)
Use the Dynamic.column(VirtualColumn) method to create an expression referencing a position.

Specified by:
toExpression in interface JepExpressionFunction
Parameters:
node - The node representing this function
Returns:
An Expression object

getNumberOfParameters

public int getNumberOfParameters()
Specified by:
getNumberOfParameters in interface org.nfunk.jep.function.PostfixMathCommandI
Returns:
Always 0

setCurNumberOfParameters

public void setCurNumberOfParameters(int n)
Can't be changed.

Specified by:
setCurNumberOfParameters in interface org.nfunk.jep.function.PostfixMathCommandI

checkNumberOfParameters

public boolean checkNumberOfParameters(int n)
Specified by:
checkNumberOfParameters in interface org.nfunk.jep.function.PostfixMathCommandI

run

public void run(Stack stack)
         throws ParseException
Specified by:
run in interface org.nfunk.jep.function.PostfixMathCommandI
Throws:
ParseException

2.17.2: 2011-06-17