edu.ucla.stat.SOCR.JRI
Class Rengine

java.lang.Object
  extended by java.lang.Thread
      extended by edu.ucla.stat.SOCR.JRI.Rengine
All Implemented Interfaces:
java.lang.Runnable

public class Rengine
extends java.lang.Thread


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
static int DEBUG
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Rengine(java.lang.String[] args, boolean runMainLoop, RMainLoopCallbacks initialCallbacks)
           
 
Method Summary
 void addMainLoopCallbacks(RMainLoopCallbacks c)
           
 void end()
           
 REXP eval(java.lang.String s)
           
static Rengine getMainEngine()
           
static long getVersion()
          version of the Rengine itself; see also rniGetVersion() for binary version.
 REXP idleEval(java.lang.String s)
          This method is very much like eval(String), except that it is non-blocking and return null if the engine is busy.
 void jriBusy(int which)
           
 java.lang.String jriChooseFile(int newFile)
           
 void jriFlushConsole()
           
 void jriLoadHistory(java.lang.String filename)
           
 java.lang.String jriReadConsole(java.lang.String prompt, int addToHistory)
           
 void jriSaveHistory(java.lang.String filename)
           
 void jriShowMessage(java.lang.String message)
           
 void jriWriteConsole(java.lang.String text)
           
 void rniAssign(java.lang.String name, long exp, long rho)
           
 long rniCAR(long exp)
           
 long rniCDR(long exp)
           
 long rniCons(long head, long tail)
           
 long rniEval(long exp, long rho)
           
 int rniExpType(long exp)
           
 long rniGetAttr(long exp, java.lang.String name)
           
 double[] rniGetDoubleArray(long exp)
           
 int[] rniGetIntArray(long exp)
           
 long[] rniGetList(long exp)
           
 java.lang.String rniGetString(long exp)
           
 java.lang.String[] rniGetStringArray(long exp)
           
 long[] rniGetVector(long exp)
           
static long rniGetVersion()
           
 void rniIdle()
           
 long rniParse(java.lang.String s, int parts)
           
 long rniPutDoubleArray(double[] a)
           
 long rniPutIntArray(int[] a)
           
 long rniPutList(long[] cont)
           
 long rniPutString(java.lang.String s)
           
 long rniPutStringArray(java.lang.String[] a)
           
 long rniPutVector(long[] exps)
           
 void rniRunMainLoop()
           
 void rniSetAttr(long exp, java.lang.String name, long attr)
           
 int rniSetupR(java.lang.String[] args)
           
 int rniStop(int flag)
           
 void run()
           
 void startMainLoop()
          if Rengine was initialized with runMainLoop=false then this method can be used to start the main loop at a later point.
static boolean versionCheck()
           
 boolean waitForR()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEBUG

public static int DEBUG
Constructor Detail

Rengine

public Rengine(java.lang.String[] args,
               boolean runMainLoop,
               RMainLoopCallbacks initialCallbacks)
Method Detail

getVersion

public static long getVersion()
version of the Rengine itself; see also rniGetVersion() for binary version. It's a good idea for the calling program to check the versions of both and abort if they don't match


versionCheck

public static boolean versionCheck()

getMainEngine

public static Rengine getMainEngine()

rniSetupR

public int rniSetupR(java.lang.String[] args)

rniParse

public long rniParse(java.lang.String s,
                     int parts)

rniEval

public long rniEval(long exp,
                    long rho)

rniGetString

public java.lang.String rniGetString(long exp)

rniGetStringArray

public java.lang.String[] rniGetStringArray(long exp)

rniGetIntArray

public int[] rniGetIntArray(long exp)

rniGetDoubleArray

public double[] rniGetDoubleArray(long exp)

rniGetVector

public long[] rniGetVector(long exp)

rniPutString

public long rniPutString(java.lang.String s)

rniPutStringArray

public long rniPutStringArray(java.lang.String[] a)

rniPutIntArray

public long rniPutIntArray(int[] a)

rniPutDoubleArray

public long rniPutDoubleArray(double[] a)

rniPutVector

public long rniPutVector(long[] exps)

rniGetAttr

public long rniGetAttr(long exp,
                       java.lang.String name)

rniSetAttr

public void rniSetAttr(long exp,
                       java.lang.String name,
                       long attr)

rniCons

public long rniCons(long head,
                    long tail)

rniCAR

public long rniCAR(long exp)

rniCDR

public long rniCDR(long exp)

rniPutList

public long rniPutList(long[] cont)

rniGetList

public long[] rniGetList(long exp)

rniGetVersion

public static long rniGetVersion()

rniStop

public int rniStop(int flag)

rniAssign

public void rniAssign(java.lang.String name,
                      long exp,
                      long rho)

rniExpType

public int rniExpType(long exp)

rniRunMainLoop

public void rniRunMainLoop()

rniIdle

public void rniIdle()

addMainLoopCallbacks

public void addMainLoopCallbacks(RMainLoopCallbacks c)

startMainLoop

public void startMainLoop()
if Rengine was initialized with runMainLoop=false then this method can be used to start the main loop at a later point. It has no effect if the loop is running already. This method returns immediately but the loop will be started once the engine is ready.


jriWriteConsole

public void jriWriteConsole(java.lang.String text)

jriBusy

public void jriBusy(int which)

jriReadConsole

public java.lang.String jriReadConsole(java.lang.String prompt,
                                       int addToHistory)

jriShowMessage

public void jriShowMessage(java.lang.String message)

jriLoadHistory

public void jriLoadHistory(java.lang.String filename)

jriSaveHistory

public void jriSaveHistory(java.lang.String filename)

jriChooseFile

public java.lang.String jriChooseFile(int newFile)

jriFlushConsole

public void jriFlushConsole()

eval

public REXP eval(java.lang.String s)

idleEval

public REXP idleEval(java.lang.String s)
This method is very much like eval(String), except that it is non-blocking and return null if the engine is busy.

Parameters:
s - string to evaluate
Returns:
result of the evaluation or null if the engine is busy

waitForR

public boolean waitForR()

end

public void end()

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread