Corrected dump function in FunctionArea. Each data column needs its own time column.

This commit is contained in:
Marcel Kronfeld 2010-10-25 10:09:54 +00:00
parent ca903ef4df
commit dbbd5a5786

View File

@ -679,20 +679,16 @@ public class FunctionArea extends DArea implements Serializable {
public boolean exportToAscii(File file) { public boolean exportToAscii(File file) {
String[] s = null; String[] s = null;
int maxSize = 0; int maxSize = 0;
DPointSet maxSet = null;
for (int i = 0; i < m_PointSetContainer.size(); i++) { for (int i = 0; i < m_PointSetContainer.size(); i++) {
// find maximum length of all point sets // find maximum length of all point sets
if (m_PointSetContainer.get(i).getConnectedPointSet().getSize() > maxSize) { if (m_PointSetContainer.get(i).getConnectedPointSet().getSize() > maxSize) {
maxSet = m_PointSetContainer.get(i).getConnectedPointSet(); maxSize = m_PointSetContainer.get(i).getConnectedPointSet().getSize();
maxSize = maxSet.getSize();
} }
} }
if (maxSize > 0) { // if there is any data, init string array and set x if (maxSize > 0) { // if there is any data, init string array and set x
// value column // value column
s = new String[maxSize + 1]; s = new String[maxSize+1];
s[0] = "calls"; for (int j = 0; j <= maxSize; j++) s[j] = "";
for (int j = 1; j <= maxSize; j++)
s[j] = "" + maxSet.getDPoint(j - 1).x;
} else { } else {
System.err.println("Error: no data to export"); System.err.println("Error: no data to export");
return true; return true;
@ -701,16 +697,13 @@ public class FunctionArea extends DArea implements Serializable {
if (m_PointSetContainer.get(i) instanceof GraphPointSet) { if (m_PointSetContainer.get(i) instanceof GraphPointSet) {
GraphPointSet set = (GraphPointSet) m_PointSetContainer.get(i); GraphPointSet set = (GraphPointSet) m_PointSetContainer.get(i);
DPointSet pset = set.getConnectedPointSet(); DPointSet pset = set.getConnectedPointSet();
s[0] = s[0] + " " + cleanBlanks(set.getInfoString(), '_'); // add // add column names
// column s[0] = s[0] + " t " + cleanBlanks(set.getInfoString(), '_');
// name
for (int j = 1; j < s.length; j++) { // add column data of place for (int j = 1; j < s.length; j++) { // add column data of place
// holder if no value in
// this set
if ((j - 1) < pset.getSize()) if ((j - 1) < pset.getSize())
s[j] = s[j] + " " + pset.getDPoint(j - 1).y; s[j] = s[j] + " " + pset.getDPoint(j - 1).x + " " + pset.getDPoint(j - 1).y;
else else
s[j] += " #"; s[j] += " ? ?"; // placeholder if no value in this set
} }
} else } else
System.err.println("error in FunctionArea::exportToAscii"); System.err.println("error in FunctionArea::exportToAscii");