Package uk.ac.starlink.ttools.jel
Class RandomJELEvaluator
- java.lang.Object
-
- uk.ac.starlink.ttools.jel.RandomJELEvaluator
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public abstract class RandomJELEvaluator extends java.lang.Object implements java.io.Closeable
Random-access evaluator for JEL expressions evaluated against tables.- Since:
- 11 Dec 2020
- Author:
- Mark Taylor
-
-
Constructor Summary
Constructors Constructor Description RandomJELEvaluator()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static RandomJELEvaluator
createEvaluator(uk.ac.starlink.table.StarTable table, java.lang.String expr, boolean isConcurrent)
Returns a RandomJELEvaluator instance for a given table and expression.abstract boolean
evaluateBoolean(long lrow)
Returns the value of the expression at a given table row as a boolean.abstract double
evaluateDouble(long lrow)
Returns the value of the expression at a given table row as a double.abstract java.lang.Object
evaluateObject(long lrow)
Returns the value of the expression at a given table row as an Object.
-
-
-
Method Detail
-
evaluateObject
public abstract java.lang.Object evaluateObject(long lrow) throws java.io.IOException
Returns the value of the expression at a given table row as an Object.- Parameters:
lrow
- evaluation row index- Returns:
- object value at given row
- Throws:
java.io.IOException
-
evaluateDouble
public abstract double evaluateDouble(long lrow) throws java.io.IOException
Returns the value of the expression at a given table row as a double. Behaviour is undefined if the expression is not numeric.- Parameters:
lrow
- evaluation row index- Returns:
- numeric value at given row
- Throws:
java.io.IOException
-
evaluateBoolean
public abstract boolean evaluateBoolean(long lrow) throws java.io.IOException
Returns the value of the expression at a given table row as a boolean. Behaviour is undefined if the expression is not boolean-typed.- Parameters:
lrow
- evaluation row index- Returns:
- boolean value at given row
- Throws:
java.io.IOException
-
createEvaluator
public static RandomJELEvaluator createEvaluator(uk.ac.starlink.table.StarTable table, java.lang.String expr, boolean isConcurrent) throws gnu.jel.CompilationException
Returns a RandomJELEvaluator instance for a given table and expression. The returned implementation may or may not be suitable for use from multiple threads concurrently, depending on theisConcurrent
parameter.- Parameters:
table
- context for expression evaluationexpr
- JEL expressionisConcurrent
- whether result will be suitable for concurrent use- Returns:
- evaluator, which is only guaranteed safe for concurrent use
if
isConcurrent
was set true - Throws:
gnu.jel.CompilationException
-
-