Révision 2380
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/QueryResult.java (revision 2380) | ||
---|---|---|
117 | 117 |
@Override |
118 | 118 |
public boolean checkCqpId(String cqpId) throws InvalidCqpIdException { |
119 | 119 |
|
120 |
if (!AbstractCqiClient.checkSubcorpusId(cqpId)) |
|
120 |
if (!AbstractCqiClient.checkSubcorpusId(cqpId)) {
|
|
121 | 121 |
throw new InvalidCqpIdException(cqpId + TXMCoreMessages.isNotAValidCQPIdForASubcorpusItMustBeAnUppercaseCharactersFollowedByLowercaseCharacters); |
122 |
} |
|
122 | 123 |
return true; |
123 | 124 |
} |
124 | 125 |
|
... | ... | |
159 | 160 |
public int[] getEnds() throws CqiClientException, IOException, CqiServerError { |
160 | 161 |
|
161 | 162 |
int n = this.getNMatch(); |
162 |
if (n > 0) |
|
163 |
if (n > 0) {
|
|
163 | 164 |
return getEnds(0, n - 1); |
164 |
else return new int[0]; |
|
165 |
} else { |
|
166 |
return new int[0]; |
|
167 |
} |
|
165 | 168 |
} |
166 | 169 |
|
167 | 170 |
public int[] getEnds(int from, int to) throws UnexpectedAnswerException, IOException, CqiServerError { |
... | ... | |
192 | 195 |
*/ |
193 | 196 |
public Match getMatch(int i) throws UnexpectedAnswerException, IOException, CqiServerError { |
194 | 197 |
|
195 |
int[] starts = CorpusManager.getCorpusManager().getCqiClient()
|
|
196 |
.dumpSubCorpus(getQualifiedCqpId(), |
|
197 |
NetCqiClient.CQI_CONST_FIELD_MATCH, i, i);
|
|
198 |
int[] ends = CorpusManager.getCorpusManager().getCqiClient() |
|
199 |
.dumpSubCorpus(getQualifiedCqpId(),
|
|
200 |
NetCqiClient.CQI_CONST_FIELD_MATCHEND, i, i); |
|
201 |
return new Match(starts[i], ends[i]);
|
|
198 |
AbstractCqiClient cqi = CorpusManager.getCorpusManager().getCqiClient();
|
|
199 |
|
|
200 |
int[] starts = cqi.dumpSubCorpus(getQualifiedCqpId(), NetCqiClient.CQI_CONST_FIELD_MATCH, i, i);
|
|
201 |
|
|
202 |
int[] ends = cqi.dumpSubCorpus(getQualifiedCqpId(), NetCqiClient.CQI_CONST_FIELD_MATCHEND, i, i);
|
|
203 |
|
|
204 |
return new Match(starts[0], ends[0]); // the starts&ends arrays should be of size 1
|
|
202 | 205 |
} |
203 | 206 |
|
204 | 207 |
/** |
... | ... | |
214 | 217 |
public List<Match> getMatches() throws CqiClientException { |
215 | 218 |
|
216 | 219 |
int n = this.getNMatch(); |
217 |
if (n > 0) |
|
220 |
if (n > 0) {
|
|
218 | 221 |
return getMatches(0, n - 1); |
219 |
else return new ArrayList<Match>(); |
|
222 |
} else { |
|
223 |
return new ArrayList<Match>(); |
|
224 |
} |
|
220 | 225 |
} |
221 | 226 |
|
222 | 227 |
|
... | ... | |
250 | 255 |
starts = getStarts(from, to); |
251 | 256 |
ends = getEnds(from, to); |
252 | 257 |
targets = getTargets(from, to); |
253 |
} |
|
254 |
catch (Exception e) { |
|
258 |
} catch (Exception e) { |
|
255 | 259 |
throw new CqiClientException(e); |
256 | 260 |
} |
257 | 261 |
for (int i = 0; i <= to - from; i++) { |
... | ... | |
289 | 293 |
|
290 | 294 |
// if (nMatch == -1) // |
291 | 295 |
try { |
292 |
nMatch = CorpusManager.getCorpusManager().getCqiClient() |
|
293 |
.subCorpusSize(getQualifiedCqpId()); |
|
294 |
} |
|
295 |
catch (Exception e) { |
|
296 |
nMatch = CorpusManager.getCorpusManager().getCqiClient().subCorpusSize(getQualifiedCqpId()); |
|
297 |
} catch (Exception e) { |
|
296 | 298 |
return 0; |
297 | 299 |
} |
298 | 300 |
return nMatch; |
... | ... | |
383 | 385 |
return CorpusManager.getCorpusManager().getCqiClient() |
384 | 386 |
.dumpSubCorpus(getQualifiedCqpId(), |
385 | 387 |
NetCqiClient.CQI_CONST_FIELD_MATCH, from, to); |
386 |
} |
|
387 |
catch (Exception e) { |
|
388 |
} catch (Exception e) { |
|
388 | 389 |
throw new CqiClientException(e); |
389 | 390 |
} |
390 | 391 |
} |
... | ... | |
392 | 393 |
public int[] getStarts() throws CqiClientException, IOException, CqiServerError { |
393 | 394 |
|
394 | 395 |
int n = this.getNMatch(); |
395 |
if (n > 0) |
|
396 |
if (n > 0) {
|
|
396 | 397 |
return getStarts(0, n - 1); |
397 |
else return new int[0]; |
|
398 |
} else { |
|
399 |
return new int[0]; |
|
400 |
} |
|
398 | 401 |
} |
399 | 402 |
|
400 | 403 |
public int[] getStarts(int from, int to) throws UnexpectedAnswerException, IOException, CqiServerError { |
401 | 404 |
|
402 |
return CorpusManager.getCorpusManager().getCqiClient() |
|
403 |
.dumpSubCorpus(getQualifiedCqpId(), |
|
404 |
NetCqiClient.CQI_CONST_FIELD_MATCH, from, to); |
|
405 |
return CorpusManager.getCorpusManager().getCqiClient().dumpSubCorpus(getQualifiedCqpId(), NetCqiClient.CQI_CONST_FIELD_MATCH, from, to); |
|
405 | 406 |
} |
406 | 407 |
|
407 | 408 |
public String toString() { |
Formats disponibles : Unified diff