Logo Search packages:      
Sourcecode: rjava version File versions  Download package

synchronized REXP org::rosuda::JRI::Rengine::eval ( String  s,
boolean  convert 
) [inline]

Parses and evaluates an R expression and returns the result.

JRI 0.3
s expression (as string) to parse and evaluate
convert if set to true the resulting REXP will contain native representation of the contents, otherwise an empty REXP will be returned. Depending on the back-end an empty REXP may or may not be used to convert the result at a later point.
resulting expression or null if something wnet wrong

Definition at line 526 of file Rengine.java.

References DEBUG, rniEval(), rniParse(), Rsync, org::rosuda::JRI::Mutex::safeLock(), and org::rosuda::JRI::Mutex::unlock().

            if (DEBUG>0)
                  System.out.println("Rengine.eval("+s+"): BEGIN "+Thread.currentThread());
        boolean obtainedLock=Rsync.safeLock();
        try {
            /* --- so far, we ignore this, because it can happen when a callback needs an eval which is ok ...
            if (!obtainedLock) {
                String es="\n>>JRI Warning: eval(\""+s+"\") detected a possible deadlock ["+Rsync+"]["+Thread.currentThread()+"]. Proceeding without lock, but this is inherently unsafe.\n";
            long pr=rniParse(s, 1);
            if (pr>0) {
                long er=rniEval(pr, 0);
                if (er>0) {
                    REXP x=new REXP(this, er, convert);
                    if (DEBUG>0) System.out.println("Rengine.eval("+s+"): END (OK)"+Thread.currentThread());
                    return x;
        } finally {
            if (obtainedLock) Rsync.unlock();
        if (DEBUG>0) System.out.println("Rengine.eval("+s+"): END (ERR)"+Thread.currentThread());
        return null;

Generated by  Doxygen 1.6.0   Back to index