org.nuiton.j2r.jni
Class RJniEngine

java.lang.Object
  extended by org.nuiton.j2r.REngineAbstract
      extended by org.nuiton.j2r.jni.RJniEngine
All Implemented Interfaces:
REngine

public class RJniEngine
extends REngineAbstract
implements REngine

RJniEngine.java Created: 22 aout 2006

Author:
Arnaud Thimel

Constructor Summary
RJniEngine()
           
 
Method Summary
 void commit()
          Method to commit all the R instructions stored when not in autocommit mode.
protected  Object convertResult(org.rosuda.JRI.REXP rexp)
          Convert the result from an R expression to a java object.
protected  RDataFrame convertToDataFrame(org.rosuda.JRI.REXP rexp)
           
protected  RList convertToRList(org.rosuda.JRI.REXP rexp)
           
 Object eval(String expr)
          Evaluate a R expression in R and get back the result.
 Object evalScript(String expr)
          Evaluate a R multi-line expression in R and get back the result.
 boolean init()
          Initialize the R engine.
 void terminate()
          Terminate the R connection.
 void voidEval(String expr)
          Evaluate a R expression in R without getting back the result.
 
Methods inherited from class org.nuiton.j2r.REngineAbstract
clearSession, cp, dget, dget, dput, dput, getwd, isAutoCommit, loadRData, loadRData, loadRData, ls, mv, plot, remove, saveRData, saveRData, saveRData, setAutoCommit, setwd
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.nuiton.j2r.REngine
clearSession, cp, dget, dget, dput, dput, getwd, isAutoCommit, loadRData, loadRData, loadRData, ls, mv, plot, remove, saveRData, saveRData, saveRData, setAutoCommit, setwd
 

Constructor Detail

RJniEngine

public RJniEngine()
Method Detail

init

public boolean init()
Initialize the R engine.

Specified by:
init in interface REngine
Returns:
true if initialized, false otherwise.
See Also:
REngine.init()

eval

public Object eval(String expr)
            throws RException
Evaluate a R expression in R and get back the result.

Specified by:
eval in interface REngine
Parameters:
expr - the R expression to evaluate.
Returns:
the result of the R expression.
Throws:
RException - if an error occur while trying to evaluate the expression.
See Also:
REngine.eval(java.lang.String)

evalScript

public Object evalScript(String expr)
                  throws RException
Evaluate a R multi-line expression in R and get back the result.

Specified by:
evalScript in interface REngine
Parameters:
expr - the R expression to evaluate.
Returns:
the result of the R expression.
Throws:
RException - if an error occur while trying to evaluate the expression.
See Also:
REngine.eval(java.lang.String)

convertResult

protected Object convertResult(org.rosuda.JRI.REXP rexp)
Convert the result from an R expression to a java object.

Parameters:
rexp - the R expression to convert.
Returns:
the java object corresponding to the R expression.

convertToDataFrame

protected RDataFrame convertToDataFrame(org.rosuda.JRI.REXP rexp)

convertToRList

protected RList convertToRList(org.rosuda.JRI.REXP rexp)

terminate

public void terminate()
Terminate the R connection.

Specified by:
terminate in interface REngine
See Also:
REngine.terminate()

voidEval

public void voidEval(String expr)
              throws RException
Evaluate a R expression in R without getting back the result. If in non-autocommit mode, expression is stored and evaluated only when the commit() method is called.

Specified by:
voidEval in interface REngine
Parameters:
expr - the R expression to evaluate.
Throws:
RException - if an error occured while trying to evaluate the expression.
See Also:
REngine.voidEval(java.lang.String), commit()

commit

public void commit()
            throws RException
Method to commit all the R instructions stored when not in autocommit mode.

Specified by:
commit in interface REngine
Throws:
RException - if an error occur while evaluating the instructions in R.
See Also:
REngine.commit()


Copyright © 2006-2010 CodeLutin. All Rights Reserved.