public abstract class TopcatJELEvaluator extends Object implements Closeable
Note this is more or less a copy of
RandomJELEvaluator
.
It's very difficult to make that code reusable here because this class
needs to use a TopcatJELRowReader rather than a StarTableRowReader
(enhanced expression parsing, e.g. RowSubsets) and the differing
functionality is implemented using inheritance rather than composition.
The right thing would probably be to rework the JEL usage to
use composition, but it's not straightforward.
Live with duplicated code instead.
Constructor and Description |
---|
TopcatJELEvaluator() |
Modifier and Type | Method and Description |
---|---|
static TopcatJELEvaluator |
createEvaluator(TopcatModel tcModel,
String expr,
boolean activation,
Class<?> reqType)
Returns a TopcatJELEvaluator 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 Object |
evaluateObject(long lrow)
Returns the value of the expression at a given table row as an Object.
|
abstract String |
getExpression()
Returns the text of the expression that this evaluator can
evaluate.
|
abstract Class<?> |
getResultType()
Returns the actual result type that JEL has determined the
compiled expression to have.
|
public abstract String getExpression()
public abstract Class<?> getResultType()
public abstract Object evaluateObject(long lrow) throws IOException
lrow
- evaluation row indexIOException
public abstract double evaluateDouble(long lrow) throws IOException
lrow
- evaluation row indexIOException
public abstract boolean evaluateBoolean(long lrow) throws IOException
lrow
- evaluation row indexIOException
public static TopcatJELEvaluator createEvaluator(TopcatModel tcModel, String expr, boolean activation, Class<?> reqType) throws gnu.jel.CompilationException
tcModel
- context for expression evaluationexpr
- JEL expressionactivation
- true to include activation functionsreqType
- required result type, or null to accept anygnu.jel.CompilationException
- if the expression doesn't compile
or doesn't have the (non-null) required typeCopyright © 2003-2025 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.