Révision 409
tmp/org.txm.cah.core/src/org/txm/cah/core/functions/CAH.java (revision 409) | ||
---|---|---|
33 | 33 |
import org.rosuda.REngine.REXPMismatchException; |
34 | 34 |
import org.txm.ca.core.functions.CA; |
35 | 35 |
import org.txm.cah.core.messages.CAHCoreMessages; |
36 |
import org.txm.core.results.ITXMResult; |
|
37 |
import org.txm.functions.Function; |
|
36 |
import org.txm.cah.core.preferences.CAHPreferences; |
|
37 |
import org.txm.core.preferences.TXMPreferences; |
|
38 |
import org.txm.functions.ProgressWatcher; |
|
39 |
import org.txm.functions.TXMCommand; |
|
38 | 40 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
39 | 41 |
import org.txm.searchengine.cqp.corpus.Corpus; |
40 | 42 |
import org.txm.searchengine.cqp.corpus.Partition; |
... | ... | |
49 | 51 |
* @author sjacquot |
50 | 52 |
* |
51 | 53 |
*/ |
52 |
public class CAH extends Function implements ITXMResult {
|
|
54 |
public class CAH extends TXMCommand {
|
|
53 | 55 |
/** The metric. */ |
54 | 56 |
String metric = "euclidean"; // euclidean, manhattan //$NON-NLS-1$ |
55 | 57 |
|
... | ... | |
214 | 216 |
/** The nocah. */ |
215 | 217 |
protected static int nocah = 1; |
216 | 218 |
|
217 |
/** |
|
218 |
* Step compute. |
|
219 |
* |
|
220 |
*/ |
|
221 |
public void stepCompute() |
|
222 |
{ |
|
219 |
@Override |
|
220 |
public boolean compute(ProgressWatcher watcher) { |
|
223 | 221 |
|
224 | 222 |
Log.info("Computing CAH..."); |
225 | 223 |
try { |
... | ... | |
258 | 256 |
catch(RWorkspaceException e) { |
259 | 257 |
System.out.println("Failed to compute CAH: "+e); |
260 | 258 |
Log.printStackTrace(e); |
259 |
return false; |
|
261 | 260 |
} |
262 | 261 |
|
262 |
// FIXME: persistence |
|
263 |
TXMPreferences.putLocalInt(this, CAHPreferences.N_CLUSTERS, this.NCluster); |
|
264 |
TXMPreferences.putLocalBoolean(this, CAHPreferences.COLUMNS_COMPUTING, this.columns); |
|
265 |
|
|
266 |
|
|
263 | 267 |
// Reset the cached data |
264 | 268 |
this.resetCache(); |
269 |
return true; |
|
265 | 270 |
} |
266 | 271 |
|
267 | 272 |
/** |
... | ... | |
636 | 641 |
|
637 | 642 |
@Override |
638 | 643 |
public String getName() { |
639 |
return this.parent.getName();
|
|
644 |
return "TODO : getName(), etc.";
|
|
640 | 645 |
} |
641 | 646 |
|
642 | 647 |
|
tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/jfreechart/JFCCAHChartCreator.java (revision 409) | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import org.jfree.chart.JFreeChart; |
4 | 4 |
import org.txm.cah.core.functions.CAH; |
5 |
import org.txm.core.results.ITXMResult;
|
|
5 |
import org.txm.core.results.TXMResult; |
|
6 | 6 |
import org.txm.chartsengine.jfreechart.core.JFCChartCreator; |
7 | 7 |
|
8 | 8 |
/** |
... | ... | |
20 | 20 |
} |
21 | 21 |
|
22 | 22 |
@Override |
23 |
public JFreeChart createChart(ITXMResult result, String preferencesNode) {
|
|
23 |
public JFreeChart createChart(TXMResult result) {
|
|
24 | 24 |
|
25 | 25 |
System.err.println("JFCCAHChartCreator.createChart(): not yet implemented."); |
26 | 26 |
|
tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/r/RCAHChartCreator.java (revision 409) | ||
---|---|---|
5 | 5 |
import org.txm.cah.core.functions.CAH; |
6 | 6 |
import org.txm.cah.core.preferences.CAHPreferences; |
7 | 7 |
import org.txm.core.preferences.TXMPreferences; |
8 |
import org.txm.core.results.ITXMResult;
|
|
8 |
import org.txm.core.results.TXMResult; |
|
9 | 9 |
import org.txm.chartsengine.r.core.RChartCreator; |
10 | 10 |
|
11 | 11 |
/** |
... | ... | |
22 | 22 |
} |
23 | 23 |
|
24 | 24 |
@Override |
25 |
public Object createChart(ITXMResult result, String preferencesNode) {
|
|
25 |
public Object createChart(TXMResult result) {
|
|
26 | 26 |
// TODO Auto-generated method stub |
27 | 27 |
return null; |
28 | 28 |
} |
29 | 29 |
|
30 | 30 |
|
31 | 31 |
@Override |
32 |
public File createChartFile(ITXMResult result, File file, String preferencesNode) {
|
|
32 |
public File createChartFile(TXMResult result, File file) {
|
|
33 | 33 |
|
34 | 34 |
CAH cah = (CAH) result; |
35 | 35 |
|
36 | 36 |
String cmd = null; |
37 | 37 |
// 2D |
38 |
if (TXMPreferences.getBoolean(preferencesNode, result, CAHPreferences.DISPLAY_2D)) {
|
|
38 |
if (result.getBooleanParameterValue(CAHPreferences.DISPLAY_2D)) {
|
|
39 | 39 |
cmd = "plot.HCPC(" + cah.getSymbol() + ", new.plot=FALSE, choice=\"tree\")"; |
40 | 40 |
|
41 | 41 |
// FIXME: for tests without drawing the inertia barplot. Without it, the max available clusters can exceed 16 |
Formats disponibles : Unified diff