Index: tmp/org.txm.core/src/java/org/txm/functions/Function.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/Function.java	(revision 443)
+++ tmp/org.txm.core/src/java/org/txm/functions/Function.java	(revision 444)
@@ -1,178 +0,0 @@
-// 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: 2016-09-19 10:31:00 +0200 (Mon, 19 Sep 2016) $
-// $LastChangedRevision: 3298 $
-// $LastChangedBy: mdecorde $ 
-//
-package org.txm.functions;
-
-import java.io.File;
-
-import org.txm.core.results.ITXMResult;
-import org.txm.core.results.TXMResult;
-
-/**
- * 
- * Function which produces a result of Textometry computation
- * 
- * The abstract Class Function.
- * 
- * Has methods to interact with a ProcessWatcher: set work amount, set messages, acquire/release interruption semaphore.
- * 
- *  @author mdecorde
- *  @author nkredens
- */
-public abstract class Function extends TXMResult {
-	
-	/**
-	 * 
-	 */
-	protected ProgressWatcher monitor;
-	
-	
-	
-	/**
-	 * 
-	 */
-	public Function() {
-		super();
-	}
-
-	/**
-	 * 
-	 * @param parent
-	 */
-	public Function(ITXMResult parent) {
-		super(parent);
-	}
-
-	/**
-	 * You must set the current monitor to be available to manage the process progress
-	 * @param monitor
-	 */
-	public void setCurrentMonitor(ProgressWatcher monitor) {
-		this.monitor = monitor;
-	}
-	
-	/**
-	 * increment the process 
-	 * @param amount of work
-	 */
-	public void worked(int amount) {
-		if (monitor != null) {
-			//System.out.println("worked "+amount);
-			monitor.worked(amount);
-		}
-	}
-	
-	/**
-	 * increment the progress and show a message
-	 * @param amount
-	 * @param message
-	 */
-	public void worked(int amount, String message) {
-		if (monitor != null) {
-			monitor.worked(amount, message);
-		}
-	}
-	
-	/**
-	 * show a message in progress
-	 * @param message
-	 */
-	public void setMessage(String message) {
-		if (monitor != null)
-			monitor.setMessage(message);
-	}
-	
-	/**
-	 * 
-	 * @return true if the monitor has been canceled by the user
-	 */
-	public boolean isCanceled() {
-		if (monitor != null) {
-			return monitor.isCanceled();
-		}
-		return false;
-	}
-	
-	public void done() {
-		if (monitor != null) {
-			monitor.done();
-		}
-	}
-	
-	public void acquireSemaphore() {
-		if (monitor != null)
-			monitor.acquireSemaphore();
-	}
-	
-	public boolean tryAcquireSemaphore() {
-		if (monitor != null)
-			return monitor.tryAcquireSemaphore();
-		else
-			return false;
-	}
-	
-	public void releaseSemaphore() {
-		if (monitor != null)
-			monitor.releaseSemaphore();
-	}
-	
-	//public abstract boolean toTxt(File file, String encoding) throws Exception;
-	@Deprecated
-	//FIXME: should be moved in an exporter extension
-	public abstract boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception;
-	
-	
-	
-
-	
-	/**
-	 * 
-	 * @return the array of extensions to show in the FileDialog SWT widget
-	 */
-	@Deprecated
-	//FIXME: should be moved in an exporter extension
-	public String[] getExportTXTExtensions() {
-		return new String[]{"*.csv"};
-	}
-	
-	/**
-	 * 
-	 * @return the parent Object that contains this result
-	 */
-	@Deprecated
-	// FIXME: to remove when TXMResult2 will be fully implemented
-	//public abstract HasResults getHasResultsParent();
-	
-	/**
-	 * Used by the Corpora view to open an editor from a double-clicked element.
-	 * Extension functions must override this method to open an editor from their produced results
-	 * @return
-	 */
-	public boolean openEditor() {
-		return false;
-	}
-}
Index: tmp/org.txm.core/src/java/org/txm/functions/TXMCommand.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/TXMCommand.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/functions/TXMCommand.java	(revision 444)
@@ -0,0 +1,240 @@
+// 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: 2016-09-19 10:31:00 +0200 (Mon, 19 Sep 2016) $
+// $LastChangedRevision: 3298 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.functions;
+
+import java.io.File;
+
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMParameters;
+import org.txm.core.results.TXMResult;
+
+/**
+ * 
+ * Function which produces a result of Textometry computation
+ * 
+ * The abstract Class Function.
+ * 
+ * Has methods to interact with a ProcessWatcher: set work amount, set messages, acquire/release interruption semaphore.
+ * 
+ *  @author mdecorde
+ *  @author nkredens
+ */
+public abstract class TXMCommand extends TXMResult {
+
+
+	/**
+	 * 
+	 */
+	protected ProgressWatcher monitor;
+	
+	
+	
+	public TXMCommand() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	public TXMCommand(TXMResult parent, TXMParameters parameters) {
+		super(parent, parameters);
+		// TODO Auto-generated constructor stub
+	}
+
+	public TXMCommand(TXMResult parent) {
+		super(parent);
+		// TODO Auto-generated constructor stub
+	}
+
+	
+	/**
+	 * You must set the current monitor to be available to manage the process progress
+	 * @param monitor
+	 */
+	public void setCurrentMonitor(ProgressWatcher monitor) {
+		this.monitor = monitor;
+	}
+	
+	/**
+	 * increment the process 
+	 * @param amount of work
+	 */
+	public void worked(int amount) {
+		if (monitor != null) {
+			//System.out.println("worked "+amount);
+			monitor.worked(amount);
+		}
+	}
+	
+	/**
+	 * increment the progress and show a message
+	 * @param amount
+	 * @param message
+	 */
+	public void worked(int amount, String message) {
+		if (monitor != null) {
+			monitor.worked(amount, message);
+		}
+	}
+	
+	/**
+	 * show a message in progress
+	 * @param message
+	 */
+	public void setMessage(String message) {
+		if (monitor != null)
+			monitor.setMessage(message);
+	}
+	
+	/**
+	 * 
+	 * @return true if the monitor has been canceled by the user
+	 */
+	public boolean isCanceled() {
+		if (monitor != null) {
+			return monitor.isCanceled();
+		}
+		return false;
+	}
+	
+	public void done() {
+		if (monitor != null) {
+			monitor.done();
+		}
+	}
+	
+	public void acquireSemaphore() {
+		if (monitor != null)
+			monitor.acquireSemaphore();
+	}
+	
+	public boolean tryAcquireSemaphore() {
+		if (monitor != null)
+			return monitor.tryAcquireSemaphore();
+		else
+			return false;
+	}
+	
+	public void releaseSemaphore() {
+		if (monitor != null)
+			monitor.releaseSemaphore();
+	}
+	
+	//public abstract boolean toTxt(File file, String encoding) throws Exception;
+	@Deprecated
+	//FIXME: should be moved in an exporter extension
+	public abstract boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws Exception;
+	
+	
+	
+
+	
+	/**
+	 * 
+	 * @return the array of extensions to show in the FileDialog SWT widget
+	 */
+	@Deprecated
+	//FIXME: should be moved in an exporter extension
+	public String[] getExportTXTExtensions() {
+		return new String[]{"*.csv"};
+	}
+	
+	/**
+	 * 
+	 * @return the parent Object that contains this result
+	 */
+	@Deprecated
+	// FIXME: to remove when TXMResult2 will be fully implemented
+	//public abstract HasResults getHasResultsParent();
+	
+	/**
+	 * Used by the Corpora view to open an editor from a double-clicked element.
+	 * Extension functions must override this method to open an editor from their produced results
+	 * @return
+	 */
+	public boolean openEditor() {
+		return false;
+	}
+	
+	
+	/**
+	 * Computes the result according to specified command parameters.
+	 * @param parameters
+	 * @return
+	 */
+	public boolean compute()	{
+		return this.compute(null);
+	}
+	
+
+	/**
+	 * Computes the result according to stored command parameters.
+	 * @param watcher
+	 * @return
+	 */
+	public abstract boolean compute(ProgressWatcher watcher);
+	
+
+	/**
+	 * Computes the result according to specified command parameters.
+	 * @param watcher
+	 * @param parameters
+	 * @return
+	 */
+	public boolean compute(ProgressWatcher watcher, TXMParameters parameters) {
+		this.parameters = parameters;
+		return this.compute(watcher);
+	}
+	
+	
+	//FIXME: tests for forcing to redefine, ex. Cooccurrence.compute(int minLeft, int maxLeft, etc.)
+//	public abstract boolean compute(Object... parameters);
+		
+	
+	
+	/**
+	 * 
+	 * @param step
+	 */
+	//FIXME: proposals to computing
+	//public abstract void compute(int step);
+	//FIXME: proposals to computing
+//	public boolean compute(int start, int end)	{
+//		for(int i = start; i <= end; i++) {
+//			if(Thread.interrupted())	{
+//				this.clean();
+//				return false;
+//			}
+//			this.compute(i);
+//		}
+//		return true;
+//	}
+	
+	
+	
+
+	
+}

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

Index: tmp/org.txm.core/src/java/org/txm/functions/CommandsAPI.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/CommandsAPI.java	(revision 443)
+++ tmp/org.txm.core/src/java/org/txm/functions/CommandsAPI.java	(revision 444)
@@ -3,6 +3,7 @@
 import java.util.HashMap;
 import java.util.HashSet;
 
+import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
 import org.txm.utils.logger.Log;
 
@@ -24,7 +25,7 @@
 	
 	protected static final HashMap<String, Command> cmds = new HashMap<String, Command>();
 	
-	public static void install(String cmd, Class<TXMResult> clazz) {
+	public static void install(String cmd, Class<TXMCommand> clazz) {
 		CommandsAPI.cmds.put(cmd, new Command(cmd,clazz));
 	}
 	
@@ -49,7 +50,7 @@
 	 * @param clazz
 	 * @param mandatory_parameters
 	 */
-	public static void install(String cmd, Class<TXMResult> clazz, HashSet<String> mandatoryParameters) {
+	public static void install(String cmd, Class<TXMCommand> clazz, HashSet<String> mandatoryParameters) {
 		Command command = new Command(cmd,clazz);
 		command.mandatoryParameters.addAll(mandatoryParameters);
 		CommandsAPI.cmds.put(cmd, command);
@@ -63,7 +64,7 @@
 	 * @param mandatory_parameters
 	 * @param optional_parameters
 	 */
-	public static void install(String cmd, Class<TXMResult> clazz, HashSet<String> mandatoryParameters, HashSet<String> optionalParameters) {
+	public static void install(String cmd, Class<TXMCommand> clazz, HashSet<String> mandatoryParameters, HashSet<String> optionalParameters) {
 		Command command = new Command(cmd,clazz);
 		command.mandatoryParameters.addAll(mandatoryParameters);
 		command.optionalParameters.addAll(optionalParameters);
@@ -79,7 +80,8 @@
 		CommandsAPI.cmds.remove(cmd);
 	}
 	
-	public Object call(String cmd, TXMResult parent, HashMap<String, Object> parameters) {
+	//FIXME: the source is not used, see if we decide to put it the TXMParameters or not, otherwise define a method TXMResult.setSource() or maybe better a method TXMResult.compute(TXMResul source)
+	public Object call(String cmd, TXMResult source, TXMParameters parameters) {
 		
 		Command command = cmds.get(cmd);
 		if (command == null) {
@@ -88,13 +90,15 @@
 		}
 		
 		// compute directly the command using the parameters 
-		TXMResult result = null;
+		TXMCommand result = null;
 		try {
 			if (command.mandatoryParameters.containsAll(parameters.keySet())) {
 				System.out.println("Computing "+command.cmd+"...");
 				result = command.clazz.newInstance();
-				//result.compute(parameters);
-				//System.out.println(result);
+				result.setParameters(parameters);
+				result.compute();
+				//FIXME: debug
+				System.out.println(result);
 			} else {
 				System.out.println("Failed to compute result with "+cmd+" command: missing some mandatory parameters: "+command.mandatoryParameters);
 			}
Index: tmp/org.txm.core/src/java/org/txm/functions/Command.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/Command.java	(revision 443)
+++ tmp/org.txm.core/src/java/org/txm/functions/Command.java	(revision 444)
@@ -13,16 +13,16 @@
 public class Command {
 	
 	public final String cmd;
-	public final Class<TXMResult> clazz;
+	public final Class<TXMCommand> clazz;
 	public final HashSet<String> mandatoryParameters = new HashSet<String>();
 	public final HashSet<String> optionalParameters = new HashSet<String>();
 	
-	public Command(Class<TXMResult> clazz) {
+	public Command(Class<TXMCommand> clazz) {
 		this.cmd = clazz.getSimpleName();
 		this.clazz = clazz;
 	}
 	
-	public Command(String cmd, Class<TXMResult> clazz) {
+	public Command(String cmd, Class<TXMCommand> clazz) {
 		this.cmd = cmd;
 		this.clazz = clazz;
 	}
