Révision 602
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 602) | ||
---|---|---|
260 | 260 |
public void keyPressed(KeyEvent e) { |
261 | 261 |
// System.out.println("key pressed : "+e.keyCode); |
262 | 262 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { |
263 |
updateResultFromEditor(); |
|
264 | 263 |
compute(true); |
265 | 264 |
} |
266 | 265 |
} |
... | ... | |
320 | 319 |
@Override |
321 | 320 |
public void handleEvent(Event event) { |
322 | 321 |
if (TXMPreferences.getBoolean(RCPPreferences.AUTO_UPDATE_EDITOR, RCPPreferences.PREFERENCES_NODE)) { |
323 |
updateResultFromEditor(); |
|
324 | 322 |
compute(true); |
325 | 323 |
// FIXME old method |
326 | 324 |
// TXMEditorPart.compute(CooccurrencesEditor.this.getResultData(), true, CooccurrencesEditor.this); |
... | ... | |
994 | 992 |
|
995 | 993 |
@Override |
996 | 994 |
public void updateResultFromEditor() { |
997 |
Display.getDefault().syncExec(new Runnable() {
|
|
995 |
this.getParametersGroupsComposite().getDisplay().syncExec(new Runnable() {
|
|
998 | 996 |
@Override |
999 | 997 |
public void run() { |
1000 | 998 |
TXMParameters parameters = getWidgetsParameters(); |
1001 | 999 |
cooc.setParameters(parameters); |
1002 |
cooc.setDirty(); |
|
1003 | 1000 |
} |
1004 | 1001 |
}); |
1005 | 1002 |
} |
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 602) | ||
---|---|---|
773 | 773 |
public boolean setParameters(TXMParameters parameters) { |
774 | 774 |
try { |
775 | 775 |
Corpus corpus = this.getCorpus(); |
776 |
boolean includeXpivot = (Boolean) this.getBooleanParameterValue(CooccurrencePreferences.INCLUDE_X_PIVOT);
|
|
776 |
boolean includeXpivot = (Boolean) parameters.getBoolean(CooccurrencePreferences.INCLUDE_X_PIVOT);
|
|
777 | 777 |
Query query = new Query(parameters.get(CooccurrencePreferences.QUERY).toString()); |
778 | 778 |
|
779 | 779 |
StructuralUnit limit = corpus.getStructuralUnit(this.getStringParameterValue(CooccurrencePreferences.STRUCTURE_LIMIT)); |
... | ... | |
783 | 783 |
if (propsParam instanceof List) |
784 | 784 |
properties = (List<Property>)propsParam; |
785 | 785 |
else if (propsParam instanceof String) { |
786 |
// parse String
|
|
786 |
properties = WordProperty.fromStringToList(corpus, propsParam.toString());
|
|
787 | 787 |
} |
788 | 788 |
|
789 |
int maxLeft = this.getIntParameterValue(CooccurrencePreferences.MAX_LEFT);
|
|
790 |
int minLeft = this.getIntParameterValue(CooccurrencePreferences.MIN_LEFT);
|
|
791 |
int maxRight = this.getIntParameterValue(CooccurrencePreferences.MAX_RIGHT);
|
|
792 |
int minRight = this.getIntParameterValue(CooccurrencePreferences.MIN_RIGHT);
|
|
793 |
double minScore = this.getDoubleParameterValue(CooccurrencePreferences.MIN_SCORE);
|
|
794 |
int minCof = this.getIntParameterValue(CooccurrencePreferences.MIN_COUNT);
|
|
795 |
int minFreq = this.getIntParameterValue(CooccurrencePreferences.MIN_FREQ);
|
|
796 |
boolean buildLexicalTableWithCooccurrents = this.getBooleanParameterValue(CooccurrencePreferences.PARTIAL_LEXICAL_TABLE);
|
|
789 |
int maxLeft = parameters.getInteger(CooccurrencePreferences.MAX_LEFT);
|
|
790 |
int minLeft = parameters.getInteger(CooccurrencePreferences.MIN_LEFT);
|
|
791 |
int maxRight = parameters.getInteger(CooccurrencePreferences.MAX_RIGHT);
|
|
792 |
int minRight = parameters.getInteger(CooccurrencePreferences.MIN_RIGHT);
|
|
793 |
double minScore = parameters.getDouble(CooccurrencePreferences.MIN_SCORE);
|
|
794 |
int minCof = parameters.getInteger(CooccurrencePreferences.MIN_COUNT);
|
|
795 |
int minFreq = parameters.getInteger(CooccurrencePreferences.MIN_FREQ);
|
|
796 |
boolean buildLexicalTableWithCooccurrents = parameters.getBoolean(CooccurrencePreferences.PARTIAL_LEXICAL_TABLE);
|
|
797 | 797 |
|
798 | 798 |
this.setParameters(query, properties, limit, maxLeft, minLeft, minRight, maxRight, minFreq, minScore, minCof, includeXpivot, buildLexicalTableWithCooccurrents); |
799 | 799 |
|
... | ... | |
1513 | 1513 |
|
1514 | 1514 |
return true; |
1515 | 1515 |
} |
1516 |
|
|
1517 |
|
|
1516 |
|
|
1517 |
public void setQuery(Query query) { |
|
1518 |
this.pQuery = query; |
|
1519 |
} |
|
1518 | 1520 |
} |
tmp/org.txm.core/src/java/org/txm/core/results/TXMParameters.java (revision 602) | ||
---|---|---|
9 | 9 |
|
10 | 10 |
/** |
11 | 11 |
* Wrapper for semantic purpose. |
12 |
* @author sjacquot |
|
12 |
* |
|
13 |
* @author sjacquot, mdecorde |
|
13 | 14 |
* |
14 | 15 |
*/ |
15 | 16 |
//FIXME: inherit from Properties may be better. but Properties only allow to store Strings |
... | ... | |
20 | 21 |
*/ |
21 | 22 |
private static final long serialVersionUID = 6004847012085746970L; |
22 | 23 |
|
23 |
//FIXME: use super.toString()? |
|
24 |
//FIXME: use super.toString()? -> MD: nope super.toString() don't break lines
|
|
24 | 25 |
public void dump() { |
25 | 26 |
Set<String> keys = this.keySet(); |
26 | 27 |
Iterator<String> it = keys.iterator(); |
... | ... | |
33 | 34 |
|
34 | 35 |
public Integer getInteger(String key) { |
35 | 36 |
Object v = get(key); |
36 |
if (v == null) return 0; |
|
37 |
else if (v instanceof Integer) return (Integer)v; |
|
38 |
else if (v instanceof String) return Integer.parseInt(v.toString()); |
|
37 |
if (v == null) { |
|
38 |
return 0; |
|
39 |
} else if (v instanceof Integer) { |
|
40 |
return (Integer)v; |
|
41 |
} else if (v instanceof String) { |
|
42 |
return Integer.parseInt(v.toString()); |
|
43 |
} else if (v instanceof Float) { |
|
44 |
float f = (Float)v; |
|
45 |
return (int)f; |
|
46 |
} else if (v instanceof Double) { |
|
47 |
double f = (Double)v; |
|
48 |
return (int)f; |
|
49 |
} |
|
39 | 50 |
return 0; |
40 | 51 |
} |
41 | 52 |
|
42 | 53 |
public Float getFloat(String key) { |
43 | 54 |
Object v = get(key); |
44 |
if (v == null) return 0.0f; |
|
45 |
else if (v instanceof Float) return (Float)v; |
|
46 |
else if (v instanceof String) return Float.parseFloat(v.toString()); |
|
55 |
if (v == null) { |
|
56 |
return 0.0f; |
|
57 |
} else if (v instanceof Float) { |
|
58 |
return (Float)v; |
|
59 |
} else if (v instanceof String) { |
|
60 |
return Float.parseFloat(v.toString()); |
|
61 |
} else if (v instanceof Double) { |
|
62 |
double f = (Double)v; |
|
63 |
return (float)f; |
|
64 |
} |
|
47 | 65 |
return 0.0f; |
48 | 66 |
} |
49 | 67 |
|
50 | 68 |
public Boolean getBoolean(String key) { |
51 | 69 |
Object v = get(key); |
52 |
if (v == null) return null; |
|
53 |
else if (v instanceof Boolean) return (Boolean)v; |
|
54 |
else if (v instanceof String) return Boolean.parseBoolean(v.toString()); |
|
55 |
return null; |
|
70 |
if (v == null) { |
|
71 |
return null; |
|
72 |
} else if (v instanceof Boolean) { |
|
73 |
return (Boolean)v; |
|
74 |
} else if (v instanceof String) { |
|
75 |
return Boolean.parseBoolean(v.toString()); |
|
76 |
} |
|
77 |
return false; |
|
56 | 78 |
} |
79 |
|
|
80 |
public Double getDouble(String key) { |
|
81 |
Object v = get(key); |
|
82 |
if (v == null) { |
|
83 |
return 0.0d; |
|
84 |
} else if (v instanceof Double) { |
|
85 |
return (Double)v; |
|
86 |
} else if (v instanceof Float) { |
|
87 |
float f = (Float)v; |
|
88 |
return (double)f; |
|
89 |
} else if (v instanceof String) { |
|
90 |
return Double.parseDouble(v.toString()); |
|
91 |
} |
|
92 |
|
|
93 |
return 0.0d; |
|
94 |
} |
|
57 | 95 |
} |
tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java (revision 602) | ||
---|---|---|
77 | 77 |
public String getName() { |
78 | 78 |
return name; |
79 | 79 |
} |
80 |
|
|
81 |
/** |
|
82 |
* Gets the dirty states. |
|
83 |
* |
|
84 |
* @return |
|
85 |
*/ |
|
86 |
public boolean isDirty() { |
|
87 |
//TODO remove this when TXMObjects will be computable |
|
88 |
return false; |
|
89 |
} |
|
90 |
|
|
91 |
public boolean getHasBeenComputedOnce() { |
|
92 |
//TODO remove this when TXMObjects will be computable |
|
93 |
return true; |
|
94 |
} |
|
80 | 95 |
|
81 | 96 |
/** |
82 | 97 |
* Gets the metadatas. |
Formats disponibles : Unified diff