Révision 558
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 558) | ||
---|---|---|
109 | 109 |
|
110 | 110 |
protected int pMaxScore; |
111 | 111 |
|
112 |
|
|
113 | 112 |
/** |
114 | 113 |
* Specificities. |
115 | 114 |
* |
... | ... | |
123 | 122 |
this.lexicalTable = lexicalTable; |
124 | 123 |
this.pMaxScore = maxScore; |
125 | 124 |
} |
126 |
|
|
127 |
|
|
128 |
|
|
129 | 125 |
|
130 | 126 |
@Override |
131 | 127 |
protected boolean _compute(boolean update) throws Exception { |
132 | 128 |
|
133 | 129 |
// compute the lexical table |
134 |
lexicalTable.compute(update);
|
|
130 |
parent.compute(update);
|
|
135 | 131 |
|
136 | 132 |
if (lexicalTable.getNColumns() < 2) { |
137 | 133 |
Log.severe(SpecificitiesCoreMessages.ComputeError_NEED_AT_LEAST_2_PARTS); |
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 558) | ||
---|---|---|
932 | 932 |
if(keyExists) { |
933 | 933 |
nodeQualifier = result.getUUID(); |
934 | 934 |
} |
935 |
|
|
935 | 936 |
// look in the global alternative preferences nodes |
936 | 937 |
else if(!keyExists(nodeQualifier, key)) { |
937 | 938 |
for(int i = 0; i < alternativeNodesQualifiers.size(); i++) { |
... | ... | |
942 | 943 |
} |
943 | 944 |
} |
944 | 945 |
|
945 |
if(nodeQualifier == null) { |
|
946 |
if (nodeQualifier == null) {
|
|
946 | 947 |
try { |
947 | 948 |
System.err.println("TXMPreferences.findNodeQualifier(): no node qualifier has been founded (key = " + key + ", TXMResult = " + result + ")."); |
948 | 949 |
} |
949 | 950 |
catch(Exception e) { |
950 | 951 |
} |
951 | 952 |
} |
952 |
|
|
953 |
System.out.println("NODE QUALIFIER FOUND: "+nodeQualifier); |
|
953 | 954 |
return nodeQualifier; |
954 | 955 |
} |
955 | 956 |
|
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 558) | ||
---|---|---|
15 | 15 |
|
16 | 16 |
import org.apache.commons.lang.StringUtils; |
17 | 17 |
import org.eclipse.core.runtime.IProgressMonitor; |
18 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
|
18 | 19 |
import org.osgi.framework.FrameworkUtil; |
19 | 20 |
import org.osgi.service.prefs.BackingStoreException; |
20 | 21 |
import org.txm.core.preferences.TXMPreferences; |
22 |
import org.txm.objects.Base; |
|
21 | 23 |
import org.txm.utils.logger.Log; |
22 | 24 |
|
23 | 25 |
/** |
... | ... | |
74 | 76 |
* The command preferences node qualifier. |
75 | 77 |
*/ |
76 | 78 |
protected String preferencesNodeQualifier; |
79 |
//protected IEclipsePreferences preferencesNode; |
|
77 | 80 |
|
78 | 81 |
/** |
79 | 82 |
* If set, allows the command to notify its progress. |
... | ... | |
85 | 88 |
private Semaphore progressSemaphore = new Semaphore(1); |
86 | 89 |
|
87 | 90 |
/** |
88 |
* This variable ensure the TXMResult class constructor has been called. A lot of necessary things are done in the TXMREsult constructor. |
|
89 |
*/ |
|
90 |
private boolean constructorCalled; |
|
91 |
|
|
92 |
/** |
|
93 | 91 |
* Creates a new TXMResult, child of the specified parent. |
94 | 92 |
* |
95 | 93 |
* @param parent |
96 | 94 |
*/ |
97 | 95 |
public TXMResult(TXMResult parent) { |
96 |
if (parent == this) { |
|
97 |
throw new IllegalArgumentException("YOU MAD BRO? parent == this"); |
|
98 |
} |
|
98 | 99 |
this.parent = parent; |
99 | 100 |
this.createUUID(); |
100 | 101 |
|
... | ... | |
104 | 105 |
parent.addChild(this); |
105 | 106 |
} |
106 | 107 |
this.children = new ArrayList<TXMResult>(1); |
108 |
// Base binaryCorpus = this.getBinaryCorpus(); |
|
109 |
// if (binaryCorpus != null && this.getClass() != Base.class) { |
|
110 |
// this.preferencesNode = binaryCorpus.getPreferenceScope().getNode(FrameworkUtil.getBundle(getClass()).getSymbolicName()); |
|
107 | 111 |
this.preferencesNodeQualifier = FrameworkUtil.getBundle(getClass()).getSymbolicName(); |
112 |
// } |
|
108 | 113 |
|
109 |
this.constructorCalled = true; // if not set the compute method will |
|
110 | 114 |
// always return false |
111 | 115 |
// FIXME: Debug |
112 | 116 |
// System.out.println("TXMResult.TXMResult(): default preferences node qualifier = " |
... | ... | |
121 | 125 |
public TXMResult() { |
122 | 126 |
this(null); |
123 | 127 |
} |
124 |
|
|
128 |
|
|
125 | 129 |
/** |
126 | 130 |
* Creates and stores an UUID dedicated to persistence for this result. |
127 | 131 |
*/ |
... | ... | |
230 | 234 |
public void setParameterValue(String key, Object value) { |
231 | 235 |
TXMPreferences.putLocal(this, key, value); |
232 | 236 |
} |
233 |
|
|
237 |
|
|
234 | 238 |
/** |
235 | 239 |
* sets the value of the specified key in parameters, local result node or |
236 | 240 |
* default preferences nodes. |
... | ... | |
241 | 245 |
public void setParameterValue(String key, List<?> values) { |
242 | 246 |
TXMPreferences.putLocal(this, key, StringUtils.join(values, UNDERSCORE)); |
243 | 247 |
} |
244 |
|
|
248 |
|
|
245 | 249 |
/** |
246 | 250 |
* Gets the value of the specified key in parameters, local result node or |
247 | 251 |
* default preferences nodes. |
... | ... | |
324 | 328 |
* @return |
325 | 329 |
*/ |
326 | 330 |
public abstract boolean setParameters(TXMParameters parameters); |
327 |
|
|
331 |
|
|
328 | 332 |
/** |
329 | 333 |
* Initialize the @Parameter class members objects using values persisted in the Preference Store |
330 | 334 |
* @return |
331 | 335 |
*/ |
332 | 336 |
public abstract boolean loadParameters(); |
333 | 337 |
|
334 |
|
|
338 |
|
|
335 | 339 |
/** |
336 | 340 |
* Deletes the object from its parent, also deletes the children. The <code>TXMResult.clean()</code> methods of this result and children results are applied before the deletion. |
337 | 341 |
* |
... | ... | |
583 | 587 |
} while (parent != null && node == null); |
584 | 588 |
|
585 | 589 |
return node; |
590 |
} |
|
586 | 591 |
|
592 |
/** |
|
593 |
* Gets the first parent of the specified class, eg. this.getFirstParent(Partition.class); |
|
594 |
* Returns the object itself if it is of the specified class. |
|
595 |
* @param type |
|
596 |
* @return null if the TXMResult is not attached to a BinaryCorpus |
|
597 |
*/ |
|
598 |
synchronized public Base getBinaryCorpus() { |
|
599 |
Object o = getFirstParent(Base.class); |
|
600 |
if (o != null) { |
|
601 |
return (Base)o; |
|
602 |
} else { |
|
603 |
return null; |
|
604 |
} |
|
587 | 605 |
} |
588 | 606 |
|
589 | 607 |
/** |
... | ... | |
870 | 888 |
return true; |
871 | 889 |
} |
872 | 890 |
|
873 |
if (!hasBeenConstructorCalled()) { |
|
874 |
return false; |
|
875 |
} |
|
876 |
|
|
877 | 891 |
if (!canCompute()) { |
878 | 892 |
// FIXME: Debug |
879 | 893 |
System.err.println("TXMResult.compute(): missing or wrong parameters, computing aborted."); |
... | ... | |
881 | 895 |
return false; |
882 | 896 |
} |
883 | 897 |
|
898 |
// // TODO THIS IS FUCKING LAZY LINE CODES OH YEAH YOU MAD BRO |
|
899 |
// TODO where do we put this parent compute ? :o |
|
900 |
// if (parent != null && !parent.getHasBeenComputedOnce()) { // parent must be computed at least one time |
|
901 |
// this.parent.compute(update, monitor); |
|
902 |
// } |
|
903 |
|
|
904 |
|
|
884 | 905 |
if (!_compute(update)) { |
885 | 906 |
|
886 | 907 |
// FIXME: Debug |
... | ... | |
925 | 946 |
// return this.compute(monitor); |
926 | 947 |
// } |
927 | 948 |
|
928 |
|
|
929 |
|
|
930 | 949 |
/** |
931 |
* |
|
932 |
* @return |
|
933 |
*/ |
|
934 |
protected boolean hasBeenConstructorCalled() { |
|
935 |
// TODO Auto-generated method stub |
|
936 |
return constructorCalled; |
|
937 |
} |
|
938 |
|
|
939 |
/** |
|
940 | 950 |
* Copies the parameters from the local preference node if exists. Also fills the non existent parameters with the command default preferences. |
941 | 951 |
*/ |
942 | 952 |
//public abstract void loadParameters(); |
tmp/org.txm.core/src/java/org/txm/objects/Base.java (revision 558) | ||
---|---|---|
68 | 68 |
BaseParameters params; |
69 | 69 |
|
70 | 70 |
private HashMap<String, Alignement> links = new HashMap<String, Alignement>(); |
71 |
|
|
72 |
private BasePreferenceScope scope; |
|
71 | 73 |
|
72 | 74 |
public String toString() { return params.name;}; |
73 | 75 |
|
... | ... | |
88 | 90 |
if (!name.equals(name.toUpperCase())) { |
89 | 91 |
System.out.println("Warning in Base.init: binary corpus name contains lower case letters: "+this.name); |
90 | 92 |
} |
93 |
|
|
94 |
this.scope = new BasePreferenceScope(this); |
|
91 | 95 |
} |
96 |
|
|
97 |
public BasePreferenceScope getPreferenceScope() { |
|
98 |
return scope; |
|
99 |
} |
|
92 | 100 |
|
93 | 101 |
/** |
94 | 102 |
* Gets the project. |
tmp/org.txm.core/src/java/org/txm/objects/BasePreferenceScope.java (revision 558) | ||
---|---|---|
1 |
package org.txm.objects; |
|
2 |
|
|
3 |
import org.eclipse.core.internal.preferences.EclipsePreferences; |
|
4 |
import org.eclipse.core.runtime.IPath; |
|
5 |
import org.eclipse.core.runtime.Path; |
|
6 |
import org.eclipse.core.runtime.Platform; |
|
7 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
|
8 |
import org.eclipse.core.runtime.preferences.IScopeContext; |
|
9 |
|
|
10 |
public class BasePreferenceScope implements IScopeContext { |
|
11 |
|
|
12 |
/** |
|
13 |
* String constant (value of <code>"project"</code>) used for the |
|
14 |
* scope name for this preference scope. |
|
15 |
*/ |
|
16 |
public static final String SCOPE = "binarycorpus"; //$NON-NLS-1$ |
|
17 |
|
|
18 |
private Base context; |
|
19 |
|
|
20 |
/** |
|
21 |
* Create and return a new project scope for the given project. The given |
|
22 |
* project must not be <code>null</code>. |
|
23 |
* |
|
24 |
* @param context the project |
|
25 |
* @exception IllegalArgumentException if the project is <code>null</code> |
|
26 |
*/ |
|
27 |
public BasePreferenceScope(Base context) { |
|
28 |
super(); |
|
29 |
if (context == null) { |
|
30 |
throw new IllegalArgumentException("NULL context"); |
|
31 |
} |
|
32 |
this.context = context; |
|
33 |
} |
|
34 |
|
|
35 |
/* |
|
36 |
* @see org.eclipse.core.runtime.IScopeContext#getNode(java.lang.String) |
|
37 |
*/ |
|
38 |
@Override |
|
39 |
public IEclipsePreferences getNode(String qualifier) { |
|
40 |
if (qualifier == null) { |
|
41 |
throw new IllegalArgumentException(); |
|
42 |
} |
|
43 |
return (IEclipsePreferences) Platform.getPreferencesService().getRootNode().node(SCOPE).node(context.getName()).node(qualifier); |
|
44 |
} |
|
45 |
|
|
46 |
/* |
|
47 |
* @see org.eclipse.core.runtime.preferences.IScopeContext#getLocation() |
|
48 |
*/ |
|
49 |
@Override |
|
50 |
public IPath getLocation() { |
|
51 |
Path location = new Path(context.getBaseDirectory().getAbsolutePath()); |
|
52 |
return location == null ? null : location.append(EclipsePreferences.DEFAULT_PREFERENCES_DIRNAME); |
|
53 |
} |
|
54 |
|
|
55 |
/* |
|
56 |
* @see org.eclipse.core.runtime.preferences.IScopeContext#getName() |
|
57 |
*/ |
|
58 |
@Override |
|
59 |
public String getName() { |
|
60 |
return SCOPE; |
|
61 |
} |
|
62 |
|
|
63 |
/* (non-Javadoc) |
|
64 |
* @see java.lang.Object#equals(java.lang.Object) |
|
65 |
*/ |
|
66 |
@Override |
|
67 |
public boolean equals(Object obj) { |
|
68 |
if (this == obj) { |
|
69 |
return true; |
|
70 |
} |
|
71 |
if (!super.equals(obj)) { |
|
72 |
return false; |
|
73 |
} |
|
74 |
if (!(obj instanceof BasePreferenceScope)) { |
|
75 |
return false; |
|
76 |
} |
|
77 |
BasePreferenceScope other = (BasePreferenceScope) obj; |
|
78 |
return context.equals(other.context); |
|
79 |
} |
|
80 |
|
|
81 |
/* (non-Javadoc) |
|
82 |
* @see java.lang.Object#hashCode() |
|
83 |
*/ |
|
84 |
@Override |
|
85 |
public int hashCode() { |
|
86 |
return super.hashCode() + context.getName().hashCode(); |
|
87 |
} |
|
88 |
} |
|
0 | 89 |
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 558) | ||
---|---|---|
48 | 48 |
|
49 | 49 |
/** |
50 | 50 |
* The Class Project. |
51 |
* TODO: remove this class, to be replace with the usage of a IProject |
|
51 | 52 |
*/ |
52 | 53 |
public class Project extends TxmObject { |
53 | 54 |
|
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/DiagnosticEditor.java (revision 558) | ||
---|---|---|
30 | 30 |
this.diag = (Diagnostic) getResultData(); |
31 | 31 |
} |
32 | 32 |
|
33 |
|
|
34 | 33 |
@Override |
35 | 34 |
public void createPartControl(Composite parent) { |
36 | 35 |
super.createPartControl(parent); |
... | ... | |
51 | 50 |
|
52 | 51 |
browser = new Browser(displayArea, SWT.NONE); |
53 | 52 |
browser.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); |
54 |
|
|
55 | 53 |
} |
56 | 54 |
|
57 | 55 |
@Override |
58 | 56 |
public void refresh(boolean update) { |
59 |
super.refresh(); |
|
60 | 57 |
File file = diag.getHTMLFile(); |
61 | 58 |
if (file.exists()) { |
62 | 59 |
browser.setUrl(file.getAbsolutePath()); |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 558) | ||
---|---|---|
61 | 61 |
// FIXME: Debug |
62 | 62 |
System.err.println("ChartResult.compute(): computing result of type " + this.getClass() + "..."); |
63 | 63 |
|
64 |
// TODO uncomment this |
|
65 |
// if (!this.isDirtyFromHistory()) { |
|
66 |
// |
|
67 |
// // FIXME: Debug |
|
68 |
// System.err.println("TXMResult.compute(): result parameters have not changed computing skipped."); |
|
69 |
// |
|
70 |
// return true; |
|
71 |
// } |
|
72 |
|
|
64 | 73 |
if(!this.isDirty()) { |
65 | 74 |
|
66 | 75 |
// FIXME: Debug |
... | ... | |
70 | 79 |
} |
71 | 80 |
else { |
72 | 81 |
|
73 |
if(!hasBeenConstructorCalled()) { |
|
74 |
return false; |
|
75 |
} |
|
76 |
|
|
77 | 82 |
if (!canCompute()) { |
78 | 83 |
// FIXME: Debug |
79 | 84 |
System.err.println("ChartResult.compute(): missing or wrong parameters, computing aborted."); |
80 | 85 |
|
81 | 86 |
return false; |
82 | 87 |
} |
88 |
|
|
89 |
// // TODO THIS IS FUCKING LAZY LINE CODES OH YEAH YOU MAD BRO |
|
90 |
// TODO where do we put this parent compute ? :o |
|
91 |
// if (parent != null && !parent.getHasBeenComputedOnce()) { // parent must be computed at least one time |
|
92 |
// this.parent.compute(update, monitor); |
|
93 |
// } |
|
83 | 94 |
|
84 | 95 |
if (!_compute(update)) { |
85 | 96 |
|
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 558) | ||
---|---|---|
39 | 39 |
import org.txm.ca.core.statsengine.r.functions.FactoMineRCA; |
40 | 40 |
import org.txm.ca.core.statsengine.r.functions.ICA; |
41 | 41 |
import org.txm.chartsengine.core.results.ChartResult; |
42 |
import org.txm.core.results.Parameter; |
|
42 | 43 |
import org.txm.core.results.TXMParameters; |
43 | 44 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
44 | 45 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
... | ... | |
82 | 83 |
/** The rowtitles. */ |
83 | 84 |
String[] rowtitles; // of the rowinfo table |
84 | 85 |
|
85 |
/** The use Factomine R. */ |
|
86 |
/** The use Factomine R: change this only if you want to use the default R CA package. */
|
|
86 | 87 |
boolean useFactoMineR = true; |
87 | 88 |
|
88 |
|
|
89 | 89 |
/** |
90 |
* Analysis property. |
|
91 |
*/ |
|
92 |
protected Property pAnalysisProperty; |
|
93 |
|
|
94 |
/** |
|
95 | 90 |
* First dimension. |
96 | 91 |
*/ |
92 |
@Parameter |
|
97 | 93 |
protected Integer pFirstDimension = 1; |
98 | 94 |
|
99 | 95 |
/** |
100 | 96 |
* Second dimension. |
101 | 97 |
*/ |
98 |
@Parameter |
|
102 | 99 |
protected Integer pSecondDimension = 2; |
103 |
|
|
104 | 100 |
|
105 |
|
|
106 | 101 |
/** |
107 | 102 |
* Create a new empty CA. |
108 | 103 |
* |
... | ... | |
111 | 106 |
*/ |
112 | 107 |
public CA(LexicalTable lexicalTable) throws StatException { |
113 | 108 |
super(lexicalTable); |
114 |
this.pAnalysisProperty = lexicalTable.getProperty(); |
|
115 | 109 |
|
116 | 110 |
if (useFactoMineR) { |
117 | 111 |
ca = new FactoMineRCA(lexicalTable.getData()); |
118 |
} |
|
119 |
else { |
|
112 |
} else { |
|
120 | 113 |
ca = new org.txm.ca.core.statsengine.r.functions.CA(lexicalTable.getData()); |
121 | 114 |
} |
122 | 115 |
} |
... | ... | |
670 | 663 |
|
671 | 664 |
@Override |
672 | 665 |
public String getSimpleName() { |
673 |
if (pAnalysisProperty != null) {
|
|
674 |
return pAnalysisProperty.getName() + " (" + this.getIntParameterValue(CAPreferences.FIRST_DIMENSION) + "," + this.getIntParameterValue(CAPreferences.SECOND_DIMENSION) + ")";
|
|
666 |
if (pFirstDimension != null) {
|
|
667 |
return getParent().getName() + " " + this.pFirstDimension + "," + this.pSecondDimension + ")";
|
|
675 | 668 |
} |
676 | 669 |
else { |
677 | 670 |
return getParent().getName(); |
... | ... | |
837 | 830 |
return |
838 | 831 |
this.parent != null |
839 | 832 |
&& this.getLexicalTable().getNColumns() > 3 |
833 |
&& this.pFirstDimension > 0 |
|
834 |
&& this.pSecondDimension > 0 |
|
835 |
&& this.pFirstDimension != this.pSecondDimension |
|
840 | 836 |
; |
841 | 837 |
} |
842 | 838 |
|
... | ... | |
844 | 840 |
public boolean saveParameters() { |
845 | 841 |
// TODO Auto-generated method stub |
846 | 842 |
System.err.println("CA.saveParameters(): not yet implemented."); |
843 |
this.setParameterValue(CAPreferences.FIRST_DIMENSION, pFirstDimension); |
|
844 |
this.setParameterValue(CAPreferences.SECOND_DIMENSION, pSecondDimension); |
|
847 | 845 |
return true; |
848 | 846 |
} |
849 | 847 |
|
... | ... | |
853 | 851 |
System.err.println("CA.setParameters(): not yet implemented."); |
854 | 852 |
return true; |
855 | 853 |
} |
856 |
|
|
854 |
|
|
857 | 855 |
@Override |
858 | 856 |
public boolean loadParameters() { |
859 | 857 |
System.err.println("CA.loadParameters(): not yet implemented."); |
860 | 858 |
return true; |
861 | 859 |
} |
860 |
|
|
862 | 861 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ComputeTXMResult.java (revision 558) | ||
---|---|---|
16 | 16 |
System.out.println("Active editor is not a TXMEditorPart. Aborting."); |
17 | 17 |
return null; |
18 | 18 |
} |
19 |
|
|
20 |
TXMEditorPart editor = (TXMEditorPart)page; |
|
19 |
|
|
20 |
TXMEditorPart editor = (TXMEditorPart) page;
|
|
21 | 21 |
editor.updateResultFromEditor(); |
22 | 22 |
editor.compute(true); |
23 |
|
|
23 |
|
|
24 | 24 |
return null; |
25 | 25 |
} |
26 | 26 |
} |
Formats disponibles : Unified diff