|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.utils.REnvironment
public class REnvironment
This is an environment class for R that helps you to handle all things in a more gentle way.
Constructor Summary | |
---|---|
REnvironment(String server,
int port,
String user,
String passwd)
Creates a new REnvironment with initial size 10 using the given port. |
|
REnvironment(String server,
int port,
String user,
String passwd,
int initSize)
Creates a new REnvironment using the given port. |
|
REnvironment(String server,
String user,
String passwd)
Creates a new REnvironment with initial size 10 using the default port. |
|
REnvironment(String server,
String user,
String passwd,
int initSize)
Creates a new REnvironment using the default port. |
Method Summary | |
---|---|
void |
close()
Close the Renviroment and removes all files from the server. |
boolean |
copyFileFromServer(String serverFileName,
String clientFileName,
boolean overwriteExistingFile)
Copies a file from the server to the local machine. |
boolean |
copyFileToServer(String clientFileName,
String serverFileName,
boolean overwriteExistingFile)
Copies a file from the local machine to the server. |
REXP |
createMatrix(String matrixName,
double[][] matrix)
Creates a matrix of doubles. |
REXP |
createMatrix(String matrixName,
int[][] matrix)
Creates a matrix of integers. |
REXP |
createVector(String vectorName,
double[] vector)
Creates a vector of doubles. |
REXP |
createVector(String vectorName,
int[] vector)
Creates a vector of integers. |
REXP |
createVector(String vectorName,
long[] vector)
Creates a vector of longs. |
REXP |
createVector(String vectorName,
String[] vector)
Creates a vector of Strings. |
void |
deleteAllFilesAtTheServer()
Deletes all files that have been copy to the server or created on the server. |
REXP |
eval(String cmd)
Evaluates the String as R commands. |
protected void |
finalize()
|
String |
getVersionInformation()
|
void |
installScript(String clientFileName,
String serverFileName,
boolean overwriteExistingFile)
Installs a script on the server. |
BufferedImage |
plot(String pltcmd)
Creates a buffered image form a given plot command. |
BufferedImage |
plot(String pltcmd,
double width,
double height)
Creates a buffered image with given dimension form a given plot command. |
boolean |
plotToPDF(String pltcmd,
double width,
double height,
String fileName,
boolean overwriteExistingFile)
Creates a pdf file with given dimension form a given plot command. |
boolean |
plotToPDF(String pltcmd,
String fileName,
boolean overwriteExistingFile)
Creates a pdf file form a given plot command. |
boolean |
plotToTexFile(String pltcmd,
double width,
double height,
String fileName,
boolean overwriteExistingFile)
Creates a tex file with given dimension form a given plot command. |
boolean |
plotToTexFile(String pltcmd,
String fileName,
boolean overwriteExistingFile)
Creates a tex file form a given plot command. |
static JFrame |
showImage(String title,
BufferedImage img)
Enables you to show an image. |
static JFrame |
showImage(String title,
BufferedImage img,
int defaultCloseOperation)
Enables you to show an image. |
void |
voidEval(String cmd)
Evaluates the String as R commands. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public REnvironment(String server, String user, String passwd, int initSize) throws Exception
server
- the name of the serveruser
- the loginpasswd
- the password for the logininitSize
- the initial number of slots for files on the server (has to be at least 1)
Exception
- if something went wrongpublic REnvironment(String server, String user, String passwd) throws Exception
server
- the name of the serveruser
- the loginpasswd
- the password for the login
Exception
- if something went wrongREnvironment(String, String, String, int)
public REnvironment(String server, int port, String user, String passwd, int initSize) throws Exception
server
- the name of the serverport
- the portuser
- the loginpasswd
- the password for the logininitSize
- the initial number of slots for files on the server (has to be at least 1)
Exception
- if something went wrongpublic REnvironment(String server, int port, String user, String passwd) throws Exception
server
- the name of the serverport
- the portuser
- the loginpasswd
- the password for the login
Exception
- if something went wrongREnvironment(String, String, String, int)
Method Detail |
---|
public boolean copyFileFromServer(String serverFileName, String clientFileName, boolean overwriteExistingFile) throws Exception
serverFileName
- name of the file on the serverclientFileName
- name of the file on the client (local machine)overwriteExistingFile
- whether to overwrite the file, if already existing on the client.
true
if the file is copied successfully
Exception
- if something went wrongpublic boolean copyFileToServer(String clientFileName, String serverFileName, boolean overwriteExistingFile) throws Exception
serverFileName
- name of the file on the serverclientFileName
- name of the file on the client (local machine)overwriteExistingFile
- whether to overwrite the file, if already existing on the server.
true
if the file is copied successfully
Exception
- if something went wrongpublic void close() throws Exception
Exception
- if something went wrongpublic REXP createMatrix(String matrixName, int[][] matrix) throws RserveException, IllegalArgumentException
matrixName
- the name of the matrixmatrix
- the matrix of integers
RserveException
- if something with rserve went wrong
IllegalArgumentException
- if matrix[i].length != matrix[j].length
public REXP createMatrix(String matrixName, double[][] matrix) throws RserveException, IllegalArgumentException
matrixName
- the name of the matrixmatrix
- the matrix of doubles
RserveException
- if something with rserve went wrong
IllegalArgumentException
- if matrix[i].length != matrix[j].length
public REXP createVector(String vectorName, String[] vector) throws RserveException
vectorName
- the name of the vectorvector
- the vector of Strings
RserveException
- if something with rserve went wrongpublic REXP createVector(String vectorName, int[] vector) throws RserveException
vectorName
- the name of the vectorvector
- the vector of integers
RserveException
- if something with rserve went wrongpublic REXP createVector(String vectorName, long[] vector) throws RserveException
vectorName
- the name of the vectorvector
- the vector of longs
RserveException
- if something with rserve went wrongpublic REXP createVector(String vectorName, double[] vector) throws RserveException
vectorName
- the name of the vectorvector
- the vector of doubles
RserveException
- if something with rserve went wrongpublic void deleteAllFilesAtTheServer() throws Exception
Exception
- if something went romgpublic REXP eval(String cmd) throws Exception
cmd
- the String to be evaluated
Exception
public String getVersionInformation() throws Exception
Exception
public void installScript(String clientFileName, String serverFileName, boolean overwriteExistingFile) throws Exception
clientFileName
- the name of the scriptfile on the clientserverFileName
- the name of the scriptfile on the serveroverwriteExistingFile
- if true
the method is enabled to overwrite an existing file
Exception
- if something went wrongpublic BufferedImage plot(String pltcmd) throws Exception
pltcmd
- the plot command
Exception
showImage(String, BufferedImage)
,
ImageIO.write(java.awt.image.RenderedImage, String, File)
public BufferedImage plot(String pltcmd, double width, double height) throws Exception
pltcmd
- the plot commandwidth
- the width of the image (in pixel)height
- the height of the image (in pixel)
Exception
showImage(String, BufferedImage)
,
ImageIO.write(java.awt.image.RenderedImage, java.lang.String, java.io.File)
public boolean plotToPDF(String pltcmd, String fileName, boolean overwriteExistingFile) throws Exception
pltcmd
- the plot commandfileName
- the name of the pdf fileoverwriteExistingFile
- if true
the method is enabled to overwrite an existing file
true
if the plot is done
Exception
public boolean plotToPDF(String pltcmd, double width, double height, String fileName, boolean overwriteExistingFile) throws Exception
pltcmd
- the plot commandwidth
- the width of the imageheight
- the height of the imagefileName
- the name of the pdf fileoverwriteExistingFile
- if true
the method is enabled to overwrite an existing file
true
if the plot is done
Exception
public boolean plotToTexFile(String pltcmd, String fileName, boolean overwriteExistingFile) throws Exception
pltcmd
- the plot commandfileName
- the name of the tex fileoverwriteExistingFile
- if true
the method is enabled to overwrite an existing file
true
if the plot is done
Exception
public boolean plotToTexFile(String pltcmd, double width, double height, String fileName, boolean overwriteExistingFile) throws Exception
pltcmd
- the plot commandwidth
- the width of the imageheight
- the height of the imagefileName
- the name of the tex fileoverwriteExistingFile
- if true
the method is enabled to overwrite an existing file
true
if the plot is done
Exception
public void voidEval(String cmd) throws Exception
cmd
- the String to be evaluated
Exception
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public static JFrame showImage(String title, BufferedImage img) throws InterruptedException
title
- the title of the frameimg
- the image
InterruptedException
public static JFrame showImage(String title, BufferedImage img, int defaultCloseOperation) throws InterruptedException
title
- the title of the frameimg
- the imagedefaultCloseOperation
- the variable used to control the window-closing operation
InterruptedException
WindowConstants
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |