Revision 2689
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/UpdateCorpus.java (revision 2689) | ||
---|---|---|
75 | 75 |
}); |
76 | 76 |
} |
77 | 77 |
|
78 |
project.setDirty(true, false);// dont propagate dirty
|
|
78 |
project.setDirty(false);// false=dont propagate dirty
|
|
79 | 79 |
project.setNeedToBuild(); |
80 | 80 |
project.setDoMultiThread(false); // too soon |
81 | 81 |
project.setDoUpdate(true); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 2689) | ||
---|---|---|
835 | 835 |
Version v = Activator.getDefault().getBundle().getVersion(); |
836 | 836 |
String vv = v.getMajor() + "." + v.getMinor() + "." + v.getMicro(); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$ |
837 | 837 |
String SAMPLES = "1. " + TXMUIMessages.bind(TXMUIMessages.sampleCorporaOfCurrentTXMP0, vv);//$NON-NLS-1$ |
838 |
String V080 = "2. " + TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, vv);//$NON-NLS-1$ |
|
839 |
String V079 = "3. " + TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, "0.7.9"); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$ |
|
840 |
String OTHER = "4. " + TXMUIMessages.selectAnotherTXMCorporaToRestore;//$NON-NLS-1$ |
|
838 |
String V081 = "2. " + TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, vv);//$NON-NLS-1$ |
|
839 |
String V080 = "3. " + TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, "0.8.0"); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$ |
|
840 |
String V079 = "4. " + TXMUIMessages.bind(TXMUIMessages.corporaOfPreviousTXMP0, "0.7.9"); //$NON-NLS-1$ //$NON-NLS-2$ $NON-NLS-2$ |
|
841 |
String OTHER = "5. " + TXMUIMessages.selectAnotherTXMCorporaToRestore;//$NON-NLS-1$ |
|
841 | 842 |
|
842 | 843 |
|
843 | 844 |
final ArrayList<Object> corporaDirs = new ArrayList<>(); |
844 | 845 |
corporaDirs.add(SAMPLES); |
846 |
corporaDirs.add(V081); |
|
845 | 847 |
corporaDirs.add(V080); |
846 | 848 |
corporaDirs.add(V079); |
847 | 849 |
corporaDirs.add(OTHER); |
848 | 850 |
|
849 | 851 |
final ArrayList<Object> initialCorporaDirs = new ArrayList<>(); |
850 | 852 |
initialCorporaDirs.add(SAMPLES); |
851 |
initialCorporaDirs.add(V080); |
|
852 |
initialCorporaDirs.add(V079); |
|
853 |
initialCorporaDirs.add(V081); |
|
853 | 854 |
|
854 |
|
|
855 | 855 |
Display.getDefault().syncExec(new Runnable() { |
856 | 856 |
|
857 | 857 |
@Override |
... | ... | |
899 | 899 |
} |
900 | 900 |
} |
901 | 901 |
|
902 |
// TXM-0.8.1 previous installation corpora |
|
903 |
if (corporaDirs.contains(V081) && backupDir.listFiles(IOUtils.HIDDENFILE_FILTER).length > 0) { // not a new install, restore corpus from the corpora-previous directory |
|
904 |
Log.info(NLS.bind(TXMUIMessages.installingPreviousCorpusFromP0, "0.8.1", corporaDir)); //$NON-NLS-1$ |
|
905 |
JobHandler job = LoadBinaryCorporaDirectory.loadBinaryCorpusFromCorporaDirectory(backupDir, false, false, true); |
|
906 |
try { |
|
907 |
job.join(); |
|
908 |
} |
|
909 |
catch (InterruptedException e) { |
|
910 |
e.printStackTrace(); |
|
911 |
} |
|
912 |
} |
|
913 |
|
|
902 | 914 |
// TXM-0.8.0 previous installation corpora |
903 | 915 |
if (corporaDirs.contains(V080) && backupDir.listFiles(IOUtils.HIDDENFILE_FILTER).length > 0) { // not a new install, restore corpus from the corpora-previous directory |
904 | 916 |
Log.info(NLS.bind(TXMUIMessages.installingPreviousCorpusFromP0, "0.8.0", corporaDir)); //$NON-NLS-1$ |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/export/ImportResultParameters.java (revision 2689) | ||
---|---|---|
124 | 124 |
|
125 | 125 |
TXMResult r = (TXMResult) s; |
126 | 126 |
if (r.importParameters(outfile)) { |
127 |
r.setDirty(); |
|
128 | 127 |
CorporaView.refreshObject(r); |
129 | 128 |
System.out.println(NLS.bind("Parameter imported from the {0} file.", outfile)); |
130 | 129 |
SWTEditorsUtils.refreshEditors(r); |
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitiesSelection.java (revision 2689) | ||
---|---|---|
289 | 289 |
} |
290 | 290 |
|
291 | 291 |
@Override |
292 |
public void setHasBeenComputedOnce(boolean hasBeenComputedOnce) { |
|
293 |
// redefined to not reset the chart |
|
294 |
} |
|
295 |
|
|
296 |
@Override |
|
297 | 292 |
public boolean setParameters(TXMParameters parameters) { |
298 | 293 |
// TODO Auto-generated method stub |
299 | 294 |
System.err.println("SpecificitiesSelection.setParameters(): not yet implemented."); |
tmp/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java (revision 2689) | ||
---|---|---|
243 | 243 |
|
244 | 244 |
if (isSuccessful) { // all done TODO remove this code when Text._compute() will be implemented |
245 | 245 |
for (Text t : project.getTexts()) { |
246 |
t.setDirty(false);
|
|
246 |
t.compute(false);
|
|
247 | 247 |
} |
248 | 248 |
|
249 | 249 |
project.setDoUpdate(false); |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 2689) | ||
---|---|---|
92 | 92 |
/** |
93 | 93 |
* Editor can use this to test if the result has been computed once. |
94 | 94 |
*/ |
95 |
protected boolean hasBeenComputedOnce = false;
|
|
95 |
private boolean computedOnce = false;
|
|
96 | 96 |
|
97 | 97 |
/** |
98 | 98 |
* The weight, essentially used for sorting purpose. |
... | ... | |
103 | 103 |
* the command this command to true when the result needs to be recomputed. |
104 | 104 |
* like after updating parameters |
105 | 105 |
*/ |
106 |
protected boolean dirty = true;
|
|
106 |
private boolean dirty = true;
|
|
107 | 107 |
|
108 | 108 |
/** |
109 | 109 |
* if a method changed the internal data without **recomputing** the result, the result must be marked "altered" |
110 | 110 |
*/ |
111 |
protected boolean altered = false;
|
|
111 |
private boolean altered = false;
|
|
112 | 112 |
|
113 | 113 |
/** |
114 | 114 |
* The result parent. Should not be null except for roots TXMResult. |
... | ... | |
129 | 129 |
/** |
130 | 130 |
* Parameters node path. Concatenation of the Project scope path + the result uuid |
131 | 131 |
*/ |
132 |
protected String parametersNodePath;
|
|
132 |
private String parametersNodePath;
|
|
133 | 133 |
|
134 | 134 |
|
135 | 135 |
/** |
... | ... | |
152 | 152 |
* User persistable state. |
153 | 153 |
*/ |
154 | 154 |
@Parameter(key = TXMPreferences.PERSITABLE, type = Parameter.INTERNAL) |
155 |
protected boolean userPersistable;
|
|
155 |
private boolean userPersistable;
|
|
156 | 156 |
|
157 | 157 |
/** |
158 | 158 |
* The visibility state. |
... | ... | |
190 | 190 |
* If locked, the result is not updated when computed. |
191 | 191 |
*/ |
192 | 192 |
@Parameter(key = TXMPreferences.LOCK, type = Parameter.INTERNAL) |
193 |
protected Boolean locked = false;
|
|
193 |
private Boolean locked = false;
|
|
194 | 194 |
|
195 | 195 |
/** |
196 | 196 |
* Current computing state. |
197 | 197 |
* True if the result is in the process of computing (is in compute(,) method) |
198 | 198 |
* |
199 | 199 |
*/ |
200 |
protected boolean computing = false;
|
|
200 |
private boolean computing = false;
|
|
201 | 201 |
|
202 | 202 |
/** |
203 | 203 |
* Synchronization state between this result and its parent. |
... | ... | |
558 | 558 |
this.parametersHistory.remove(0); |
559 | 559 |
this.parametersHistory.remove(0); |
560 | 560 |
} |
561 |
|
|
562 | 561 |
} |
563 | 562 |
|
564 | 563 |
/** |
... | ... | |
951 | 950 |
* Sets the result dirty state so editors or others will know the TXMResult needs to be recomputed or not. |
952 | 951 |
* This method is also recursively called on all the children branch sets the new dirty state. |
953 | 952 |
* |
954 |
* @param dirty
|
|
953 |
* @param propagate if true all children are set dirty as well
|
|
955 | 954 |
*/ |
956 |
public void setDirty(boolean dirty) { |
|
957 |
setDirty(dirty, true); |
|
958 |
} |
|
959 |
|
|
960 |
/** |
|
961 |
* Sets the result dirty state so editors or others will know the TXMResult needs to be recomputed or not. |
|
962 |
* This method is also recursively called on all the children branch sets the new dirty state. |
|
963 |
* |
|
964 |
* @param dirty |
|
965 |
*/ |
|
966 |
public void setDirty(boolean dirty, boolean propagate) { |
|
967 |
this.dirty = dirty; |
|
955 |
public void setDirty(boolean propagate) { |
|
956 |
this.dirty = true; |
|
968 | 957 |
if (propagate) { |
969 | 958 |
for (int i = 0; i < this.children.size(); i++) { |
970 |
this.children.get(i).setDirty(dirty);
|
|
959 |
this.children.get(i).setDirty(propagate);
|
|
971 | 960 |
} |
972 | 961 |
} |
973 | 962 |
} |
974 | 963 |
|
975 |
|
|
976 | 964 |
/** |
977 | 965 |
* Gets the value of the specified key in parameters, local result node or |
978 | 966 |
* default preferences nodes. |
... | ... | |
1137 | 1125 |
this.saveParameter(TXMPreferences.PARENT_PARAMETERS_NODE_PATH, this.parent.getParametersNodePath()); |
1138 | 1126 |
} |
1139 | 1127 |
|
1140 |
if (this.hasBeenComputedOnce) {
|
|
1128 |
if (this.computedOnce) {
|
|
1141 | 1129 |
this.lazyName = this.getSimpleName(); |
1142 | 1130 |
} |
1143 | 1131 |
|
... | ... | |
2129 | 2117 |
} |
2130 | 2118 |
clone = this.getClass().getDeclaredConstructor(String.class).newInstance(newNodePath); |
2131 | 2119 |
|
2120 |
System.out.println("CLONE COMPUTED? " + clone.hasBeenComputedOnce()); |
|
2121 |
System.out.println("CLONE DIRTY? " + clone.isDirty()); |
|
2122 |
|
|
2132 | 2123 |
if (all) { |
2133 | 2124 |
for (TXMResult child : this.children) { |
2134 | 2125 |
child.clone(clone, all); |
... | ... | |
2172 | 2163 |
catch (Exception e) { |
2173 | 2164 |
Log.printStackTrace(e); |
2174 | 2165 |
} |
2166 |
|
|
2175 | 2167 |
return true; |
2176 | 2168 |
} |
2177 | 2169 |
|
... | ... | |
2365 | 2357 |
// no changes to do |
2366 | 2358 |
// FIXME: SJ: we need to do do some actions even if the object is locked, eg. updating parameters, saving parameters, etc. |
2367 | 2359 |
// FIXME: MD: nope the parameters must not move and will be saved in the current state |
2368 |
if (this.hasBeenComputedOnce && this.locked) {
|
|
2360 |
if (this.computedOnce && this.locked) {
|
|
2369 | 2361 |
this.computing = false; |
2370 | 2362 |
return true; |
2371 | 2363 |
} |
... | ... | |
2458 | 2450 |
|
2459 | 2451 |
// store last used parameters |
2460 | 2452 |
// this.updateLastParameters(); |
2461 |
if (this.hasBeenComputedOnce// don't update the computing date if the object has been lazy loaded
|
|
2453 |
if (this.computedOnce// don't update the computing date if the object has been lazy loaded
|
|
2462 | 2454 |
|| this.lastComputingDate == null) { // set the update date if never computed once |
2463 | 2455 |
this.lastComputingDate = Calendar.getInstance().getTime(); // update this internal parameter before saving parameters |
2464 | 2456 |
} |
... | ... | |
2478 | 2470 |
} |
2479 | 2471 |
|
2480 | 2472 |
this.dirty = false; // the computing was successful, the result is no more dirty |
2481 |
this.hasBeenComputedOnce = true;
|
|
2473 |
this.computedOnce = true;
|
|
2482 | 2474 |
|
2483 | 2475 |
if (this.altered) { |
2484 | 2476 |
Log.finest(NLS.bind("TXMResult.compute(): Warning {0} modifications have been lost.", this.getSimpleName())); |
... | ... | |
2586 | 2578 |
// set back to dirty |
2587 | 2579 |
this.dirty = true; |
2588 | 2580 |
this.computing = false; |
2589 |
this.hasBeenComputedOnce = false;
|
|
2581 |
this.computedOnce = false;
|
|
2590 | 2582 |
|
2591 | 2583 |
// FIXME: SJ: old code, used when the monitor was stored in the TXMResult, need to check if we need a replacement for this |
2592 | 2584 |
// this.monitorSetCanceled(true); |
... | ... | |
2773 | 2765 |
} |
2774 | 2766 |
|
2775 | 2767 |
/** |
2776 |
* Sets a boolean state to define if the result has already been computed at least once or not. |
|
2777 |
* |
|
2778 |
* @param hasBeenComputedOnce the hasBeenComputedOnce to set |
|
2779 |
*/ |
|
2780 |
// FIXME: SJ: became useless |
|
2781 |
@Deprecated |
|
2782 |
public void setHasBeenComputedOnce(boolean hasBeenComputedOnce) { |
|
2783 |
this.hasBeenComputedOnce = hasBeenComputedOnce; |
|
2784 |
} |
|
2785 |
|
|
2786 |
/** |
|
2787 | 2768 |
* Gets a boolean state defining if the result has already been computed at least once or not. |
2788 | 2769 |
* |
2789 | 2770 |
* true if the result has already been lazy LOADED........... |
... | ... | |
2791 | 2772 |
* @return |
2792 | 2773 |
*/ |
2793 | 2774 |
public boolean hasBeenComputedOnce() { |
2794 |
return hasBeenComputedOnce;
|
|
2775 |
return computedOnce;
|
|
2795 | 2776 |
} |
2796 | 2777 |
|
2797 | 2778 |
|
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 2689) | ||
---|---|---|
51 | 51 |
import org.eclipse.core.runtime.IProgressMonitor; |
52 | 52 |
import org.eclipse.core.runtime.Path; |
53 | 53 |
import org.eclipse.core.runtime.Platform; |
54 |
import org.eclipse.core.runtime.SubMonitor; |
|
55 | 54 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
56 | 55 |
import org.eclipse.osgi.util.NLS; |
57 | 56 |
import org.osgi.framework.Bundle; |
... | ... | |
180 | 179 |
|
181 | 180 |
this.needToBuild = needToBuild; |
182 | 181 |
this.userName = name; |
183 |
this.dirty = false; |
|
184 |
this.hasBeenComputedOnce = true; |
|
182 |
|
|
185 | 183 |
this.setVisible(false); |
186 | 184 |
|
187 | 185 |
initRCPStuffs(new LogMonitor()); |
... | ... | |
193 | 191 |
} |
194 | 192 |
} |
195 | 193 |
|
196 |
|
|
197 | 194 |
/** |
198 | 195 |
* Instantiates a new existing project from persistence. |
199 | 196 |
* This project will not be builded, main corpus, texts, editions, etc. will be restored from persistence. |
... | ... | |
205 | 202 |
super(parametersNodePath); |
206 | 203 |
|
207 | 204 |
this.needToBuild = false; |
208 |
this.dirty = false; |
|
209 |
this.hasBeenComputedOnce = true; |
|
210 | 205 |
this.setVisible(false); |
211 | 206 |
|
212 | 207 |
initRCPStuffs(new LogMonitor()); |
tmp/org.txm.core/src/java/org/txm/objects/Text.java (revision 2689) | ||
---|---|---|
261 | 261 |
} |
262 | 262 |
|
263 | 263 |
public void setSourceFile(File src) { |
264 |
if (pSource == null || !pSource.equals(src)) {
|
|
264 |
if (pSource == null || !pSource.getAbsolutePath().equals(src.getAbsolutePath())) {
|
|
265 | 265 |
this.pSource = src; |
266 |
this.dirty = true;
|
|
266 |
this.setDirty();
|
|
267 | 267 |
} |
268 | 268 |
} |
269 | 269 |
|
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 2689) | ||
---|---|---|
1240 | 1240 |
public void setContextSize(int leftsize, int rightsize) { |
1241 | 1241 |
this.pLeftContextSize = leftsize; |
1242 | 1242 |
this.pRightContextSize = rightsize; |
1243 |
dirty = true;
|
|
1243 |
this.setDirty();
|
|
1244 | 1244 |
} |
1245 | 1245 |
|
1246 | 1246 |
public void setCQLSeparator(String cql_limit) { |
... | ... | |
1309 | 1309 |
this.pLeftContextSize = leftContextSize; |
1310 | 1310 |
this.pRightContextSize = rightContextSize; |
1311 | 1311 |
|
1312 |
this.dirty = true;
|
|
1312 |
this.setDirty();
|
|
1313 | 1313 |
} |
1314 | 1314 |
|
1315 | 1315 |
@Override |
... | ... | |
1399 | 1399 |
this.pRightContextSize = (Integer) parameters.get(ConcordancePreferences.RIGHT_CONTEXT_SIZE); |
1400 | 1400 |
|
1401 | 1401 |
this.saveParameters(); |
1402 |
this.dirty = true;
|
|
1402 |
this.setDirty();
|
|
1403 | 1403 |
return true; |
1404 | 1404 |
} |
1405 | 1405 |
|
... | ... | |
1461 | 1461 |
this.pViewLeftProperties = viewProperties; |
1462 | 1462 |
this.pViewRightProperties = viewProperties; |
1463 | 1463 |
this.pViewKeywordProperties = viewProperties; |
1464 |
this.dirty = true;
|
|
1464 |
this.setDirty();
|
|
1465 | 1465 |
resetLines(); |
1466 | 1466 |
} |
1467 | 1467 |
|
... | ... | |
1501 | 1501 |
this.pViewKeywordProperties = new ArrayList<>(); |
1502 | 1502 |
} |
1503 | 1503 |
|
1504 |
this.dirty = true;
|
|
1504 |
this.setDirty();
|
|
1505 | 1505 |
resetLines(); |
1506 | 1506 |
} |
1507 | 1507 |
|
tmp/org.txm.referencer.core/src/org/txm/referencer/core/functions/Referencer.java (revision 2689) | ||
---|---|---|
507 | 507 |
if (pattern != null) this.pPattern = pattern; |
508 | 508 |
if (prop != null) this.pProperty = prop; |
509 | 509 |
if (hierarchicSort != null) this.pHierarchicSort = hierarchicSort; |
510 |
dirty = true;
|
|
510 |
this.setDirty();
|
|
511 | 511 |
} |
512 | 512 |
|
513 | 513 |
@Override |
tmp/org.txm.ahc.core/src/org/txm/ahc/core/functions/AHC.java (revision 2689) | ||
---|---|---|
235 | 235 |
|
236 | 236 |
// Reset the cached data |
237 | 237 |
this.resetCache(); |
238 |
this.dirty = false; |
|
239 | 238 |
return true; |
240 | 239 |
} |
241 | 240 |
|
... | ... | |
260 | 259 |
if (method != null) { |
261 | 260 |
this.method = method; |
262 | 261 |
} |
263 |
this.dirty = true;
|
|
262 |
this.setDirty(); //TODO check if this is still necessary
|
|
264 | 263 |
} |
265 | 264 |
|
266 | 265 |
|
tmp/org.txm.internalview.core/src/org/txm/internalview/core/functions/InternalView.java (revision 2689) | ||
---|---|---|
120 | 120 |
if (this.hasParameterChanged(InternalViewPreferences.STRUCTURAL_UNIT)) { |
121 | 121 |
|
122 | 122 |
// reset the current page (only if the result has been computed at least once otherwise it breaks the deserialization) |
123 |
if (this.hasBeenComputedOnce) { |
|
123 |
if (this.hasBeenComputedOnce()) {
|
|
124 | 124 |
this.pCurrentPage = 0; |
125 | 125 |
} |
126 | 126 |
|
... | ... | |
134 | 134 |
} |
135 | 135 |
result.drop(); |
136 | 136 |
// System.out.println(matches); |
137 |
dirty = false; |
|
138 | 137 |
return (nmatches > 0); |
139 | 138 |
} |
140 | 139 |
return true; |
... | ... | |
357 | 356 |
if (structProperties != null) this.pStructuralUnitsProperties = structProperties; |
358 | 357 |
if (currentStructure != null) this.pCurrentPage = currentStructure; |
359 | 358 |
|
360 |
dirty = true;
|
|
359 |
this.setDirty();
|
|
361 | 360 |
} |
362 | 361 |
|
363 | 362 |
|
364 | 363 |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 2689) | ||
---|---|---|
143 | 143 |
this.domainGridLinesVisible = true; |
144 | 144 |
} |
145 | 145 |
|
146 |
|
|
147 | 146 |
@Override |
148 | 147 |
protected boolean autoLoadParametersFromAnnotations() throws Exception { |
149 | 148 |
return (super.autoLoadParametersFromAnnotations() |
... | ... | |
176 | 175 |
*/ |
177 | 176 |
protected abstract boolean __compute(TXMProgressMonitor monitor) throws Exception; |
178 | 177 |
|
179 |
|
|
180 | 178 |
@Override |
181 | 179 |
protected final boolean _compute(TXMProgressMonitor monitor) { |
182 | 180 |
|
... | ... | |
186 | 184 |
Log.finest("*** ChartResult._compute(): " + this.getClass().getSimpleName() + ": starting computing process..."); |
187 | 185 |
|
188 | 186 |
// FIXME: SJ: Computes the result only if at least one computing parameter has changed |
189 |
// if(this.hasParameterChanged()) { |
|
190 |
computingState = this.__compute(monitor.createNewMonitor(90)); |
|
187 |
if (super.hasParameterChanged()) { // test only Parameter.COMPUTING |
|
188 |
computingState = this.__compute(monitor.createNewMonitor(90)); |
|
189 |
} |
|
191 | 190 |
// } |
192 |
if (computingState) {
|
|
191 |
if (computingState && (hasRenderingParameterChanged() || super.hasParameterChanged())) { // test only Parameter.RENDERING
|
|
193 | 192 |
computingState = this.renderChart(monitor.createNewMonitor(10)); |
194 | 193 |
} |
195 | 194 |
} |
... | ... | |
364 | 363 |
|
365 | 364 |
super.updateDirtyFromHistory(); |
366 | 365 |
|
367 |
if (!this.dirty) {
|
|
368 |
this.dirty = this.hasRenderingParameterChanged(); // FIXME: SJ: temporary but breaks the dirty computing state and rendering computing state management
|
|
366 |
if (!this.isDirty() && this.hasRenderingParameterChanged()) {
|
|
367 |
this.setDirty(false); // FIXME: SJ: temporary but breaks the dirty computing state and rendering computing state management
|
|
369 | 368 |
// problem here is that if the object is not dirty, TXMResult.compute() doesn't call ChartResult._compute() so the rendering is not done |
370 | 369 |
} |
371 | 370 |
} |
... | ... | |
379 | 378 |
* @throws Exception |
380 | 379 |
*/ |
381 | 380 |
public void updateChartDirtyFromHistory() throws Exception { |
382 |
if (this.dirty || this.hasRenderingParameterChanged()) {
|
|
381 |
if (this.isDirty() || this.hasRenderingParameterChanged()) {
|
|
383 | 382 |
this.chartDirty = true; |
384 | 383 |
} |
385 | 384 |
} |
... | ... | |
393 | 392 |
// clone.chart = this.chart.clone(); |
394 | 393 |
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 |
395 | 394 |
clone.chartDirty = true; |
396 |
clone.hasBeenComputedOnce = false; |
|
397 | 395 |
return clone; |
398 | 396 |
} |
399 | 397 |
|
tmp/org.txm.index.core/src/org/txm/index/core/functions/PartitionIndex.java (revision 2689) | ||
---|---|---|
128 | 128 |
|
129 | 129 |
monitor.worked(30); |
130 | 130 |
|
131 |
this.dirty = false; |
|
132 | 131 |
this.pTopIndex = 0; |
133 | 132 |
|
134 | 133 |
monitor.setTask("Index done."); |
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 2689) | ||
---|---|---|
198 | 198 |
|
199 | 199 |
this.cut(); |
200 | 200 |
|
201 |
this.dirty = false; |
|
202 | 201 |
this.pTopIndex = 0; |
203 | 202 |
|
204 | 203 |
monitor.setTask("Index done."); |
... | ... | |
496 | 495 |
public String getSimpleDetails() { |
497 | 496 |
|
498 | 497 |
try { |
499 |
if (hasBeenComputedOnce) {
|
|
498 |
if (this.hasBeenComputedOnce()) {
|
|
500 | 499 |
return TXMCoreMessages.bind(TXMCoreMessages.fminP0fmaxP1tP2vP3, getFmin(), getFmax(), getT(), getV()); |
501 | 500 |
} |
502 | 501 |
else { |
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 2689) | ||
---|---|---|
108 | 108 |
/** The count. */ |
109 | 109 |
HashMap<String, Integer> count; |
110 | 110 |
|
111 |
// contains the number of encounter |
|
112 |
/** The counted. */ |
|
113 |
HashMap<Integer, Integer> counted = new HashMap<>(); |
|
114 |
|
|
115 | 111 |
// contains the sum of distances |
116 | 112 |
/** The counts. */ |
117 | 113 |
HashMap<String, Integer> counts = new HashMap<>(); |
... | ... | |
124 | 120 |
/** The distances. */ |
125 | 121 |
HashMap<String, Double> distances = new HashMap<>(); |
126 | 122 |
|
127 |
// contains the sum of distances |
|
128 |
/** The distancescounts. */ |
|
129 |
HashMap<String, Integer> distancesCounts = new HashMap<>(); |
|
130 |
|
|
131 | 123 |
/** The FA. */ |
132 | 124 |
int FA = -1; |
133 | 125 |
|
... | ... | |
152 | 144 |
/** The m1. */ |
153 | 145 |
private List<Match> m1; |
154 | 146 |
|
155 |
// contains the list of positions already counteds |
|
156 | 147 |
/** The m2. */ |
157 | 148 |
private List<Match> m2; |
158 | 149 |
|
... | ... | |
258 | 249 |
|
259 | 250 |
@Override |
260 | 251 |
protected boolean _compute(TXMProgressMonitor monitor) throws CqiClientException, IOException, CqiServerError, StatException { |
261 |
// FIXME: debug |
|
262 | 252 |
// System.out.println("cooc: "+corpus+" "+query+" "+properties+" "+limit+" "+maxLeft+" "+minLeft+" "+minRight+" "+maxRight+" "+minFreq+" "+minCof+" "+minScore+" "+includeXpivot); |
263 | 253 |
|
264 | 254 |
monitor.setTask(CooccurrenceCoreMessages.info_buildingQueries); |
... | ... | |
269 | 259 |
this.allsignaturesstr.clear(); |
270 | 260 |
this.conclines.clear(); |
271 | 261 |
this.count.clear(); |
272 |
this.counted.clear(); |
|
273 | 262 |
this.counts.clear(); |
274 | 263 |
this.dist.clear(); |
275 | 264 |
this.distances.clear(); |
276 |
this.distancesCounts.clear(); |
|
277 | 265 |
this.indexfreqs.clear(); |
278 | 266 |
this.keysToString.clear(); |
279 | 267 |
this.occproperties.clear(); |
... | ... | |
431 | 419 |
// FIXME: useless? |
432 | 420 |
public void clearMemory() { |
433 | 421 |
if (distances != null) distances.clear(); |
434 |
if (distancesCounts != null) distancesCounts.clear(); |
|
435 | 422 |
if (counts != null) counts.clear(); |
436 | 423 |
if (indexfreqs != null) indexfreqs.clear(); |
437 |
if (counted != null) counted.clear(); |
|
438 | 424 |
if (m1 != null) m1.clear(); |
439 | 425 |
if (m2 != null) m2.clear(); |
440 | 426 |
if (m3 != null) m3.clear(); |
... | ... | |
754 | 740 |
CQPCorpus corpus = this.getCorpus(); |
755 | 741 |
this.concordance = conc; |
756 | 742 |
corpus = conc.getCorpus(); |
757 |
this.P = corpus.getSize() |
|
758 |
/ (conc.getLeftContextSize() + conc.getRightContextSize()); |
|
743 |
this.P = corpus.getSize() / (conc.getLeftContextSize() + conc.getRightContextSize()); |
|
759 | 744 |
this.FA = conc.getNLines(); |
760 | 745 |
corpus = conc.getCorpus(); |
761 | 746 |
pQuery = new CQLQuery(conc.getQuery().getQueryString()); // TODO manage all kind of query |
... | ... | |
862 | 847 |
|
863 | 848 |
Object propsParam = parameters.get(CooccurrencePreferences.UNIT_PROPERTIES); |
864 | 849 |
List<WordProperty> properties = null; |
865 |
if (propsParam instanceof List) { |
|
850 |
if (propsParam instanceof List<?>) {
|
|
866 | 851 |
properties = (List<WordProperty>) propsParam; |
867 | 852 |
} |
868 | 853 |
else if (propsParam instanceof String) { |
... | ... | |
980 | 965 |
index.alterFrequencies(referenceCorpus); |
981 | 966 |
} |
982 | 967 |
catch (Exception e) { |
983 |
// TODO Auto-generated catch block |
|
984 | 968 |
org.txm.utils.logger.Log.printStackTrace(e); |
985 | 969 |
return false; |
986 | 970 |
} |
... | ... | |
1128 | 1112 |
* @return true, if successful |
1129 | 1113 |
*/ |
1130 | 1114 |
public boolean stepCount() { |
1131 |
ArrayList<Integer> keepedPosition = new ArrayList<>(); |
|
1115 |
// ArrayList<Integer> keepedPosition = new ArrayList<>();
|
|
1132 | 1116 |
|
1133 | 1117 |
int startsearchM2 = 0; // optimisation: m2 is ordered |
1134 | 1118 |
int startsearchM3 = 0; // optimisation: m3 is ordered |
... | ... | |
1186 | 1170 |
// System.out.print(" "+position); |
1187 | 1171 |
} |
1188 | 1172 |
|
1189 |
noOcc = 0; |
|
1190 |
for (int position : positions) { // cooccurent words positions |
|
1191 |
// String signature = allsignatures.get(position); |
|
1192 |
String signaturestr = allsignaturesstr.get(position); |
|
1173 |
|
|
1174 |
|
|
1175 |
// find shortest distance for each positions |
|
1176 |
HashMap<Integer, Integer> positionsDistances = new HashMap<>(); |
|
1177 |
for (int position : positions) { // cooccurrent words positions |
|
1178 |
|
|
1193 | 1179 |
if (o.getStart() <= position && position <= o.getEnd()) { |
1194 | 1180 |
// ignore positions in the anticontext positions |
1195 | 1181 |
continue; |
1196 | 1182 |
} |
1197 | 1183 |
|
1184 |
int dist; |
|
1185 |
if (position <= m.getStart()) { |
|
1186 |
dist = m.getStart() - position; |
|
1187 |
} |
|
1188 |
else if (m.getEnd() <= position) { |
|
1189 |
dist = position - m.getEnd(); |
|
1190 |
} |
|
1191 |
else { // the n match is in the m match !? |
|
1192 |
System.out.println("Warning: the n match is in the m match ? " + n + " " + m); |
|
1193 |
dist = 0; |
|
1194 |
} |
|
1195 |
if (!positionsDistances.containsKey(position) || positionsDistances.get(position) > dist) { |
|
1196 |
positionsDistances.put(position, dist); |
|
1197 |
} |
|
1198 |
} |
|
1199 |
|
|
1200 |
// store and count distances for each position signature |
|
1201 |
noOcc = 0; |
|
1202 |
for (int position : positionsDistances.keySet()) { // cooccurrent words positions |
|
1203 |
// String signature = allsignatures.get(position); |
|
1204 |
String signaturestr = allsignaturesstr.get(position); |
|
1205 |
|
|
1198 | 1206 |
if (!distances.containsKey(signaturestr)) { |
1199 | 1207 |
distances.put(signaturestr, 0.0); |
1200 |
distancesCounts.put(signaturestr, 0); |
|
1201 | 1208 |
} |
1202 | 1209 |
|
1203 |
if (counted.containsKey(position)) { |
|
1204 |
// ignore positions already counted |
|
1205 |
counted.put(position, counted.get(position) + 1); |
|
1206 |
// continue; |
|
1210 |
if (!counts.containsKey(signaturestr)) { |
|
1211 |
counts.put(signaturestr, 0); |
|
1207 | 1212 |
} |
1208 |
else { |
|
1209 |
counted.put(position, 1); |
|
1210 |
if (!counts.containsKey(signaturestr)) { |
|
1211 |
counts.put(signaturestr, 0); |
|
1212 |
} |
|
1213 |
counts.put(signaturestr, (counts.get(signaturestr)) + 1); |
|
1214 |
keepedPosition.add(position); |
|
1215 |
|
|
1216 |
double dist; |
|
1217 |
if (position <= m.getStart()) { |
|
1218 |
dist = m.getStart() - position; |
|
1219 |
} |
|
1220 |
else if (m.getEnd() <= position) { |
|
1221 |
dist = position - m.getEnd(); |
|
1222 |
} |
|
1223 |
else { // the n match is in the m match !? |
|
1224 |
System.out.println("Warning: the n match is in the m match ? " + n + " " + m); |
|
1225 |
dist = 0; |
|
1226 |
} |
|
1227 |
|
|
1228 |
distances.put(signaturestr, (distances.get(signaturestr)) + dist); |
|
1229 |
distancesCounts.put(signaturestr, (distancesCounts.get(signaturestr)) + 1); |
|
1230 |
|
|
1231 |
} |
|
1232 | 1213 |
|
1214 |
int dist = positionsDistances.get(position); |
|
1215 |
distances.put(signaturestr, (distances.get(signaturestr)) + dist); |
|
1216 |
counts.put(signaturestr, (counts.get(signaturestr)) + 1); |
|
1217 |
// } |
|
1218 |
|
|
1233 | 1219 |
noOcc++; |
1234 | 1220 |
} |
1235 | 1221 |
|
... | ... | |
1252 | 1238 |
public boolean stepGetMatches() throws CqiClientException { |
1253 | 1239 |
CQPCorpus corpus = this.getCorpus(); |
1254 | 1240 |
QueryResult r1 = corpus.query(pQuery, "CoocFocusQuery", false); // keywords positions //$NON-NLS-1$ |
1255 |
QueryResult r2 = corpus.query(contextQuery, "CoocContextFocusQuery", false); // max context //$NON-NLS-1$ |
|
1256 |
QueryResult r3 = corpus.query(anticontextquery, "CoocAntiContextFocusQuery", false); // no context //$NON-NLS-1$ |
|
1241 |
QueryResult r2 = null; |
|
1242 |
if (contextQuery.equals(pQuery.fixQuery())) { |
|
1243 |
r2 = r1; |
|
1244 |
} |
|
1245 |
else { |
|
1246 |
r2 = corpus.query(contextQuery, "CoocContextFocusQuery", false); // max context //$NON-NLS-1$ |
|
1247 |
} |
|
1248 |
QueryResult r3 = null; |
|
1249 |
if (anticontextquery.equals(pQuery.fixQuery())) { |
|
1250 |
r3 = r1; |
|
1251 |
} |
|
1252 |
else if (contextQuery.equals(anticontextquery)) { |
|
1253 |
r3 = r2; |
|
1254 |
} |
|
1255 |
else { |
|
1256 |
r3 = corpus.query(anticontextquery, "CoocAntiContextFocusQuery", false); // no context //$NON-NLS-1$ |
|
1257 |
} |
|
1257 | 1258 |
|
1259 |
|
|
1258 | 1260 |
m1 = r1.getMatches(); |
1259 | 1261 |
numberOfKeyword = m1.size(); |
1260 | 1262 |
m2 = r2.getMatches(); |
1261 | 1263 |
m3 = r3.getMatches(); |
1262 | 1264 |
|
1265 |
Log.finest("R1 size=" + m1.size()); |
|
1266 |
Log.finest("R2 size=" + m2.size()); |
|
1267 |
Log.finest("R3 size=" + m3.size()); |
|
1268 |
|
|
1263 | 1269 |
// System.out.println(query+" M1 size: "+m1.size()); |
1264 | 1270 |
// System.out.println(contextquery+" M2 size: "+m2.size()); |
1265 | 1271 |
// System.out.println(anticontextquery+" M3 size: "+m3.size()); |
1266 | 1272 |
r1.drop(); |
1267 |
r2.drop(); |
|
1268 |
r3.drop(); |
|
1273 |
|
|
1274 |
if (r2 != r1) { |
|
1275 |
r2.drop(); |
|
1276 |
} |
|
1277 |
if (r3 != r1 && r2 != r3) { |
|
1278 |
r3.drop(); |
|
1279 |
} |
|
1269 | 1280 |
return true; |
1270 | 1281 |
} |
1271 | 1282 |
|
... | ... | |
1313 | 1324 |
// System.out.println("distance count: "+distancescounts.get(signaturestr)); |
1314 | 1325 |
// } |
1315 | 1326 |
if (counts.containsKey(signaturestr)) { |
1316 |
CLine cline = new CLine(this, specifrownames[ii], props, counts |
|
1317 |
.get(signaturestr), indexfreqs.get(specifrownames[ii]), scores[ii][1], |
|
1318 |
((float) (distances.get(signaturestr) / distancesCounts |
|
1319 |
.get(signaturestr))) - 1.0f, -1); |
|
1320 |
// System.out.println(cline); |
|
1327 |
CLine cline = new CLine(this, specifrownames[ii], props, |
|
1328 |
counts.get(signaturestr), // cofreq |
|
1329 |
indexfreqs.get(specifrownames[ii]), scores[ii][1], // freq |
|
1330 |
((float) (distances.get(signaturestr) / counts.get(signaturestr))) - 1.0f, // mean distance |
|
1331 |
-1); |
|
1332 |
|
|
1333 |
// select the line |
|
1321 | 1334 |
if (cline.freq >= this.pFminFilter && cline.nbocc >= this.pFCoocFilter && cline.score >= 0 && cline.score >= this.pScoreMinFilter) { |
1322 | 1335 |
if (cline.score >= Integer.MAX_VALUE - 5) { |
1323 | 1336 |
cline.score = Float.MAX_EXPONENT; |
tmp/org.txm.properties.core/src/org/txm/properties/core/functions/Properties.java (revision 2689) | ||
---|---|---|
139 | 139 |
if (this.pMaxPropertiesToDisplay <= 0) { |
140 | 140 |
this.pMaxPropertiesToDisplay = 10; |
141 | 141 |
} |
142 |
this.dirty = true;
|
|
142 |
this.setDirty();
|
|
143 | 143 |
} |
144 | 144 |
|
145 | 145 |
|
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 2689) | ||
---|---|---|
342 | 342 |
protected boolean _load(Element e) { |
343 | 343 |
|
344 | 344 |
// partition already computed |
345 |
if (this.hasBeenComputedOnce) { |
|
345 |
if (this.hasBeenComputedOnce()) {
|
|
346 | 346 |
return true; |
347 | 347 |
} |
348 | 348 |
|
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java (revision 2689) | ||
---|---|---|
205 | 205 |
@Override |
206 | 206 |
public void onProjectClose() { |
207 | 207 |
try { |
208 |
if (hasBeenComputedOnce && this.pID != null) {
|
|
208 |
if (this.hasBeenComputedOnce() && this.pID != null) {
|
|
209 | 209 |
CorpusManager.getCorpusManager().deleteCorpus(this); |
210 | 210 |
} |
211 | 211 |
} |
... | ... | |
464 | 464 |
*/ |
465 | 465 |
@Override |
466 | 466 |
public int getSize() throws CqiClientException { |
467 |
if (!hasBeenComputedOnce) return 0;
|
|
467 |
if (!this.hasBeenComputedOnce()) return 0;
|
|
468 | 468 |
|
469 | 469 |
if (this.size == -1) { |
470 | 470 |
try { |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java (revision 2689) | ||
---|---|---|
224 | 224 |
super.clean(); |
225 | 225 |
|
226 | 226 |
// nothing to do if the corpus has not yet been computed |
227 |
if (this.hasBeenComputedOnce) { |
|
227 |
if (this.hasBeenComputedOnce()) {
|
|
228 | 228 |
try { |
229 | 229 |
AbstractCqiClient CQI = CorpusManager.getCorpusManager().getCqiClient(); |
230 | 230 |
if (CQPSearchEngine.isInitialized()) { |
... | ... | |
391 | 391 |
*/ |
392 | 392 |
@Override |
393 | 393 |
public int getSize() throws CqiClientException { |
394 |
if (!hasBeenComputedOnce) return 0;
|
|
394 |
if (!this.hasBeenComputedOnce()) return 0;
|
|
395 | 395 |
|
396 | 396 |
if (this.size == -1) { |
397 | 397 |
// Log.finest(TXMCoreMessages.bind(TXMCoreMessages.SUBCORPUS_SIZE, new Object[]{this.pName, "N/A"})); |
... | ... | |
530 | 530 |
this.pQuery = queryResult.getQuery(); |
531 | 531 |
this.qresult = queryResult; |
532 | 532 |
|
533 |
this.dirty = false;
|
|
533 |
this.setDirty();
|
|
534 | 534 |
} |
535 | 535 |
|
536 | 536 |
@Override |
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 2689) | ||
---|---|---|
733 | 733 |
if (useAllOccurrences != null) { |
734 | 734 |
this.useAllOccurrences = useAllOccurrences; |
735 | 735 |
} |
736 |
this.dirty = true;
|
|
736 |
this.setDirty();
|
|
737 | 737 |
} |
738 | 738 |
|
739 | 739 |
/** |
Also available in: Unified diff