Revision 199

tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Contrast.java (revision 199)
11 11
import org.txm.chartsengine.r.core.RChartsEngine;
12 12
import org.txm.chartsengine.r.core.themes.DefaultTheme;
13 13
import org.txm.functions.TXMResult;
14
import org.txm.lexicaltable.functions.LexicalTableBuilder;
14
import org.txm.lexicaltable.functions.LexicalTableFactory;
15 15
//import org.txm.progression.core.functions.Progression;
16 16
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
17 17
import org.txm.searchengine.cqp.corpus.Corpus;
......
40 40
		if (partition.getParts().size() < 2) {
41 41
			throw new IllegalArgumentException(Messages.Specificites_0);
42 42
		}
43
		table = LexicalTableBuilder.getLexicalTable(partition, property, Fmin);
43
		table = LexicalTableFactory.getLexicalTable(partition, property, Fmin);
44 44
		
45 45
	}
46 46

  
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificites.java (revision 199)
34 34
import java.util.List;
35 35
import java.util.Set;
36 36

  
37
import org.txm.lexicaltable.functions.LexicalTableBuilder;
37
import org.txm.lexicaltable.functions.LexicalTableFactory;
38 38
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
39 39
import org.txm.searchengine.cqp.corpus.Corpus;
40 40
import org.txm.searchengine.cqp.corpus.Lexicon;
......
98 98
			}
99 99
		}
100 100
		// System.out.println("get/create lexical table");
101
		LexicalTable table = LexicalTableBuilder.getLexicalTable(partition, analysisProperty, Fmin);
101
		LexicalTable table = LexicalTableFactory.getLexicalTable(partition, analysisProperty, Fmin);
102 102
		partition.storeResult(table);
103 103

  
104 104
		// Create a set of the existing types
105 105

  
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 199)
43 43
import org.txm.ca.core.statsengine.r.functions.ICA;
44 44
import org.txm.functions.Function;
45 45
import org.txm.functions.TXMResult;
46
import org.txm.lexicaltable.functions.LexicalTableBuilder;
46
import org.txm.lexicaltable.functions.LexicalTableFactory;
47 47
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
48 48
import org.txm.searchengine.cqp.corpus.Corpus;
49 49
import org.txm.searchengine.cqp.corpus.Partition;
......
164 164
		this.corpus = partition.getCorpus();
165 165
		this.analysisProperty = analysisProperty;
166 166

  
167
		table = LexicalTableBuilder.getLexicalTable(partition, analysisProperty, 1);
167
		table = LexicalTableFactory.getLexicalTable(partition, analysisProperty, 1);
168 168
		partition.storeResult(table);
169 169
		if (useFactoMineR)
170 170
			ca = new FactoMineRCA(table);
......
906 906
	 */
907 907
	public void stepLexicalTable() throws StatException, CqiClientException
908 908
	{
909
		table = LexicalTableBuilder.getLexicalTable(partition, analysisProperty, fmin);
909
		table = LexicalTableFactory.getLexicalTable(partition, analysisProperty, fmin);
910 910
		partition.storeResult(table);
911 911
	}
912 912

  
913 913

  
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/commands/ComputeCAH.java (revision 199)
55 55
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
56 56
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
57 57
import org.txm.core.preferences.TXMPreferences;
58
import org.txm.lexicaltable.functions.LexicalTableBuilder;
58
import org.txm.lexicaltable.functions.LexicalTableFactory;
59 59
import org.txm.rcpapplication.JobsTimer;
60 60
import org.txm.rcpapplication.TxmPreferences;
61 61
import org.txm.rcpapplication.actions.LexicalTableDialog;
......
143 143
					fmin = d.getFmin();
144 144
					vmax = d.getMaxLines();
145 145
					
146
					lexicaltable = LexicalTableBuilder.getLexicalTable(partition, property, fmin); // use the CAPreferencePage Fmin
146
					lexicaltable = LexicalTableFactory.getLexicalTable(partition, property, fmin); // use the CAPreferencePage Fmin
147 147
					lexicaltable.cut(vmax);
148 148
					partition.storeResult(lexicaltable);
149 149
					
150 150

  
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/functions/LexicalTableBuilder.java (revision 199)
1
package org.txm.lexicaltable.functions;
2

  
3
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
4
import org.txm.searchengine.cqp.corpus.Partition;
5
import org.txm.searchengine.cqp.corpus.Property;
6
import org.txm.stat.StatException;
7
import org.txm.stat.data.LexicalTable;
8
import org.txm.stat.engine.r.data.LexicalTableImpl;
9

  
10
public class LexicalTableBuilder {
11
	/**
12
	 * Create a lexical table for this partition given an analysis property.
13
	 * Lexical table are cached and recycled. In order to drop from memory a
14
	 * lexical table, use {@link #dropLexicalTable(Property)}.
15
	 *
16
	 * @param analysisProperty the analysis property
17
	 * @param Fmin the fmin
18
	 * @return the lexical table
19
	 * @throws StatException the stat exception
20
	 * @throws CqiClientException the cqi client exception
21
	 * @author sloiseau
22
	 */
23
	public static LexicalTable getLexicalTable(Partition partition, Property analysisProperty, int Fmin)
24
	throws StatException, CqiClientException {
25
		// System.out.println("CL : test si déja existant ds cache");
26
		/*if (lexicalTables.containsKey(analysisProperty.getName())) {
27
			if (lexicalTables.get(analysisProperty.getName()).getConstructorFmin() == Fmin)
28
				return lexicalTables.get(analysisProperty.getName());
29
		}*/
30
		// System.out.println("CL : fait un new lexique");
31
		LexicalTable t = LexicalTableImpl.getLexicalTable(partition,
32
				analysisProperty, Fmin);
33

  
34
		// System.out.println("CL : put results ds le cache");
35
		partition.storeResult(t);
36
		return t;
37
	}
38
}
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/functions/LexicalTableFactory.java (revision 199)
1
package org.txm.lexicaltable.functions;
2

  
3
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
4
import org.txm.searchengine.cqp.corpus.Partition;
5
import org.txm.searchengine.cqp.corpus.Property;
6
import org.txm.stat.StatException;
7
import org.txm.stat.data.LexicalTable;
8
import org.txm.stat.engine.r.data.LexicalTableImpl;
9

  
10
public class LexicalTableFactory {
11
	/**
12
	 * Create a lexical table for this partition given an analysis property.
13
	 * Lexical table are cached and recycled. In order to drop from memory a
14
	 * lexical table, use {@link #dropLexicalTable(Property)}.
15
	 *
16
	 * @param analysisProperty the analysis property
17
	 * @param Fmin the fmin
18
	 * @return the lexical table
19
	 * @throws StatException the stat exception
20
	 * @throws CqiClientException the cqi client exception
21
	 * @author sloiseau
22
	 */
23
	public static LexicalTable getLexicalTable(Partition partition, Property analysisProperty, int Fmin)
24
	throws StatException, CqiClientException {
25
		// System.out.println("CL : test si déja existant ds cache");
26
		/*if (lexicalTables.containsKey(analysisProperty.getName())) {
27
			if (lexicalTables.get(analysisProperty.getName()).getConstructorFmin() == Fmin)
28
				return lexicalTables.get(analysisProperty.getName());
29
		}*/
30
		// System.out.println("CL : fait un new lexique");
31
		LexicalTable t = LexicalTableImpl.getLexicalTable(partition,
32
				analysisProperty, Fmin);
33

  
34
		// System.out.println("CL : put results ds le cache");
35
		partition.storeResult(t);
36
		return t;
37
	}
38
}
0 39

  
tmp/org.txm.rcp/src/main/java/org/txm/rcpapplication/commands/function/ComputeLexicalTable.java (revision 199)
51 51
import org.txm.ca.core.preferences.CAPreferences;
52 52
//import org.txm.functions.queryindex.QueryIndex;
53 53
import org.txm.functions.index.Index;
54
import org.txm.lexicaltable.functions.LexicalTableBuilder;
54
import org.txm.lexicaltable.functions.LexicalTableFactory;
55 55
import org.txm.rcpapplication.JobsTimer;
56 56
import org.txm.rcpapplication.Messages;
57 57
import org.txm.rcpapplication.StatusLine;
......
86 86
	/** The table. */
87 87
	private LexicalTable table = null;
88 88

  
89
	/** The copy. */
90
	private LexicalTable copy = null;
91

  
92 89
	/** The code. */
93 90
	int code;
94 91

  
......
262 259
						monitor.beginTask(NLS.bind(Messages.ComputeLexicalTable_1, partition.getName(), property), 100);
263 260

  
264 261
						this.acquireSemaphore();
265
						table = LexicalTableBuilder.getLexicalTable(partition, property, Fmin);
262
						table = LexicalTableFactory.getLexicalTable(partition, property, Fmin);
266 263
						this.releaseSemaphore();
267 264
						
268 265
						this.acquireSemaphore();
269
						copy = table.getCopy();
266
						table.cut(vmax);
270 267
						this.releaseSemaphore();
271
						
272
						this.acquireSemaphore();
273
						copy.cut(vmax);
274
						this.releaseSemaphore();
275 268

  
276 269
						monitor.worked(45);
277
						if (monitor.isCanceled() || copy == null) {
270
						if (monitor.isCanceled() || table == null) {
278 271
							return Status.CANCEL_STATUS;
279 272
						}
280 273

  
281
						partition.storeResult(copy);
274
						partition.storeResult(table);
282 275

  
283 276
						monitor.worked(5);
284 277

  
......
288 281
							public void run() {
289 282
								IWorkbenchPage page = window.getActivePage();
290 283
								LexicalTableEditorInput editorInput = new LexicalTableEditorInput(
291
										copy, partition, property);
284
										table, partition, property);
292 285
								try {
293 286
									StatusLine.setMessage(Messages.ComputeLexicalTable_10);
294 287
									page.openEditor(editorInput,
......
475 468
				try {
476 469
					monitor.beginTask("Computing Lexical table with Index: "+firstIndex+" property: "+property, 100);
477 470
					this.acquireSemaphore();
478
					copy = LexicalTableImpl.createLexicalTableImpl(vocabularies,
471
					table = LexicalTableImpl.createLexicalTableImpl(vocabularies,
479 472
							QuantitativeDataStructureImpl
480 473
							.createSymbole(LexicalTableImpl.class), useAllOccurrences);
481 474
					monitor.worked(45);
482 475
					this.releaseSemaphore();
483
					if (monitor.isCanceled() || copy == null)
476
					if (monitor.isCanceled() || table == null)
484 477
						return Status.CANCEL_STATUS;
485 478

  
486
					firstIndex.storeResult(copy);
479
					firstIndex.storeResult(table);
487 480
					monitor.worked(5);
488 481

  
489 482
					monitor.subTask(Messages.ComputeLexicalTable_10);
......
492 485
						public void run() {
493 486
							IWorkbenchPage page = window.getActivePage();
494 487
							LexicalTableEditorInput editorInput = new LexicalTableEditorInput(
495
									copy, partition, property);
488
									table, partition, property);
496 489
							try {
497 490
								StatusLine.setMessage(Messages.ComputeLexicalTable_10);
498 491
								page.openEditor(editorInput,
......
512 505
						@Override
513 506
						public void run() {
514 507
							CorporaView.refresh();
515
							CorporaView.expand(copy.getParent());
508
							CorporaView.expand(table.getParent());
516 509
							QueriesView.refresh();
517 510
							RVariablesView.refresh();
518 511
						}
519 512

  

Also available in: Unified diff