Révision 1082

tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditor.java (revision 1082)
209 209
	
210 210
	/**
211 211
	 * Synchronizes the editor with the chart result. 
212
	 * Dedicated to dynamically change the editor components from the stored result.
212
	 * Dedicated to dynamically change the editor components values from the stored result data.
213 213
	 */
214 214
	public abstract void updateEditorFromChart(boolean update);
215 215
	
tmp/org.txm.ahc.core/src/org/txm/ahc/core/functions/AHC.java (revision 1082)
35 35
import org.txm.ahc.core.preferences.AHCPreferences;
36 36
import org.txm.ca.core.functions.CA;
37 37
import org.txm.chartsengine.core.results.ChartResult;
38
import org.txm.core.preferences.TXMPreferences;
39 38
import org.txm.core.results.Parameter;
40 39
import org.txm.core.results.TXMParameters;
41 40
import org.txm.lexicaltable.core.functions.LexicalTable;
......
185 184
	 */
186 185
	public AHC(String uuid, CA ca)	{
187 186
		super(uuid, ca);
188
		this.ca = ca;
189 187
	}
190 188

  
191 189
	@Override
192 190
	protected boolean _compute()	{
193 191

  
194
		
195 192
		Log.info("Computing CAH...");
196 193
		try {
197 194
			this.table = this.ca.getLexicalTable();
198 195
			this.target = this.ca.getSymbol();
199 196

  
200
			// reset the number of clusters to default
201
			if(this.hasParameterChanged(AHCPreferences.COLUMNS_COMPUTING))	{
197
			// reset the number of clusters to default if columns or rows computing has changed
198
			if(this.lastParameters.get(AHCPreferences.COLUMNS_COMPUTING) != null && this.hasParameterChanged(AHCPreferences.COLUMNS_COMPUTING))	{
202 199
				this.numberOfClusters = AHCPreferences.getInstance().getInt(AHCPreferences.N_CLUSTERS);
203 200
			}
204 201

  
205
			
206 202
			String colOrLine = "columns"; //$NON-NLS-1$
207
			if (!this.columnsComputing)
203
			if (!this.columnsComputing) {
208 204
				colOrLine ="rows"; //$NON-NLS-1$
205
			}
209 206

  
210 207
			if (this.symbol == null)	{
211 208
				this.symbol = prefixR + (ahcCounter++);
......
232 229
	}
233 230
	
234 231
	
235
	
232
	/**
233
	 * 
234
	 * @param columns
235
	 * @param metric
236
	 * @param nCluster
237
	 * @param method
238
	 */
236 239
	public void setParameters(Boolean columns, String metric, Integer nCluster, String method) {
237
		if (columns != null) this.columnsComputing = columns;
238
		if (metric != null) this.metric = metric;
239
		if (nCluster != null) this.numberOfClusters = nCluster;
240
		if (method != null) this.method = method;
241
		dirty = true;
240
		if (columns != null) {
241
			this.columnsComputing = columns;
242
		}
243
		if (metric != null) {
244
			this.metric = metric;
245
		}
246
		if (nCluster != null) {
247
			this.numberOfClusters = nCluster;
248
		}
249
		if (method != null) {
250
			this.method = method;
251
		}
252
		this.dirty = true;
242 253
	}
243 254

  
244 255

  
245 256
	@Override
246 257
	public boolean loadParameters() {
247
		// nothing to do
258
		if(this.ca == null)	{
259
			this.ca = (CA) this.getParent();
260
		}
248 261
		return true;
249 262
	}
250 263

  
......
254 267
		return true;
255 268
	}
256 269

  
257
	
258
	
259 270
	@Override
260 271
	public boolean canCompute() {
261
		return this.ca != null
272
		return
273
				this.ca != null
262 274
				&& Arrays.binarySearch(AHC.getMethods(), this.method) >= 0 
263 275
				&& Arrays.binarySearch(AHC.getMetrics(), this.metric) >= 0
264 276
				&& this.numberOfClusters >= 2;
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 1082)
198 198
		if(this.lexicalTable.hasBeenComputedOnce())	{
199 199
			SpecificitiesR rSpecificities = new SpecificitiesR(this.lexicalTable.getData());
200 200
			double[][] specIndex = rSpecificities.getScores();
201
	
202
			
201

  
203 202
			if (this.lexicalTable.getPartition() != null) {
204 203
				init(symbol, specIndex, this.unitProperty.getName()); 
205 204
			}
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 1082)
128 128
	 * @param lexicalTable the lexical table
129 129
	 * @throws StatException stat exception if the structure can not be created in R statistics engine.
130 130
	 */
131
	public CA(LexicalTable lexicalTable) throws StatException {
131
	public CA(LexicalTable lexicalTable) {
132 132
		this(null, lexicalTable);
133 133
	}
134 134
	
......
138 138
	 * @param lexicalTable the lexical table
139 139
	 * @throws StatException stat exception if the structure can not be created in R statistics engine.
140 140
	 */
141
	public CA(String uuid) throws StatException {
141
	public CA(String uuid) {
142 142
		this(uuid, null);
143 143
	}
144 144
	
......
148 148
	 * @param lexicalTable the lexical table
149 149
	 * @throws StatException stat exception if the structure can not be created in R statistics engine.
150 150
	 */
151
	public CA(String uuid, LexicalTable lexicalTable) throws StatException {
151
	public CA(String uuid, LexicalTable lexicalTable) {
152 152
		super(uuid, lexicalTable);
153 153
	}
154 154

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 1082)
871 871
					// multiple
872 872
					if(value instanceof List || value instanceof ArrayList)	{
873 873
						((PropertiesSelector)object).setSelectedProperties((List) value);	
874
					} else if(value instanceof ReferencePattern)	{
874
					}
875
					else if(value instanceof ReferencePattern)	{
875 876
						((PropertiesSelector)object).setSelectedProperties(((ReferencePattern) value).getProperties());	
876 877
					}
877 878
					// single
......
987 988
						// multiple
988 989
						if (resultField.getType().isAssignableFrom(List.class))	{
989 990
							value = new ArrayList(((PropertiesSelector)object).getSelectedProperties()); // need to copy the list otherwise the properties selector modify the result itself through reference	
990
						} else if (resultField.getType().isAssignableFrom(ReferencePattern.class))	{
991
						}
992
						else if (resultField.getType().isAssignableFrom(ReferencePattern.class))	{
991 993
							value = new ReferencePattern(((PropertiesSelector)object).getSelectedProperties()); // need to copy the list otherwise the properties selector modify the result itself through reference	
992 994
						}
993 995
						// single
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1082)
1642 1642
			// SJ: other way, test the object itself
1643 1643
			if (parent != null && !parent.hasBeenComputedOnce()) { 
1644 1644
				if (!this.parent.compute(monitor, false, updateLastParameters)) {
1645
					Log.finest("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to compute parent result.");
1645
					Log.severe("TXMResult.compute(): " + this.getClass().getSimpleName() + ": failed to compute parent result.");
1646 1646

  
1647 1647
					//return false;
1648 1648
				}
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/editors/AHCChartEditor.java (revision 1082)
105 105
	@Override
106 106
	public void updateEditorFromChart(boolean update) {
107 107
		
108
		// Update the maximum value of the number of clusters spinner according to the new CAH configuration 
108
		// Update the maximum value of the number of clusters spinner according to the new AHC configuration 
109 109
		this.numberOfClusters.setMaximum(this.getResult().getMaxClustersCount());
110 110

  
111 111
		// Updates the current value of the number of clusters spinner
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/handlers/ComputeAHC.java (revision 1082)
65 65
	@Override
66 66
	public Object execute(ExecutionEvent event) throws ExecutionException {
67 67

  
68

  
69 68
		if(!this.checkStatsEngine()) {
70 69
			return null;
71 70
		}
......
85 84
		// creates from LexicalTable
86 85
		else if (selection instanceof LexicalTable) {
87 86
			LexicalTable lexicaltable = (LexicalTable) selection;
88
			
89
			try {
90
				ahc = new AHC(new CA(lexicaltable));
91
			} catch (StatException e) {
92
				Log.severe("Failed to build the CA with lexical table " + lexicaltable + ": " + e);
93
				Log.printStackTrace(e);
94
			}
95
			lexicaltable.addChild(ahc);
96
			
87
			ahc = new AHC(new CA(lexicaltable));
97 88
		}
98 89
		// creates from Partition
99 90
		else if (selection instanceof Partition) {
......
120 111
					
121 112
					LexicalTable lexicaltable = new LexicalTable(partition, property, fMin, vMax); // use the CAPreferencePage Fmin
122 113
					ahc = new AHC(new CA(lexicaltable));
123
				} else {
124
					// canceled
114
				}
115
				// canceled
116
				else {
125 117
					return null;
126 118
				}
127 119
			} catch (Exception e) {

Formats disponibles : Unified diff