return new RowPointer(this, row);
public void write(PrintWriter writer) { for (int i = 0 ; i < getColumnCount(); i++) { if (i != 0) { writer.print('\t'); } writer.print(getString(i)); } } }
public void print() { write(new PrintWriter(System.out)); }
return new RowPointer(this, row);
/** * Return a mapping that connects the entry from a column back to the row * from which it came. For instance: * <pre> * Table t = loadTable("country-data.tsv", "header"); * // use the contents of the 'country' column to index the table * Map<String, TableRow> lookup = t.getRowMap("country"); * // get the row that has "us" in the "country" column: * TableRow usRow = lookup.get("us"); * // get an entry from the 'population' column * int population = usRow.getInt("population"); * </pre> */ public Map<String, TableRow> getRowMap(int column) { Map<String, TableRow> outgoing = new HashMap<>(); for (int row = 0; row < getRowCount(); row++) { String id = getString(row, column); outgoing.put(id, new RowPointer(this, row)); } // for (TableRow row : rows()) { // String id = row.getString(column); // outgoing.put(id, row); // } return outgoing; }
/** * @webref table:method * @brief Finds a row that matches the given expression * @param regexp the regular expression to match * @param column ID number of the column to search * @see Table#getRow(int) * @see Table#rows() * @see Table#findRow(String, int) * @see Table#findRows(String, int) * @see Table#matchRows(String, int) */ public TableRow matchRow(String regexp, int column) { int row = matchRowIndex(regexp, column); return (row == -1) ? null : new RowPointer(this, row); }
/** * @webref table:method * @brief Finds a row that contains the given value * @param value the value to match * @param column ID number of the column to search * @see Table#getRow(int) * @see Table#rows() * @see Table#findRows(String, int) * @see Table#matchRow(String, int) * @see Table#matchRows(String, int) */ public TableRow findRow(String value, int column) { int row = findRowIndex(value, column); return (row == -1) ? null : new RowPointer(this, row); }
/** * @webref table:method * @brief Finds a row that matches the given expression * @param regexp the regular expression to match * @param column ID number of the column to search * @see Table#getRow(int) * @see Table#rows() * @see Table#findRow(String, int) * @see Table#findRows(String, int) * @see Table#matchRows(String, int) */ public TableRow matchRow(String regexp, int column) { int row = matchRowIndex(regexp, column); return (row == -1) ? null : new RowPointer(this, row); }
/** * @webref table:method * @brief Finds a row that contains the given value * @param value the value to match * @param column ID number of the column to search * @see Table#getRow(int) * @see Table#rows() * @see Table#findRows(String, int) * @see Table#matchRow(String, int) * @see Table#matchRows(String, int) */ public TableRow findRow(String value, int column) { int row = findRowIndex(value, column); return (row == -1) ? null : new RowPointer(this, row); }
public TableRow next() { rp.setRow(++row); return rp; }
/** * @webref table:method * @brief Gets a row from a table * @param row ID number of the row to get * @see Table#rows() * @see Table#findRow(String, int) * @see Table#findRows(String, int) * @see Table#matchRow(String, int) * @see Table#matchRows(String, int) */ public TableRow getRow(int row) { return new RowPointer(this, row); }
public TableRow next() { rp.setRow(indices[++index]); return rp; }
public RowIndexIterator(Table table, int[] indices) { this.table = table; this.indices = indices; index = -1; // just set to something arbitrary rp = new RowPointer(table, -1); }
/** * @webref table:method * @brief Adds a row to a table * @see Table#removeRow(int) * @see Table#clearRows() */ public TableRow addRow() { //if (rowIncrement == 0) { setRowCount(rowCount + 1); return new RowPointer(this, rowCount - 1); }
/** * @webref table:method * @brief Gets a row from a table * @param row ID number of the row to get * @see Table#rows() * @see Table#findRow(String, int) * @see Table#findRows(String, int) * @see Table#matchRow(String, int) * @see Table#matchRows(String, int) */ public TableRow getRow(int row) { return new RowPointer(this, row); }
/** * @nowebref */ public TableRow addRow(Object[] columnData) { setRow(getRowCount(), columnData); return new RowPointer(this, rowCount - 1); }
public TableRow next() { rp.setRow(++row); return rp; }
public RowIterator(Table table) { this.table = table; row = -1; rp = new RowPointer(table, row); }
/** * @nowebref */ public TableRow addRow(Object[] columnData) { setRow(getRowCount(), columnData); return new RowPointer(this, rowCount - 1); }
/** * @webref table:method * @brief Adds a row to a table * @see Table#removeRow(int) * @see Table#clearRows() */ public TableRow addRow() { //if (rowIncrement == 0) { setRowCount(rowCount + 1); return new RowPointer(this, rowCount - 1); }