|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.jep.ScoreFunction
public class ScoreFunction
A JEP function class that adds a 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)
Field Summary | |
---|---|
private DbControl |
dc
|
private int |
numParameters
|
private SqlResult |
result
|
private int |
scoreIndex
|
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
boolean |
checkNumberOfParameters(int n)
|
String |
getFunctionName()
Get the name of this function. |
int |
getNumberOfParameters()
|
void |
run(Stack stack)
|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private DbControl dc
private int scoreIndex
private SqlResult result
private int numParameters
Constructor Detail |
---|
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)
Method Detail |
---|
public 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 function
Expression
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(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 Object score() throws ParseException
Object
ParseException
- If no result has been specified or if getting the score result fails.
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |