Index: tmp/org.txm.specificities.core/build.properties
===================================================================
--- tmp/org.txm.specificities.core/build.properties	(revision 0)
+++ tmp/org.txm.specificities.core/build.properties	(revision 73)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml

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

Index: tmp/org.txm.specificities.core/plugin.xml
===================================================================
--- tmp/org.txm.specificities.core/plugin.xml	(revision 0)
+++ tmp/org.txm.specificities.core/plugin.xml	(revision 73)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.txm.chartsengine.chartcreator">
+      <ChartCreator
+            chartsEngineName="jfreechart_charts_engine"
+            class="org.txm.specificities.core.chartsengine.jfreechart.JFCSpecificitiesBarChartCreator"
+            fileNamePrefix="specificities">
+      </ChartCreator>
+      <ChartCreator
+            chartsEngineName="r_charts_engine"
+            class="org.txm.specificities.core.chartsengine.r.RSpecificitiesBarChartCreator"
+            fileNamePrefix="specificities">
+      </ChartCreator>
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.preferences">
+      <initializer
+            class="org.txm.specificities.core.preferences.SpecificitiesPreferences">
+      </initializer>
+   </extension>
+
+</plugin>

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

Index: tmp/org.txm.specificities.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- tmp/org.txm.specificities.core/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ tmp/org.txm.specificities.core/.settings/org.eclipse.jdt.core.prefs	(revision 73)
@@ -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.specificities.core/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.specificities.core/.classpath
===================================================================
--- tmp/org.txm.specificities.core/.classpath	(revision 0)
+++ tmp/org.txm.specificities.core/.classpath	(revision 73)
@@ -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.specificities.core/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.specificities.core/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.specificities.core/META-INF/MANIFEST.MF	(revision 0)
+++ tmp/org.txm.specificities.core/META-INF/MANIFEST.MF	(revision 73)
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Specificities Core
+Bundle-SymbolicName: org.txm.specificities.core;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.txm.chartsengine.core;bundle-version="1.0.0",
+ org.txm.core,
+ org.txm.chartsengine.jfreechart.core;bundle-version="1.0.0",
+ org.txm.chartsengine.r.core;bundle-version="1.0.0",
+ org.eclipse.core.runtime;bundle-version="3.10.0"
+Export-Package: org.txm.specificities.core.chartsengine.jfreechart,
+ org.txm.specificities.core.chartsengine.r,
+ org.txm.specificities.core.functions,
+ org.txm.specificities.core.messages,
+ org.txm.specificities.core.preferences

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

Index: tmp/org.txm.specificities.core/.project
===================================================================
--- tmp/org.txm.specificities.core/.project	(revision 0)
+++ tmp/org.txm.specificities.core/.project	(revision 73)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.specificities.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.specificities.core/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/messages/TBXSpecificitiesMessages.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/messages/TBXSpecificitiesMessages.java	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/messages/TBXSpecificitiesMessages.java	(revision 73)
@@ -0,0 +1,21 @@
+package org.txm.specificities.core.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+
+
+public class TBXSpecificitiesMessages extends NLS {
+
+	private static final String BUNDLE_NAME = "org.txm.specificities.core.messages.messages"; //$NON-NLS-1$
+
+	public static String ChartsEngine_SPECIFICITIES_X_AXIS_LABEL;
+	public static String ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL;
+	public static String ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL;
+
+
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, TBXSpecificitiesMessages.class);
+	}
+
+}

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

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/messages/messages_fr.properties
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/messages/messages_fr.properties	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/messages/messages_fr.properties	(revision 73)
@@ -0,0 +1,3 @@
+ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL=Banalit� : {0}
+ChartsEngine_SPECIFICITIES_X_AXIS_LABEL=Partie
+ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL=Score
\ No newline at end of file

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

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/messages/messages.properties
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/messages/messages.properties	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/messages/messages.properties	(revision 73)
@@ -0,0 +1,3 @@
+ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL=Banality: {0}
+ChartsEngine_SPECIFICITIES_X_AXIS_LABEL=Part
+ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL=Score

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

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Chi2.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Chi2.java	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Chi2.java	(revision 73)
@@ -0,0 +1,50 @@
+package org.txm.specificities.core.functions;
+
+import org.txm.functions.contrasts.Contrast;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.stat.StatException;
+import org.txm.stat.data.LexicalTable;
+import org.txm.stat.engine.r.RWorkspace;
+
+public class Chi2 extends Contrast {
+	public Chi2(Corpus corpus, Subcorpus subcorpus, Property property)
+			throws StatException, CqiClientException {
+		super(corpus, subcorpus, property);
+		// TODO Auto-generated constructor stub
+	}
+
+	public Chi2(Partition partition, Property property, int Fmin)
+			throws StatException, CqiClientException {
+		super(partition, property, Fmin);
+		// TODO Auto-generated constructor stub
+	}
+
+
+	public Chi2(LexicalTable table) {
+		super(table);
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public boolean compute() throws StatException {
+		colNames = table.getColNames().asStringsArray();
+		rowNames = table.getRowNames().asStringsArray();
+		frequencies = RWorkspace.getRWorkspaceInstance().evalToInt2D(table.getSymbol());
+		
+		// compute
+		String cmd = "mat <- "+table.getSymbol()+"\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+					" mat2 <- rowSums(mat) %o% colSums(mat) / sum(mat)"+"\n"+ //$NON-NLS-1$ //$NON-NLS-2$
+					symbol +" <- (mat - mat2) ^ 2 / mat2"; //$NON-NLS-1$
+		indices = RWorkspace.getRWorkspaceInstance().evalToDouble2D(cmd);
+		return true;
+	}
+
+	@Override
+	public String getName() {
+		return "Chi2"; //$NON-NLS-1$
+	}
+}

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

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitesException.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitesException.java	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitesException.java	(revision 73)
@@ -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 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.specificities.core.functions;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SpecificitesException.
+ *
+ * @author sloiseau
+ */
+public class SpecificitesException extends Exception {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 4206288552541531386L;
+
+	/**
+	 * Instantiates a new specificites exception.
+	 */
+	public SpecificitesException() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new specificites exception.
+	 *
+	 * @param arg0 the arg0
+	 * @param arg1 the arg1
+	 */
+	public SpecificitesException(String arg0, Throwable arg1) {
+		super(arg0, arg1);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new specificites exception.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public SpecificitesException(String arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+
+	/**
+	 * Instantiates a new specificites exception.
+	 *
+	 * @param arg0 the arg0
+	 */
+	public SpecificitesException(Throwable arg0) {
+		super(arg0);
+		// TODO Auto-generated constructor stub
+	}
+}

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

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitesResult.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitesResult.java	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitesResult.java	(revision 73)
@@ -0,0 +1,840 @@
+// 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: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.specificities.core.functions;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.rosuda.REngine.REXPMismatchException;
+import org.txm.core.chartsengine.r.__RDevice;
+import org.txm.functions.Function;
+import org.txm.functions.TXMResult;
+import org.txm.functions.progression.Progression;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.Lexicon;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.stat.StatException;
+import org.txm.stat.data.LexicalTable;
+import org.txm.stat.data.Matrix;
+import org.txm.stat.data.Vector;
+import org.txm.stat.engine.r.RWorkspace;
+import org.txm.stat.engine.r.data.DoubleMatrix;
+import org.txm.stat.engine.r.data.VectorImpl;
+import org.txm.stat.utils.ArrayIndex;
+import org.txm.stat.utils.CheckArray;
+import org.txm.stat.utils.VectorizeArray;
+import org.txm.HasResults;
+import org.txm.Messages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Hold specificites computation result.
+ * 
+ * @author sloiseau
+ * 
+ */
+public class SpecificitesResult extends Function implements TXMResult  {
+
+	public static int MAXSPECIF = 1000;
+
+	/** The indices. */
+	private final double[][] indices;
+
+	/** The table. */
+	private final LexicalTable table;
+
+	/** The rowindex. */
+	private int[] rowindex = null;
+
+	/** The colindex. */
+	private int[] colindex = null;
+
+	/** The frequencies. */
+	private int[][] frequencies = null;
+
+	/** The lexicon. */
+	private Lexicon lexicon;
+
+	/** The sub lexicon. */
+	private Lexicon subLexicon;
+
+	/** The colnames. */
+	private List<String> colnames = null;
+
+	/** The rownames. */
+	private List<String> rownames = null;
+
+	/** The corpus. */
+	private Corpus corpus = null;
+
+	/** The sub corpus. */
+	private Corpus subCorpus = null;
+
+	/** The partition. */
+	private Partition partition;
+
+	/** The name. */
+	private String name;
+
+	/** The symbol. */
+	private String symbol;
+
+	/** The subcorpus. */
+	private Corpus subcorpus;
+
+	/** The writer. */
+	private BufferedWriter writer;
+	
+	/**
+	 * The selected type names to focus on.
+	 */
+	protected String[] selectedTypeNames;
+
+	/**
+	 * The selected part names to focus on.
+	 */
+	protected String[] selectedPartNames;
+
+	/**
+	 * The selected specificities indices to focus on.
+	 */
+	protected double[][] selectedSpecificitiesIndex;
+	
+
+	/**
+	 * Instantiates a new specificites result : for subcorpus specif ities.
+	 *
+	 * @param symbol the symbol
+	 * @param specIndex the spec index
+	 * @param lexicon the lexicon
+	 * @param subLexicon the sub lexicon
+	 * @param name the name
+	 */
+	protected SpecificitesResult(String symbol, double[][] specIndex, Lexicon lexicon,
+			Lexicon subLexicon, String name, int maxScore) {
+		this.symbol = symbol;
+		this.indices = specIndex;
+
+		this.lexicon = lexicon;
+		this.subLexicon = subLexicon;
+		this.corpus = lexicon.getCorpus();
+		this.subCorpus = subLexicon.getCorpus();
+		this.name = name;
+
+		int MAX = MAXSPECIF;
+		int MIN = -MAXSPECIF;
+
+		if (maxScore > 0) {
+			MAX = maxScore;
+			MIN = -maxScore;
+		}
+		for (int i = 0 ; i < indices.length ; i++) {
+			for (int j = 0 ; j < indices[i].length ; j++) {
+				if (indices[i][j] > MAX) {
+					indices[i][j] = MAX;
+				} else if (indices[i][j] < MIN) {
+					indices[i][j] = MIN;
+				}
+			}
+		}
+
+		this.table = null;
+	}
+
+	/**
+	 * Instantiates a new specificites result.
+	 *
+	 * @param symbol the symbol
+	 * @param specIndex the spec index (as double[row][column])
+	 * @param table the table
+	 * @param typeFocus names of the rows of the lexical table with corresponding rows
+	 * in the specIndex array; <code>null</code> if all the rows are
+	 * represented in specIndex.
+	 * @param partFocus names of the cols of the lexical table with corresponding cols
+	 * in the specIndex array; <code>null</code> if all the cols are
+	 * represented in specIndex.
+	 * @param name the name
+	 * @param maxScore if abs(score) > maxScore -> score = +/- maxScore
+	 * @throws StatException the stat exception
+	 */
+	protected SpecificitesResult(String symbol, double[][] specIndex, LexicalTable table,
+			List<String> typeFocus, List<String> partFocus, String name, int maxScore)
+					throws StatException {
+		this.symbol = symbol;
+
+		if (table == null) {
+			throw new IllegalArgumentException(Messages.SpecificitesResult_2);
+		}
+		this.partition = table.getPartition();
+		this.name = name;
+
+		if (specIndex == null || specIndex.length == 0) {
+			throw new IllegalArgumentException(Messages.SpecificitesResult_0);
+		}
+		boolean ok = CheckArray.checkMatrixRepresentation(specIndex);
+		if (!ok) {
+			throw new IllegalArgumentException(Messages.SpecificitesResult_1);
+		}
+
+		this.indices = specIndex;
+		this.table = table;
+		this.colnames = partFocus;
+		this.rownames = typeFocus;
+
+		// filter by max&min
+		int MAX = MAXSPECIF;
+		int MIN = -MAXSPECIF;
+
+		if (maxScore > 0) {
+			MAX = maxScore;
+			MIN = -maxScore;
+		}
+
+		for (int i = 0 ; i < indices.length ; i++) {
+			for (int j = 0 ; j < indices[i].length ; j++) {
+				if (indices[i][j] > MAX) {
+					indices[i][j] = MAX;
+				} else if (indices[i][j] < MIN) {
+					indices[i][j] = MIN;
+				}
+			}
+		}
+
+		if (typeFocus != null && typeFocus.size() != 0) {
+			if (typeFocus.size() != specIndex.length) {
+				throw new IllegalArgumentException(
+						Messages.SpecificitesResult_3 + typeFocus.size()
+						+ Messages.SpecificitesResult_4
+						+ specIndex.length
+						+ Messages.SpecificitesResult_5);
+			}
+
+			rowindex = ArrayIndex.getIndex(
+					table.getRowNames().asStringsArray(), typeFocus
+					.toArray(new String[] {}));
+			for (int i : rowindex) {
+				if (i == -1) {
+					throw new IllegalArgumentException(
+							Messages.SpecificitesResult_6);
+				}
+			}
+		}
+		if (partFocus != null && partFocus.size() != 0) {
+			if (partFocus.size() != specIndex[0].length) {
+				throw new IllegalArgumentException(
+						Messages.SpecificitesResult_7 + partFocus.size()
+						+ ", " + specIndex[0].length + ")."); //$NON-NLS-1$//$NON-NLS-2$ 
+			}
+			colindex = ArrayIndex.getIndex(
+					table.getColNames().asStringsArray(), partFocus
+					.toArray(new String[] {}));
+			for (int i : colindex) {
+				if (i == -1) {
+					throw new IllegalArgumentException(
+							Messages.SpecificitesResult_10);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Gets the type focus.
+	 *
+	 * @return the type focus
+	 */
+	public List<String> getTypeFocus() {
+		return rownames;
+	}
+
+	/**
+	 * Gets the part focus.
+	 *
+	 * @return the part focus
+	 */
+	public List<String> getPartFocus() {
+		return colnames;
+	}
+
+	/**
+	 * Gets the nbr part.
+	 *
+	 * @return the nbr part
+	 * @throws StatException the stat exception
+	 */
+	public int getNbrPart() throws StatException {
+		if (table != null)
+			return table.getNColumns();
+		else
+			return getPartShortNames().length;
+	}
+
+	/**
+	 * Gets the corpus size.
+	 *
+	 * @return the corpus size
+	 * @throws StatException the stat exception
+	 */
+	public int getCorpusSize() throws StatException {
+		return table != null ? table.getTotal() : lexicon.nbrOfToken();
+	}
+
+	/**
+	 * Gets the specificites index.
+	 * 
+	 * @return the specificites index
+	 */
+	public double[][] getSpecificitesIndex() {
+		return indices;
+	}
+
+	/**
+	 * Name of the type for which specificite are computed.
+	 *
+	 * @return the type names
+	 * @throws StatException the stat exception
+	 */
+	public String[] getTypeNames() throws StatException {
+		if (table != null) {
+			return (rownames != null && rownames.size() != 0) ? rownames
+					.toArray(new String[] {}) : table.getRowNames()
+					.asStringsArray();
+		} else {
+			return lexicon.getForms();
+		}
+	}
+
+	/**
+	 * Name of the part for which specif icite are computed.
+	 *
+	 * @return the part short names
+	 * @throws StatException the stat exception
+	 */
+	public String[] getPartShortNames() throws StatException {
+		//		System.out.println("get col names: "+table);
+		//		System.out.println("colnames: "+colnames);
+		if (colnames != null && colnames.size() > 0)
+			return colnames.toArray(new String[]{});
+		else if (table != null) {
+			// return (colnames != null && colnames.size() != 0) ?
+			// colnames.toArray(new String[]{}) :
+			// table.getColNames().asStringsArray();
+			/*
+			 * List<Part> parts = table.getPartition().getOrderedParts(); String[]
+			 * partShortNames = new String[parts.size()]; for (int i = 0; i <
+			 * partShortNames.length; i++) { partShortNames[i] =
+			 * parts.get(i).getShortName(); }
+			 */
+			return table.getColNames().asStringsArray();
+
+		} else {
+			if(this.subCorpus != null)
+				return new String[] { this.subCorpus.getName(),
+					this.corpus.getName() + " \\ " + this.subCorpus.getName() }; //$NON-NLS-1$
+		}
+		return new String[0];
+	}
+
+	/**
+	 * Gets the frequency.
+	 *
+	 * @return the frequency
+	 * @throws StatException the stat exception
+	 */
+	public int[][] getFrequency() throws StatException {
+		//System.out.println("GET FREQUENCIES");
+		if (frequencies == null) {
+			//System.out.println("no frequencies");
+			if (table != null) {
+				//System.out.println("FROM TABLE");
+				frequencies = RWorkspace.getRWorkspaceInstance().evalToInt2D(table.getSymbol());
+				
+			} else {// if table == null : subcorpus specif 
+				//System.out.println("FROM LEXICON");
+				frequencies = new int[lexicon.getFreq().length][2]; // build a frenquency table from lexicons
+				String[] corpusforms = lexicon.getForms(); // all the forms
+				String[] subcorpusforms = subLexicon.getForms(); // all the forms
+				int[] corpusfreq = lexicon.getFreq(); // all the freqs
+				int[] subcorpusfreq = subLexicon.getFreq(); // all the freqs in the subcorpus
+
+				//				System.out.println("len subforms: "+subcorpusforms.length);
+				//				System.out.println("len subfreqs: "+subcorpusfreq.length);
+				for (int i = 0 ; i < corpusforms.length ; i++) //get all forms
+				{
+					int j = 0; // find the index of the form in the subcorpus arrays
+					for (j = 0; j < subcorpusforms.length; j++) {
+						if (subcorpusforms[j].equals(corpusforms[i]))
+							break;// found the good form
+					}
+					if(j < subcorpusforms.length)
+						frequencies[i][0] = subcorpusfreq[j];
+					frequencies[i][1] = corpusfreq[i] - frequencies[i][0];
+				}
+			}
+		}
+		return frequencies;
+	}
+
+	/**
+	 * Gets the lexical table.
+	 *
+	 * @return the lexical table
+	 */
+	public LexicalTable getLexicalTable() {
+		return table;
+	}
+
+	/**
+	 * Gets the lexicon.
+	 *
+	 * @return the lexicon
+	 */
+	public Lexicon getLexicon() {
+		return lexicon;
+	}
+
+	/**
+	 * Gets the part size.
+	 *
+	 * @return the part size
+	 * @throws StatException the stat exception
+	 */
+	public int[] getPartSize() throws StatException {
+		if (table != null) {
+			Vector partsize = table.getColMarginsVector();
+			if (colindex != null) {
+				partsize = partsize.get(colindex);
+			}
+			return partsize.asIntArray();
+		} else {
+			return new int[] { subLexicon.nbrOfToken(),
+					lexicon.nbrOfToken() - subLexicon.nbrOfToken() };
+		}
+	}
+
+	/**
+	 * The frequency in the whole corpus.
+	 *
+	 * @return the form frequencies
+	 * @throws StatException the stat exception
+	 */
+	public int[] getFormFrequencies() throws StatException {
+		if (table != null) {
+			//System.out.println("get freq by table");
+			Vector formFrequencies = table.getRowMarginsVector();
+			if (rowindex != null) {
+				formFrequencies = formFrequencies.get(rowindex);
+			}
+			return formFrequencies.asIntArray();
+		} else {
+			//System.out.println("freqs by lexicon of "+lexicon.getCorpus());
+			return lexicon.getFreq();
+		}
+	}
+
+	/**
+	 * To txt.
+	 *
+	 * @param outfile the outfile
+	 * @param encoding the encoding
+	 * @param colseparator the colseparator
+	 * @param txtseparator the txtseparator
+	 * @return true, if successful
+	 * @throws StatException the stat exception
+	 */
+	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) throws StatException {
+
+		// NK: Declared as class attribute to perform a clean if the operation is interrupted
+		//OutputStreamWriter writer;
+		try {
+			this.writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile),	encoding)); 
+		} catch (UnsupportedEncodingException e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			return false;
+		} catch (FileNotFoundException e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			return false;
+		}
+
+		//int[] T = getPartSize();
+		acquireSemaphore();
+		try {
+			getFrequency();
+			getFormFrequencies();
+			getLexicon();
+			String[] names = getPartShortNames();
+			// if ("UTF-8".equals(encoding)) writer.write('\ufeff'); // UTF-8 BOM
+			//write column header
+			String txt = Messages.SpecificitesResult_8+colseparator+"F"; //$NON-NLS-1$
+			for(String colname : names) {
+				txt += colseparator+ "f_"+colname + colseparator + "Score"; //$NON-NLS-1$ //$NON-NLS-2$
+			}
+			writer.write(txt +"\n"); //$NON-NLS-1$
+
+			//write data
+			for (int ii = 0; ii < frequencies.length; ii++) {
+				txt = txtseparator + getTypeNames()[ii].replace(txtseparator, txtseparator+txtseparator)+txtseparator; 
+				int somme = 0;
+				String txtcols = ""; //$NON-NLS-1$
+				for (int j = 0; j < frequencies[ii].length; j++) {
+					somme += frequencies[ii][j];
+					txtcols += (colseparator + frequencies[ii][j]); 
+					txtcols += (colseparator + indices[ii][j]); 
+				}
+				writer.write(txt + colseparator + somme+ txtcols+ "\n"); //$NON-NLS-1$
+				writer.flush();
+			}
+			writer.close();
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		} finally {
+			releaseSemaphore();
+		}
+
+		return true;
+	}
+
+	/**
+	 * To svg.
+	 *
+	 * @param file the file
+	 * @param typeNames the type names
+	 * @param partNames the part names
+	 * @param specIndex the spec index
+	 * @param transpose the transpose
+	 * @param drawBarPlot the draw bar plot
+	 * @param drawLines the draw lines
+	 * @param device the device
+	 * @throws StatException the stat exception
+	 */
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated
+	public final void toSVG(File file, String[] typeNames,
+			String[] partNames, double[][] specIndex, boolean transpose, boolean drawBarPlot, boolean drawLines, __RDevice device, float BANALITE, boolean monochrome) throws StatException {
+
+		// TODO: should filter max and min here
+		// specIndex
+
+		Matrix spec = new DoubleMatrix(specIndex);
+		Vector types = new VectorImpl(typeNames);
+		Vector parts = new VectorImpl(partNames);
+
+		RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+		rw.eval("rownames(" + spec.getSymbol() + ") <- " + types.getSymbol() + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		rw.eval("colnames(" + spec.getSymbol() + ") <- " + parts.getSymbol() + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		try {
+			//System.out.println(""+"barplot(" + spec.getSymbol() + ", beside=T, legend.text=rownames(" + spec.getSymbol() + "));"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+			String matrix = spec.getSymbol();
+			if (transpose)
+				matrix = "t("+matrix+")"; //$NON-NLS-1$ //$NON-NLS-2$
+
+
+			String names = parts.getSymbol();
+			if (transpose)
+				names = types.getSymbol();
+
+			String legend = types.getSymbol();
+			if (transpose)
+				legend = parts.getSymbol();
+
+			String title = this.getName();
+
+			String cmd = ""; //$NON-NLS-1$
+
+			String[] colors;
+			String[] allcolors = Progression.colors;
+			if (transpose) { // one color per part
+				colors = new String[partNames.length];
+				for (int j = 0 ; j < partNames.length ; j++) {
+					colors[j] = allcolors[j%allcolors.length];
+				}
+			} else { // one color per word
+				colors = new String[typeNames.length];
+				for (int j = 0 ; j < typeNames.length ; j++)
+					colors[j] = allcolors[j%allcolors.length];
+			}
+
+			RWorkspace.getRWorkspaceInstance().eval("rm(colors)"); //$NON-NLS-1$
+			RWorkspace.getRWorkspaceInstance().addVectorToWorkspace("colors", colors); //$NON-NLS-1$
+			//System.out.println("colors: "+Arrays.toString(colors));
+
+			String colorString;
+
+			if (monochrome)
+				colorString = ""; //$NON-NLS-1$
+			else
+				colorString = ", col=colors"; //$NON-NLS-1$
+
+			cmd += "op <- par(mar=c(5,5,5,10), xpd=TRUE);\n"; //$NON-NLS-1$
+
+			if (drawBarPlot) {
+				cmd += 	"mat <- "+matrix+";\n" + //$NON-NLS-1$ //$NON-NLS-2$
+						"draw <- barplot(mat, space=c(1,3)"+colorString+ //$NON-NLS-1$
+						", horiz=F, las=2, names.arg="+names+", main=\""+title+ //$NON-NLS-1$ //$NON-NLS-2$
+						"\", beside=T, xpd=TRUE);\n" +  //$NON-NLS-1$ //$NON-NLS-2$
+						// removed : legend.text="+legend + "
+						//"rm(op);" + //$NON-NLS-1$
+						"W2 <- 100000;\n"+//$NON-NLS-1$
+						"lines(c(0,W2), c(-"+BANALITE+", -"+BANALITE+"), lty=2);\n" + // seuil banalité inférieur //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+						"lines(c(0,W2), c("+BANALITE+", "+BANALITE+"), lty=2);\n" + // seuil banalité supérieur //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+						"lines(c(0,W2), c(0,0), lty=1);\n"+ //$NON-NLS-1$
+						"\n"; //$NON-NLS-1$ 
+			} else {
+				//compute the hist but dont show the bar
+				cmd += 	"mat <- "+matrix+";\n" + //$NON-NLS-1$ //$NON-NLS-2$
+						"draw <- barplot(mat, space=c(1,3), col=\"white\", border=NA, horiz=F, las=2, names.arg="+names+", main=\""+title+"\", beside=T);\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				//"rm(op);\n"; //$NON-NLS-1$ 
+			}
+
+			if (drawLines) {
+				if (transpose) {
+					cmd +=	"for(i in 1:length(draw[1,])){\n" + //$NON-NLS-1$
+							"lines(draw[,i], mat[,i], col=colors[[i]]);\n" + //$NON-NLS-1$
+							"}\n"; //$NON-NLS-1$
+				} else {
+					cmd +=	"for(i in 1:length(draw[,1])){\n" + //$NON-NLS-1$
+							"lines(draw[i,], mat[i,], col=colors[[i]]);\n" + //$NON-NLS-1$
+							"}\n"; //$NON-NLS-1$
+				}
+				if (!drawBarPlot) {
+					if (transpose) {
+						cmd +=	"for(i in 1:length(draw[1,])){\n" + //$NON-NLS-1$
+								"text(draw[,i], 0, label="+legend+", offset=0, srt=90);\n" + //$NON-NLS-1$ //$NON-NLS-2$
+								"lines(c(draw[[1,i]],draw[[length(draw[,i]),i]]), c(0,0))" + //$NON-NLS-1$
+								"}\n"; //$NON-NLS-1$
+					} else {
+						cmd += "lines( c(0,99999), c(0,0))\n"; //$NON-NLS-1$
+					}
+				}
+			}
+
+			//			if (transpose)
+			//				cmd += "legend(\"topright\", "+names+", inset = c(-0.2, 0), col = colors, lty = 1, xpd=TRUE);\n"; //$NON-NLS-1$ //$NON-NLS-2$
+			//			else
+			if (drawBarPlot)
+				cmd += "legend(\"topright\", "+legend+", inset = c(-0.2,0), col = colors, pch = 0, xpd=TRUE);\n"; //$NON-NLS-1$ //$NON-NLS-2$
+			else
+				cmd += "legend(\"topright\", "+legend+", inset = c(-0.2,0), col = colors, lty = 1, xpd=TRUE);\n"; //$NON-NLS-1$ //$NON-NLS-2$
+
+			rw.plot(file, cmd, device);
+		} catch (Exception e) {
+			System.out.println(e.getLocalizedMessage());
+			throw new StatException(e);
+		}
+	}
+
+	/**
+	 * SL
+	 * 
+	 * TODO should be a generic function for drawing barplot with vector.
+	 *
+	 * @param file the file
+	 * @throws StatException the stat exception
+	 */
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated
+	public void toSVG(File file) throws StatException {
+		toSVG(file, __RDevice.SVG);
+	}
+
+
+	/**
+	 * To svg.
+	 *
+	 * @param file the file
+	 * @param device the device
+	 * @throws StatException the stat exception
+	 */
+	@Deprecated
+	// FIXME : to remove when charts engine will be validated
+	public void toSVG(File file, __RDevice device) throws StatException {
+		// TODO Auto-generated method stub
+		double[][] specindex = getSpecificitesIndex();
+		try {
+			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+			double[] i = VectorizeArray.vectorizeByInner(specindex);
+			VectorImpl v = new VectorImpl(i);
+			//System.out.println("R : "+v.getSymbol()); //$NON-NLS-1$
+			rw.plot(file, "barplot(" + v.getSymbol() + ")", device); //$NON-NLS-1$ //$NON-NLS-2$
+		} catch (REXPMismatchException e) {
+			throw new StatException(e);
+		}
+	}
+
+	/**
+	 * Gets the parent, i.e. the subcorpus if the specif ities were computed on a
+	 * subcorpus, and the partition if teh specificities were computed on a
+	 * partition
+	 * 
+	 * @return the parent
+	 */
+	public HasResults getParent() {
+		if (partition != null) return table;
+		if (subcorpus != null) return subcorpus;
+		return corpus; // computed on subcorpus
+	}
+
+	/**
+	 * Gets the name.
+	 *
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Gets the symbol.
+	 *
+	 * @return the symbol
+	 */
+	public String getSymbol() {
+		return symbol;
+	}
+
+	/**
+	 * Gets the sorted part indexes.
+	 *
+	 * @return the sorted part indexes
+	 */
+	public int[] getSortedPartIndexes() {
+
+		try {
+			int[] indexes = new int[this.getNbrPart()];
+			String[] partsname = this.getPartShortNames().clone();
+			for (int i = 0; i < this.getNbrPart(); i++) {
+				indexes[i] = i;
+			}
+
+			for (int i = 0; i < this.getNbrPart(); i++) {
+				int imin = i;
+				for (int j = i; j < this.getNbrPart(); j++) {
+					if (partsname[imin].compareTo(partsname[j]) > 0) {
+						imin = j;
+					}
+				}
+				String tmp = partsname[i];
+				partsname[i] = partsname[imin];
+				partsname[imin] = tmp;
+
+				int tmp2 = indexes[i];
+				indexes[i] = indexes[imin];
+				indexes[imin] = tmp2;
+			}
+			return indexes;
+		} catch (StatException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		return new int[0];
+	}
+
+	/**
+	 * Sets the corpus.
+	 *
+	 * @param subcorpus2 the new corpus
+	 */
+	public void setCorpus(Subcorpus subcorpus2) {
+		this.subcorpus = subcorpus2;
+	}
+
+	/**
+	 * Gets the corpus.
+	 *
+	 * @return the corpus
+	 */
+	public Corpus getCorpus() {
+		return subcorpus;
+	}
+
+	@Override
+	public void clean() {
+		try {
+			this.writer.flush();
+			this.writer.close();	
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * @return the selectedTypeNames
+	 */
+	public String[] getSelectedTypeNames() {
+		return selectedTypeNames;
+	}
+
+	/**
+	 * @param selectedTypeNames the selectedTypeNames to set
+	 */
+	public void setSelectedTypeNames(String[] selectedTypeNames) {
+		this.selectedTypeNames = selectedTypeNames;
+	}
+
+	/**
+	 * @return the selectedPartNames
+	 */
+	public String[] getSelectedPartNames() {
+		return selectedPartNames;
+	}
+
+	/**
+	 * @param selectedPartNames the selectedPartNames to set
+	 */
+	public void setSelectedPartNames(String[] selectedPartNames) {
+		this.selectedPartNames = selectedPartNames;
+	}
+
+	/**
+	 * @return the selectedSpecificitiesIndex
+	 */
+	public double[][] getSelectedSpecificitiesIndex() {
+		return selectedSpecificitiesIndex;
+	}
+
+	/**
+	 * @param selectedSpecificitiesIndex the selectedSpecificitiesIndex to set
+	 */
+	public void setSelectedSpecificitiesIndex(double[][] selectedSpecificitiesIndex) {
+		this.selectedSpecificitiesIndex = selectedSpecificitiesIndex;
+	}
+
+	@Override
+	public boolean delete() {
+		if (partition != null) return partition.removeResult(this);
+		return corpus.removeResult(this);
+	}
+}

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

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificites.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificites.java	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificites.java	(revision 73)
@@ -0,0 +1,217 @@
+// 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-11-29 16:47:07 +0100 (Tue, 29 Nov 2016) $
+// $LastChangedRevision: 3349 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.specificities.core.functions;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.Lexicon;
+import org.txm.searchengine.cqp.corpus.Part;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.searchengine.cqp.corpus.query.Focus;
+import org.txm.stat.StatException;
+import org.txm.stat.data.LexicalTable;
+import org.txm.stat.data.Vector;
+import org.txm.stat.engine.r.RWorkspaceException;
+import org.txm.Messages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * High level access to the Specificities.
+ * 
+ * The methods in this class access the Specificities function through
+ * high-level objects (representation of CQP corpus ({@link Corpus},
+ * {@link Subcorpus}, {@link Partition}), representation of queries (
+ * {@link Focus}, {@link Property}), and lexicon {@link Lexicon})).
+ * 
+ * @author sloiseau
+ * 
+ */
+public class Specificites {
+
+	/** The specif_counter. */
+	private static int specif_counter = 1;
+	private static ArrayList<Integer> selectedColIdx;
+
+	/**
+	 * Compute the specificity index for all the cells of a complete lexical
+	 * table, as defined by a {@link Partition} and a {@link Property}.
+	 * 
+	 * This may be used for extracting, for all part, the forms the most or the
+	 * less specif ic.
+	 *
+	 * @param partition the partition
+	 * @param analysisProperty the analysis property
+	 * @param formFocus the form focus
+	 * @param partsFocus the parts focus
+	 * @param Fmin the fmin
+	 * @return the specificites result
+	 * @throws CqiClientException the cqi client exception
+	 * @throws StatException the stat exception
+	 */
+	public static SpecificitesResult specificites(Partition partition, Property analysisProperty,
+			List<Part> partsFocus, int Fmin, int maxScore) throws CqiClientException, StatException {
+		if (partition.getParts().size() < 2) {
+			throw new IllegalArgumentException(Messages.Specificites_0);
+		}
+		// complication due to Jean-Philippe special interest in usage of Part.
+		List<String> partNamesFocus = new ArrayList<String>();
+		
+		if (partsFocus != null) {
+			partNamesFocus = new ArrayList<String>();
+			for (Part p : partsFocus) {
+				partNamesFocus.add(p.getShortName());
+			}
+		}
+		// System.out.println("get/create lexical table");
+		LexicalTable table = partition.getLexicalTable(analysisProperty, Fmin);
+		partition.storeResult(table);
+
+		// Create a set of the existing types
+		String[] rownames = table.getRowNames().asStringsArray();
+		ArrayList<String> found = new ArrayList<String>(Arrays.asList(rownames));
+
+		String symbol = org.txm.stat.engine.r.function.Specificites.prefixR+(specif_counter++);
+		
+		//System.out.println("Av specif ");
+		double[][] specIndex = org.txm.stat.engine.r.function.Specificites
+		.specificites(symbol, table, found.toArray(new String[] {}), partNamesFocus.toArray(new String[] {}));
+		//System.out.println("Ap specif ");
+		
+		return new SpecificitesResult(
+				symbol,
+				specIndex,
+				table,
+				found,
+				partNamesFocus,
+				analysisProperty.getName(),
+				maxScore);
+	}
+
+	/**
+	 * Specificites.
+	 *
+	 * @param table the table
+	 * @return the specificites result
+	 * @throws CqiClientException the cqi client exception
+	 * @throws StatException the stat exception
+	 */
+	public static SpecificitesResult specificites(LexicalTable table, int maxScore)
+	throws CqiClientException, StatException {
+		if (table.getNColumns() < 2) {
+			throw new IllegalArgumentException(Messages.Specificites_0);
+		}
+
+		String[] rownames = table.getRowNames().asStringsArray();
+		String[] colnames = table.getColNames().asStringsArray();
+		String symbol = org.txm.stat.engine.r.function.Specificites.prefixR+(specif_counter++);
+
+		double[][] specIndex = org.txm.stat.engine.r.function.Specificites.specificites(symbol, table, rownames, colnames);
+
+		if (table.getPartition() != null) {
+			return new SpecificitesResult(symbol, specIndex, table, Arrays
+					.asList(rownames), Arrays.asList(colnames), table.getProperty().getName(), maxScore); 
+		} else {
+			return new SpecificitesResult(symbol, specIndex, table, Arrays
+					.asList(rownames), Arrays.asList(colnames),
+					"TLNONAME: " + table.getProperty().getName(), maxScore); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Specificites.
+	 *
+	 * @param corpus the corpus
+	 * @param subcorpus the subcorpus
+	 * @param property the property
+	 * @return the specificites result
+	 * @throws CqiClientException the cqi client exception
+	 * @throws StatException the stat exception
+	 */
+	public static SpecificitesResult specificites(Corpus corpus,
+			Subcorpus subcorpus, Property property, int maxScore) throws CqiClientException,
+			StatException {
+
+		Lexicon totalFrequencies = corpus.getLexicon(property);
+		Lexicon subFrequencies = subcorpus.getLexicon(property);
+
+		//System.out.println("Send corpus vector");
+		Vector totalFSymbol;
+		Vector subFSymbol;
+		try {
+			totalFSymbol = totalFrequencies.asVector();
+			subFSymbol = subFrequencies.asVector();
+		} catch (StatException e) {
+			throw new RWorkspaceException(e);
+		}
+
+		//System.out.println("compute specifs");
+		String symbol = org.txm.stat.engine.r.function.Specificites.prefixR+(specif_counter++);
+		double[][] specIndex = org.txm.stat.engine.r.function.Specificites.specificites(symbol, totalFSymbol, subFSymbol);
+
+		//System.out.println("build SpecificitesResult");
+		SpecificitesResult specif =  new SpecificitesResult(symbol, specIndex, totalFrequencies,
+				subFrequencies, property.getName(), maxScore); 
+
+		specif.setCorpus(subcorpus);
+		return specif ;
+	}
+
+	/**
+	 * TODO to be replaced by
+	 * "org.apache.commons.collections.CollectionUtils.subtract" when someone
+	 * figure out where is the eclipse plugin for apache commons collections. SL
+	 *
+	 * @param leftoperande the leftoperande
+	 * @param rightoperande the rightoperande
+	 * @return an array of two sets: the first one contains the element of
+	 * leftoperande not in rightoperande, the second the element of
+	 * leftoperande present in rightoperande.
+	 */
+	private static final Set<String>[] subtract(Set<String> leftoperande,
+			Set<String> rightoperande) {
+		Set<String>[] returned = new HashSet[] { new HashSet<String>(),
+				new HashSet<String>() };
+		for (String s : leftoperande) {
+			if (!rightoperande.contains(s)) {
+				returned[0].add(s);
+			} else {
+				returned[1].add(s);
+			}
+		}
+		return returned;
+	}
+}

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

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificites2.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificites2.java	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificites2.java	(revision 73)
@@ -0,0 +1,50 @@
+package org.txm.specificities.core.functions;
+
+import org.txm.functions.contrasts.Contrast;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.stat.StatException;
+import org.txm.stat.data.LexicalTable;
+import org.txm.stat.engine.r.RWorkspace;
+
+public class Specificites2 extends Contrast {
+	
+	public Specificites2(Corpus corpus, Subcorpus subcorpus, Property property)
+			throws StatException, CqiClientException {
+		super(corpus, subcorpus, property);
+		// TODO Auto-generated constructor stub
+	}
+
+	public Specificites2(Partition partition, Property property, int Fmin)
+			throws StatException, CqiClientException {
+		super(partition, property, Fmin);
+		// TODO Auto-generated constructor stub
+	}
+
+
+	public Specificites2(LexicalTable table) {
+		super(table);
+		// TODO Auto-generated constructor stub
+	}
+
+	public boolean compute() throws StatException {
+	
+	colNames = table.getColNames().asStringsArray();
+	rowNames = table.getRowNames().asStringsArray();
+	frequencies = RWorkspace.getRWorkspaceInstance().evalToInt2D(table.getSymbol());
+	
+	// compute
+	indices = org.txm.stat.engine.r.function.Specificites.specificites("SYMBOL", table, null, null); //$NON-NLS-1$
+	
+	return true;
+}
+
+	@Override
+	public String getName() {
+		// TODO Auto-generated method stub
+		return "Specif2"; //$NON-NLS-1$
+	}
+}

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

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/package.html
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/package.html	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/package.html	(revision 73)
@@ -0,0 +1,5 @@
+<html>
+<body>
+<p>Computing indicator of association between part and forms in a corpus following the "specificites" method.</p>
+</body>
+</html>
\ No newline at end of file

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

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/r/RSpecificitiesBarChartCreator.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/r/RSpecificitiesBarChartCreator.java	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/r/RSpecificitiesBarChartCreator.java	(revision 73)
@@ -0,0 +1,177 @@
+package org.txm.specificities.core.chartsengine.r;
+
+import java.io.File;
+
+import org.txm.chartsengine.core.ChartsEngine;
+import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
+import org.txm.chartsengine.r.core.RChartCreator;
+import org.txm.core.chartsengine.base.messages.ChartsEngineMessages;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.functions.progression.Progression;
+import org.txm.specificities.core.functions.SpecificitesResult;
+import org.txm.specificities.core.preferences.SpecificitiesPreferences;
+import org.txm.stat.data.Matrix;
+import org.txm.stat.data.Vector;
+import org.txm.stat.engine.r.RWorkspace;
+import org.txm.stat.engine.r.data.DoubleMatrix;
+import org.txm.stat.engine.r.data.VectorImpl;
+import org.txm.utils.logger.Log;
+
+/**
+ * Creates a partition dimensions bar chart from the specified <code>Partition</code> result.
+ * @author sjacquot
+ *
+ */
+public class RSpecificitiesBarChartCreator extends RChartCreator {
+
+	public RSpecificitiesBarChartCreator() {
+	}
+
+	@Override
+	public Object createChart(Object resultData, String preferencesNode) {
+		return null;
+	}
+
+	
+	@Override
+	public File createChartFile(Object resultData, File file, String preferencesNode) {
+
+		try {
+			
+			SpecificitesResult specificitiesResult = (SpecificitesResult) resultData;
+
+			// parameters
+			boolean transpose = TXMPreferences.getBoolean(preferencesNode, resultData, SpecificitiesPreferences.CHART_TRANSPOSE);
+			boolean drawBars = TXMPreferences.getBoolean(preferencesNode, resultData, SpecificitiesPreferences.CHART_DRAW_BARS);
+			boolean drawLines = TXMPreferences.getBoolean(preferencesNode, resultData, SpecificitiesPreferences.CHART_DRAW_LINES);
+			float banality = TXMPreferences.getFloat(preferencesNode, resultData, SpecificitiesPreferences.CHART_BANALITY);
+			boolean grayscale = (TXMPreferences.getInt(preferencesNode, resultData, ChartsEnginePreferences.RENDERING_COLORS_MODE) == ChartsEngine.RENDERING_GRAYSCALE_MODE);
+			
+	
+
+			// TODO: should filter max and min here
+			// specIndex
+
+			Matrix spec = new DoubleMatrix(specificitiesResult.getSelectedSpecificitiesIndex());
+			Vector types = new VectorImpl(specificitiesResult.getSelectedTypeNames());
+			Vector parts = new VectorImpl(specificitiesResult.getSelectedPartNames());
+
+			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+			rw.eval("rownames(" + spec.getSymbol() + ") <- " + types.getSymbol() + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			rw.eval("colnames(" + spec.getSymbol() + ") <- " + parts.getSymbol() + ";"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+			//System.out.println(""+"barplot(" + spec.getSymbol() + ", beside=T, legend.text=rownames(" + spec.getSymbol() + "));"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+			String matrix = spec.getSymbol();
+			if (transpose)
+				matrix = "t("+matrix+")"; //$NON-NLS-1$ //$NON-NLS-2$
+
+
+			String names = parts.getSymbol();
+			if (transpose)
+				names = types.getSymbol();
+
+			String legend = types.getSymbol();
+			if (transpose)
+				legend = parts.getSymbol();
+
+			String title = specificitiesResult.getName();
+
+			String cmd = ""; //$NON-NLS-1$
+
+			String[] colors;
+			String[] allcolors = Progression.colors;
+			if (transpose) { // one color per part
+				colors = new String[specificitiesResult.getSelectedPartNames().length];
+				for (int j = 0 ; j < specificitiesResult.getSelectedPartNames().length ; j++) {
+					colors[j] = allcolors[j%allcolors.length];
+				}
+			} else { // one color per word
+				colors = new String[specificitiesResult.getSelectedTypeNames().length];
+				for (int j = 0 ; j < specificitiesResult.getSelectedTypeNames().length ; j++)
+					colors[j] = allcolors[j%allcolors.length];
+			}
+
+			RWorkspace.getRWorkspaceInstance().eval("rm(colors)"); //$NON-NLS-1$
+			RWorkspace.getRWorkspaceInstance().addVectorToWorkspace("colors", colors); //$NON-NLS-1$
+			//System.out.println("colors: "+Arrays.toString(colors));
+
+			String colorString;
+
+			if (grayscale)
+				colorString = ""; //$NON-NLS-1$
+			else
+				colorString = ", col=colors"; //$NON-NLS-1$
+
+			cmd += "op <- par(mar=c(5,5,5,10), xpd=TRUE);\n"; //$NON-NLS-1$
+
+			if (drawBars) {
+				cmd += 	"mat <- "+matrix+";\n" + //$NON-NLS-1$ //$NON-NLS-2$
+						"draw <- barplot(mat, space=c(1,3)"+colorString+ //$NON-NLS-1$
+						", horiz=F, las=2, names.arg="+names+", main=\""+title+ //$NON-NLS-1$ //$NON-NLS-2$
+						"\", beside=T, xpd=TRUE);\n" +  //$NON-NLS-1$ //$NON-NLS-2$
+						// removed : legend.text="+legend + "
+						//"rm(op);" + //$NON-NLS-1$
+						"W2 <- 100000;\n"+//$NON-NLS-1$
+						"lines(c(0,W2), c(-"+banality+", -"+banality+"), lty=2);\n" + // seuil banalité inférieur //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+						"lines(c(0,W2), c("+banality+", "+banality+"), lty=2);\n" + // seuil banalité supérieur //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+						"lines(c(0,W2), c(0,0), lty=1);\n"+ //$NON-NLS-1$
+						"\n"; //$NON-NLS-1$
+			} else {
+				//compute the hist but dont show the bar
+				cmd += 	"mat <- "+matrix+";\n" + //$NON-NLS-1$ //$NON-NLS-2$
+						"draw <- barplot(mat, space=c(1,3), col=\"white\", border=NA, horiz=F, las=2, names.arg="+names+", main=\""+title+"\", beside=T);\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+						//"rm(op);\n"; //$NON-NLS-1$
+			}
+
+			if (drawLines) {
+				if (transpose) {
+					cmd +=	"for(i in 1:length(draw[1,])){\n" + //$NON-NLS-1$
+							"lines(draw[,i], mat[,i], col=colors[[i]]);\n" + //$NON-NLS-1$
+							"}\n"; //$NON-NLS-1$
+				} else {
+					cmd +=	"for(i in 1:length(draw[,1])){\n" + //$NON-NLS-1$
+							"lines(draw[i,], mat[i,], col=colors[[i]]);\n" + //$NON-NLS-1$
+							"}\n"; //$NON-NLS-1$
+				}
+				if (!drawBars) {
+					if (transpose) {
+						cmd +=	"for(i in 1:length(draw[1,])){\n" + //$NON-NLS-1$
+								"text(draw[,i], 0, label="+legend+", offset=0, srt=90);\n" + //$NON-NLS-1$ //$NON-NLS-2$
+								"lines(c(draw[[1,i]],draw[[length(draw[,i]),i]]), c(0,0))" + //$NON-NLS-1$
+								"}\n"; //$NON-NLS-1$
+					} else {
+						cmd += "lines( c(0,99999), c(0,0))\n"; //$NON-NLS-1$
+					}
+				}
+			}
+
+//				if (transpose)
+//					cmd += "legend(\"topright\", "+names+", inset = c(-0.2, 0), col = colors, lty = 1, xpd=TRUE);\n"; //$NON-NLS-1$ //$NON-NLS-2$
+//				else
+			if (drawBars)
+				cmd += "legend(\"topright\", "+legend+", inset = c(-0.2,0), col = colors, pch = 0, xpd=TRUE);\n"; //$NON-NLS-1$ //$NON-NLS-2$
+			else
+				cmd += "legend(\"topright\", "+legend+", inset = c(-0.2,0), col = colors, lty = 1, xpd=TRUE);\n"; //$NON-NLS-1$ //$NON-NLS-2$
+
+			
+			this.getChartsEngine().plot(file, cmd);
+
+
+		}
+		catch (Exception e) {
+			Log.severe(ChartsEngineMessages.bind(ChartsEngineMessages.ChartsEngine_CANT_CREATE_SPECIFICITIES_FILE_CHART, this.getChartsEngine().getName()) + e);
+		}
+
+		return file;
+	}
+
+	
+
+
+	@Override
+	public Class getResultDataClass() {
+		return SpecificitesResult.class;
+	}
+
+}

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

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/jfreechart/JFCSpecificitiesBarChartCreator.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/jfreechart/JFCSpecificitiesBarChartCreator.java	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/jfreechart/JFCSpecificitiesBarChartCreator.java	(revision 73)
@@ -0,0 +1,227 @@
+package org.txm.specificities.core.chartsengine.jfreechart;
+
+import java.awt.Color;
+
+import org.jfree.chart.JFreeChart;
+import org.jfree.chart.axis.NumberAxis;
+import org.jfree.chart.plot.Marker;
+import org.jfree.chart.plot.ValueMarker;
+import org.jfree.data.general.DatasetUtilities;
+import org.jfree.data.xy.XYSeries;
+import org.jfree.data.xy.XYSeriesCollection;
+import org.jfree.ui.RectangleAnchor;
+import org.jfree.ui.TextAnchor;
+import org.txm.chartsengine.core.ChartsEngine;
+import org.txm.chartsengine.jfreechart.core.JFCChartCreator;
+import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IItemSelectionRenderer;
+import org.txm.chartsengine.jfreechart.core.themes.base.ExtendedNumberAxis;
+import org.txm.core.chartsengine.base.messages.ChartsEngineMessages;
+import org.txm.core.chartsengine.jfreechart.messages.JFreeChartsEngineMessages;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.specificities.core.functions.SpecificitesResult;
+import org.txm.specificities.core.preferences.SpecificitiesPreferences;
+
+/**
+ * Creates a specificities chart from the specified <code>SpecificitesResult</code> result.
+ * @author sjacquot
+ *
+ */
+public class JFCSpecificitiesBarChartCreator extends JFCChartCreator {
+
+	public JFCSpecificitiesBarChartCreator() {
+	}
+
+	@Override
+	public JFreeChart createChart(Object resultData, String preferencesNode) {
+
+		SpecificitesResult specificitiesResult = (SpecificitesResult) resultData;
+
+		// parameters
+		boolean transpose = TXMPreferences.getBoolean(preferencesNode, resultData, SpecificitiesPreferences.CHART_TRANSPOSE);
+		boolean drawBars = TXMPreferences.getBoolean(preferencesNode, resultData, SpecificitiesPreferences.CHART_DRAW_BARS);
+		boolean drawLines = TXMPreferences.getBoolean(preferencesNode, resultData, SpecificitiesPreferences.CHART_DRAW_LINES);
+		float banality = TXMPreferences.getFloat(preferencesNode, resultData, SpecificitiesPreferences.CHART_BANALITY);
+		
+		JFreeChart chart = null;
+
+
+		// FIXME: XY bar chart version
+		// Create the data set
+		final XYSeriesCollection dataset = new XYSeriesCollection();
+
+
+		String[] xAxisSymbols;
+
+		// Transpose the data set
+		if(transpose)	{
+	        xAxisSymbols = new String[specificitiesResult.getSelectedTypeNames().length];
+
+			for(int i = 0; i < specificitiesResult.getSelectedPartNames().length; i++) {
+				XYSeries series = new XYSeries(specificitiesResult.getSelectedPartNames()[i]);
+				dataset.addSeries(series);
+
+
+				for(int j = 0; j < specificitiesResult.getSelectedTypeNames().length; j++) {
+					series.add(j, specificitiesResult.getSelectedSpecificitiesIndex()[j][i]);
+					// Add X axis symbol
+					xAxisSymbols[j] = specificitiesResult.getSelectedTypeNames()[j];
+				}
+			}
+
+		}
+		else {
+	        xAxisSymbols = new String[specificitiesResult.getSelectedPartNames().length];
+
+			for(int i = 0; i < specificitiesResult.getSelectedTypeNames().length; i++) {
+
+				XYSeries series = new XYSeries(specificitiesResult.getSelectedTypeNames()[i]);
+				dataset.addSeries(series);
+
+				for(int j = 0; j < specificitiesResult.getSelectedPartNames().length; j++) {
+					series.add(j, specificitiesResult.getSelectedSpecificitiesIndex()[i][j]);
+					// Add X axis symbol
+					xAxisSymbols[j] = specificitiesResult.getSelectedPartNames()[j];
+				}
+			}
+		}
+
+        if(drawBars)	{
+			// Create the bar chart
+	        chart = this.getChartsEngine().createXYBarChart(dataset, specificitiesResult.getName(), ChartsEngineMessages.ChartsEngine_SPECIFICITIES_X_AXIS_LABEL, ChartsEngineMessages.ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL, true, false, false, xAxisSymbols);
+        }
+        else	{
+			// Create the line chart
+	        chart = this.getChartsEngine().createXYLineChart(dataset, specificitiesResult.getName(), ChartsEngineMessages.ChartsEngine_SPECIFICITIES_X_AXIS_LABEL, ChartsEngineMessages.ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL,
+	        		true, false, true, true, true, false, false, xAxisSymbols);
+        }
+
+        ((IItemSelectionRenderer) chart.getXYPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_SPECIFICITIES);
+
+
+        // Custom range axis for ticks drawing options
+        double minimumValue = DatasetUtilities.findMinimumRangeValue(chart.getXYPlot().getDataset()).doubleValue();
+        double maximumValue = DatasetUtilities.findMaximumRangeValue(chart.getXYPlot().getDataset()).doubleValue();
+        // Adjust ticks values according to data set contains only positives values or only negatives values
+        if(minimumValue > 0)	{
+        	minimumValue = 0;
+        }
+        if(maximumValue < 0)	{
+        	maximumValue = banality;
+        }
+
+        // Custom range axis to cut the values to minimum and maximum values
+        chart.getXYPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) chart.getXYPlot().getRangeAxis(), true, true, minimumValue, maximumValue));
+
+
+        // Add positive banality marker
+        Marker marker = new ValueMarker(banality);
+        marker.setPaint(Color.red);
+        marker.setLabel(JFreeChartsEngineMessages.bind(ChartsEngineMessages.ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL, banality));
+        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
+        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
+        chart.getXYPlot().addRangeMarker(marker);
+
+
+        // Add negative banality marker
+        marker = new ValueMarker(-banality);
+        marker.setPaint(Color.red);
+        marker.setLabel(JFreeChartsEngineMessages.bind(ChartsEngineMessages.ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL, -banality));
+        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
+        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
+        chart.getXYPlot().addRangeMarker(marker);
+
+
+
+		// FIXME: Category bar chart version
+//		// Create the data set
+//		final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
+//
+//		// Transpose the data set
+//		if(transpose)	{
+//			for(int i = 0; i < specificitiesResult.getSelectedTypeNames().length; i++) {
+//				for(int j = 0; j < specificitiesResult.getSelectedPartNames().length; j++) {
+//					dataset.addValue(specificitiesResult.getSelectedSpecificitiesIndex()[i][j],
+//							specificitiesResult.getSelectedPartNames()[j],
+//							specificitiesResult.getSelectedTypeNames()[i]);
+//				}
+//			}
+//		}
+//		else {
+//			for(int i = 0; i < specificitiesResult.getSelectedPartNames().length; i++) {
+//				for(int j = 0; j < specificitiesResult.getSelectedTypeNames().length; j++) {
+//					dataset.addValue(specificitiesResult.getSelectedSpecificitiesIndex()[j][i],
+//							specificitiesResult.getSelectedTypeNames()[j],
+//							specificitiesResult.getSelectedPartNames()[i]);
+//				}
+//			}
+//		}
+//
+//        if(drawBars)	{
+//			// Create the bar chart
+//	        chart = this.createCategoryBarChart(dataset, specificitiesResult.getName(), ChartsEngineMessages.ChartsEngine_SPECIFICITIES_X_AXIS_LABEL, ChartsEngineMessages.ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL, true, false);
+//        }
+//        else	{
+//			// Create the line chart
+//	        chart = this.createCategoryLineChart(dataset, specificitiesResult.getName(), ChartsEngineMessages.ChartsEngine_SPECIFICITIES_X_AXIS_LABEL, ChartsEngineMessages.ChartsEngine_SPECIFICITIES_Y_AXIS_LABEL, true, false);
+//        }
+//        ((IItemSelectionRenderer) chart.getCategoryPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_SPECIFICITIES);
+//
+//
+//        // Custom range axis for ticks drawing options
+//        double minimumValue = DatasetUtilities.findMinimumRangeValue(chart.getCategoryPlot().getDataset()).doubleValue();
+//        double maximumValue = DatasetUtilities.findMaximumRangeValue(chart.getCategoryPlot().getDataset()).doubleValue();
+//        // Adjust ticks values according to data set contains only positives values or only negatives values
+//        if(minimumValue > 0)	{
+//        	minimumValue = 0;
+//        }
+//        if(maximumValue < 0)	{
+//        	maximumValue = banality;
+//        }
+//
+//        // Custom range axis to cut the values to minimum and maximum values
+//        chart.getCategoryPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) chart.getCategoryPlot().getRangeAxis(), true, true, minimumValue, maximumValue));
+//
+//
+//        // Add positive banality marker
+//        Marker marker = new ValueMarker(banality);
+//        marker.setPaint(Color.red);
+//        marker.setLabel(JFreeChartsEngineMessages.bind(ChartsEngineMessages.ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL, banality));
+//        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
+//        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
+//        chart.getCategoryPlot().addRangeMarker(marker);
+//
+//
+//        // Add negative banality marker
+//        marker = new ValueMarker(-banality);
+//        marker.setPaint(Color.red);
+//        marker.setLabel(JFreeChartsEngineMessages.bind(ChartsEngineMessages.ChartsEngine_SPECIFICITIES_BANALITY_MARKER_LABEL, -banality));
+//        marker.setLabelAnchor(RectangleAnchor.TOP_RIGHT);
+//        marker.setLabelTextAnchor(TextAnchor.BOTTOM_RIGHT);
+//        chart.getCategoryPlot().addRangeMarker(marker);
+
+
+//        int itemsColorsRenderingMode = Theme.ITEMS_RENDERING_COLORS_MODE;
+//		// Grayscale
+//        if(grayscale)	{
+//        	itemsColorsRenderingMode = Theme.ITEMS_RENDERING_GRAYSCALE_MODE;
+//        }
+//
+//        // Re-apply theme to the chart to match the colors rendering mode
+//        // FIXME : the rendering mode should be pass to all methods, even base methods as createXYLineChart(), createBarChart(), etc.
+//		this.theme.applyThemeToChart(chart, itemsColorsRenderingMode);
+
+		return chart;
+		
+	}
+
+
+	@Override
+	public Class getResultDataClass() {
+		return SpecificitesResult.class;
+	}
+	
+
+	
+	
+
+}

Property changes on: tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/jfreechart/JFCSpecificitiesBarChartCreator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/preferences/SpecificitiesPreferences.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/preferences/SpecificitiesPreferences.java	(revision 0)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/preferences/SpecificitiesPreferences.java	(revision 73)
@@ -0,0 +1,53 @@
+package org.txm.specificities.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 sjacquot
+ *
+ */
+public class SpecificitiesPreferences extends TXMPreferences {
+
+
+	// auto populate the preference node qualifier from the current bundle id
+	public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(SpecificitiesPreferences.class).getSymbolicName();
+	
+	public static final String PREFERENCES_PREFIX = "specificities_"; //$NON-NLS-1$
+	
+	
+	public static final String MAX_SCORE = PREFERENCES_PREFIX + "maxscore"; //$NON-NLS-1$
+	public static final String FORMAT = PREFERENCES_PREFIX + "format"; //$NON-NLS-1$
+	
+	// charts
+	public static final String CHART_TRANSPOSE = PREFERENCES_PREFIX + "chart_transpose"; //$NON-NLS-1$
+	public static final String CHART_DRAW_BARS = PREFERENCES_PREFIX + "chart_draw_bars"; //$NON-NLS-1$
+	public static final String CHART_DRAW_LINES = PREFERENCES_PREFIX + "chart_draw_lines"; //$NON-NLS-1$
+	public static final String CHART_BANALITY = PREFERENCES_PREFIX + "chart_banality"; //$NON-NLS-1$
+
+	public SpecificitiesPreferences() {
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public void initializeDefaultPreferences() {
+		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
+		
+		preferences.put(FORMAT, "%,.1f");
+		preferences.putInt(MAX_SCORE, 1);
+		
+		preferences.putBoolean(CHART_TRANSPOSE, false);
+		preferences.putBoolean(CHART_DRAW_BARS, true);
+		preferences.putBoolean(CHART_DRAW_LINES, false);
+		preferences.putFloat(CHART_BANALITY, 2);
+		
+		
+		// shared charts rendering preferences
+		super.initializeChartsEngineSharedPreferences(preferences);
+	}
+	
+}

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

