|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.proteios.util.jep.MeanFunction
public class MeanFunction
A JEP function class that adds a mean(string) function to a
JEP expression parser. The function will calculate the mean value of the raw data
property with the given name. For example:
mean('ch1BgMean')
To be able to use this function it must be registered with the JEP parser and, before the expression is evaluated, a rawbioassay object must be set. For example we can evaluate an expression for every raw data object in a raw bioassay:
DbControl dc = ...
RawBioAssay assay = ...
String expression = "raw('ch1FgMean') - mean('ch1BgMean')";
RawFunction raw = new RawFunction(assay.getRawDataType());
MeanFunction mean = new MeanFunction(assay);
JEP jep = JepUtil.newJep(expression, raw, mean);
DataResultIterator<RawData> result =
assay.getRawData().iterate(dc);
while (result.hasNext())
{
raw.setRawData(result.next());
double value = jep.getValue();
// Do something with the value
}
result.close();
Jep| Constructor Summary | |
|---|---|
MeanFunction(DbControl dc)
Create a new instance of this function working with raw data of the specified raw bio assay. |
|
| Method Summary | |
|---|---|
String |
getFunctionName()
Get the name of this function. |
int |
getNumberOfParameters()
|
Object |
mean(String propertyName)
Get the value of the specified property of the current raw data object. |
void |
run(Stack stack)
|
void |
setCurNumberOfParameters(int n)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MeanFunction(DbControl dc)
dc - DbControl used in this function| Method Detail |
|---|
public String getFunctionName()
JepFunctionJEP parser.
getFunctionName in interface JepFunctionJEP.addFunction(String, PostfixMathCommandI)public int getNumberOfParameters()
getNumberOfParameters in interface org.nfunk.jep.function.PostfixMathCommandIpublic void setCurNumberOfParameters(int n)
setCurNumberOfParameters in interface org.nfunk.jep.function.PostfixMathCommandI
public void run(Stack stack)
throws ParseException
run in interface org.nfunk.jep.function.PostfixMathCommandIParseException
public Object mean(String propertyName)
throws ParseException
propertyName - The name of the raw data property
ParseException
|
Last update: 2011-06-23 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||