diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java index 5d86e45bb..796491dc5 100644 --- a/core/src/processing/data/Table.java +++ b/core/src/processing/data/Table.java @@ -4418,13 +4418,13 @@ public class Table { public FloatDict getFloatDict(int keyColumn, int valueColumn) { return new FloatDict(getStringColumn(keyColumn), - getFloatColumn(valueColumn)); + getFloatColumn(valueColumn)); } public StringDict getStringDict(String keyColumnName, String valueColumnName) { return new StringDict(getStringColumn(keyColumnName), - getStringColumn(valueColumnName)); + getStringColumn(valueColumnName)); } @@ -4434,6 +4434,26 @@ public class Table { } + public Map getRowMap(String columnName) { + int col = getColumnIndex(columnName); + return (col == -1) ? null : getRowMap(col); + } + + + public Map getRowMap(int column) { + Map 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; + } + + // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . diff --git a/core/todo.txt b/core/todo.txt index 6c82a318e..aa0e23064 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,6 +1,8 @@ 0253 (3.2.1) X implement defaultUncaughtExceptionHandler X helps avoid needing to double-quit OS X applications +X add getRowMap() function +_ do we want rows() to not be transient? started