public class Calculator{ private Table table = new DefaultTable(); public synchronized Result calculate(){ // implementation } public synchronized void setTable(Table newtable){ this.table = newtable } }
/** * Fill a table row * @param table The table to be filled * @param row A map containing the column values * @param rowIndex The index of the row to te filled */ private void fillRow(DefaultTable table, Map<String, Object> row, int rowIndex) { try { table.addRow(); // set the column values for the current row for (Map.Entry<String, Object> column : row.entrySet()) { table.setValue(rowIndex, column.getKey(), column.getValue()); } } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } } }
/** * Fill a table row * * @param table * The table to be filled * @param row * A map containing the column values * @param rowIndex * The index of the row to te filled */ private void fillRow(DefaultTable table, Map<String, Object> row, int rowIndex) { try { if(!row.entrySet().isEmpty()){ table.addRow(); // set the column values for the current row for (Map.Entry<String, Object> column : row.entrySet()) { table.setValue(rowIndex, column.getKey(), column.getValue()); } } } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); } } }
ITable[] tables = { new DefaultTable(...), new DefaultTable(...), ... };
while (resultSet.next()) { String tableName = resultSet.getString(3); dataset.addTable(new DefaultTable(tableName));
public class Calculator{ private final Object monitor = new Object(); private Table table = new DefaultTable(); public Result calculate() { synchronize (monitor) { // implementation } } public void setTable(Table newtable){ synchronize (monitor) { this.table = newtable } } }
ITableMetaData meta = getMetaData(entry.getKey(), rows); DefaultTable table = new DefaultTable(meta); int rowIndex = 0;
ITableMetaData meta = getMetaData(entry.getKey(), rows); DefaultTable table = new DefaultTable(meta); int rowIndex = 0;