java.lang.Object
de.uka.ipd.sdq.sensorframework.visualisation.rvisualisation.utils.RConnectionImpl
All Implemented Interfaces:
RConnection

public class RConnectionImpl extends Object implements RConnection
Encapsulate the access to the R engine. Is responsible for the initialization of the R engine and the execution of R commands.
  • Constructor Details

    • RConnectionImpl

      public RConnectionImpl()
      Initializes the connection to the R engine.
  • Method Details

    • initalizeConnection

      protected void initalizeConnection()
      Initializes the connection to a R engine.
    • execute

      public Vector<org.rosuda.JRI.REXP> execute(String rCommands)
      Description copied from interface: RConnection
      Executes the command(s) in R.
      Specified by:
      execute in interface RConnection
      Parameters:
      rCommands - One or more valid commands in R, separated by \n.
      Returns:
      result Result returned from R. Empty if no result was returned.
    • assign

      public void assign(String name, double[] array)
      Description copied from interface: RConnection
      Stores an array in a R variable.
      Specified by:
      assign in interface RConnection
      Parameters:
      name - Name of the R variable in which the array is stored.
      array - Array to store in an R variable.
    • isEngineAvailable

      public static boolean isEngineAvailable()
      checks if an R engine could be found and the connection is established.
      Returns:
      true if the connection is established.
    • getRConnection

      public static RConnectionImpl getRConnection()
      Returns:
      returns the current RConnection.
    • getLastConsoleMessage

      public String getLastConsoleMessage()
      Specified by:
      getLastConsoleMessage in interface RConnection
      Returns:
      the last message on the console of the connected R engine.