Révision 1365
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/data/MatrixImpl.java (revision 1365) | ||
---|---|---|
38 | 38 |
|
39 | 39 |
import org.rosuda.REngine.REXP; |
40 | 40 |
import org.rosuda.REngine.REXPMismatchException; |
41 |
import org.txm.core.messages.TXMCoreMessages; |
|
41 | 42 |
import org.txm.statsengine.core.StatException; |
42 | 43 |
import org.txm.statsengine.core.data.Matrix; |
43 | 44 |
import org.txm.statsengine.core.data.Vector; |
... | ... | |
48 | 49 |
import org.txm.statsengine.r.core.exceptions.RWorkspaceException; |
49 | 50 |
import org.txm.utils.CharsetDetector; |
50 | 51 |
import org.txm.utils.OSDetector; |
52 |
import org.txm.utils.io.IOUtils; |
|
51 | 53 |
import org.txm.utils.logger.Log; |
52 | 54 |
|
53 | 55 |
import cern.colt.matrix.DoubleMatrix2D; |
... | ... | |
434 | 436 |
int ncol = this.getNColumns(); |
435 | 437 |
|
436 | 438 |
if (index < 0 || index >= ncol) { |
437 |
throw new IllegalArgumentException(StatsEngineCoreMessages.columnIndex + index |
|
438 |
+ StatsEngineCoreMessages.tooBigMax + ncol + ")"); //$NON-NLS-1$ |
|
439 |
throw new IllegalArgumentException(StatsEngineCoreMessages.bind(StatsEngineCoreMessages.columnIndex, index, ncol)); |
|
439 | 440 |
} |
440 | 441 |
String colName = createSymbole(Vector.class); |
441 | 442 |
rw.voidEval(colName + "<- " + symbol + "[ ," + (index + 1) + "];"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
... | ... | |
460 | 461 |
try { |
461 | 462 |
return new VectorImpl("colnames("+this.getSymbol()+")"); //$NON-NLS-1$ //$NON-NLS-2$ |
462 | 463 |
} catch (RWorkspaceException e) { |
463 |
// TODO Auto-generated catch block |
|
464 | 464 |
org.txm.utils.logger.Log.printStackTrace(e); |
465 | 465 |
return null; |
466 | 466 |
} |
... | ... | |
471 | 471 |
REXP rexp = RWorkspace.getRWorkspaceInstance().eval(this.symbol); |
472 | 472 |
return asIntMatrix(rexp); |
473 | 473 |
} catch (RWorkspaceException e) { |
474 |
// TODO Auto-generated catch block |
|
475 | 474 |
org.txm.utils.logger.Log.printStackTrace(e); |
476 | 475 |
} catch (REXPMismatchException e) { |
477 |
// TODO Auto-generated catch block |
|
478 | 476 |
org.txm.utils.logger.Log.printStackTrace(e); |
479 | 477 |
} |
480 | 478 |
return null; |
... | ... | |
538 | 536 |
try { |
539 | 537 |
return new VectorImpl("rownames("+this.getSymbol()+")"); //$NON-NLS-1$ //$NON-NLS-2$ |
540 | 538 |
} catch (RWorkspaceException e) { |
541 |
// TODO Auto-generated catch block |
|
542 | 539 |
org.txm.utils.logger.Log.printStackTrace(e); |
543 | 540 |
return null; |
544 | 541 |
} |
... | ... | |
579 | 576 |
String path = f.getAbsolutePath(); |
580 | 577 |
|
581 | 578 |
CharsetDetector guesser = new CharsetDetector(f); |
582 |
if (!("UTF-8".equals(guesser.getEncoding().toUpperCase()))) {
|
|
583 |
System.out.println("Warning: file encoding seems to not be 'UTF-8' but '"+guesser.getEncoding()+"'");
|
|
579 |
if (!(IOUtils.UTF8.equals(guesser.getEncoding().toUpperCase()))) {
|
|
580 |
System.out.println(TXMCoreMessages.bind("Warning: file encoding seems to not be 'UTF-8' but '{0}'", guesser.getEncoding()));
|
|
584 | 581 |
} |
585 | 582 |
|
586 | 583 |
int nline = 0; |
587 | 584 |
try { |
588 |
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f), "UTF-8"));
|
|
585 |
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(f), IOUtils.UTF8));
|
|
589 | 586 |
while(reader.readLine() != null) nline++; |
590 | 587 |
reader.close(); |
591 | 588 |
} catch(Exception e) { } |
592 | 589 |
|
593 | 590 |
if (nline == 0) { |
594 |
System.out.println("Error: the file is empty");
|
|
591 |
Log.severe(TXMCoreMessages.bind("Error: the file {0} is empty.", f));
|
|
595 | 592 |
return false; |
596 | 593 |
} |
597 | 594 |
|
... | ... | |
610 | 607 |
int linesize = rw.eval("dim(tmpmat)[1]").asInteger(); //$NON-NLS-1$ |
611 | 608 |
int ncol = this.getNColumns(); |
612 | 609 |
if (colsize != ncol) { |
613 |
System.out.println(StatsEngineCoreMessages.matrixImplDDotErrorDDotColumnSizeDiffersDDotOriginal+ncol+" imported="+colsize); //$NON-NLS-2$
|
|
610 |
Log.severe(TXMCoreMessages.bind(StatsEngineCoreMessages.matrixImplDDotErrorDDotColumnSizeDiffersDDotOriginal, ncol, colsize));
|
|
614 | 611 |
return false; |
615 | 612 |
} |
616 | 613 |
|
... | ... | |
618 | 615 |
|
619 | 616 |
nline--; |
620 | 617 |
if (nline != linesize) { |
621 |
System.out.println("Warning: some lines have not been read. Check your file format (header, encoding=UTF-8, separator=TAB)"); |
|
622 |
System.out.println("Number of lines in the file="+nline);
|
|
623 |
System.out.println("Number of lines in the matrix="+linesize);
|
|
618 |
System.out.println("Warning: some lines have not been read. Check your file format (header, encoding=UTF-8, separator=TAB).");
|
|
619 |
System.out.println(TXMCoreMessages.bind("Number of lines in the file={0}.", nline));
|
|
620 |
System.out.println(TXMCoreMessages.bind("Number of lines in the matrix={0}.", linesize));
|
|
624 | 621 |
} |
625 | 622 |
return true; |
626 | 623 |
} |
... | ... | |
917 | 914 |
int nrow = this.getNRows(); |
918 | 915 |
int ncol = this.getNColumns(); |
919 | 916 |
if (row < 0 || row >= nrow) { |
920 |
throw new IllegalArgumentException(StatsEngineCoreMessages.rowIndex + row |
|
921 |
+ StatsEngineCoreMessages.tooBigMax + nrow + ")"); //$NON-NLS-1$ |
|
917 |
throw new IllegalArgumentException(StatsEngineCoreMessages.bind(StatsEngineCoreMessages.rowIndex, row, nrow)); |
|
922 | 918 |
} |
923 | 919 |
if (col < 0 || col >= ncol) { |
924 |
throw new IllegalArgumentException(StatsEngineCoreMessages.colIndex + col |
|
925 |
+ StatsEngineCoreMessages.tooBigMax + ncol + ")"); //$NON-NLS-1$ |
|
920 |
throw new IllegalArgumentException(StatsEngineCoreMessages.bind(StatsEngineCoreMessages.colIndex, col, ncol)); |
|
926 | 921 |
} |
927 | 922 |
// appel à R |
928 | 923 |
try { |
tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/messages/messages_fr.properties (revision 1365) | ||
---|---|---|
10 | 10 |
|
11 | 11 |
cannotDeleteANonexistingObject = ** Impossible de supprimer un objet qui n'existe pas. |
12 | 12 |
|
13 |
cannotDeleteAllLines = Impossible de supprimer toutes les lignes |
|
13 |
cannotDeleteAllLines = Impossible de supprimer toutes les lignes.
|
|
14 | 14 |
|
15 |
colIndex = Index de colonne (
|
|
15 |
colIndex = .Index de colonne ({0}) trop grand (max {1}).
|
|
16 | 16 |
|
17 | 17 |
columnIndex = Index de colonne ( |
18 | 18 |
|
... | ... | |
20 | 20 |
|
21 | 21 |
error_statsEngineNotReadyCancelingCommand = Le moteur de statistiques n'est pas initialisé, annulation de la commande. |
22 | 22 |
|
23 |
failedToGetRowNames = Impossible d'obtenir les noms de lignes |
|
23 |
failedToGetRowNames = Impossible d'obtenir les noms de lignes.
|
|
24 | 24 |
|
25 | 25 |
innerArraysMustBeOfDimensionSup0 = ** Les tableaux internes doivent avoir une dimension supérieure à 0 |
26 | 26 |
|
27 | 27 |
matrixDDotFailedToGetNrowDDot = Matrice: impossible d'obtenir le nombre de lignes: {0}. |
28 | 28 |
|
29 |
matrixImplDDotErrorDDotColumnSizeDiffersDDotOriginal = MatrixImpl: Erreur: la taille des colonnes diffère de l'originale |
|
29 |
matrixImplDDotErrorDDotColumnSizeDiffersDDotOriginal = MatrixImpl: Erreur: la taille des colonnes diffère de l'originale : originale {0}, importée {1}.
|
|
30 | 30 |
|
31 | 31 |
mode = mode |
32 | 32 |
|
... | ... | |
36 | 36 |
|
37 | 37 |
rObjectEvaluatedToNull = L'objet R a une valeur nulle. |
38 | 38 |
|
39 |
rowIndex = Index de ligne ({0}) trop grand (max {1}) |
|
39 |
rowIndex = Index de ligne ({0}) trop grand (max {1}).
|
|
40 | 40 |
|
41 | 41 |
rowNamesOfAContingencyTableCannotBeNull = Les noms de lignes d'une matrice de contingence ne peuvent pas être nuls. |
42 | 42 |
|
43 | 43 |
theIndexArrayCanNotBeNullOrEmpty = ** Le tableau d'index ne peut pas être nul ou vide. |
44 | 44 |
|
45 |
tooBigMax = ) trop grand (max |
|
46 |
|
|
47 | 45 |
unknownTypeDDot = Type inconnu : {0}. |
tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/messages/messages.properties (revision 1365) | ||
---|---|---|
10 | 10 |
|
11 | 11 |
cannotDeleteANonexistingObject = ** Cannot delete a non-existing object. |
12 | 12 |
|
13 |
cannotDeleteAllLines = Cannot delete all lines |
|
13 |
cannotDeleteAllLines = Cannot delete all lines.
|
|
14 | 14 |
|
15 |
colIndex = Col index ( |
|
15 |
colIndex = Col index ({0}) too big (max {1}).
|
|
16 | 16 |
|
17 | 17 |
columnIndex = Column index ( |
18 | 18 |
|
19 |
columnNamesOfAContingencyTableCannotBeNull = Column names of a contingency table cannot be null |
|
19 |
columnNamesOfAContingencyTableCannotBeNull = Column names of a contingency table cannot be null.
|
|
20 | 20 |
|
21 | 21 |
error_statsEngineNotReadyCancelingCommand = Statistics Engine is not ready, canceling command. |
22 | 22 |
|
23 |
failedToGetRowNames = Failed to get row names |
|
23 |
failedToGetRowNames = Failed to get row names.
|
|
24 | 24 |
|
25 | 25 |
innerArraysMustBeOfDimensionSup0 = ** Inner arrays must be of dimension > 0. |
26 | 26 |
|
27 | 27 |
matrixDDotFailedToGetNrowDDot = Matrix: failed to get nrow: {0}. |
28 | 28 |
|
29 |
matrixImplDDotErrorDDotColumnSizeDiffersDDotOriginal = MatrixImpl: Error: column size differs: original
|
|
29 |
matrixImplDDotErrorDDotColumnSizeDiffersDDotOriginal = MatrixImpl: Error: column sizes differ: original {0}, imported {1}.
|
|
30 | 30 |
|
31 | 31 |
mode = mode |
32 | 32 |
|
... | ... | |
36 | 36 |
|
37 | 37 |
rObjectEvaluatedToNull = R object evaluated to null. |
38 | 38 |
|
39 |
rowIndex = Row index ({0}) too big (max {1}) |
|
39 |
rowIndex = Row index ({0}) too big (max {1}).
|
|
40 | 40 |
|
41 | 41 |
rowNamesOfAContingencyTableCannotBeNull = Row names of a contingency table cannot be null. |
42 | 42 |
|
43 | 43 |
theIndexArrayCanNotBeNullOrEmpty = ** The index array can not be null or empty. |
44 | 44 |
|
45 |
tooBigMax = ) too big (max |
|
46 |
|
|
47 | 45 |
unknownTypeDDot = Unknown type: {0}. |
tmp/org.txm.statsengine.core/src/org/txm/statsengine/core/messages/StatsEngineCoreMessages.java (revision 1365) | ||
---|---|---|
25 | 25 |
public static String aZerobasedIndexCannotBeInf0OrSupToTheNumberOfIndexedElements; |
26 | 26 |
public static String notImplemented; |
27 | 27 |
public static String rowIndex; |
28 |
public static String tooBigMax; |
|
29 | 28 |
public static String colIndex; |
30 | 29 |
public static String rObjectEvaluatedToNull; |
31 | 30 |
public static String unknownTypeDDot; |
Formats disponibles : Unified diff