Révision 2609

tmp/org.txm.querycooccurrences.rcp/src/org/txm/functions/coocmatrix/QueryAutoCooccurrence.java (revision 2609)
76 76
	public boolean _compute() throws Exception {
77 77
		coocs = new int[queries.size()][queries.size()];
78 78
		
79
		this.setTask("Querying cooccurrences...");
80
		this.setWorkRemaining(nNodes);
79
		this.monitorSetTask("Querying cooccurrences...");
80
		this.monitorSetWorkRemaining(nNodes);
81 81
		
82 82
		for (int i = 0; i < queries.size(); i++) {
83 83
			int j = i;
84 84
			if (oriented) j = 0; // if the graph is not oriented, we don't need to evaluate all queries
85 85
			for (; j < queries.size(); j++) {
86
				this.worked(1);
86
				this.monitorSetWorked(1);
87 87
				String query = null;
88 88
				if (oriented) {
89 89
					query = "(" + queries.get(i) + "[]{0," + dist + "}" + queries.get(j) + ") " + this.struct;
......
111 111
			coocs[j][i] = coocs[i][j];
112 112
			}
113 113
			}
114
		this.done();
114
		this.monitorDone();
115 115
		
116 116
		return true;
117 117
	}
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 2609)
310 310
		boolean needInit = (this.chartComposite.getChartComponent() == null) && (this.getResult().getChart() != null);
311 311
		
312 312
		// loading chart
313
		this.getResult().setTask(TXMCoreMessages.bind("Loading chart of type {0}...", this.getResult().getResultType())); //$NON-NLS-1$
313
		this.getResult().monitorSetTask(TXMCoreMessages.bind("Loading chart of type {0}...", this.getResult().getResultType())); //$NON-NLS-1$
314 314
		this.loadChart();
315 315
		
316 316
		
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java (revision 2609)
127 127
	 */
128 128
	protected boolean __compute() {
129 129
		
130
		this.setTask("Computing balance with metadata propertyName = " + this.structuralUnitProperty + ", structural unit = " + this.structuralUnit.getName() + " and groupByTexts = " + this.countTexts); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
130
		this.monitorSetTask("Computing balance with metadata propertyName = " + this.structuralUnitProperty + ", structural unit = " + this.structuralUnit.getName() + " and groupByTexts = " + this.countTexts); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
131 131
		try {
132 132
			this.dataset = new HashMap<Integer, Comparable[]>();
133 133
			
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 2609)
600 600
			if (i != j) { // i does point at the beginning of a block of non
601 601
				// existing lines. We have to create the lines between i and j
602 602

  
603
				if (isCanceled()) return new ArrayList<Line>(); // check if user canceled the Job
603
				if (monitorIsCanceled()) return new ArrayList<Line>(); // check if user canceled the Job
604 604

  
605 605
				// First we get all the data we need : values for the view
606 606
				// properties, the analysis property and the reference
......
1640 1640

  
1641 1641
		//write lines
1642 1642
		for (int i = from ; i <= to ; i += packetSize +1) {
1643
			worked(step);
1643
			monitorSetWorked(step);
1644 1644
			//println "worked: $step"
1645 1645
			//println "packet $i -> "+(i+packetSize)
1646 1646
			int to2 = i+packetSize;
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 2609)
211 211
	 */
212 212
	protected boolean renderChart() throws Exception {
213 213
		
214
		this.setTask("Rendering chart for result " + this.getClass() + " and chart type " + this.getChartType() + "...");
214
		this.monitorSetTask("Rendering chart for result " + this.getClass() + " and chart type " + this.getChartType() + "...");
215 215
		
216 216
		Log.finest("*** ChartResult.renderChart(): rendering chart for result " + this.getClass() + " and chart type " + this.getChartType() + "..."); //$NON-NLS-1$
217 217
		
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 2609)
104 104
	/**
105 105
	 * 
106 106
	 * @param parent
107
	 * @throws NullPointerException
108 107
	 */
109 108
	public Partition(CQPCorpus parent) {
110 109
		super(parent);
......
118 117
		super(parametersNodePath);
119 118
	}
120 119
	
120
	
121
	
122
	@Override
123
	protected boolean _compute() throws Exception {
124
		
125
		// create the parts only if they not already exist
126
		if (this.getPartsCount() == 0) {
127
			
128
			if (this.pProperty != null) {
129
				_compute_with_property();
130
			}
131
			else {
132
				_compute_with_lists();
133
			}
134
		}
135
		this.totalsize = -1; // refresh total size at next call of getTotalSize
136
		return true;
137
	}
138
	
139
	
140
	
121 141
	/**
122 142
	 * Computes the Partition using a list of queries.
123 143
	 *
......
136 156
		Log.finest(NLS.bind(SearchEngineCoreMessages.info_creatingNewPartition, this.userName, this.getParent()));
137 157
		long start = System.currentTimeMillis();
138 158
		
139
		this.setTask("Building parts...");
159
		this.monitorSetTask("Building parts...");
140 160
		
141 161
		for (int i = 0; i < pQueries.size(); i++) {
142 162
			String queryS = pQueries.get(i);
......
145 165
			if (pPartNames != null && i < pPartNames.size()) {
146 166
				partName = pPartNames.get(i);
147 167
			}
168
			// ensure the part has a name, if empty
148 169
			if (partName.trim().length() == 0) {
149 170
				partName = "-"; //$NON-NLS-1$
150 171
			}
......
181 202
		
182 203
		Log.finest(NLS.bind(SearchEngineCoreMessages.info_creatingNewPartition, this.userName, this.getParent()));
183 204
		
184
		
185 205
		if (pValues == null) {
186 206
			pValues = pProperty.getValues(corpus);
187 207
		}
......
252 272
	}
253 273
	
254 274
	
255
	@Override
256
	protected boolean _compute() throws Exception {
257
		
258
		// create the parts only if they not already exist
259
		if (this.getParts().size() == 0) {
260
			
261
			if (this.pProperty != null) {
262
				_compute_with_property();
263
			}
264
			else {
265
				_compute_with_lists();
266
			}
267
		}
268
		this.totalsize = -1; // refresh total size at next call of getTotalSize
269
		return true;
270
	}
271 275
	
272 276
	
273 277
	@Override
......
416 420
	
417 421
	/**
418 422
	 * Gets a part specified by its index.
423
	 * The index also represents the raw order in the children list.
419 424
	 * 
420 425
	 * @param index
421 426
	 * @return
422 427
	 */
428
	// FIXME: SJ: became useless?
423 429
	public Part getPart(int index) {
424 430
		return this.getParts().get(index);
425 431
	}
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 2609)
189 189
		}
190 190
		// }
191 191
		this.filterLines();
192
		this.worked(30);
192
		this.monitorSetWorked(30);
193 193
		
194
		this.setTask("Sorting...");
194
		this.monitorSetTask("Sorting...");
195 195
		this.sortLines(SortMode.FREQUNIT, true);
196
		this.worked(30);
196
		this.monitorSetWorked(30);
197 197
		
198 198
		this.cut();
199 199
		
200 200
		this.dirty = false;
201 201
		this.pTopIndex = 0;
202 202
		
203
		this.setTask("Index done.");
203
		this.monitorSetTask("Index done.");
204 204
		
205 205
		return true;
206 206
	}
tmp/org.txm.index.core/src/org/txm/index/core/functions/___Lexicon2.java (revision 2609)
198 198
	protected boolean computeWithMainCorpus(MainCorpus corpus, Property property, IProgressMonitor monitor) throws CqiClientException {
199 199
		// System.out.println("in "+this.getCqpId()+" look for cached lexicon "+property);
200 200
		// System.out.println("not found");
201
		this.setTask("Computing lexicon size...");
201
		this.monitorSetTask("Computing lexicon size...");
202 202
		Log.finest(IndexCoreMessages.lexicon + corpus.getID());
203 203
		int lexiconSize;
204 204
		try {
......
215 215
		
216 216
		int[] freqs;
217 217
		try {
218
			this.setTask("Computing lexicon frequencies...");
218
			this.monitorSetTask("Computing lexicon frequencies...");
219 219
			freqs = CorpusManager.getCorpusManager().getCqiClient().id2Freq(property.getQualifiedName(), ids);
220 220
		}
221 221
		catch (Exception e) {
......
248 248
		int[][] fdist = null;
249 249
		Subcorpus tmp = null;
250 250
		try {
251
			this.setTask("Computing lexicon frequencies...");
251
			this.monitorSetTask("Computing lexicon frequencies...");
252 252
			tmp = corpus.createSubcorpus(new CQLQuery("[]"), "S" + corpus.getNextSubcorpusCounter(), true); //$NON-NLS-1$
253 253
			if (tmp != null) {
254 254
				fdist = CorpusManager.getCorpusManager().getCqiClient().fdist1(tmp.getQualifiedCqpId(), 0, ICqiClient.CQI_CONST_FIELD_MATCH, property.getName());
tmp/org.txm.index.core/src/org/txm/index/core/functions/PartitionIndex.java (revision 2609)
108 108
			currentpartid++;
109 109
		}
110 110
		
111
		this.worked(30);
111
		this.monitorSetWorked(30);
112 112
		
113 113
		setLineCounts();
114 114
		
......
117 117
		this.filterLines();
118 118
		
119 119
		
120
		this.worked(30);
120
		this.monitorSetWorked(30);
121 121
		
122
		this.setTask("Sorting...");
122
		this.monitorSetTask("Sorting...");
123 123
		
124 124
		this.sortLines(SortMode.FREQUNIT, true);
125 125
		
126 126
		this.cut();
127 127
		
128
		this.worked(30);
128
		this.monitorSetWorked(30);
129 129
		
130 130
		this.dirty = false;
131 131
		this.pTopIndex = 0;
132 132
		
133
		this.setTask("Index done.");
133
		this.monitorSetTask("Index done.");
134 134
		
135 135
		return true;
136 136
	}
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 2609)
2567 2567
			this.dirty = true;
2568 2568
			this.computing = false;
2569 2569
			this.hasBeenComputedOnce = false;
2570
			this.setCanceled(true);
2570
			this.monitorSetCanceled(true);
2571 2571
			
2572 2572
			Log.finest(NLS.bind("Computing state of {0} ({1}) has been reset...", this.getName(), this.getClass().getSimpleName()));
2573 2573
			
......
2694 2694
	 * 
2695 2695
	 * @param value
2696 2696
	 */
2697
	public void setCanceled(boolean value) {
2697
	public void monitorSetCanceled(boolean value) {
2698 2698
		if (this.monitor != null) {
2699 2699
			Log.info(NLS.bind("Canceling computing of {0} ({1})...", this.getName(), this.getClass().getSimpleName()));
2700 2700
			this.monitor.setCanceled(value);
......
2706 2706
	 * 
2707 2707
	 * @param name
2708 2708
	 */
2709
	public void setTask(String name) {
2709
	public void monitorSetTask(String name) {
2710 2710
		if (this.monitor != null) {
2711 2711
			this.monitor.subTask(name);
2712 2712
		}
......
2718 2718
	 *
2719 2719
	 * @param amount of work
2720 2720
	 */
2721
	public void worked(int amount) {
2721
	public void monitorSetWorked(int amount) {
2722 2722
		if (this.monitor != null) {
2723 2723
			this.monitor.worked(amount);
2724 2724
		}
......
2730 2730
	 *
2731 2731
	 * @return true if the monitor has been canceled by the user
2732 2732
	 */
2733
	public boolean isCanceled() {
2733
	public boolean monitorIsCanceled() {
2734 2734
		if (this.monitor != null) {
2735 2735
			return this.monitor.isCanceled();
2736 2736
		}
......
2740 2740
	/**
2741 2741
	 * Sets the monitor state as done.
2742 2742
	 */
2743
	public void done() {
2743
	public void monitorDone() {
2744 2744
		if (this.monitor != null) {
2745 2745
			this.monitor.done();
2746 2746
		}
......
2751 2751
	 * 
2752 2752
	 * @param workRemaining number of ticks
2753 2753
	 */
2754
	public void setWorkRemaining(int workRemaining) {
2754
	public void monitorSetWorkRemaining(int workRemaining) {
2755 2755
		if (this.monitor != null) {
2756 2756
			this.monitor.setWorkRemaining(workRemaining);
2757 2757
		}
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 2609)
384 384
			}
385 385
			
386 386
			SubMonitor monitor = null;
387
			if (this.isCanceled()) {
387
			if (this.monitorIsCanceled()) {
388 388
				monitor = SubMonitor.convert(new LogMonitor(), "computing " + this, 100);
389 389
			}
390 390
			
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 2609)
259 259
		// FIXME: debug
260 260
		// System.out.println("cooc: "+corpus+" "+query+" "+properties+" "+limit+" "+maxLeft+" "+minLeft+" "+minRight+" "+maxRight+" "+minFreq+" "+minCof+" "+minScore+" "+includeXpivot);
261 261
		
262
		this.setTask(CooccurrenceCoreMessages.info_buildingQueries);
262
		this.monitorSetTask(CooccurrenceCoreMessages.info_buildingQueries);
263 263
		
264 264
		// clear data
265 265
		try {
......
283 283
			return false;
284 284
		}
285 285
		
286
		this.setTask(CooccurrenceCoreMessages.info_retreivingMatches);
286
		this.monitorSetTask(CooccurrenceCoreMessages.info_retreivingMatches);
287 287
		if (!this.stepGetMatches()) {
288 288
			return false;
289 289
		}
290
		this.worked(20);
290
		this.monitorSetWorked(20);
291 291
		
292
		this.setTask(CooccurrenceCoreMessages.info_buildingLineSignatures);
292
		this.monitorSetTask(CooccurrenceCoreMessages.info_buildingLineSignatures);
293 293
		if (!this.stepBuildSignatures()) {
294 294
			return false;
295 295
		}
296
		this.worked(20);
296
		this.monitorSetWorked(20);
297 297
		
298
		this.setTask(CooccurrenceCoreMessages.info_counting);
298
		this.monitorSetTask(CooccurrenceCoreMessages.info_counting);
299 299
		if (!this.stepCount()) {
300 300
			return false;
301 301
		}
302
		this.worked(20);
302
		this.monitorSetWorked(20);
303 303
		
304
		this.setTask(CooccurrenceCoreMessages.info_buildingLexicalTable);
304
		this.monitorSetTask(CooccurrenceCoreMessages.info_buildingLexicalTable);
305 305
		if (!this.stepBuildLexicalTable()) {
306 306
			return false;
307 307
		}
308
		this.worked(10);
308
		this.monitorSetWorked(10);
309 309
		
310
		this.setTask(CooccurrenceCoreMessages.info_computingSpecificitiesScores);
310
		this.monitorSetTask(CooccurrenceCoreMessages.info_computingSpecificitiesScores);
311 311
		if (!this.stepGetScores()) {
312 312
			return false;
313 313
		}
314 314
		
315 315
		this.clearMemory();
316
		this.done();
316
		this.monitorDone();
317 317
		
318 318
		return true;
319 319
	}
tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java (revision 2609)
329 329
			this.structurePositions = new int[0];
330 330
			this.structureNames = new String[0];
331 331
			
332
			this.setTask("Processing queries...");
332
			this.monitorSetTask("Processing queries...");
333 333
			if (!this.stepQueries()) {
334 334
				return true;
335 335
			}
336 336
			
337
			if (this.isCanceled()) {
337
			if (this.monitorIsCanceled()) {
338 338
				return false;
339 339
			}
340
			this.worked(10);
340
			this.monitorSetWorked(10);
341 341
		}
342 342
		
343 343
		// Structural units
344
		this.setTask("Processing structural units...");
344
		this.monitorSetTask("Processing structural units...");
345 345
		if (!this.stepStructuralUnits()) {
346 346
			return false;
347 347
		}
348
		this.worked(20);
348
		this.monitorSetWorked(20);
349 349
		
350 350
		
351 351
		// Finalization steps
352 352
		if (this.hasParameterChanged(ProgressionPreferences.QUERIES)) {
353
			this.setTask("Finalizing...");
353
			this.monitorSetTask("Finalizing...");
354 354
			if (!stepFinalize()) {
355 355
				return false;
356 356
			}
357
			this.worked(20);
357
			this.monitorSetWorked(20);
358 358
		}
359 359
		
360 360
		return true;
......
472 472
			for (Match m : matches) {
473 473
				positions[i++] = m.getStart();
474 474
				npositions++;
475
				this.worked(1);
475
				this.monitorSetWorked(1);
476 476
			}
477 477
		}
478 478
		return npositions > 0;
......
557 557
				
558 558
				i++;
559 559
				
560
				this.worked(1);
560
				this.monitorSetWorked(1);
561 561
			}
562 562
			this.bande = distmin * this.bandeMultiplier;
563 563
		}
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ExpI.java (revision 2609)
165 165
		reader.close();
166 166
		
167 167
		System.out.println("Number of query lines: " + lines.size());
168
		this.setTask("Querying...");
168
		this.monitorSetTask("Querying...");
169 169
		
170 170
		for (String line : lines) {
171 171
			String[] split = line.split("=", 2); //$NON-NLS-1$
......
177 177
					if (addLine(split[0], new CQLQuery(split[1])) == null) {
178 178
						System.out.println(TXMCoreMessages.bind(TXMCoreMessages.warningColonQueryFailedColonP0, line));
179 179
					}
180
					this.worked(1);
180
					this.monitorSetWorked(1);
181 181
				}
182 182
			}
183 183
		}
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ContextSubcorpus.java (revision 2609)
91 91
			keywordFileReader.close();
92 92
			System.out.println("Number of keywords lines: " + keywordLines.size());
93 93
			System.out.println("context left and right size is: " + contextSize);
94
			this.setTask("Querying keywords...");
94
			this.monitorSetTask("Querying keywords...");
95 95
			
96 96
			int nkeyword = 0;
97 97
			for (String line : keywordLines) {
......
101 101
					keywordQueriestoName.put(split[1], split[0]);
102 102
					results.add(corpus.query(q, "K" + nkeyword++, false));
103 103
				}
104
				this.worked(1);
104
				this.monitorSetWorked(1);
105 105
			}
106 106
			keywordFileReader.close();
107 107
			
108 108
			// Loop over QueryResult to Merge them into one subcorpus
109 109
			int n = 0;
110
			this.setTask("Creating subcorpus...");
110
			this.monitorSetTask("Creating subcorpus...");
111 111
			while (results.size() > 1) {
112 112
				
113 113
				QueryResult q1 = results.get(0);
......
120 120
				results.remove(0);
121 121
				results.remove(0);
122 122
				results.add(new QueryResult(merge_name, merge_name, corpus, null));
123
				this.worked(1);
123
				this.monitorSetWorked(1);
124 124
			}
125 125
			
126 126
			System.out.println("Done.");
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ValuesOfQuery.java (revision 2609)
52 52
		
53 53
		if (!(CQPSearchEngine.getCqiClient() instanceof MemCqiClient)) return false;
54 54
		
55
		this.setTask("Start querying...");
55
		this.monitorSetTask("Start querying...");
56 56
		
57 57
		File file = File.createTempFile("query", ".txt");
58 58
		// ExecTimer t = new ExecTimer();
......
65 65
		cli.query("group " + result.getQualifiedCqpId() + " match " + prop.getName() + " > \"" + file + "\";");
66 66
		// System.out.println("query done"+t.stop());t.start();
67 67
		
68
		this.worked(50);
68
		this.monitorSetWorked(50);
69 69
		
70 70
		if (!file.exists()) return false;
71 71
		
......
102 102
				break;
103 103
			}
104 104
			line = reader.readLine();
105
			this.worked(1);
105
			this.monitorSetWorked(1);
106 106
		}
107 107
		reader.close();
108 108
		writer.close();
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ExpII.java (revision 2609)
211 211
		}
212 212
		keywordFileReader.close();
213 213
		System.out.println("Number of keywords lines: " + keywordLines.size());
214
		this.setTask("Querying keywords...");
214
		this.monitorSetTask("Querying keywords...");
215 215
		
216 216
		int nkeyword = 0;
217 217
		for (String line : keywordLines) {
......
224 224
				keywordEndPositions.put(split[1], result.getEnds());
225 225
				keywordsMaxCountsLexicon.put(split[1], new int[textBoundaries.length]);
226 226
				idxLexicon.put(split[1], idx_lexicon_counter++);
227
				this.worked(1);
227
				this.monitorSetWorked(1);
228 228
			}
229 229
		}
230 230
		keywordFileReader.close();
......
239 239
		queriesFileReader.close();
240 240
		
241 241
		System.out.println("Number of lemma lines: " + lines.size());
242
		this.setTask("Querying...");
242
		this.monitorSetTask("Querying...");
243 243
		
244 244
		int nquery = 0;
245 245
		for (String line : lines) {
......
311 311
					}
312 312
				}
313 313
			}
314
			this.worked(1);
314
			this.monitorSetWorked(1);
315 315
		}
316 316
		
317
		this.setTask("Finalizing doc_word_freq_2.txt file...");
317
		this.monitorSetTask("Finalizing doc_word_freq_2.txt file...");
318 318
		for (String key : keywordsMaxCountsLexicon.keySet()) {
319 319
			int[] keyMaxValues = keywordsMaxCountsLexicon.get(key);
320 320
			for (int noText = 0; noText < textBoundaries.length; noText++) {
......
328 328
		queriesFileReader.close();
329 329
		writer.close();
330 330
		
331
		this.setTask("Writing lexicon file...");
331
		this.monitorSetTask("Writing lexicon file...");
332 332
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(lexiconFile), "UTF-8")));
333 333
		for (String query : idxLexicon.keySet()) {
334 334
			String name = keywordQueriestoName.get(query);

Formats disponibles : Unified diff