ported core and data updates from Java mode · codeanticode/processing-android@751c5e8 · GitHub
Skip to content
This repository was archived by the owner on May 11, 2025. It is now read-only.

Commit 751c5e8

Browse files
committed
ported core and data updates from Java mode
1 parent 394fa89 commit 751c5e8

3 files changed

Lines changed: 111 additions & 2 deletions

File tree

core/src/processing/core/PApplet.java

Lines changed: 14 additions & 1 deletion

core/src/processing/data/StringDict.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,26 @@ public StringDict(String[][] pairs) {
130130
}
131131

132132

133+
/**
134+
* Create a dictionary that maps between column titles and cell entries
135+
* in a TableRow. If two columns have the same name, the later column's
136+
* values will override the earlier values.
137+
*/
138+
public StringDict(TableRow row) {
139+
this(row.getColumnCount());
140+
141+
String[] titles = row.getColumnTitles();
142+
if (titles == null) {
143+
titles = new StringList(IntList.fromRange(row.getColumnCount())).array();
144+
}
145+
for (int col = 0; col < row.getColumnCount(); col++) {
146+
set(titles[col], row.getString(col));
147+
}
148+
// remove unused and overwritten entries
149+
crop();
150+
}
151+
152+
133153
/**
134154
* @webref stringdict:method
135155
* @brief Returns the number of key/value pairs

core/src/processing/data/Table.java

Lines changed: 77 additions & 1 deletion

0 commit comments

Comments
 (0)