public abstract class StarTableJELRowReader extends JELRowReader
In addition to the syntax provided by the superclass, the following symbols are understood:
0<=x<1
which is constant for a given row
within this reader. The quality of the random numbers may not
be particularly good.
valueDouble
,
valueInt
, valueLong
,
valueString
and valueObject
are provided.
Each takes as an argument an exact column name, and provides the
typed value of the column at the current row.
These methods are not the generally recommended way to
access column values; they are slower and less tidy than simply
using column names or $IDs in expressions, and do not admit of
static analysis, so their use can not be reflected in
the results of getTranslatedColumns
.
However, it does allow access by column name to columns with names
that are not legal java identifiers.
Modifier and Type | Field and Description |
---|---|
static String |
PARAM_PREFIX
The string which should be prefixed to a table parameter (constant)
name to result in substituting its value.
|
static String |
UCD_PREFIX
A string to prefix to a UCD string to indicate the column/parameter
with that UCD.
|
static String |
UTYPE_PREFIX
A string to prefix to a Utype string to indicate the column/parameter
with that Utype.
|
COLUMN_ID_CHAR, NULL_QUERY_PREFIX, OBJECT_PREFIX
Constructor and Description |
---|
StarTableJELRowReader(StarTable table)
Constructs a new row reader for a given StarTable.
|
Modifier and Type | Method and Description |
---|---|
protected Constant<?> |
createDescribedValueConstant(DescribedValue dval)
Returns a Constant object based on a DescribedValue.
|
protected boolean |
getBooleanColumnValue(int icol)
Returns a boolean value for a cell of the current row.
|
protected byte |
getByteColumnValue(int icol)
Returns a byte value for a cell of the current row.
|
protected abstract Object |
getCell(int icol)
Returns the value for a given column in this reader's table at
the current row.
|
protected char |
getCharColumnValue(int icol)
Returns a char value for a cell of the current row.
|
protected Class<?> |
getColumnClass(int icol)
Returns the class of values returned by a given column.
|
protected int |
getColumnIndexByName(String name)
Returns the column index of a column in the row given its name.
|
protected Constant<?> |
getConstantByName(String name)
Understands table parameters identified case-insensitively
by name (using the
PARAM_PREFIX prefix) or
by UCD (using the UCD_PREFIX prefix) or
by Utype (using the UTYPE_PREFIX prefix). |
abstract long |
getCurrentRow()
Returns the index of the row on which evaluations are currently
taking place.
|
DescribedValue |
getDescribedValueByName(String name)
Returns a table parameter that can be identified by the given
designation.
|
protected double |
getDoubleColumnValue(int icol)
Returns a double value for a cell of the current row.
|
protected float |
getFloatColumnValue(int icol)
Returns a float value for a cell of the current row.
|
protected int |
getIntColumnValue(int icol)
Returns a int value for a cell of the current row.
|
protected long |
getLongColumnValue(int icol)
Returns a long value for a cell of the current row.
|
protected Object |
getObjectColumnValue(int icol)
Returns an Object value for a cell of the current row.
|
protected short |
getShortColumnValue(int icol)
Returns a short value for a cell of the current row.
|
protected Constant<?> |
getSpecialByName(String name)
Adds to the superclass implementation the following:
"$0", "index" or "$index" gives the (1-based) row number
"$ncol" gives the number of columns in the table
"$nrow" gives the number of rows in the table (null if unknown)
"$random" or "RANDOM" returns a double random number,
always the same for a given row
|
StarTable |
getTable()
Returns the table associated with this reader.
|
static Pattern |
getUcdRegex(String ucd)
Takes a (non-prefixed) UCD specification and returns a Pattern
actual UCDs should match if they represent the same thing.
|
static Pattern |
getUtypeRegex(String utype)
Takes a (non-prefixed) Utype specification and returns a Pattern
actual Utypes should match if they represent the same thing.
|
protected boolean |
isBlank(int icol)
Indicates whether the value in a given column is null.
|
boolean |
requiresRowIndex()
Indicates whether this RowReader has been asked to reference any
constants for which the row index is required.
|
double |
valueDouble(String colName)
Returns the value of a named column in this reader's table
at the current row as a double.
|
int |
valueInt(String colName)
Returns the value of a named column in this reader's table
at the current row as an int.
|
long |
valueLong(String colName)
Returns the value of a named column in this reader's table
at the current row as a long int.
|
Object |
valueObject(String colName)
Returns the value of a named column in this reader's table
at the current row as an Object;
This is not generally the recommended way to access column values,
but it will work for column names without any syntactical restrictions.
|
String |
valueString(String colName)
Returns the value of a named column in this reader's table
at the current row as a String.
|
evaluate, evaluateBoolean, evaluateDouble, foundNull, getBooleanArrayProperty, getBooleanProperty, getBooleanProperty, getBooleanValue, getByteArrayProperty, getByteProperty, getByteValue, getCharArrayProperty, getCharProperty, getCharValue, getColumnIndex, getDateArrayProperty, getDoubleArrayProperty, getDoubleProperty, getDoubleValue, getFloatArrayProperty, getFloatProperty, getFloatValue, getIntArrayProperty, getIntProperty, getIntValue, getLongArrayProperty, getLongProperty, getLongValue, getNumberProperty, getObjectArrayProperty, getObjectProperty, getShortArrayProperty, getShortProperty, getShortValue, getStringArrayProperty, getStringProperty, getTranslatedColumns, getTranslatedConstants, getTypeName, setFailOnNull, stripPrefix, translate
public static final String PARAM_PREFIX
public static final String UCD_PREFIX
public static final String UTYPE_PREFIX
public StarTableJELRowReader(StarTable table)
table
- the StarTable this reader will read frompublic StarTable getTable()
protected abstract Object getCell(int icol) throws IOException
icol
- column indexicol
at the current rowIOException
public abstract long getCurrentRow()
public boolean requiresRowIndex()
getCurrentRow()
method.
Since not all row reader implementations are able to return a value
for that method, this is useful information.public double valueDouble(String colName)
colName
- column name, matched exactlypublic int valueInt(String colName)
colName
- column name, matched exactlypublic long valueLong(String colName)
colName
- column name, matched exactlypublic String valueString(String colName)
colName
- column name, matched exactlypublic Object valueObject(String colName)
colName
- column name, matched exactlyprotected boolean isBlank(int icol)
JELRowReader
isBlank
in class JELRowReader
icol
- column indexprotected Class<?> getColumnClass(int icol)
JELRowReader
getColumnClass
in class JELRowReader
icol
- non-negative column indexprotected int getColumnIndexByName(String name)
JELRowReader
name
does not refer to any known column, return -1.getColumnIndexByName
in class JELRowReader
name
- column namepublic DescribedValue getDescribedValueByName(String name)
name
- designation in JEL expressionname
, or nullprotected Constant<?> getConstantByName(String name)
PARAM_PREFIX
prefix) or
by UCD (using the UCD_PREFIX
prefix) or
by Utype (using the UTYPE_PREFIX
prefix).getConstantByName
in class JELRowReader
name
- constant nameprotected Constant<?> getSpecialByName(String name)
getSpecialByName
in class JELRowReader
name
- special nameprotected Constant<?> createDescribedValueConstant(DescribedValue dval)
dval
- described value objectprotected boolean getBooleanColumnValue(int icol)
JELRowReader
JELRowReader.foundNull()
(and return any value) if the result
is null.getBooleanColumnValue
in class JELRowReader
icol
- column indexprotected byte getByteColumnValue(int icol)
JELRowReader
JELRowReader.foundNull()
(and return any value) if the result
is null.getByteColumnValue
in class JELRowReader
icol
- column indexprotected char getCharColumnValue(int icol)
JELRowReader
JELRowReader.foundNull()
(and return any value) if the result
is null.getCharColumnValue
in class JELRowReader
icol
- column indexprotected short getShortColumnValue(int icol)
JELRowReader
JELRowReader.foundNull()
(and return any value) if the result
is null.getShortColumnValue
in class JELRowReader
icol
- column indexprotected int getIntColumnValue(int icol)
JELRowReader
JELRowReader.foundNull()
(and return any value) if the result
is null.getIntColumnValue
in class JELRowReader
icol
- column indexprotected long getLongColumnValue(int icol)
JELRowReader
JELRowReader.foundNull()
(and return any value) if the result
is null.getLongColumnValue
in class JELRowReader
icol
- column indexprotected float getFloatColumnValue(int icol)
JELRowReader
JELRowReader.foundNull()
(and return any value) if the result
is null.getFloatColumnValue
in class JELRowReader
icol
- column indexprotected double getDoubleColumnValue(int icol)
JELRowReader
JELRowReader.foundNull()
(and return any value) if the result
is null.getDoubleColumnValue
in class JELRowReader
icol
- column indexprotected Object getObjectColumnValue(int icol)
JELRowReader
getObjectColumnValue
in class JELRowReader
icol
- column indexpublic static Pattern getUcdRegex(String ucd)
ucd
it is considered as a trailing match-all wildcard.ucd
- UCD1 or UCD1+ specification/patternpublic static Pattern getUtypeRegex(String utype)
utype
- utype specificationCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.