de.cesr.more.measures.util
Class MRService

java.lang.Object
  extended by de.cesr.more.measures.util.MRService
All Implemented Interfaces:
org.rosuda.JRI.RMainLoopCallbacks

public class MRService
extends Object
implements org.rosuda.JRI.RMainLoopCallbacks

MORe Service class for R calculations - schedules at initialisation stopping R.Engine at the end of simulation - loads igraph library - instantiates REnging

Date:
14.11.2011

Method Summary
static
<V,E extends MoreEdge<? super V>>
void
assignGraphObject(org.rosuda.JRI.Rengine re, Graph<V,E> graph, String targetSymbol)
           
static
<V,E extends MoreEdge<? super V>>
void
assignGraphObject(org.rosuda.JRI.Rengine re, Graph<V,E> graph, String targetSymbol, Map<V,Integer> idMap)
          Assigns a JUNG graph object to an R igraph graph object.
static void endEngine()
          Stops REngine.
static MRService getInstance()
          Returns the the current MRService if existing and creates a new instance otherwise.
static org.rosuda.JRI.Rengine getRengine()
          Create a new REngine
 void rBusy(org.rosuda.JRI.Rengine arg0, int which)
           
 String rChooseFile(org.rosuda.JRI.Rengine arg0, int arg1)
           
 void rFlushConsole(org.rosuda.JRI.Rengine arg0)
           
 void rLoadHistory(org.rosuda.JRI.Rengine arg0, String arg1)
           
 String rReadConsole(org.rosuda.JRI.Rengine arg0, String arg1, int arg2)
           
 void rSaveHistory(org.rosuda.JRI.Rengine arg0, String arg1)
           
 void rShowMessage(org.rosuda.JRI.Rengine arg0, String message)
           
 void rWriteConsole(org.rosuda.JRI.Rengine arg0, String message, int level)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static MRService getInstance()
Returns the the current MRService if existing and creates a new instance otherwise.

Returns:
instance of MRService

endEngine

public static void endEngine()
Stops REngine. Scheduled at initialisation for end of simulation.


assignGraphObject

public static <V,E extends MoreEdge<? super V>> void assignGraphObject(org.rosuda.JRI.Rengine re,
                                                                       Graph<V,E> graph,
                                                                       String targetSymbol,
                                                                       Map<V,Integer> idMap)
Assigns a JUNG graph object to an R igraph graph object.

Parameters:
re - the REngine
graph - the graph to assign
targetSymbol - name of R target object

assignGraphObject

public static <V,E extends MoreEdge<? super V>> void assignGraphObject(org.rosuda.JRI.Rengine re,
                                                                       Graph<V,E> graph,
                                                                       String targetSymbol)

getRengine

public static org.rosuda.JRI.Rengine getRengine()
Create a new REngine

Returns:
the new REngine

rBusy

public void rBusy(org.rosuda.JRI.Rengine arg0,
                  int which)
Specified by:
rBusy in interface org.rosuda.JRI.RMainLoopCallbacks
See Also:
RMainLoopCallbacks.rBusy(org.rosuda.JRI.Rengine, int)

rChooseFile

public String rChooseFile(org.rosuda.JRI.Rengine arg0,
                          int arg1)
Specified by:
rChooseFile in interface org.rosuda.JRI.RMainLoopCallbacks
See Also:
RMainLoopCallbacks.rChooseFile(org.rosuda.JRI.Rengine, int)

rFlushConsole

public void rFlushConsole(org.rosuda.JRI.Rengine arg0)
Specified by:
rFlushConsole in interface org.rosuda.JRI.RMainLoopCallbacks
See Also:
RMainLoopCallbacks.rFlushConsole(org.rosuda.JRI.Rengine)

rLoadHistory

public void rLoadHistory(org.rosuda.JRI.Rengine arg0,
                         String arg1)
Specified by:
rLoadHistory in interface org.rosuda.JRI.RMainLoopCallbacks
See Also:
RMainLoopCallbacks.rLoadHistory(org.rosuda.JRI.Rengine, java.lang.String)

rReadConsole

public String rReadConsole(org.rosuda.JRI.Rengine arg0,
                           String arg1,
                           int arg2)
Specified by:
rReadConsole in interface org.rosuda.JRI.RMainLoopCallbacks
See Also:
RMainLoopCallbacks.rReadConsole(org.rosuda.JRI.Rengine, java.lang.String, int)

rSaveHistory

public void rSaveHistory(org.rosuda.JRI.Rengine arg0,
                         String arg1)
Specified by:
rSaveHistory in interface org.rosuda.JRI.RMainLoopCallbacks
See Also:
RMainLoopCallbacks.rSaveHistory(org.rosuda.JRI.Rengine, java.lang.String)

rShowMessage

public void rShowMessage(org.rosuda.JRI.Rengine arg0,
                         String message)
Specified by:
rShowMessage in interface org.rosuda.JRI.RMainLoopCallbacks
See Also:
RMainLoopCallbacks.rShowMessage(org.rosuda.JRI.Rengine, java.lang.String)

rWriteConsole

public void rWriteConsole(org.rosuda.JRI.Rengine arg0,
                          String message,
                          int level)
Specified by:
rWriteConsole in interface org.rosuda.JRI.RMainLoopCallbacks
See Also:
RMainLoopCallbacks.rWriteConsole(org.rosuda.JRI.Rengine, java.lang.String, int)