Révision 1085
tmp/org.txm.index.core/src/org/txm/index/core/functions/Lexicon.java (revision 1085) | ||
---|---|---|
40 | 40 |
import org.eclipse.core.runtime.IProgressMonitor; |
41 | 41 |
import org.txm.core.messages.TXMCoreMessages; |
42 | 42 |
import org.txm.core.preferences.TBXPreferences; |
43 |
import org.txm.core.preferences.TXMPreferences; |
|
43 | 44 |
import org.txm.core.results.Parameter; |
44 | 45 |
import org.txm.core.results.TXMParameters; |
45 | 46 |
import org.txm.core.results.TXMResult; |
... | ... | |
94 | 95 |
/** |
95 | 96 |
* The property. |
96 | 97 |
*/ |
97 |
@Parameter(key=TBXPreferences.UNIT_PROPERTY)
|
|
98 |
@Parameter(key=TXMPreferences.UNIT_PROPERTY)
|
|
98 | 99 |
protected Property pProperty; |
99 | 100 |
|
100 | 101 |
|
... | ... | |
114 | 115 |
super(uuid); |
115 | 116 |
} |
116 | 117 |
|
118 |
@Override |
|
117 | 119 |
public Corpus getParent() { |
118 | 120 |
return (Corpus)super.getParent(); |
119 | 121 |
} |
... | ... | |
122 | 124 |
public boolean loadParameters() throws Exception { |
123 | 125 |
try { |
124 | 126 |
//this.persistable = false; // FIXME: remove that later |
125 |
String p = this.getStringParameterValue(TBXPreferences.UNIT_PROPERTY);
|
|
127 |
String p = this.getStringParameterValue(TXMPreferences.UNIT_PROPERTY);
|
|
126 | 128 |
if (p != null && p.length() > 0) { |
127 | 129 |
Corpus parent = getParent(); |
128 | 130 |
if (parent != null) { |
129 | 131 |
this.pProperty = parent.getProperty(p); |
130 |
} else { |
|
132 |
} |
|
133 |
else { |
|
131 | 134 |
return false; |
132 | 135 |
} |
133 | 136 |
} |
... | ... | |
142 | 145 |
|
143 | 146 |
@Override |
144 | 147 |
public boolean saveParameters() throws Exception { |
145 |
this.saveParameter(TBXPreferences.UNIT_PROPERTY, this.pProperty); |
|
148 |
// FIXME: became useless? check that it's well automated by autoSaveParametersFromAnnotations()? |
|
149 |
//this.saveParameter(TXMPreferences.UNIT_PROPERTY, this.pProperty); |
|
146 | 150 |
return true; |
147 | 151 |
} |
148 | 152 |
|
... | ... | |
150 | 154 |
@Override |
151 | 155 |
public void clean() { |
152 | 156 |
// TODO Auto-generated method stub |
153 |
|
|
154 | 157 |
} |
155 | 158 |
|
156 | 159 |
@Override |
... | ... | |
160 | 163 |
|
161 | 164 |
@Override |
162 | 165 |
protected boolean _compute() throws Exception { |
163 |
if (getCorpus() instanceof MainCorpus) {
|
|
164 |
return computeWithMainCorpus((MainCorpus)getCorpus(), pProperty, monitor);
|
|
166 |
if (this.getParent() instanceof MainCorpus) {
|
|
167 |
return computeWithMainCorpus((MainCorpus)this.getParent(), pProperty, monitor);
|
|
165 | 168 |
} |
166 |
else if (getCorpus() instanceof Subcorpus) {
|
|
167 |
return computewithSubCorpus((Subcorpus)getCorpus(), pProperty, monitor);
|
|
169 |
else if (this.getParent() instanceof Subcorpus) {
|
|
170 |
return computewithSubCorpus((Subcorpus)this.getParent(), pProperty, monitor);
|
|
168 | 171 |
} |
169 | 172 |
else { |
170 |
Log.severe("Error: Lexicon parent is neither a Maincorpus nor a Subcorpus."); |
|
173 |
Log.severe("Error: Lexicon parent is neither a Maincorpus nor a Subcorpus."); //$NON-NLS-1$
|
|
171 | 174 |
return false; |
172 | 175 |
} |
173 | 176 |
} |
... | ... | |
224 | 227 |
// eg. dist = CorpusManager.getCorpusManager().getCqiClient().fdist1(corpus.getQualifiedCqpId(), 0, ICqiClient.CQI_CONST_FIELD_MATCH, property.getName()); |
225 | 228 |
protected boolean computewithSubCorpus(Subcorpus corpus, Property property, IProgressMonitor monitor) throws CqiClientException { |
226 | 229 |
|
227 |
if (corpus instanceof Part) this.persistable = false; |
|
230 |
if (corpus instanceof Part) { |
|
231 |
this.persistable = false; |
|
232 |
} |
|
228 | 233 |
|
229 | 234 |
//System.out.println("not found"); |
230 | 235 |
Log.finest(TXMCoreMessages.SUBCORPUS_LEXICON + corpus.getName()); |
... | ... | |
233 | 238 |
Subcorpus tmp = null; |
234 | 239 |
try { |
235 | 240 |
this.subTask("Computing lexicon frequencies..."); |
236 |
tmp = corpus.createSubcorpus(new CQLQuery("[]"), "S"+corpus.getNextSubcorpusCounter(), true); //$NON-NLS-1$
|
|
241 |
tmp = corpus.createSubcorpus(new CQLQuery("[]"), "S" + corpus.getNextSubcorpusCounter(), true); //$NON-NLS-1$
|
|
237 | 242 |
if (tmp != null) { |
238 | 243 |
fdist = CorpusManager.getCorpusManager().getCqiClient().fdist1(tmp.getQualifiedCqpId(), 0, ICqiClient.CQI_CONST_FIELD_MATCH, property.getName()); |
239 | 244 |
|
... | ... | |
296 | 301 |
|
297 | 302 |
@Override |
298 | 303 |
public boolean delete() { |
299 |
if (getCorpus() != null) { |
|
300 |
getCorpus().removeData(this); |
|
304 |
super.delete(); |
|
305 |
|
|
306 |
// FIXME: deprecated + anyway if it's still useful after the TXMObject nerf it should be in the clean() method |
|
307 |
if (this.parent != null) { |
|
308 |
this.getParent().removeData(this); |
|
301 | 309 |
} |
310 |
// end of fixme |
|
311 |
|
|
302 | 312 |
return true; |
303 | 313 |
} |
304 | 314 |
|
... | ... | |
313 | 323 |
StringBuffer buffer = new StringBuffer(); |
314 | 324 |
getForms(); |
315 | 325 |
for (int i = 0; i < forms.length; i++) { |
316 |
buffer.append(txt+ forms[i].replace(txt, txt+txt) + txt + col + freqs[i] + "\n"); //$NON-NLS-1$
|
|
326 |
buffer.append(txt + forms[i].replace(txt, txt + txt) + txt + col + freqs[i] + "\n"); //$NON-NLS-1$
|
|
317 | 327 |
} |
318 | 328 |
return buffer.toString(); |
319 | 329 |
} |
... | ... | |
334 | 344 |
return (Arrays.equals(freqs, other.getFreq()) && Arrays.equals(getForms(), other.getForms())); |
335 | 345 |
} |
336 | 346 |
|
337 |
/** |
|
338 |
* The corpus or subcorpus this lexicon is build on. |
|
339 |
* |
|
340 |
* @return the corpus |
|
341 |
*/ |
|
342 |
public Corpus getCorpus() { |
|
343 |
return (Corpus)parent; |
|
344 |
} |
|
345 | 347 |
|
348 |
|
|
346 | 349 |
public String getDetails() { |
347 |
return getCorpus().getName() + " " + this.pProperty.getName(); //$NON-NLS-1$ |
|
350 |
try { |
|
351 |
return this.getParent().getName() + " " + this.pProperty.getName(); //$NON-NLS-1$ |
|
352 |
} |
|
353 |
catch (Exception e) { |
|
354 |
return this.getCurrentName(); |
|
355 |
} |
|
348 | 356 |
} |
349 | 357 |
|
350 | 358 |
//TODO: move this into a Lexicon chart renderer |
... | ... | |
444 | 452 |
@Override |
445 | 453 |
public String getName() { |
446 | 454 |
try { |
447 |
return IndexCoreMessages.LEXICON_RESULT_TYPE + ": " + this.getCorpus().getSimpleName() + ": " + this.getSimpleName();
|
|
455 |
return IndexCoreMessages.LEXICON_RESULT_TYPE + ": " + this.parent.getSimpleName() + ": " + this.getSimpleName();
|
|
448 | 456 |
} |
449 | 457 |
catch(Exception e) { |
450 | 458 |
} |
... | ... | |
466 | 474 |
return this.getProperty().getName(); |
467 | 475 |
} |
468 | 476 |
catch(Exception e) { |
477 |
return this.getEmptyName(); |
|
469 | 478 |
} |
470 |
return ""; |
|
471 | 479 |
} |
472 | 480 |
|
473 | 481 |
/** |
... | ... | |
489 | 497 |
* {@link Subcorpus#getLexicon(Property)}. |
490 | 498 |
*/ |
491 | 499 |
public boolean hack(Map<String, Integer> map) { |
492 |
if (map.size() != forms.length) return false; |
|
500 |
if (map.size() != forms.length) { |
|
501 |
return false; |
|
502 |
} |
|
493 | 503 |
|
494 | 504 |
//super(corpus); |
495 | 505 |
int size = map.size(); |
... | ... | |
579 | 589 |
|
580 | 590 |
@Override |
581 | 591 |
public String toString() { |
582 |
return IndexCoreMessages.Lexicon_3 + getName();
|
|
592 |
return IndexCoreMessages.Lexicon_3 + this.getCurrentName();
|
|
583 | 593 |
} |
584 | 594 |
|
585 | 595 |
/** |
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 1085) | ||
---|---|---|
43 | 43 |
import org.eclipse.osgi.util.NLS; |
44 | 44 |
import org.rosuda.REngine.REXPMismatchException; |
45 | 45 |
import org.txm.core.preferences.TBXPreferences; |
46 |
import org.txm.core.preferences.TXMPreferences; |
|
46 | 47 |
import org.txm.core.results.Parameter; |
47 | 48 |
import org.txm.core.results.TXMParameters; |
48 | 49 |
import org.txm.core.results.TXMResult; |
... | ... | |
52 | 53 |
import org.txm.searchengine.core.Match; |
53 | 54 |
import org.txm.searchengine.core.Query; |
54 | 55 |
import org.txm.searchengine.core.Selection; |
55 |
import org.txm.searchengine.cqp.CQPSearchEngine; |
|
56 |
import org.txm.searchengine.cqp.ICqiClient; |
|
57 | 56 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
58 | 57 |
import org.txm.searchengine.cqp.corpus.Corpus; |
59 | 58 |
import org.txm.searchengine.cqp.corpus.CorpusManager; |
60 | 59 |
import org.txm.searchengine.cqp.corpus.Part; |
61 | 60 |
import org.txm.searchengine.cqp.corpus.Partition; |
62 | 61 |
import org.txm.searchengine.cqp.corpus.Property; |
63 |
import org.txm.searchengine.cqp.corpus.QueryResult; |
|
64 | 62 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
65 | 63 |
import org.txm.searchengine.cqp.corpus.WordProperty; |
66 | 64 |
import org.txm.searchengine.cqp.corpus.query.CQLQuery; |
... | ... | |
86 | 84 |
protected int Fmax = 0; |
87 | 85 |
/** The current Fmin value. */ |
88 | 86 |
protected int Fmin = 9999999; |
87 |
|
|
89 | 88 |
/** The lexicon used to compute the index (if query = null || query == [] && properties.size() == 1 */ |
89 |
@Deprecated |
|
90 | 90 |
protected Lexicon lexicon; |
91 |
@Deprecated |
|
91 | 92 |
protected boolean lexiconMode = false; |
93 |
|
|
94 |
|
|
92 | 95 |
/** The current lines. */ |
93 | 96 |
protected List<Line> lines = new ArrayList<Line>(); |
94 | 97 |
/** The current number of lines. */ |
... | ... | |
103 | 106 |
/** |
104 | 107 |
* Maximum frequency filter value. |
105 | 108 |
*/ |
106 |
@Parameter(key=TBXPreferences.F_MAX)
|
|
109 |
@Parameter(key=TXMPreferences.F_MAX)
|
|
107 | 110 |
protected Integer pFmaxFilter; |
108 | 111 |
|
109 | 112 |
/** |
110 | 113 |
* Minimum frequency filter value. |
111 | 114 |
*/ |
112 |
@Parameter(key=TBXPreferences.F_MIN)
|
|
115 |
@Parameter(key=TXMPreferences.F_MIN)
|
|
113 | 116 |
protected Integer pFminFilter; |
114 | 117 |
|
115 | 118 |
/** |
116 | 119 |
* Number of lines to display per page. |
117 | 120 |
*/ |
118 |
@Parameter(key=IndexPreferences.N_LINES_PER_PAGE)
|
|
121 |
@Parameter(key=TXMPreferences.N_LINES_PER_PAGE)
|
|
119 | 122 |
protected Integer pNLinesPerPage; |
120 | 123 |
|
121 | 124 |
/** |
122 | 125 |
* The word properties shown. |
123 | 126 |
*/ |
124 |
@Parameter(key=TBXPreferences.UNIT_PROPERTIES)
|
|
127 |
@Parameter(key=TXMPreferences.UNIT_PROPERTIES)
|
|
125 | 128 |
protected List<WordProperty> pProperties; |
126 | 129 |
|
127 | 130 |
/** |
... | ... | |
133 | 136 |
/** |
134 | 137 |
* The CQP query. |
135 | 138 |
*/ |
136 |
@Parameter(key=TBXPreferences.QUERY)
|
|
139 |
@Parameter(key=TXMPreferences.QUERY)
|
|
137 | 140 |
protected Query pQuery; |
138 | 141 |
|
139 | 142 |
/** |
... | ... | |
145 | 148 |
/** |
146 | 149 |
* The vmax filter value parameter. |
147 | 150 |
*/ |
148 |
@Parameter(key=TBXPreferences.V_MAX)
|
|
151 |
@Parameter(key=TXMPreferences.V_MAX)
|
|
149 | 152 |
protected Integer pVmaxFilter; |
150 | 153 |
|
151 | 154 |
/** |
... | ... | |
541 | 544 |
} else if (this.parent instanceof Partition) { |
542 | 545 |
return ((Partition)this.parent).getParent(); |
543 | 546 |
} else if (this.lexicon != null) { |
544 |
return this.lexicon.getCorpus();
|
|
547 |
return this.lexicon.getParent();
|
|
545 | 548 |
} else { |
546 | 549 |
return null; |
547 | 550 |
} |
... | ... | |
724 | 727 |
try { |
725 | 728 |
if (lexicon != null) { |
726 | 729 |
return lexicon.getName(); |
727 |
} else { |
|
730 |
} |
|
731 |
else { |
|
728 | 732 |
return IndexCoreMessages.RESULT_TYPE + ": " + this.parent.getSimpleName() + ": " + this.getSimpleName(); |
729 | 733 |
} |
730 | 734 |
} |
731 | 735 |
catch(Exception e) { |
736 |
return this.getEmptyName(); |
|
732 | 737 |
} |
733 |
return ""; |
|
734 | 738 |
} |
735 | 739 |
|
736 | 740 |
/** |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1085) | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.io.File; |
4 | 4 |
import java.io.IOException; |
5 |
import java.io.Serializable; |
|
5 | 6 |
import java.lang.reflect.Field; |
6 | 7 |
import java.text.DateFormat; |
7 | 8 |
import java.text.SimpleDateFormat; |
... | ... | |
775 | 776 |
continue; // no preference key defined |
776 | 777 |
} |
777 | 778 |
|
778 |
if (f.getType().isAssignableFrom(int.class) || f.getType().isAssignableFrom(Integer.class) || |
|
779 |
f.getType().isAssignableFrom(double.class) || f.getType().isAssignableFrom(Double.class) || |
|
780 |
f.getType().isAssignableFrom(float.class) || f.getType().isAssignableFrom(Float.class) || |
|
781 |
f.getType().isAssignableFrom(boolean.class) || f.getType().isAssignableFrom(Boolean.class) || |
|
782 |
f.getType().isAssignableFrom(String.class)) { |
|
779 |
// FIXME: remove because we want that saveParameter(key, value) call value.toString() if it is an Object |
|
780 |
// if (f.getType().isAssignableFrom(int.class) || f.getType().isAssignableFrom(Integer.class) || |
|
781 |
// f.getType().isAssignableFrom(double.class) || f.getType().isAssignableFrom(Double.class) || |
|
782 |
// f.getType().isAssignableFrom(float.class) || f.getType().isAssignableFrom(Float.class) || |
|
783 |
// f.getType().isAssignableFrom(boolean.class) || f.getType().isAssignableFrom(Boolean.class) || |
|
784 |
// f.getType().isAssignableFrom(String.class)) { |
|
785 |
|
|
786 |
|
|
783 | 787 |
f.setAccessible(true); // set accessible to test the field values |
784 | 788 |
try { |
785 |
Object newValue = f.get(this); |
|
786 |
if (newValue != null) { |
|
787 |
this.saveParameter(key, newValue); |
|
789 |
Object value = f.get(this); |
|
790 |
if (value != null) { |
|
791 |
// FIXME: but do not pass a Serializable for now |
|
792 |
if (!Serializable.class.isInstance(value)) { |
|
793 |
this.saveParameter(key, value); |
|
794 |
} |
|
788 | 795 |
} |
789 | 796 |
} catch (Exception e) { |
790 | 797 |
e.printStackTrace(); |
791 | 798 |
} |
792 |
} |
|
799 |
// }
|
|
793 | 800 |
} |
794 | 801 |
return true; |
795 | 802 |
} |
... | ... | |
986 | 993 |
TXMResult r = results.get(i); |
987 | 994 |
if (r.mustBePersisted()) { |
988 | 995 |
TXMPreferences.flush(r); |
989 |
} else { |
|
996 |
} |
|
997 |
else { |
|
990 | 998 |
Log.finest("TXMResult.deleteAllNonPersistentResults(): Deleting result " + r.getSimpleName() + " of type " + r.getClass().getSimpleName() + "."); |
991 | 999 |
TXMPreferences.delete(r); |
992 | 1000 |
} |
... | ... | |
1034 | 1042 |
} |
1035 | 1043 |
// } |
1036 | 1044 |
} catch (Exception e) { |
1045 |
// nothing to do |
|
1037 | 1046 |
} |
1038 | 1047 |
return false; |
1039 | 1048 |
} |
... | ... | |
1430 | 1439 |
} |
1431 | 1440 |
|
1432 | 1441 |
/** |
1433 |
* Returns a string representation of a unique ID of the result.
|
|
1442 |
* Returns a string representation of an unique ID for the result.
|
|
1434 | 1443 |
* |
1435 | 1444 |
* @return |
1436 | 1445 |
*/ |
tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/base/Utils.java (revision 1085) | ||
---|---|---|
24 | 24 |
*/ |
25 | 25 |
public static String createPartitionDimensionsChartTitle(PartitionDimensions partitionDimensions, boolean sortPartsBySize, boolean displayPartsCountInTitle) { |
26 | 26 |
|
27 |
String title = PartitionCoreMessages.bind(PartitionCoreMessages.CHARTSENGINE_PARTITION_DIMENSIONS_DIMENSIONS_OF_PARTITION, partitionDimensions.getSimpleName(), partitionDimensions.getCorpus().getSimpleName()); |
|
27 |
String title = PartitionCoreMessages.bind(PartitionCoreMessages.CHARTSENGINE_PARTITION_DIMENSIONS_DIMENSIONS_OF_PARTITION, partitionDimensions.getParent().getSimpleName(), partitionDimensions.getCorpus().getSimpleName());
|
|
28 | 28 |
|
29 | 29 |
// FIXME |
30 | 30 |
// if(displayPartsCountInTitle) { |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1085) | ||
---|---|---|
898 | 898 |
} |
899 | 899 |
else if(object instanceof AssistedChoiceQueryWidget) { |
900 | 900 |
if(!((Query)value).getQueryString().isEmpty()) { |
901 |
((QueryWidget)object).setText(((Query)value).getQueryString()); |
|
901 |
((AssistedChoiceQueryWidget)object).setText(((Query)value).getQueryString());
|
|
902 | 902 |
} |
903 | 903 |
} |
904 | 904 |
else if(object instanceof AssistedQueryWidget) { |
905 | 905 |
if(!((CQLQuery)value).getQueryString().isEmpty()) { |
906 |
((QueryWidget)object).setText(((CQLQuery)value).getQueryString()); |
|
906 |
((AssistedQueryWidget)object).setText(((CQLQuery)value).getQueryString());
|
|
907 | 907 |
} |
908 | 908 |
} |
909 | 909 |
else if(object instanceof QueryWidget) { |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/DeleteObject.java (revision 1085) | ||
---|---|---|
72 | 72 |
public class DeleteObject extends AbstractHandler { |
73 | 73 |
|
74 | 74 |
private static boolean shouldRestartToolbox = false; |
75 |
|
|
76 |
private static boolean continueToDelete = true; |
|
77 |
|
|
75 | 78 |
|
76 | 79 |
/* (non-Javadoc) |
77 | 80 |
* @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
... | ... | |
100 | 103 |
return job.getResultObject(); |
101 | 104 |
} |
102 | 105 |
|
103 |
private static boolean continueToDelete = true; |
|
106 |
/** |
|
107 |
* |
|
108 |
* @param selection |
|
109 |
* @return |
|
110 |
*/ |
|
104 | 111 |
public static synchronized boolean askContinueToDelete(final IStructuredSelection selection) { |
105 | 112 |
continueToDelete = true; |
106 | 113 |
|
... | ... | |
110 | 117 |
Display.getDefault().syncExec(new Runnable() { |
111 | 118 |
@Override |
112 | 119 |
public void run() { |
113 |
MessageBox messageBox = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_QUESTION |
|
114 |
| SWT.YES | SWT.NO); |
|
120 |
MessageBox messageBox = new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO); |
|
115 | 121 |
messageBox.setMessage(NLS.bind(TXMUIMessages.DeleteObject_0, selection.toList())); |
116 | 122 |
int response = messageBox.open(); |
117 | 123 |
if (response != SWT.YES) { |
Formats disponibles : Unified diff