Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java	(revision 281)
@@ -0,0 +1,1553 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2015-06-15 15:29:16 +0200 (Mon, 15 Jun 2015) $
+// $LastChangedRevision: 2989 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.UUID;
+
+import org.apache.commons.lang.StringUtils;
+import org.eclipse.osgi.util.NLS;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.FrameworkUtil;
+import org.rosuda.REngine.REXP;
+import org.rosuda.REngine.REXPLogical;
+import org.rosuda.REngine.REXPMismatchException;
+import org.rosuda.REngine.REngineException;
+import org.rosuda.REngine.Rserve.RConnection;
+import org.rosuda.REngine.Rserve.RserveException;
+import org.txm.statsengine.core.StatException;
+import org.txm.statsengine.core.data.QuantitativeDataStructure;
+import org.txm.statsengine.core.messages.StatsEngineCoreMessages;
+import org.txm.statsengine.core.utils.VectorizeArray;
+import org.txm.statsengine.r.core.exceptions.RException;
+import org.txm.statsengine.r.core.exceptions.RObjectAlreadyExist;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+import org.txm.statsengine.r.core.messages.RCoreMessages;
+import org.txm.statsengine.r.core.rcolt.RColt;
+import org.txm.utils.OSDetector;
+import org.txm.utils.StreamHog;
+import org.txm.utils.logger.Log;
+import org.txm.utils.network.SystemProxyDetector;
+
+import cern.colt.list.DoubleArrayList;
+import cern.colt.list.IntArrayList;
+import cern.colt.matrix.DoubleMatrix2D;
+
+// TODO: Auto-generated Javadoc
+/**
+ * RWorkspace is the wrapper on top of the R Engine. All data sent to and
+ * retreive from R are using this class. One instance of this class must be
+ * created in a program.
+ * 
+ * This class throw exception RWorkspace exception, encapsulating lower level
+ * exception such as <code>RserveException</code>,
+ * <code>REXPMismatchException</code> or <code>REngineException</code>.
+ * 
+ * This class offers many methods avoiding other classes in the toolbox to
+ * contain R code. The goal is to concentrate R code, as much as possible, here.
+ * See {@link #extractItemFromListByName(String, String)} for instance, and
+ * other "extract..." methods.
+ * 
+ * methods in this class may be organized in the following group:
+ * <ul>
+ * <li>1/ initialization, connection to R, shutdown, etc.</li>
+ * <li>2/ adding object to the R workspace (methods prefixed with "add").</li>
+ * <li>3/ methods encapsulating R code for common fonctions: methods prefixed
+ * with "assign...", "extract..." for instance.</li>
+ * <li>4/ methods for evaluating R expression ({@link #safeEval(String)},
+ * {@link #eval(String)}, {@link #evalToDouble(String)}, etc.)</li>
+ * <li>5/ Static methods for converting result of evaluation in type (
+ * {@link #toDouble(REXP)}, etc.)</li>
+ * <li>6/ methods for checking existence of R object in the R workspace,
+ * removing object from the R workspace, etc.
+ * {@link #checkForDuplicateVariable(String)}, {@link #clearWorkspace()},
+ * {@link #containsVariable(String)},
+ * {@link #removeVariableFromWorkspace(String)}, etc.)</li>
+ * <li>7/ methods for plotting.</li>
+ * </ul>
+ * 
+ * TODO : assign/remove... in a textometrie environment, when Rengine.assign()
+ * will be able to deal with R environment.
+ * 
+ * TODO : remove unused variables from workspace.
+ * 
+ * @author Sylvain Loiseau &lt;sloiseau@ens-lsh.fr&gt;
+ */
+
+public final class RWorkspace {
+
+	/** The comm. */
+	private static RFileCommunication comm;
+
+	/** The connection. */
+	private static RConnection connection = null;
+
+	/** The eval logs. */
+	static ArrayList<String> evalLogs = new ArrayList<String>();
+
+	/** The filecommunication. */
+	private static boolean filecommunication = false;
+
+	// --------------------------------------
+	/** The last safeeval expr. */
+	static String lastSafeevalExpr = ""; //$NON-NLS-1$
+
+	/** The Rserve process. */
+	private static Process RserveProcess = null;
+
+	/** The workspace. */
+	private static RWorkspace workspace = null;
+	
+	/** The error logger. */
+	private StreamHog errorLogger;
+
+	/** The input logger. */
+	private StreamHog inputLogger;
+
+	/** The loggin. */
+	private boolean logging;
+
+	/** The DEFAUL t_ symbol. */
+	//private String DEFAULT_SYMBOL = "txmresult"; //$NON-NLS-1$
+
+	/**
+	 * Folder where to create the R working directory
+	 */
+	protected File userdir = null;
+
+	/**
+	 * Appendto eval log.
+	 *
+	 * @param cmd the cmd
+	 */
+	public static void appendtoEvalLog(String cmd)
+	{
+		evalLogs.add(cmd);
+	}
+
+	/**
+	 * Close the connection.
+	 *
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public static final void closeConnection() throws RWorkspaceException {
+		// If no R object have been created during the lif ecycle of the
+		// application,
+		// the connection has never been initialized.
+		if (connection != null)
+			connection.close();
+	}
+
+	/**
+	 * Connect to Rserve.
+	 *
+	 * @param host the host
+	 * @param port the port
+	 * @return true if success
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public static boolean connect(String host, int port)
+			throws RWorkspaceException {
+		try {
+			Log.info(RCoreMessages.RWorkspace_2+host+":"+port); //$NON-NLS-1$
+			connection = new RConnection(host, port);
+			//connection.setStringEncoding("UTF-8");
+
+			return isConnected();
+		} catch (RserveException x) {
+			throw new RWorkspaceException(x);
+		}
+
+	}
+
+	/**
+	 * Connect to Rserve.
+	 *
+	 * @param host the host
+	 * @param port the port
+	 * @param user the user
+	 * @param password the password
+	 * @return true, if successful
+	 */
+	public static boolean connect(String host, int port, String user, String password) {
+		try {
+			Log.info(RCoreMessages.RWorkspace_2+host+":"+port+" user :"+user); //$NON-NLS-2$ //$NON-NLS-1$
+			connection = new RConnection(host, port);
+			connection.login(user, password);
+			return isConnected();
+
+		} catch (RserveException x) {
+			System.out.println(RCoreMessages.RWorkspace_0 + host+ ", " + port + ", " + user); //$NON-NLS-1$//$NON-NLS-2$ 
+			Log.severe(RCoreMessages.RWorkspace_0 + host+ ", " + port + ", " + user); //$NON-NLS-1$//$NON-NLS-2$ 
+		}
+		return false;
+	}
+
+	/**
+	 * Gets the last safe eval expr.
+	 *
+	 * @return the last safe eval expr
+	 */
+	public static String getLastSafeEvalExpr()
+	{
+		return lastSafeevalExpr;
+	}
+
+
+	public static String getRandomSymbol() {
+		String symbol = "Random"+UUID.randomUUID(); //$NON-NLS-1$
+		return symbol;
+	}
+
+	/**
+	 * Entering the R workspace.
+	 *
+	 * @param 
+	 * @return the r workspace instance
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public static final RWorkspace getRWorkspaceInstance() throws RWorkspaceException {
+		if (workspace == null) {
+			Bundle bundle = FrameworkUtil.getBundle(RWorkspace.class);
+			File userdir = new File(bundle.getLocation());
+			System.out.println("BUNDLE LOCATION OF '" + bundle.getSymbolicName() + "': " + userdir);
+			workspace = new RWorkspace(userdir);
+		}
+		return workspace;
+	}
+
+	
+	//FIXME: old method, based on hard-coded bundle name
+//	public static final RWorkspace getRWorkspaceInstance()
+//			throws RWorkspaceException {
+//		Bundle bundle = Platform.getBundle("org.txm.statsengine.r.core");
+//		File userdir = new File(bundle.getLocation());
+//		System.out.println("BUNDLE LOCATION OF 'org.txm.statsengine.r.core': "+userdir);
+//		if (workspace == null) {
+//			workspace = new RWorkspace(userdir);
+//		}
+//		return workspace;
+//	}
+
+	
+	
+	/**
+	 * Post initialisation of Rserve : loads libraries.
+	 * @deprecated The extensions will load themself the packages they need 
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	private static void init() throws RWorkspaceException {
+		String[] packagesToLoad = { }; //$NON-NLS-1$
+		for (int i = 0; i < packagesToLoad.length; i++) {
+			String name = packagesToLoad[i];
+			try {
+				// System.out.println("load R lib : " + name);
+				connection.eval(("library(" + name + ")")); //$NON-NLS-1$ //$NON-NLS-2$
+				// System.out.println("Done : load R lib : " + name);
+			} catch (RserveException e) {
+				throw new RWorkspaceException(NLS.bind(RCoreMessages.LIBRARY_NOT_LOADED, name, e));
+			} catch (Exception e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+	}
+
+	/**
+	 * Default initialisation of RWorkspace with defautl parameters :
+	 * address = 127.0.0.1
+	 * port = 6311
+	 * debug = false.
+	 *
+	 * @param pathToRExecutalbe the path to r executalbe
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public static final void initializeRWorkspace(String pathToRExecutalbe)
+			throws RWorkspaceException {
+		workspace = new RWorkspace(pathToRExecutalbe, "127.0.0.1", 6311, false); //$NON-NLS-1$
+	}
+
+	/**
+	 * Initialize r workspace.
+	 * debug = false
+	 *
+	 * @param pathToRExecutalbe the path to r executalbe
+	 * @param host the host
+	 * @param port the port
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public static final void initializeRWorkspace(String pathToRExecutalbe,
+			String host, int port) throws RWorkspaceException {
+		workspace = new RWorkspace(pathToRExecutalbe, host, port, false);
+	}
+
+	// --------------------------------------
+	/**
+	 * check R path
+	 * check if Rserve has already been launched
+	 * if not try to launch it.
+	 *
+	 * @param pathToRExecutable the path to r executable
+	 * @param options 
+	 * @param rServeArgs 
+	 * @return true if Rserve is launched
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	private static boolean initRserve(String pathToRExecutable, int port, boolean debug, String rargs, String rServeArgs)
+			throws RWorkspaceException {
+		boolean isRServerOk;
+		if (pathToRExecutable == null || pathToRExecutable.length() == 0) {
+			isRServerOk = StartRserve.checkLocalRserve(port, debug, rargs, rServeArgs);
+			if (!isRServerOk) {
+				throw new RWorkspaceException(
+						RCoreMessages.RSERVE_PATH_NOT_SET_ERROR); 
+			}
+		} else {
+			Log.info(RCoreMessages.RWorkspace_10+pathToRExecutable);
+			isRServerOk = StartRserve.launchRserve(pathToRExecutable, port, debug, rargs, rServeArgs);
+			// System.out.println("ap launchRserve");
+			if (!isRServerOk) {
+				throw new RWorkspaceException(RCoreMessages.RSERVE_PATH_SET_ERROR+ " : "+pathToRExecutable); //$NON-NLS-1$
+			}
+		}
+
+		if (isRServerOk) {
+			Log.finest("RSERVE_ACTIVATED"); //$NON-NLS-1$
+			System.out.println(RCoreMessages.CONNECTED_TO_STATS_MODULE); 
+			RserveProcess = StartRserve.Rserveprocess;
+		}
+		return isRServerOk;
+	}
+
+	/**
+	 * Checks if is connected.
+	 *
+	 * @return true if the RWorkspace is connected to RServe
+	 */
+	private static boolean isConnected() {
+		if (!connection.isConnected()) {
+			return false;
+		} else {
+			return true;
+		}
+	}
+
+	
+	/**
+	 * Checks if is file tranfert.
+	 *
+	 * @return true, if is file tranfert
+	 */
+	public static boolean isFileTranfert() {
+		return filecommunication;
+	}
+
+	
+	
+	/**
+	 * Load eval log.
+	 *
+	 * @param file the file
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static void loadEvalLog(File file) throws IOException
+	{
+		BufferedReader reader = new BufferedReader(new FileReader(file));
+		String cmd = reader.readLine();
+		while(cmd != null)
+		{
+			evalLogs.add(cmd);
+			cmd = reader.readLine();
+		}
+		reader.close();
+	}
+
+	/**
+	 * Prints the last safe eval expr.
+	 */
+	public static void printLastSafeEvalExpr() {
+		System.out.println(RCoreMessages.RWorkspace_11+lastSafeevalExpr);
+	}
+
+	/**
+	 * Save eval log.
+	 *
+	 * @param file the file
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public static void saveEvalLog(File file) throws IOException {
+		FileWriter writer = new FileWriter(file);
+		for (String cmd : evalLogs)
+			writer.write(cmd+"\n"); //$NON-NLS-1$
+		writer.flush();
+		writer.close();
+	}
+
+	/**
+	 * if state is true, the matrix will be send to R with a File.
+	 *
+	 * @param state the state
+	 * @return true if success
+	 */
+	public static boolean setUseFileCommunication(boolean state) {
+		filecommunication = state;
+		if (filecommunication) {
+			try {
+				comm = new RFileCommunication();
+			} catch (IOException e) {
+				filecommunication = false;
+				Log.severe(RCoreMessages.RWorkspace_6+Log.toString(e));
+				return false;
+			}
+		}
+		return true;
+	}
+
+	/**
+	 * Close the connection and destroy the Rserve process.
+	 *
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public static final void shutdown() throws RWorkspaceException {
+		try {
+			// If no R object have been created during the lif ecycle of the
+			// application,
+			// the connection has never been initialized.
+
+			if (connection != null) {
+				if (connection.isConnected()) {
+					// connection.close(); // No: invoquing "close()" make
+					// "shutdown()" to throw a "not connected" exception.
+					connection.shutdown();
+					connection = null; // warning, after shuting down the
+					// server, the connection appears still
+					// ok but using it yield to a
+					// "Broken pipe" exception.
+				}
+			}
+			if (RserveProcess != null) RserveProcess.destroy();
+		} catch (RserveException e) {
+			throw new RWorkspaceException(e);
+		}
+	}
+
+	/**
+	 * Start exec.
+	 *
+	 * @param pathToRExecutable the path to r executable
+	 * @param string 
+	 * @param string 
+	 * @return true, if successful
+	 */
+	public static boolean startExec(String pathToRExecutable, int port, boolean debug, String rArgs, String rServeArgs) {
+		// System.out.println("Start Exec");
+		try {
+			initRserve(pathToRExecutable, port, debug, rArgs, rServeArgs);
+			return true;
+		} catch (RWorkspaceException e) {
+			System.out.println(RCoreMessages.RWorkspace_8+e);
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return false;
+	}
+
+	/**
+	 * To double.
+	 *
+	 * @param rexp the rexp
+	 * @return the double[]
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public static final double[] toDouble(REXP rexp) throws RWorkspaceException {
+		try {
+			return rexp.asDoubles();
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+	}
+
+	/**
+	 * protected on purpose. See {@link #getRWorkspaceInstance()}.
+	 *
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public RWorkspace(File userdir) throws RWorkspaceException {
+		this.userdir = userdir;
+	}
+
+	// --------------------------------------
+
+//	/**
+//	 * protected on purpose. See {@link #getRWorkspaceInstance()}.
+//	 *
+//	 * @param pathToRExecutable the path to r executable
+//	 * @throws RWorkspaceException the r workspace exception
+//	 */
+//	protected RWorkspace(String pathToRExecutable, int port, boolean debug) throws RWorkspaceException {
+//		if (initRserve(pathToRExecutable, port, debug, "","")) {
+//			connect();
+//			init();
+//		}
+//	}
+
+	/**
+	 * protected on purpose. See {@link #getRWorkspaceInstance()}.
+	 *
+	 * @param pathToRExecutable the path to r executable
+	 * @param host the host
+	 * @param port the port
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	protected RWorkspace(String pathToRExecutable, String host, int port, boolean debug)
+			throws RWorkspaceException {
+		if (initRserve(pathToRExecutable, port, debug, "", "")) {
+			connect(host, port);
+			init();
+		}
+	}
+
+	/**
+	 * Add a matrix into the workspace and link it to a name. The inner arrays
+	 * of the <code>matrix</code> parameters are the <strong>row</strong> of the
+	 * resulting R matrix.
+	 *
+	 * @param variableName the name to be used in the R workspace.
+	 * @param matrix the data to be bound to the name. In the form
+	 * <code>matrix[row][column]</code>, with exactly the same number
+	 * of column in every row.
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void addMatrixToWorkspace(String variableName, double[][] matrix)
+			throws RWorkspaceException {
+		//System.out.println("matrix len: "+matrix.length+" test="+(matrix.length == 0));
+		if (matrix.length == 0) {
+			new RWorkspaceException(RCoreMessages.RWorkspace_7);
+		}
+		int ncol = matrix[0].length;
+		int nrow = matrix.length;
+
+		double[] vector = VectorizeArray.vectorizeByInner(matrix);
+
+		if (!filecommunication) {
+			try {
+				connection.assign(variableName, vector);
+			} catch (REngineException e) {
+				throw new RWorkspaceException(e);
+			}
+			try {
+				connection .voidEval(variableName
+						+ "<- matrix(" + variableName + ", nrow=" + nrow + ", ncol=" + ncol + ", byrow=T)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			} catch (RserveException e) {
+				throw new RWorkspaceException(e);
+			}
+		} else {
+			comm.assign(variableName, vector, nrow, ncol);
+		}
+		Log.finest("MATRIX_ADDED_TO_WORKSPACE" + new Object[] { nrow, ncol, variableName }); //$NON-NLS-1$
+	}
+
+	/**
+	 * Add a matrix into the workspace and link it to a name. Intended to be
+	 * efficient for sparse matrix.
+	 *
+	 * @param variableName the name to be used in the R workspace.
+	 * @param matrix the data to be bound to the name.
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void addMatrixToWorkspace(String variableName, DoubleMatrix2D matrix)
+			throws RWorkspaceException {
+
+		double[][] data = RColt.doubleMatrix2D2DoubleDoubleArray(matrix);
+		addMatrixToWorkspace(variableName, data);
+
+		// // IntArrayList x = new IntArrayList();
+		// // IntArrayList y = new IntArrayList();
+		// // DoubleArrayList val = new DoubleArrayList();
+		// //
+		// // matrix.trimToSize();
+		// // matrix.getNonZeros(x, y, val);
+		// // x.trimToSize();
+		// // y.trimToSize();
+		// // val.trimToSize();
+		// //
+		// // for (int i = 0; i < x.size(); i++) {
+		// // x.setQuick(i, x.getQuick(i) + 1);
+		// // }
+		// //
+		// // for (int i = 0; i < y.size(); i++) {
+		// // y.setQuick(i, y.getQuick(i) + 1);
+		// // }
+		// //
+		// // System.out.println("colt");
+		// // System.out.println(x);
+		// // System.out.println(y);
+		// // System.out.println(val);
+		//		
+		// int nrow = matrix.rows();
+		// int ncol = matrix.columns();
+		// // System.out.println(matrix);
+		// // System.out.println(Arrays.toString(vald));
+		// try {
+		// // connection.eval(variableName + "<- matrix(0, nrow=" + nrow +
+		// ", ncol=" + ncol + " );");
+		// connection.assign(variableName, m);
+		// } catch (RserveException e) {
+		// throw new RWorkspaceException(e);
+		// }
+		// try {
+		// connection.assign(variableName + ".nonzero", val.elements());
+		// connection.assign(variableName + ".x", x.elements());
+		// connection.assign(variableName + ".y", y.elements());
+		// } catch (REngineException e) {
+		// throw new RWorkspaceException(e);
+		// }
+		// try {
+		// // connection.voidEval("dim(" + variableName + ") <- c(" + nrow +
+		// ", " + ncol + ")");
+		// // connection.voidEval(variableName + "[" + variableName + ".x, " +
+		// variableName + ".y" + " ] <- " + variableName + ".nonzero");
+		// // for (int i = 0; i < x.size(); i++) {
+		// // for (int j = 0; j < y.size(); j++) {
+		// // connection.voidEval(variableName + "[" + x.getQuick(i) + ", " +
+		// y.getQuick(j) + "] <- " + val.getQuick(i * 5 + * j));
+		// // }
+		// // }
+		//			
+		// } catch (RserveException e) {
+		// throw new RWorkspaceException(e);
+		// }
+		//		
+		// removeVariableFromWorkspace(variableName + ".nonzero");
+		// removeVariableFromWorkspace(variableName + ".x");
+		// removeVariableFromWorkspace(variableName + ".y");
+		//		
+		//		
+		// System.out.println("--------------matrice d'origine----------");
+		// System.out.println(matrix);
+		//		
+		// // DoubleFactory2D.dense.make(arg0)
+		// System.out.println("--------------matrice issue de R----------");
+		// DenseDoubleMatrix2D m = null;
+		// try {
+		// m = new
+		// DenseDoubleMatrix2D(connection.eval(variableName).asDoubleMatrix());
+		// } catch (REXPMismatchException e) {
+		// // TODO Auto-generated catch block
+		// org.txm.utils.logger.Log.printStackTrace(e);
+		// } catch (RserveException e) {
+		// // TODO Auto-generated catch block
+		// org.txm.utils.logger.Log.printStackTrace(e);
+		// }
+		// System.out.println(m);
+
+	}
+
+//TODO: is addLexiconToWorkspace used ?
+//	/**
+//	 * Adds the lexicon to workspace.
+//	 *
+//	 * @param variableName the variable name
+//	 * @param lexicon the lexicon
+//	 * @throws RWorkspaceException the r workspace exception
+//	 */
+//	public void addLexiconToWorkspace(String variableName, Lexicon lexicon)
+//			throws RWorkspaceException {
+//		int[] freqs = lexicon.getFreq();
+//		String[] forms = lexicon.getForms();
+//		try {
+//			addVectorToWorkspace(variableName, freqs);
+//			addVectorToWorkspace(variableName + "_names", forms); //$NON-NLS-1$
+//			connection
+//			.voidEval("names(" + variableName + ") <- " + variableName + "_names"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+//			connection.voidEval("rm(" + variableName + "_names" + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+//		} catch (RserveException e) {
+//			throw new RWorkspaceException(e);
+//		}
+//		Log.finest("LEXICON_ADDED" + new Object[] { lexicon.nbrOfType() + variableName }); //$NON-NLS-1$
+//	}
+
+	/**
+	 * Add a matrix into the workspace and link it to a name. The inner arrays
+	 * of the <code>matrix</code> parameters are the <strong>row</strong> of the
+	 * resulting R matrix.
+	 *
+	 * @param variableName the name to be used in the R workspace.
+	 * @param matrix the data to be bound to the name. In the form
+	 * <code>matrix[row][column]</code>, with exactly the same number
+	 * of column in every row.
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void addMatrixToWorkspace(String variableName, int[][] matrix)
+			throws RWorkspaceException {
+		int ncol = 0;
+		if (matrix.length == 0) {
+			ncol = 0;
+		} else {
+			ncol = matrix[0].length;
+		}
+		int nrow = matrix.length;
+		int[] vector = VectorizeArray.vectorizeByInner(matrix);
+		if (!filecommunication) {
+			try {
+				connection.assign(variableName, vector);
+			} catch (REngineException e) {
+				throw new RWorkspaceException(e);
+			}
+			try {
+				connection .voidEval(variableName
+						+ "<- matrix(" + variableName + ", nrow=" + nrow + ", ncol=" + ncol + ", byrow=T)"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			} catch (RserveException e) {
+				throw new RWorkspaceException(e);
+			}
+		} else {
+			comm.assign(variableName, vector, nrow, ncol);
+		}
+		Log.finest("MATRIX_ADDED_TO_WORKSPACE" + new Object[] { nrow, ncol, variableName }); //$NON-NLS-1$
+	}
+
+	/**
+	 * Adds the vector to workspace.
+	 *
+	 * @param variableName the variable name
+	 * @param vector the vector
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void addVectorToWorkspace(String variableName, double[] vector)
+			throws RWorkspaceException {
+		if (filecommunication) {
+			comm.assign(variableName, vector);
+		} else {
+			try {
+				connection.assign(variableName, vector);
+			} catch (REngineException e) {
+				throw new RWorkspaceException(e);
+			}
+		}
+
+		Log.finest("DOUBLE_VECTOR_ADDED_TO_WORKSPACE" + new Object[] { vector.length, variableName }); //$NON-NLS-1$
+	}
+
+	/**
+	 * Add a vector into the workspace and link it to a name.
+	 *
+	 * @param variableName the variable name
+	 * @param vector the vector
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void addVectorToWorkspace(String variableName, DoubleArrayList vector)
+			throws RWorkspaceException {
+
+		vector.trimToSize();
+		double[] vald = vector.elements();
+		if (filecommunication) {
+			comm.assign(variableName, vald);
+		} else {
+			try {
+				connection.assign(variableName, vald);
+			} catch (REngineException e) {
+				throw new RWorkspaceException(e);
+			}
+		}
+		Log.finest("DOUBLE_VECTOR_ADDED_TO_WORKSPACE" + new Object[] { vald.length, variableName }); //$NON-NLS-1$
+	}
+
+	/**
+	 * Adds the vector to workspace.
+	 *
+	 * @param variableName the variable name
+	 * @param vector the vector
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void addVectorToWorkspace(String variableName, int[] vector)
+			throws RWorkspaceException {
+		//checkForDuplicateVariable(variableName);
+		if (filecommunication) {
+			comm.assign(variableName, vector);
+		} else {
+			try {
+				connection.assign(variableName, vector);
+			} catch (REngineException e) {
+				throw new RWorkspaceException(e);
+			}
+		}
+
+		Log.finest("INT_VECTOR_ADDED_TO_WORKSPACE" + new Object[] { vector.length, variableName }); //$NON-NLS-1$
+	}
+
+	/**
+	 * Adds the vector to workspace.
+	 *
+	 * @param variableName the variable name
+	 * @param vector the vector
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void addVectorToWorkspace(String variableName, IntArrayList vector)
+			throws RWorkspaceException {
+		vector.trimToSize();
+		int[] vald = vector.elements();
+		if (filecommunication) {
+			comm.assign(variableName, vald);
+		} else {
+			try {
+				connection.assign(variableName, vald);
+			} catch (REngineException e) {
+				throw new RWorkspaceException(e);
+			}
+		}
+
+		Log.finest("INT_VECTOR_ADDED_TO_WORKSPACE" + new Object[] { vald.length, variableName }); //$NON-NLS-1$
+	}
+
+	// --------------------------------------
+
+	/**
+	 * Adds the vector to workspace.
+	 *
+	 * @param variableName the variable name
+	 * @param vector the vector
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void addVectorToWorkspace(String variableName, String[] vector)
+			throws RWorkspaceException {
+
+		try {
+			connection.assign(variableName, vector);
+		} catch (REngineException e) {
+			throw new RWorkspaceException(e);
+		}
+
+		Log.finest("CHAR_VECTOR_ADDED_TO_WORKSPACE" + new Object[] { vector.length, variableName }); //$NON-NLS-1$
+	}
+
+	/**
+	 * Assign col names to matrix.
+	 *
+	 * @param matrix the matrix
+	 * @param colNames the col names
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void assignColNamesToMatrix(String matrix, String colNames)
+			throws RWorkspaceException {
+		voidEval("colnames(" + matrix + ") <- " + colNames); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Assign row names to matrix.
+	 *
+	 * @param matrix the matrix
+	 * @param rowNames the row names
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void assignRowNamesToMatrix(String matrix, String rowNames)
+			throws RWorkspaceException {
+		voidEval("rownames(" + matrix + ") <- " + rowNames); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Builds the string args.
+	 *
+	 * @param arguments the arguments
+	 * @return the string[]
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	private String[] buildStringArgs(QuantitativeDataStructure[] arguments) throws RWorkspaceException {
+		String[] arguments_as_string = new String[arguments.length];
+		for (int i = 0; i < arguments_as_string.length; i++) {
+			if (arguments[i] == null) { // null may be used for specif ying
+				// "NULL" R object.
+				arguments_as_string[i] = "NULL"; //$NON-NLS-1$
+			} else {
+				if (!containsVariable(arguments[i].getSymbol())) {
+					throw new RWorkspaceException(NLS.bind(RCoreMessages.REQUESTED_OBJECT_NOT_FOUND_IN_R, arguments[i].getSymbol())); 
+				}
+				arguments_as_string[i] = arguments[i].getSymbol();
+			}
+		}
+		return arguments_as_string;
+	}
+
+	/**
+	 * Call a function, with an array of {@link QuantitativeDataStructure}.
+	 * 
+	 * The <code>QuantitativeDataStructure</code> array is turned into a list of
+	 * non-named parameters, and {@link #callFunction(String, String[])} is
+	 * called.
+	 * 
+	 * If one of the <code>QuantitativeDataStructure</code> is <code>null</code>
+	 * , then the string "NULL" is used (= R null).
+	 *
+	 * @param functionName the function name
+	 * @param arguments of the function, as non-named parameters.
+	 * @return a REXP object
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public REXP callFunction(String functionName, QuantitativeDataStructure[] arguments) throws RWorkspaceException {
+		String[] arguments_as_string = buildStringArgs(arguments);
+		return callFunction(functionName, arguments_as_string);
+	}
+
+	/**
+	 * Call a function, with an array of {@link QuantitativeDataStructure}.
+	 * 
+	 * The <code>QuantitativeDataStructure</code> array is turned into a list of
+	 * non-named parameters, and {@link #callFunction(String, String[])} is
+	 * called.
+	 * 
+	 * If one of the <code>QuantitativeDataStructure</code> is <code>null</code>
+	 * , then the string "NULL" is used (= R null).
+	 *
+	 * @param functionName the function name
+	 * @param arguments of the function, as non-named parameters.
+	 * @param symbol the symbol
+	 * @return a REXP object
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public REXP callFunction(String functionName, QuantitativeDataStructure[] arguments, String symbol) throws RWorkspaceException {
+		String[] arguments_as_string = buildStringArgs(arguments);
+		return callFunctionAndAffect(functionName, arguments_as_string, symbol);
+	}
+
+	/**
+	 * See {@link #callFunction(String, String[])}.
+	 *
+	 * @param functionName the function name
+	 * @param argument the argument
+	 * @return the rEXP
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public REXP callFunction(String functionName, String argument)
+			throws RWorkspaceException {
+		return callFunction(functionName, new String[] { argument });
+	}
+
+	/**
+	 * Call a function, with a list of non-named parameters, and return the
+	 * result as a <code>REXP</code> object.
+	 *
+	 * @param functionName the function name
+	 * @param arguments of the function, as non-named parameters.
+	 * @return a REXP object
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public REXP callFunction(String functionName, String[] arguments)
+			throws RWorkspaceException {
+		//return eval(makeFunctionCall(functionName, arguments));
+		return callFunctionAndAffect(functionName, arguments, "txmresult"); //$NON-NLS-1$
+	}
+
+	/**
+	 * Same as {@link #callFunction(String, String[])}, but affect the result to
+	 * a R name in the R workspace.
+	 *
+	 * @param functionName the function name
+	 * @param arguments the arguments
+	 * @param symbol the name to which the result of the function will be affected.
+	 * @return the rEXP
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public REXP callFunctionAndAffect(String functionName, String[] arguments, String symbol) throws RWorkspaceException {
+		if (symbol.length() == 0)//symbol must be well formed
+			symbol = "txmresult"; //$NON-NLS-1$
+		StringBuffer sb = new StringBuffer();
+		sb.append(symbol);
+		sb.append(RConstant.AFFECTATION);
+		sb.append(makeFunctionCall(functionName, arguments));
+		return eval(sb.toString());
+	}
+
+	/**
+	 * Check for duplicate variable.
+	 *
+	 * @param variableName the variable name
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void checkForDuplicateVariable(String variableName)
+			throws RWorkspaceException {
+		if (containsVariable(variableName)) {
+			throw new RObjectAlreadyExist(
+					"Duplicate variable name: " + variableName + ". Existing variables: " + Arrays.toString(getExistingVariableName())); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+	}
+
+
+	/**
+	 * Remove all variables from workspace.
+	 *
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void clearWorkspace() throws RWorkspaceException {
+		try {
+			connection.voidEval("rm(list=ls(), inherits=FALSE)"); //$NON-NLS-1$
+		} catch (RserveException e) {
+			throw new RWorkspaceException(e);
+		}
+		Log.finest("WORKSPACE_PURGED"); //$NON-NLS-1$
+	}
+
+	/**
+	 * connect to Rserve using the defaults address and port 127.0.0.1:6311
+	 *
+	 * @return true if success
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	private boolean connect() throws RWorkspaceException {
+		return connect("127.0.0.1", 6311); //$NON-NLS-1$
+	}
+
+	/**
+	 * Test if a variable exists in the R workspace. A variable exists in the R
+	 * workspace if the R function <code>exists</code> return true on that
+	 * variable name.
+	 *
+	 * @param variableName the variable supposed to exists in the R workspace.
+	 * @return <code>true</code> if the variable exist, <code>false</code>
+	 * otherwise.
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public boolean containsVariable(String variableName)
+			throws RWorkspaceException {
+		REXP res = null;
+		try {
+			res = connection.eval("exists(\"" + variableName + "\")"); //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (RserveException e) {
+			throw new RWorkspaceException(e);
+		}
+		if (res.isLogical() && ((REXPLogical) res).isTRUE()[0]) {
+			return true;
+		}
+		return false;
+	}
+
+	/**
+	 * Bar delegate call to {@link Rengine#eval(String)}.
+	 * 
+	 * It is up to the caller to check if everything goes well (testing if the
+	 * return value is not of type XT_NULL).
+	 *
+	 * @param exp the exp
+	 * @return the rEXP
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public synchronized REXP eval(String exp) throws RWorkspaceException {
+		REXP res = null;
+		try {
+			res = safeEval(exp);
+		} catch (RserveException e) {
+			RWorkspace.printLastSafeEvalExpr();
+			throw new RWorkspaceException(e);
+		} catch (REXPMismatchException e) {
+			throw new RException(exp + "; " + e.getMessage(), e); //$NON-NLS-1$
+		}
+		//Log.finest("EVALUATED_EXPRESSION" + exp ); //$NON-NLS-1$
+		return res;
+	}
+
+	/**
+	 * Eval to double.
+	 *
+	 * @param exp the exp
+	 * @return the double[]
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public double[] evalToDouble(String exp) throws RWorkspaceException {
+		double[] res = null;
+		try {
+			res = eval(exp).asDoubles();
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+		return res;
+	}
+
+	// public REXP safeVoidEval(String s) throws RserveException, RException,
+	// REXPMismatchException {
+	// REXP r = connection.voidEval("try({" + s + "}, silent=TRUE)");
+	// if (r.inherits("try-error")) throw new RException(r.asString());
+	// return r;
+	// }
+
+	/**
+	 * Eval to double2 d.
+	 *
+	 * @param exp the exp
+	 * @return the double[][]
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public double[][] evalToDouble2D(String exp) throws RWorkspaceException {
+		double[][] res = null;
+		try {
+			res = eval(exp).asDoubleMatrix();
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+		return res;
+	}
+
+	/*
+	 * Eval to int 2d.
+	 *
+	 * @param exp the exp
+	 * @return the double[][]
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public int[][] evalToInt2D(String exp) throws RWorkspaceException {
+		int[][] res = null;
+		try {
+			int[] dims = eval(StatsEngineCoreMessages.MatrixImpl_2+exp+")").asIntegers(); //$NON-NLS-2$
+			int ncol = dims[1];
+			int nrow = dims[0];
+			int[] tmp = eval("c("+exp+")").asIntegers(); //$NON-NLS-1$ //$NON-NLS-2$
+
+			int c = 0;
+			res = new int[nrow][ncol];
+			for (int i = 0 ; i < ncol ; i++) {
+				for (int j = 0 ; j < nrow ; j++) {
+					res[j][i] = tmp[c++];
+				}
+			}
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+		return res;
+	}
+
+	/**
+	 * Eval to string.
+	 *
+	 * @param exp the exp
+	 * @return the string[]
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public String[] evalToString(String exp) throws RWorkspaceException {
+		String[] res = null;
+		try {
+			res = eval(exp).asStrings();
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+		return res;
+	}
+
+	/**
+	 * Extract item from list by name.
+	 *
+	 * @param list the list
+	 * @param item_name the item_name
+	 * @return the rEXP
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public REXP extractItemFromListByName(REXP list, String item_name)
+			throws RWorkspaceException {
+		try {
+			return list.asList().at(item_name);
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(RCoreMessages.ERROR_EXTRACT_ITEM
+					+ e.getMessage()); 
+		}
+	}
+
+	/**
+	 * Extract item from list by name.
+	 *
+	 * @param list_symbol the list_symbol
+	 * @param item_name the item_name
+	 * @return the rEXP
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public REXP extractItemFromListByName(String list_symbol, String item_name)
+			throws RWorkspaceException {
+		return eval(list_symbol + RConstant.LIST_EXTRACTOR + item_name);
+	}
+
+	/**
+	 * Gets the connection.
+	 *
+	 * @return the connection
+	 */
+	public RConnection getConnection() {
+		return connection;
+	}
+
+	public StreamHog getErrorLogger() {
+		return errorLogger;
+	}
+
+	// --------------------------------------
+
+	/**
+	 * Gets the existing variable name.
+	 *
+	 * @return the existing variable name
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	private String[] getExistingVariableName() throws RWorkspaceException {
+		REXP res;
+		try {
+			res = connection.eval("ls()"); //$NON-NLS-1$
+		} catch (RserveException e) {
+			throw new RWorkspaceException(e);
+		}
+		try {
+			return res.asStrings();
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+	}
+
+	// --------------------------------------
+
+	public StreamHog getInputLogger() {
+		return inputLogger;
+	}
+
+	/**
+	 * Gets the last error line.
+	 *
+	 * @return the last error line
+	 */
+	public String getLastErrorLine() {
+		return this.errorLogger.lastline;
+	}
+
+	/**
+	 * Gets the last log line.
+	 *
+	 * @return the last log line
+	 */
+	public String getLastLogLine() {
+		return this.inputLogger.lastline;
+	}
+
+	/**
+	 * Initializes the R connection configuration (time out and proxy configuration, if needed). 
+	 * @param conf
+	 * @throws RserveException
+	 */
+	public void initializeRWorkspaceConnectionConfiguration(SystemProxyDetector conf) throws RserveException {
+		
+		// reduce time out
+		Log.warning("Setting R connection time out to 3 seconds.");
+		this.getConnection().eval("options(timeout = 3);"); //$NON-NLS-1$
+		
+		// configure the HTTP proxy
+		if (conf.isSystemProxyDetected()) {
+			String proxyUrl = conf.getHttpProxyUrl();
+			Log.warning("Setting R proxy configuration from system proxy configuration to: " + proxyUrl);
+			this.getConnection().eval("Sys.setenv(http_proxy=\"" + proxyUrl + "\")"); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+	}
+
+	/**
+	 * Checks if is logging.
+	 *
+	 * @return true, if is logging
+	 */
+	public boolean isLogging() {
+		// TODO Auto-generated method stub
+		return logging;
+	}
+
+	// --------------------------------------
+
+	/**
+	 * Make function call.
+	 *
+	 * @param functionName the function name
+	 * @param arguments the arguments
+	 * @return the string
+	 */
+	private String makeFunctionCall(String functionName, String[] arguments) {
+		StringBuffer sb = new StringBuffer();
+		sb.append(functionName);
+		sb.append(RConstant.OPEN_PAREN);
+		for (int i = 0; i < arguments.length; i++) {
+			sb.append(arguments[i]);
+			if ((i + 1) < arguments.length) {
+				sb.append(", "); //$NON-NLS-1$
+			}
+		}
+		sb.append(RConstant.CLOSE_PAREN);
+		return sb.toString();
+	}
+
+	@SuppressWarnings("rawtypes")
+	/**
+	 * Post configuration.
+	 *
+	 * @param rPackagesPath the r packages path
+	 * @return true, if successful
+	 */
+	public boolean postConfiguration(String rPackagesPath) {
+		// System.out.println("R post configuration");
+		try {
+			// more logs
+			connection.eval("try(options(max.print=5000))"); //$NON-NLS-1$
+
+			// set TXM R workspace directory
+			File RWorkspaceDirectory = new File(userdir, "R"); //$NON-NLS-1$
+			RWorkspaceDirectory.mkdir();
+			if (!RWorkspaceDirectory.exists()) {
+				System.out.println("TXM R workspace directory not found: "+RWorkspaceDirectory);
+			} else {
+				Log.warning("Setting TXM R workspace directory: "+RWorkspaceDirectory.getAbsolutePath());
+				connection.eval("setwd(\""+RWorkspaceDirectory.getAbsolutePath().replace("\\", "/")+"\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			}
+
+			File RLibrariesWorkspaceDirectory = new File(userdir, "R/libraries");
+			RLibrariesWorkspaceDirectory.mkdir();
+			if (!RLibrariesWorkspaceDirectory.exists()) {
+				System.out.println("TXM R libraries workspace directory not found: "+RLibrariesWorkspaceDirectory);
+			} else {
+				Log.warning("Setting TXM R libraries workspace directory: "+RLibrariesWorkspaceDirectory.getAbsolutePath());
+				connection.eval(".libPaths(c(\""+RLibrariesWorkspaceDirectory.getAbsolutePath().replace("\\", "/")+"\",.libPaths()))");//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			}
+
+			if (OSDetector.isFamilyWindows())	{
+				rPackagesPath = rPackagesPath.replace("\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+
+
+			// set proxy configuration using detected system proxy if exists
+			SystemProxyDetector conf = new SystemProxyDetector();
+			this.initializeRWorkspaceConnectionConfiguration(conf);
+
+			// load R libraries: this is now done by extensions/commands themself
+			try {
+				init(); // load libs
+			} catch (RWorkspaceException e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return false;
+			}
+
+			//connection.eval("try(.libPaths(\"" + rPackagesPath + "\"))"); //$NON-NLS-1$ //$NON-NLS-2$
+
+			return true;
+		} catch (RserveException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return false;
+	}
+
+	/**
+	 * Start logger.
+	 *
+	 * @param streamHog the stream hog
+	 * @param streamHog2 the stream hog2
+	 * @return the r workspace
+	 */
+	public RWorkspace registerLogger(StreamHog streamHog, StreamHog streamHog2) {
+		this.errorLogger = streamHog;
+		this.inputLogger = streamHog2;
+		return null;
+	}
+
+	/**
+	 * Remove a variable from the workspace. The content is lost, and the name
+	 * refers to nothing.
+	 *
+	 * @param variableName the variable name
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void removeVariableFromWorkspace(String variableName)
+			throws RWorkspaceException {
+		try {
+			connection.voidEval("rm(" + variableName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (RserveException e) {
+			throw new RWorkspaceException(e);
+		}
+		Log.finest("VARIABLE_REMOVED: " + new Object[] { variableName }); //$NON-NLS-1$
+	}
+
+	/**
+	 * Safe eval.
+	 *
+	 * @param expr the expr
+	 * @return the rEXP
+	 * @throws RserveException the rserve exception
+	 * @throws RException the r exception
+	 * @throws REXPMismatchException the rEXP mismatch exception
+	 */
+	public REXP safeEval(String expr) throws RserveException, RException,
+	REXPMismatchException {
+		if (logging && inputLogger != null ) inputLogger.printMessage(expr); //$NON-NLS-1$
+		lastSafeevalExpr = expr;
+		Log.finest("Reval: " + expr); //$NON-NLS-1$
+		REXP r = connection.eval("try({" + expr + "}, silent=TRUE)"); //$NON-NLS-1$ //$NON-NLS-2$
+		if (r !=null && r.inherits("try-error")) throw new RException(expr, r.asString()); //$NON-NLS-1$
+		return r;
+	}
+
+	/**
+	 * Sets the log.
+	 *
+	 * @param start the new log
+	 */
+	public void setLog(boolean start)
+	{
+		logging = start;
+		if (errorLogger != null)
+			this.errorLogger.setPrint(start);
+		if (inputLogger != null)
+			this.inputLogger.setPrint(start);
+	}
+
+	/**
+	 * Start logger.
+	 *
+	 * @param streamHog the stream hog
+	 * @param streamHog2 the stream hog2
+	 * @return the r workspace
+	 */
+	public RWorkspace stopLogger() {
+		this.errorLogger.stopLogging();
+		this.inputLogger.stopLogging();
+		return null;
+	}
+
+	/**
+	 * To txt.
+	 *
+	 * @param file the file
+	 * @param symbol the symbol
+	 * @throws StatException the stat exception
+	 */
+	public void toTxt(File file, String symbol) throws StatException {
+		eval("write.table(" + symbol + file.getAbsolutePath().replace("\\", "\\\\")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	}
+
+	/**
+	 * Bar delegate call to {@link Connection#voidEval(String)}.
+	 * 
+	 * It is up to the caller to check if everything goes well (testing if the
+	 * return value is not of type XT_NULL).
+	 *
+	 * @param exp the exp
+	 * @return the string
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public String userEval(String exp) throws RWorkspaceException {
+		if (exp.trim().length() == 0)
+			return ""; //$NON-NLS-1$
+		//if (loggin)
+		//System.out.println("R>"+exp); //$NON-NLS-1$
+
+		if (exp.endsWith(";")) //$NON-NLS-1$
+			exp = exp.substring(0, exp.length()-1);
+
+		//		String trybegin = "try("; //$NON-NLS-1$
+		//		String tryend = ")"; //$NON-NLS-1$
+
+		String out = null;
+		try {
+			//out = connection.eval("paste(capture.output(print(" + trybegin + trybegin +"("+ exp+")" + tryend + tryend + ")),collapse=\"\\n\")").asString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			//String cmd = "paste(capture.output(print(" + trybegin + "("+ exp+")" + tryend + ")),collapse=\"\\n\")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			Log.info("R eval: "+exp);
+			REXP ret = connection.eval(exp); 
+			//REXP ret = connection.eval(exp);
+
+			if (ret instanceof org.rosuda.REngine.REXPString) {
+				if (ret.isVector()) {
+					out =  "result: "+StringUtils.join(ret.asStrings(), ", ");
+				} else {
+					out =  "result: "+ret.asString();
+				} 
+			} else if (ret instanceof org.rosuda.REngine.REXPDouble) {
+				if (ret.isVector()) {
+					out = "result: "+ret.asDouble();
+				} else {
+					out =  "result: "+Arrays.toString(ret.asDoubles());
+				}
+			}  else if (ret instanceof org.rosuda.REngine.REXPInteger) {
+				if (ret.isVector()) {
+					out = "result: "+ret.asInteger();
+				} else {
+					out =  "result: "+Arrays.toString(ret.asIntegers());
+				}
+			} else if (ret instanceof org.rosuda.REngine.REXPNull) {
+				out =  "NULL";
+			} else {
+				out =  "result: "+ret;
+			}
+			
+		} catch (REXPMismatchException e) {
+			System.out.println("REXPMismatchException: "+e);
+			Log.printStackTrace(e);
+		} catch (RserveException e) {
+			System.out.println(RCoreMessages.RWorkspace_1 + e.getMessage()+" : "+exp);  //$NON-NLS-1$
+			Log.printStackTrace(e);
+		}
+
+		Log.finest("EVALUATED_EXPRESSION: " + exp ); //$NON-NLS-1$
+		return out;
+	}
+
+	/**
+	 * Bar delegate call to {@link Connection#voidEval(String)}.
+	 * 
+	 * It is up to the caller to check if everything goes well (testing if the
+	 * return value is not of type XT_NULL).
+	 *
+	 * @param exp the exp
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void voidEval(String exp) throws RWorkspaceException {
+
+		if (exp.endsWith(";")) //$NON-NLS-1$
+			exp = exp.substring(0, exp.length()-1);
+
+		//		String trybegin = "try("; //$NON-NLS-1$
+		//		String tryend = ")"; //$NON-NLS-1$
+
+		try {
+			safeEval(exp);
+		} catch (RserveException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (REXPMismatchException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+
+		Log.finest("EVALUATED_EXPRESSION: " + exp ); //$NON-NLS-1$
+	}
+	
+	
+	/**
+	 * Loads a package library from its name.
+	 * @param p
+	 * @throws RWorkspaceException
+	 */
+	public void loadPackage(String p) throws RWorkspaceException {
+		this.eval("library(\""+p+"\")"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RWorkspaceException.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RWorkspaceException.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RWorkspaceException.java	(revision 281)
@@ -0,0 +1,82 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (Mon, 06 May 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core.exceptions;
+
+import org.txm.statsengine.core.StatException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Super-class of all exception related to the R engine.
+ * 
+ * @author sloiseau
+ */
+public class RWorkspaceException extends StatException {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1630828823146927953L;
+
+	/**
+	 * Instantiates a new r workspace exception.
+	 */
+	public RWorkspaceException() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new r workspace exception.
+	 *
+	 * @param arg0 the arg0
+	 * @param arg1 the arg1
+	 */
+	public RWorkspaceException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new r workspace exception.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public RWorkspaceException(String arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new r workspace exception.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public RWorkspaceException(Throwable arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RWorkspaceException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RException.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RException.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RException.java	(revision 281)
@@ -0,0 +1,89 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (Mon, 06 May 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core.exceptions;
+
+import org.txm.statsengine.r.core.messages.RCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * An exception indicating an error during the evaluation of an expression by
+ * the R engine.
+ * 
+ * @author sloiseau
+ */
+public class RException extends RWorkspaceException {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = -3459835604570896478L;
+
+	/**
+	 * Instantiates a new r exception.
+	 */
+	public RException() {
+		super();
+	}
+
+	/**
+	 * Instantiates a new r exception.
+	 *
+	 * @param msg the msg
+	 */
+	public RException(String msg) {
+		super(msg);
+	}
+
+	/**
+	 * Instantiates a new r exception.
+	 *
+	 * @param expr the expr
+	 * @param msg the msg
+	 */
+	public RException(String expr, String msg) {
+		super(RCoreMessages.RException_0 + msg + RCoreMessages.RException_1 + RCoreMessages.RException_2 + expr); 
+	}
+
+	/**
+	 * Instantiates a new r exception.
+	 *
+	 * @param arg0 the arg0
+	 * @param arg1 the arg1
+	 */
+	public RException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+	}
+
+	/**
+	 * Instantiates a new r exception.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public RException(Throwable arg0) {
+		super(arg0);
+	}
+
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RObjectDoesNotExist.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RObjectDoesNotExist.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RObjectDoesNotExist.java	(revision 281)
@@ -0,0 +1,78 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (Mon, 06 May 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core.exceptions;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * Exception thrown if a symbol without corresponding object in the R workspace
+ * is used.
+ * 
+ * @author sloiseau
+ */
+public class RObjectDoesNotExist extends RWorkspaceException {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = -1344530765750521820L;
+
+	/**
+	 * Instantiates a new r object does not exist.
+	 */
+	public RObjectDoesNotExist() {
+		super();
+	}
+
+	/**
+	 * Instantiates a new r object does not exist.
+	 *
+	 * @param arg0 the arg0
+	 * @param arg1 the arg1
+	 */
+	public RObjectDoesNotExist(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+	}
+
+	/**
+	 * Instantiates a new r object does not exist.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public RObjectDoesNotExist(String arg0) {
+		super(arg0);
+	}
+
+	/**
+	 * Instantiates a new r object does not exist.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public RObjectDoesNotExist(Throwable arg0) {
+		super(arg0);
+	}
+
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RObjectDoesNotExist.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RServeException.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RServeException.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RServeException.java	(revision 281)
@@ -0,0 +1,79 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (Mon, 06 May 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core.exceptions;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class RServeException.
+ */
+public class RServeException extends RException {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * Instantiates a new r serve exception.
+	 */
+	public RServeException() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new r serve exception.
+	 *
+	 * @param arg0 the arg0
+	 * @param arg1 the arg1
+	 */
+	public RServeException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new r serve exception.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public RServeException(String arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new r serve exception.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public RServeException(Throwable arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RServeException.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RObjectAlreadyExist.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RObjectAlreadyExist.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RObjectAlreadyExist.java	(revision 281)
@@ -0,0 +1,78 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (Mon, 06 May 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core.exceptions;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * When one try to create an object with a symbol already existing in the
+ * workspace.
+ * 
+ * @author sloiseau
+ */
+public class RObjectAlreadyExist extends RWorkspaceException {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 3386015668080138287L;
+
+	/**
+	 * Instantiates a new r object already exist.
+	 */
+	public RObjectAlreadyExist() {
+		super();
+	}
+
+	/**
+	 * Instantiates a new r object already exist.
+	 *
+	 * @param arg0 the arg0
+	 * @param arg1 the arg1
+	 */
+	public RObjectAlreadyExist(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+	}
+
+	/**
+	 * Instantiates a new r object already exist.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public RObjectAlreadyExist(String arg0) {
+		super(arg0);
+	}
+
+	/**
+	 * Instantiates a new r object already exist.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public RObjectAlreadyExist(Throwable arg0) {
+		super(arg0);
+	}
+
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/exceptions/RObjectAlreadyExist.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/preferences/RPreferences.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/preferences/RPreferences.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/preferences/RPreferences.java	(revision 281)
@@ -0,0 +1,90 @@
+package org.txm.statsengine.r.core.preferences;
+
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.service.prefs.Preferences;
+import org.txm.core.preferences.TXMPreferences;
+
+/**
+ * Default preferences initializer.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class RPreferences extends TXMPreferences {
+
+
+	// auto populate the preference node qualifier from the current bundle id
+	public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(RPreferences.class).getSymbolicName();
+
+	
+	public static final String PREFERENCES_PREFIX = "r_"; //$NON-NLS-1$
+	
+	/** The Constant R_REMOTE. */
+	public static final String IS_MANDATORY = PREFERENCES_PREFIX + "is_mandatory"; //$NON-NLS-1$
+
+	/** The Constant R_PATH_TO_EXECUTABLE. */
+	public static final String PATH_TO_EXECUTABLE = PREFERENCES_PREFIX + "path_to_executable"; //$NON-NLS-1$
+
+	/** The Constant R_REMOTE. */
+	public static final String REMOTE = PREFERENCES_PREFIX + "remote"; //$NON-NLS-1$
+	public static final String DEBUG = PREFERENCES_PREFIX + "debug"; //$NON-NLS-1$
+
+	/** The Constant R_SERVER_ADDRESS. */
+	public static final String SERVER_ADDRESS = PREFERENCES_PREFIX + "server_address"; //$NON-NLS-1$
+
+	/** The Constant R_PORT. */
+	public static final String PORT = PREFERENCES_PREFIX + "port"; //$NON-NLS-1$
+
+	/** The Constant R_USER. */
+	public static final String USER = PREFERENCES_PREFIX + "user"; //$NON-NLS-1$
+
+	/** The Constant R_PASSWORD. */
+	public static final String PASSWORD = PREFERENCES_PREFIX + "password"; //$NON-NLS-1$
+
+	/** The Constant R_PACKAGES_PATH. */
+	public static final String PACKAGES_PATH = PREFERENCES_PREFIX + "packages_path"; //$NON-NLS-1$
+
+	public static final String RARGS = PREFERENCES_PREFIX + "rargs"; //$NON-NLS-1$
+	public static final String RSERVEARGS = PREFERENCES_PREFIX + "rserveargs"; //$NON-NLS-1$
+
+	/** The Constant R_DISABLE. */
+	public static final String DISABLE = PREFERENCES_PREFIX + "disable"; //$NON-NLS-1$
+
+	/** The Constant R_FILE_TRANSFERT. */
+	public static final String FILE_TRANSFERT = PREFERENCES_PREFIX + "file_transfert"; //$NON-NLS-1$
+	public static final String SVG_DEVICE = PREFERENCES_PREFIX + "svg_device"; //$NON-NLS-1$
+
+
+	
+
+	/**
+	 * 
+	 */
+	public RPreferences() {
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public void initializeDefaultPreferences() {
+		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
+		
+		preferences.putBoolean(IS_MANDATORY, false);
+		preferences.put(PATH_TO_EXECUTABLE, "");
+		preferences.put(SERVER_ADDRESS, "127.0.0.1");
+		preferences.putBoolean(REMOTE, false);
+		preferences.putBoolean(DISABLE, false);
+		preferences.putBoolean(DEBUG, false);
+		preferences.put(PORT, "6311");
+		preferences.put(USER, "");
+		preferences.put(PASSWORD, "");
+		preferences.put(RARGS, "");
+		preferences.put(RSERVEARGS, "");
+		preferences.putBoolean(FILE_TRANSFERT, false);
+		preferences.put(SVG_DEVICE, "svg");
+		
+	}
+	
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/preferences/RPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/ConnectToRserve.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/ConnectToRserve.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/ConnectToRserve.java	(revision 281)
@@ -0,0 +1,61 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.statsengine.r.core;
+import org.rosuda.REngine.REXP;
+import org.rosuda.REngine.RList;
+import org.rosuda.REngine.Rserve.RConnection;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ConnectToRserve.
+ */
+// not used? class of test?
+class ConnectToRserve {
+	
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String args[]) {
+		try {
+			RConnection c = new RConnection();
+			String userhome = System.getProperty("user.home"); //$NON-NLS-1$
+			RList ret = c.eval("source('"+userhome+"/Bureau/R/Rdata')").asList(); //$NON-NLS-1$ //$NON-NLS-2$
+			
+			System.out.println("source ret : "+ret.get(1)); //$NON-NLS-1$
+			System.out.println(ret);
+			
+			REXP ret2 = c.eval("print(lexicaltable)"); //$NON-NLS-1$
+			System.out.println("lexicaltable :"+ret2); //$NON-NLS-1$
+		}
+		catch(Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}
\ No newline at end of file

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/ConnectToRserve.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/rcolt/package.html
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/rcolt/package.html	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/rcolt/package.html	(revision 281)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Converting colt data structure into data structure suited for the R language (mainly vectorized version of matrix).</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/rcolt/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/rcolt/RColt.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/rcolt/RColt.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/rcolt/RColt.java	(revision 281)
@@ -0,0 +1,197 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (Mon, 06 May 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core.rcolt;
+
+import cern.colt.function.IntIntDoubleFunction;
+import cern.colt.matrix.DoubleMatrix2D;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Method for transformation of colt matrix into various array.
+ * 
+ * @author sloiseau
+ * 
+ */
+public final class RColt {
+
+	/**
+	 * Double matrix2 d2 int int array.
+	 *
+	 * @param matrix the matrix
+	 * @return the int[][]
+	 */
+	public final static int[][] doubleMatrix2D2IntIntArray(DoubleMatrix2D matrix) {
+		int rows = matrix.rows();
+		int columns = matrix.columns();
+		int[][] values = new int[rows][columns];
+		for (int row = rows; --row >= 0;) {
+			int[] currentRow = values[row];
+			for (int column = columns; --column >= 0;) {
+				currentRow[column] = (int) matrix.getQuick(row, column);
+			}
+		}
+		return values;
+		// final IntIntDoubleFunction fun = new CreateIntIntArray(matrix.rows(),
+		// matrix.columns());
+		// matrix.forEachNonZero(fun);
+		// return ((CreateIntIntArray)fun).getIntIntArray();
+	}
+
+	/**
+	 * Double matrix2 d2 double double array.
+	 *
+	 * @param matrix the matrix
+	 * @return the double[][]
+	 */
+	public final static double[][] doubleMatrix2D2DoubleDoubleArray(
+			DoubleMatrix2D matrix) {
+		matrix.trimToSize();
+		return matrix.toArray();
+	}
+
+	/*
+	 * public final static int[][] intMatrix2D2IntIntArray (IntMatrix2D matrix)
+	 * { matrix.trimToSize(); return matrix.toArray(); }
+	 */
+
+	/**
+	 * Transform a Colt {@link DoubleMatrix2D} into an array of <code>int</code>
+	 * .
+	 * 
+	 * The value of the matrix are stored by column (the values of the first
+	 * column, then the values of the second column, etc.)
+	 *
+	 * @param matrix the matrix
+	 * @return an array of <code>int</code>
+	 * @todo use {@link DoubleMatrix2D#trimToSize()} and
+	 * {@link DoubleMatrix2D#toArray()}
+	 */
+	public final static int[] doubleMatrix2D2IntArray(DoubleMatrix2D matrix) {
+		final IntIntDoubleFunction fun = new CreateIntArray(matrix.rows(),
+				matrix.columns());
+		matrix.forEachNonZero(fun);
+		return ((CreateIntArray) fun).getIntArray();
+	}
+
+	// public final static REXP DoubleMatrix2D2REXP(DoubleMatrix2D matrix,
+	// Rengine engine, String varName) {
+	// final IntIntDoubleFunction fun = new CreateIntIntArray(matrix.rows(),
+	// matrix.columns());
+	// matrix.forEachNonZero(fun);
+	// int[][] m = ((CreateIntIntArray)fun).getIntIntArray();
+	// engine.assign(varName, m);
+	// return ((CreateIntIntArray)fun).getIntIntArray();
+	// }
+
+	/**
+	 * The Class CreateIntIntArray.
+	 */
+	static class CreateIntIntArray implements IntIntDoubleFunction {
+
+		/** The array. */
+		private final int[][] array;
+
+		/**
+		 * Instantiates a new creates the int int array.
+		 *
+		 * @param rows the rows
+		 * @param columns the columns
+		 */
+		public CreateIntIntArray(int rows, int columns) {
+			array = new int[rows][columns];
+			for (int i = 0; i < array.length; i++) {
+				for (int j = 0; j < array[i].length; j++) {
+					array[i][j] = 0;
+				}
+			}
+		}
+
+		/* (non-Javadoc)
+		 * @see cern.colt.function.IntIntDoubleFunction#apply(int, int, double)
+		 */
+		@Override
+		public double apply(int row, int col, double value) {
+			array[row][col] = (int) value;
+			return value;
+		}
+
+		/**
+		 * Gets the int int array.
+		 *
+		 * @return the int int array
+		 */
+		public int[][] getIntIntArray() {
+			return array;
+		}
+	}
+
+	/**
+	 * The Class CreateIntArray.
+	 */
+	static class CreateIntArray implements IntIntDoubleFunction {
+
+		/** The array. */
+		private final int[] array;
+		
+		/** The rows. */
+		private final int rows;
+
+		/**
+		 * Instantiates a new creates the int array.
+		 *
+		 * @param rows the rows
+		 * @param columns the columns
+		 */
+		public CreateIntArray(int rows, int columns) {
+			array = new int[rows * columns];
+			for (int i = 0; i < array.length; i++) {
+				array[i] = 0;
+			}
+			this.rows = rows;
+		}
+
+		/* (non-Javadoc)
+		 * @see cern.colt.function.IntIntDoubleFunction#apply(int, int, double)
+		 */
+		@Override
+		public double apply(int row, int col, double value) {
+			array[(col * rows) + row] = (int) value;
+			return value;
+		}
+
+		/**
+		 * Gets the int array.
+		 *
+		 * @return the int array
+		 */
+		public int[] getIntArray() {
+			return array;
+		}
+	}
+
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/rcolt/RColt.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RserveWatcher.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RserveWatcher.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RserveWatcher.java	(revision 281)
@@ -0,0 +1,85 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.statsengine.r.core;
+
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+import org.txm.utils.Watcher;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class RserveWatcher.
+ */
+//FIXME: not used ?
+public class RserveWatcher extends Watcher	{
+
+	
+	/**
+	 * Instantiates a new rserve watcher.
+	 */
+	public RserveWatcher()
+	{
+		this.processname = "RSERVE"; //$NON-NLS-1$
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.Watcher#check()
+	 */
+	@Override
+	protected boolean check() {
+		RWorkspace rw;
+		try {
+			rw = RWorkspace.getRWorkspaceInstance();
+		} catch (RWorkspaceException e1) {
+			System.out.println("Rserve watcher encounter an error: "+e1); //$NON-NLS-1$
+			return false;
+		}
+		
+		if (rw == null)
+		{
+			return false;
+		}
+		else
+		{
+			try {
+				rw.eval("print(\"test\")"); //$NON-NLS-1$
+			} catch (Exception e) {
+				System.out.println("Rserve watcher encounter an error: "+e); //$NON-NLS-1$
+				return false;
+			}
+		}
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.Watcher#restart()
+	 */
+	@Override
+	protected boolean restart() {
+		return Toolbox.restartStatEngine(true);
+	}
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RserveWatcher.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/StartRserve.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/StartRserve.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/StartRserve.java	(revision 281)
@@ -0,0 +1,287 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2015-06-15 15:29:16 +0200 (Mon, 15 Jun 2015) $
+// $LastChangedRevision: 2989 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core;
+
+import java.io.File;
+
+import org.rosuda.REngine.Rserve.RConnection;
+import org.txm.statsengine.r.core.messages.RCoreMessages;
+import org.txm.utils.OSDetector;
+import org.txm.utils.StreamHog;
+import org.txm.utils.logger.Log;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Helper class that consumes output of a process. In addition, it filter output
+ * of the REG command on Windows to look for InstallPath registry entry which
+ * specif ies the location of R.
+ * 
+ * @author RServe library
+ */
+
+/**
+ * simple class that start Rserve locally if it's not running already - see
+ * mainly <code>checkLocalRserve</code> method. It spits out quite some
+ * debugging outout of the console, so feel free to modif y it for your
+ * application if desired.
+ * <p>
+ * <i>Important:</i> All applications should shutdown every Rserve that they
+ * started! Never leave Rserve running if you started it after your application
+ * quits since it may pose a security risk. Inform the user if you started an
+ * Rserve instance.
+ */
+public class StartRserve {
+
+	/** shortcut to <code>launchRserve(cmd, "--no-save --slave", "--no-save --slave", false)</code>. */
+	public static Process Rserveprocess;
+
+	/**
+	 * Launch rserve.
+	 *
+	 * @param cmd the cmd
+	 * @param options 
+	 * @return true, if successful
+	 */
+	protected static boolean launchRserve(String cmd, int port, boolean debug, String rArgs, String rServeArgs) {
+		if (new File(cmd).exists() && !new File(cmd).isDirectory()
+				&& new File(cmd).canExecute())
+			return launchRserve(cmd,
+					"--no-save --slave --encoding utf8 "+rArgs, "--RS-encoding utf8 --no-save --slave --encoding utf8 "+rServeArgs, port, debug); //$NON-NLS-1$ //$NON-NLS-2$
+		return false;
+	}
+
+	/**
+	 * attempt to start Rserve. Note: parameters are <b>not</b> quoted, so avoid
+	 * using any quotes in arguments
+	 *
+	 * @param cmd command necessary to start R
+	 * @param rargs arguments are are to be passed to R
+	 * @param rsrvargs arguments to be passed to Rserve
+	 * @param debug the debug
+	 * @return <code>true</code> if Rserve is running or was successfully
+	 * started, <code>false</code> otherwise.
+	 */
+	protected static boolean launchRserve(String cmd, String rargs,
+			String rsrvargs, int port, boolean debug) {
+		//System.out.println("LAUNCH R SERVER "+cmd+" "+port+" "+debug);
+		try {
+			String[] cmdline = null;
+			// FIXME: don't forget to remove this Window dedicated code if we manage to use http_proxy command line argument
+			boolean isWindows = false;
+			
+			// Windows OS
+			if (OSDetector.isFamilyWindows()) {
+				isWindows = true; /* Windows startup */
+				
+				
+				// TODO: old tests for setting proxy in R
+				//Windows : set --internet2 option to manage proxy if any
+				
+//				// set Proxy configuration using Eclipse RCP stored values
+//				String proxy_conf = "";
+//				ProxyConf conf = new ProxyConf(RWorkspace.getRWorkspaceInstance());
+//				if (conf.mustSetProxyConfiguration()) {
+//					proxy_conf = "http_proxy="+conf.getHttpProxyUrl();
+//					rsrvargs += " "+proxy_conf; // add the http_proxy parameter
+//					Log.info("Run Rserve with proxy configuration: "+proxy_conf);
+//				}
+				
+				cmdline = new String[] {
+						cmd,
+						rargs, 
+						"-e", //$NON-NLS-1$
+						"library(Rserve);Rserve(" //$NON-NLS-1$ 
+						+ (debug ? "TRUE" : "FALSE")  //$NON-NLS-1$ //$NON-NLS-2$
+						+ ",port=" + port + "" //$NON-NLS-1$ //$NON-NLS-2$
+						+ ",args='" //$NON-NLS-1$
+						+ rsrvargs + "')\" " //$NON-NLS-1$
+				};	
+			}
+			// Mac, Linux
+			else {
+				cmdline = new String[] {
+						"/bin/sh", //$NON-NLS-1$
+						"-c", //$NON-NLS-1$
+						"echo 'library(Rserve);Rserve(" //$NON-NLS-1$
+						+ (debug ? "TRUE" : "FALSE") //$NON-NLS-1$ //$NON-NLS-2$
+						+ ",port="+port+"" //$NON-NLS-1$ //$NON-NLS-2$
+						+ ",args=\"" + rsrvargs //$NON-NLS-1$
+						+ "\")'|" + cmd //$NON-NLS-1$ 
+						+ " " + rargs }; //$NON-NLS-1$
+			}
+
+//			ProcessBuilder builder = new ProcessBuilder(cmdline);
+//			Rserveprocess = builder.start();
+
+			Runtime runtime = Runtime.getRuntime();
+			Rserveprocess = runtime.exec(cmdline);
+			
+			//Log.info(Messages.StartRserve_0+Arrays.toString(cmdline));
+			StreamHog errStream = new StreamHog(Rserveprocess.getErrorStream(), debug);
+			StreamHog inStream = new StreamHog(Rserveprocess.getInputStream(), debug);
+			RWorkspace.getRWorkspaceInstance().registerLogger(errStream, inStream);
+
+			if (!debug && !isWindows)
+				Rserveprocess.waitFor();
+			// System.out.println("call terminated, let us try to connect ...");
+		} catch (Exception x) {
+			System.err.println(RCoreMessages.StartRserve_21 + x.getMessage());
+			return false;
+		}
+
+		System.err.print(RCoreMessages.StartRserve_22);
+
+		try {
+			Thread.sleep(200);
+		} catch (InterruptedException ix) { }
+
+		int attempts = 20;
+		while (attempts > 0) {
+			try {
+				System.out.print("."); //$NON-NLS-1$
+				RConnection c = new RConnection("127.0.0.1", port); //$NON-NLS-1$
+				c.close();
+				return true;
+			} catch (Exception e2) {
+				try {
+					Thread.sleep(2000);
+				} catch (InterruptedException ix) { }
+			}
+
+			attempts--;
+		}
+		System.out.println(""); //$NON-NLS-1$
+		return false;
+	}
+
+	/**
+	 * checks whether Rserve is running and if that's not the case it attempts
+	 * to start it using the defaults for the platform where it is run on. This
+	 * method is meant to be set-and-forget and cover most default setups. For
+	 * special setups you may get more control over R with <
+	 * <code>launchRserve</code> instead.
+	 * @param rServeArgs 
+	 * @param rargs 
+	 *
+	 * @return true, if successful
+	 */
+	protected static boolean checkLocalRserve(int port, boolean debug, String rargs, String rServeArgs) {
+		Log.info(RCoreMessages.StartRserve_2);
+		if (isRserveRunning(port)) {
+			Log.info(RCoreMessages.StartRserve_3+port);
+			return true;
+		}
+		// Windows OS
+		if (OSDetector.isFamilyWindows()) {
+			// System.out.println("Windows: query registry to find where R is installed ...");
+			String installPath = null;
+			try {
+				Process rp = Runtime.getRuntime().exec(
+						"reg query HKLM\\Software\\R-core\\R"); //$NON-NLS-1$
+				StreamHog regHog = new StreamHog(rp.getInputStream(), true);
+				rp.waitFor();
+				regHog.join();
+				installPath = regHog.getInstallPath();
+			} catch (Exception rge) {
+				System.err.println(RCoreMessages.StartRserve_28 + rge);
+				return false;
+			}
+			if (installPath == null) {
+				System.err.println(RCoreMessages.StartRserve_29);
+				return false;
+			}
+			// System.out.println(" Found R in : "+installPath +
+			// "\\bin\\R.exe");
+			return launchRserve(installPath + "\\bin\\R.exe", port, debug, rargs, rServeArgs); //$NON-NLS-1$
+		}
+
+		Log.info(RCoreMessages.StartRserve_4);
+		if (launchRserve("R", port, debug, rargs, rServeArgs)) return true; //$NON-NLS-1$
+
+		// R not in the PATH env, try with R common paths
+		String[] paths = {
+				"/Library/Frameworks/R.framework/Resources/bin/R", //$NON-NLS-1$
+				"/usr/local/lib/R/bin/R", //$NON-NLS-1$
+				"/usr/lib/R/bin/R", //$NON-NLS-1$
+				"/sw/bin/R", //$NON-NLS-1$
+				"/usr/common/bin/R", //$NON-NLS-1$
+		"/opt/bin/R" }; //$NON-NLS-1$
+		for (String path : paths) {
+			Log.info(RCoreMessages.StartRserve_6+path);
+			if (new File(path).exists() && launchRserve(path, port, debug, rargs, rServeArgs)) return true;
+		}
+
+		return false;
+		//			
+		//		return (launchRserve("R", port, debug) //$NON-NLS-1$
+		//				|| /* try some common unix locations of R */
+		//				(( && launchRserve("/Library/Frameworks/R.framework/Resources/bin/R", port, debug)) //$NON-NLS-1$
+		//				|| ((new File("/usr/local/lib/R/bin/R")).exists() && launchRserve("/usr/local/lib/R/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
+		//				|| ((new File("/usr/lib/R/bin/R")).exists() && launchRserve("/usr/lib/R/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
+		//				|| ((new File("/usr/local/bin/R")).exists() && launchRserve("/usr/local/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
+		//				|| ((new File("/sw/bin/R")).exists() && launchRserve("/sw/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
+		//				|| ((new File("/usr/common/bin/R")).exists() && launchRserve("/usr/common/bin/R")) || ((new File( //$NON-NLS-1$ //$NON-NLS-2$
+		//				"/opt/bin/R")).exists() && launchRserve("/opt/bin/R"))); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * check whether Rserve is currently running (on local machine and default
+	 * port).
+	 * 
+	 * @return <code>true</code> if local Rserve instance is running,
+	 *         <code>false</code> otherwise
+	 */
+	protected static boolean isRserveRunning(int port) {
+		try {
+			new RConnection("127.0.0.1", port); //$NON-NLS-1$
+			// System.out.println("Rserve is running.");
+			// c.close();
+			return true;
+		} catch (Exception e) {
+			// System.out.println("First connect try failed with: "+
+			// e.getMessage());
+		}
+		return false;
+	}
+
+
+	public static void main(String[] args) {
+		System.out.println("result=" + checkLocalRserve(8212, false, "", ""));
+		try {
+			System.out.println("Start RServe");
+			RConnection c = new RConnection("localhost", 8212);
+			System.out.println("Stop RServe");
+			c.eval("print(1+1)");
+			c.eval("2+2");
+			c.shutdown();
+			System.out.println("Done");
+		} catch (Exception x) {
+			x.printStackTrace();
+		}
+	}
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/StartRserve.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RStatsEngine.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RStatsEngine.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RStatsEngine.java	(revision 281)
@@ -0,0 +1,181 @@
+package org.txm.statsengine.r.core;
+
+import java.io.IOException;
+
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+import org.txm.statsengine.r.core.messages.RCoreMessages;
+import org.txm.statsengine.r.core.preferences.RPreferences;
+import org.txm.utils.OSDetector;
+import org.txm.utils.logger.Log;
+
+/**
+ * R statistics engine. Contains methods to start, stop, kill, etc. the R and RServe process.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class RStatsEngine {
+
+	
+	/** The state of the stats engine. */
+	private static boolean started = false;
+	
+	
+	private static boolean mandatory = false;
+
+	
+	private RStatsEngine() {
+		// no instantiation
+	}
+
+	
+	/**
+	 * start the statengine if the engine is not remote then launch Rserve.
+	 *
+	 * @return true, if successful
+	 */
+	public static boolean start() {
+		try {
+			
+			if (TXMPreferences.getBoolean(RPreferences.PREFERENCES_NODE, RPreferences.DISABLE)) {
+				System.err.println("Warning, Statistics Engine is disabled.");
+				return false;
+			}
+			
+			Log.warning("Starting Statistics Engine.");
+
+			// try launching R server and connecting to it
+			int port = TXMPreferences.getInt(RPreferences.PREFERENCES_NODE, RPreferences.PORT);
+			String user = TXMPreferences.getString(RPreferences.PREFERENCES_NODE, RPreferences.USER);
+			String password = TXMPreferences.getString(RPreferences.PREFERENCES_NODE, RPreferences.PASSWORD);
+			boolean remote = TXMPreferences.getBoolean(RPreferences.PREFERENCES_NODE, RPreferences.REMOTE);
+			boolean debug = TXMPreferences.getBoolean(RPreferences.PREFERENCES_NODE, RPreferences.DEBUG);
+			mandatory = TXMPreferences.getBoolean(RPreferences.PREFERENCES_NODE, RPreferences.IS_MANDATORY);
+
+			
+			Log.info(RCoreMessages.Log_STARTING_STATS_ENGINE + user + RCoreMessages.Log_REMOTE + remote + RCoreMessages.Log_PORT + port + RCoreMessages.Log_DEBUG + debug);
+			// System.out.println("test remote :" + R_PATH_TO_EXECUTABLE + ":" + properties.getProperty(R_PATH_TO_EXECUTABLE));
+			if (!remote) {
+				// start Rserve executable
+				started = RWorkspace.startExec(
+						TXMPreferences.getString(RPreferences.PREFERENCES_NODE, RPreferences.PATH_TO_EXECUTABLE), 
+						port, 
+						debug, 
+						TXMPreferences.getString(RPreferences.PREFERENCES_NODE, RPreferences.RARGS),
+						TXMPreferences.getString(RPreferences.PREFERENCES_NODE, RPreferences.RSERVEARGS));
+
+				if (started) { // try connecting to R witout login
+					started = RWorkspace.connect("127.0.0.1", port); //$NON-NLS-1$
+				}
+			} else { // try connecting to R, with login and password
+				started = RWorkspace.connect(TXMPreferences.getString(RPreferences.PREFERENCES_NODE, RPreferences.SERVER_ADDRESS), port, user, password);
+			}
+
+			if (started) { // post configuration of R
+				String rPackagesPath = TXMPreferences.getString(RPreferences.PREFERENCES_NODE, RPreferences.PACKAGES_PATH);
+				started = RWorkspace.getRWorkspaceInstance().postConfiguration(rPackagesPath);
+			}
+
+			//System.out.println("try to set R_FILE_TRANSFERT to " + TXMPreferences.getBoolean(RPreferences.PREFERENCES_NODE, RPreferences.R_FILE_TRANSFERT));
+			RWorkspace.setUseFileCommunication(TXMPreferences.getBoolean(RPreferences.PREFERENCES_NODE, RPreferences.FILE_TRANSFERT));
+			//	System.out.println("success");
+			//System.out.println("file transfert ? "+RWorkspace.isFileTranfert());
+		} catch (RWorkspaceException e) {
+			System.err.println(RCoreMessages.Error_CONNECTION_FAILED_2); 
+			started = false;
+		}
+
+		return started;
+	}
+
+	
+	/**
+	 * kill Rserve process.
+	 */
+	public static void kill() {
+		if (!TXMPreferences.getBoolean(RPreferences.PREFERENCES_NODE, RPreferences.REMOTE))	{
+			// Windows OS
+			if (OSDetector.isFamilyWindows()) {
+				try {
+					Process p = Runtime.getRuntime().exec(
+							//"taskkill /IM Rserve.exe /F"); //$NON-NLS-1$
+							"cmd /c FOR /F \"tokens=5 delims= \" %P IN ('netstat -ano ^| findstr :6330 ^| findstr LISTENING') DO taskkill /F /PID %P"); //$NON-NLS-1$
+
+					p.waitFor();
+					started = false;
+				} catch (IOException e) {
+					Log.severe(RCoreMessages.Error_FAILED_TO_KILL_RSERVE+Log.toString(e));
+					System.out.println(RCoreMessages.Error_FAILED_TO_KILL_RSERVE+Log.toString(e));
+					try {
+						Process p = Runtime.getRuntime().exec(
+								//"tskill Rserve.exe"); //$NON-NLS-1$
+								"cmd /c FOR /F \"tokens=5 delims= \" %P IN ('netstat -ano ^| findstr :6330 ^| findstr LISTENING') DO tskill %P"); //$NON-NLS-1$
+						p.waitFor();
+						started = false;
+					} catch (IOException e2) {
+						Log.severe(RCoreMessages.Error_FAILED_TO_KILL_RSERVE_2+Log.toString(e2));
+						System.out.println(RCoreMessages.Error_FAILED_TO_KILL_RSERVE_2+Log.toString(e2));
+						Log.printStackTrace(e2);
+					} catch (InterruptedException e3) {
+						Log.severe(Log.toString(e3));
+						System.out.println(Log.toString(e3));
+						org.txm.utils.logger.Log.printStackTrace(e3);
+					}
+				} catch (InterruptedException e) {
+					Log.severe("Error while closing R: " + e.getLocalizedMessage());
+					System.out.println(Log.toString(e));
+					org.txm.utils.logger.Log.printStackTrace(e);
+				}
+			}
+			// Mac, Linux
+			else {
+				try {
+					Process p = Runtime.getRuntime().exec(
+							"kill -9 `lsof -t -a -c Rserve-bin.so -i : " + TXMPreferences.getInt(RPreferences.PREFERENCES_NODE, RPreferences.PORT) + "`"); //$NON-NLS-1$ //$NON-NLS-2$
+					p.waitFor();
+					started = false;
+				} catch (IOException e) {
+					Log.severe(RCoreMessages.Error_FAILED_TO_KILL_RSERVE_3 + Log.toString(e));
+					System.out.println(RCoreMessages.Error_FAILED_TO_KILL_RSERVE_3 + Log.toString(e));
+					org.txm.utils.logger.Log.printStackTrace(e);
+				} catch (InterruptedException e) {
+					Log.severe("Error while closing R: " + e.getLocalizedMessage());
+					System.out.println(Log.toString(e));
+					org.txm.utils.logger.Log.printStackTrace(e);
+				}
+			}
+		}
+	}
+	
+	
+	/**
+	 * Shut the stats engine down.
+	 */
+	public static void shutdown() {
+		try {
+			RWorkspace.shutdown();
+			RStatsEngine.kill();
+			started = false;
+		} catch (Exception e) {
+			Log.severe("Error while closing R: " + e.getLocalizedMessage());
+		}
+	}
+	
+	/**
+	 * Retuns the running state of the stats engine.
+	 */
+	public static boolean isStarted()	{
+		return started;
+	}
+
+
+	/**
+	 * @return the mandatory
+	 */
+	public static boolean isMandatory() {
+		return mandatory;
+	}
+	
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RStatsEngine.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RFileCommunication.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RFileCommunication.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RFileCommunication.java	(revision 281)
@@ -0,0 +1,313 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2015-05-22 09:06:15 +0200 (Fri, 22 May 2015) $
+// $LastChangedRevision: 2973 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+import org.txm.utils.OSDetector;
+
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class RFileCommunication.
+ */
+public class RFileCommunication {
+	
+	/** The transfertfile. */
+	File transfertfile;
+	
+	/** The transfertfilepath. */
+	String transfertfilepath;
+
+	/**
+	 * Instantiates a new r file communication.
+	 *
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public RFileCommunication() throws IOException
+	{
+		createTempFile();
+
+	}
+
+	/**
+	 * Creates the temp file.
+	 *
+	 * @throws IOException Signals that an I/O exception has occurred.
+	 */
+	public void createTempFile() throws IOException
+	{
+		transfertfile = File.createTempFile("Rtransfert","file"); //$NON-NLS-1$ //$NON-NLS-2$
+		//transfertfile = new File("~/Bureau/RTRANSFERT.txt");
+		transfertfilepath = transfertfile.getAbsolutePath();
+		if (OSDetector.isFamilyWindows()) //$NON-NLS-1$ //$NON-NLS-2$
+		{
+			//System.out.println("patch path");
+			transfertfilepath = transfertfilepath.replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		//System.out.println("Transfert file: "+transfertfilepath);
+	}
+
+	/**
+	 * Assign.
+	 *
+	 * @param variablename the variablename
+	 * @param matrix the matrix
+	 * @param nrow the nrow
+	 * @param ncol the ncol
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void assign(String variablename, int[] matrix, int nrow, int ncol) throws RWorkspaceException
+	{
+		writeVector(matrix);
+		RWorkspace.getRWorkspaceInstance().eval("source(\""+transfertfilepath+"\");"); //$NON-NLS-1$ //$NON-NLS-2$
+		RWorkspace.getRWorkspaceInstance().eval(variablename+" <- matrix(vectorint, nrow="+nrow+", ncol="+ncol+", byrow=T);"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	}
+
+	/**
+	 * Assign.
+	 *
+	 * @param variablename the variablename
+	 * @param matrix the matrix
+	 * @param nrow the nrow
+	 * @param ncol the ncol
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void assign(String variablename, double[] matrix, int nrow, int ncol) throws RWorkspaceException
+	{
+		writeVector(matrix);
+		RWorkspace.getRWorkspaceInstance().eval("source(\""+transfertfilepath+"\");"); //$NON-NLS-1$ //$NON-NLS-2$
+		RWorkspace.getRWorkspaceInstance().eval(variablename+" <- matrix(vectordouble, nrow="+nrow+", ncol="+ncol+", byrow=T);"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	}
+
+	/**
+	 * Assign.
+	 *
+	 * @param variablename the variablename
+	 * @param vector the vector
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void assign(String variablename, int[] vector) throws RWorkspaceException
+	{
+		//System.out.println("assign vector "+variablename+" size "+vector.length);
+		writeVector(vector);
+		RWorkspace.getRWorkspaceInstance().eval("source(\""+transfertfilepath+"\");"); //$NON-NLS-1$ //$NON-NLS-2$
+		RWorkspace.getRWorkspaceInstance().eval(variablename+" <- vectorint;"); //$NON-NLS-1$
+	}
+
+	/**
+	 * Assign.
+	 *
+	 * @param variablename the variablename
+	 * @param vector the vector
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void assign(String variablename, double[] vector) throws RWorkspaceException
+	{
+		//System.out.println("assign vector "+variablename+" size "+vector.length);
+		writeVector(vector);
+		RWorkspace.getRWorkspaceInstance().eval("source(\""+transfertfilepath+"\");"); //$NON-NLS-1$ //$NON-NLS-2$
+		RWorkspace.getRWorkspaceInstance().eval(variablename+" <- vectordouble;"); //$NON-NLS-1$
+		
+	}
+
+	/**
+	 * Assign.
+	 *
+	 * @param variablename the variablename
+	 * @param vector the vector
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void assign(String variablename, String[] vector) throws RWorkspaceException
+	{
+		//System.out.println("assign vector "+variablename+" size "+vector.length);
+		writeVector(vector);
+		RWorkspace.getRWorkspaceInstance().eval("source(\""+transfertfilepath+"\");"); //$NON-NLS-1$ //$NON-NLS-2$
+		RWorkspace.getRWorkspaceInstance().eval(variablename+" <- vectorstr;"); //$NON-NLS-1$
+	}
+
+	/*
+	public boolean writeMatrix(int[][] matrix)
+	{
+		//System.out.println("WRITE MATRIX");
+		try {
+			BufferedWriter writer = new BufferedWriter(new FileWriter(transfertfilepath));
+			for(int i = 0 ; i < matrix.length ; i++)
+			{
+				StringBuffer str = new StringBuffer();
+				for(int j = 0 ; j < matrix[i].length ; j++)
+					if (j == matrix[i].length -1)
+						str.append(matrix[i][j]);
+					else
+						str.append(""+matrix[i][j]+"\t");
+				writer.write(str.toString()+"\n");
+			}
+			writer.close();
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	public boolean writeMatrix(double[][] matrix)
+	{
+		//System.out.println("WRITE MATRIX");
+		try {
+			BufferedWriter writer = new BufferedWriter(new FileWriter(transfertfilepath));
+			for(int i = 0 ; i < matrix.length ; i++)
+			{
+				StringBuffer str = new StringBuffer();
+				for(int j = 0 ; j < matrix[i].length ; j++)
+					if (j == matrix[i].length -1)
+						str.append(matrix[i][j]);
+					else
+						str.append(""+matrix[i][j]+"\t");
+				writer.write(str.toString()+"\n");
+			}
+			writer.close();
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+*/
+	/**
+	 * Write vector.
+	 *
+	 * @param vector the vector
+	 * @return true, if successful
+	 */
+	private boolean writeVector(String[] vector) {
+		//System.out.println("WRITE VECTOR");
+		try {
+			BufferedWriter writer = new BufferedWriter(new FileWriter(transfertfilepath));
+
+			StringBuffer str = new StringBuffer();
+			str.append("vectorstr <- c("); //$NON-NLS-1$
+			for(int j = 0 ; j < vector.length ; j++)
+				if (j == vector.length -1)
+					str.append("\""+vector[j]+"\""); //$NON-NLS-1$ //$NON-NLS-2$
+				else
+					str.append("\""+vector[j]+"\", "); //$NON-NLS-1$ //$NON-NLS-2$
+			str.append(");"); //$NON-NLS-1$
+			writer.write(str.toString());
+
+			writer.close();
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Write vector.
+	 *
+	 * @param vector the vector
+	 * @return true, if successful
+	 */
+	public boolean writeVector(int[] vector)
+	{
+		//System.out.println("WRITE VECTOR");
+		try {
+			BufferedWriter writer = new BufferedWriter(new FileWriter(transfertfilepath));
+
+			StringBuffer str = new StringBuffer();
+			str.append("vectorint <- as.integer(c("); //$NON-NLS-1$
+			for(int j = 0 ; j < vector.length ; j++)
+				if (j == vector.length -1)
+					str.append(vector[j]);
+				else
+					str.append(""+vector[j]+", "); //$NON-NLS-1$ //$NON-NLS-2$
+			str.append("));"); //$NON-NLS-1$
+			writer.write(str.toString());
+			writer.close();
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Write vector.
+	 *
+	 * @param vector the vector
+	 * @return true, if successful
+	 */
+	public boolean writeVector(double[] vector)
+	{
+		//System.out.println("WRITE VECTOR");
+		try {
+			BufferedWriter writer = new BufferedWriter(new FileWriter(transfertfilepath));
+
+			StringBuffer str = new StringBuffer();
+			str.append("vectordouble <- c("); //$NON-NLS-1$
+			for(int j = 0 ; j < vector.length ; j++)
+			{
+				if (j == vector.length -1)
+					str.append(vector[j]);
+				else
+					str.append(""+vector[j]+", "); //$NON-NLS-1$ //$NON-NLS-2$
+			}
+			str.append(");"); //$NON-NLS-1$
+			writer.write(str.toString());
+			writer.close();
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args the arguments
+	 */
+	public static void main(String[] args)
+	{
+		double[][] matrix ={{1,2,3}, {4,5,6}, {7,8,9}};
+		RFileCommunication comm;
+		try {
+			comm = new RFileCommunication();
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return;
+		}
+
+		//comm.writeMatrix(matrix);
+	}
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RFileCommunication.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/RCoreMessages.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/RCoreMessages.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/RCoreMessages.java	(revision 281)
@@ -0,0 +1,75 @@
+package org.txm.statsengine.r.core.messages;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.messages.Utf8NLS;
+
+public class RCoreMessages extends NLS {
+
+	private static final String BUNDLE_NAME = "org.txm.statsengine.r.core.messages.messages"; //$NON-NLS-1$
+
+	
+	public static String Error_STATS_ENGINE_NOT_READY_CANCELING_COMMAND;
+	
+	public static String Log_STARTING_STATS_ENGINE;
+	public static String Log_REMOTE;
+	public static String Log_PORT;
+	public static String Log_DEBUG;
+
+	public static String Error_CONNECTION_FAILED_2;
+	public static String Error_FAILED_TO_KILL_RSERVE;
+	public static String Error_FAILED_TO_KILL_RSERVE_2;
+	public static String Error_FAILED_TO_KILL_RSERVE_3;
+
+	public static String StartRserve_2;
+	public static String StartRserve_21;
+	public static String StartRserve_22;
+	public static String StartRserve_28;
+	public static String StartRserve_29;
+	public static String StartRserve_3;
+	public static String StartRserve_4;
+	public static String StartRserve_6;
+
+	public static String RWorkspace_0;
+	public static String RWorkspace_1;
+	public static String RWorkspace_10;
+	public static String RWorkspace_11;
+	public static String RWorkspace_2;
+	public static String RWorkspace_3;
+	public static String RWorkspace_6;
+	public static String RWorkspace_7;
+	public static String RWorkspace_8;
+
+	public static String LIBRARY_NOT_LOADED;
+
+	public static String RException_0;
+	public static String RException_1;
+	public static String RException_2;
+
+	public static String RSERVE_PATH_NOT_SET_ERROR;
+	public static String RSERVE_PATH_SET_ERROR;
+	public static String CONNECTED_TO_STATS_MODULE;
+	public static String CHAR_VECTOR_ADDED_TO_WORKSPACE;
+	public static String CONNECTION_OK;
+	public static String ERROR_EXTRACT_ITEM;
+	public static String REQUESTED_OBJECT_NOT_FOUND_IN_R;
+
+
+	// FIXME: unused keys
+	public static String StartRserve_0;
+	public static String RWorkspace_21;
+	public static String RSERVE_ACTIVATED;
+	public static String R_EXPR;
+	public static String R_READ_CONSOLE;
+	public static String R_SAVE_HISTORY;
+	public static String R_SHOW_MESSAGE;
+	public static String R_WRITE_CONSOLE;
+	//end of fixme
+	
+	static {
+		// initialize resource bundle
+		Utf8NLS.initializeMessages(BUNDLE_NAME, RCoreMessages.class);
+	}
+
+	private RCoreMessages() {
+	}
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/RCoreMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages.properties
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages.properties	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages.properties	(revision 281)
@@ -0,0 +1,57 @@
+
+Error_CONNECTION_FAILED_2                      = ** Error while connecting to the stat engine.
+Error_FAILED_TO_KILL_RSERVE                    = Failed to exec 'taskkill /IM Rserve.exe /F': 
+Error_FAILED_TO_KILL_RSERVE_2                  = Failed to exec 'tskill Rserve.exe': 
+Error_FAILED_TO_KILL_RSERVE_3                  = Failed to exec 'killall -9 Rserve-bin.so': 
+Error_STATS_ENGINE_NOT_READY_CANCELING_COMMAND = Statistics Engine is not ready, canceling command.
+
+LIBRARY_NOT_LOADED = Failed to load the {0} library: {1}
+
+Log_DEBUG                 = debug:
+Log_PORT                  = \ port: 
+Log_REMOTE                = \ remote:
+Log_STARTING_STATS_ENGINE = Starting Statistics Engine: user: 
+
+RException_0 = ** R error: "
+RException_1 = "
+RException_2 = \nwhile evaluating: 
+
+RSERVE_ACTIVATED          = Statistics Engine running 
+RSERVE_PATH_NOT_SET_ERROR = ** The Statistics Engine program path is not set and we could not find it
+RSERVE_PATH_SET_ERROR     = ** The Statistics Engine program path is set but we couldn't find it
+
+RWorkspace_0  = ** Failed to connect to the R Workspace 
+RWorkspace_1  = ** Evaluation Error: 
+RWorkspace_10 = Starting R using path: 
+RWorkspace_11 = Last safeeval: 
+RWorkspace_2  = try : connect to R at 
+RWorkspace_21 = Full command: 
+RWorkspace_3  = Saving graphic in file 
+RWorkspace_6  = ** Failed to initialize file transfert: 
+RWorkspace_7  = Matrix is empty
+RWorkspace_8  = Failed to start RServe : 
+
+R_EXPR                    = Expression sent to the Statistics Engine for evaluation: {0}.
+R_READ_CONSOLE            = The Statistics Engine waits for something to read from the console ({0}, {1}).
+R_SAVE_HISTORY            = The Statistics Engine has saved an history ({0}).
+R_SHOW_MESSAGE            = The Statistics Engine displayed this message: {0}.
+R_WRITE_CONSOLE           = The Statistics Engine displayed this message in the console: {0}.
+
+StartRserve_0  = Starting R with command line: 
+StartRserve_2  = No R path given, trying to find it...
+StartRserve_21 = ** Failed to start Rserve with command: 
+StartRserve_22 = Statistical Engine launched
+StartRserve_28 = ** Failed to run REG to find the location of R program: 
+StartRserve_29 = \ You need the 'R' software and you need to configure in the 'Tools/Preferences' window the correct path to it.
+StartRserve_3  = Rserve already running on port 
+StartRserve_4  = try R path : 'R'
+StartRserve_6  = try R path : 
+
+
+CHAR_VECTOR_ADDED_TO_WORKSPACE = Vector "{1}" ({0,number,integer} "character") has been transmited to the Statistics Engine.
+CONNECTED_TO_STATS_MODULE = connected.
+CONNECTION_OK = Connected to the Statistics Engine.
+
+ERROR_EXTRACT_ITEM = ** Error extracting list item: 
+
+REQUESTED_OBJECT_NOT_FOUND_IN_R = The requested object ({0}) was not found in the R workspace.

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages_ru.properties
===================================================================

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages_ru.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages_fr.properties
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages_fr.properties	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages_fr.properties	(revision 281)
@@ -0,0 +1,58 @@
+
+Error_CONNECTION_FAILED_2                      = ** La connexion au moteur statistique a échoué.
+Error_FAILED_TO_KILL_RSERVE                    = Echec de la commande 'taskkill /IM Rserve.exe /F': 
+Error_FAILED_TO_KILL_RSERVE_2                  = Echec de la commande 'tskill Rserve.exe': 
+Error_FAILED_TO_KILL_RSERVE_3                  = Echec de la commande 'killall -9 Rserve-bin.so': 
+Error_STATS_ENGINE_NOT_READY_CANCELING_COMMAND = Le moteur de statistiques n'est pas initialisé, annulation de la commande.
+
+LIBRARY_NOT_LOADED = La librairie {0} n''a pu être chargée : {1}
+
+Log_DEBUG                 = debug : 
+Log_PORT                  = \ port : 
+Log_REMOTE                = \ distant : 
+Log_STARTING_STATS_ENGINE = Démarrage du moteur de statistiques par l'utilisateur :
+
+RException_0 = ** Erreur R : "
+RException_1 = "
+RException_2 = \n lors de l'évaluation de :
+
+RSERVE_ACTIVATED          = Moteur Statistique lancé 
+RSERVE_PATH_NOT_SET_ERROR = ** Le chemin du programme du serveur statistique n'a pas été renseigné et sa recherche a échoué
+RSERVE_PATH_SET_ERROR     = ** Le chemin du programme du serveur statistique a été renseigné mais sa recherche a échoué
+
+RWorkspace_0  = ** Echec de connexion à l'espace de travail R 
+RWorkspace_1  = ** Erreur d'évaluation : 
+RWorkspace_10 = Démarrage de R avec le chemin d'accès: 
+RWorkspace_11 = Dernier 'safeeval'
+RWorkspace_2  = tentative de connexion à R : 
+RWorkspace_21 = Commande complète : 
+RWorkspace_3  = Sauvegarde du graphique dans le fichier 
+RWorkspace_6  = ** Echec de l'initialisation du transfert : 
+RWorkspace_7  = La matrice est vide
+RWorkspace_8  = Impossible de démarrer RServe : 
+
+R_EXPR                    = Expression transmise au Moteur Statistique pour évaluation : {0}.
+R_READ_CONSOLE            = Le Moteur Statistique attend une réponse de la console ({0}, {1}).
+R_SAVE_HISTORY            = Le Moteur Statistique a sauvegardé un historique ({0}).
+R_SHOW_MESSAGE            = Le Moteur Statistique a affiché ce message : {0}.
+R_WRITE_CONSOLE           = Le Moteur Statistique a afiché ce message dans la console: {0}.
+
+StartRserve_0  = Démarrage de R avec la ligne de commande: 
+StartRserve_2  = Chemin d'accès à R non fourni, tentative de résolution...
+StartRserve_21 = ** Echec du lancement de Rserve avec la commande : 
+StartRserve_22 = Moteur statistique lancé
+StartRserve_28 = ** Echec du lancement de REG pour localiser le programme R
+StartRserve_29 = \ Vous avez besoin du logiciel 'R' et de configurer ses chemins via la fenêtre de préférences 'Outils/Préférences'
+StartRserve_3  = Rserve déja démarré sur le port 
+StartRserve_4  = Essai du chemin de R : 'R'
+StartRserve_6  = Essai du chemin de R : 
+
+
+CHAR_VECTOR_ADDED_TO_WORKSPACE = Le vecteur "{1}" ({0,number,integer} valeurs "character") a été transmis au Moteur Statistique.
+CONNECTED_TO_STATS_MODULE = connecté.
+CONNECTION_OK = Connexion au Moteur Statistique établie.
+ERROR_EXTRACT_ITEM = ** Erreur lors de l'extraction de la liste d'items : \	
+REQUESTED_OBJECT_NOT_FOUND_IN_R = L'objet demandé ({0}) n'a pas été trouvé dans l'espace de travail R.
+
+
+

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/messages/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/VectorImpl.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/VectorImpl.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/VectorImpl.java	(revision 281)
@@ -0,0 +1,387 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (Thu, 29 Aug 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.statsengine.r.core.data;
+
+import java.util.List;
+
+import org.rosuda.REngine.REXP;
+import org.rosuda.REngine.REXPMismatchException;
+import org.txm.statsengine.core.StatException;
+import org.txm.statsengine.core.data.Vector;
+import org.txm.statsengine.core.utils.ArrayIndex;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Implementation of the {@link Vector} interface, wrapping a R vector.
+ * 
+ * @author sloiseau
+ */
+public class VectorImpl extends QuantitativeDataStructureImpl implements Vector {
+
+	/**
+	 * This is final in order to be sure that a length is always defined, and
+	 * defined only once, on a vector.
+	 */
+	private int length;
+
+	/**
+	 * Instantiates a new vector.
+	 *
+	 * @param data the data
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public VectorImpl(int[] data) throws RWorkspaceException {
+		super();
+		rw.addVectorToWorkspace(symbol, data);
+		length = data.length;
+	}
+
+	/**
+	 * Instantiates a new vector impl.
+	 *
+	 * @param data the data
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public VectorImpl(double[] data) throws RWorkspaceException {
+		super();
+		rw.addVectorToWorkspace(symbol, data);
+		length = data.length;
+	}
+
+	/**
+	 * Instantiates a new vector impl.
+	 *
+	 * @param data the data
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public VectorImpl(String[] data) throws RWorkspaceException {
+		super();
+		rw.addVectorToWorkspace(symbol, data);
+		length = data.length;
+	}
+	
+	/**
+	 * Instantiates a new vector.
+	 *
+	 * @param data the data
+	 * @param symbol the symbol
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public VectorImpl(int[] data, String symbol) throws RWorkspaceException {
+		super();
+		this.symbol = symbol;
+		rw.addVectorToWorkspace(symbol, data);
+		length = data.length;
+	}
+
+	/**
+	 * Instantiates a new vector impl.
+	 *
+	 * @param data the data
+	 * @param symbol the symbol
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public VectorImpl(double[] data, String symbol) throws RWorkspaceException {
+		super();
+		this.symbol = symbol;
+		rw.addVectorToWorkspace(symbol, data);
+		length = data.length;
+	}
+
+	/**
+	 * Instantiates a new vector impl.
+	 *
+	 * @param data the data
+	 * @param symbol the symbol
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public VectorImpl(String[] data, String symbol) throws RWorkspaceException {
+		super();
+		this.symbol = symbol;
+		rw.addVectorToWorkspace(symbol, data);
+		length = data.length;
+	}
+
+	/**
+	 * Constructing a Vector when the R object already exists in the workspace:
+	 * we only want to record its symbol in a java object.
+	 *
+	 * @param symbol the symbol
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public VectorImpl(String symbol) throws RWorkspaceException {
+		super(symbol);
+		try {
+			length = rw.eval("length(" + symbol + ")").asInteger(); //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+	}
+
+	/**
+	 * Sets the r names.
+	 *
+	 * @param vals the new r names
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void setRNames(String[] vals) throws RWorkspaceException {
+		Vector names = new VectorImpl(vals);
+
+		StringBuffer exp = new StringBuffer();
+		exp.append("names("); //$NON-NLS-1$
+		exp.append(symbol);
+		exp.append(")"); //$NON-NLS-1$
+		exp.append("<-"); //$NON-NLS-1$
+		exp.append(names.getSymbol());
+		exp.append(";"); //$NON-NLS-1$
+
+		rw.voidEval(exp.toString());
+		rw.voidEval("rm(" + names.getSymbol() + ");"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Gets the r names.
+	 * 
+	 * @param string
+	 *            the string
+	 * 
+	 * @return the r names
+	 * 
+	 * @throws RWorkspaceException
+	 *             the r workspace exception
+	 */
+	public void getRNames(String[] string) throws RWorkspaceException {
+		getAttribute("names"); //$NON-NLS-1$
+	}
+
+	/**
+	 * Get a new vector with a copy of the value at the specif ied index in this
+	 * vector.
+	 *
+	 * @param index the index
+	 * @return the vector
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	@Override
+	public Vector get(int[] index) throws RWorkspaceException {
+		int[] rIndex = ArrayIndex.zeroToOneBasedIndex(index, this.length);
+		// TODO Auto-generated method stub
+		String name_index = createSymbole(Vector.class);
+		rw.addVectorToWorkspace(name_index, rIndex);
+		String name = createSymbole(Vector.class);
+		rw.voidEval(name + "<- " + symbol + "[ " + name_index + "];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		return new VectorImpl(name);
+	}
+
+	/**
+	 * Throw a {@link RWorkspaceException} if the vector is not of type integer.
+	 *
+	 * @return the int[]
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	@Override
+	public int[] asIntArray() throws RWorkspaceException {
+		try {
+			return rw.eval(symbol).asIntegers();
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Vector#asStringsArray()
+	 */
+	@Override
+	public String[] asStringsArray() throws StatException {
+		try {
+			return rw.eval(symbol).asStrings();
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Vector#asDoubleArray()
+	 */
+	@Override
+	public double[] asDoubleArray() throws StatException {
+		try {
+			return rw.eval(symbol).asDoubles();
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Vector#getLength()
+	 */
+	@Override
+	public int getLength() throws StatException {
+		return length;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Vector#remove(int)
+	 */
+	@Override
+	public boolean remove(int index) {
+		try {
+			if (index < this.length) {
+				rw.eval(symbol + " <- " + symbol + "[-" + (index + 1) + "];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				length--;
+			}
+		} catch (RWorkspaceException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Vector#setString(int, java.lang.String)
+	 */
+	@Override
+	public void setString(int index, String value) {
+		try {
+			if (index < this.length) {
+				rw.eval(symbol + "[" + (index + 1) + "] <-\"" + value + "\";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			}
+		} catch (RWorkspaceException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Vector#setDouble(int, double)
+	 */
+	@Override
+	public void setDouble(int index, double value) {
+		try {
+			if (index < this.length) {
+				rw.eval(symbol + "[" + (index + 1) + "] <-" + value + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			}
+		} catch (RWorkspaceException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Vector#setInt(int, int)
+	 */
+	@Override
+	public void setInt(int index, int value) {
+		try {
+			if (index < this.length) {
+				rw.eval(symbol + "[" + (index + 1) + "] <-" + value + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			}
+		} catch (RWorkspaceException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Vector#sort(java.lang.Boolean)
+	 */
+	@Override
+	public void sort(Boolean reverse) {
+		try {
+			//System.out.println("R sort rownames Reverse" + reverse);
+			REXP r = rw
+					.eval(symbol
+							+ "<- " + symbol + "[order(" + symbol + ", decreasing = " + reverse.toString().toUpperCase() + ")];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Vector#setOrder(java.util.List, java.lang.Boolean)
+	 */
+	@Override
+	public void setOrder(List<Integer> neworder, Boolean reverse) {
+		if (neworder.size() != this.length)
+			return;
+		String order = "c("; //$NON-NLS-1$
+		if (reverse) {
+			for (int i = neworder.size() - 1; i >= 0; i--)
+				order += "" + (neworder.get(i) + 1) + ", "; //$NON-NLS-1$ //$NON-NLS-2$
+		} else {
+			for (Integer i : neworder)
+				order += "" + (i + 1) + ", "; //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		order = order.substring(0, order.length() - 2);
+		order += ")"; //$NON-NLS-1$
+		try {
+			// System.out.println("R sort rownames Reverse"+reverse);
+			REXP r = rw.eval(symbol + "<- " + symbol + "[" + order + "];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Vector#cut(int)
+	 */
+	@Override
+	public void cut(int nlines) {
+		try {
+			// cut nlines
+			REXP r = rw.eval(symbol + "<- " + symbol + "[1:" + (nlines) + "];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/VectorImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/MatrixImpl.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/MatrixImpl.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/MatrixImpl.java	(revision 281)
@@ -0,0 +1,1071 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2015-05-22 09:06:15 +0200 (Fri, 22 May 2015) $
+// $LastChangedRevision: 2973 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core.data;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.rosuda.REngine.REXP;
+import org.rosuda.REngine.REXPMismatchException;
+import org.txm.statsengine.core.StatException;
+import org.txm.statsengine.core.data.Matrix;
+import org.txm.statsengine.core.data.Vector;
+import org.txm.statsengine.core.messages.StatsEngineCoreMessages;
+import org.txm.statsengine.core.utils.ArrayIndex;
+import org.txm.statsengine.r.core.RWorkspace;
+import org.txm.statsengine.r.core.exceptions.RException;
+import org.txm.statsengine.r.core.exceptions.RObjectDoesNotExist;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+import org.txm.statsengine.r.core.messages.RCoreMessages;
+import org.txm.utils.CharsetDetector;
+import org.txm.utils.OSDetector;
+
+import cern.colt.matrix.DoubleMatrix2D;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Implementation of the {@link Matrix} interface, wrapping a R matrix.
+ * 
+ * define the methods to edit/delete elements in the matrix
+ * 
+ * @author sloiseau
+ */
+public class MatrixImpl extends QuantitativeDataStructureImpl implements Matrix {
+
+
+	public static int[][] asIntMatrix(REXP r) throws REXPMismatchException {
+
+		int[] ct = r.asIntegers();
+		if (ct == null) return null;
+		REXP dim = r.getAttribute("dim"); //$NON-NLS-1$
+		int[] ds = dim.asIntegers();
+		if (ds == null || ds.length != 2)
+			return null; // matrix must be 2-dimensional
+
+		int m = ds[0], n = ds[1];
+		int[][] rez = new int[m][n];
+
+		// R stores matrices as matrix(c(1,2,3,4),2,2) = col1:(1,2), col2:(3,4)
+		// we need to copy everything, since we create 2d array from 1d array
+		int i = 0, k = 0;
+		while (i < n) {
+			int j = 0;
+			while (j < m) {
+				rez[j++][i] = ct[k++];
+			}
+			i++;
+		}
+		return rez;
+	}
+
+	//	/** The ncol. */
+	//	protected int ncol;
+	//	
+	//	/** The nrow. */
+	//	protected int nrow;
+
+
+	/**
+	 * Instantiates a new matrix impl.
+	 *
+	 * @param matrix the matrix
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public MatrixImpl(double[][] matrix) throws RWorkspaceException {
+		super();
+		rw.addMatrixToWorkspace(symbol, matrix);
+		//		this.nrow = matrix.length;
+		//		this.ncol = matrix[0].length;
+		//this.rows = null;
+		//this.cols = null;
+	}
+
+	/**
+	 * Instantiates a new matrix impl.
+	 *
+	 * @param matrix the matrix
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public MatrixImpl(DoubleMatrix2D matrix) throws RWorkspaceException {
+		super();
+		rw.addMatrixToWorkspace(symbol, matrix);
+		//		this.nrow = matrix.rows();
+		//		this.ncol = matrix.columns();
+		//this.rows = null;
+		//this.cols = null;
+	}
+
+	/**
+	 * Create a new matrix given a {@link DoubleMatrix2D}, with row and col
+	 * names.
+	 *
+	 * @param matrix the matrix
+	 * @param rowNames row names.
+	 * @param columnNames the column names
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public MatrixImpl(DoubleMatrix2D matrix, String[] rowNames,
+			String[] columnNames) throws RWorkspaceException {
+		this(matrix);
+
+		if (rowNames == null) {
+			throw new IllegalArgumentException(StatsEngineCoreMessages.MatrixImpl_4);
+		}
+		//		if (rowNames.length != nrow) {
+		//			throw new IllegalArgumentException(Messages.MatrixImpl_5);
+		//		}
+		//this.rows = new VectorImpl(rowNames);
+		rw.assignRowNamesToMatrix(symbol, new VectorImpl(rowNames).getSymbol());
+
+		if (columnNames == null) {
+			throw new IllegalArgumentException(StatsEngineCoreMessages.MatrixImpl_6);
+		}
+		//		if (columnNames.length != ncol) {
+		//			throw new IllegalArgumentException(Messages.MatrixImpl_7
+		//					+ columnNames.length + ", " + ncol + ")."); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+		//		}
+		//this.cols = new VectorImpl(columnNames);
+		rw.assignColNamesToMatrix(symbol, new VectorImpl(columnNames).getSymbol());
+
+	}
+
+	/**
+	 * Instantiates a new matrix impl.
+	 *
+	 * @param matrix the matrix
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public MatrixImpl(int[][] matrix) throws RWorkspaceException {
+		super();
+		rw.addMatrixToWorkspace(symbol, matrix);
+		//		this.nrow = matrix.length;
+		//		if (matrix.length > 0)
+		//			this.ncol = matrix[0].length;
+		//		else
+		//			this.ncol = 0;
+		//this.rows = null;
+		//this.cols = null;
+	}
+	
+	public void exchangeColumns(int c1, int c2) {
+		try {
+			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+			rw.eval("tmp <- "+symbol+"[,"+c1+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			rw.eval(symbol+"[,"+c1+"] <- "+symbol+"[,"+c2+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			rw.eval(symbol+"[,"+c2+"] <- tmp"); //$NON-NLS-1$ //$NON-NLS-2$
+			rw.eval("tmp <- colnames("+symbol+")["+c1+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			rw.eval("colnames("+symbol+")["+c1+"] <- colnames("+symbol+")["+c2+"]"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+			rw.eval("colnames("+symbol+")["+c2+"] <- tmp"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Instantiates a new matrix impl.
+	 *
+	 * @param matrix the matrix
+	 * @param lineNames the form names
+	 * @param partNames the part names
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public MatrixImpl(int[][] matrix, String[] lineNames, String[] partNames) throws RWorkspaceException {
+		this(matrix);
+
+		if (lineNames == null) {
+			throw new IllegalArgumentException(StatsEngineCoreMessages.MatrixImpl_4);
+		}
+		//		if (lineNames.length != nrow) {
+		//			throw new IllegalArgumentException(Messages.MatrixImpl_5);
+		//		}
+		//this.rows = ;
+		rw.assignRowNamesToMatrix(symbol, new VectorImpl(lineNames).getSymbol());
+
+		if (partNames == null) {
+			throw new IllegalArgumentException(StatsEngineCoreMessages.MatrixImpl_6);
+		}
+		//		if (partNames.length != ncol) {
+		//			throw new IllegalArgumentException(Messages.MatrixImpl_7
+		//					+ partNames.length + ", " + ncol + ")."); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
+		//		}
+		//this.cols = new VectorImpl(partNames);
+		rw.assignColNamesToMatrix(symbol, new VectorImpl(partNames).getSymbol());
+
+	}
+
+	/**
+	 * Create a matrix wrapping data already existing into R with the given
+	 * symbol.
+	 * 
+	 * This method is protected on purpose : only classes in this package,
+	 * dealing with the R workspace, may have direct access to R objects.
+	 *
+	 * @param symbol the name of R object existing in the workspace.
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	protected MatrixImpl(String symbol) throws RWorkspaceException {
+		super(symbol);
+		if (!rw.containsVariable(symbol)) {
+			throw new RObjectDoesNotExist(StatsEngineCoreMessages.MatrixImpl_0 + symbol
+					+ StatsEngineCoreMessages.MatrixImpl_1);
+		}
+		REXP res = rw.eval("dim(" + symbol + ")"); //$NON-NLS-2$ //$NON-NLS-1$
+		int[] dim = null;
+		try {
+			dim = res.asIntegers();
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+		//		nrow = dim[0];
+		//		ncol = dim[1];
+		//this.rows = null;
+		//this.cols = null;
+	}
+
+	/**
+	 * Removes the row with a negative index.
+	 * @param row the row [1..N]
+	 */
+	public void _removeRow(int row) {
+		// dans R theMatrixWithoutRow5 = theMatrix[-5,]
+		try {
+			REXP r = rw.eval(symbol
+					+ " <- " + symbol + "[ " + row + ",];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			//nrow--;
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		// de la liste rows
+	}
+
+	/**
+	 * Cut.
+	 *
+	 * @param nRowToCut the nlines
+	 * @throws StatException 
+	 */
+	public void cut(int nRowToCut){
+		if (nRowToCut > this.getNRows())
+			return;
+
+		try {
+			// cut nlines
+			REXP r = rw.eval(symbol
+					+ "<- " + symbol + "[1:" + (nRowToCut) + ", ];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			getRowNames().cut(nRowToCut);
+			//this.nrow = nlines;
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	// public String[] rownames() throws RWorkspaceException {
+	// return rw.evalToString("rownames(" + symbol + ");");
+	// }
+
+	/**
+	 * Export data.
+	 *
+	 * @param f the f
+	 * @param colseparator the colseparator
+	 * @param txtseparator the txtseparator
+	 */
+	public void exportData(File f, String colseparator, String txtseparator) {
+		try {
+			org.txm.statsengine.r.core.RWorkspace
+			.getRWorkspaceInstance().safeEval(
+					"write.table(" + symbol + ", file=\"" + f.getAbsolutePath().replace("\\", "\\\\") + "\", fileEncoding=\"UTF-8\");"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ 
+		} catch (Exception e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			RWorkspace.printLastSafeEvalExpr();
+		}
+	}
+
+	/**
+	 * Filter.
+	 *
+	 * @param freqs the freqs
+	 * @param nlines the nlines
+	 * @param fmin the fmin
+	 * @throws REXPMismatchException 
+	 * @throws RWorkspaceException 
+	 * @throws StatException 
+	 */
+	public void filter(int nlines, int fmin) throws RWorkspaceException, REXPMismatchException {
+		RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+
+		// first sort rows
+		rw.eval("freqs <- rowSums("+symbol+")"); //$NON-NLS-1$ //$NON-NLS-2$
+		int[] freqs = rw.eval("freqs").asIntegers(); //$NON-NLS-1$
+		rw.eval("order <- sort(freqs, decreasing= TRUE, index.return= TRUE)"); //$NON-NLS-1$
+		//rw.eval("print(order)");
+		int[] order = rw.eval("order$ix").asIntegers();  //$NON-NLS-1$
+		rw.eval(symbol + "<- " + symbol + "[order$ix, ];"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// find first fmin line
+		int ifmin = 999999999;
+		for (int i = 0 ; i < order.length ; i++) {
+			//System.out.print("\t"+i+" freqs["+order[i]+"]"+freqs[order[i]-1]);
+			if (freqs[order[i]-1] < fmin) { // minus 1 because of R indexes
+				ifmin = i; // the ith line
+				break;
+			}
+		}
+		//System.out.println("iFmin: "+ifmin);
+
+		//cut
+		cut(Math.min(nlines, ifmin));
+	}
+
+	public void sortByFreqs(boolean reverse) throws RWorkspaceException, REXPMismatchException {
+		rw.eval("freqs <- rowSums("+symbol+")"); //$NON-NLS-1$ //$NON-NLS-2$
+		String DECREASING = "FALSE"; //$NON-NLS-1$
+		if (reverse) DECREASING = "TRUE"; //$NON-NLS-1$
+		rw.eval("order <- sort(freqs, decreasing= "+DECREASING+", index.return= TRUE)"); //$NON-NLS-1$ //$NON-NLS-2$
+		rw.eval(symbol + "<- " + symbol + "[order$ix, ];"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Fusion rows.
+	 *
+	 * @param row the row
+	 * @throws RWorkspaceException 
+	 */
+	public boolean mergeRows(int[] rows) throws RWorkspaceException {
+		if (rows.length < 2) return false;
+		Arrays.sort(rows);
+		//System.out.println("fusion rows: "+Arrays.toString(rows)); //$NON-NLS-1$
+		int rowToChange = rows[0] + 1;
+		rw.addVectorToWorkspace("rowsToMerge", ArrayIndex.zeroToOneBasedIndex(rows, rows.length)); //$NON-NLS-1$
+		RWorkspace.getRWorkspaceInstance().eval("newrow <- colSums("+symbol+"[rowsToMerge,])"); //$NON-NLS-1$ //$NON-NLS-2$
+		RWorkspace.getRWorkspaceInstance().eval(symbol+"["+rowToChange+",] <- newrow"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		this.removeRows(Arrays.copyOfRange(rows, 1, rows.length)); // remove rows minus the first row to remove
+
+		return true;
+	}
+
+	/**
+	 * Fusion rows.
+	 *
+	 * @param row the row
+	 * @throws RWorkspaceException 
+	 */
+	public boolean mergeCols(int[] cols) throws RWorkspaceException {
+		if (cols.length < 2) return false;
+		Arrays.sort(cols);
+		//System.out.println("fusion rows: "+Arrays.toString(rows)); //$NON-NLS-1$
+		int colToChange = cols[0] + 1;
+		rw.addVectorToWorkspace("colsToMerge", ArrayIndex.zeroToOneBasedIndex(cols, cols.length)); //$NON-NLS-1$
+		RWorkspace.getRWorkspaceInstance().eval("newcol <- rowSums("+symbol+"[,colsToMerge])"); //$NON-NLS-1$ //$NON-NLS-2$
+		RWorkspace.getRWorkspaceInstance().eval(symbol+"[,"+colToChange+"] <- newcol"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		this.removeCols(Arrays.copyOfRange(cols, 1, cols.length)); // remove rows minus the first row to remove
+
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Matrix#get(int, int)
+	 */
+	@Override
+	public double get(int row, int col) throws RException, RWorkspaceException {
+		int ncol = this.getNColumns();
+		int	nrow = this.getNRows();
+
+		if (row < 0 || row >= nrow) {
+			//throw new IllegalArgumentException(Messages.MatrixImpl_10 + row + Messages.MatrixImpl_11 + nrow + ")"); //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-1$
+		}
+		if (col < 0 || col >= ncol) {
+			//throw new IllegalArgumentException(Messages.MatrixImpl_13 + col + Messages.MatrixImpl_14 + ncol + ")"); //$NON-NLS-3$ //$NON-NLS-1$ //$NON-NLS-1$
+		}
+		REXP r = rw.eval(symbol
+				+ "[" + ArrayIndex.zeroToOneBasedIndex(row) + ", " + ArrayIndex.zeroToOneBasedIndex(col) + " ];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		if (r.isInteger()) {
+			try {
+				return r.asInteger();
+			} catch (REXPMismatchException e) {
+				throw new RWorkspaceException(e);
+			}
+		} else if (r.isComplex()) {
+			try {
+				return r.asDouble();
+			} catch (REXPMismatchException e) {
+				throw new RWorkspaceException(e);
+			}
+		} else if (r.isNumeric()) {
+			try {
+				return r.asDouble();
+			} catch (REXPMismatchException e) {
+				throw new RWorkspaceException(e);
+			}
+		} else if (r.isNull()) {
+			throw new IllegalArgumentException(StatsEngineCoreMessages.MatrixImpl_19);
+		} else {
+			// System.out.println("row: " + row);
+			// System.out.println("col: " + col);
+			// System.out.println("nrow: " + nrow);
+			// System.out.println("ncol: " + ncol);
+			// System.out.println(rw.eval("print(" + getSymbol() + ");"));
+			throw new IllegalArgumentException(StatsEngineCoreMessages.MatrixImpl_20
+					+ r.getAttribute(StatsEngineCoreMessages.MatrixImpl_21));
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Matrix#getCol(int)
+	 */
+	@Override
+	public Vector getCol(int index) throws RException, RWorkspaceException {
+		int ncol = this.getNColumns();
+
+		if (index < 0 || index >= ncol) {
+			throw new IllegalArgumentException(StatsEngineCoreMessages.MatrixImpl_28 + index
+					+ StatsEngineCoreMessages.MatrixImpl_29 + ncol + ")"); //$NON-NLS-1$ 
+		}
+		String colName = createSymbole(Vector.class);
+		rw.voidEval(colName + "<- " + symbol + "[ ," + (index + 1) + "];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		return new VectorImpl(colName);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Matrix#getCol(java.lang.String)
+	 */
+	@Override
+	public Vector getCol(String column) throws RWorkspaceException {
+		String colName = createSymbole(Vector.class);
+		rw.voidEval(colName + "<- " + symbol + "[ ,\"" + column + "\"];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		return new VectorImpl(colName);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Matrix#getColNames()
+	 */
+	@Override
+	public Vector getColNames() {
+		try {
+			return new VectorImpl("colnames("+this.getSymbol()+")"); //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return null;
+		}
+	}
+
+	public int[][] getIntData() {
+		try {
+			REXP rexp = RWorkspace.getRWorkspaceInstance().eval(this.symbol);
+			return asIntMatrix(rexp);
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (REXPMismatchException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Matrix#getNColumns()
+	 */
+	@Override
+	public int getNColumns() {
+		try {
+			return RWorkspace.getRWorkspaceInstance().eval(StatsEngineCoreMessages.MatrixImpl_2+symbol+")[2]").asInteger(); //$NON-NLS-2$
+		} catch (Exception e) {
+			System.out.println("Matrix: failed to get nrow: "+e); //$NON-NLS-1$
+		}
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Matrix#getNRows()
+	 */
+	@Override
+	public int getNRows() {
+		try {
+			return RWorkspace.getRWorkspaceInstance().eval(StatsEngineCoreMessages.MatrixImpl_2+symbol+")[1]").asInteger(); //$NON-NLS-2$
+		} catch (Exception e) {
+			System.out.println(StatsEngineCoreMessages.MatrixImpl_67+e);
+		}
+		return 0;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Matrix#getRow(int)
+	 */
+	@Override
+	public Vector getRow(int index) throws RException, RWorkspaceException {
+		int nrow = getNRows();
+		if (index < 0 || index >= nrow) {
+			throw new IllegalArgumentException(StatsEngineCoreMessages.MatrixImpl_22 + index
+					+ StatsEngineCoreMessages.MatrixImpl_23 + nrow + ")"); //$NON-NLS-1$ 
+		}
+		String rowName = createSymbole(Vector.class);
+		rw.voidEval(rowName + "<- " + symbol + "[" + (index + 1) + ", ];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		return new VectorImpl(rowName);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Matrix#getRow(java.lang.String)
+	 */
+	@Override
+	public Vector getRow(String row) throws RWorkspaceException {
+		String rowName = createSymbole(Vector.class);
+		rw.voidEval(rowName + "<- " + symbol + "[ \"" + row + "\" , ];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		return new VectorImpl(rowName);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.Matrix#getRowNames()
+	 */
+	@Override
+	public Vector getRowNames() {
+		try {
+			return new VectorImpl("rownames("+this.getSymbol()+")"); //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return null;
+		}
+	}
+
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.ContingencyTable#getRowMargin()
+	 */
+	public int[] getRowMargins() throws StatException {
+		try {
+			return rw.eval("rowSums(" + this.symbol + ");").asIntegers(); //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (REXPMismatchException e) {
+			throw new StatException(e);
+		} 
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.ContingencyTable#getRowMargin()
+	 */
+	public int[] getColMargins() throws StatException {
+		try {
+			return rw.eval("colSums(" + this.symbol + ");").asIntegers(); //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (Exception e) {
+			throw new StatException(e);
+		}
+	}
+
+	/**
+	 * Import data.
+	 *
+	 * @param f the f
+	 * @throws RWorkspaceException 
+	 * @throws REXPMismatchException 
+	 */
+	public boolean importData(File f) throws RWorkspaceException, REXPMismatchException {
+
+		String path = f.getAbsolutePath();
+		
+		CharsetDetector guesser = new CharsetDetector(f);
+		if (!("UTF-8".equals(guesser.getEncoding().toUpperCase()))) {
+			System.out.println("Warning: file encoding seems to not be 'UTF-8' but '"+guesser.getEncoding()+"'");
+		}
+		
+		int nline = 0;
+		try {
+			BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8"));
+			while(reader.readLine() != null) nline++;
+			reader.close();
+		} catch(Exception e) { }
+		
+		if (nline == 0) {
+			System.out.println("Error: the file is empty");
+			return false;
+		}
+		
+		if (OSDetector.isFamilyWindows()) //$NON-NLS-1$ //$NON-NLS-2$
+			path = path.replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
+		rw.voidEval("tmpmat <- as.matrix(read.table(file=\"" + path + "\", fileEncoding=\"UTF-8\"));"); //$NON-NLS-1$ //$NON-NLS-2$
+		
+		rw.voidEval("a <- colnames(tmpmat)"); //$NON-NLS-1$
+		rw.voidEval("if (length(grep(\"X.+\", a)) == length(a)) {"+ //$NON-NLS-1$
+				" strcut <- function(x) substr(x, 2, nchar(x)) ;"+ //$NON-NLS-1$
+				" for(i in 1:length(a)) { a[i] <- strcut(a[i]) } ; "+ //$NON-NLS-1$
+				" colnames(tmpmat) <- a; }"); //$NON-NLS-1$
+		
+		// check number of columns
+		int colsize = rw.eval("dim(tmpmat)[2]").asInteger(); //$NON-NLS-1$
+		int linesize = rw.eval("dim(tmpmat)[1]").asInteger(); //$NON-NLS-1$
+		int ncol = this.getNColumns();
+		if (colsize != ncol) {
+			System.out.println(StatsEngineCoreMessages.MatrixImpl_73+ncol+" imported="+colsize); //$NON-NLS-2$
+			return false;
+		}
+		
+		rw.eval(symbol +"<- tmpmat"); //$NON-NLS-1$
+		
+		nline--;
+		if (nline != linesize) {
+			System.out.println("Warning: some lines have not been read. Check your file format (header, encoding=UTF-8, separator=TAB)");
+			System.out.println("Number of lines in the file="+nline);
+			System.out.println("Number of lines in the matrix="+linesize);
+		}
+		return true;
+	}
+
+	public void print() {
+
+		try {
+			String[] rowNames = this.getRowNames().asStringsArray();
+			String[] colNames = this.getColNames().asStringsArray();
+			int[][] data = getIntData();
+
+			// col names
+			for (String col : colNames)
+				System.out.print("\t"+col); //$NON-NLS-1$
+					System.out.println();		
+					for (int i = 0 ; i < rowNames.length ; i++) {
+						System.out.print(rowNames[i]);
+						for (int j = 0 ; j < colNames.length ; j++) {
+							System.out.print("\t"+data[i][j]); //$NON-NLS-1$
+						}
+						System.out.println();
+					}
+		} catch (StatException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Removes the col.
+	 *
+	 * @param col the col
+	 * @param checkEmptyLines the check empty lines
+	 */
+	public void removeCol(int col) {
+		//System.out.println("rmv col " + col);
+		try {
+			REXP r = rw.eval(symbol + " <- " + symbol + "[,-" + ArrayIndex.zeroToOneBasedIndex(col) + "];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Removes the col and delete empty rows.
+	 *
+	 * @param col the col
+	 * @param checkEmptyLines the check empty lines
+	 */
+	public void removeCol(int col, boolean checkEmptyLines) {
+		//System.out.println("rmv col " + col);
+		try {
+			removeCol(col);
+
+			//we remove the empty lineslines
+			if (checkEmptyLines) {
+				removeEmptyRows();
+			}
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Removes the cols.
+	 *
+	 * @param cols the cols
+	 */
+	public void removeCols(int[] cols) {
+		Arrays.sort(cols);
+		int index = 0;
+		for (int i = cols.length - 1; i >= 0; i--) {
+			index = cols[i];
+			removeCol(index, false);
+		}
+	}
+
+	public void removeCols(int[] cols, boolean removeEmptyLines) throws RWorkspaceException {
+		removeCols(cols);
+		if (removeEmptyLines) removeEmptyRows();
+	}
+
+	/**
+	 * Removes the cols.
+	 *
+	 * @param cols the cols
+	 */
+	public void removeCols(List<Integer> cols) {
+		Collections.sort(cols);
+		int index = 0;
+		for (int i = cols.size() - 1; i >= 0; i--) {
+			index = cols.get(i);
+			removeCol(index, false);
+		}
+	}
+
+	public void removeCols(List<Integer> cols, boolean removeEmptyLines) throws RWorkspaceException {
+		removeCols(cols);
+		if (removeEmptyLines) {
+			removeEmptyRows();
+		}
+	}
+
+	private void removeEmptyCols() throws RWorkspaceException {
+		try {
+			int[] colsums = rw.eval("apply("+symbol+",2,sum)").asIntegers();//get a vector of line sums //$NON-NLS-1$ //$NON-NLS-2$
+			ArrayList<Integer> removecols = new ArrayList<Integer>();
+			// get the empty line index
+			for (int i = 0 ; i < colsums.length ; i++) {
+				if (colsums[i] == 0)
+					removecols.add(i);
+			}
+
+			if (removecols.size() > 0) {
+				removeCols(removecols);
+			}
+		} catch (REXPMismatchException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Removes the empty lines.
+	 *
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public void removeEmptyRows() throws RWorkspaceException
+	{
+		try {
+			int[] rowsums = rw.eval("apply("+symbol+",1,sum)").asIntegers();//get a vector of line sums //$NON-NLS-1$ //$NON-NLS-2$
+			ArrayList<Integer> rowIndexes = new ArrayList<Integer>();
+			// get the empty line index
+			for (int i = 0 ; i < rowsums.length ; i++) {
+				if (rowsums[i] == 0)
+					rowIndexes.add(i);
+			}
+
+			if (rowIndexes.size() > 0) {
+				removeRows(rowIndexes);
+			}
+		} catch (REXPMismatchException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Removes the row.
+	 *
+	 * @param row the row
+	 */
+	public void removeRow(int row) {
+		// dans R theMatrixWithoutRow5 = theMatrix[-5,]
+		try {
+			REXP r = rw.eval(symbol
+					+ " <- " + symbol + "[ -" + ArrayIndex.zeroToOneBasedIndex(row) + ",];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		// de la liste rows
+	}
+
+	/**
+	 * Removes the rows.
+	 *
+	 * @param from the from
+	 * @param to the to
+	 */
+	public void removeRows(int from, int to) {
+		int nrow = this.getNRows();
+		if (0 <= from && from <= to && to < nrow) {
+			for (int i = to; i >= from; i--) {
+				removeRow(i);
+			}
+		}
+	}
+
+	/**
+	 * Removes the rows indexes.
+	 *
+	 * @param rows the rows
+	 */
+	public void removeRows(int[] rows) {
+		if (rows.length == 0) return;
+		int nrow = this.getNRows();
+		try {
+			Arrays.sort(rows);
+			for (int i = 0 ; i < rows.length ; i++) {
+				rows[i] = - (rows[i]+1);
+			}
+			int idx = rows[0];
+			if (rows.length > 1) {
+				int[] subrows = new int[rows.length-1];
+				System.arraycopy(rows, 1, subrows, 0, rows.length - 1);
+				rw.addVectorToWorkspace("linesToDelete", subrows); //$NON-NLS-1$
+				//System.out.println("all lines to delete: "+Arrays.toString(rows));
+				//System.out.println("lines to delete: "+Arrays.toString(subrows));
+				REXP r = rw.eval(symbol + " <- " + symbol + "[ linesToDelete,];"); //$NON-NLS-1$ //$NON-NLS-2$
+				nrow -= rows.length - 1;
+			}
+
+			if (nrow == 2) {
+				// 2 lines left
+				int last = 1;
+				if (idx == -1) last = 2;
+				String[] rowNames;
+				try {
+					rowNames = getRowNames().asStringsArray();
+				} catch (StatException e) {
+					System.out.println(StatsEngineCoreMessages.MatrixImpl_79);
+					org.txm.utils.logger.Log.printStackTrace(e);
+					return;
+				}
+				String lastRowName = rowNames[last-1];
+				REXP r = rw.eval(this.symbol+"<-matrix("+this.symbol+"["+idx+",], nrow=1, dimnames = list(rownames=\""+lastRowName+"\", colnames("+this.symbol+")))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+				//_removeRow(idx);
+				nrow = 1;
+			} else {
+				//System.out.println("remove last row: "+idx);
+				_removeRow(idx);
+			}
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	public void removeRows(int[] rows, boolean removeEmptyCols) throws RWorkspaceException {
+		removeRows(rows);
+		if (removeEmptyCols) removeEmptyCols();
+	}
+
+	/**
+	 * Removes the rows.
+	 *
+	 * @param rows the row
+	 */
+	public void removeRows(List<Integer> rows) {
+
+		Collections.sort(rows);
+		//System.out.println("del rows " + row);
+		int index = 0;
+		int nrow = this.getNRows();
+		int diff = Math.abs(rows.size() - nrow);
+		if (diff > 1) {
+			for (int i = rows.size() - 1; i >= 0; i--) {
+				index = rows.get(i);
+				removeRow(index);
+			}
+		} else if (diff == 1) {
+			for (int i = rows.size() - 2; i >= 0; i--) {
+				index = rows.get(i);
+				removeRow(index);
+			}
+			// 2 lines left
+			int idx = rows.get(rows.size() - 1);
+			int last = 0;
+			if (idx == 0)
+				last = 1;
+			String[] rowNames;
+			try {
+				rowNames = getRowNames().asStringsArray();
+			} catch (StatException e) {
+				System.out.println(StatsEngineCoreMessages.MatrixImpl_79);
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return;
+			}
+			String lastRowName = rowNames[last];
+			System.out.println("table<-matrix(table[c(-"+idx+"),],nrow=1,dimnames = list(rownames="+lastRowName+",colnames(table)))"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		} else {
+			System.out.println(StatsEngineCoreMessages.MatrixImpl_88);
+		}
+	}
+
+	public void removeRows(List<Integer> rows, boolean removeEmptyCols) throws RWorkspaceException {
+		this.removeRows(rows);
+		if (removeEmptyCols) {
+			removeEmptyCols();
+		}
+	}
+
+	/**
+	 * Sets the.
+	 *
+	 * @param row the row
+	 * @param col the col
+	 * @param value the value
+	 */
+	public void set(int row, int col, double value) {
+		int nrow = this.getNRows();
+		int ncol = this.getNColumns();
+		if (row < 0 || row >= nrow) {
+			throw new IllegalArgumentException(StatsEngineCoreMessages.MatrixImpl_10 + row
+					+ StatsEngineCoreMessages.MatrixImpl_11 + nrow + ")"); //$NON-NLS-1$ 
+		}
+		if (col < 0 || col >= ncol) {
+			throw new IllegalArgumentException(StatsEngineCoreMessages.MatrixImpl_13 + col
+					+ StatsEngineCoreMessages.MatrixImpl_14 + ncol + ")"); //$NON-NLS-1$ 
+		}
+		// appel à R
+		try {
+			REXP r = rw.eval(symbol
+					+ "[" + ArrayIndex.zeroToOneBasedIndex(row) + ", " + ArrayIndex.zeroToOneBasedIndex(col) + " ] <- " + value + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Sets the order.
+	 *
+	 * @param neworder the neworder
+	 * @param reverse the reverse
+	 */
+	public void setOrder(List<Integer> neworder, Boolean reverse) {
+		int nrow = this.getNRows();
+		if (neworder.size() != nrow)
+		{
+			//System.out.println("MatrixImpl.setOrder: error new order size "+neworder.size()+" != nrow "+nrow);
+			return;
+		}
+		String order = "c("; //$NON-NLS-1$
+		if (reverse) {
+			for (int i = neworder.size() - 1; i >= 0; i--)
+				order += "" + (neworder.get(i) + 1) + ", "; //$NON-NLS-1$ //$NON-NLS-2$
+		} else {
+			for (Integer i : neworder)
+				order += "" + (i + 1) + ", "; //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		order = order.substring(0, order.length() - 2);
+					order += ")"; //$NON-NLS-1$
+					try {
+						// System.out.println("R sort rownames Reverse"+reverse);
+						REXP r = rw.eval(symbol + "<- " + symbol + "[" + order + ", ];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+						//REXP r2 = rw.eval("rownames("+symbol+") <- rownames(" + symbol + ")[" + order + "];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+					} catch (RWorkspaceException e) {
+						// TODO Auto-generated catch block
+						org.txm.utils.logger.Log.printStackTrace(e);
+					}
+	}
+
+	/**
+	 * Sort.
+	 *
+	 * @param col the col
+	 * @param reverse the reverse
+	 */
+	public void sort(int col, Boolean reverse) {
+		try {
+			// System.out.println("R sort "+col+" Reverse"+reverse);
+			REXP r = rw
+					.eval(symbol
+							+ "<- " + symbol + "[order(" + symbol + "[ ," + (col + 1) + "], decreasing = " + reverse.toString().toUpperCase() + "), ];;"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Sort row names.
+	 *
+	 * @param reverse the reverse
+	 */
+	public void sortRowNames(Boolean reverse) {
+
+		try {
+			// System.out.println("R sort rownames Reverse"+reverse);
+			REXP r = rw
+					.eval(symbol
+							+ "<- " + symbol + "[order(rownames(" + symbol + "), decreasing = " + reverse.toString().toUpperCase() + "), ];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			getRowNames().sort(reverse);
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Export data.
+	 *
+	 * @param f the f
+	 * @param colseparator the colseparator
+	 * @param txtseparator the txtseparator
+	 */
+	public void toTxt(File f, String encoding, String colseparator, String txtseparator) {
+		try {
+			String path = f.getAbsolutePath().replace("\\", "\\\\"); //$NON-NLS-1$ //$NON-NLS-2$
+			org.txm.statsengine.r.core.RWorkspace.getRWorkspaceInstance().safeEval(
+					"write.table(" + symbol + ", file=\"" + path + "\""//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+							+ ", fileEncoding=\""+encoding+"\"" //$NON-NLS-1$ //$NON-NLS-2$
+							+ ", sep=\""+colseparator+"\");"); //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (Exception e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			RWorkspace.printLastSafeEvalExpr();
+		}
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/MatrixImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/ContingencyTableImpl.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/ContingencyTableImpl.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/ContingencyTableImpl.java	(revision 281)
@@ -0,0 +1,357 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (Mon, 06 May 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core.data;
+
+import org.rosuda.REngine.REXPMismatchException;
+import org.txm.statsengine.core.StatException;
+import org.txm.statsengine.core.data.ContingencyTable;
+import org.txm.statsengine.core.data.Vector;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+
+import cern.colt.matrix.DoubleMatrix2D;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Implementation of the {@link ContingencyTable} interface, wrapping a R
+ * matrix.
+ * 
+ * @author sloiseau
+ */
+public class ContingencyTableImpl extends MatrixImpl implements ContingencyTable {
+
+	/**
+	 * Create a new contingency table after a {@link DoubleMatrix2D}.
+	 *
+	 * @param matrix the matrix
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public ContingencyTableImpl(DoubleMatrix2D matrix)
+			throws RWorkspaceException {
+		super(matrix);
+	}
+
+	/**
+	 * Create a new contingency table after a {@link DoubleMatrix2D}, with row
+	 * names and column names.
+	 *
+	 * @param matrix the matrix
+	 * @param rowNames row names.
+	 * @param columnNames the column names
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public ContingencyTableImpl(DoubleMatrix2D matrix, String[] rowNames,
+			String[] columnNames) throws RWorkspaceException {
+		super(matrix, rowNames, columnNames);
+	}
+
+	/**
+	 * Instantiates a new contingency table impl.
+	 *
+	 * @param matrix the matrix
+	 * @param formNames the form names
+	 * @param partNames the part names
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public ContingencyTableImpl(int[][] matrix, String[] formNames,
+			String[] partNames) throws RWorkspaceException {
+		super(matrix, formNames, partNames);
+	}
+	
+	/**
+	 * See {@link MatrixImpl#Matrix(String, Header)}.
+	 *
+	 * @param symbol the name of the object
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public ContingencyTableImpl(String symbol) throws RWorkspaceException {
+		super(symbol);
+	}
+
+
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.ContingencyTable#getColMargin()
+	 */
+	public Vector getColMargin() throws RWorkspaceException {
+		String colName = createSymbole(Vector.class);
+		rw.voidEval(colName + "<- colSums(" + this.symbol + ");"); //$NON-NLS-1$ //$NON-NLS-2$
+		return new VectorImpl(colName);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.ContingencyTable#getRowMargin()
+	 */
+	@Override
+	public Vector getRowMarginsVector() throws StatException {
+		String colName = createSymbole(Vector.class);
+		rw.voidEval(colName + "<- rowSums(" + this.symbol + ");"); //$NON-NLS-1$ //$NON-NLS-2$
+		return new VectorImpl(colName);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.ContingencyTable#getRowMargin()
+	 */
+	@Override
+	public Vector getColMarginsVector() throws StatException {
+		String rowName = createSymbole(Vector.class);
+		try {
+			rw.voidEval(rowName + "<- colSums(" + this.symbol + ");"); //$NON-NLS-1$ //$NON-NLS-2$
+			return new VectorImpl(rowName);
+		} catch (RWorkspaceException e) {
+			throw new StatException(e);
+		} 
+		
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.stat.data.ContingencyTable#getTotal()
+	 */
+	@Override
+	public int getTotal() throws RWorkspaceException {
+		int total;
+		try {
+			total = rw.eval("sum(" + this.symbol + ");").asInteger(); //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (REXPMismatchException e) {
+			throw new RWorkspaceException(e);
+		}
+		return total;
+	}
+
+	// /**
+	// * Gets the col.
+	// *
+	// * @param index the index
+	// *
+	// * @return the col
+	// */
+	// public DoubleMatrix1D getCol(int index) {
+	// if (index < 0 || index >= matrix.columns()) {
+	// throw new IllegalArgumentException("Column index (" + index +
+	// ") too hight (max: " + matrix.columns() + ")");
+	// }
+	// return matrix.viewColumn(index);
+	// }
+	//
+	// /**
+	// * Gets the sum.
+	// *
+	// * @return the sum
+	// */
+	// public int getSum() {
+	// if (sum == -1) {
+	// sum = (int) this.matrix.zSum();
+	// }
+	// return sum;
+	// }
+	//
+	//	
+	// /**
+	// * Row margin.
+	// *
+	// * @return the sum over the rows
+	// */
+	// public DoubleMatrix1D getRowSum() {
+	// if (rowSum==null){
+	// DoubleMatrix1D ones = DoubleFactory1D.dense.make(matrix.rows(),1);
+	// rowSum = matrix.viewDice().zMult(ones, null);
+	// }
+	// return rowSum;
+	// }
+	//	
+	//
+	//
+	// /**
+	// * Col margin.
+	// *
+	// * @return the sum over the columns
+	// */
+	// public DoubleMatrix1D getColSum() {
+	// if (colSum==null){
+	// DoubleMatrix1D ones = DoubleFactory1D.dense.make(matrix.columns(),1);
+	// colSum = matrix.zMult(ones, null);
+	// }
+	// return colSum;
+	// }
+
+	/**
+	 * Apply a four paramters-function on the whole table.
+	 * 
+	 * For each non zero value, the function will received four parameters:
+	 * <ul>
+	 * <li>The sum of the values in the matrix</li>
+	 * <li>The sum of the row of the given value</li>
+	 * <li>The sum of the column of the given value</li>
+	 * <li>The value</li>
+	 * </ul>
+	 * 
+	 * @param fun
+	 *            the fun
+	 * 
+	 * @return the matrix
+	 */
+	// public Matrix apply(final AbstractMatrixIntIntIntDoubleFunction fun) {
+	// cacheColSum();
+	// cacheRowSum();
+	// cacheSum();
+	// return new Matrix(
+	// matrix.copy().forEachNonZero(
+	// new IntIntDoubleFunction() {
+	// public double apply(int row, int col, double value) {
+	// return fun.apply(sum, rowSum[row], colSum[col], value);
+	// }
+	// }
+	// )
+	// );
+	// }
+
+	/**
+	 * Apply a function on the given row.
+	 * 
+	 * For each non zero value, the function will received four parameters:
+	 * <ul>
+	 * <li>The sum of the values in the matrix</li>
+	 * <li>The sum of the row of the given value</li>
+	 * <li>The sum of the column of the given value</li>
+	 * <li>The value</li>
+	 * </ul>
+	 * 
+	 * @param fun
+	 *            the fun
+	 * @param rowIndex
+	 *            the row index
+	 * 
+	 * @return the variable
+	 */
+	// public NumericalVector applyOnRowWithMargin(final
+	// AbstractMatrixIntIntIntDoubleFunction fun, int rowIndex) {
+	// cacheColSum();
+	// cacheRowSum();
+	// cacheSum();
+	// IntArrayList indexList = new IntArrayList();
+	// DoubleArrayList valueList = new DoubleArrayList();
+	// matrix.viewRow(rowIndex).getNonZeros(indexList, valueList);
+	//
+	// DoubleArrayList result = new DoubleArrayList(indexList.size());
+	//
+	// for (int i = 0; i < indexList.size(); i++) {
+	// int column = indexList.getQuick(i);
+	// double value = valueList.getQuick(i);
+	// result.setQuick(i, fun.apply(sum, rowSum[rowIndex], colSum[column],
+	// value));
+	// }
+	//
+	// return new NumericalVector(result);
+	// }
+
+	/**
+	 * Apply a function on the given column.
+	 * 
+	 * For each non zero value, the function will received four parameters:
+	 * <ul>
+	 * <li>The sum of the values in the matrix</li>
+	 * <li>The sum of the row of the given value</li>
+	 * <li>The sum of the column of the given value</li>
+	 * <li>The value</li>
+	 * </ul>
+	 * 
+	 * @param fun
+	 *            the fun
+	 * @param columnIndex
+	 *            the column index
+	 * 
+	 * @return the variable
+	 */
+	// public NumericalVector applyOnColumnWithMargin(final
+	// AbstractMatrixIntIntIntDoubleFunction fun, int columnIndex) {
+	// cacheColSum();
+	// cacheRowSum();
+	// cacheSum();
+	// IntArrayList indexList = new IntArrayList();
+	// DoubleArrayList valueList = new DoubleArrayList();
+	// matrix.viewColumn(columnIndex).getNonZeros(indexList, valueList);
+	//
+	// DoubleArrayList result = new DoubleArrayList(indexList.size());
+	//
+	// for (int i = 0; i < indexList.size(); i++) {
+	// int row = indexList.getQuick(i);
+	// double value = valueList.getQuick(i);
+	// result.setQuick(i, fun.apply(sum, rowSum[row], colSum[columnIndex],
+	// value));
+	// }
+	// return new NumericalVector(result);
+	// }
+
+	// /**
+	// * For each non zero value in the matrix, get its row in the
+	// * first list, its column in the second list, and its value
+	// * in the third list.
+	// *
+	// * This is a strict delegation to {@link
+	// DoubleMatrix2D#getNonZeros(IntArrayList, IntArrayList, DoubleArrayList)}.
+	// *
+	// * @param rowList
+	// * @param columnList
+	// * @param valueList
+	// */
+	// public void getNonZeros(IntArrayList rowList, IntArrayList columnList,
+	// DoubleArrayList valueList) {
+	// matrix.getNonZeros(rowList, columnList, valueList);
+	// }
+
+	/**
+	 * For each non zero value in the matrix, get its row in the first list, its
+	 * column in the second list, its value in the third list, the total of the
+	 * column of the value in the fourth list, and the total of the row of the
+	 * value in the firth list.
+	 * 
+	 * @param rowList
+	 * @param columnList
+	 * @param valueList
+	 * @param columnMargin
+	 * @param rowMargin
+	 */
+	// public void getNonZerosWithMargin(
+	// IntArrayList rowList,
+	// IntArrayList columnList,
+	// DoubleArrayList valueList,
+	// IntArrayList columnMargin,
+	// IntArrayList rowMargin
+	// ) {
+	// I'm not sure to understand what this function does, but I'm pretty sure
+	// it's buggy
+	// cacheColSum();
+	// cacheRowSum();
+	// matrix.getNonZeros(rowList, columnList, valueList);
+	// columnMargin.setSize(rowList.size());
+	// rowMargin.setSize(rowList.size());
+	// for (int i = 0; i < rowList.size(); i++) {
+	// columnMargin.setQuick(i, colSum[columnList.getQuick(i)]);
+	// rowMargin.setQuick(i, rowSum[rowList.getQuick(i)]);
+	// }
+	// }
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/ContingencyTableImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/QuantitativeDataStructureImpl.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/QuantitativeDataStructureImpl.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/QuantitativeDataStructureImpl.java	(revision 281)
@@ -0,0 +1,205 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (Mon, 06 May 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core.data;
+
+import org.rosuda.REngine.REXP;
+import org.txm.core.results.TXMResult;
+import org.txm.statsengine.core.data.QuantitativeDataStructure;
+import org.txm.statsengine.core.data.Vector;
+import org.txm.statsengine.core.messages.StatsEngineCoreMessages;
+import org.txm.statsengine.r.core.RWorkspace;
+import org.txm.statsengine.r.core.exceptions.RObjectDoesNotExist;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The root of the hierarchy for all classes wrapping R data.
+ * 
+ * @author Sylvain Loiseau &lt;sloiseau@ens-lsh.fr&gt;
+ */
+public abstract class QuantitativeDataStructureImpl extends TXMResult implements QuantitativeDataStructure {
+	
+	/** The counter. */
+	private static int counter = 1;
+
+	/**
+	 * An immutable symbol for the name of this data structure in the R
+	 * workspace.
+	 */
+	protected String symbol;
+
+	/** The R workspace. */
+	protected final RWorkspace rw;
+
+	/**
+	 * This constructor is called by every sub-classes for initializing final
+	 * fields header and symbol.
+	 *
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	protected QuantitativeDataStructureImpl() throws RWorkspaceException {
+		this.symbol = createSymbole();
+		this.rw = RWorkspace.getRWorkspaceInstance();
+	}
+
+	/**
+	 * This constructor is called by every sub-classes for initializing final
+	 * fields header and symbol.
+	 *
+	 * @param symbol the symbol
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	protected QuantitativeDataStructureImpl(String symbol)
+			throws RWorkspaceException {
+		this.rw = RWorkspace.getRWorkspaceInstance();
+		/*if (!rw.containsVariable(symbol)) {
+			throw new RObjectDoesNotExist(
+					Messages.QuantitativeDataStructureImpl_0 + symbol
+							+ Messages.QuantitativeDataStructureImpl_1);
+		}*/
+		this.symbol = symbol;
+	}
+
+	/**
+	 * Create an arbitrary symbol for naming this quantitative data structure
+	 * into the R workspace.
+	 * 
+	 * @return a symbol.
+	 */
+	protected final String createSymbole() {
+		return createSymbole(getClass());
+	}
+
+	/**
+	 * Create an arbitrary symbol for naming this quantitative data structure
+	 * into the R workspace given a class name.
+	 *
+	 * @param aClass the a class
+	 * @return the symbol.
+	 */
+	public final static String createSymbole(Class<?> aClass) {
+		int hash = counter++;
+		// warning : always use the absolute value since the hashCode may
+		// be a negative value; if turned into string, a negative value will
+		// start with "-"
+		// and produce an illegal R variable name. SL, 2009 05 22.
+		String prefix = aClass.getSimpleName();
+		if (prefix.endsWith("Impl")) //$NON-NLS-1$
+			prefix = prefix.substring(0, prefix.length()-4);
+		String s = prefix + String.valueOf(hash);
+		return s;
+	}
+
+	/**
+	 * Remove the object from the R workspace.
+	 *
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	protected void removeFromRWorkspace() throws RWorkspaceException {
+		if (!rw.containsVariable(symbol)) {
+			throw new RObjectDoesNotExist(
+					StatsEngineCoreMessages.QuantitativeDataStructureImpl_2);
+		}
+		rw.voidEval("rm(" + symbol + ")"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	// @Override
+	// /**
+	// * Provide information about the header of this object and basic snapshot
+	// of its content using the <code>str</code> R function.
+	// */
+	// public String toString() {
+	// StringBuffer sb = new StringBuffer();
+	// sb.append(header.toString());
+	// // String representation = "";
+	// // try {
+	// // NO
+	// // representation = rw.eval("str(" + symbol + ")").toString();
+	// // } catch (REXPMismatchException e) {
+	// // representation = " [No representation available for this object.]";
+	// // } catch (RWorkspaceException e) {
+	// // representation = " [No representation available for this object.]";
+	// // }
+	// return sb.toString();
+	// }
+
+	/**
+	 * Add the given key-value attribute pair to the wrapped R object.
+	 *
+	 * @param name the name
+	 * @param vals the vals
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	protected void setAttribute(String name, String[] vals)
+			throws RWorkspaceException {
+		Vector attr = new VectorImpl(vals);
+
+		StringBuffer exp = new StringBuffer();
+		exp.append("attr("); //$NON-NLS-1$
+		exp.append(symbol);
+		exp.append(","); //$NON-NLS-1$
+		exp.append(name);
+		exp.append(")"); //$NON-NLS-1$
+		exp.append("<-"); //$NON-NLS-1$
+		exp.append(attr.getSymbol());
+		exp.append(";"); //$NON-NLS-1$
+
+		rw.voidEval(exp.toString());
+		rw.voidEval("rm(" + attr.getSymbol() + ");"); //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Get an attribute on a R object.
+	 *
+	 * @param name of the attribute
+	 * @return the attribute as a REXP object, since the attribute may be every
+	 * data type.
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	protected REXP getAttribute(String name) throws RWorkspaceException {
+		StringBuffer exp = new StringBuffer();
+		exp.append("attr("); //$NON-NLS-1$
+		exp.append(symbol);
+		exp.append(","); //$NON-NLS-1$
+		exp.append(name);
+		exp.append(")"); //$NON-NLS-1$
+		exp.append(";"); //$NON-NLS-1$
+
+		return rw.eval(exp.toString());
+	}
+
+	/**
+	 * Gets the symbol, ie. the name of the data structure in R.
+	 * 
+	 * @return the symbol
+	 */
+	@Override
+	public String getSymbol() {
+		return symbol;
+	}
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/QuantitativeDataStructureImpl.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/Factor.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/Factor.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/Factor.java	(revision 281)
@@ -0,0 +1,85 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (Mon, 06 May 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core.data;
+
+import org.txm.statsengine.core.messages.StatsEngineCoreMessages;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A wrapper on a R "factor".
+ * 
+ * @author sloiseau
+ * 
+ */
+public class Factor extends QuantitativeDataStructureImpl {
+
+	/**
+	 * Create a factor.
+	 *
+	 * @param values the values of the factor.
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public Factor(String values) throws RWorkspaceException {
+		throw new UnsupportedOperationException(StatsEngineCoreMessages.Factor_0);
+	}
+
+	/**
+	 * The levels are the unordered set of dif ferent values present in the
+	 * factor.
+	 *
+	 * @return the levels
+	 */
+	public String[] getLevels() {
+		throw new UnsupportedOperationException(StatsEngineCoreMessages.Factor_0);
+	}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getSimpleName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public String getDetails() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/Factor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/package.html
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/package.html	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/package.html	(revision 281)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Implementation of quantitative data structures for representing corpus, as defined in package <code>org.txm.stat.data</code>, wrapping and hidding R data structures.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/DoubleMatrix.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/DoubleMatrix.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/DoubleMatrix.java	(revision 281)
@@ -0,0 +1,88 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (Mon, 06 May 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core.data;
+
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+
+import cern.colt.matrix.DoubleMatrix2D;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A double matrix, backed to the R engine.
+ * 
+ * @author sloiseau
+ */
+public class DoubleMatrix extends MatrixImpl {
+
+	/**
+	 * Instantiates a new double matrix.
+	 *
+	 * @param matrix the matrix
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public DoubleMatrix(DoubleMatrix2D matrix) throws RWorkspaceException {
+		super(matrix);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new double matrix.
+	 *
+	 * @param mat the mat
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public DoubleMatrix(double[][] mat) throws RWorkspaceException {
+		super(mat);
+	}
+
+	/**
+	 * Instantiates a new double matrix.
+	 *
+	 * @param symbol the symbol
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public DoubleMatrix(String symbol) throws RWorkspaceException {
+		super(symbol);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new double matrix.
+	 *
+	 * @param matrix the matrix
+	 * @param rowNames the row names
+	 * @param columnNames the column names
+	 * @throws RWorkspaceException the r workspace exception
+	 */
+	public DoubleMatrix(DoubleMatrix2D matrix, String[] rowNames,
+			String[] columnNames) throws RWorkspaceException {
+		super(matrix, rowNames, columnNames);
+		// TODO Auto-generated constructor stub
+	}
+
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/DoubleMatrix.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RConstant.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RConstant.java	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RConstant.java	(revision 281)
@@ -0,0 +1,47 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (Mon, 06 May 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.statsengine.r.core;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class RConstant.
+ */
+public class RConstant {
+	
+	/** The Constant LIST_EXTRACTOR. */
+	public final static String LIST_EXTRACTOR = "$"; //$NON-NLS-1$
+	
+	/** The Constant OPEN_PAREN. */
+	public final static String OPEN_PAREN = "("; //$NON-NLS-1$
+	
+	/** The Constant CLOSE_PAREN. */
+	public final static String CLOSE_PAREN = ")"; //$NON-NLS-1$
+	
+	/** The Constant AFFECTATION. */
+	public final static String AFFECTATION = "<-"; //$NON-NLS-1$
+}

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RConstant.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/package.html
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/package.html	(revision 0)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/package.html	(revision 281)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Root package of the implementation of a stat engine using the R piece of software (<a href="http://www.r-project.org">http://www.r-project.org</a>.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/RWorkspace.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/RWorkspace.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/ConnectToRserve.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/ConnectToRserve.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/messages/messages.properties
===================================================================
--- tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/messages/messages.properties	(revision 0)
+++ tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/messages/messages.properties	(revision 281)
@@ -0,0 +1,57 @@
+
+Error_CONNECTION_FAILED_2                      = ** Error while connecting to the stat engine.
+Error_FAILED_TO_KILL_RSERVE                    = Failed to exec 'taskkill /IM Rserve.exe /F': 
+Error_FAILED_TO_KILL_RSERVE_2                  = Failed to exec 'tskill Rserve.exe': 
+Error_FAILED_TO_KILL_RSERVE_3                  = Failed to exec 'killall -9 Rserve-bin.so': 
+Error_STATS_ENGINE_NOT_READY_CANCELING_COMMAND = Statistics Engine is not ready, canceling command.
+
+LIBRARY_NOT_LOADED = Failed to load the {0} library: {1}
+
+Log_DEBUG                 = debug:
+Log_PORT                  = \ port: 
+Log_REMOTE                = \ remote:
+Log_STARTING_STATS_ENGINE = Starting Statistics Engine: user: 
+
+RException_0 = ** R error: "
+RException_1 = "
+RException_2 = \nwhile evaluating: 
+
+RSERVE_ACTIVATED          = Statistics Engine running 
+RSERVE_PATH_NOT_SET_ERROR = ** The Statistics Engine program path is not set and we could not find it
+RSERVE_PATH_SET_ERROR     = ** The Statistics Engine program path is set but we couldn't find it
+
+RWorkspace_0  = ** Failed to connect to the R Workspace 
+RWorkspace_1  = ** Evaluation Error: 
+RWorkspace_10 = Starting R using path: 
+RWorkspace_11 = Last safeeval: 
+RWorkspace_2  = try : connect to R at 
+RWorkspace_21 = Full command: 
+RWorkspace_3  = Saving graphic in file 
+RWorkspace_6  = ** Failed to initialize file transfert: 
+RWorkspace_7  = Matrix is empty
+RWorkspace_8  = Failed to start RServe : 
+
+R_EXPR                    = Expression sent to the Statistics Engine for evaluation: {0}.
+R_READ_CONSOLE            = The Statistics Engine waits for something to read from the console ({0}, {1}).
+R_SAVE_HISTORY            = The Statistics Engine has saved an history ({0}).
+R_SHOW_MESSAGE            = The Statistics Engine displayed this message: {0}.
+R_WRITE_CONSOLE           = The Statistics Engine displayed this message in the console: {0}.
+
+StartRserve_0  = Starting R with command line: 
+StartRserve_2  = No R path given, trying to find it...
+StartRserve_21 = ** Failed to start Rserve with command: 
+StartRserve_22 = Statistical Engine launched
+StartRserve_28 = ** Failed to run REG to find the location of R program: 
+StartRserve_29 = \ You need the 'R' software and you need to configure in the 'Tools/Preferences' window the correct path to it.
+StartRserve_3  = Rserve already running on port 
+StartRserve_4  = try R path : 'R'
+StartRserve_6  = try R path : 
+
+
+CHAR_VECTOR_ADDED_TO_WORKSPACE = Vector "{1}" ({0,number,integer} "character") has been transmited to the Statistics Engine.
+CONNECTED_TO_STATS_MODULE = connected.
+CONNECTION_OK = Connected to the Statistics Engine.
+
+ERROR_EXTRACT_ITEM = ** Error extracting list item: 
+
+REQUESTED_OBJECT_NOT_FOUND_IN_R = The requested object ({0}) was not found in the R workspace.
Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/messages/RCoreMessages.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/messages/RCoreMessages.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/messages/messages_ru.properties
===================================================================
Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/messages/messages_fr.properties
===================================================================
--- tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/messages/messages_fr.properties	(revision 0)
+++ tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/messages/messages_fr.properties	(revision 281)
@@ -0,0 +1,58 @@
+
+Error_CONNECTION_FAILED_2                      = ** La connexion au moteur statistique a échoué.
+Error_FAILED_TO_KILL_RSERVE                    = Echec de la commande 'taskkill /IM Rserve.exe /F': 
+Error_FAILED_TO_KILL_RSERVE_2                  = Echec de la commande 'tskill Rserve.exe': 
+Error_FAILED_TO_KILL_RSERVE_3                  = Echec de la commande 'killall -9 Rserve-bin.so': 
+Error_STATS_ENGINE_NOT_READY_CANCELING_COMMAND = Le moteur de statistiques n'est pas initialisé, annulation de la commande.
+
+LIBRARY_NOT_LOADED = La librairie {0} n''a pu être chargée : {1}
+
+Log_DEBUG                 = debug : 
+Log_PORT                  = \ port : 
+Log_REMOTE                = \ distant : 
+Log_STARTING_STATS_ENGINE = Démarrage du moteur de statistiques par l'utilisateur :
+
+RException_0 = ** Erreur R : "
+RException_1 = "
+RException_2 = \n lors de l'évaluation de :
+
+RSERVE_ACTIVATED          = Moteur Statistique lancé 
+RSERVE_PATH_NOT_SET_ERROR = ** Le chemin du programme du serveur statistique n'a pas été renseigné et sa recherche a échoué
+RSERVE_PATH_SET_ERROR     = ** Le chemin du programme du serveur statistique a été renseigné mais sa recherche a échoué
+
+RWorkspace_0  = ** Echec de connexion à l'espace de travail R 
+RWorkspace_1  = ** Erreur d'évaluation : 
+RWorkspace_10 = Démarrage de R avec le chemin d'accès: 
+RWorkspace_11 = Dernier 'safeeval'
+RWorkspace_2  = tentative de connexion à R : 
+RWorkspace_21 = Commande complète : 
+RWorkspace_3  = Sauvegarde du graphique dans le fichier 
+RWorkspace_6  = ** Echec de l'initialisation du transfert : 
+RWorkspace_7  = La matrice est vide
+RWorkspace_8  = Impossible de démarrer RServe : 
+
+R_EXPR                    = Expression transmise au Moteur Statistique pour évaluation : {0}.
+R_READ_CONSOLE            = Le Moteur Statistique attend une réponse de la console ({0}, {1}).
+R_SAVE_HISTORY            = Le Moteur Statistique a sauvegardé un historique ({0}).
+R_SHOW_MESSAGE            = Le Moteur Statistique a affiché ce message : {0}.
+R_WRITE_CONSOLE           = Le Moteur Statistique a afiché ce message dans la console: {0}.
+
+StartRserve_0  = Démarrage de R avec la ligne de commande: 
+StartRserve_2  = Chemin d'accès à R non fourni, tentative de résolution...
+StartRserve_21 = ** Echec du lancement de Rserve avec la commande : 
+StartRserve_22 = Moteur statistique lancé
+StartRserve_28 = ** Echec du lancement de REG pour localiser le programme R
+StartRserve_29 = \ Vous avez besoin du logiciel 'R' et de configurer ses chemins via la fenêtre de préférences 'Outils/Préférences'
+StartRserve_3  = Rserve déja démarré sur le port 
+StartRserve_4  = Essai du chemin de R : 'R'
+StartRserve_6  = Essai du chemin de R : 
+
+
+CHAR_VECTOR_ADDED_TO_WORKSPACE = Le vecteur "{1}" ({0,number,integer} valeurs "character") a été transmis au Moteur Statistique.
+CONNECTED_TO_STATS_MODULE = connecté.
+CONNECTION_OK = Connexion au Moteur Statistique établie.
+ERROR_EXTRACT_ITEM = ** Erreur lors de l'extraction de la liste d'items : \	
+REQUESTED_OBJECT_NOT_FOUND_IN_R = L'objet demandé ({0}) n'a pas été trouvé dans l'espace de travail R.
+
+
+
Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/RserveWatcher.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/RserveWatcher.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/StartRserve.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/StartRserve.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/VectorImpl.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/VectorImpl.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/MatrixImpl.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/MatrixImpl.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/ContingencyTableImpl.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/ContingencyTableImpl.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/package.html
===================================================================
--- tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/package.html	(revision 0)
+++ tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/package.html	(revision 281)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Implementation of quantitative data structures for representing corpus, as defined in package <code>org.txm.stat.data</code>, wrapping and hidding R data structures.</p>
+</body>
+</html>
\ No newline at end of file
Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/QuantitativeDataStructureImpl.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/QuantitativeDataStructureImpl.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/Factor.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/Factor.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/DoubleMatrix.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/data/DoubleMatrix.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/RStatsEngine.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/RStatsEngine.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/RFileCommunication.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/RFileCommunication.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/package.html
===================================================================
--- tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/package.html	(revision 0)
+++ tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/package.html	(revision 281)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Root package of the implementation of a stat engine using the R piece of software (<a href="http://www.r-project.org">http://www.r-project.org</a>.</p>
+</body>
+</html>
\ No newline at end of file
Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/RConstant.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/RConstant.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/exceptions/RWorkspaceException.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/exceptions/RWorkspaceException.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/exceptions/RException.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/exceptions/RException.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/exceptions/RObjectDoesNotExist.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/exceptions/RObjectDoesNotExist.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/exceptions/RServeException.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/exceptions/RServeException.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/exceptions/RObjectAlreadyExist.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/exceptions/RObjectAlreadyExist.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/preferences/RPreferences.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/preferences/RPreferences.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/rcolt/RColt$CreateIntArray.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/rcolt/RColt$CreateIntArray.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/rcolt/package.html
===================================================================
--- tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/rcolt/package.html	(revision 0)
+++ tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/rcolt/package.html	(revision 281)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Converting colt data structure into data structure suited for the R language (mainly vectorized version of matrix).</p>
+</body>
+</html>
\ No newline at end of file
Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/rcolt/RColt$CreateIntIntArray.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/rcolt/RColt$CreateIntIntArray.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/rcolt/RColt.class
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.statsengine.r.core/bin/org/txm/statsengine/r/core/rcolt/RColt.class
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tmp/org.txm.statsengine.r.core/build.properties
===================================================================
--- tmp/org.txm.statsengine.r.core/build.properties	(revision 0)
+++ tmp/org.txm.statsengine.r.core/build.properties	(revision 281)
@@ -0,0 +1,3 @@
+output.. = bin/
+bin.includes = META-INF/,\
+               plugin.xml

Property changes on: tmp/org.txm.statsengine.r.core/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/plugin.xml
===================================================================
--- tmp/org.txm.statsengine.r.core/plugin.xml	(revision 0)
+++ tmp/org.txm.statsengine.r.core/plugin.xml	(revision 281)
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer
+            class="org.txm.statsengine.r.core.preferences.RPreferences">
+      </initializer>
+   </extension>
+
+</plugin>

Property changes on: tmp/org.txm.statsengine.r.core/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- tmp/org.txm.statsengine.r.core/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ tmp/org.txm.statsengine.r.core/.settings/org.eclipse.jdt.core.prefs	(revision 281)
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6

Property changes on: tmp/org.txm.statsengine.r.core/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/.classpath
===================================================================
--- tmp/org.txm.statsengine.r.core/.classpath	(revision 0)
+++ tmp/org.txm.statsengine.r.core/.classpath	(revision 281)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Property changes on: tmp/org.txm.statsengine.r.core/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.statsengine.r.core/META-INF/MANIFEST.MF	(revision 0)
+++ tmp/org.txm.statsengine.r.core/META-INF/MANIFEST.MF	(revision 281)
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: R Statistics Engine Core
+Bundle-SymbolicName: org.txm.statsengine.r.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Require-Bundle: org.txm.libs.colt;bundle-version="1.0.0";visibility:=reexport,
+ org.txm.libs.rserve;bundle-version="0.0.0";visibility:=reexport,
+ org.txm.statsengine.core;bundle-version="1.0.0";visibility:=reexport,
+ org.txm.core;bundle-version="0.7.0",
+ org.eclipse.core.runtime
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.txm.statsengine.r.core,
+ org.txm.statsengine.r.core.data,
+ org.txm.statsengine.r.core.exceptions,
+ org.txm.statsengine.r.core.messages,
+ org.txm.statsengine.r.core.preferences,
+ org.txm.statsengine.r.core.rcolt
+Bundle-Vendor: Textometrie.org

Property changes on: tmp/org.txm.statsengine.r.core/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.statsengine.r.core/.project
===================================================================
--- tmp/org.txm.statsengine.r.core/.project	(revision 0)
+++ tmp/org.txm.statsengine.r.core/.project	(revision 281)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.statsengine.r.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: tmp/org.txm.statsengine.r.core/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

