Révision 2419
| tmp/org.txm.index.rcp/src/org/txm/index/rcp/adapters/IndexRAdaptor.java (revision 2419) | ||
|---|---|---|
| 43 | 43 |
ArrayList<String> colnames = new ArrayList<String>(); |
| 44 | 44 |
|
| 45 | 45 |
colnames.add("F"); //$NON-NLS-1$
|
| 46 |
List<String> partnames = index.getPartnames();
|
|
| 46 |
List<String> partnames = index.getPartNames();
|
|
| 47 | 47 |
if (partnames.size() > 1) |
| 48 | 48 |
for (int j = 0; j < partnames.size(); j++) |
| 49 | 49 |
colnames.add(partnames.get(j)); |
| tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 2419) | ||
|---|---|---|
| 274 | 274 |
} |
| 275 | 275 |
} |
| 276 | 276 |
|
| 277 |
List<String> colnames = partIndex.getPartnames();
|
|
| 277 |
List<String> colnames = partIndex.getPartNames();
|
|
| 278 | 278 |
|
| 279 | 279 |
Collection<Line> lines = alllines.values(); |
| 280 | 280 |
List<String> rownames = new ArrayList<String>(lines.size()); |
| tmp/org.txm.index.core/src/org/txm/index/core/functions/PartitionIndex.java (revision 2419) | ||
|---|---|---|
| 73 | 73 |
* @author mdecorde |
| 74 | 74 |
* @author sjacquot |
| 75 | 75 |
*/ |
| 76 |
// FIXME: SJ: chzeck that all works well then remove the partnamtes usage |
|
| 76 | 77 |
public class PartitionIndex extends Index {
|
| 77 | 78 |
|
| 78 | 79 |
|
| ... | ... | |
| 83 | 84 |
@Deprecated |
| 84 | 85 |
protected boolean lexiconMode = false; |
| 85 | 86 |
|
| 86 |
/** |
|
| 87 |
* Partition part names. |
|
| 88 |
*/ |
|
| 89 |
protected List<String> partNames = new ArrayList<>(); |
|
| 87 |
// /**
|
|
| 88 |
// * Partition part names.
|
|
| 89 |
// */
|
|
| 90 |
// protected List<String> partNames = new ArrayList<>();
|
|
| 90 | 91 |
|
| 91 |
|
|
| 92 | 92 |
|
| 93 |
|
|
| 93 | 94 |
/** |
| 94 | 95 |
* |
| 95 | 96 |
* @param parent |
| ... | ... | |
| 112 | 113 |
*/ |
| 113 | 114 |
public PartitionIndex(String parametersNodePath, Partition parent) {
|
| 114 | 115 |
super(parametersNodePath, parent); |
| 115 |
|
|
| 116 |
Partition partition = getParent(); |
|
| 117 |
partNames.clear(); |
|
| 118 |
for (Part part : partition.getParts()) {
|
|
| 119 |
partNames.add(part.getName());
|
|
| 120 |
} |
|
| 116 |
// |
|
| 117 |
// Partition partition = getParent();
|
|
| 118 |
// partNames.clear();
|
|
| 119 |
// for (Part part : partition.getParts()) {
|
|
| 120 |
// partNames.add(part.getName());
|
|
| 121 |
// }
|
|
| 121 | 122 |
} |
| 122 | 123 |
|
| 123 | 124 |
@Override |
| ... | ... | |
| 125 | 126 |
return (Partition) parent; |
| 126 | 127 |
} |
| 127 | 128 |
|
| 129 |
|
|
| 130 |
|
|
| 128 | 131 |
@Override |
| 129 |
public String getComputingDoneMessage() {
|
|
| 130 |
if (this.lines.isEmpty()) {
|
|
| 131 |
return TXMCoreMessages.common_noResults; |
|
| 132 |
} |
|
| 133 |
else {
|
|
| 134 |
return TXMCoreMessages.bind(TXMCoreMessages.common_P0ItemsForP1Occurrences, this.lines.size(), this.nTotalTokens); |
|
| 135 |
} |
|
| 132 |
public String getComputingStartMessage() {
|
|
| 133 |
return TXMCoreMessages.bind(IndexCoreMessages.indexOfP0PropertiesP1OnP2Partition, this.pQuery, WordProperty.propertiesToString(this.pProperties).replaceAll(TXMPreferences.LIST_SEPARATOR, |
|
| 134 |
", "), this.getCorpus().getName()); //$NON-NLS-1$ |
|
| 136 | 135 |
} |
| 137 | 136 |
|
| 137 |
|
|
| 138 |
|
|
| 139 |
|
|
| 138 | 140 |
@Override |
| 139 | 141 |
protected boolean _compute() throws Exception {
|
| 140 | 142 |
lines.clear(); |
| 141 | 143 |
counts.clear(); |
| 142 |
partNames.clear(); |
|
| 144 |
// partNames.clear();
|
|
| 143 | 145 |
currentpartid = 0; |
| 144 | 146 |
nTotalTokens = 0; |
| 145 | 147 |
|
| 146 | 148 |
Partition partition = getParent(); |
| 147 |
partNames.clear(); |
|
| 149 |
// partNames.clear();
|
|
| 148 | 150 |
for (Part part : partition.getParts()) {
|
| 149 | 151 |
scanCorpus(part); |
| 150 | 152 |
currentpartid++; |
| 151 |
partNames.add(part.getName()); |
|
| 153 |
// partNames.add(part.getName());
|
|
| 152 | 154 |
} |
| 153 | 155 |
|
| 154 | 156 |
setLineCounts(); |
| ... | ... | |
| 213 | 215 |
Log.fine("Partition not set."); //$NON-NLS-1$
|
| 214 | 216 |
return false; |
| 215 | 217 |
} |
| 216 |
|
|
| 217 |
if (pProperties == null || pProperties.size() == 0) {
|
|
| 218 |
Log.fine("No property set."); //$NON-NLS-1$
|
|
| 219 |
return false; |
|
| 218 |
return super.canCompute(); |
|
| 219 |
} |
|
| 220 |
|
|
| 221 |
|
|
| 222 |
@Override |
|
| 223 |
public CQPCorpus getCorpus() {
|
|
| 224 |
try {
|
|
| 225 |
return ((Partition) this.parent).getParent(); |
|
| 220 | 226 |
} |
| 221 |
|
|
| 222 |
if (pQuery == null || pQuery.getQueryString().length() == 0) {
|
|
| 223 |
Log.fine("No query set."); //$NON-NLS-1$
|
|
| 224 |
return false; |
|
| 227 |
catch (Exception e) {
|
|
| 225 | 228 |
} |
| 226 |
|
|
| 227 |
return true; |
|
| 229 |
return null; |
|
| 228 | 230 |
} |
| 229 | 231 |
|
| 230 | 232 |
|
| ... | ... | |
| 247 | 249 |
} |
| 248 | 250 |
|
| 249 | 251 |
|
| 250 |
|
|
| 251 | 252 |
|
| 252 |
/** |
|
| 253 |
* Gets the corpus. |
|
| 254 |
* |
|
| 255 |
* @return the corpus |
|
| 256 |
*/ |
|
| 257 |
@Override |
|
| 258 |
public CQPCorpus getCorpus() {
|
|
| 259 |
if (this.parent instanceof CQPCorpus) {
|
|
| 260 |
return (CQPCorpus) this.parent; |
|
| 261 |
} |
|
| 262 |
else if (this.parent instanceof Partition) {
|
|
| 263 |
return ((Partition) this.parent).getParent(); |
|
| 264 |
} |
|
| 265 |
else if (this.lexicon != null) {
|
|
| 266 |
return this.lexicon.getParent(); |
|
| 267 |
} |
|
| 268 |
else {
|
|
| 269 |
return null; |
|
| 270 |
} |
|
| 271 |
} |
|
| 272 | 253 |
|
| 273 | 254 |
@Override |
| 274 | 255 |
public String getDetails() {
|
| ... | ... | |
| 294 | 275 |
} |
| 295 | 276 |
} |
| 296 | 277 |
|
| 297 |
|
|
| 298 | 278 |
|
| 279 |
|
|
| 299 | 280 |
/** |
| 300 | 281 |
* If the index has been build with corpus + property, the method returns the lexicon used. |
| 301 | 282 |
* |
| ... | ... | |
| 309 | 290 |
return this.lexiconMode; |
| 310 | 291 |
} |
| 311 | 292 |
|
| 312 |
|
|
| 313 | 293 |
|
| 294 |
|
|
| 314 | 295 |
/** |
| 315 | 296 |
* update the lines counts. |
| 316 | 297 |
*/ |
| 317 | 298 |
@Override |
| 318 | 299 |
protected void setLineCounts() {
|
| 319 |
for (Line line : lines) {// for each Line set its count
|
|
| 320 |
int[] c = new int[partNames.size()]; |
|
| 321 |
for (int i = 0; i < partNames.size(); i++) {
|
|
| 300 |
// for each Line set its count |
|
| 301 |
for (Line line : lines) {
|
|
| 302 |
int[] c = new int[this.getPartition().getPartsCount()]; |
|
| 303 |
for (int i = 0; i < this.getPartition().getPartsCount(); i++) {
|
|
| 322 | 304 |
if (counts.get(line.getSignature()).size() <= i) {
|
| 323 | 305 |
c[i] = 0; |
| 324 | 306 |
} |
| ... | ... | |
| 373 | 355 |
return null; |
| 374 | 356 |
} |
| 375 | 357 |
|
| 358 |
|
|
| 359 |
|
|
| 376 | 360 |
/** |
| 377 | 361 |
* Gets the part names. |
| 378 | 362 |
* |
| 379 | 363 |
* @return the part names |
| 380 | 364 |
*/ |
| 381 |
public List<String> getPartnames() {
|
|
| 382 |
return partNames;
|
|
| 365 |
public List<String> getPartNames() {
|
|
| 366 |
return this.getPartition().getPartNames();
|
|
| 383 | 367 |
} |
| 384 | 368 |
|
| 385 |
|
|
| 386 | 369 |
|
| 370 |
|
|
| 387 | 371 |
@Override |
| 388 | 372 |
public String getSimpleName() {
|
| 389 | 373 |
if (lexicon != null) {
|
| ... | ... | |
| 409 | 393 |
} |
| 410 | 394 |
} |
| 411 | 395 |
|
| 412 |
|
|
| 413 | 396 |
|
| 397 |
|
|
| 414 | 398 |
/** |
| 415 | 399 |
* Tell if the index has been computed with a partition or not. |
| 416 | 400 |
* |
| ... | ... | |
| 421 | 405 |
} |
| 422 | 406 |
|
| 423 | 407 |
/** |
| 424 |
|
|
| 425 |
|
|
| 426 |
/** |
|
| 427 | 408 |
* |
| 409 |
* |
|
| 410 |
* /** |
|
| 411 |
* |
|
| 428 | 412 |
* @param props |
| 429 | 413 |
*/ |
| 430 | 414 |
@Override |
| ... | ... | |
| 436 | 420 |
|
| 437 | 421 |
|
| 438 | 422 |
|
| 439 |
|
|
| 440 | 423 |
|
| 441 |
|
|
| 442 |
|
|
| 424 |
|
|
| 425 |
|
|
| 426 |
|
|
| 443 | 427 |
/** |
| 444 | 428 |
* dump a part of the index. |
| 445 | 429 |
* |
| ... | ... | |
| 451 | 435 |
@Override |
| 452 | 436 |
public void toConsole(int from, int to) throws CqiClientException, IOException {
|
| 453 | 437 |
|
| 438 |
List<Part> parts = this.getPartition().getParts(); |
|
| 439 |
|
|
| 454 | 440 |
String header = ""; //$NON-NLS-1$ |
| 455 | 441 |
for (Property p : pProperties) {
|
| 456 | 442 |
header += (p + pPropertiesSeparator); |
| 457 | 443 |
} |
| 458 | 444 |
header = header.substring(0, header.length() - 1); |
| 459 | 445 |
header += "\tF"; //$NON-NLS-1$ |
| 460 |
if (partNames.size() > 1) {
|
|
| 461 |
for (int j = 0; j < partNames.size(); j++) {
|
|
| 462 |
header += "\t" + partNames.get(j); //$NON-NLS-1$
|
|
| 446 |
if (parts.size() > 1) {
|
|
| 447 |
for (int j = 0; j < parts.size(); j++) {
|
|
| 448 |
header += "\t" + parts.get(j).getName(); //$NON-NLS-1$
|
|
| 463 | 449 |
} |
| 464 | 450 |
} |
| 465 | 451 |
|
| ... | ... | |
| 467 | 453 |
for (int i = from; i < to; i++) {
|
| 468 | 454 |
Line ligne = lines.get(i); |
| 469 | 455 |
System.out.print(ligne + "\t" + ligne.getFrequency()); //$NON-NLS-1$ |
| 470 |
if (partNames.size() > 1) {
|
|
| 471 |
for (int j = 0; j < partNames.size(); j++) {
|
|
| 456 |
if (parts.size() > 1) {
|
|
| 457 |
for (int j = 0; j < parts.size(); j++) {
|
|
| 472 | 458 |
System.out.print("\t" + ligne.getFrequency(j)); //$NON-NLS-1$
|
| 473 | 459 |
} |
| 474 | 460 |
} |
| ... | ... | |
| 495 | 481 |
@Deprecated |
| 496 | 482 |
public void toTxt(File outfile, int from, int to, String encoding, String colseparator, String txtseparator) |
| 497 | 483 |
throws CqiClientException, IOException {
|
| 484 |
|
|
| 485 |
|
|
| 486 |
List<Part> parts = this.getPartition().getParts(); |
|
| 487 |
|
|
| 498 | 488 |
// NK: writer declared as class attribute to perform a clean if the operation is interrupted |
| 499 | 489 |
this.writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), encoding)); |
| 500 | 490 |
// if ("UTF-8".equals(encoding)) writer.write('\ufeff'); // UTF-8 BOM
|
| ... | ... | |
| 504 | 494 |
} |
| 505 | 495 |
header = txtseparator + header.substring(0, header.length() - 1) + txtseparator; |
| 506 | 496 |
header += colseparator + txtseparator + "F" + txtseparator; //$NON-NLS-1$ |
| 507 |
if (partNames.size() > 1) {
|
|
| 508 |
for (int j = 0; j < partNames.size(); j++) {
|
|
| 509 |
header += colseparator + txtseparator + partNames.get(j).replace(txtseparator, txtseparator + txtseparator) + txtseparator;
|
|
| 497 |
if (parts.size() > 1) {
|
|
| 498 |
for (int j = 0; j < parts.size(); j++) {
|
|
| 499 |
header += colseparator + txtseparator + parts.get(j).getName().replace(txtseparator, txtseparator + txtseparator) + txtseparator;
|
|
| 510 | 500 |
} |
| 511 | 501 |
} |
| 512 | 502 |
header += "\n"; //$NON-NLS-1$ |
| ... | ... | |
| 516 | 506 |
for (int i = from; i < to; i++) {
|
| 517 | 507 |
Line ligne = lines.get(i); |
| 518 | 508 |
writer.write(txtseparator + ligne.toString().replace(txtseparator, txtseparator + txtseparator) + txtseparator + colseparator + ligne.getFrequency()); |
| 519 |
if (partNames.size() > 1) {
|
|
| 520 |
for (int j = 0; j < partNames.size(); j++) {
|
|
| 509 |
if (parts.size() > 1) {
|
|
| 510 |
for (int j = 0; j < parts.size(); j++) {
|
|
| 521 | 511 |
writer.write(colseparator + ligne.getFrequency(j)); |
| 522 | 512 |
} |
| 523 | 513 |
} |
| ... | ... | |
| 527 | 517 |
writer.close(); |
| 528 | 518 |
} |
| 529 | 519 |
|
| 530 |
|
|
| 531 | 520 |
|
| 521 |
|
|
| 532 | 522 |
@Override |
| 533 | 523 |
public String getResultType() {
|
| 534 | 524 |
return PartitionIndex.class.getSimpleName(); |
| tmp/org.txm.index.core/src/org/txm/index/core/r/ParitionIndexRTransformer.java (revision 2419) | ||
|---|---|---|
| 43 | 43 |
String symbol = prefixR + novoc; |
| 44 | 44 |
|
| 45 | 45 |
ArrayList<String> colnames = new ArrayList<String>(); |
| 46 |
List<String> partnames = index.getPartnames();
|
|
| 46 |
List<String> partnames = index.getPartNames();
|
|
| 47 | 47 |
|
| 48 | 48 |
colnames.add("F"); //$NON-NLS-1$
|
| 49 | 49 |
colnames.addAll(partnames); |
| tmp/org.txm.index.core/src/org/txm/index/core/messages/messages.properties (revision 2419) | ||
|---|---|---|
| 20 | 20 |
|
| 21 | 21 |
indexOfP0PropertiesP1InTheP2Corpus = Index of <{0}>, properties [{1}], in the {2} corpus...
|
| 22 | 22 |
|
| 23 |
indexOfP0PropertiesP1OnP2Partition = Index of <{0}>, properties [{1}], on {2} partition...
|
|
| 24 |
|
|
| 23 | 25 |
lexicon = Lexicon |
| 24 | 26 |
|
| 25 | 27 |
lexiconColonP0 = Lexicon: {0}
|
| tmp/org.txm.index.core/src/org/txm/index/core/messages/IndexCoreMessages.java (revision 2419) | ||
|---|---|---|
| 37 | 37 |
|
| 38 | 38 |
public static String indexOfP0PropertiesP1InTheP2Corpus; |
| 39 | 39 |
|
| 40 |
public static String indexOfP0PropertiesP1OnP2Partition; |
|
| 40 | 41 |
|
| 41 | 42 |
|
| 42 | 43 |
static {
|
| tmp/org.txm.index.core/src/org/txm/index/core/messages/messages_fr.properties (revision 2419) | ||
|---|---|---|
| 20 | 20 |
|
| 21 | 21 |
indexOfP0PropertiesP1InTheP2Corpus = Index de <{0}>, propriété(s) [{1}], dans le corpus {2}...
|
| 22 | 22 |
|
| 23 |
indexOfP0PropertiesP1OnP2Partition = Index de <{0}>, propriété(s) [{1}], de la partition {2}...
|
|
| 24 |
|
|
| 23 | 25 |
lexicon = Lexique |
| 24 | 26 |
|
| 25 | 27 |
lexiconColonP0 = Lexique : {0}
|
| tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 2419) | ||
|---|---|---|
| 420 | 420 |
return this.getParts().size(); |
| 421 | 421 |
} |
| 422 | 422 |
|
| 423 |
|
|
| 423 | 424 |
/** |
| 425 |
* Gets a part specified by its index. |
|
| 426 |
* |
|
| 427 |
* @param index |
|
| 428 |
* @return |
|
| 429 |
*/ |
|
| 430 |
public Part getPart(int index) {
|
|
| 431 |
return this.getParts().get(index); |
|
| 432 |
} |
|
| 433 |
|
|
| 434 |
|
|
| 435 |
/** |
|
| 424 | 436 |
* Gets the name of the parts. |
| 425 | 437 |
* |
| 426 | 438 |
* @return the part names |
| 427 | 439 |
*/ |
| 440 |
// FIXME: SJ: later, do not cache the names => the names may have been modified by the user |
|
| 428 | 441 |
public List<String> getPartNames() {
|
| 429 | 442 |
if (this.hasBeenComputedOnce()) {
|
| 430 | 443 |
List<Part> parts = this.getParts(); |
| tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java (revision 2419) | ||
|---|---|---|
| 27 | 27 |
* |
| 28 | 28 |
*/ |
| 29 | 29 |
public class PartitionDimensions extends ChartResult {
|
| 30 |
|
|
| 30 |
|
|
| 31 | 31 |
/** |
| 32 | 32 |
* Parent partition parts caching. |
| 33 | 33 |
*/ |
| ... | ... | |
| 36 | 36 |
/** |
| 37 | 37 |
* Parent partition parts sorted by size caching. |
| 38 | 38 |
*/ |
| 39 |
// FIXME: SJ: became useless since the parent Parts are now real TXMResult children |
|
| 39 |
// FIXME: SJ: became useless? since the parent Parts are now real TXMResult children
|
|
| 40 | 40 |
@Deprecated |
| 41 | 41 |
protected List<Part> partsSortedBySize = null; |
| 42 | 42 |
|
| 43 |
|
|
| 44 |
|
|
| 45 | 43 |
/** |
| 46 | 44 |
* To display or not the parts count in chart title. |
| 47 | 45 |
*/ |
| 48 |
@Parameter(key=PartitionDimensionsPreferences.CHART_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE, type=Parameter.RENDERING)
|
|
| 46 |
@Parameter(key = PartitionDimensionsPreferences.CHART_DIMENSIONS_DISPLAY_PARTS_COUNT_IN_TITLE, type = Parameter.RENDERING)
|
|
| 49 | 47 |
protected boolean displayPartsCountInTitle; |
| 50 |
|
|
| 48 |
|
|
| 51 | 49 |
/** |
| 52 | 50 |
* To sort or not the parts by size. |
| 53 | 51 |
*/ |
| 54 |
@Parameter(key=PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE, type=Parameter.RENDERING)
|
|
| 52 |
@Parameter(key = PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE, type = Parameter.RENDERING)
|
|
| 55 | 53 |
protected boolean sortBySize; |
| 56 |
|
|
| 57 | 54 |
|
| 58 | 55 |
|
| 59 | 56 |
|
| 57 |
|
|
| 60 | 58 |
/** |
| 61 | 59 |
* Creates a not computed partition dimensions. |
| 60 |
* |
|
| 62 | 61 |
* @param partition |
| 63 | 62 |
*/ |
| 64 | 63 |
public PartitionDimensions(Partition partition) {
|
| 65 | 64 |
this(null, partition); |
| 66 | 65 |
} |
| 67 |
|
|
| 66 |
|
|
| 68 | 67 |
/** |
| 69 | 68 |
* Creates a not computed partition dimensions. |
| 69 |
* |
|
| 70 | 70 |
* @param parametersNodePath |
| 71 | 71 |
*/ |
| 72 | 72 |
public PartitionDimensions(String parametersNodePath) {
|
| ... | ... | |
| 75 | 75 |
|
| 76 | 76 |
/** |
| 77 | 77 |
* Creates a not computed partition dimensions. |
| 78 |
* |
|
| 78 | 79 |
* @param parametersNodePath |
| 79 | 80 |
* @param partition |
| 80 | 81 |
*/ |
| ... | ... | |
| 84 | 85 |
this.domainGridLinesVisible = false; |
| 85 | 86 |
} |
| 86 | 87 |
|
| 87 |
|
|
| 88 |
|
|
| 88 | 89 |
@Override |
| 89 | 90 |
public boolean loadParameters() {
|
| 90 | 91 |
// nothing to do |
| 91 | 92 |
return true; |
| 92 | 93 |
} |
| 93 |
|
|
| 94 |
|
|
| 94 | 95 |
@Override |
| 95 | 96 |
public boolean saveParameters() {
|
| 96 | 97 |
// nothing to do |
| 97 | 98 |
return true; |
| 98 | 99 |
} |
| 99 |
|
|
| 100 | 100 |
|
| 101 | 101 |
|
| 102 |
|
|
| 102 | 103 |
@Override |
| 103 | 104 |
protected boolean __compute() throws Exception {
|
| 104 | 105 |
// retrieve the parts |
| 105 | 106 |
this.parts = this.getPartition().getParts(); |
| 106 | 107 |
|
| 107 |
// store a copy of parts sorted by size
|
|
| 108 |
List<Part> sortedParts = new ArrayList<Part>(this.parts);
|
|
| 108 |
// store a copy of parts sorted by size |
|
| 109 |
List<Part> sortedParts = new ArrayList<>(this.parts); |
|
| 109 | 110 |
Collections.sort(sortedParts, new Comparator<Part>() {
|
| 111 |
|
|
| 110 | 112 |
@Override |
| 111 | 113 |
public int compare(Part arg0, Part arg1) {
|
| 112 | 114 |
try {
|
| 113 | 115 |
return arg1.getSize() - arg0.getSize(); |
| 114 |
} catch (CqiClientException e) {
|
|
| 116 |
} |
|
| 117 |
catch (CqiClientException e) {
|
|
| 115 | 118 |
return 0; |
| 116 | 119 |
} |
| 117 | 120 |
} |
| ... | ... | |
| 120 | 123 |
|
| 121 | 124 |
return true; |
| 122 | 125 |
} |
| 123 |
|
|
| 126 |
|
|
| 124 | 127 |
@Override |
| 125 | 128 |
public void clean() {
|
| 126 | 129 |
// does nothing |
| 127 | 130 |
} |
| 128 |
|
|
| 131 |
|
|
| 129 | 132 |
@Override |
| 130 | 133 |
public boolean canCompute() {
|
| 131 | 134 |
return this.getPartition() != null; |
| 132 | 135 |
} |
| 133 |
|
|
| 136 |
|
|
| 134 | 137 |
@Override |
| 135 | 138 |
public boolean setParameters(TXMParameters parameters) {
|
| 136 | 139 |
try {
|
| 137 |
this.setSortBySize((boolean)parameters.get(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE)); |
|
| 140 |
this.setSortBySize((boolean) parameters.get(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORT_BY_SIZE));
|
|
| 138 | 141 |
return true; |
| 139 | 142 |
} |
| 140 |
catch(Exception e) {
|
|
| 143 |
catch (Exception e) {
|
|
| 141 | 144 |
// TODO Auto-generated catch block |
| 142 | 145 |
e.printStackTrace(); |
| 143 | 146 |
} |
| 144 | 147 |
return false; |
| 145 | 148 |
} |
| 146 |
|
|
| 147 |
|
|
| 148 | 149 |
|
| 150 |
|
|
| 151 |
|
|
| 149 | 152 |
/** |
| 150 | 153 |
* Convenience method. |
| 151 | 154 |
*/ |
| 152 |
public Partition getPartition() {
|
|
| 155 |
public Partition getPartition() {
|
|
| 153 | 156 |
try {
|
| 154 | 157 |
return (Partition) this.parent; |
| 155 | 158 |
} |
| 156 |
catch(Exception e) {
|
|
| 159 |
catch (Exception e) {
|
|
| 157 | 160 |
e.printStackTrace(); |
| 158 | 161 |
return null; |
| 159 | 162 |
} |
| 160 | 163 |
} |
| 161 | 164 |
|
| 162 | 165 |
|
| 163 |
|
|
| 166 |
|
|
| 164 | 167 |
/** |
| 165 | 168 |
* Gets the number of parts in the linked partition. |
| 169 |
* |
|
| 166 | 170 |
* @return |
| 167 | 171 |
*/ |
| 168 |
public int getPartsCount() {
|
|
| 172 |
public int getPartsCount() {
|
|
| 169 | 173 |
return this.parts.size(); |
| 170 | 174 |
} |
| 171 | 175 |
|
| 172 | 176 |
/** |
| 173 | 177 |
* Gets the parts of the linked partition sorted by size or not. |
| 178 |
* |
|
| 174 | 179 |
* @param sortedBySize |
| 175 | 180 |
* @return |
| 176 | 181 |
*/ |
| 177 | 182 |
public List<Part> getParts(boolean sortedBySize) {
|
| 178 |
if(sortedBySize) {
|
|
| 183 |
if (sortedBySize) {
|
|
| 179 | 184 |
return this.partsSortedBySize; |
| 180 | 185 |
} |
| 181 |
else {
|
|
| 186 |
else {
|
|
| 182 | 187 |
return this.parts; |
| 183 | 188 |
} |
| 184 | 189 |
} |
| ... | ... | |
| 186 | 191 |
|
| 187 | 192 |
/** |
| 188 | 193 |
* Gets the corpus of the linked partition. |
| 194 |
* |
|
| 189 | 195 |
* @return |
| 190 | 196 |
*/ |
| 191 |
public CQPCorpus getCorpus() {
|
|
| 197 |
public CQPCorpus getCorpus() {
|
|
| 192 | 198 |
return this.getPartition().getParent(); |
| 193 | 199 |
} |
| 194 |
|
|
| 195 |
|
|
| 200 |
|
|
| 201 |
|
|
| 196 | 202 |
@Override |
| 197 | 203 |
public String getSimpleName() {
|
| 198 | 204 |
return PartitionCoreMessages.RESULT_TYPE; |
| ... | ... | |
| 200 | 206 |
|
| 201 | 207 |
|
| 202 | 208 |
@Override |
| 203 |
public String getName() {
|
|
| 209 |
public String getName() {
|
|
| 204 | 210 |
try {
|
| 205 | 211 |
return PartitionCoreMessages.bind(PartitionCoreMessages.dimensionsColonP0, this.getParent().getName()); |
| 206 | 212 |
} |
| 207 |
catch(Exception e) {
|
|
| 208 |
}
|
|
| 213 |
catch (Exception e) {
|
|
| 214 |
} |
|
| 209 | 215 |
return ""; //$NON-NLS-1$ |
| 210 | 216 |
} |
| 211 |
|
|
| 212 |
|
|
| 217 |
|
|
| 218 |
|
|
| 213 | 219 |
@Override |
| 214 | 220 |
public String getDetails() {
|
| 215 | 221 |
return this.getName(); |
| 216 | 222 |
} |
| 217 |
|
|
| 218 |
|
|
| 223 |
|
|
| 224 |
|
|
| 219 | 225 |
@Override |
| 220 | 226 |
public boolean toTxt(File arg0, String arg1, String arg2, String arg3) throws Exception {
|
| 221 | 227 |
// TODO Auto-generated method stub |
| 222 | 228 |
return false; |
| 223 | 229 |
} |
| 224 |
|
|
| 225 |
|
|
| 226 |
|
|
| 230 |
|
|
| 231 |
|
|
| 232 |
|
|
| 227 | 233 |
/** |
| 228 | 234 |
* @return the sortBySize |
| 229 | 235 |
*/ |
| 230 | 236 |
public boolean isSortingBySize() {
|
| 231 | 237 |
return sortBySize; |
| 232 | 238 |
} |
| 233 |
|
|
| 234 |
|
|
| 235 |
|
|
| 239 |
|
|
| 240 |
|
|
| 241 |
|
|
| 236 | 242 |
/** |
| 237 | 243 |
* @param sortBySize the sortBySize to set |
| 238 | 244 |
*/ |
| 239 | 245 |
public void setSortBySize(boolean sortBySize) {
|
| 240 | 246 |
this.sortBySize = sortBySize; |
| 241 | 247 |
} |
| 242 |
|
|
| 243 |
|
|
| 244 |
|
|
| 248 |
|
|
| 249 |
|
|
| 250 |
|
|
| 245 | 251 |
/** |
| 246 | 252 |
* @return the displayPartCountInTitle |
| 247 | 253 |
*/ |
| 248 | 254 |
public boolean isDisplayingPartCountInTitle() {
|
| 249 | 255 |
return displayPartsCountInTitle; |
| 250 | 256 |
} |
| 251 |
|
|
| 257 |
|
|
| 252 | 258 |
@Override |
| 253 | 259 |
public String getResultType() {
|
| 254 | 260 |
return PartitionCoreMessages.RESULT_TYPE; |
| 255 | 261 |
} |
| 256 |
|
|
| 257 |
} |
|
| 262 |
|
|
| 263 |
} |
|
Formats disponibles : Unified diff