From: Sasa M. <sa...@us...> - 2004-11-05 12:23:02
|
Update of /cvsroot/jrobin/src/org/jrobin/core/jrrd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4852/org/jrobin/core/jrrd Modified Files: Archive.java Log Message: Major bug removed from the jrrd package (archived values were only partialy imported). Minor changes to Demo.java. Index: Archive.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/jrrd/Archive.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Archive.java 22 Jul 2004 09:34:10 -0000 1.1 --- Archive.java 5 Nov 2004 12:22:52 -0000 1.2 *************** *** 290,294 **** --- 290,321 ---- } + /* + // THIS IS THE ORIGINAL CODE: BUGGY! Replaced by Sasa Markovic with a new method + // Funny: the bug will appear only if dsCount != 2 :) + public double[][] getValuesOriginal() throws IOException { + if (values != null) { + return values; + } + values = new double[db.header.dsCount][rowCount]; + int row = currentRow; + db.rrdFile.ras.seek(dataOffset + (row + 1) * 16); // <----- BUG (resolved below) + for (int counter = 0; counter < rowCount; counter++) { + row++; + if (row == rowCount) { + row = 0; + db.rrdFile.ras.seek(dataOffset); + } + for (int col = 0; col < db.header.dsCount; col++) { + double value = db.rrdFile.readDouble(); + values[col][counter] = value; + } + } + return values; + } + */ + + // Resolved bug from the original method (see above) public double[][] getValues() throws IOException { + // OK PART if (values != null) { return values; *************** *** 296,300 **** values = new double[db.header.dsCount][rowCount]; int row = currentRow; ! db.rrdFile.ras.seek(dataOffset + (row + 1) * 16); for (int counter = 0; counter < rowCount; counter++) { row++; --- 323,329 ---- values = new double[db.header.dsCount][rowCount]; int row = currentRow; ! // HERE ARE THE DRAGONS! ! db.rrdFile.ras.seek(dataOffset + (row + 1) * db.header.dsCount * 8); ! // OK, TOO! for (int counter = 0; counter < rowCount; counter++) { row++; |