diff --git a/core/src/processing/data/Table.java b/core/src/processing/data/Table.java index 61b2fbd0a..973f01ee0 100644 --- a/core/src/processing/data/Table.java +++ b/core/src/processing/data/Table.java @@ -2223,53 +2223,6 @@ public class Table { // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . - /** - * Remove any of the specified characters from the entire table. - */ - public void removeTokens(String tokens) { - for (int col = 0; col < getColumnCount(); col++) { - removeTokens(tokens, col); - } - } - - - /** - * Removed any of the specified characters from a column. For instance, - * the following code removes dollar signs and commas from column 2: - *
- * table.removeTokens(",$", 2);
- *
- */
- public void removeTokens(String tokens, int column) {
- for (int row = 0; row < rowCount; row++) {
- String s = getString(row, column);
- if (s != null) {
- char[] c = s.toCharArray();
- int index = 0;
- for (int j = 0; j < c.length; j++) {
- if (tokens.indexOf(c[j]) == -1) {
- if (index != j) {
- c[index] = c[j];
- }
- index++;
- }
- }
- if (index != c.length) {
- setString(row, column, new String(c, 0, index));
- }
- }
- }
- }
-
-
- public void removeTokens(String tokens, String columnName) {
- removeTokens(tokens, getColumnIndex(columnName));
- }
-
-
- // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
-
-
/**
* Return the row that contains the first String that matches.
* @param value the String to match
@@ -2574,6 +2527,53 @@ public class Table {
// . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+ /**
+ * Remove any of the specified characters from the entire table.
+ */
+ public void removeTokens(String tokens) {
+ for (int col = 0; col < getColumnCount(); col++) {
+ removeTokens(tokens, col);
+ }
+ }
+
+
+ /**
+ * Removed any of the specified characters from a column. For instance,
+ * the following code removes dollar signs and commas from column 2:
+ *
+ * table.removeTokens(",$", 2);
+ *
+ */
+ public void removeTokens(String tokens, int column) {
+ for (int row = 0; row < rowCount; row++) {
+ String s = getString(row, column);
+ if (s != null) {
+ char[] c = s.toCharArray();
+ int index = 0;
+ for (int j = 0; j < c.length; j++) {
+ if (tokens.indexOf(c[j]) == -1) {
+ if (index != j) {
+ c[index] = c[j];
+ }
+ index++;
+ }
+ }
+ if (index != c.length) {
+ setString(row, column, new String(c, 0, index));
+ }
+ }
+ }
+ }
+
+
+ public void removeTokens(String tokens, String columnName) {
+ removeTokens(tokens, getColumnIndex(columnName));
+ }
+
+
+ // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+
+
public void trim() {
for (int col = 0; col < getColumnCount(); col++) {
trim(col);
diff --git a/core/todo.txt b/core/todo.txt
index 5e68e154a..4a9b762d4 100644
--- a/core/todo.txt
+++ b/core/todo.txt
@@ -6,33 +6,37 @@ X heading2D()? weird.. changed to heading()
X http://toxiclibs.org/docs/core/toxi/geom/Vec3D.html
X http://code.google.com/p/processing/issues/detail?id=987
-X lots of improvements/cleanups to Table class
-X added lastRowIndex()
-X rows() instead of getRows() (doesn't perform like our other get() functions)
-X it's more like keys() and values() in HashMap
-X addRow() returns TableRow object to be modified
-X lastRowIndex() (to avoid getRowCount() - 1)
-X not lastRow() because Row functions return TableRow object/intf
+table
+X added lastRowIndex()
+X rows() instead of getRows() (doesn't perform like our other get() functions)
+X it's more like keys() and values() in HashMap
+X addRow() returns TableRow object to be modified
+X lastRowIndex() (to avoid getRowCount() - 1)
+X not lastRow() because Row functions return TableRow object/intf
+X makeNullEmpty() -> replace(null, "");
+X makeEmptyNull() -> replace("", null);
+X saveTable("filename.tsv") or saveTable("filename.txt", "tsv")
+X createTable() method in PApplet
+X removed getUniqueXxxx() and some others, pending names
-X makeNullEmpty() -> replace(null, "");
-X makeEmptyNull() -> replace("", null);
+more table
+_ naming for these (or whether to include hash)
+_ Table createSubset() -> leave out?
+_ String[] getUnique(col)
+_ HashMap