Révision 1536
tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java (revision 1536) | ||
---|---|---|
125 | 125 |
* @param countTexts |
126 | 126 |
* @throws CqiClientException |
127 | 127 |
*/ |
128 |
protected boolean _compute() { |
|
128 |
protected boolean __compute() {
|
|
129 | 129 |
|
130 | 130 |
this.subTask("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 { |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 1536) | ||
---|---|---|
29 | 29 |
import org.txm.chartsengine.rcp.editors.ChartEditor; |
30 | 30 |
import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages; |
31 | 31 |
import org.txm.core.messages.TXMCoreMessages; |
32 |
import org.txm.core.preferences.TXMPreferences; |
|
32 | 33 |
import org.txm.core.results.Parameter; |
33 | 34 |
import org.txm.core.results.TXMResult; |
34 | 35 |
import org.txm.progression.core.functions.Progression; |
... | ... | |
90 | 91 |
|
91 | 92 |
|
92 | 93 |
|
93 |
|
|
94 |
|
|
95 | 94 |
/** |
96 | 95 |
* Queries. |
97 | 96 |
*/ |
98 |
@Parameter(key=ProgressionPreferences.QUERIES)
|
|
99 |
protected List<Query> queryList; |
|
97 |
@Parameter(key=TXMPreferences.QUERIES)
|
|
98 |
protected List<CQLQuery> queryList;
|
|
100 | 99 |
|
101 | 100 |
/** |
102 | 101 |
* Structural unit. |
103 | 102 |
*/ |
104 |
@Parameter(key=ProgressionPreferences.STRUCTURAL_UNIT)
|
|
103 |
@Parameter(key=TXMPreferences.STRUCTURAL_UNIT)
|
|
105 | 104 |
protected StructuralUnitsComboViewer structuralUnitsComboViewer; |
106 | 105 |
|
107 | 106 |
/** |
108 | 107 |
* Structural unit property. |
109 | 108 |
*/ |
110 |
@Parameter(key=ProgressionPreferences.STRUCTURAL_UNIT_PROPERTY)
|
|
109 |
@Parameter(key=TXMPreferences.STRUCTURAL_UNIT_PROPERTY)
|
|
111 | 110 |
protected StructuralUnitPropertiesComboViewer structuralUnitPropertiesComboViewer; |
112 | 111 |
|
113 | 112 |
/** |
... | ... | |
614 | 613 |
@Override |
615 | 614 |
public void updateEditorFromChart(boolean update) { |
616 | 615 |
|
616 |
queryList = this.getResult().getQueries(); |
|
617 |
|
|
617 | 618 |
// initialize query fields |
618 | 619 |
if (queryWidgets.size() == 0 && queryList != null) { |
619 | 620 |
for (Query q : queryList) { |
... | ... | |
631 | 632 |
public void updateResultFromEditor() { |
632 | 633 |
|
633 | 634 |
// create query list from widget |
634 |
queryList = new ArrayList<Query>(); |
|
635 |
queryList = new ArrayList<CQLQuery>();
|
|
635 | 636 |
for (QueryField wid : queryWidgets) { |
636 | 637 |
if (!wid.getQuery().isEmpty()) { |
637 |
queryList.add(wid.getQuery()); |
|
638 |
queryList.add((CQLQuery) wid.getQuery());
|
|
638 | 639 |
wid.memorize(); |
639 | 640 |
} |
640 | 641 |
} |
tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java (revision 1536) | ||
---|---|---|
88 | 88 |
|
89 | 89 |
|
90 | 90 |
@Override |
91 |
protected boolean _compute() throws Exception { |
|
91 |
protected boolean __compute() throws Exception {
|
|
92 | 92 |
// retrieve the parts |
93 | 93 |
this.parts = this.getPartition().getParts(); |
94 | 94 |
|
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 1536) | ||
---|---|---|
158 | 158 |
return compute(monitor, true); |
159 | 159 |
} |
160 | 160 |
|
161 |
// @Override |
|
162 |
// public boolean compute(IProgressMonitor monitor, boolean deepComputing) { |
|
163 |
// |
|
164 |
// if (this.computing) { |
|
165 |
// return true; |
|
166 |
// } |
|
167 |
// |
|
168 |
// try { |
|
169 |
// Log.finest("*** ChartResult.compute(): " + this.getClass().getSimpleName() + ": starting computing process..."); |
|
170 |
// |
|
171 |
// // compute the result if needed |
|
172 |
// if(super.compute(monitor, deepComputing)) { |
|
173 |
// this.altered = false; |
|
174 |
// // compute the chart |
|
175 |
// return renderChart(); |
|
176 |
// } |
|
177 |
// else { |
|
178 |
// return false; |
|
179 |
// } |
|
180 |
// } |
|
181 |
// catch (Exception e) { |
|
182 |
// e.printStackTrace(); |
|
183 |
// Log.severe("ChartResult.compute(): Exception occurs during computing."); |
|
184 |
// return false; |
|
185 |
// } |
|
186 |
// } |
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
/** |
|
191 |
* This method is dedicated to be implemented by the inherited chart result classes to define the computing steps. |
|
192 |
* @return true if the result was computed |
|
193 |
* |
|
194 |
* @throws Exception |
|
195 |
*/ |
|
196 |
protected abstract boolean __compute() throws Exception; |
|
197 |
|
|
198 |
|
|
161 | 199 |
@Override |
162 |
public boolean compute(IProgressMonitor monitor, boolean deepComputing) { |
|
163 |
if (computing) return true; |
|
200 |
protected final boolean _compute() { |
|
164 | 201 |
|
202 |
boolean computingState = true; |
|
203 |
|
|
165 | 204 |
try { |
166 |
Log.finest("*** ChartResult.compute(): " + this.getClass().getSimpleName() + ": starting computing process..."); |
|
167 |
|
|
168 |
// compute the result if needed |
|
169 |
if(super.compute(monitor, deepComputing)) { |
|
170 |
this.altered = false; |
|
171 |
// compute the chart |
|
172 |
return renderChart(); |
|
173 |
} |
|
174 |
else { |
|
175 |
return false; |
|
176 |
} |
|
205 |
Log.finest("*** ChartResult._compute(): " + this.getClass().getSimpleName() + ": starting computing process..."); |
|
206 |
|
|
207 |
// Computes the result only if at least one computing parameter has changed |
|
208 |
//if(this.hasParameterChanged()) { |
|
209 |
computingState = this.__compute(); |
|
210 |
//} |
|
211 |
computingState = this.renderChart(); |
|
177 | 212 |
} |
178 | 213 |
catch (Exception e) { |
179 | 214 |
e.printStackTrace(); |
180 |
Log.severe("ChartResult.compute(): Exception occurs during computing.");
|
|
181 |
return false;
|
|
215 |
Log.severe("ChartResult._compute(): Exception occurs during computing or rendering.");
|
|
216 |
computingState = false;
|
|
182 | 217 |
} |
218 |
|
|
219 |
return computingState; |
|
183 | 220 |
} |
184 | 221 |
|
185 | 222 |
/** |
... | ... | |
196 | 233 |
Log.finest("*** ChartResult.renderChart(): rendering chart for result " + this.getClass() + " and chart type " + this.getChartType() + "..."); //$NON-NLS-1$ |
197 | 234 |
|
198 | 235 |
|
236 |
// FIXME: SJ: need to clear the last computing parameters else we can't check if a computing parameter has changed in the chart creators |
|
199 | 237 |
// if(this.parametersHistory.size() > 2 |
200 |
// |
|
238 |
|
|
201 | 239 |
// || this.getLastParametersFromHistory().isEmpty() |
202 |
// ) {
|
|
203 |
// this.clearLastComputingParameters();
|
|
240 |
// ) {
|
|
241 |
//this.clearLastComputingParameters();
|
|
204 | 242 |
// } |
205 | 243 |
|
244 |
// update the chart dirty state from history if a parameter has changed since last computing |
|
245 |
this.updateChartDirtyFromHistory(); |
|
206 | 246 |
|
207 |
|
|
208 |
if (!this.chartDirty && !this.isChartDirtyFromHistory()) { |
|
247 |
if (!this.chartDirty) { |
|
209 | 248 |
Log.finest("--- ChartResult.renderChart(): chart rendering parameters have not changed since last rendering, rendering skipped."); //$NON-NLS-1$ |
210 | 249 |
return true; |
211 | 250 |
} |
212 |
else if (!this.chartDirty) { |
|
213 |
Log.finest("--- ChartResult.renderChart(): chart is not dirty, rendering skipped."); //$NON-NLS-1$ |
|
214 |
return true; |
|
215 |
} |
|
216 | 251 |
|
217 |
|
|
218 | 252 |
ChartCreator chartCreator = this.getChartCreator(); |
219 | 253 |
|
220 | 254 |
// try to find a chart creator in other charts engines |
... | ... | |
242 | 276 |
// Solution 1: store two stacks, one for computing parameters and another for rendering parameters |
243 | 277 |
// Solution 2: stop to dissociate rendering parameters and computing parameters. Maybe the best way but need to check if this dissociation is very useless |
244 | 278 |
// clear the last computing parameters |
245 |
if(this.parametersHistory.size() > 2 |
|
246 |
|
|
247 |
//|| this.getLastParametersFromHistory().isEmpty() |
|
248 |
) { |
|
249 |
this.clearLastComputingParameters(); |
|
250 |
} |
|
279 |
// if(this.parametersHistory.size() > 2
|
|
280 |
// |
|
281 |
// //|| this.getLastParametersFromHistory().isEmpty()
|
|
282 |
// ) {
|
|
283 |
// this.clearLastComputingParameters();
|
|
284 |
// }
|
|
251 | 285 |
|
252 | 286 |
// Creating, if needed. |
253 | 287 |
// The change of the chart type parameter can occur if: |
254 | 288 |
// - the chart has never been created |
255 | 289 |
// - the chart type has been changed, e.g. to dynamically change the type of chart or the current charts engine |
256 | 290 |
if (this.chart == null || |
257 |
//(this.getLastParametersFromHistory().get(ChartsEnginePreferences.CHART_TYPE) != null &&
|
|
258 |
this.hasParameterChanged(ChartsEnginePreferences.CHART_TYPE) |
|
291 |
(this.getLastParametersFromHistory().get(ChartsEnginePreferences.CHART_TYPE) != null && |
|
292 |
this.hasParameterChanged(ChartsEnginePreferences.CHART_TYPE))
|
|
259 | 293 |
//) |
260 | 294 |
|
261 | 295 |
) { |
262 |
Log.finest("+++ ChartResult.renderChart(): creating chart."); //$NON-NLS-1$ |
|
296 |
Log.finest("+++ ChartResult.renderChart(): creating chart..."); //$NON-NLS-1$
|
|
263 | 297 |
|
264 | 298 |
this.chart = chartCreator.createChart(this); |
265 | 299 |
} |
266 | 300 |
|
267 | 301 |
// Updating |
268 |
Log.finest("ChartResult.renderChart(): updating chart."); |
|
302 |
Log.finest("ChartResult.renderChart(): updating chart...");
|
|
269 | 303 |
|
270 | 304 |
// the update must be done here (BEFORE the call of this.updateLastRenderingParameters()) rather than in the SWTChartComponentsProvider => the problem is that for File based Engine, the file may be created twice, need to check this |
271 | 305 |
// also before the call of this.updateLastParameters() to be able to check if a computing parameter has changed in the chart creators |
... | ... | |
273 | 307 |
|
274 | 308 |
// FIXME: needed by the above fix #1 |
275 | 309 |
// reupdate the last computing parameters |
276 |
this.updateLastParameters(); |
|
310 |
//this.updateLastParameters();
|
|
277 | 311 |
|
278 |
this.updateLastRenderingParameters(); |
|
312 |
//this.updateLastRenderingParameters();
|
|
279 | 313 |
|
280 | 314 |
this.needsToClearItemsSelection = false; |
281 | 315 |
this.needsToResetView = false; |
282 | 316 |
|
283 | 317 |
this.chartDirty = false; |
284 | 318 |
|
319 |
// file persistence flush |
|
320 |
// if (this.mustBePersisted()) { |
|
321 |
// TXMPreferences.flush(this); |
|
322 |
// } |
|
323 |
|
|
285 | 324 |
// Debug |
286 | 325 |
Log.finest("ChartResult.renderChart(): chart rendering done."); //$NON-NLS-1$ |
287 | 326 |
|
... | ... | |
295 | 334 |
} |
296 | 335 |
|
297 | 336 |
|
298 |
@Override |
|
299 |
public boolean hasParameterChanged(String key) { |
|
300 |
if (key.isEmpty()) { |
|
301 |
return false; |
|
302 |
} |
|
303 |
return super.hasParameterChanged(key); |
|
304 |
} |
|
337 |
// @Override
|
|
338 |
// public boolean hasParameterChanged(String key) {
|
|
339 |
// if (key.isEmpty()) {
|
|
340 |
// return false;
|
|
341 |
// }
|
|
342 |
// return super.hasParameterChanged(key);
|
|
343 |
// }
|
|
305 | 344 |
|
306 | 345 |
|
307 |
|
|
308 | 346 |
@Override |
309 | 347 |
public String dumpParameters() { |
310 | 348 |
return super.dumpParameters() + "\n" + this.dumpParameters(Parameter.RENDERING); //$NON-NLS-1$ |
311 | 349 |
} |
312 | 350 |
|
313 |
/** |
|
314 |
* Updates the parameters used for last rendering. |
|
315 |
* |
|
316 |
* @throws Exception |
|
317 |
*/ |
|
318 |
protected void updateLastRenderingParameters() throws Exception { |
|
319 |
this.updateLastParameters(Parameter.RENDERING, true); |
|
320 |
} |
|
351 |
// /**
|
|
352 |
// * Updates the parameters used for last rendering.
|
|
353 |
// *
|
|
354 |
// * @throws Exception
|
|
355 |
// */
|
|
356 |
// protected void updateLastRenderingParameters() throws Exception {
|
|
357 |
// this.updateLastParameters(Parameter.RENDERING, true);
|
|
358 |
// }
|
|
321 | 359 |
|
322 | 360 |
/** |
323 | 361 |
* Clears the parameters used for last rendering. |
... | ... | |
329 | 367 |
} |
330 | 368 |
|
331 | 369 |
|
370 |
|
|
332 | 371 |
/** |
333 |
* |
|
372 |
* Checks if at least one rendering parameter value has changed since last computing.
|
|
334 | 373 |
* @return |
335 | 374 |
* @throws Exception |
336 | 375 |
*/ |
337 |
public final boolean isChartDirtyFromHistory() throws Exception { |
|
338 |
|
|
339 |
List<Field> fields = this.getAllFields(); |
|
340 |
|
|
341 |
for (Field f : fields) { |
|
342 |
Parameter parameter = f.getAnnotation(Parameter.class); |
|
343 |
if (parameter == null || parameter.type() != Parameter.RENDERING) { |
|
344 |
continue; |
|
345 |
} |
|
346 |
|
|
347 |
String name; |
|
348 |
if(!parameter.key().isEmpty()) { |
|
349 |
name = parameter.key(); |
|
350 |
} |
|
351 |
else { |
|
352 |
name = f.getName(); |
|
353 |
} |
|
354 |
|
|
355 |
f.setAccessible(true); // not to set accessible to test the field values |
|
356 |
|
|
357 |
// FIXME: old version |
|
358 |
//Object previousValue = this.lastParameters.get(name); |
|
359 |
// FIXME: new version with stack |
|
360 |
Object previousValue = this.getLastParametersFromHistory().get(name); |
|
361 |
|
|
362 |
|
|
363 |
Object newValue = f.get(this); |
|
364 |
this.updateChartDirty(previousValue, newValue); |
|
365 |
if (this.chartDirty) { |
|
366 |
// FIXME: debug |
|
367 |
Log.finest("ChartResult.isChartDirtyFromHistory(): parameter " + name + " has changed."); |
|
368 |
return this.chartDirty; // no need to go further |
|
369 |
} |
|
376 |
public boolean hasRenderingParameterChanged() throws Exception { |
|
377 |
return this.hasParameterChanged(this.getLastParametersFromHistory(), Parameter.RENDERING); |
|
378 |
} |
|
379 |
|
|
380 |
@Override |
|
381 |
public void updateDirtyFromHistory() throws Exception { |
|
382 |
this.dirty = super.hasParameterChanged(); |
|
383 |
if(!this.dirty) { |
|
384 |
this.dirty = this.hasRenderingParameterChanged(); |
|
370 | 385 |
} |
371 |
return this.chartDirty; |
|
372 | 386 |
} |
373 |
|
|
374 |
|
|
387 |
|
|
388 |
|
|
375 | 389 |
/** |
376 |
* Updates the chart dirty state by comparing an old parameter with a new one. |
|
377 |
* |
|
378 |
* @param lastValue may be null |
|
379 |
* @param newValue may be null |
|
390 |
* Sets the chart dirty state to true if a rendering parameter has changed since last computing. |
|
391 |
* @return |
|
392 |
* @throws Exception |
|
380 | 393 |
*/ |
381 |
protected void updateChartDirty(Object lastValue, Object newValue) { |
|
382 |
if(lastValue == null && newValue == null) { |
|
383 |
return; |
|
384 |
} |
|
385 |
if (lastValue == null || !lastValue.equals(newValue)) { |
|
386 |
Log.info("ChartResult.updateChartDirty(): " + this.getClass().getSimpleName() + ": setting chart dirty to true: last = "+ lastValue + " / new = " + newValue); |
|
394 |
public void updateChartDirtyFromHistory() throws Exception { |
|
395 |
|
|
396 |
if(this.hasRenderingParameterChanged()) { |
|
387 | 397 |
this.chartDirty = true; |
388 | 398 |
} |
389 | 399 |
} |
390 | 400 |
|
401 |
|
|
402 |
// /** |
|
403 |
// * Updates the chart dirty state by comparing an old parameter with a new one. |
|
404 |
// * |
|
405 |
// * @param lastValue may be null |
|
406 |
// * @param newValue may be null |
|
407 |
// */ |
|
408 |
// protected void updateChartDirty(Object lastValue, Object newValue) { |
|
409 |
// if(lastValue == null && newValue == null) { |
|
410 |
// return; |
|
411 |
// } |
|
412 |
// if (lastValue == null || !lastValue.equals(newValue)) { |
|
413 |
// Log.info("ChartResult.updateChartDirty(): " + this.getClass().getSimpleName() + ": setting chart dirty to true: last = "+ lastValue + " / new = " + newValue); |
|
414 |
// this.chartDirty = true; |
|
415 |
// } |
|
416 |
// } |
|
417 |
|
|
418 |
|
|
391 | 419 |
@Override |
392 | 420 |
public ChartResult clone() { |
393 | 421 |
ChartResult clone = null; |
... | ... | |
395 | 423 |
clone.chart = null; |
396 | 424 |
// FIXME: would be nice to clone the chart if possible instead of clearing the last rendering parameters? |
397 | 425 |
//clone.chart = this.chart.clone(); |
398 |
clone.clearLastRenderingParameters(); // to force recreation of the chart at next computing |
|
426 |
clone.clearLastRenderingParameters(); // to force recreation of the chart at next computing // FIXME: SJ: need to see if it's necessary, the chartDirty state may be sufficient
|
|
399 | 427 |
clone.chartDirty = true; |
400 | 428 |
clone.hasBeenComputedOnce = false; |
401 | 429 |
return clone; |
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 1536) | ||
---|---|---|
165 | 165 |
} |
166 | 166 |
|
167 | 167 |
@Override |
168 |
protected boolean _compute() throws Exception { |
|
168 |
protected boolean __compute() throws Exception {
|
|
169 | 169 |
|
170 | 170 |
try { |
171 | 171 |
// clear cache |
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/Eigenvalues.java (revision 1536) | ||
---|---|---|
98 | 98 |
|
99 | 99 |
|
100 | 100 |
@Override |
101 |
protected boolean _compute() throws Exception { |
|
101 |
protected boolean __compute() throws Exception {
|
|
102 | 102 |
// nothing to do |
103 | 103 |
return true; |
104 | 104 |
} |
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/functions/WordCloud.java (revision 1536) | ||
---|---|---|
93 | 93 |
|
94 | 94 |
|
95 | 95 |
@Override |
96 |
protected boolean _compute() { |
|
96 |
protected boolean __compute() {
|
|
97 | 97 |
// // FIXME: source must always be an Index because the corpus source produces an Index |
98 | 98 |
// // from corpus |
99 | 99 |
// if (source instanceof Corpus) { |
tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java (revision 1536) | ||
---|---|---|
111 | 111 |
/** |
112 | 112 |
* Queries. |
113 | 113 |
*/ |
114 |
@Parameter(key=TBXPreferences.QUERIES)
|
|
114 |
@Parameter(key=TXMPreferences.QUERIES)
|
|
115 | 115 |
protected List<CQLQuery> queries; |
116 | 116 |
|
117 | 117 |
/** |
118 | 118 |
* Structural unit. |
119 | 119 |
*/ |
120 |
@Parameter(key=TBXPreferences.STRUCTURAL_UNIT)
|
|
120 |
@Parameter(key=TXMPreferences.STRUCTURAL_UNIT, type=Parameter.RENDERING)
|
|
121 | 121 |
protected StructuralUnit structuralUnit; |
122 | 122 |
|
123 | 123 |
/** |
124 | 124 |
* Structural unit property. |
125 | 125 |
*/ |
126 |
@Parameter(key=TBXPreferences.STRUCTURAL_UNIT_PROPERTY)
|
|
126 |
@Parameter(key=TXMPreferences.STRUCTURAL_UNIT_PROPERTY, type=Parameter.RENDERING)
|
|
127 | 127 |
protected StructuralUnitProperty structuralUnitProperty; |
128 | 128 |
|
129 | 129 |
/** |
130 | 130 |
* Repeats or not the same value when displaying the section markers. |
131 | 131 |
*/ |
132 |
@Parameter(key=ProgressionPreferences.REPEAT_SAME_VALUES) |
|
132 |
@Parameter(key=ProgressionPreferences.REPEAT_SAME_VALUES, type=Parameter.RENDERING)
|
|
133 | 133 |
protected boolean repeatValues; |
134 | 134 |
|
135 | 135 |
/** |
... | ... | |
141 | 141 |
/** |
142 | 142 |
* Regex to display only the property that match it. |
143 | 143 |
*/ |
144 |
@Parameter(key=ProgressionPreferences.PROPERTY_REGEX) |
|
144 |
@Parameter(key=ProgressionPreferences.PROPERTY_REGEX, type=Parameter.RENDERING)
|
|
145 | 145 |
protected String propertyRegex; |
146 | 146 |
|
147 | 147 |
|
... | ... | |
292 | 292 |
* @throws CqiServerError |
293 | 293 |
* @throws IOException |
294 | 294 |
*/ |
295 |
protected boolean _compute() throws Exception { |
|
295 |
protected boolean __compute() throws Exception {
|
|
296 | 296 |
|
297 | 297 |
// Queries |
298 | 298 |
if(this.hasParameterChanged(ProgressionPreferences.QUERIES)) { |
tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/jfreechart/JFCProgressionCumulativeChartCreator.java (revision 1536) | ||
---|---|---|
126 | 126 |
// System.err.println("*******************************JFCProgressionCumulativeChartCreator.updateChart(): has query parameter change = " + t1 + " / older = " + t2); |
127 | 127 |
if( |
128 | 128 |
progression.hasParameterChanged(TXMPreferences.QUERIES) |
129 |
|| |
|
130 |
progression.hasParameterChanged(TXMPreferences.QUERIES, true) |
|
129 |
// ||
|
|
130 |
// progression.hasParameterChanged(TXMPreferences.QUERIES, true)
|
|
131 | 131 |
) { |
132 | 132 |
XYSeriesCollection dataset = (XYSeriesCollection) chart.getXYPlot().getDataset(); |
133 | 133 |
dataset.removeAllSeries(); |
tmp/org.txm.cooccurrence.chartsengine/src/org/txm/cooccurrence/functions/CooccurrenceGraph.java (revision 1536) | ||
---|---|---|
132 | 132 |
* @see org.txm.core.results.TXMResult#_compute() |
133 | 133 |
*/ |
134 | 134 |
@Override |
135 |
protected boolean _compute() throws Exception { |
|
135 |
protected boolean __compute() throws Exception {
|
|
136 | 136 |
// TODO Auto-generated method stub |
137 | 137 |
return true; |
138 | 138 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1536) | ||
---|---|---|
1193 | 1193 |
else if(object instanceof NewNavigationWidget) { |
1194 | 1194 |
((NewNavigationWidget)object).setCurrentPosition((Integer) value); |
1195 | 1195 |
} |
1196 |
else if(object instanceof AssistedQueryWidget) { |
|
1197 |
if(!((CQLQuery)value).getQueryString().isEmpty()) { |
|
1198 |
((AssistedQueryWidget)object).setText(((CQLQuery)value).getQueryString()); |
|
1199 |
} |
|
1200 |
} |
|
1201 | 1196 |
else if(object instanceof AssistedChoiceQueryWidget) { |
1202 | 1197 |
if(!((Query)value).getQueryString().isEmpty()) { |
1203 | 1198 |
((AssistedChoiceQueryWidget)object).setText(((Query)value).getQueryString()); |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java (revision 1536) | ||
---|---|---|
145 | 145 |
throw new IllegalArgumentException(NLS.bind(TXMUIMessages.theNumberOfEditorsP0AndNumberOfInputsP1MustBeEqual, editors.size(), inputs.size())); |
146 | 146 |
} |
147 | 147 |
|
148 |
// put first editor in the left panel and set is as "main" editor
|
|
148 |
// put first editor in the left panel and set it as "main" editor
|
|
149 | 149 |
try { |
150 | 150 |
|
151 | 151 |
final CAFactorialMapChartEditor caFactorialMapEditorPart = (CAFactorialMapChartEditor) editors.get(0); |
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitiesSelection.java (revision 1536) | ||
---|---|---|
77 | 77 |
super(parametersNodePath); |
78 | 78 |
} |
79 | 79 |
@Override |
80 |
protected boolean _compute() throws Exception { |
|
80 |
protected boolean __compute() throws Exception {
|
|
81 | 81 |
Specificities specificities = this.getParent(); |
82 | 82 |
double[][] tableLines = specificities.getSpecificitesIndex(); |
83 | 83 |
String[] partNames = specificities.getColumnsNames(); |
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 1536) | ||
---|---|---|
310 | 310 |
* Saves all preferences and session results in the default app directory. |
311 | 311 |
*/ |
312 | 312 |
public static void saveAll() { |
313 |
|
|
314 |
Log.info("Saving preferences and session results..."); |
|
313 | 315 |
|
314 |
Log.info("Saving preferences and session results."); |
|
315 |
|
|
316 | 316 |
try { |
317 | 317 |
preferencesRootNode.flush(); |
318 | 318 |
} catch(Exception e) { |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1536) | ||
---|---|---|
308 | 308 |
Log.finest("Warning: the TXMResult of " + this.getClass() + " is attached to no parent. (uuid = " + this.parametersNodePath + ")"); //$NON-NLS-1$ //$NON-NLS-2$ |
309 | 309 |
} |
310 | 310 |
|
311 |
try { |
|
312 |
this.parametersHistory.add(new HashMap<String, Object>()); |
|
313 |
//this.updateLastParameters(); |
|
314 |
} |
|
315 |
catch (Exception e) { |
|
316 |
// TODO Auto-generated catch block |
|
317 |
e.printStackTrace(); |
|
318 |
} |
|
311 |
// try {
|
|
312 |
// this.parametersHistory.add(new HashMap<String, Object>());
|
|
313 |
// //this.updateLastParameters();
|
|
314 |
// }
|
|
315 |
// catch (Exception e) {
|
|
316 |
// // TODO Auto-generated catch block
|
|
317 |
// e.printStackTrace();
|
|
318 |
// }
|
|
319 | 319 |
} |
320 | 320 |
|
321 | 321 |
/** |
... | ... | |
464 | 464 |
} |
465 | 465 |
|
466 | 466 |
/** |
467 |
* Returns all the member fields of the class instance. |
|
467 |
* Returns all the member fields of the class instance (from all inherited classes).
|
|
468 | 468 |
* @return the list of declared fields |
469 | 469 |
*/ |
470 | 470 |
public List<Field> getAllFields() { |
... | ... | |
495 | 495 |
* @param appendToLastParameters |
496 | 496 |
* @throws Exception |
497 | 497 |
*/ |
498 |
// FIXME: SJ: should become useless after ChartResult changes |
|
498 | 499 |
protected void updateLastParameters(int parameterType, boolean appendToLastParameters) throws Exception { |
499 | 500 |
|
500 | 501 |
HashMap<String, Object> lastParameters; |
... | ... | |
533 | 534 |
} |
534 | 535 |
|
535 | 536 |
// truncate the stack to the max count |
536 |
// FIXME: store this in a TBX preference |
|
537 |
// FIXME: SJ: later, store this in a TBX preference
|
|
537 | 538 |
if(this.parametersHistory.size() > 5) { |
538 | 539 |
this.parametersHistory.remove(0); |
539 | 540 |
this.parametersHistory.remove(0); |
... | ... | |
552 | 553 |
|
553 | 554 |
|
554 | 555 |
/** |
555 |
* |
|
556 |
* Removes all the parameters of the specified type from the last parameters history.
|
|
556 | 557 |
* @param parameterType |
557 | 558 |
* @throws Exception |
558 | 559 |
*/ |
... | ... | |
583 | 584 |
} |
584 | 585 |
|
585 | 586 |
|
586 |
/** |
|
587 |
* Clears the parameters used for last computing. |
|
588 |
* Dedicated to force a full recomputing. |
|
589 |
* @throws Exception |
|
590 |
*/ |
|
591 |
protected void clearLastComputingParameters() {
|
|
592 |
this.clearLastParameters(Parameter.COMPUTING); |
|
593 |
} |
|
587 |
// /**
|
|
588 |
// * Clears the parameters used for last computing.
|
|
589 |
// * Dedicated to force a full recomputing.
|
|
590 |
// * @throws Exception
|
|
591 |
// */
|
|
592 |
// protected void clearLastParameters() {
|
|
593 |
// this.clearLastParameters(Parameter.COMPUTING);
|
|
594 |
// }
|
|
594 | 595 |
|
595 | 596 |
|
596 | 597 |
/** |
... | ... | |
601 | 602 |
* @param older |
602 | 603 |
* @return |
603 | 604 |
*/ |
604 |
public boolean hasParameterChanged(String key, boolean older) { |
|
605 |
if(older) { |
|
606 |
return this.hasParameterChanged(key, this.parametersHistory.get(this.parametersHistory.size() - 2)); |
|
607 |
} |
|
608 |
else { |
|
609 |
return this.hasParameterChanged(key); |
|
610 |
} |
|
611 |
} |
|
605 |
// FIXME: SJ: should become useless after ChartResult changes |
|
606 |
// @Deprecated |
|
607 |
// public boolean hasParameterChanged(String key, boolean older) { |
|
608 |
// if(older) { |
|
609 |
// return this.hasParameterChanged(key, this.parametersHistory.get(this.parametersHistory.size() - 2)); |
|
610 |
// } |
|
611 |
// else { |
|
612 |
// return this.hasParameterChanged(key); |
|
613 |
// } |
|
614 |
// } |
|
612 | 615 |
|
613 | 616 |
/** |
614 | 617 |
* Checks if a parameter value has changed since last computing. |
... | ... | |
627 | 630 |
* @return |
628 | 631 |
*/ |
629 | 632 |
public boolean hasParameterChanged(String key, HashMap<String, Object> lastParameters) { |
633 |
|
|
634 |
if(lastParameters == null) { |
|
635 |
return true; |
|
636 |
} |
|
637 |
|
|
630 | 638 |
if (key.isEmpty()) { |
631 | 639 |
return false; |
632 | 640 |
} |
633 |
// if (this.isDirty()) { |
|
634 |
// return true; |
|
635 |
// } |
|
636 | 641 |
|
637 | 642 |
Object lastValue = lastParameters.get(key); |
638 | 643 |
Object newValue = this.getParameter(key); |
... | ... | |
649 | 654 |
} |
650 | 655 |
} |
651 | 656 |
|
657 |
/** |
|
658 |
* Checks if at least one parameter value of the specified parameter type has changed since last computing according to the specified external map. |
|
659 |
* @param lastParameters |
|
660 |
* @param parameterType |
|
661 |
* @return |
|
662 |
*/ |
|
663 |
public boolean hasParameterChanged(HashMap<String, Object> lastParameters, int parameterType) throws Exception { |
|
652 | 664 |
|
665 |
// result has never been computed |
|
666 |
if(lastParameters == null) { |
|
667 |
return true; |
|
668 |
} |
|
653 | 669 |
|
670 |
boolean hasParameterChanged = false; |
|
671 |
|
|
672 |
List<Field> fields = this.getAllFields(); |
|
673 |
|
|
674 |
for (Field f : fields) { |
|
675 |
Parameter parameter = f.getAnnotation(Parameter.class); |
|
676 |
if (parameter == null || parameter.type() != parameterType) { |
|
677 |
continue; |
|
678 |
} |
|
679 |
String name; |
|
680 |
if (!parameter.key().isEmpty()) { |
|
681 |
name = parameter.key(); |
|
682 |
} |
|
683 |
else { |
|
684 |
name = f.getName(); |
|
685 |
} |
|
686 |
|
|
687 |
f.setAccessible(true); // to be able to test the field values |
|
688 |
|
|
689 |
hasParameterChanged = this.hasParameterChanged(name, lastParameters); |
|
690 |
|
|
691 |
if (hasParameterChanged) { |
|
692 |
Log.finest("TXMResult.hasParameterChanged(): " + this.getClass().getSimpleName() + ": parameter " + name + " has changed."); |
|
693 |
break; |
|
694 |
} |
|
695 |
} |
|
696 |
|
|
697 |
return hasParameterChanged; |
|
698 |
} |
|
699 |
|
|
700 |
|
|
654 | 701 |
/** |
702 |
* Checks if at least one computing parameter value has changed since last computing. |
|
703 |
* @return |
|
704 |
* @throws Exception |
|
705 |
*/ |
|
706 |
public boolean hasParameterChanged() throws Exception { |
|
707 |
return this.hasParameterChanged(this.getLastParametersFromHistory(), Parameter.COMPUTING); |
|
708 |
} |
|
709 |
|
|
710 |
|
|
711 |
/** |
|
655 | 712 |
* Dumps the command and default preferences of the result preferences node qualifier. |
656 | 713 |
* @return |
657 | 714 |
*/ |
... | ... | |
733 | 790 |
|
734 | 791 |
|
735 | 792 |
|
736 |
/** |
|
737 |
* Updates the dirty state by comparing an old parameter with a new one. |
|
738 |
* |
|
739 |
* @param lastValue may be null |
|
740 |
* @param newValue may be null |
|
741 |
*/ |
|
742 |
protected void updateDirty(Object lastValue, Object newValue) { |
|
743 |
if(lastValue == null && newValue == null) { |
|
744 |
return; |
|
745 |
} |
|
746 |
if (lastValue == null || !lastValue.equals(newValue)) { |
|
747 |
Log.info("TXMResult.updateDirty(): " + this.getClass().getSimpleName() + ": setting dirty to true: last = "+ lastValue + " / new = " + newValue); |
|
748 |
this.setDirty(); |
|
749 |
} |
|
750 |
} |
|
793 |
// /**
|
|
794 |
// * Updates the dirty state by comparing an old parameter with a new one.
|
|
795 |
// *
|
|
796 |
// * @param lastValue may be null
|
|
797 |
// * @param newValue may be null
|
|
798 |
// */
|
|
799 |
// protected void updateDirty(Object lastValue, Object newValue) {
|
|
800 |
// if(lastValue == null && newValue == null) {
|
|
801 |
// return;
|
|
802 |
// }
|
|
803 |
// if (lastValue == null || !lastValue.equals(newValue)) {
|
|
804 |
// Log.info("TXMResult.updateDirty(): " + this.getClass().getSimpleName() + ": setting dirty to true: last = "+ lastValue + " / new = " + newValue);
|
|
805 |
// this.setDirty();
|
|
806 |
// }
|
|
807 |
// }
|
|
751 | 808 |
|
752 | 809 |
/** |
753 |
* Updates the dirty states by comparing TXMResult @Parameter with previously used parameters in the compute() method.
|
|
810 |
* Sets the dirty state to true if a parameter has changed since last computing.
|
|
754 | 811 |
* |
755 |
* To work correctly : |
|
756 |
* - the equals method of the TXMResult parameters must be correctly implemented. |
|
757 |
* - the @Parameter member must be another variable (the previous is stored in the lastParameters protected variable) (e.g editing a List @Parameter is not enough for this test) |
|
758 |
* |
|
759 |
* The method is final and don't need to be re-implemented. To ignore this method, don't use the @Parameter annotations |
|
760 |
* |
|
761 |
* Implement isDirty if you need more test |
|
762 |
* |
|
763 |
* @return |
|
764 |
* @throws IllegalAccessException |
|
765 |
* @throws IllegalArgumentException |
|
812 |
* @throws Exception |
|
766 | 813 |
*/ |
767 |
public final boolean isDirtyFromHistory() throws Exception { |
|
768 |
|
|
769 |
List<Field> fields = this.getAllFields(); |
|
814 |
public void updateDirtyFromHistory() throws Exception { |
|
815 |
// |
|
816 |
//// // result has never been computed |
|
817 |
//// if(this.getLastParametersFromHistory() == null) { |
|
818 |
//// this.dirty = true; |
|
819 |
//// return true; |
|
820 |
//// } |
|
821 |
//// |
|
822 |
//// List<Field> fields = this.getAllFields(); |
|
823 |
//// |
|
824 |
//// for (Field f : fields) { |
|
825 |
//// Parameter parameter = f.getAnnotation(Parameter.class); |
|
826 |
//// if (parameter == null |
|
827 |
//// || parameter.type() == Parameter.INTERNAL |
|
828 |
//// //|| parameter.type() != Parameter.COMPUTING |
|
829 |
//// ) { |
|
830 |
//// continue; |
|
831 |
//// } |
|
832 |
//// String name; |
|
833 |
//// if (!parameter.key().isEmpty()) { |
|
834 |
//// name = parameter.key(); |
|
835 |
//// } |
|
836 |
//// else { |
|
837 |
//// name = f.getName(); |
|
838 |
//// } |
|
839 |
//// |
|
840 |
//// f.setAccessible(true); // to be able to test the field values |
|
841 |
//// |
|
842 |
//// Object previousValue = this.getLastParametersFromHistory().get(name); |
|
843 |
//// Object newValue = f.get(this); |
|
844 |
//// |
|
845 |
//// // // FIXME: debug |
|
846 |
//// // Log.finest("TXMResult.isDirtyFromHistory(): checking parameter: " + name); |
|
847 |
//// |
|
848 |
//// this.updateDirty(previousValue, newValue); |
|
849 |
//// if (this.dirty) { |
|
850 |
//// Log.finest("TXMResult.isDirtyFromHistory(): " + this.getClass().getSimpleName() + ": parameter " + name + " has changed."); |
|
851 |
//// return this.dirty; // no need to go further |
|
852 |
//// } |
|
853 |
//// } |
|
854 |
//// return this.dirty; |
|
855 |
// |
|
856 |
// this.dirty = this.hasParameterChanged(); |
|
857 |
//// if (this.chartDirty) { |
|
858 |
//// // FIXME: debug |
|
859 |
//// Log.finest("ChartResult.isChartDirtyFromHistory(): parameter " + name + " has changed."); |
|
860 |
//// return this.chartDirty; // no need to go further |
|
861 |
//// } |
|
862 |
//// return this.dirty; |
|
863 |
// if(this.dirty) { |
|
864 |
// return true; |
|
865 |
// } |
|
866 |
// else { |
|
867 |
//return this.hasParameterChanged(); |
|
868 |
// } |
|
770 | 869 |
|
771 |
for (Field f : fields) { |
|
772 |
Parameter parameter = f.getAnnotation(Parameter.class); |
|
773 |
if (parameter == null |
|
774 |
|| parameter.type() != Parameter.COMPUTING |
|
775 |
// FIXME: non electric mode tests |
|
776 |
//|| parameter.electric() == false |
|
777 |
) { |
|
778 |
continue; |
|
779 |
} |
|
780 |
String name; |
|
781 |
if (!parameter.key().isEmpty()) { |
|
782 |
name = parameter.key(); |
|
783 |
} |
|
784 |
else { |
|
785 |
name = f.getName(); |
|
786 |
} |
|
787 |
|
|
788 |
f.setAccessible(true); // to be able to test the field values |
|
789 |
|
|
790 |
Object previousValue = this.getLastParametersFromHistory().get(name); |
|
791 |
Object newValue = f.get(this); |
|
792 |
|
|
793 |
// // FIXME: debug |
|
794 |
// Log.finest("TXMResult.isDirtyFromHistory(): checking parameter: " + name); |
|
795 |
|
|
796 |
this.updateDirty(previousValue, newValue); |
|
797 |
if (this.dirty) { |
|
798 |
Log.finest("TXMResult.isDirtyFromHistory(): " + this.getClass().getSimpleName() + ": parameter " + name + " has changed."); |
|
799 |
return this.dirty; // no need to go further |
|
800 |
} |
|
870 |
if(this.hasParameterChanged()) { |
|
871 |
this.dirty = true; |
|
801 | 872 |
} |
802 |
return this.dirty; |
|
873 |
|
|
803 | 874 |
} |
804 | 875 |
|
805 | 876 |
|
806 | 877 |
public HashMap<String, Object> getLastParametersFromHistory() { |
807 |
return this.parametersHistory.get(this.parametersHistory.size() - 1); |
|
878 |
try { |
|
879 |
return this.parametersHistory.get(this.parametersHistory.size() - 1); |
|
880 |
} |
|
881 |
catch (Exception e) { |
|
882 |
return null; |
|
883 |
} |
|
808 | 884 |
} |
809 | 885 |
|
810 | 886 |
/** |
... | ... | |
2166 | 2242 |
} |
2167 | 2243 |
} |
2168 | 2244 |
|
2169 |
// check if the result is dirty (manually dirty or have some parameters changed since last computing) |
|
2170 |
boolean d1 = this.isDirtyFromHistory(); |
|
2171 |
boolean d2 = this.isDirty(); |
|
2172 |
if (!d1 && !d2) { |
|
2245 |
// update the dirty state from history if a parameter has changed since last computing |
|
2246 |
this.updateDirtyFromHistory(); |
|
2247 |
|
|
2248 |
// check if the result is dirty |
|
2249 |
if (!this.isDirty()) { |
|
2173 | 2250 |
Log.finest("--- TXMResult.compute(): " + this.getClass().getSimpleName() + ": result parameters have not changed since last computing, computing skipped."); |
2174 | 2251 |
skipComputing = true; |
2175 | 2252 |
} |
... | ... | |
2192 | 2269 |
this.computing = false; |
2193 | 2270 |
return false; |
2194 | 2271 |
} |
2272 |
|
|
2273 |
|
|
2274 |
// // clear the lazy name, no more needed since the object has been computed and getSimpleName() can now work |
|
2275 |
// this.lazyName = null; |
|
2276 |
// |
|
2277 |
// // store last used parameters |
|
2278 |
// this.updateLastParameters(); |
|
2279 |
|
|
2280 |
|
|
2281 |
|
|
2195 | 2282 |
} |
2196 | 2283 |
|
2197 | 2284 |
// clear the lazy name, no more needed since the object has been computed and getSimpleName() can now work |
... | ... | |
2205 | 2292 |
|
2206 | 2293 |
// store last used parameters |
2207 | 2294 |
// this.updateLastParameters(); |
2208 |
if (this.hasBeenComputedOnce// don't update the compute date if the object has been lazy loaded
|
|
2295 |
if (this.hasBeenComputedOnce// don't update the computing date if the object has been lazy loaded
|
|
2209 | 2296 |
|| this.lastComputingDate == null) { // set the update date if never computed once |
2210 | 2297 |
this.lastComputingDate = Calendar.getInstance().getTime(); // update this internal parameter before saving parameters |
2211 | 2298 |
} |
... | ... | |
2276 | 2363 |
} |
2277 | 2364 |
|
2278 | 2365 |
/** |
2279 |
* |
|
2366 |
* This method is dedicated to be implemented by the inherited result classes to define the computing steps.
|
|
2280 | 2367 |
* @return true if the result was computed |
2281 | 2368 |
* |
2282 | 2369 |
* @throws Exception |
tmp/org.txm.ahc.core/src/org/txm/ahc/core/functions/AHC.java (revision 1536) | ||
---|---|---|
185 | 185 |
} |
186 | 186 |
|
187 | 187 |
@Override |
188 |
protected boolean _compute() { |
|
188 |
protected boolean __compute() {
|
|
189 | 189 |
|
190 | 190 |
Log.info("Computing AHC..."); |
191 | 191 |
try { |
Formats disponibles : Unified diff