/** assigns a value to a given symbol name * @param name symbol name * @param value value */ public void assign(String name, REXP value) throws REngineException, REXPMismatchException { eng.assign(name, value, this); }
/** convenince method equivalent to <code>eval(parse(cmd, false), null, true);</code> @param cmd expression to parse (see {@link #parse}) @return result */ public REXP parseAndEval(String cmd) throws REngineException, REXPMismatchException { return parseAndEval(cmd, null, true); };
/** convenince method equivalent to <code>eval(parse(text, false), where, resolve);</code> @param text to parse (see {@link #parse}) @param where environment to evaluate in (see {@link #eval}) @param resolve whether to resolve the resulting reference or not (see {@link #eval}) @return result */ public REXP parseAndEval(String text, REXP where, boolean resolve) throws REngineException, REXPMismatchException { REXP p = parse(text, false); return eval(p, where, resolve); }
connectable.getRengine().assign("numList", values); rMax = connectable.getRengine().parseAndEval("max(numList)").asDouble(); connectable.getRengine().parseAndEval("rm(list = setdiff(ls(), lsf.str()))"); } catch (Exception e) { log.error("Exception: ", e);
/** get a value from this environment * @param name name of the value * @param resolve if <code>false</code> returns a reference to the object, if <code>false</code> the reference is resolved * @return value corresponding to the symbol name or possibly <code>null</code> if the value is unbound (the latter is currently engine-specific) */ public REXP get(String name, boolean resolve) throws REngineException { try { return eng.get(name, this, resolve); } catch (REXPMismatchException e) { // this should never happen because this is always guaranteed to be REXPEnv throw(new REngineException(eng, "REXPMismatchException:"+e+" in get()")); } }
/** returns the parent environment or a reference to it * @param resolve if <code>true</code> returns the environemnt, otherwise a reference. * @return parent environemnt (or a reference to it) */ public REXP parent(boolean resolve) throws REngineException { try { return eng.getParentEnvironment(this, resolve); } catch (REXPMismatchException e) { // this should never happen because this is always guaranteed to be REXPEnv throw(new REngineException(eng, "REXPMismatchException:"+e+" in parent()")); } }
/** finalization that notifies the engine when a reference gets collected */ protected void finalize() throws Throwable { try { eng.finalizeReference(this); } finally { super.finalize(); } } // type checks
/** resolve the external REXP reference into an actual REXP object. In addition, the value (if not <code>null</code>) will be cached for subsequent calls to <code>resolve</code> until <code>invalidate</code> is called. */ public REXP resolve() { if (resolvedValue != null) return resolvedValue; try { resolvedValue = eng.resolveReference(this); return resolvedValue; } catch (REXPMismatchException me) { // this should never happen since we are REXPReference } catch(REngineException ee) { // FIXME: what to we do? } return null; }
@Override public void disconnect() throws IOException { if (rengine != null) { rengine.close(); } }
connectable.getRengine().assign("numList", values); } catch (REngineException e) { log.error("Exception: ", e); rMin = connectable.getRengine().parseAndEval("min(numList)").asDouble(); connectable.getRengine().parseAndEval("rm(list = setdiff(ls(), lsf.str()))"); } catch (Exception e) { log.error("Exception: ", e);
/** get a value from this environment * @param name name of the value * @param resolve if <code>false</code> returns a reference to the object, if <code>false</code> the reference is resolved * @return value corresponding to the symbol name or possibly <code>null</code> if the value is unbound (the latter is currently engine-specific) */ public REXP get(String name, boolean resolve) throws REngineException { try { return eng.get(name, this, resolve); } catch (REXPMismatchException e) { // this should never happen because this is always guaranteed to be REXPEnv throw(new REngineException(eng, "REXPMismatchException:"+e+" in get()")); } }
/** returns the parent environment or a reference to it * @param resolve if <code>true</code> returns the environemnt, otherwise a reference. * @return parent environemnt (or a reference to it) */ public REXP parent(boolean resolve) throws REngineException { try { return eng.getParentEnvironment(this, resolve); } catch (REXPMismatchException e) { // this should never happen because this is always guaranteed to be REXPEnv throw(new REngineException(eng, "REXPMismatchException:"+e+" in parent()")); } }
/** finalization that notifies the engine when a reference gets collected */ protected void finalize() throws Throwable { try { eng.finalizeReference(this); } finally { super.finalize(); } } // type checks
/** resolve the external REXP reference into an actual REXP object. In addition, the value (if not <code>null</code>) will be cached for subsequent calls to <code>resolve</code> until <code>invalidate</code> is called. */ public REXP resolve() { if (resolvedValue != null) return resolvedValue; try { resolvedValue = eng.resolveReference(this); return resolvedValue; } catch (REXPMismatchException me) { // this should never happen since we are REXPReference } catch(REngineException ee) { // FIXME: what to we do? } return null; }
@Override public void disconnect() throws IOException { if (rengine != null) { rengine.close(); } }
connectable.getRengine().assign("numList", values); rMax = connectable.getRengine().parseAndEval("max(numList)").asDouble(); connectable.getRengine().parseAndEval("rm(list = setdiff(ls(), lsf.str()))"); } catch (Exception e) { log.error("Exception: ", e);
/** assigns a value to a given symbol name * @param name symbol name * @param value value */ public void assign(String name, REXP value) throws REngineException, REXPMismatchException { eng.assign(name, value, this); }
/** convenince method equivalent to <code>eval(parse(cmd, false), null, true);</code> @param cmd expression to parse (see {@link #parse}) @return result */ public REXP parseAndEval(String cmd) throws REngineException, REXPMismatchException { return parseAndEval(cmd, null, true); };
/** convenince method equivalent to <code>eval(parse(text, false), where, resolve);</code> @param text to parse (see {@link #parse}) @param where environment to evaluate in (see {@link #eval}) @param resolve whether to resolve the resulting reference or not (see {@link #eval}) @return result */ public REXP parseAndEval(String text, REXP where, boolean resolve) throws REngineException, REXPMismatchException { REXP p = parse(text, false); return eval(p, where, resolve); }
connectable.getRengine().assign("numList", values); } catch (REngineException e) { log.error("Exception: ", e); rMin = connectable.getRengine().parseAndEval("min(numList)").asDouble(); connectable.getRengine().parseAndEval("rm(list = setdiff(ls(), lsf.str()))"); } catch (Exception e) { log.error("Exception: ", e);