Révision 3318

TXM/trunk/org.txm.analec.rcp/src/org/txm/annotation/urs/search/URSSearchEngine.java (revision 3318)
12 12
import org.txm.objects.CorpusBuild;
13 13
import org.txm.objects.Match;
14 14
import org.txm.searchengine.core.IQuery;
15
import org.txm.searchengine.core.Query;
15 16
import org.txm.searchengine.core.SearchEngine;
16 17
import org.txm.searchengine.core.SearchEngineProperty;
17 18
import org.txm.searchengine.core.Selection;
......
266 267
	}
267 268
	
268 269
	@Override
269
	public IQuery newQuery() {
270
	public Query newQuery() {
270 271
		return new URSQuery();
271 272
	}
272 273

  
TXM/trunk/org.txm.libs.batik/META-INF/MANIFEST.MF (revision 3318)
196 196
 org.xml.sax.ext,
197 197
 org.xml.sax.helpers
198 198
Bundle-Name: Batik
199
Bundle-Version: 0
199
Bundle-Version: 1.14
200 200
Bundle-ClassPath: .,
201 201
 batik-anim-1.14.jar,
202 202
 batik-awt-util-1.14.jar,
TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/searchengine/ts/TIGERSearchEngine.java (revision 3318)
20 20
import org.txm.objects.Project;
21 21
import org.txm.searchengine.core.EmptySelection;
22 22
import org.txm.searchengine.core.IQuery;
23
import org.txm.searchengine.core.Query;
23 24
import org.txm.searchengine.core.SearchEngine;
24 25
import org.txm.searchengine.core.SearchEngineProperty;
25 26
import org.txm.searchengine.core.Selection;
......
263 264
	}
264 265
	
265 266
	@Override
266
	public IQuery newQuery() {
267
	public Query newQuery() {
267 268
		return new TIGERQuery();
268 269
	}
269 270
	
TXM/trunk/org.txm.tigersearch.rcp/src/org/txm/function/tigersearch/TIGERSearch.java (revision 3318)
85 85
	}
86 86
	
87 87
	public boolean isComputed() {
88
		
88 89
		return tsresult != null;
89 90
	}
90 91
	
91 92
	public boolean isDrawn() {
93
		
92 94
		return tsresult != null && T != null && NT != null;
93 95
	}
94 96
	
95 97
	public boolean toSVG(File svgFile, int sent, int sub, String T, String NT) {
98
		
96 99
		if (tsresult == null) return false; // no result
97 100
		this.T = T;
98 101
		this.NT = NT;
TXM/trunk/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendIndexTo.java (revision 3318)
62 62
	public String createQueries(ExecutionEvent event, ISelection selection) {
63 63
		if (selection instanceof StructuredSelection) {
64 64
			StructuredSelection sselection = (StructuredSelection) selection;
65
			return CQLQuery.serialize(Index.createQueries(sselection.toList()));
65
			return CQLQuery.queriesToString(Index.createQueries(sselection.toList()));
66 66
		}
67 67
		return null;
68 68
	}
TXM/trunk/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java (revision 3318)
205 205
			}
206 206
		}
207 207
		
208
		
209 208
		// generate the chart type according to cumulative boolean preference
210 209
		if (!this.getBooleanParameterValue(ProgressionPreferences.CHART_CUMULATIVE)) {
211 210
			this.chartType = Progression.DENSITY_CHART_TYPE;
......
478 477
				monitor.worked(1);
479 478
			}
480 479
		}
481
		return npositions > 0;
480
		return true;
482 481
	}
483 482
	
484 483
	/**
......
848 847
	
849 848
	@Override
850 849
	public String getComputingStartMessage() {
851
		return TXMCoreMessages.bind(ProgressionCoreMessages.progressionOfP0InTheP1Corpus, Query.queriesToString(this.queries), this.getCorpus().getName());
850
		return TXMCoreMessages.bind(ProgressionCoreMessages.progressionOfP0InTheP1Corpus, Query.toPrettyString(this.queries), this.getCorpus().getName());
852 851
	}
853 852
	
854 853
	
TXM/trunk/org.txm.searchengine.core/src/org/txm/searchengine/core/Query.java (revision 3318)
31 31
import java.util.List;
32 32

  
33 33
import org.txm.core.preferences.TXMPreferences;
34
import org.txm.utils.logger.Log;
34 35

  
35 36
/**
36 37
 * Implements a SearchEngine generic query with a query and a search engine.
......
53 54
	 */
54 55
	public static String queriesToString(List<Query> queries) {
55 56
		if (queries == null) return "";
56
		String str = "";
57
		StringBuilder str = new StringBuilder();
57 58
		for (int i = 0; i < queries.size(); i++) {
58 59
			if (i > 0) {
59
				str += TXMPreferences.LIST_SEPARATOR;
60
				str.append(TXMPreferences.LIST_SEPARATOR);
60 61
			}
61
			str += queries.get(i).getQueryString();
62
			str += TXMPreferences.LIST_SEPARATOR + queries.get(i).getSearchEngine().getName();
62
			Query q = queries.get(i);
63
			str.append(q.getQueryString());
64
			str.append(TXMPreferences.LIST_SEPARATOR + q.getSearchEngine().getName());
63 65
		}
64
		return str;
66
		return str.toString();
65 67
	}
66
	
68
			
67 69
	/**
68 70
	 * Converts the specified string to a list of Query.
69 71
	 * Input string must contains queries separated by a tabulation.
70 72
	 * 
73
	 * A query is composed of a engine name + tabulation + query
74
	 * 
75
	 * if the String list is odd, the 
76
	 * 
71 77
	 * @param str
72 78
	 * @return
73 79
	 */
74 80
	public static List<Query> stringToQueries(String str) {
81
		
75 82
		ArrayList<Query> queries = new ArrayList<>();
76 83
		if (str == null || str.length() == 0) {
77 84
			return queries;
78 85
		}
79 86
		String[] split = str.split(TXMPreferences.LIST_SEPARATOR);
80
		for (int i = 0; i + 1 < split.length; i = i + 2) {
81
			String s = split[i];
82
			String eName = split[i];
83
			SearchEngine e = SearchEnginesManager.getSearchEngine(eName);
84
			queries.add(new Query(s, e));
85
		}
87
			
88
			for (int i = 0; i + 1 < split.length; i = i + 2) {
89
				String s = split[i];
90
				String eName = split[i+1];
91
				SearchEngine e = SearchEnginesManager.getSearchEngine(eName);
92
				if (e == null) {
93
					Log.warning("Error: unknown search engine: "+eName);
94
					continue;
95
				}
96
				
97
				Query q = e.newQuery();
98
				q.setQuery(s);
99
				queries.add(q);
100
			}
86 101
		return queries;
87 102
	}
88 103
	
......
227 242
	public String toString() {
228 243
		return queryString;
229 244
	}
245

  
246
	public static Object toPrettyString(List<Query> queries) {
247
		
248
		if (queries == null) return "";
249
		StringBuilder str = new StringBuilder();
250
		for (int i = 0; i < queries.size(); i++) {
251
			if (i > 0) {
252
				str.append(TXMPreferences.LIST_SEPARATOR);
253
			}
254
			Query q = queries.get(i);
255
			str.append(q.getQueryString());
256
			str.append(TXMPreferences.LIST_SEPARATOR + q.getSearchEngine().getName());
257
		}
258
		return str.toString();
259
	}
230 260
}
TXM/trunk/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEngine.java (revision 3318)
21 21
	
22 22
	public abstract Selection query(CorpusBuild corpus, IQuery query, String name, boolean saveQuery) throws Exception;
23 23
	
24
	public abstract IQuery newQuery();
24
	public abstract Query newQuery();
25 25

  
26 26
	/**
27 27
	 * 
TXM/trunk/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 3318)
130 130
	@Parameter(key = ProgressionPreferences.REPEAT_SAME_VALUES)
131 131
	protected Button repeatSameValues;
132 132
	
133
	
134
	
135
	
136
	
137 133
	@Override
138 134
	public void __createPartControl() {
139 135
		
140
		
141 136
		// FIXME: tests to use Fields editor and ScopedPreferenceStore for command parameters
142 137
		// BooleanFieldEditor field = new BooleanFieldEditor(ChartsEnginePreferences.SHOW_TITLE, "test2 show title store", editor.getParametersComposite());
143 138
		// field.setPreferenceStore(new TXMPreferenceStore(TXMPreferences.getId(progression)));
TXM/trunk/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/query/CQLQuery.java (revision 3318)
100 100
	}
101 101
	
102 102
	/**
103
	 * Converts the specified string to a list of Query.
104
	 * Input string must contains queries separated by a tabulation.
105
	 * 
106
	 * @param str
107
	 * @return
108
	 */
109
	public static List<CQLQuery> unserialize(String str) {
110
		ArrayList<CQLQuery> queries = new ArrayList<>();
111
		if (str == null || str.length() == 0) {
112
			return queries;
113
		}
114
		String[] split = str.split(TXMPreferences.LIST_SEPARATOR);
115
		for (String s : split) {
116
			queries.add(new CQLQuery(s));
117
		}
118
		return queries;
119
	}
120
	
121
	
122
	/**
123
	 * Converts the specified list of Query to a string.
124
	 * Queries strings are separated by a tabulation.
125
	 * 
126
	 * @param queries
127
	 * @return
128
	 */
129
	public static String serialize(List<CQLQuery> queries) {
130
		String str = ""; //$NON-NLS-1$
131
		for (int i = 0; i < queries.size(); i++) {
132
			if (i > 0) {
133
				str += TXMPreferences.LIST_SEPARATOR;
134
			}
135
			str += queries.get(i).getQueryString();
136
		}
137
		return str;
138
	}
139
	
140
	/**
141 103
	 * Creates a readable formated string from the query.
142 104
	 * 
143 105
	 * @return
TXM/trunk/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java (revision 3318)
14 14
import org.txm.objects.Match;
15 15
import org.txm.searchengine.core.EmptySelection;
16 16
import org.txm.searchengine.core.IQuery;
17
import org.txm.searchengine.core.Query;
17 18
import org.txm.searchengine.core.SearchEngine;
18 19
import org.txm.searchengine.core.SearchEngineProperty;
19 20
import org.txm.searchengine.core.Selection;
......
439 440
	}
440 441
	
441 442
	@Override
442
	public IQuery newQuery() {
443
	public Query newQuery() {
443 444
		return new CQLQuery(""); //$NON-NLS-1$
444 445
	}
445 446
	

Formats disponibles : Unified diff