use of org.renjin.sexp.AbstractAtomicVector in project bamboobsc by billchen198318.
the class ScriptExpressionUtils method executeRenjin.
private static void executeRenjin(String scriptExpression, Map<String, Object> results, Map<String, Object> parameters) throws Exception {
ScriptEngine engine = buildRenjinScriptEngine();
if (parameters != null) {
for (Map.Entry<String, Object> entry : parameters.entrySet()) {
engine.put(entry.getKey(), entry.getValue());
}
}
engine.eval(scriptExpression);
if (results != null) {
for (Map.Entry<String, Object> entry : results.entrySet()) {
Object res = engine.get(entry.getKey());
if (res instanceof AbstractAtomicVector) {
if (((AbstractAtomicVector) res).length() > 0) {
entry.setValue(((AbstractAtomicVector) res).getElementAsObject(0));
}
} else {
entry.setValue(res);
}
}
}
}
Aggregations