Revision 180

tmp/org.txm.ca.core/.classpath (revision 180)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<classpath>
3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5
	<classpathentry kind="src" path="src"/>
6
	<classpathentry kind="output" path="bin"/>
7
</classpath>
0 8

  
tmp/org.txm.ca.core/META-INF/MANIFEST.MF (revision 180)
1
Manifest-Version: 1.0
2
Bundle-ManifestVersion: 2
3
Bundle-Name: CA Core
4
Bundle-SymbolicName: org.txm.ca.core;singleton:=true
5
Bundle-Version: 1.0.0.qualifier
6
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
7
Require-Bundle: org.txm.chartsengine.core;bundle-version="1.0.0",
8
 org.txm.core;bundle-version="0.7.0",
9
 org.eclipse.core.runtime;bundle-version="3.10.0",
10
 org.txm.chartsengine.r.core;bundle-version="1.0.0",
11
 org.txm.chartsengine.jfreechart.core;bundle-version="1.0.0",
12
 org.txm.lexicaltable.core
13
Export-Package: org.txm.ca.core.chartsengine.base,
14
 org.txm.ca.core.chartsengine.jfreechart.datasets,
15
 org.txm.ca.core.chartsengine.jfreechart.themes.highcharts.chartcreators,
16
 org.txm.ca.core.chartsengine.jfreechart.themes.highcharts.renderers,
17
 org.txm.ca.core.chartsengine.r,
18
 org.txm.ca.core.functions,
19
 org.txm.ca.core.messages,
20
 org.txm.ca.core.preferences,
21
 org.txm.ca.core.statsengine.r.functions
0 22

  
tmp/org.txm.ca.core/.project (revision 180)
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>org.txm.ca.core</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>org.eclipse.pde.ManifestBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
		<buildCommand>
19
			<name>org.eclipse.pde.SchemaBuilder</name>
20
			<arguments>
21
			</arguments>
22
		</buildCommand>
23
	</buildSpec>
24
	<natures>
25
		<nature>org.eclipse.pde.PluginNature</nature>
26
		<nature>org.eclipse.jdt.core.javanature</nature>
27
	</natures>
28
</projectDescription>
0 29

  
tmp/org.txm.ca.core/src/org/txm/ca/core/preferences/CAPreferences.java (revision 180)
1
package org.txm.ca.core.preferences;
2

  
3

  
4
import org.eclipse.core.runtime.preferences.DefaultScope;
5
import org.osgi.framework.FrameworkUtil;
6
import org.osgi.service.prefs.Preferences;
7
import org.txm.core.preferences.TXMPreferences;
8

  
9
/**
10
 * Default preferences initializer.
11
 * 
12
 * @author mdecorde
13
 * @author sjacquot
14
 *
15
 */
16
public class CAPreferences extends TXMPreferences {
17

  
18

  
19
	// auto populate the preference node qualifier from the current bundle id
20
	public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(CAPreferences.class).getSymbolicName();
21

  
22
	
23
	public static final String PREFERENCES_PREFIX = "ca_"; //$NON-NLS-1$
24
	
25
	
26
	
27
	/** Lexical table FMIN. */
28
	public static final String F_MIN = PREFERENCES_PREFIX + "lt_fmin"; //$NON-NLS-1$
29
	/** Lexical table VMAX. */
30
	public static final String V_MAX = PREFERENCES_PREFIX + "lt_vmax"; //$NON-NLS-1$
31

  
32
	/** The Constant SHOWINDIVIDUALS. */
33
	public static final String SHOW_INDIVIDUALS = PREFERENCES_PREFIX + "chart_show_individuals"; //$NON-NLS-1$
34

  
35
	/** The Constant SHOWVARIABLES. */
36
	public static final String SHOW_VARIABLES = PREFERENCES_PREFIX + "chart_show_variables"; //$NON-NLS-1$
37

  
38
	/** The Constant QUALITYDISPLAY. */
39
	public static final String QUALITY_DISPLAY_FORMAT = PREFERENCES_PREFIX + "quality_display_format"; //$NON-NLS-1$
40

  
41
	/** The Constant CONTRIBDISPLAY. */
42
	public static final String CONTRIB_DISPLAY_FORMAT = PREFERENCES_PREFIX + "contrib_display_format"; //$NON-NLS-1$
43

  
44
	/** The Constant MASSDISPLAY. */
45
	public static final String MASS_DISPLAY_FORMAT = PREFERENCES_PREFIX + "mass_display_format"; //$NON-NLS-1$
46

  
47
	public static final String CHI_DISPLAY_FORMAT = PREFERENCES_PREFIX + "chi_display_format"; //$NON-NLS-1$
48
	
49
	/** The Constant DISTDISPLAY. */
50
	public static final String DIST_DISPLAY_FORMAT = PREFERENCES_PREFIX + "dist_display_format"; //$NON-NLS-1$
51

  
52
	/** The Constant COS2DISPLAY. */
53
	public static final String COS2_DISPLAY_FORMAT = PREFERENCES_PREFIX + "cos2_display_format"; //$NON-NLS-1$
54

  
55
	/** The Constant COORDDISPLAY. */
56
	public static final String COORD_DISPLAY_FORMAT = PREFERENCES_PREFIX + "coord_display_format"; //$NON-NLS-1$
57

  
58
	
59
	public static final String FIRST_DIMENSION = PREFERENCES_PREFIX + "first_dimension"; //$NON-NLS-1$
60
	public static final String SECOND_DIMENSION = PREFERENCES_PREFIX + "second_dimension"; //$NON-NLS-1$
61
	
62
	
63
	/**
64
	 * 
65
	 */
66
	public CAPreferences() {
67
		// TODO Auto-generated constructor stub
68
	}
69

  
70
	@Override
71
	public void initializeDefaultPreferences() {
72
		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
73
		
74
		preferences.putInt(F_MIN, 10);
75
		preferences.putInt(V_MAX, 200);
76

  
77
		String defaultFormat = "0.00"; //$NON-NLS-1$
78
		preferences.put(QUALITY_DISPLAY_FORMAT, defaultFormat);
79
		preferences.put(CONTRIB_DISPLAY_FORMAT, defaultFormat);
80
		preferences.put(MASS_DISPLAY_FORMAT, defaultFormat);
81
		preferences.put(CHI_DISPLAY_FORMAT, defaultFormat);
82
		preferences.put(DIST_DISPLAY_FORMAT, defaultFormat);
83
		preferences.put(COS2_DISPLAY_FORMAT, defaultFormat);
84
		preferences.put(COORD_DISPLAY_FORMAT, defaultFormat);
85

  
86
		
87
		preferences.putBoolean(SHOW_INDIVIDUALS, true);
88
		preferences.putBoolean(SHOW_VARIABLES, true);
89

  
90
		preferences.putInt(FIRST_DIMENSION, 1);
91
		preferences.putInt(SECOND_DIMENSION, 2);
92
		
93
		
94
		// shared charts rendering preferences
95
		super.initializeChartsEngineSharedPreferences(preferences);
96
	}
97
	
98
}
0 99

  
tmp/org.txm.ca.core/src/org/txm/ca/core/statsengine/r/functions/FactoMineRCA.java (revision 180)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.ca.core.statsengine.r.functions;
29

  
30
import java.io.File;
31
import java.util.Arrays;
32

  
33
import org.rosuda.REngine.REXP;
34
import org.rosuda.REngine.REXPMismatchException;
35
import org.txm.Messages;
36
import org.txm.stat.StatException;
37
import org.txm.stat.data.LexicalTable;
38
import org.txm.stat.engine.r.RWorkspace;
39
import org.txm.stat.engine.r.RWorkspaceException;
40
import org.txm.stat.engine.r.data.QuantitativeDataStructureImpl;
41

  
42
// TODO: Auto-generated Javadoc
43
/**
44
 * Access to the R implementation of the Correspondance Analysis.
45
 *
46
 * @author mdecorde
47
 */
48
public class FactoMineRCA implements ICA {
49

  
50
	/** The singular values. */
51
	private double[] valeursPropres = null;
52
	
53
	/** The singular values2. */
54
	private double[] singularValues = null;
55

  
56
	/** The rowmass. */
57
	private double[] rowmass = null;
58
	
59
	/** The rowdist. */
60
	private double[] rowdist = null;
61
	
62
	/** The rowinertia. */
63
	private double[] rowinertia = null;
64
	
65
	/** The colmass. */
66
	private double[] colmass = null;
67
	
68
	/** The coldist. */
69
	private double[] coldist = null;
70
	
71
	/** The colinertia. */
72
	private double[] colinertia = null;
73

  
74
	/** The rowcos2. */
75
	private double[][] rowcos2 = null;
76
	
77
	/** The rowcontrib. */
78
	private double[][] rowcontrib = null;
79
	
80
	/** The colcos2. */
81
	private double[][] colcos2 = null;
82
	
83
	/** The colcontrib. */
84
	private double[][] colcontrib = null;
85

  
86
	/** The rw. */
87
	private final RWorkspace rw = RWorkspace.getRWorkspaceInstance();
88
	
89
	/** The symbol. */
90
	private final String symbol = QuantitativeDataStructureImpl.createSymbole(FactoMineRCA.class);
91

  
92
	/** The rowscoords. */
93
	private double[][] rowscoords;
94

  
95
	/** The colscoords. */
96
	private double[][] colscoords;
97

  
98
	private LexicalTable table;
99
	
100
	/**
101
	 * Create a correspondance analysis on the given table. The correspondance
102
	 * analysis is computed as soon as the object is created.
103
	 *
104
	 * @param table the table
105
	 * @throws StatException the stat exception
106
	 */
107
	public FactoMineRCA(LexicalTable table) throws StatException {
108

  
109
		if (!rw.containsVariable(table.getSymbol())) {
110
			throw new StatException(Messages.CA_0);
111
		}
112

  
113
		loadLibrary();
114

  
115
		this.table = table;
116
		try {
117
			//rw.callFunctionAndAffect("FactoMineR:CA", new String[] { table.getSymbol() }, symbol); //$NON-NLS-1$
118
			rw.eval(symbol+" <- FactoMineR::CA("+table.getSymbol()+", graph=FALSE)"); //$NON-NLS-1$ //$NON-NLS-2$
119
		} catch (RWorkspaceException e) {
120
			throw new StatException(Messages.CA_2 + e.getMessage(), e);
121
		}
122
	}
123

  
124
	/* (non-Javadoc)
125
	 * @see org.txm.stat.engine.r.function.ICA#getColContrib()
126
	 */
127
	@Override
128
	public double[][] getColContrib() throws StatException {
129
		if (colcontrib == null) {
130
			try {
131
				REXP sv = rw.extractItemFromListByName(symbol, "col$contrib"); //$NON-NLS-1$
132
				colcontrib = sv.asDoubleMatrix();
133
				// Arrays.sort(rowdist);
134
			} catch (RWorkspaceException e) {
135
				throw new StatException(Messages.FactoMineRCA_2 + e.getMessage(), e);
136
			} catch (REXPMismatchException e) {
137
				// TODO Auto-generated catch block
138
				org.txm.utils.logger.Log.printStackTrace(e);
139
			}
140
		}
141
		return colcontrib;
142
	}
143

  
144
	/* (non-Javadoc)
145
	 * @see org.txm.stat.engine.r.function.ICA#getColCos2()
146
	 */
147
	@Override
148
	public double[][] getColCos2() throws StatException {
149
		if (colcos2 == null) {
150
			try {
151
				REXP sv = rw.extractItemFromListByName(symbol, "col$cos2"); //$NON-NLS-1$
152
				colcos2 = sv.asDoubleMatrix();
153
				// Arrays.sort(rowdist);
154
			} catch (RWorkspaceException e) {
155
				throw new StatException(Messages.FactoMineRCA_3 + e.getMessage(), e);
156
			} catch (REXPMismatchException e) {
157
				// TODO Auto-generated catch block
158
				org.txm.utils.logger.Log.printStackTrace(e);
159
			}
160
		}
161
		return colcos2;
162
	}
163

  
164
	/**
165
	 * Get the rows mass.
166
	 *
167
	 * @return the col dist
168
	 * @throws StatException the stat exception
169
	 */
170
	@Override
171
	public double[] getColDist() throws StatException {
172
		if (coldist == null) 
173
		{
174
			double[][] colcoords = getColsCoords();
175
			coldist = new double[colcoords.length];
176
			for (int i = 0; i < colcoords.length; i++)
177
				for (int c = 0; c < colcoords[i].length; c++)
178
					coldist[i] += Math.pow(colcoords[i][c], 2);
179
		}
180
		return coldist;
181
	}
182

  
183
	/* (non-Javadoc)
184
	 * @see org.txm.stat.engine.r.function.ICA#getColsCoords()
185
	 */
186
	@Override
187
	public double[][] getColsCoords() {
188
		if (colscoords == null) {
189
			try {
190
				REXP exp = rw.extractItemFromListByName(symbol, "col$coord"); //$NON-NLS-1$
191
				colscoords = exp.asDoubleMatrix();
192

  
193
				//System.out.println("Avant:");
194
//				for (int i = 0; i < colscoords.length; i++)
195
//				{
196
//					for (int c = 0; c < colscoords[i].length; c++)
197
//					{
198
//						System.out.println(" "+colscoords[i][c]);
199
//					}
200
//					System.out.println();
201
//				}
202
				
203
				// multiply coords by sv
204
//				this.getSingularValues();
205
//				for (int i = 0; i < colscoords.length; i++)
206
//					for (int c = 0; c < colscoords[i].length; c++)
207
//						colscoords[i][c] = colscoords[i][c] * singularValues[c];
208
//				
209
//				System.out.println("Apres:");
210
//				for (int i = 0; i < colscoords.length; i++)
211
//				{
212
//					for (int c = 0; c < colscoords[i].length; c++)
213
//					{
214
//						System.out.println(" "+colscoords[i][c]);
215
//					}
216
//					System.out.println();
217
//				}
218
						
219
			} catch (Exception e) {
220
				// TODO Auto-generated catch block
221
				org.txm.utils.logger.Log.printStackTrace(e);
222
			}
223
		}
224
		return colscoords;
225
	}
226

  
227
	/**
228
	 * Get the rows mass.
229
	 *
230
	 * @return the cols inertia
231
	 * @throws StatException the stat exception
232
	 */
233
	@Override
234
	public double[] getColsInertia() throws StatException {
235
		if (colinertia == null) {
236
			try {
237
				REXP sv = rw.extractItemFromListByName(symbol, "col$contrib"); //$NON-NLS-1$
238
				colinertia = RWorkspace.toDouble(sv);
239
				// Arrays.sort(colinertia);
240
			} catch (RWorkspaceException e) {
241
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
242
			}
243
		}
244
		return colinertia;
245
	}
246

  
247
	/**
248
	 * Get the rows mass.
249
	 *
250
	 * @return the cols mass
251
	 * @throws StatException the stat exception
252
	 */
253
	@Override
254
	public double[] getColsMass() throws StatException {
255
		if (colmass == null) {
256
			try {
257
				REXP sv = rw.extractItemFromListByName(symbol, "call$marge.col"); //$NON-NLS-1$
258
				colmass = RWorkspace.toDouble(sv);
259
				// Arrays.sort(colmass);
260
			} catch (RWorkspaceException e) {
261
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
262
			}
263
		}
264
		return colmass;
265
	}
266

  
267
	/* (non-Javadoc)
268
	 * @see org.txm.stat.engine.r.function.ICA#getRowContrib()
269
	 */
270
	@Override
271
	public double[][] getRowContrib() throws StatException {
272
		//System.out.println("FACTO: getRowContrib");
273
		if (rowcontrib == null) {
274
			try {
275
				REXP sv = rw.extractItemFromListByName(symbol, "row$contrib"); //$NON-NLS-1$
276
				rowcontrib = sv.asDoubleMatrix();
277
				for (int i = 0 ; i < rowcontrib.length ; i++)
278
					for (int j = 0 ; j < rowcontrib[i].length ; j++)
279
						rowcontrib[i][j] = rowcontrib[i][j] / 100.0; 
280
				// Arrays.sort(rowdist);
281
			} catch (RWorkspaceException e) {
282
				throw new StatException(Messages.FactoMineRCA_4 + e.getMessage(), e);
283
			} catch (REXPMismatchException e) {
284
				// TODO Auto-generated catch block
285
				org.txm.utils.logger.Log.printStackTrace(e);
286
			}
287
		}
288
		return rowcontrib;
289
	}
290

  
291
	/* (non-Javadoc)
292
	 * @see org.txm.stat.engine.r.function.ICA#getRowCos2()
293
	 */
294
	@Override
295
	public double[][] getRowCos2() throws StatException {
296
		if (rowcos2 == null) {
297
			try {
298
				REXP sv = rw.extractItemFromListByName(symbol, "row$cos2"); //$NON-NLS-1$
299
				rowcos2 = sv.asDoubleMatrix();
300
				// Arrays.sort(rowdist);
301
			} catch (RWorkspaceException e) {
302
				throw new StatException(Messages.FactoMineRCA_5 + e.getMessage(), e);
303
			} catch (REXPMismatchException e) {
304
				// TODO Auto-generated catch block
305
				org.txm.utils.logger.Log.printStackTrace(e);
306
			}
307
		}
308
		return rowcos2;
309
	}
310

  
311
	/**
312
	 * Get the rows mass.
313
	 *
314
	 * @return the row dist
315
	 * @throws StatException the stat exception
316
	 */
317
	@Override
318
	public double[] getRowDist() throws StatException {
319
		if (rowdist == null)
320
		{
321
			double[][] rowcoords = getRowsCoords();
322
			rowdist = new double[rowcoords.length];
323
			for (int i = 0; i < rowcoords.length; i++)
324
				for (int c = 0; c < rowcoords[i].length; c++)
325
					rowdist[i] += Math.pow(rowcoords[i][c], 2);
326
		}
327
		return rowdist;
328
	}
329

  
330
	/* (non-Javadoc)
331
	 * @see org.txm.stat.engine.r.function.ICA#getRowsCoords()
332
	 */
333
	@Override
334
	public double[][] getRowsCoords() {
335
		if (rowscoords == null) {
336
			try {
337
				REXP sv = rw.extractItemFromListByName(symbol, "row$coord"); //$NON-NLS-1$
338
				rowscoords = sv.asDoubleMatrix();
339
				
340
//				this.getSingularValues();
341
//				//System.out.println("Apres:");
342
//				for (int i = 0; i < rowscoords.length; i++)
343
//				{
344
//					for (int c = 0; c < rowscoords[i].length; c++)
345
//					{
346
//						rowscoords[i][c] = rowscoords[i][c] * singularValues[c];
347
//				//		System.out.println(" "+rowscoords[i][c]);
348
//					}
349
//					//System.out.println();
350
//				}
351
						
352
			} catch (Exception e) {
353
				// TODO Auto-generated catch block
354
				org.txm.utils.logger.Log.printStackTrace(e);
355
			}
356
		}
357
		return rowscoords;
358
	}
359

  
360
	/**
361
	 * Get the rows mass.
362
	 *
363
	 * @return the rows inertia
364
	 * @throws StatException the stat exception
365
	 */
366
	@Override
367
	public double[] getRowsInertia() throws StatException {
368
		if (rowinertia == null) {
369
			try {
370
				REXP sv = rw.extractItemFromListByName(symbol, "row$contrib"); //$NON-NLS-1$
371
				rowinertia = RWorkspace.toDouble(sv);
372
				// Arrays.sort(rowinertia);
373
			} catch (RWorkspaceException e) {
374
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
375
			}
376
		}
377
		return rowinertia;
378
	}
379

  
380
	/**
381
	 * Get the rows mass.
382
	 *
383
	 * @return the rows mass
384
	 * @throws StatException the stat exception
385
	 */
386
	@Override
387
	public double[] getRowsMass() throws StatException {
388
		if (rowmass == null) {
389
			try {
390
				REXP sv = rw.extractItemFromListByName(symbol, "call$marge.row"); //$NON-NLS-1$
391
				rowmass = RWorkspace.toDouble(sv);
392
				// Arrays.sort(rowmass);
393
			} catch (RWorkspaceException e) {
394
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
395
			}
396
		}
397
		return rowmass;
398
	}
399

  
400
	/**
401
	 * Get the singular values.
402
	 *
403
	 * @return the singular values
404
	 * @throws StatException the stat exception
405
	 */
406
	@Override
407
	public double[] getSingularValues() throws StatException {
408
		if (singularValues == null) {
409
			getValeursPropres();
410
			singularValues = new double[valeursPropres.length];
411
			for(int i = 0 ; i < valeursPropres.length ; i++)
412
				singularValues[i] = Math.pow(valeursPropres[i], 0.5);
413
		}
414
		return singularValues;
415
	}
416

  
417
	/* (non-Javadoc)
418
	 * @see org.txm.stat.engine.r.function.ICA#getSymbol()
419
	 */
420
	@Override
421
	public String getSymbol() {
422
		return symbol;
423
	}
424

  
425
	/**
426
	 * Gets the valeurs propres.
427
	 *
428
	 * @return the singular values pow 2
429
	 * @throws StatException the stat exception
430
	 */
431
	@Override
432
	public double[] getValeursPropres() throws StatException {
433
		if (valeursPropres == null) {
434
			try {
435
				REXP sv = rw.eval(symbol+"$eig$eigenvalue"); //$NON-NLS-1$
436
				valeursPropres = RWorkspace.toDouble(sv);
437
				// remove last singular value
438
				if (valeursPropres.length == table.getNColumns())
439
					valeursPropres = Arrays.copyOfRange(valeursPropres, 0, valeursPropres.length -1);
440
				// Arrays.sort(singularValues);
441
			} catch (RWorkspaceException e) {
442
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
443
			}
444
		}
445
		return valeursPropres;
446
		
447
	}
448

  
449
	/* (non-Javadoc)
450
	 * @see org.txm.stat.engine.r.function.ICA#loadLibrary()
451
	 */
452
	@Override
453
	public boolean loadLibrary(){
454
		try {
455
			rw.voidEval("library(FactoMineR)"); //$NON-NLS-1$
456
		} catch (RWorkspaceException e) {
457
			System.out.println(Messages.CA_16+ e);
458
			return false;
459
		}
460
		return true;
461
	}
462

  
463

  
464
	/**
465
	 * Draw in the given file a plot of the factorial map.
466
	 *
467
	 * @param file the file
468
	 * @param encoding the encoding
469
	 * @param colseparator the colseparator
470
	 * @param txtseparator the txtseparator
471
	 * @return true, if successful
472
	 */
473
	@Override
474
	public boolean toTxt(File file, String encoding, String colseparator, String txtseparator) {
475
		try {
476
			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
477
			rw.eval("sink(file=\"" + file.getAbsolutePath().replace("\\", "\\\\")+"\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
478
			rw.eval("print("+symbol+")"); //$NON-NLS-1$ //$NON-NLS-2$
479
			
480
			rw.eval("print("+symbol+"$eig)"); //$NON-NLS-1$ //$NON-NLS-2$
481
			
482
			rw.eval("print("+symbol+"$col)"); //$NON-NLS-1$ //$NON-NLS-2$
483
			
484
			rw.eval("print("+symbol+"$col$coord)"); //$NON-NLS-1$ //$NON-NLS-2$
485
			
486
			rw.eval("print("+symbol+"$col$cos2)"); //$NON-NLS-1$ //$NON-NLS-2$
487
			
488
			rw.eval("print("+symbol+"$col$contrib)"); //$NON-NLS-1$ //$NON-NLS-2$
489
			
490
			rw.eval("print("+symbol+"$row)"); //$NON-NLS-1$ //$NON-NLS-2$
491
			
492
			rw.eval("print("+symbol+"$row$coord)"); //$NON-NLS-1$ //$NON-NLS-2$
493
			
494
			rw.eval("print("+symbol+"$row$cos2)"); //$NON-NLS-1$ //$NON-NLS-2$
495
			
496
			rw.eval("print("+symbol+"$row$contrib)"); //$NON-NLS-1$ //$NON-NLS-2$
497
//			rw.eval("print("+symbol+"$call)"); //$NON-NLS-1$ //$NON-NLS-2$
498
//			rw.eval("print("+symbol+"$call$marge.col)"); //$NON-NLS-1$ //$NON-NLS-2$
499
//			rw.eval("print("+symbol+"$call$marge.row)"); //$NON-NLS-1$ //$NON-NLS-2$
500
			rw.eval("sink()"); //$NON-NLS-1$
501
		} catch (StatException e) {
502
			org.txm.utils.logger.Log.printStackTrace(e);
503
			return false;
504
		}
505
		return true;
506
	}
507
	
508
	
509
	@Override
510
	public int getRowsCount() {
511
		return this.table.getRowsCount();
512
	}
513

  
514
	@Override
515
	public int getColumnsCount() {
516
		return this.table.getColumnsCount();
517
	}
518
}
0 519

  
tmp/org.txm.ca.core/src/org/txm/ca/core/statsengine/r/functions/ICA.java (revision 180)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.ca.core.statsengine.r.functions;
29

  
30
import java.io.File;
31

  
32
import org.txm.stat.StatException;
33

  
34
// TODO: Auto-generated Javadoc
35
/**
36
 * The Interface ICA.
37
 */
38
public interface ICA {
39
	
40
	/**
41
	 * Gets the col contrib.
42
	 *
43
	 * @return the col contrib
44
	 * @throws StatException the stat exception
45
	 */
46
	public double[][] getColContrib() throws StatException;
47

  
48
	/**
49
	 * Gets the col cos2.
50
	 *
51
	 * @return the col cos2
52
	 * @throws StatException the stat exception
53
	 */
54
	public double[][] getColCos2() throws StatException;
55

  
56
	/**
57
	 * Gets the col dist.
58
	 *
59
	 * @return the col dist
60
	 * @throws StatException the stat exception
61
	 */
62
	public double[] getColDist() throws StatException;
63

  
64
	/**
65
	 * Gets the cols coords.
66
	 *
67
	 * @return the cols coords
68
	 */
69
	public double[][] getColsCoords();
70

  
71
	/**
72
	 * Get the rows mass.
73
	 *
74
	 * @return the cols inertia
75
	 * @throws StatException the stat exception
76
	 */
77
	public double[] getColsInertia() throws StatException;
78

  
79
	/**
80
	 * Get the rows mass.
81
	 *
82
	 * @return the cols mass
83
	 * @throws StatException the stat exception
84
	 */
85
	public double[] getColsMass() throws StatException;
86

  
87
	/**
88
	 * Gets the row contrib.
89
	 *
90
	 * @return the row contrib
91
	 * @throws StatException the stat exception
92
	 */
93
	public double[][] getRowContrib() throws StatException;
94

  
95
	/**
96
	 * Gets the row cos2.
97
	 *
98
	 * @return the row cos2
99
	 * @throws StatException the stat exception
100
	 */
101
	public double[][] getRowCos2() throws StatException;
102
	
103
	/**
104
	 * Gets the row dist.
105
	 *
106
	 * @return the row dist
107
	 * @throws StatException the stat exception
108
	 */
109
	public double[] getRowDist() throws StatException;
110
	
111
	/**
112
	 * Gets the rows coords.
113
	 *
114
	 * @return the rows coords
115
	 */
116
	public double[][] getRowsCoords();
117
	
118
	/**
119
	 * Get the rows mass.
120
	 *
121
	 * @return the rows inertia
122
	 * @throws StatException the stat exception
123
	 */
124
	public double[] getRowsInertia() throws StatException;
125
	
126
	/**
127
	 * Get the rows mass.
128
	 *
129
	 * @return the rows mass
130
	 * @throws StatException the stat exception
131
	 */
132
	public double[] getRowsMass() throws StatException;
133
	
134
	/**
135
	 * Get the singular values.
136
	 *
137
	 * @return the singular values
138
	 * @throws StatException the stat exception
139
	 */
140
	public double[] getSingularValues() throws StatException;
141
	
142
	
143
	/**
144
	 * Gets the number of rows.
145
	 * @return the number of rows
146
	 */
147
	public int getRowsCount();
148

  
149
	
150
	/**
151
	 * Gets the number of columns.
152
	 * @return the number of columns
153
	 */
154
	public int getColumnsCount();
155

  
156
	
157
	/**
158
	 * Gets the symbol.
159
	 *
160
	 * @return the symbol
161
	 */
162
	public String getSymbol();
163

  
164
	/**
165
	 * Gets the valeurs propres.
166
	 *
167
	 * @return the valeurs propres
168
	 * @throws StatException the stat exception
169
	 */
170
	public double[] getValeursPropres() throws StatException;
171

  
172
	/**
173
	 * Load library.
174
	 *
175
	 * @return true, if successful
176
	 */
177
	public boolean loadLibrary();
178

  
179

  
180

  
181
	/**
182
	 * Draw in the given file a plot of the factorial map.
183
	 *
184
	 * @param file the file
185
	 * @param encoding the encoding
186
	 * @param colseparator the colseparator
187
	 * @param txtseparator the txtseparator
188
	 * @return true, if successful
189
	 */
190
	public boolean toTxt(File file, String encoding, String colseparator, String txtseparator);
191
}
0 192

  
tmp/org.txm.ca.core/src/org/txm/ca/core/statsengine/r/functions/CA.java (revision 180)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate: 2014-06-10 15:10:24 +0200 (Tue, 10 Jun 2014) $
25
// $LastChangedRevision: 2771 $
26
// $LastChangedBy: sjacquot $ 
27
//
28
package org.txm.ca.core.statsengine.r.functions;
29

  
30
import java.io.File;
31

  
32
import org.rosuda.REngine.REXP;
33
import org.txm.Messages;
34
import org.txm.stat.StatException;
35
import org.txm.stat.data.LexicalTable;
36
import org.txm.stat.engine.r.RWorkspace;
37
import org.txm.stat.engine.r.RWorkspaceException;
38
import org.txm.stat.engine.r.data.QuantitativeDataStructureImpl;
39

  
40
/**
41
 * Access to the R implementation of the Correspondance Analysis.
42
 *
43
 * @author sloiseau, mdecorde, sjacquot
44
 */
45
public class CA implements ICA	{
46

  
47
	/** The singular values. */
48
	private double[] singularValues = null;
49
	
50
	/** The singular values2. */
51
	private double[] singularValues2 = null;
52
	
53
	/** The rowmass. */
54
	private double[] rowmass = null;
55
	
56
	/** The rowdist. */
57
	private double[] rowdist = null;
58
	
59
	/** The rowinertia. */
60
	private double[] rowinertia = null;
61
	
62
	/** The rowcos2. */
63
	private double[][] rowcos2 = null;
64
	
65
	/** The rowcontrib. */
66
	private double[][] rowcontrib = null;
67

  
68
	/** The colmass. */
69
	private double[] colmass = null;
70
	
71
	/** The coldist. */
72
	private double[] coldist = null;
73
	
74
	/** The colinertia. */
75
	private double[] colinertia = null;
76
	
77
	/** The colcos2. */
78
	private double[][] colcos2 = null;
79
	
80
	/** The colcontrib. */
81
	private double[][] colcontrib = null;
82

  
83
	/** The rw. */
84
	private final RWorkspace rw = RWorkspace.getRWorkspaceInstance();
85
	
86
	/** The symbol. */
87
	private final String symbol = QuantitativeDataStructureImpl.createSymbole(CA.class);
88

  
89
	/** The rowscoords. */
90
	private double[][] rowscoords;
91

  
92
	/** The colscoords. */
93
	private double[][] colscoords;
94
	
95
	/**
96
	 * The lexical table.
97
	 */
98
	private LexicalTable table;
99
	
100
	/**
101
	 * Create a correspondance analysis on the given table. The correspondance
102
	 * analysis is computed as soon as the object is created.
103
	 *
104
	 * @param table the table
105
	 * @throws StatException the stat exception
106
	 */
107
	public CA(LexicalTable table) throws StatException {
108

  
109
		
110
		
111
		if (!rw.containsVariable(table.getSymbol())) {
112
			throw new StatException(Messages.CA_0);
113
		}
114

  
115
		loadLibrary();
116
		this.table = table;
117
		
118
		try {
119
			rw.callFunctionAndAffect(
120
					"ca", new String[] { table.getSymbol() }, symbol); //$NON-NLS-1$
121
		} catch (RWorkspaceException e) {
122
			throw new StatException(Messages.CA_2 + e.getMessage(), e);
123
		}
124
	}
125

  
126
	/* (non-Javadoc)
127
	 * @see org.txm.stat.engine.r.function.ICA#getColContrib()
128
	 */
129
	@Override
130
	public double[][] getColContrib() throws StatException {
131

  
132
		double[][] colcoords = getColsCoords();
133
		double[] sv = this.getValeursPropres();
134
		double[] mass = this.getColsMass();
135

  
136
		colcontrib = new double[colcoords.length][3];
137

  
138
		for (int i = 0; i < colcoords.length; i++) {
139
			for(int c = 0 ; c < 3 ; c++)
140
			{
141
				colcontrib[i][c] = 100.0 * mass[i] * (colcoords[i][c] * colcoords[i][c]) / (sv[c]);
142
			}
143
		}
144
		return colcontrib;
145
	}
146

  
147
	/* (non-Javadoc)
148
	 * @see org.txm.stat.engine.r.function.ICA#getColCos2()
149
	 */
150
	@Override
151
	public double[][] getColCos2() {
152
		if (colcos2 == null)
153
		{
154
			double[][] colcoords = getColsCoords();
155
			double[] dist = getColDist();
156
			colcos2 = new double[colcoords.length][3];
157

  
158
			for (int i = 0; i < colcoords.length; i++) {
159

  
160
				double distt = dist[i];
161

  
162
				colcos2[i][0] = Math.pow(colcoords[i][0], 2) / distt;
163
				colcos2[i][1] = Math.pow(colcoords[i][1], 2) / distt;
164
				colcos2[i][2] = Math.pow(colcoords[i][2], 2) / distt;
165
			}
166
		}
167
		return colcos2;
168
	}
169

  
170
	/* (non-Javadoc)
171
	 * @see org.txm.stat.engine.r.function.ICA#getColDist()
172
	 */
173
	@Override
174
	public double[] getColDist() {
175
		if (coldist == null)
176
		{
177
			double[][] colcoords = getColsCoords();
178
			coldist = new double[colcoords.length];
179
			for (int i = 0; i < colcoords.length; i++)
180
				for (int c = 0; c < colcoords[i].length; c++)
181
					coldist[i] += Math.pow(colcoords[i][c], 2);
182
		}
183
		return coldist;
184
	}
185

  
186
	/* (non-Javadoc)
187
	 * @see org.txm.stat.engine.r.function.ICA#getColsCoords()
188
	 */
189
	@Override
190
	public double[][] getColsCoords() {
191
		if (colscoords == null) {
192
			try {
193
				REXP exp = rw.extractItemFromListByName(symbol, "colcoord"); //$NON-NLS-1$
194
				colscoords = exp.asDoubleMatrix();
195

  
196
				// multiply coords by sv
197
				this.getSingularValues();
198
				for (int i = 0; i < colscoords.length; i++)
199
					for (int c = 0; c < colscoords[i].length; c++)
200
						colscoords[i][c] = colscoords[i][c] * singularValues[c];
201
			} catch (Exception e) {
202
				// TODO Auto-generated catch block
203
				org.txm.utils.logger.Log.printStackTrace(e);
204
			}
205
		}
206
		return colscoords;
207
	}
208

  
209
	/**
210
	 * Get the rows mass.
211
	 *
212
	 * @return the cols dist
213
	 * @throws StatException the stat exception
214
	 */
215
	public double[] getColsDist() throws StatException {
216
		if (coldist == null) {
217
			try {
218
				REXP sv = rw.extractItemFromListByName(symbol, "coldist"); //$NON-NLS-1$
219
				coldist = RWorkspace.toDouble(sv);
220
				// Arrays.sort(coldist);
221
			} catch (RWorkspaceException e) {
222
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
223
			}
224
		}
225
		return coldist;
226
	}
227

  
228
	/**
229
	 * Get the rows mass.
230
	 *
231
	 * @return the cols inertia
232
	 * @throws StatException the stat exception
233
	 */
234
	@Override
235
	public double[] getColsInertia() throws StatException {
236
		if (colinertia == null) {
237
			try {
238
				REXP sv = rw.extractItemFromListByName(symbol, "colinertia"); //$NON-NLS-1$
239
				colinertia = RWorkspace.toDouble(sv);
240
				// Arrays.sort(colinertia);
241
			} catch (RWorkspaceException e) {
242
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
243
			}
244
		}
245
		return colinertia;
246
	}
247

  
248
	/**
249
	 * Get the rows mass.
250
	 *
251
	 * @return the cols mass
252
	 * @throws StatException the stat exception
253
	 */
254
	@Override
255
	public double[] getColsMass() throws StatException {
256
		if (colmass == null) {
257
			try {
258
				REXP sv = rw.extractItemFromListByName(symbol, "colmass"); //$NON-NLS-1$
259
				colmass = RWorkspace.toDouble(sv);
260
				// Arrays.sort(colmass);
261
			} catch (RWorkspaceException e) {
262
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
263
			}
264
		}
265
		return colmass;
266
	}
267

  
268
	/* (non-Javadoc)
269
	 * @see org.txm.stat.engine.r.function.ICA#getRowContrib()
270
	 */
271
	@Override
272
	public double[][] getRowContrib() throws StatException {
273
		if (rowcontrib != null)
274
			return rowcontrib;
275

  
276
		double[][] rowcoords = getRowsCoords();
277
		double[] sv = this.getValeursPropres();
278
		double[] mass = this.getRowsMass();
279

  
280
		rowcontrib = new double[rowcoords.length][3];
281

  
282
		for (int i = 0; i < rowcoords.length; i++) {
283
			for(int c = 0 ; c <3 ; c++)
284
			{
285
				rowcontrib[i][c] = 100.0 * mass[i] * (rowcoords[i][c] * rowcoords[i][c]) / (sv[c]);
286
			}
287
		}
288
		return rowcontrib;
289
	}
290

  
291
	/* (non-Javadoc)
292
	 * @see org.txm.stat.engine.r.function.ICA#getRowCos2()
293
	 */
294
	@Override
295
	public double[][] getRowCos2() {
296
		if (rowcos2 == null)
297
		{
298
			double[][] rowcoords = getRowsCoords();
299
			double[] dist = getRowDist();
300

  
301
			rowcos2 = new double[rowcoords.length][3];
302

  
303
			for (int i = 0; i < rowcoords.length; i++) {
304

  
305
				double distt = dist[i];
306

  
307
				rowcos2[i][0] = Math.pow(rowcoords[i][0], 2) / distt;
308
				rowcos2[i][1] = Math.pow(rowcoords[i][1], 2) / distt;
309
				rowcos2[i][2] = Math.pow(rowcoords[i][2], 2) / distt;
310
			}
311
		}
312
		return rowcos2;
313
	}
314

  
315
	/* (non-Javadoc)
316
	 * @see org.txm.stat.engine.r.function.ICA#getRowDist()
317
	 */
318
	@Override
319
	public double[] getRowDist() {
320
		if (rowdist == null)
321
		{
322
			double[][] rowcoords = getRowsCoords();
323
			rowdist = new double[rowcoords.length];
324
			for (int i = 0; i < rowcoords.length; i++)
325
				for (int c = 0; c < rowcoords[i].length; c++)
326
					rowdist[i] += Math.pow(rowcoords[i][c], 2);
327
		}
328
		return rowdist;
329
	}
330

  
331
	/* (non-Javadoc)
332
	 * @see org.txm.stat.engine.r.function.ICA#getRowsCoords()
333
	 */
334
	@Override
335
	public double[][] getRowsCoords() {
336
		if (rowscoords == null) {
337
			try {
338
				REXP sv = rw.extractItemFromListByName(symbol, "rowcoord"); //$NON-NLS-1$
339
				rowscoords = sv.asDoubleMatrix();
340

  
341
				this.getSingularValues();
342
				for (int i = 0; i < rowscoords.length; i++)
343
					for (int c = 0; c < rowscoords[i].length; c++)
344
						rowscoords[i][c] = rowscoords[i][c] * singularValues[c];
345
			} catch (Exception e) {
346
				// TODO Auto-generated catch block
347
				org.txm.utils.logger.Log.printStackTrace(e);
348
			}
349
		}
350
		return rowscoords;
351
	}
352

  
353
	/**
354
	 * Get the rows mass.
355
	 *
356
	 * @return the rows dist
357
	 * @throws StatException the stat exception
358
	 */
359
	public double[] getRowsDist() throws StatException {
360
		if (rowdist == null) {
361
			try {
362
				REXP sv = rw.extractItemFromListByName(symbol, "rowdist"); //$NON-NLS-1$
363
				rowdist = RWorkspace.toDouble(sv);
364
				// Arrays.sort(rowdist);
365
			} catch (RWorkspaceException e) {
366
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
367
			}
368
		}
369
		return rowdist;
370
	}
371

  
372
	/**
373
	 * Get the rows mass.
374
	 *
375
	 * @return the rows inertia
376
	 * @throws StatException the stat exception
377
	 */
378
	@Override
379
	public double[] getRowsInertia() throws StatException {
380
		if (rowinertia == null) {
381
			try {
382
				REXP sv = rw.extractItemFromListByName(symbol, "rowinertia"); //$NON-NLS-1$
383
				rowinertia = RWorkspace.toDouble(sv);
384
				// Arrays.sort(rowinertia);
385
			} catch (RWorkspaceException e) {
386
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
387
			}
388
		}
389
		return rowinertia;
390
	}
391

  
392
	/**
393
	 * Get the rows mass.
394
	 *
395
	 * @return the rows mass
396
	 * @throws StatException the stat exception
397
	 */
398
	@Override
399
	public double[] getRowsMass() throws StatException {
400
		if (rowmass == null) {
401
			try {
402
				REXP sv = rw.extractItemFromListByName(symbol, "rowmass"); //$NON-NLS-1$
403
				rowmass = RWorkspace.toDouble(sv);
404
				// Arrays.sort(rowmass);
405
			} catch (RWorkspaceException e) {
406
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
407
			}
408
		}
409
		return rowmass;
410
	}
411

  
412
	/**
413
	 * Get the singular values.
414
	 *
415
	 * @return the singular values
416
	 * @throws StatException the stat exception
417
	 */
418
	@Override
419
	public double[] getSingularValues() throws StatException {
420
		if (singularValues == null) {
421
			try {
422
				REXP sv = rw.extractItemFromListByName(symbol, "sv"); //$NON-NLS-1$
423
				singularValues = RWorkspace.toDouble(sv);
424
				// Arrays.sort(singularValues);
425
			} catch (RWorkspaceException e) {
426
				throw new StatException(Messages.CA_4 + e.getMessage(), e);
427
			}
428
		}
429
		return singularValues;
430
	}
431
	
432
	/**
433
	 * Gets the valeurs propres.
434
	 *
435
	 * @return the singular valeurs pow 2
436
	 * @throws StatException the stat exception
437
	 */
438
	@Override
439
	public double[] getValeursPropres() throws StatException {
440
		if (singularValues2 == null) {
441
			getSingularValues();
442
			singularValues2 = new double[singularValues.length];
443
			for(int i = 0 ; i < singularValues.length ; i++)
444
				singularValues2[i] = Math.pow(singularValues[i], 2);
445
		}
446
		return singularValues2;
447
	}
448

  
449
	/* (non-Javadoc)
450
	 * @see org.txm.stat.engine.r.function.ICA#getSymbol()
451
	 */
452
	@Override
453
	public String getSymbol() {
454
		return symbol;
455
	}
456

  
457
	/* (non-Javadoc)
458
	 * @see org.txm.stat.engine.r.function.ICA#loadLibrary()
459
	 */
460
	@Override
461
	public boolean loadLibrary() {
462
		try {
463
			rw.voidEval("library(ca)"); //$NON-NLS-1$
464
		} catch (RWorkspaceException e) {
465
			System.out.println(Messages.CA_16 + e);
466
			return false;
467
		}
468
		return true;
469
	}
470

  
471

  
472

  
473
	/**
474
	 * Draw in the given file a plot of the factorial map.
475
	 *
476
	 * @param file the file
477
	 * @param encoding the encoding
478
	 * @param colseparator the colseparator
479
	 * @param txtseparator the txtseparator
480
	 * @return true, if successful
481
	 */
482
	@Override
483
	public boolean toTxt(File file, String encoding, String colseparator, String txtseparator) {
484
		try {
485
			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
486
			rw.eval("sink(file=\"" + file.getAbsolutePath().replace("\\", "\\\\")+"\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
487
			rw.eval("print("+symbol+")"); //$NON-NLS-1$ //$NON-NLS-2$
488
			rw.eval("sink()"); //$NON-NLS-1$
489
		} catch (StatException e) {
490
			org.txm.utils.logger.Log.printStackTrace(e);
491
			return false;
492
		}
493
		return true;
494
	}
495

  
496
	@Override
497
	public int getRowsCount() {
498
		return this.table.getRowsCount();
499
	}
500

  
501
	@Override
502
	public int getColumnsCount() {
503
		return this.table.getColumnsCount();
504
	}
505
}
0 506

  
tmp/org.txm.ca.core/src/org/txm/ca/core/messages/CACoreMessages.java (revision 180)
1
package org.txm.ca.core.messages;
2

  
3
import org.eclipse.osgi.util.NLS;
4
import org.txm.core.messages.TXMCoreMessages;
5

  
6
public class CACoreMessages extends NLS {
7

  
8
	private static final String BUNDLE_NAME = "org.txm.ca.core.messages.messages"; //$NON-NLS-1$
9

  
10
	
11
	public static String ChartsEngine_CANT_CREATE_CA_FILE_CHART;
12
	public static String ChartsEngine_CANT_CREATE_CA_SINGULAR_VALUES_FILE_CHART;
13
	
14
	public static String ChartsEngine_CA_FACTORIAL_MAP_TITLE;
15
	public static String ChartsEngine_CA_FACTORIAL_MAP_LEGEND_COLUMNS_LABEL;
16
	public static String ChartsEngine_CA_FACTORIAL_MAP_LEGEND_ROWS_LABEL;
17
	public static String ChartsEngine_CA_FACTORIAL_MAP_AXIS_LABEL_PREFIX;
18
	public static String ChartsEngine_CA_FACTORIAL_MAP_TOOLTIP_ROWS_LABEL;
19
	public static String ChartsEngine_CA_FACTORIAL_MAP_TOOLTIP_COLS_LABEL;
20
	public static String ChartsEngine_CA_FACTORIAL_MAP_TOOLTIP_COORDINATES;
21

  
22
	public static String ChartsEngine_CA_SINGULAR_VALUES_CANT_CREATE_CHART;
23
	public static String ChartsEngine_CA_SINGULAR_VALUES_TITLE;
24
	public static String ChartsEngine_CA_SINGULAR_VALUES_X_AXIS_LABEL;
25
	public static String ChartsEngine_CA_SINGULAR_VALUES_X_LABELS_PREFIX;
26
	public static String ChartsEngine_CA_SINGULAR_VALUES_Y_AXIS_LABEL;
27
	public static String ChartsEngine_CA_SINGULAR_VALUES_TOOLTIP_Y_LABEL;
28
	public static String ChartsEngine_CA_SINGULAR_VALUES_TOOLTIP_PERCENT;
29
	public static String ChartsEngine_CA_SINGULAR_VALUES_TOOLTIP_SUM;
30

  
31

  
32
	
33
	static {
34
		// initialize resource bundle
35
		TXMCoreMessages.initializeMessages(BUNDLE_NAME, CACoreMessages.class);
36
	}
37

  
38
	private CACoreMessages() {
39
	}
40
}
0 41

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff