Ok - just to help you in terms of debugging your own code. First check that the indices being referenced are valid for your array. e.g.:
- String getString(int rowIndex, int column) {
- println("index: " + rowIndex + " column: " + column);
- return data[rowIndex][column];
- }
Now when I tried this the indices looked perfectly reasonable, which suggested a problem with the array... I tried printing out the length of the pieces arrays - I got lots of ones, which seemed strange. So I looked at the code generating the arrays and was struck by line 20 of the Table class:
- String[] pieces = split(rows[i], TAB);
...But when I copied the .tsv data (that's
tab separated values) across I had noticed that the values weren't separated by tabs, but by spaces... So you can either fix your data, or split on spaces (i.e. split(rows[i], " "); ) instead; though I'm not sure I'd consider a space as a particularly safe delimiter...