Generic class for handling tabular data, typically from a CSV, TSV, or other sort of spreadsheet file. CSV files are comma separated values , often with the data in quotes. TSV files use tabs as separators, and usually don't
| 61 | * @see TableRow |
| 62 | */ |
| 63 | public class Table { |
| 64 | protected int rowCount; |
| 65 | protected int allocCount; |
| 66 | |
| 67 | // protected boolean skipEmptyRows = true; |
| 68 | // protected boolean skipCommentLines = true; |
| 69 | // protected String extension = null; |
| 70 | // protected boolean commaSeparatedValues = false; |
| 71 | // protected boolean awfulCSV = false; |
| 72 | |
| 73 | protected String missingString = null; |
| 74 | protected int missingInt = 0; |
| 75 | protected long missingLong = 0; |
| 76 | protected float missingFloat = Float.NaN; |
| 77 | protected double missingDouble = Double.NaN; |
| 78 | protected int missingCategory = -1; |
| 79 | |
| 80 | String[] columnTitles; |
| 81 | HashMapBlows[] columnCategories; |
| 82 | HashMap<String, Integer> columnIndices; |
| 83 | |
| 84 | protected Object[] columns; // [column] |
| 85 | |
| 86 | // accessible for advanced users |
| 87 | static public final int STRING = 0; |
| 88 | static public final int INT = 1; |
| 89 | static public final int LONG = 2; |
| 90 | static public final int FLOAT = 3; |
| 91 | static public final int DOUBLE = 4; |
| 92 | static public final int CATEGORY = 5; |
| 93 | int[] columnTypes; |
| 94 | |
| 95 | protected RowIterator rowIterator; |
| 96 | |
| 97 | // 0 for doubling each time, otherwise the number of rows to increment on |
| 98 | // each expansion. |
| 99 | protected int expandIncrement; |
| 100 | |
| 101 | |
| 102 | /** |
| 103 | * Creates a new, empty table. Use addRow() to add additional rows. |
| 104 | */ |
| 105 | public Table() { |
| 106 | init(); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * @nowebref |
| 111 | */ |
| 112 | public Table(File file) throws IOException { |
| 113 | this(file, null); |
| 114 | } |
| 115 | |
| 116 | |
| 117 | /** |
| 118 | * version that uses a File object; future releases (or data types) |
| 119 | * may include additional optimizations here |
| 120 | * |
nothing calls this directly
no outgoing calls
no test coverage detected