public class ScoreFunction extends java.lang.Object implements JepExpressionFunction
score(reporterListId)
function to a
JEP expression parser. The function will look up a reporters score in the
reporter list with the ID given as an argument to this function.
To be able to use this function it must be registered with the JEP
parser and, before the expression is evaluated, a SqlResult
object
must be set.
Jep
,
BioAssaySetUtil.createJepExpression(DbControl, String, DynamicQuery)
Modifier and Type | Field and Description |
---|---|
private DbControl |
dc |
private int |
numParameters |
private SqlResult |
result |
private int |
scoreIndex |
Constructor and Description |
---|
ScoreFunction(DbControl dc)
Create a new instance of this function.
|
ScoreFunction(DbControl dc,
int scoreIndex)
Create a new instance of this function which can be used
to dynamically evaluate expressions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkNumberOfParameters(int n) |
java.lang.String |
getFunctionName()
Get the name of this function.
|
int |
getNumberOfParameters() |
void |
run(java.util.Stack stack) |
java.lang.Object |
score()
Get the score value from the current sql result.
|
void |
setCurNumberOfParameters(int n) |
void |
setSqlResult(SqlResult result)
Set a new
SqlResult object that will be used the next time the
JEP expression is evaluated. |
Expression |
toExpression(Node node)
Use the
Dynamic.score(ReporterList) method to create an
expression referencing the score of a reporter in the reporter list. |
private DbControl dc
private int scoreIndex
private SqlResult result
private int numParameters
public ScoreFunction(DbControl dc)
Expression
:s.dc
- DbControl to use when this ScoreFunction accessing the database.Jep.formulaToExpression(String, JepFunction[])
public ScoreFunction(DbControl dc, int scoreIndex)
dc
- DbControl to use when this ScoreFunction accessing the database.scoreIndex
- The column index in the SqlResult that holds the score valuesetSqlResult(SqlResult)
public java.lang.String getFunctionName()
JepFunction
JEP
parser.getFunctionName
in interface JepFunction
JEP.addFunction(String, PostfixMathCommandI)
public Expression toExpression(Node node)
Dynamic.score(ReporterList)
method to create an
expression referencing the score of a reporter in the reporter list.toExpression
in interface JepExpressionFunction
node
- The node representing this functionExpression
objectpublic int getNumberOfParameters()
getNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public void setCurNumberOfParameters(int n)
setCurNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public boolean checkNumberOfParameters(int n)
checkNumberOfParameters
in interface org.nfunk.jep.function.PostfixMathCommandI
public void run(java.util.Stack stack) throws ParseException
run
in interface org.nfunk.jep.function.PostfixMathCommandI
ParseException
public void setSqlResult(SqlResult result)
SqlResult
object that will be used the next time the
JEP expression is evaluated.result
- The result objectpublic java.lang.Object score() throws ParseException
Object
ParseException
- If no result has been specified or if getting the score result fails.