public class TopcatJELUtils
extends uk.ac.starlink.ttools.jel.JELUtils
Modifier and Type | Field and Description |
---|---|
static String |
ACTIVATION_CLASSES_PROPERTY |
Modifier and Type | Method and Description |
---|---|
static String |
betweenExpression(String expr,
double lo,
double hi,
uk.ac.starlink.ttools.plot2.Scale scale,
int npix)
Returns a JEL expression that characterises a univariate range of values.
|
static Class<?> |
classForName(String cname)
Returns the class with the given name, or null if it's not on the
path.
|
static String |
combineSubsetsExpression(TopcatModel tcModel,
String expr,
RowSubset[] rowSubsets)
Returns a JEL expression that represents the union of a given
array of subsets ANDed with a given JEL expression.
|
static List<Class<?>> |
getActivationStaticClasses()
Returns the list of classes whose static methods will be mapped
into the JEL evaluation namespace for activation purposes only.
|
static String |
getAngleExpression(TopcatModel tcModel,
ColumnSelector angleSelector,
AngleColumnConverter.Unit unit)
Returns a JEL expression for the value in a given angular unit
represented by a column selector that reads angular data.
|
static String |
getColumnId(uk.ac.starlink.table.gui.StarTableColumn tcol)
Returns the JEL $Identifier for a given column.
|
static String |
getDataExpression(TopcatModel tcModel,
ColumnSelector colSelector)
Returns a JEL expression for the value given by a column selector.
|
static String |
getDataExpression(TopcatModel tcModel,
GuiCoordContent content)
Returns a single JEL-friendly expression which may be used to
reference a GuiCoordContent, if possible.
|
static String |
getDataExpression(TopcatModel tcModel,
String label)
Converts a data label to a JEL-friendly expression for a table quantity.
|
static String[] |
getDataExpressions(TopcatModel tcModel,
GuiCoordContent content)
Returns an array of JEL-friendly expressions which may be used to
reference a GuiCoordContent.
|
static gnu.jel.Library |
getLibrary(uk.ac.starlink.ttools.jel.JELRowReader rowReader,
boolean activation)
Returns a JEL Library suitable for expression evaluation.
|
static Set<Integer> |
getReferencedColumns(TopcatModel tcModel,
String expr)
Returns a list of the column indices that are directly or indirectly
referenced by a given JEL expression.
|
static Set<Integer> |
getReferencedSubsets(TopcatModel tcModel,
String expr)
Returns a list of subset IDs that are directly or indirectly
referenced by a given JEL expression.
|
static String |
getSubsetExpression(TopcatModel tcModel,
RowSubset rset)
Returns a JEL-friendly expression which may be used to reference
a RowSubset.
|
static String |
groupForMultiply(String expr)
Provides grouping as required for a given JEL expression.
|
static boolean |
isColumnReferenced(TopcatModel tcModel,
int icol,
String expr)
Indicates whether a given JEL expression makes direct or indirect
reference to an existing column in a given table.
|
static boolean |
isJelIdentifier(String label)
Indicates whether a given string is a syntactically legal Java
identifier.
|
static boolean |
isSubsetReferenced(TopcatModel tcModel,
int rsetId,
String expr)
Indicates whether a given JEL expression makes direct or indirect
reference to an existing subset in a given topcat model.
|
static boolean |
isSubsetReferenced(TopcatModel tcModel,
String rsetName,
String expr)
Indicates whether a given JEL expression makes direct or indirect
reference to a named subset in a given topcat model.
|
static String |
multiplyExpression(String expr,
double factor)
Returns a JEL expression multiplied by a factor.
|
static Class<?> |
wrapPrimitiveClass(Class<?> prim)
Turns a primitive class into the corresponding wrapper class.
|
public static final String ACTIVATION_CLASSES_PROPERTY
public static gnu.jel.Library getLibrary(uk.ac.starlink.ttools.jel.JELRowReader rowReader, boolean activation)
rowReader
- object which can read rows from the table to
be used for expression evaluationactivation
- true iff the result is to include classes
used only for activation (e.g. write to System.out,
pop up viewers) as well as classes with methods for
calculationspublic static List<Class<?>> getActivationStaticClasses()
public static Class<?> wrapPrimitiveClass(Class<?> prim)
prim
- primitive classpublic static Class<?> classForName(String cname)
cname
- class namepublic static boolean isColumnReferenced(TopcatModel tcModel, int icol, String expr)
tcModel
- topcat modelicol
- column index to testexpr
- JEL expressionpublic static Set<Integer> getReferencedColumns(TopcatModel tcModel, String expr)
tcModel
- topcat modelexpr
- JEL expressionpublic static boolean isSubsetReferenced(TopcatModel tcModel, int rsetId, String expr)
tcModel
- topcat modelrsetId
- ID of row subset to testexpr
- JEL expressionpublic static Set<Integer> getReferencedSubsets(TopcatModel tcModel, String expr)
tcModel
- topcat modelexpr
- JEL expressionpublic static boolean isSubsetReferenced(TopcatModel tcModel, String rsetName, String expr)
tcModel
- topcat modelrsetName
- name of row subset to testexpr
- JEL expressionpublic static String getDataExpression(TopcatModel tcModel, ColumnSelector colSelector)
tcModel
- topcat modelcolSelector
- column selectorpublic static String getAngleExpression(TopcatModel tcModel, ColumnSelector angleSelector, AngleColumnConverter.Unit unit)
tcModel
- topcat modelangleSelector
- selector for an angular quantityunit
- required angular unitpublic static String getDataExpression(TopcatModel tcModel, GuiCoordContent content)
tcModel
- topcat modelcontent
- user specification for a plotted quantitypublic static String[] getDataExpressions(TopcatModel tcModel, GuiCoordContent content)
tcModel
- topcat modelcontent
- user specification for a plotted quantitypublic static String getDataExpression(TopcatModel tcModel, String label)
tcModel
- topcat modellabel
- textual identifier for datapublic static String getSubsetExpression(TopcatModel tcModel, RowSubset rset)
tcModel
- topcat modelrset
- row subsetpublic static String getColumnId(uk.ac.starlink.table.gui.StarTableColumn tcol)
tcol
- table column from data modelpublic static boolean isJelIdentifier(String label)
label
- text to testpublic static String combineSubsetsExpression(TopcatModel tcModel, String expr, RowSubset[] rowSubsets)
tcModel
- topcat modelexpr
- expression to AND withrowSubsets
- array of zero or more subsets composing union;
if none are provided, ALL is assumedpublic static String groupForMultiply(String expr)
This is not bulletproof, but will generally do the right thing.
expr
- input JEL expressionpublic static String multiplyExpression(String expr, double factor)
expr
- base JEL expressionfactor
- factor to multiply bypublic static String betweenExpression(String expr, double lo, double hi, uk.ac.starlink.ttools.plot2.Scale scale, int npix)
expr
- JEL expression whose value is to be constrainedlo
- lowest permissible bound for exprhi
- highest permissible bound for exprscale
- scalingnpix
- approximate number of pixels covered by the rangelo<=expr<=hi
Copyright © 2003-2025 CCLRC: Council for the Central Laboratory of the Research Councils. All Rights Reserved.