that ain't supposed to be in there

This commit is contained in:
Ben Fry
2016-07-31 20:05:56 -04:00
parent b65249d532
commit acafc7464a

View File

@@ -739,93 +739,6 @@ public class Table {
}
return csl.handle(line, reader);
}
/*
static protected String[] splitLineCSV(String line, BufferedReader reader) throws IOException {
char[] c = line.toCharArray();
// get tally of number of columns and allocate the array
int cols = 1; // the first comma indicates the second column
boolean quote = false;
for (int i = 0; i < c.length; i++) {
if (!quote && (c[i] == ',')) {
cols++;
} else if (c[i] == '\"') {
// double double quotes (escaped quotes like "") will simply toggle
// this back and forth, so it should remain accurate
quote = !quote;
}
}
String[] pieces = new String[cols];
// now do actual parsing
int pieceCount = 0;
int offset = 0;
while (offset < c.length) {
int start = offset;
int stop = nextComma(c, offset);
while (stop == -1) {
// found a newline inside the quote, grab another line
String nextLine = reader.readLine();
System.out.println("extending to " + nextLine);
if (nextLine == null) {
System.err.println(line);
throw new IOException("Found a quoted line that wasn't terminated properly.");
}
char[] temp = new char[c.length + 1 + nextLine.length()];
PApplet.arrayCopy(c, temp, c.length);
// NOTE: we're converting to \n here, which isn't perfect
temp[c.length] = '\n';
line.getChars(0, nextLine.length(), temp, c.length + 1);
c = temp;
stop = nextComma(c, offset);
System.out.println("stop is now " + stop);
}
offset = stop + 1; // next time around, need to step over the comment
if (c[start] == '\"' && c[stop-1] == '\"') {
start++;
stop--;
}
int i = start;
int ii = start;
while (i < stop) {
if (c[i] == '\"') {
i++; // skip over pairs of double quotes become one
}
if (i != ii) {
c[ii] = c[i];
}
i++;
ii++;
}
/*
if (autoTyping) {
if (autoTypes == null) {
autoTypes = new int[pieces.length];
} else {
if (autoTypes.length < pieces.length) {
}
Double.parseDouble("");
Float.parseFloat("blah");
// if (autoTypes[pieceCount]) {
//
// }
}
}
*/
String s = new String(c, start, ii - start);
pieces[pieceCount++] = s;
}
// Make any remaining entries blanks instead of nulls. Empty columns from
// CSV are always "" not null, so this handles successive commas in a line
for (int i = pieceCount; i < pieces.length; i++) {
pieces[i] = "";
}
return pieces;
}
*/
/**