Class RawFunction

  • All Implemented Interfaces:
    JepExpressionFunction, JepFunction, org.nfunk.jep.function.PostfixMathCommandI

    public class RawFunction
    extends Object
    implements JepExpressionFunction
    A JEP function class that adds a raw(string) function to a JEP expression parser. The function will look up the value of the raw data property with the given name. For example: raw('ch1FgMean') - raw('ch1BgMean')

    To be able to use this function it must be registered with the JEP parser and, before the expression is evaluated, a raw data 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') - raw('ch1BgMean')";
    RawFunction raw = new RawFunction(assay.getRawDataType());
    JEP jep = JepUtil.newJep(expression, raw);
    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();
    
    Version:
    2.0
    Author:
    Nicklas
    See Also:
    Jep, BioAssaySetUtil.createJepExpression(DbControl, String, DynamicQuery)
    Last modified
    $Date: 2015-04-20 11:08:18 +0200 (må, 20 apr 2015) $
    • Field Detail

      • allowUse

        private final boolean allowUse
      • numParameters

        private int numParameters
    • Constructor Detail

      • RawFunction

        public RawFunction​(boolean allowUse)
        Create a new instance of this function. The new instance cannot be used to dynamically evaluate expressions. It should only be used for converting JEP formulas to Expression:s.
        See Also:
        Jep.formulaToExpression(String, JepFunction[])
      • RawFunction

        public RawFunction​(DbControl dc,
                           RawDataType rawDataType,
                           boolean allowUse)
        Create a new instance of this function working with raw data of the specified raw data type.
        Parameters:
        rawDataType - The type of raw data this function uses