Package ptolemy.actor.lib.r
Class RConsole
- java.lang.Object
-
- ptolemy.actor.lib.r.RConsole
-
- All Implemented Interfaces:
org.rosuda.JRI.RMainLoopCallbacks
public class RConsole extends java.lang.Object implements org.rosuda.JRI.RMainLoopCallbacksA simple buffering console that is used to cache the output from an R session and then can be used to return the console output as a string.- Since:
- Ptolemy II 11.0
- Version:
- $Id$
- Author:
- Matt Jones
-
-
Constructor Summary
Constructors Constructor Description RConsole()Construct the R Console class and initialize the buffer containing the text.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the console.java.lang.StringgetConsoleOutput()After an R session has ended, get a String representation of the output of the R session.voidrBusy(org.rosuda.JRI.Rengine re, int which)Print a busy message.java.lang.StringrChooseFile(org.rosuda.JRI.Rengine re, int newFile)Choose a file.voidrFlushConsole(org.rosuda.JRI.Rengine re)Flush the console.voidrLoadHistory(org.rosuda.JRI.Rengine re, java.lang.String filename)Load the history.java.lang.StringrReadConsole(org.rosuda.JRI.Rengine re, java.lang.String prompt, int addToHistory)Read from the console.voidrSaveHistory(org.rosuda.JRI.Rengine re, java.lang.String filename)Save history.voidrShowMessage(org.rosuda.JRI.Rengine re, java.lang.String message)Show a message.voidrWriteConsole(org.rosuda.JRI.Rengine re, java.lang.String text, int oType)Callback that is called when text is available from the R Engine and should be written to the console.
-
-
-
Method Detail
-
clear
public void clear()
Clear the console.
-
getConsoleOutput
public java.lang.String getConsoleOutput()
After an R session has ended, get a String representation of the output of the R session.- Returns:
- String containing the text of the R session output
-
rWriteConsole
public void rWriteConsole(org.rosuda.JRI.Rengine re, java.lang.String text, int oType)Callback that is called when text is available from the R Engine and should be written to the console.- Specified by:
rWriteConsolein interfaceorg.rosuda.JRI.RMainLoopCallbacks- Parameters:
re- The R enginetext- The text to by written.oType- Ignored in this method.
-
rBusy
public void rBusy(org.rosuda.JRI.Rengine re, int which)Print a busy message.- Specified by:
rBusyin interfaceorg.rosuda.JRI.RMainLoopCallbacks- Parameters:
re- The R enginewhich- Unknown.
-
rReadConsole
public java.lang.String rReadConsole(org.rosuda.JRI.Rengine re, java.lang.String prompt, int addToHistory)Read from the console. In this class, null is returned.- Specified by:
rReadConsolein interfaceorg.rosuda.JRI.RMainLoopCallbacks- Parameters:
re- The R engineprompt- The promptaddToHistory- unknown- Returns:
- the string read from the console
-
rShowMessage
public void rShowMessage(org.rosuda.JRI.Rengine re, java.lang.String message)Show a message.- Specified by:
rShowMessagein interfaceorg.rosuda.JRI.RMainLoopCallbacks- Parameters:
re- The R enginemessage- The message
-
rChooseFile
public java.lang.String rChooseFile(org.rosuda.JRI.Rengine re, int newFile)Choose a file. In this class return the empty string.- Specified by:
rChooseFilein interfaceorg.rosuda.JRI.RMainLoopCallbacks- Parameters:
re- The R enginenewFile- unused- Returns:
- The file name.
-
rFlushConsole
public void rFlushConsole(org.rosuda.JRI.Rengine re)
Flush the console. In this class, do nothing.- Specified by:
rFlushConsolein interfaceorg.rosuda.JRI.RMainLoopCallbacks- Parameters:
re- The R engine
-
rLoadHistory
public void rLoadHistory(org.rosuda.JRI.Rengine re, java.lang.String filename)Load the history. In this class, do nothing.- Specified by:
rLoadHistoryin interfaceorg.rosuda.JRI.RMainLoopCallbacks- Parameters:
re- The R enginefilename- The file that contains the history.
-
rSaveHistory
public void rSaveHistory(org.rosuda.JRI.Rengine re, java.lang.String filename)Save history. In this class, do nothing.- Specified by:
rSaveHistoryin interfaceorg.rosuda.JRI.RMainLoopCallbacks- Parameters:
re- The R enginefilename- the file in which to save the history.
-
-