Package org.openrefine.grel.ast
Class FunctionCallExpr
- java.lang.Object
-
- org.openrefine.grel.ast.FunctionCallExpr
-
- All Implemented Interfaces:
Serializable
,GrelExpr
- Direct Known Subclasses:
ArrayExpr
public class FunctionCallExpr extends Object implements GrelExpr
An abstract syntax tree node encapsulating a function call. The function's arguments are all evaluated down to values before the function is applied. If any argument is an error, the function is not applied, and the error is the result of the expression.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FunctionCallExpr(GrelExpr[] args, Function f, String sourceName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object other)
Object
evaluate(Properties bindings)
Returns the value of the expression in a given context.Set<String>
getColumnDependencies(String baseColumn)
Returns the names of the columns this expression depends on.boolean
isLocal()
FunctionCallExpr
renameColumnDependencies(Map<String,String> substitutions)
Translates this expression by simultaneously substituting column names as the supplied map specifies.String
toString()
For GREL expressions, toString should return the source code of the expression, or a source code for an equivalent expression.
-
-
-
Method Detail
-
evaluate
public Object evaluate(Properties bindings)
Description copied from interface:GrelExpr
Returns the value of the expression in a given context.
-
toString
public String toString()
Description copied from interface:GrelExpr
For GREL expressions, toString should return the source code of the expression, or a source code for an equivalent expression. (without the "grel:" prefix).
-
getColumnDependencies
public final Set<String> getColumnDependencies(String baseColumn)
Description copied from interface:GrelExpr
Returns the names of the columns this expression depends on.- Specified by:
getColumnDependencies
in interfaceGrelExpr
- Parameters:
baseColumn
- the name of the column this expression is based on (null if none)- Returns:
- null if the columns could not be isolated: in this case, the expression might depend on all columns in the project.
-
renameColumnDependencies
public FunctionCallExpr renameColumnDependencies(Map<String,String> substitutions)
Description copied from interface:GrelExpr
Translates this expression by simultaneously substituting column names as the supplied map specifies.This is only possible if the extraction of column dependencies with
GrelExpr.getColumnDependencies(String)
succeeds (return a non-null value).- Specified by:
renameColumnDependencies
in interfaceGrelExpr
- Parameters:
substitutions
- a map specifying new names for some columns. If a column name is not present in the map, it is assumed that the column is not renamed.- Returns:
- a new expression with updated column names.
-
-