Skip to content

Commit 9a678ee

Browse files
committed
testing out a lookup function
1 parent e107f6d commit 9a678ee

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

core/src/processing/data/Table.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4418,13 +4418,13 @@ public FloatDict getFloatDict(String keyColumnName, String valueColumnName) {
44184418

44194419
public FloatDict getFloatDict(int keyColumn, int valueColumn) {
44204420
return new FloatDict(getStringColumn(keyColumn),
4421-
getFloatColumn(valueColumn));
4421+
getFloatColumn(valueColumn));
44224422
}
44234423

44244424

44254425
public StringDict getStringDict(String keyColumnName, String valueColumnName) {
44264426
return new StringDict(getStringColumn(keyColumnName),
4427-
getStringColumn(valueColumnName));
4427+
getStringColumn(valueColumnName));
44284428
}
44294429

44304430

@@ -4434,6 +4434,26 @@ public StringDict getStringDict(int keyColumn, int valueColumn) {
44344434
}
44354435

44364436

4437+
public Map<String, TableRow> getRowMap(String columnName) {
4438+
int col = getColumnIndex(columnName);
4439+
return (col == -1) ? null : getRowMap(col);
4440+
}
4441+
4442+
4443+
public Map<String, TableRow> getRowMap(int column) {
4444+
Map<String, TableRow> outgoing = new HashMap<>();
4445+
for (int row = 0; row < getRowCount(); row++) {
4446+
String id = getString(row, column);
4447+
outgoing.put(id, new RowPointer(this, row));
4448+
}
4449+
// for (TableRow row : rows()) {
4450+
// String id = row.getString(column);
4451+
// outgoing.put(id, row);
4452+
// }
4453+
return outgoing;
4454+
}
4455+
4456+
44374457
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44384458

44394459

core/todo.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
0253 (3.2.1)
22
X implement defaultUncaughtExceptionHandler
33
X helps avoid needing to double-quit OS X applications
4+
X add getRowMap() function
5+
_ do we want rows() to not be transient?
46

57

68
started

0 commit comments

Comments
 (0)