Search in sources :

Example 16 with Evaluable

use of com.google.refine.expr.Evaluable in project OpenRefine by OpenRefine.

the class OperatorCallExpr method toString.

@Override
public String toString() {
    StringBuffer sb = new StringBuffer();
    for (Evaluable ev : _args) {
        if (sb.length() > 0) {
            sb.append(' ');
            sb.append(_op);
            sb.append(' ');
        }
        sb.append(ev.toString());
    }
    return sb.toString();
}
Also used : Evaluable(com.google.refine.expr.Evaluable)

Example 17 with Evaluable

use of com.google.refine.expr.Evaluable in project OpenRefine by OpenRefine.

the class ColumnAdditionByFetchingURLsOperation method createProcess.

@Override
public Process createProcess(Project project, Properties options) throws Exception {
    Engine engine = createEngine(project);
    engine.initializeFromJSON(_engineConfig);
    Evaluable eval = MetaParser.parse(_urlExpression);
    return new ColumnAdditionByFetchingURLsProcess(project, engine, eval, getBriefDescription(null), _cacheResponses);
}
Also used : Evaluable(com.google.refine.expr.Evaluable) Engine(com.google.refine.browsing.Engine)

Example 18 with Evaluable

use of com.google.refine.expr.Evaluable in project OpenRefine by OpenRefine.

the class GrelTests method parseEval.

private void parseEval(Properties bindings, String[] test) throws ParsingException {
    Evaluable eval = MetaParser.parse("grel:" + test[0]);
    Object result = eval.evaluate(bindings);
    Assert.assertEquals(result.toString(), test[1], "Wrong result for expression: " + test[0]);
}
Also used : Evaluable(com.google.refine.expr.Evaluable)

Aggregations

Evaluable (com.google.refine.expr.Evaluable)18 ParsingException (com.google.refine.expr.ParsingException)6 Project (com.google.refine.model.Project)6 Cell (com.google.refine.model.Cell)5 Column (com.google.refine.model.Column)5 Row (com.google.refine.model.Row)5 Properties (java.util.Properties)5 JSONObject (org.json.JSONObject)4 RowVisitor (com.google.refine.browsing.RowVisitor)3 EvalError (com.google.refine.expr.EvalError)3 WrappedCell (com.google.refine.expr.WrappedCell)3 OperatorCallExpr (com.google.refine.grel.ast.OperatorCallExpr)3 Serializable (java.io.Serializable)3 Engine (com.google.refine.browsing.Engine)2 NumericBinIndex (com.google.refine.browsing.util.NumericBinIndex)2 VariableExpr (com.google.refine.grel.ast.VariableExpr)2 CellChange (com.google.refine.model.changes.CellChange)2 LinkedList (java.util.LinkedList)2 Test (org.testng.annotations.Test)2 FilteredRows (com.google.refine.browsing.FilteredRows)1