![Stefano Mazzocchi](/assets/img/avatar_default.png)
(no functional changes) git-svn-id: http://google-refine.googlecode.com/svn/trunk@62 7d457c2a-affb-35e4-300a-418c747d4874
35 lines
845 B
Java
35 lines
845 B
Java
package com.metaweb.gridworks.expr;
|
|
|
|
import java.util.Properties;
|
|
|
|
public class FunctionCallExpr implements Evaluable {
|
|
final protected Evaluable[] _args;
|
|
final protected Function _function;
|
|
|
|
public FunctionCallExpr(Evaluable[] args, Function f) {
|
|
_args = args;
|
|
_function = f;
|
|
}
|
|
|
|
public Object evaluate(Properties bindings) {
|
|
Object[] args = new Object[_args.length];
|
|
for (int i = 0; i < _args.length; i++) {
|
|
args[i] = _args[i].evaluate(bindings);
|
|
}
|
|
return _function.call(bindings, args);
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuffer sb = new StringBuffer();
|
|
|
|
for (Evaluable ev : _args) {
|
|
if (sb.length() > 0) {
|
|
sb.append(", ");
|
|
}
|
|
sb.append(ev.toString());
|
|
}
|
|
|
|
return _function.getClass().getSimpleName() + "(" + sb.toString() + ")";
|
|
}
|
|
}
|